s-address-item.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view
  3. class="address-item ss-flex ss-row-between ss-col-center"
  4. :class="[{ 'border-bottom': props.hasBorderBottom }]"
  5. >
  6. <view class="item-left" v-if="!isEmpty(props.item)">
  7. <view class="area-text ss-flex ss-col-center">
  8. <uni-tag
  9. class="ss-m-r-10"
  10. size="small"
  11. custom-style="background-color: var(--ui-BG-Main); border-color: var(--ui-BG-Main); color: #fff;"
  12. v-if="props.item.is_default"
  13. text="默认"
  14. ></uni-tag>
  15. {{ props.item.province_name }} {{ props.item.city_name }} {{ props.item.district_name }}
  16. </view>
  17. <view class="address-text">{{ props.item.address }}</view>
  18. <view class="person-text">{{ props.item.consignee }} {{ props.item.mobile }}</view>
  19. </view>
  20. <view v-else><view class="address-text ss-m-b-10">请选择收货地址</view></view>
  21. <slot>
  22. <button class="ss-reset-button edit-btn" @tap.stop="onEdit">
  23. <view class="edit-icon ss-flex ss-row-center ss-col-center">
  24. <image :src="sheep.$url.static('/static/img/shop/user/address/edit.png')"></image>
  25. </view>
  26. </button>
  27. </slot>
  28. </view>
  29. </template>
  30. <script setup>
  31. /**
  32. * 基础组件 - 地址卡片
  33. *
  34. * @param {String} icon = _icon-edit - icon
  35. *
  36. * @event {Function()} click - 点击
  37. * @event {Function()} actionClick - 点击工具栏
  38. *
  39. * @slot - 默认插槽
  40. */
  41. import sheep from '@/sheep';
  42. import { isEmpty } from 'lodash';
  43. const props = defineProps({
  44. item: {
  45. type: Object,
  46. default() {},
  47. },
  48. hasBorderBottom: {
  49. type: Boolean,
  50. defult: true,
  51. },
  52. });
  53. const onEdit = () => {
  54. sheep.$router.go('/pages/user/address/edit', {
  55. id: props.item.id,
  56. });
  57. };
  58. </script>
  59. <style lang="scss" scoped>
  60. .address-item {
  61. padding: 24rpx 30rpx;
  62. .item-left {
  63. width: 600rpx;
  64. }
  65. .area-text {
  66. font-size: 26rpx;
  67. font-weight: 400;
  68. color: $dark-9;
  69. }
  70. .address-text {
  71. font-size: 32rpx;
  72. font-weight: 500;
  73. color: #333333;
  74. line-height: 48rpx;
  75. }
  76. .person-text {
  77. font-size: 28rpx;
  78. font-weight: 400;
  79. color: $dark-9;
  80. }
  81. }
  82. .edit-btn {
  83. width: 44rpx;
  84. height: 44rpx;
  85. background: $gray-f;
  86. border-radius: 50%;
  87. .edit-icon {
  88. width: 24rpx;
  89. height: 24rpx;
  90. }
  91. }
  92. image {
  93. width: 100%;
  94. height: 100%;
  95. }
  96. </style>