order-choose-address.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <view class="choose-address" @click="handleClick">
  3. <template v-if="addressInfo">
  4. <view class="contact">
  5. <text class="name" v-text="addressInfo.shouHuoRen"></text>
  6. <text class="mobile" v-text="addressInfo.mobile"></text>
  7. </view>
  8. <view class="address">
  9. <text class="iconfont icon-shouhuodizhi icon"></text>
  10. <text class="text">收货地址:{{ address }}</text>
  11. </view>
  12. <text class="iconfont icon-genghuan more"></text>
  13. </template>
  14. <template v-else>
  15. <view class="create">
  16. <text class="iconfont icon-tianjiadizhi icon"></text>
  17. <text class="text">添加收货地址</text>
  18. </view>
  19. </template>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. name: 'order-choose-address',
  25. props: {
  26. addressInfo: {
  27. type: Object,
  28. default: () => null
  29. },
  30. disabled: {
  31. type: Boolean,
  32. default: false
  33. }
  34. },
  35. computed: {
  36. address() {
  37. if (!this.addressInfo) {
  38. return ''
  39. }
  40. return (
  41. this.addressInfo.provinceName +
  42. this.addressInfo.cityName +
  43. this.addressInfo.townName +
  44. this.addressInfo.address
  45. )
  46. }
  47. },
  48. methods: {
  49. handleClick() {
  50. if (this.disabled) return
  51. if (!this.addressInfo) {
  52. this.$router.navigateTo('address/address-create?type=choose')
  53. } else {
  54. this.$router.navigateTo('address/address-list?type=choose')
  55. }
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. .choose-address {
  62. @extend .cm-flex-center;
  63. flex-direction: column;
  64. align-items: flex-start;
  65. position: relative;
  66. height: 120rpx;
  67. padding: 0 24rpx;
  68. background-color: #fff;
  69. background-image: url('https://static.caimei365.com/app/mini-hehe/icon/icon-line.png');
  70. background-position: left bottom;
  71. background-repeat: no-repeat;
  72. background-size: 750rpx 6rpx;
  73. .contact {
  74. @include ellipsis(1);
  75. padding-left: 44rpx;
  76. font-size: 30rpx;
  77. font-weight: bold;
  78. color: #333;
  79. .name {
  80. margin-right: 24rpx;
  81. }
  82. }
  83. .address {
  84. @include ellipsis(1);
  85. margin-top: 4rpx;
  86. max-width: 650rpx;
  87. font-size: 28rpx;
  88. color: #333;
  89. .icon {
  90. font-size: 34rpx;
  91. color: #f83c6c;
  92. margin-right: 8rpx;
  93. }
  94. }
  95. .create {
  96. width: 100%;
  97. text-align: center;
  98. color: #f83c6c;
  99. .icon {
  100. font-size: 34rpx;
  101. margin-right: 8rpx;
  102. color: #f83c6c;
  103. }
  104. .text {
  105. font-size: 28rpx;
  106. }
  107. }
  108. .more {
  109. position: absolute;
  110. right: 24rpx;
  111. bottom: 24rpx;
  112. font-size: 28rpx;
  113. color: #333;
  114. }
  115. }
  116. </style>