address-card.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <view class="slot" :style="showBorderBottom ? '' : 'border-bottom:none'" @click="goPage(data)">
  3. <view class="info">
  4. <view class="item">
  5. <text class="tag" v-if="data.defaultFlag==1">默认</text>
  6. <text class="label">{{ data.fullAddress}}</text>
  7. </view>
  8. <view class="item">{{ data.detailAddress }}</view>
  9. <view class="item">
  10. <text>{{ data.name }}</text>
  11. <text>{{ data.mobile }}</text>
  12. </view>
  13. </view>
  14. <view class="operate" v-if="showEdit && isGoSelect"><u-icon size="32" name="edit-pen"></u-icon></view>
  15. <view class="operate" v-if="!showEdit && isGoSelect"><u-icon size="20" name="arrow-right"></u-icon></view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. name: 'address-card',
  21. props: {
  22. // 是否显示编辑按钮
  23. showEdit: {
  24. type: Boolean,
  25. default: false
  26. },
  27. // 数据源
  28. data: {
  29. type: Object,
  30. default: () => {
  31. return {};
  32. }
  33. },
  34. // 是否显示底部边框
  35. showBorderBottom: {
  36. type: Boolean,
  37. default: false
  38. },
  39. // 是否选择并返回
  40. isBack: {
  41. type: Boolean,
  42. default: false
  43. },
  44. // 是否能点击
  45. isGoSelect: {
  46. type: Boolean,
  47. default: true
  48. }
  49. },
  50. methods: {
  51. goPage(data) {
  52. if (!this.isGoSelect) return;
  53. if (this.showEdit) {
  54. uni.navigateTo({
  55. url: '/pages-mine/pages/address/add-or-update?id='+this.data.id
  56. });
  57. } else if (this.isBack) {
  58. console.log('emit',data)
  59. uni.$emit('addressInfo', data);
  60. uni.navigateBack({
  61. delta: 1
  62. });
  63. } else {
  64. uni.navigateTo({
  65. url: '/pages-mine/pages/address/list?isSelect=true&isBack=true'
  66. });
  67. }
  68. }
  69. }
  70. };
  71. </script>
  72. <style lang="scss" scoped>
  73. .slot {
  74. padding-top: 30rpx;
  75. padding-bottom: 30rpx;
  76. background-color: $app-theme-bg-color;
  77. display: flex;
  78. justify-content: space-between;
  79. align-items: center;
  80. border-bottom: 1rpx solid $app-theme-border-color;
  81. .tag {
  82. font-size: 20rpx;
  83. color: $app-theme-color;
  84. padding: 4rpx 14rpx;
  85. background-color: rgba($app-theme-color, 0.1);
  86. margin-right: 12rpx;
  87. }
  88. .item:nth-child(1) {
  89. margin-bottom: 12rpx;
  90. .label {
  91. font-size: 28rpx;
  92. color: $app-theme-text-black-color;
  93. font-weight: 400;
  94. }
  95. }
  96. .item:nth-child(2) {
  97. margin-bottom: 12rpx;
  98. font-size: 32rpx;
  99. color: $app-theme-text-black-color;
  100. font-weight: 500;
  101. }
  102. .item:nth-child(3) {
  103. text {
  104. font-size: 28rpx;
  105. color: $app-theme-text-black-color;
  106. font-weight: 400;
  107. margin-right: 16rpx;
  108. }
  109. }
  110. }
  111. </style>