普兆健康管家前端代码仓库
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.

122 lines
2.5 KiB

  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.default">默认</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 { area, address } = this.data
  49. return `${area.join('')}${address}`
  50. },
  51. },
  52. }
  53. </script>
  54. <style scoped lang="scss">
  55. .btn {
  56. &-copy {
  57. display: inline-flex;
  58. font-family: PingFang SC;
  59. font-weight: 400;
  60. font-size: 28rpx;
  61. line-height: 1.4;
  62. color: #7451DE;
  63. }
  64. }
  65. .user {
  66. justify-content: flex-start;
  67. column-gap: 24rpx;
  68. font-family: PingFang SC;
  69. font-weight: 400;
  70. font-size: 32rpx;
  71. line-height: 1.4;
  72. color: #181818;
  73. .tag {
  74. padding: 2rpx 14rpx;
  75. font-family: PingFang SC;
  76. font-weight: 400;
  77. font-size: 24rpx;
  78. line-height: 1.4;
  79. color: #7451DE;
  80. background: #EFEAFF;
  81. border: 2rpx solid #7451DE;
  82. border-radius: 8rpx;
  83. }
  84. .btn-copy {
  85. margin-left: 24rpx;
  86. }
  87. }
  88. .address {
  89. margin-top: 16rpx;
  90. align-items: flex-start;
  91. justify-content: flex-start;
  92. font-family: PingFang SC;
  93. font-weight: 400;
  94. font-size: 28rpx;
  95. line-height: 1.4;
  96. color: #9B9B9B;
  97. .icon {
  98. flex: none;
  99. margin: 3px 8rpx 0 0;
  100. width: 32rpx;
  101. height: 32rpx;
  102. }
  103. .text {
  104. margin-right: 8rpx;
  105. }
  106. .btn-copy {
  107. vertical-align: text-bottom;
  108. }
  109. }
  110. </style>