Commit a472545509791d2aa84aca3c3983748d8990d3b9
Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into test
Showing
5 changed files
with
98 additions
and
27 deletions
packageC/pages/presell/cart/cart.js
... | ... | @@ -2397,22 +2397,40 @@ Page({ |
2397 | 2397 | |
2398 | 2398 | //---用微信支付--- |
2399 | 2399 | if (dd.tail_pay_type == 0) { |
2400 | - var n = t.data.data; | |
2401 | - th.weixinPay(n, | |
2402 | - function () { | |
2403 | - //---用余额支付--- | |
2404 | - getApp().my_warnning("支付成功", 1, th); | |
2405 | - var send_time = th.data.pre_arr.delivery_date; | |
2406 | - if (th.data.pre_arr.delivery_type == 2) { | |
2407 | - send_time = th.data.pre_arr.delivery_daynum * 3600; | |
2408 | - } | |
2409 | - th.setData({ isclose: 0, 'order.order_status': 1, 'order.pay_status': 1, 'wait_wk': 0, 'presell.tail_pay_state': 1, 'wait_fh': 1, send_time: send_time }); | |
2410 | - this.data.paying=0; | |
2411 | - | |
2412 | - }, function () { | |
2413 | - this.data.paying=0; | |
2414 | - getApp().my_warnning("支付失败", 0, th); | |
2415 | - }) | |
2400 | + util_pay.pay_data(t,function (){ | |
2401 | + //---用余额支付--- | |
2402 | + getApp().my_warnning("支付成功", 1, th); | |
2403 | + var send_time = th.data.pre_arr.delivery_date; | |
2404 | + if (th.data.pre_arr.delivery_type == 2) { | |
2405 | + send_time = th.data.pre_arr.delivery_daynum * 3600; | |
2406 | + } | |
2407 | + th.setData({ isclose: 0, 'order.order_status': 1, 'order.pay_status': 1, 'wait_wk': 0, 'presell.tail_pay_state': 1, 'wait_fh': 1, send_time: send_time }); | |
2408 | + th.data.paying=0; | |
2409 | + | |
2410 | + },function (e){ | |
2411 | + th.data.paying=0; | |
2412 | + wx.showToast({ | |
2413 | + title:e, | |
2414 | + icon: 'none', | |
2415 | + duration: 2500 | |
2416 | + }) | |
2417 | + }) | |
2418 | + // var n = t.data.data; | |
2419 | + // th.weixinPay(n, | |
2420 | + // function () { | |
2421 | + // //---用余额支付--- | |
2422 | + // getApp().my_warnning("支付成功", 1, th); | |
2423 | + // var send_time = th.data.pre_arr.delivery_date; | |
2424 | + // if (th.data.pre_arr.delivery_type == 2) { | |
2425 | + // send_time = th.data.pre_arr.delivery_daynum * 3600; | |
2426 | + // } | |
2427 | + // th.setData({ isclose: 0, 'order.order_status': 1, 'order.pay_status': 1, 'wait_wk': 0, 'presell.tail_pay_state': 1, 'wait_fh': 1, send_time: send_time }); | |
2428 | + // th.data.paying=0; | |
2429 | + // | |
2430 | + // }, function () { | |
2431 | + // this.data.paying=0; | |
2432 | + // getApp().my_warnning("支付失败", 0, th); | |
2433 | + // }) | |
2416 | 2434 | } else { |
2417 | 2435 | if (t.data.code == 0) { |
2418 | 2436 | var send_time = th.data.pre_arr.delivery_date; |
... | ... | @@ -2426,7 +2444,7 @@ Page({ |
2426 | 2444 | } else { |
2427 | 2445 | getApp().my_warnning(t.data.msg, 1, th); |
2428 | 2446 | } |
2429 | - this.data.paying=0; | |
2447 | + th.data.paying=0; | |
2430 | 2448 | } |
2431 | 2449 | } |
2432 | 2450 | }); | ... | ... |
packageE/pages/cart/cart2/cart2.js
pages/cart/cart_wk/cart_wk.js
... | ... | @@ -3,6 +3,7 @@ var t = getApp(), |
3 | 3 | oo = t.globalData.setting, |
4 | 4 | os=oo; |
5 | 5 | var ut=require("../../../utils/util.js"); |
6 | +var util_pay=require("../../../utils/pay.js"); | |
6 | 7 | var regeneratorRuntime = require('../../../utils/runtime.js'); |
7 | 8 | |
8 | 9 | Page({ |
... | ... | @@ -86,6 +87,7 @@ Page({ |
86 | 87 | * 生命周期函数--监听页面显示 |
87 | 88 | */ |
88 | 89 | onShow: function () { |
90 | + util_pay.set_fir(); | |
89 | 91 | getApp().check_can_share(); |
90 | 92 | var th = this; |
91 | 93 | if (th.data.isclose == 0) { |
... | ... | @@ -606,15 +608,24 @@ Page({ |
606 | 608 | |
607 | 609 | //---用微信支付--- |
608 | 610 | if (dd.tail_pay_type == 0) { |
609 | - var n = t.data.data; | |
610 | - th.weixinPay(n, | |
611 | - function () { | |
612 | - var allmoney = th.data.allpice; | |
613 | - th.jumpPaymentPage(th.data.order.order_sn, allmoney); | |
614 | - }, function () { | |
615 | - th.data.paying=0; | |
616 | - getApp().my_warnning("支付失败", 0, th); | |
617 | - }) | |
611 | + | |
612 | + util_pay.pay_data(t,function (){ | |
613 | + var allmoney = th.data.allpice; | |
614 | + th.jumpPaymentPage(th.data.order.order_sn, allmoney); | |
615 | + },function (){ | |
616 | + th.data.paying=0; | |
617 | + getApp().my_warnning("支付失败", 0, th); | |
618 | + }) | |
619 | + | |
620 | + //var n = t.data.data; | |
621 | + // th.weixinPay(n, | |
622 | + // function () { | |
623 | + // var allmoney = th.data.allpice; | |
624 | + // th.jumpPaymentPage(th.data.order.order_sn, allmoney); | |
625 | + // }, function () { | |
626 | + // th.data.paying=0; | |
627 | + // getApp().my_warnning("支付失败", 0, th); | |
628 | + // }) | |
618 | 629 | } else { |
619 | 630 | if (t.data.code == 0) { |
620 | 631 | //---用余额支付--- | ... | ... |
pages/user/order_list/order_list.js
utils/pay.js
... | ... | @@ -111,6 +111,46 @@ module.exports = { |
111 | 111 | } |
112 | 112 | }); |
113 | 113 | }, |
114 | + | |
115 | + //-- 这里是专享礼包的调用 -- | |
116 | + pay_data:function (t,succ,fail){ | |
117 | + var th=this; | |
118 | + var ob=t.data.data; | |
119 | + if(!ob){ | |
120 | + this.set_fir(); | |
121 | + fail('支付参数错误'); | |
122 | + return false; | |
123 | + } | |
124 | + if(ob.is_fuioupay){ | |
125 | + const plugin = requirePlugin('fuiou-pay') | |
126 | + | |
127 | + var paramsJson={ | |
128 | + reqType:"11",//必填 01-商户模式,11-机构模式 | |
129 | + reqData:ob.reqData,//必填 富友加密参数 | |
130 | + } | |
131 | + getApp().globalData.no_clear=1; | |
132 | + console.log(plugin, plugin.fuioupay) | |
133 | + plugin.fuioupay(parseInt(ob.amt),paramsJson,function (res){ | |
134 | + console.log(res); | |
135 | + th.wx_paying=0; | |
136 | + "function" == typeof succ && succ(); | |
137 | + },function (error){ | |
138 | + th.wx_paying=0; | |
139 | + console.log("插件支付错误",error); | |
140 | + //支付失败的时候 | |
141 | + //getApp().confirmBox(error.code+error.message); | |
142 | + var msg='取消支付'; | |
143 | + if(error && error.code){ | |
144 | + msg=error.code+":"+error.message; | |
145 | + } | |
146 | + fail(msg) | |
147 | + | |
148 | + }) | |
149 | + }else { | |
150 | + this.weixinPay(ob, succ, fail); | |
151 | + } | |
152 | + }, | |
153 | + | |
114 | 154 | weixinPay: function(n, e, a) { |
115 | 155 | var th=this; |
116 | 156 | if(!n) return false; | ... | ... |