s-address-item.vue 2.4 KB

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