app-address-bar.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view class="app-address-bar">
  3. <view v-if="allZiti" class="group">
  4. <view class="dir-left-nowrap">
  5. <view class="box-grow-1">
  6. <app-input placeholder="请填写联系人"
  7. height="100"
  8. padding-left="36"
  9. v-model="address.name"
  10. @input="handleAddressInput"></app-input>
  11. </view>
  12. <view class="box-grow-1"
  13. style="padding-right: 36rpx;">
  14. <app-input placeholder="请填写手机号"
  15. height="100"
  16. v-model="address.mobile"
  17. @input="handleAddressInput"></app-input>
  18. </view>
  19. </view>
  20. </view>
  21. <view v-else class="group dir-left-nowrap cross-center" @click="navigateAddress"
  22. style="padding: 25rpx 32rpx">
  23. <view class="box-grow-1">
  24. <template v-if="address">
  25. <view class="dir-left-nowrap" style="padding: 11rpx 0;">
  26. <view class="box-grow-1">收货人:{{address.name}}</view>
  27. <view class="box-grow-0">{{address.mobile}}</view>
  28. </view>
  29. <view style="padding: 9rpx 0; line-height: 1.25; text-align: justify;">
  30. 收货地址:
  31. <template v-if="hasCity">{{address.location}}</template>
  32. <template v-else>
  33. {{address.province}}
  34. {{address.city}}
  35. {{address.district}}
  36. </template>
  37. {{address.detail}}
  38. </view>
  39. </template>
  40. <view v-else style="padding: 11rpx 0;">
  41. <template v-if="hasCity">请选择收货地址</template>
  42. <template v-else>请选择收货地址</template>
  43. </view>
  44. <view v-if="hasZiti"
  45. :class="[`${theme}`, `${theme}-m-text`]"
  46. style="padding: 11rpx 0;">
  47. (收货地址中的手机号码将用于自提信息)
  48. </view>
  49. <view v-if="address && hasCity"
  50. style="padding: 11rpx 0;">
  51. 该地址在配送范围内
  52. </view>
  53. </view>
  54. <view class="box-grow-0" style="padding-left: 24rpx;">
  55. <image src="/static/image/icon/right.png"
  56. style="width: 12rpx; height: 22rpx;"></image>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import {mapGetters} from 'vuex';
  63. export default {
  64. name: "app-address-bar",
  65. props: {
  66. address: {
  67. default: null,
  68. },
  69. allZiti: {
  70. default: false,
  71. },
  72. hasZiti: {
  73. default: false,
  74. },
  75. hasCity: {
  76. default: false,
  77. },
  78. city: {
  79. default: null
  80. }
  81. },
  82. computed: {
  83. ...mapGetters('mallConfig', {
  84. theme: 'getTheme'
  85. }),
  86. },
  87. methods: {
  88. navigateAddress() {
  89. if (this.city && this.city.errorCode === 1) {
  90. uni.showModal({
  91. content: this.city.error,
  92. showCancel: false
  93. });
  94. return ;
  95. }
  96. uni.navigateTo({
  97. url: '/pages/order-submit/address-pick?hasCity=' + this.hasCity,
  98. });
  99. },
  100. handleAddressInput() {
  101. this.$emit('addressInput', this.address);
  102. },
  103. },
  104. }
  105. </script>