Commit c14890bbc18c304e91120bd43fafd471b97956a7

Authored by 后端研发-倪永富
1 parent edda6eaa

我的礼包的功能 购买返回订单号,并跳转到订单成功页

pages/giftpack/buygiftpack/giftpackbuy.js
... ... @@ -52,6 +52,8 @@ Page({
52 52 var id = e.currentTarget.dataset.id; //活动id
53 53 var my_confirm = th.selectComponent("#my_confirm"); //组件的id
54 54 var order_sn = e.currentTarget.dataset.order_sn;//订单号
  55 + var money=e.currentTarget.dataset.money; //支付金额
  56 +
55 57 my_confirm.open(
56 58 "是否确定购买该礼包",
57 59 "取消",
... ... @@ -81,8 +83,9 @@ Page({
81 83 }, // 设置请求的 header
82 84 success: function(res) {
83 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 89 wx.requestPayment({
87 90 timeStamp: String(res.timeStamp),
88 91 nonceStr: res.nonceStr,
... ...
pages/giftpack/buygiftpack/giftpackbuy.wxml
... ... @@ -62,7 +62,7 @@
62 62 </block>
63 63 <block wx:else>
64 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 66 <button class="box_button_dui box_button_buy">立即购买</button>
67 67 </view>
68 68 </block>
... ...
pages/giftpack/payment/payment.js
... ... @@ -8,52 +8,19 @@ Page({
8 8 url: e.globalData.setting.imghost,
9 9 resourceUrl: e.globalData.setting.resourceUrl,
10 10 iurl: e.globalData.setting.imghost,
11   - order: null,
12   - type: 1,
13 11 allmoney: 0,
14   - user_money: 0,
15 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 19 wx.setNavigationBarTitle({
24 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 26 goto: function () {
... ...
pages/giftpack/payment/payment.wxml
... ... @@ -21,32 +21,17 @@
21 21 </view>
22 22  
23 23 <!-- 实付金额 -->
24   -
25 24 <view class="payitem flex">
26 25 <view>实付金额 :</view>
27 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 28 </view>
31 29  
32 30 <!-- 支付方式 -->
33 31 <view class="payitem flex" wx:if="type==1">
34 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 34 </view>
47   -
48   -
49   -
50 35 </view>
51 36 </view>
52 37 <view class="flex-level">
... ... @@ -55,7 +40,6 @@
55 40  
56 41 <!-- 跳转链接 -->
57 42 <view>
58   -
59 43 <!-- 链接 -->
60 44 <view class="fs32">
61 45 <view class="flex-center">
... ...
pages/user/index/index.js
... ... @@ -251,7 +251,7 @@ Page({
251 251 //!this.nomore && this.requestRecommend();
252 252 var goods_list = this.selectComponent("#goods_recommend"); //组件的id
253 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 217 <view class="four-level-word">我的服务</view>
218 218 </view>
219 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 221 <view class="four-level-word">我的礼包</view>
222 222 </view>
223 223 </view>
... ...