普兆健康管家前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
2.6 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <view>
  3. <template v-if="data">
  4. <view class="flex user">
  5. <view>{{ data.name }}</view>
  6. <view class="flex">
  7. <text>{{ data.phone }}</text>
  8. <button v-if="enableCopy" class="btn btn-copy" @click="$utils.copyText(data.phone)">复制</button>
  9. </view>
  10. <view class="tag" v-if="data.defaultFlag">默认</view>
  11. </view>
  12. <view class="flex address">
  13. <image v-if="showIcon" class="icon" src="@/pages_order/static/address/icon-address.png" mode="scaleToFill"></image>
  14. <view>
  15. <text class="text">{{ displayAddress }}</text>
  16. <button v-if="enableCopy" class="btn btn-copy" @click="$utils.copyText(displayAddress)">复制</button>
  17. </view>
  18. </view>
  19. </template>
  20. <template v-else>
  21. <view>请选择地址</view>
  22. </template>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. props: {
  28. data: {
  29. type: Object,
  30. default() {
  31. return null
  32. }
  33. },
  34. showIcon: {
  35. type: Boolean,
  36. default: false,
  37. },
  38. enableCopy: {
  39. type: Boolean,
  40. default: false,
  41. },
  42. },
  43. computed: {
  44. displayAddress() {
  45. if (!this.data) {
  46. return ''
  47. }
  48. const {
  49. province,
  50. city,
  51. district,
  52. detail,
  53. } = this.data
  54. return `${[province, city, district].join('')}${detail}`
  55. },
  56. },
  57. }
  58. </script>
  59. <style scoped lang="scss">
  60. .btn {
  61. &-copy {
  62. display: inline-flex;
  63. font-family: PingFang SC;
  64. font-weight: 400;
  65. font-size: 28rpx;
  66. line-height: 1.4;
  67. color: #7451DE;
  68. }
  69. }
  70. .user {
  71. justify-content: flex-start;
  72. column-gap: 24rpx;
  73. font-family: PingFang SC;
  74. font-weight: 400;
  75. font-size: 32rpx;
  76. line-height: 1.4;
  77. color: #181818;
  78. .tag {
  79. padding: 2rpx 14rpx;
  80. font-family: PingFang SC;
  81. font-weight: 400;
  82. font-size: 24rpx;
  83. line-height: 1.4;
  84. color: #7451DE;
  85. background: #EFEAFF;
  86. border: 2rpx solid #7451DE;
  87. border-radius: 8rpx;
  88. }
  89. .btn-copy {
  90. margin-left: 24rpx;
  91. }
  92. }
  93. .address {
  94. margin-top: 16rpx;
  95. align-items: flex-start;
  96. justify-content: flex-start;
  97. font-family: PingFang SC;
  98. font-weight: 400;
  99. font-size: 28rpx;
  100. line-height: 1.4;
  101. color: #9B9B9B;
  102. .icon {
  103. flex: none;
  104. margin: 3px 8rpx 0 0;
  105. width: 32rpx;
  106. height: 32rpx;
  107. }
  108. .text {
  109. margin-right: 8rpx;
  110. }
  111. .btn-copy {
  112. vertical-align: text-bottom;
  113. }
  114. }
  115. </style>