app-submit-address.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <view class="app-submit-address">
  3. <view class="information dir-top-nowrap main-left">
  4. <view class="express dir-left-nowrap cross-center" @click="navigateAddress" v-if="delivery === 0">
  5. <view class="dir-top-nowrap content" v-if="Object.keys(address).length > 0">
  6. <view class="top dir-left-nowrap main-between">
  7. <text class="font">收货人:{{address.name}}</text>
  8. <text class="font">{{address.mobile}}</text>
  9. </view>
  10. <view class="bottom font t-omit-two">
  11. 收货地址:{{address.province}}{{address.city}}{{address.district}}{{address.detail}}
  12. </view>
  13. </view>
  14. <view class="content font" v-else>请选择收货地址</view>
  15. <view>
  16. <image class="icon-image" src="/static/image/icon/arrow-right.png"></image>
  17. </view>
  18. </view>
  19. <view class="lifting dir-left-nowrap cross-center main-between" v-else>
  20. <input type="text" placeholder="姓名" v-model="name">
  21. <input type="number" placeholder="电话" v-model="mobile">
  22. </view>
  23. <image class="line" :src="appImg.common.address_bottom"></image>
  24. </view>
  25. <view class="delivery-method dir-left-nowrap main-between cross-center">
  26. <view>配送方式</view>
  27. <view class="dir-left-nowrap main-between method">
  28. <text class="item" @click="setMethod(0)" :class="[`${delivery === 0 ? theme + '-background' : ''}`]">快递配送</text>
  29. <text class="item" @click="setMethod(1)" :class="[`${delivery === 1 ? theme + '-background' : ''}`]">到店自提</text>
  30. </view>
  31. </view>
  32. <view class="store-information dir-top-nowrap" v-if="delivery === 1">
  33. <view class="font" v-if="store_list.length == 0">
  34. 暂无门店,请选择其他配送方式
  35. </view>
  36. <view class="font" v-if="store_list.length > 0">门店信息</view>
  37. <view class="dir-left-nowrap main-between cross-center" v-if="store_list.length > 0">
  38. <view class="content dir-top-nowrap">
  39. <view class="dir-left-nowrap main-between">
  40. <view class="font">{{store_list[0].name}}</view>
  41. <view>
  42. <image class="location" src="/static/image/icon/location.png"></image>
  43. <text class="font">距您{{store_list[0].distance}}</text>
  44. </view>
  45. </view>
  46. <view class="address">
  47. {{store_list[0].address}}
  48. </view>
  49. </view>
  50. <image class="icon-image" src="/static/image/icon/arrow-right.png"></image>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. import { mapState } from 'vuex';
  57. export default {
  58. props: {
  59. theme: String,
  60. address: Object,
  61. goods_id: Number,
  62. id: Number,
  63. },
  64. data() {
  65. return {
  66. delivery: 0,
  67. store_list: [],
  68. name: '',
  69. mobile: '',
  70. }
  71. },
  72. methods: {
  73. navigateAddress() {
  74. let url = '/pages/order-submit/address-pick';
  75. url += '?sign=gift&id='+ this.id;
  76. uni.navigateTo({
  77. url: url,
  78. });
  79. },
  80. setMethod(data) {
  81. this.delivery = data;
  82. let _this = this;
  83. if (this.delivery === 1) {
  84. uni.getLocation({
  85. type: 'wgs84',
  86. success: function (res) {
  87. _this.$request({
  88. url: _this.$api.order.store_list,
  89. data: {
  90. latitude: res.latitude,
  91. longitude: res.longitude,
  92. goods_id: _this.goods_id,
  93. }
  94. }).then(res => {
  95. _this.store_list = res.data.list;
  96. })
  97. }
  98. });
  99. }
  100. }
  101. },
  102. computed: {
  103. ...mapState({
  104. appImg: state => state.mallConfig.__wxapp_img,
  105. }),
  106. },
  107. }
  108. </script>
  109. <style lang="scss" scoped>
  110. .icon-image {
  111. width: #{12upx};
  112. height: #{22upx};
  113. }
  114. .information {
  115. background-color: #ffffff;
  116. }
  117. .app-submit-address {
  118. width: 100%;
  119. .express {
  120. .content {
  121. width:#{660upx};
  122. margin-right: #{28upx};
  123. }
  124. padding: #{32upx 24upx};
  125. .top {
  126. margin-bottom: #{22upx};
  127. }
  128. .font {
  129. font-size: #{32upx};
  130. line-height: 1;
  131. color: #353535;
  132. }
  133. .bottom {
  134. line-height: #{36upx};
  135. }
  136. }
  137. .line {
  138. width: 100%;
  139. height: #{8upx};
  140. }
  141. }
  142. .delivery-method {
  143. font-size: #{32upx};
  144. width: 100%;
  145. margin-top: #{24upx};
  146. background-color: #ffffff;
  147. height: #{120upx};
  148. padding: #{0 24upx};
  149. .method {
  150. width: #{355upx};
  151. .item {
  152. width: #{170upx};
  153. height: #{56upx};
  154. border-radius: #{30upx};
  155. line-height: #{56upx};
  156. background-color: #f7f7f7;
  157. text-align: center;
  158. }
  159. }
  160. }
  161. .lifting {
  162. padding: #{0 24upx};
  163. width: 100%;
  164. height: #{100upx};
  165. input {
  166. width: 50%;
  167. color: #353535;
  168. font-size: #{32upx};
  169. }
  170. }
  171. /*门店信息*/
  172. .store-information {
  173. width: 100%;
  174. padding: #{32upx 24upx 32upx 24upx};
  175. background-color: #ffffff;
  176. border-top: #{1upx} solid #e2e2e2;
  177. .content {
  178. padding: #{32upx 40upx 32upx 0};
  179. width: #{662upx};
  180. }
  181. .font {
  182. color: #353535;
  183. font-size: #{32upx};
  184. line-height: 1;
  185. }
  186. .location {
  187. width: #{22upx};
  188. height: #{26upx};
  189. margin-right: #{8upx};
  190. }
  191. .address {
  192. color: #999999;
  193. font-size: #{28upx};
  194. line-height: 1;
  195. margin-top: #{20upx};
  196. }
  197. }
  198. </style>