s-address-item.vue 2.6 KB

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