Commit 248b0e031d417ecaf98a5675a2f2ffd7d8415f9e

Authored by 吉鹏
1 parent 4e5fb860bc
Exists in master

解决支付问题

src/pages/confirmOrder/confirmOrder.vue
... ... @@ -23,19 +23,25 @@
23 23 @tap="toaddAddress"
24 24 class="list order-user"
25 25 >
26   - <view class="order-user-head">
  26 + <view class="order-user-head" v-if="addressInfo != false">
27 27 <view class="name">
28 28 <view
29 29 v-if="addressInfo.default === '1'"
30 30 class="default"
31   - ><text>默认</text></view>{{addressInfo.name}}
  31 + >
  32 + <text>默认</text>
  33 + </view>
  34 + {{addressInfo.name}}
32 35 </view>
33 36 <text class="mobile">{{addressInfo.mobile}}</text>
34 37 </view>
35   - <view class="order-user-body">
  38 + <view class="order-user-body" v-if="addressInfo != false">
36 39 <image src="../../static/myorder-paying-location.png"></image>
37 40 <text class="address">{{addressInfo.address}}\n{{addressInfo.add_detail}}</text>
38   - </view>
  41 + </view>
  42 + <view class="order-user-body" v-if="addressInfo == false">
  43 + <text class="address">点击添加地址</text>
  44 + </view>
39 45 <image
40 46 class="arrow"
41 47 src="../../static/right.png"
... ... @@ -301,16 +307,14 @@ export default {
301 307 if (code === 1) {
302 308 // console.log('code', code, data)
303 309 this.showAddress = true
304   - this.addressInfo = data
  310 + this.addressInfo = data
305 311 }
306 312 })
307 313 } else {
308 314 store.dispatch('address/default').then(({ code, data }) => {
309   - if (code === 1) {
310   - // console.log('code', code, data)
311 315 this.showAddress = true
312   - this.addressInfo = data
313   - }
  316 + this.addressInfo = data
  317 + console.log("this.addressInfo", this.addressInfo)
314 318 })
315 319 }
316 320 },
... ... @@ -375,10 +379,16 @@ export default {
375 379 })
376 380 },
377 381 // 下单
378   - orderBuild() {
  382 + orderBuild() {
  383 + if(!this.addressInfo){
  384 + uni.showLoading({
  385 + title: '请先添加地址',
  386 + })
  387 + return
  388 + }
379 389 uni.showLoading({
380 390 title: '支付中',
381   - })
  391 + })
382 392 if (this.isCart === 'true') {
383 393 const checkedGoods = []
384 394 const sk_id_arr = []
... ... @@ -415,10 +425,10 @@ export default {
415 425 // 支付
416 426 pay(res) {
417 427 console.log('pay', res)
418   - const { data, exKeyName: keyName } = res
  428 + const { data, exKeyName: keyName } = res
419 429 const uid = uni.getStorageSync('uid')
420 430 const timeStamp = new Date().getTime().toString()
421   - const nonceStr = 'asfafasfasfasfasf'
  431 + const nonceStr = 'asfafasfasfasfasf'
422 432 // 支付参数
423 433 const fieldSet = {
424 434 openid: this.$store.state.user.userInfo.openid,
... ... @@ -433,8 +443,13 @@ export default {
433 443 app_uid: 2020,
434 444 timeStamp,
435 445 keyname: keyName,
436   - billInfo: JSON.stringify(data),
437   - }
  446 + billInfo: JSON.stringify({
  447 + address:this.addressInfo,
  448 + list:data,
  449 + keyname: keyName
  450 + }),
  451 + }
  452 + console.log("fieldSet", fieldSet)
438 453 // 请求后台支付接口
439 454 store.dispatch('order/pay', fieldSet).then(({ data, data2, pay_id: payId }) => {
440 455 if (data.return_code === 'SUCCESS' && data.result_code === 'SUCCESS') {
... ...
src/pages/myOrderPaying/myOrderPaying.vue
... ... @@ -43,12 +43,12 @@
43 43 <view class="order">
44 44 <view class="order-user">
45 45 <view class="order-user-head">
46   - <text class="p1">{{orderAddressInfo.userName}}</text>
47   - <text class="p2">{{orderAddressInfo.telNumber}}</text>
  46 + <text class="p1">{{orderAddressInfo.name}}</text>
  47 + <text class="p2">{{orderAddressInfo.mobile}}</text>
48 48 </view>
49 49 <view class="order-user-body">
50 50 <image src="../../static/myorder-paying-location.png"></image>
51   - <text class="p3">{{orderAddressInfo.provinceName}} {{orderAddressInfo.cityName}} {{orderAddressInfo.countyName}}\n{{orderAddressInfo.detailInfo}}</text>
  51 + <text class="p3">{{orderAddressInfo.address}}</text>
52 52 </view>
53 53 </view>
54 54 <view class="order-info">
... ...