app-address-bar.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. :style="{'color': getTheme.color,'padding': '11rpx 0'}">
  46. (收货地址中的手机号码将用于自提信息)
  47. </view>
  48. <view v-if="address && hasCity"
  49. style="padding: 11rpx 0;">
  50. 该地址在配送范围内
  51. </view>
  52. </view>
  53. <view class="box-grow-0" style="padding-left: 24rpx;">
  54. <image src="/static/image/icon/right.png"
  55. style="width: 12rpx; height: 22rpx;"></image>
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import {mapGetters} from 'vuex';
  62. export default {
  63. name: "app-address-bar",
  64. props: {
  65. address: {
  66. default: null,
  67. },
  68. allZiti: {
  69. default: false,
  70. },
  71. hasZiti: {
  72. default: false,
  73. },
  74. hasCity: {
  75. default: false,
  76. },
  77. city: {
  78. default: null
  79. }
  80. },
  81. computed: {
  82. ...mapGetters('mallConfig', {
  83. theme: 'getTheme'
  84. }),
  85. },
  86. methods: {
  87. navigateAddress() {
  88. if (this.city && this.city.errorCode === 1) {
  89. uni.showModal({
  90. content: this.city.error,
  91. showCancel: false
  92. });
  93. return ;
  94. }
  95. uni.navigateTo({
  96. url: '/pages/order-submit/address-pick?hasCity=' + this.hasCity,
  97. });
  98. },
  99. handleAddressInput() {
  100. this.$emit('addressInput', this.address);
  101. },
  102. },
  103. }
  104. </script>