Commit c14890bbc18c304e91120bd43fafd471b97956a7
1 parent
edda6eaa
我的礼包的功能 购买返回订单号,并跳转到订单成功页
Showing
6 changed files
with
13 additions
and
59 deletions
pages/giftpack/buygiftpack/giftpackbuy.js
@@ -52,6 +52,8 @@ Page({ | @@ -52,6 +52,8 @@ Page({ | ||
52 | var id = e.currentTarget.dataset.id; //活动id | 52 | var id = e.currentTarget.dataset.id; //活动id |
53 | var my_confirm = th.selectComponent("#my_confirm"); //组件的id | 53 | var my_confirm = th.selectComponent("#my_confirm"); //组件的id |
54 | var order_sn = e.currentTarget.dataset.order_sn;//订单号 | 54 | var order_sn = e.currentTarget.dataset.order_sn;//订单号 |
55 | + var money=e.currentTarget.dataset.money; //支付金额 | ||
56 | + | ||
55 | my_confirm.open( | 57 | my_confirm.open( |
56 | "是否确定购买该礼包", | 58 | "是否确定购买该礼包", |
57 | "取消", | 59 | "取消", |
@@ -81,8 +83,9 @@ Page({ | @@ -81,8 +83,9 @@ Page({ | ||
81 | }, // 设置请求的 header | 83 | }, // 设置请求的 header |
82 | success: function(res) { | 84 | success: function(res) { |
83 | if (res.data.code == 0) { | 85 | if (res.data.code == 0) { |
84 | - res = res.data.data; | ||
85 | - var url = "/pages/giftpack/payment/payment?type=" + 1 + "order_sn=" + order_sn; | 86 | + var order_sn=res.data.data.orderSn; |
87 | + res = res.data.data.result; | ||
88 | + var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; | ||
86 | wx.requestPayment({ | 89 | wx.requestPayment({ |
87 | timeStamp: String(res.timeStamp), | 90 | timeStamp: String(res.timeStamp), |
88 | nonceStr: res.nonceStr, | 91 | nonceStr: res.nonceStr, |
pages/giftpack/buygiftpack/giftpackbuy.wxml
@@ -62,7 +62,7 @@ | @@ -62,7 +62,7 @@ | ||
62 | </block> | 62 | </block> |
63 | <block wx:else> | 63 | <block wx:else> |
64 | <block wx:if="{{items.payMoney>0}}"> | 64 | <block wx:if="{{items.payMoney>0}}"> |
65 | - <view class="flex" bindtap="GetBuyPrice" data-id="{{items.lbId}}"> | 65 | + <view class="flex" bindtap="GetBuyPrice" data-id="{{items.lbId}}" data-money="{{items.payMoney}}"> |
66 | <button class="box_button_dui box_button_buy">立即购买</button> | 66 | <button class="box_button_dui box_button_buy">立即购买</button> |
67 | </view> | 67 | </view> |
68 | </block> | 68 | </block> |
pages/giftpack/payment/payment.js
@@ -8,52 +8,19 @@ Page({ | @@ -8,52 +8,19 @@ Page({ | ||
8 | url: e.globalData.setting.imghost, | 8 | url: e.globalData.setting.imghost, |
9 | resourceUrl: e.globalData.setting.resourceUrl, | 9 | resourceUrl: e.globalData.setting.resourceUrl, |
10 | iurl: e.globalData.setting.imghost, | 10 | iurl: e.globalData.setting.imghost, |
11 | - order: null, | ||
12 | - type: 1, | ||
13 | allmoney: 0, | 11 | allmoney: 0, |
14 | - user_money: 0, | ||
15 | order_sn: "", | 12 | order_sn: "", |
16 | - pick: null, | ||
17 | }, | 13 | }, |
18 | 14 | ||
19 | /** | 15 | /** |
20 | * 生命周期函数--监听页面加载 | 16 | * 生命周期函数--监听页面加载 |
21 | */ | 17 | */ |
22 | - onLoad: async function (options) { | 18 | + onLoad: function (options) { |
23 | wx.setNavigationBarTitle({ | 19 | wx.setNavigationBarTitle({ |
24 | title: '支付成功', | 20 | title: '支付成功', |
25 | }); | 21 | }); |
26 | - | ||
27 | - var type = options.type, order_sn = options.order_sn; | ||
28 | - var th = this, order = null; | ||
29 | - //如果是等1,就是单个订单的订单号 | ||
30 | - if (type == 1) { | ||
31 | - await getApp().request.promiseGet("/api/weshop/order/page", | ||
32 | - { data: { store_id: e.globalData.setting.stoid, order_sn: order_sn } }).then(res => { | ||
33 | - order = res.data.data.pageData[0]; | ||
34 | - th.setData({ order: order, order_sn: order_sn }) | ||
35 | - }) | ||
36 | - } else { | ||
37 | - await getApp().request.promiseGet("/api/weshop/order/page", | ||
38 | - { data: { store_id: e.globalData.setting.stoid, parent_sn: order_sn } }).then(res => { | ||
39 | - | ||
40 | - var allmoney = 0, user_money = 0; | ||
41 | - for (var i in res.data.data.pageData) { | ||
42 | - var item = res.data.data.pageData[i]; | ||
43 | - allmoney += item.order_amount; | ||
44 | - user_money += item.user_money ? item.user_money : 0; | ||
45 | - } | ||
46 | - order = res.data.data.pageData[0]; | ||
47 | - th.setData({ order: order, type: 2, allmoney: allmoney, order_sn: order_sn, user_money: user_money }) | ||
48 | - }) | ||
49 | - } | ||
50 | - //--获取门店-- | ||
51 | - if (order.exp_type == 1) { | ||
52 | - await getApp().request.promiseGet("/api/weshop/pickup/get/" + e.globalData.setting.stoid + "/" + order.pickup_id, | ||
53 | - { 1: 1 }).then(res => { | ||
54 | - th.setData({ pick: res.data.data }) | ||
55 | - }); | ||
56 | - } | 22 | + var money = parseFloat(options.money), order_sn = options.order_sn; |
23 | + this.setData({allmoney:money,order_sn:order_sn}) | ||
57 | }, | 24 | }, |
58 | 25 | ||
59 | goto: function () { | 26 | goto: function () { |
pages/giftpack/payment/payment.wxml
@@ -21,32 +21,17 @@ | @@ -21,32 +21,17 @@ | ||
21 | </view> | 21 | </view> |
22 | 22 | ||
23 | <!-- 实付金额 --> | 23 | <!-- 实付金额 --> |
24 | - | ||
25 | <view class="payitem flex"> | 24 | <view class="payitem flex"> |
26 | <view>实付金额 :</view> | 25 | <view>实付金额 :</view> |
27 | <!-- {{filters.toFix()}} --> | 26 | <!-- {{filters.toFix()}} --> |
28 | - <view class="pay_money" wx:if="{{type==1}}">{{filters.toFix(order.order_amount+order.user_money+order.pt_tail_money,2)}}元</view> | ||
29 | - <view class="pay_money" wx:else>{{filters.toFix(allmoney+user_money,2) }}元</view> | 27 | + <view class="pay_money">{{filters.toFix(allmoney,2)}}元</view> |
30 | </view> | 28 | </view> |
31 | 29 | ||
32 | <!-- 支付方式 --> | 30 | <!-- 支付方式 --> |
33 | <view class="payitem flex" wx:if="type==1"> | 31 | <view class="payitem flex" wx:if="type==1"> |
34 | <view>支付方式 :</view> | 32 | <view>支付方式 :</view> |
35 | - <view wx:if="{{order.order_amount>0 && order.user_money>0 }}">微信支付,余额支付</view> | ||
36 | - <view wx:elif="{{order.order_amount>0}}">微信支付</view> | ||
37 | - <view wx:elif="{{order.user_money>0}}">余额支付</view> | ||
38 | - <view wx:else>免单</view> | ||
39 | - </view> | ||
40 | - <view class="payitem flex" wx:else> | ||
41 | - <view>支付方式 :</view> | ||
42 | - <view wx:if="{{allmoney>0 && user_money>0 }}">微信支付,余额支付</view> | ||
43 | - <view wx:elif="{{allmoney>0}}">微信支付</view> | ||
44 | - <view wx:elif="{{user_money>0}}">余额支付</view> | ||
45 | - <view wx:else>免单</view> | 33 | + <view>微信支付</view> |
46 | </view> | 34 | </view> |
47 | - | ||
48 | - | ||
49 | - | ||
50 | </view> | 35 | </view> |
51 | </view> | 36 | </view> |
52 | <view class="flex-level"> | 37 | <view class="flex-level"> |
@@ -55,7 +40,6 @@ | @@ -55,7 +40,6 @@ | ||
55 | 40 | ||
56 | <!-- 跳转链接 --> | 41 | <!-- 跳转链接 --> |
57 | <view> | 42 | <view> |
58 | - | ||
59 | <!-- 链接 --> | 43 | <!-- 链接 --> |
60 | <view class="fs32"> | 44 | <view class="fs32"> |
61 | <view class="flex-center"> | 45 | <view class="flex-center"> |
pages/user/index/index.js
@@ -251,7 +251,7 @@ Page({ | @@ -251,7 +251,7 @@ Page({ | ||
251 | //!this.nomore && this.requestRecommend(); | 251 | //!this.nomore && this.requestRecommend(); |
252 | var goods_list = this.selectComponent("#goods_recommend"); //组件的id | 252 | var goods_list = this.selectComponent("#goods_recommend"); //组件的id |
253 | goods_list.init(); | 253 | goods_list.init(); |
254 | - setTimeOut(function () { goods_list.get_list(); }, 300) | 254 | + setTimeout(function () { goods_list.get_list(); }, 300) |
255 | }, | 255 | }, |
256 | 256 | ||
257 | /** | 257 | /** |
pages/user/index/index.wxml
@@ -217,7 +217,7 @@ | @@ -217,7 +217,7 @@ | ||
217 | <view class="four-level-word">我的服务</view> | 217 | <view class="four-level-word">我的服务</view> |
218 | </view> | 218 | </view> |
219 | <view class="item t-c" data-url="/pages/giftpack/mygiftpack/mygiftpack" bindtap="goto_nav"> | 219 | <view class="item t-c" data-url="/pages/giftpack/mygiftpack/mygiftpack" bindtap="goto_nav"> |
220 | - <image class="xc-center-img " src="{{iurl}}/miniapp/images/user/wdlb.png"></image> | 220 | + <image class="xc-center-img " src="{{iurl}}/miniapp/images//user/wdlb.png"></image> |
221 | <view class="four-level-word">我的礼包</view> | 221 | <view class="four-level-word">我的礼包</view> |
222 | </view> | 222 | </view> |
223 | </view> | 223 | </view> |