s-address-item.vue 2.5 KB

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