Commit 5b8cddaf05643172d7a56dc7d84fe65d0068f6d0
合并通联收银支付
Showing
30 changed files
with
1288 additions
and
151 deletions
app.js
packageA/pages/cart2_ser/cart2_ser.js
... | ... | @@ -3,7 +3,7 @@ var t = getApp(), |
3 | 3 | a = t.request, |
4 | 4 | e = require("../../../utils/common.js"), |
5 | 5 | s = require("../../../utils/util.js"), |
6 | - o = require("../../../utils/md5.js"), | |
6 | + ut=s, o = require("../../../utils/md5.js"), | |
7 | 7 | to = getApp(); |
8 | 8 | var oo = t.globalData.setting, |
9 | 9 | os = oo; |
... | ... | @@ -49,6 +49,10 @@ Page({ |
49 | 49 | is_cart: 0, //是不是购物车进来的购买 |
50 | 50 | }, |
51 | 51 | onLoad: function(t) { |
52 | + | |
53 | + //定义第一次进入 | |
54 | + this.data.fir_in=1; | |
55 | + | |
52 | 56 | wx.setNavigationBarTitle({ |
53 | 57 | title: "填写订单", |
54 | 58 | }); |
... | ... | @@ -274,11 +278,47 @@ Page({ |
274 | 278 | |
275 | 279 | //----------子页返回父页触发---------- |
276 | 280 | onShow: function() { |
277 | - var fy=s.fy_back("/pages/user/order_list/order_list?index=2&tabindex=1",1); | |
278 | - if(fy) return false; | |
279 | 281 | |
280 | - t_pay.set_fir(); | |
281 | 282 | var th = this; |
283 | + | |
284 | + //判断是不是第一次进入 | |
285 | + if(this.data.fir_in){ | |
286 | + this.data.fir_in=0; | |
287 | + }else{ | |
288 | + var fy=s.fy_back("/pages/user/order_list/order_list?index=2&tabindex=1",1); | |
289 | + if(fy) return false; | |
290 | + t_pay.set_fir(); | |
291 | + | |
292 | + var back_url="/pages/payment/pay_success/pay_success?card=1&order_id=" + th.data.order_id; | |
293 | + //-- 通联的第三方支付的返回优化 -- | |
294 | + ut.is_pay_ok(back_url,"/pages/user/order_list/order_list?index=2&tabindex=1",function (){ | |
295 | + | |
296 | + if(!th.data.order_id) return false; | |
297 | + getApp().request.promiseGet("/api/weshop/recharge/user/page", | |
298 | + {data:{store_id:os.stoid,order_id:th.data.order_id,user_id:getApp().globalData.user_id }}).then(res=>{ | |
299 | + if(ut.ajax_ok(res)){ | |
300 | + var item=res.data.data.pageData[0]; | |
301 | + if(item.pay_status==1){ | |
302 | + //支付支付,返回首页 | |
303 | + ut.m_toast('支付成功'); | |
304 | + setTimeout(()=>{ | |
305 | + getApp().re_to(back_url); | |
306 | + },1000) | |
307 | + | |
308 | + }else{ | |
309 | + //支付支付,返回首页 | |
310 | + ut.m_toast('支付失败'); | |
311 | + setTimeout(()=>{ | |
312 | + getApp().re_to("/pages/user/order_list/order_list?index=2&tabindex=1"); | |
313 | + },1000) | |
314 | + } | |
315 | + } | |
316 | + }) | |
317 | + }); | |
318 | + | |
319 | + } | |
320 | + | |
321 | + | |
282 | 322 | if (th.data.isclose == 0) { |
283 | 323 | wx.navigateTo({ |
284 | 324 | url: "/pages/index/index/index" |
... | ... | @@ -647,6 +687,9 @@ Page({ |
647 | 687 | }, 1000) |
648 | 688 | |
649 | 689 | },function (e){ |
690 | + | |
691 | + console.log('kkkkkkk'); | |
692 | + | |
650 | 693 | wx.showToast({ |
651 | 694 | title: e, |
652 | 695 | icon: 'none', | ... | ... |
packageA/pages/details_serviceCard/details_serviceCard.js
... | ... | @@ -20,6 +20,9 @@ Page({ |
20 | 20 | */ |
21 | 21 | onLoad: function(options) { |
22 | 22 | |
23 | + //定义第一次进入 | |
24 | + this.data.fir_in=1; | |
25 | + | |
23 | 26 | self = this; |
24 | 27 | this.data.options = options; |
25 | 28 | |
... | ... | @@ -47,8 +50,87 @@ Page({ |
47 | 50 | */ |
48 | 51 | onShow: function() { |
49 | 52 | this.data.is_summit_ing=0; |
50 | - util.fy_back('',0) | |
51 | - t_pay.set_fir(); | |
53 | + | |
54 | + var th=this; | |
55 | + //判断是不是第一次进入 | |
56 | + if(this.data.fir_in){ | |
57 | + this.data.fir_in=0; | |
58 | + }else{ | |
59 | + util.fy_back('',0) | |
60 | + t_pay.set_fir(); | |
61 | + | |
62 | + var back_url='/pages/user/order_list/order_list?index=2&tabindex=1'; | |
63 | + var err_url='/pages/user/order_list/order_list?index=2&tabindex=1'; | |
64 | + | |
65 | + if(th.data.details) { | |
66 | + //-- 判断一下活动的类型 -- | |
67 | + var prom_type = th.data.details.list[0].prom_type > 0 ? th.data.details.list[0].prom_type : 0; | |
68 | + var order_id = th.data.details.order_id; | |
69 | + var order_sn = th.data.details.order_sn; | |
70 | + | |
71 | + var ck_url = ''; //请求地址 | |
72 | + var req_data = {}; //请求参数 | |
73 | + if (parseInt(prom_type) == 6) { | |
74 | + //跳转到组图的页面 | |
75 | + back_url= "/packageA/pages/serviceCard_pd/team_success/team_success?ordersn=" + order_sn | |
76 | + ck_url = "/api/weshop/rechargeServicelist/page"; | |
77 | + req_data = {store_id: os.stoid, order_id: order_id}; | |
78 | + } else { | |
79 | + ck_url = "/api/weshop/recharge/user/page"; | |
80 | + req_data = {store_id: os.stoid, order_id: order_id, user_id: getApp().globalData.user_id}; | |
81 | + } | |
82 | + | |
83 | + //-- 通联的第三方支付的返回优化 -- | |
84 | + ut.is_pay_ok(back_url, err_url, function () { | |
85 | + | |
86 | + if (!th.data.details) return false; | |
87 | + | |
88 | + getApp().request.promiseGet(ck_url, | |
89 | + {data: req_data}).then(res => { | |
90 | + if (ut.ajax_ok(res)) { | |
91 | + var item = res.data.data.pageData[0]; | |
92 | + if (parseInt(prom_type) == 6) { | |
93 | + if (item.pt_status == 1 || item.pt_status == 2) { | |
94 | + //支付支付,返回首页 | |
95 | + ut.m_toast('支付成功'); | |
96 | + setTimeout(() => { | |
97 | + getApp().re_to(back_url); | |
98 | + }, 1000) | |
99 | + | |
100 | + } else { | |
101 | + //支付支付,返回首页 | |
102 | + ut.m_toast('支付失败'); | |
103 | + setTimeout(() => { | |
104 | + getApp().re_to(err_url); | |
105 | + }, 1000) | |
106 | + } | |
107 | + | |
108 | + } else { | |
109 | + if (item.pay_status == 1) { | |
110 | + //支付支付,返回首页 | |
111 | + ut.m_toast('支付成功'); | |
112 | + setTimeout(() => { | |
113 | + getApp().re_to(back_url); | |
114 | + }, 1000) | |
115 | + | |
116 | + } else { | |
117 | + //支付支付,返回首页 | |
118 | + ut.m_toast('支付失败'); | |
119 | + setTimeout(() => { | |
120 | + getApp().re_to(err_url); | |
121 | + }, 1000) | |
122 | + } | |
123 | + } | |
124 | + | |
125 | + | |
126 | + } | |
127 | + }) | |
128 | + }); | |
129 | + } | |
130 | + | |
131 | + } | |
132 | + | |
133 | + | |
52 | 134 | getApp().check_can_share(); |
53 | 135 | if (app.globalData.userInfo) { |
54 | 136 | if (!this.data.isLogin) { | ... | ... |
packageA/pages/myGift/myGift.js
... | ... | @@ -4,6 +4,7 @@ let self = null; |
4 | 4 | var os = app.globalData.setting; |
5 | 5 | var t_pay = require("../../../utils/pay2.js"); |
6 | 6 | var util = require('../../../utils/util.js'); |
7 | +var ut=util; | |
7 | 8 | |
8 | 9 | Page({ |
9 | 10 | |
... | ... | @@ -53,6 +54,9 @@ Page({ |
53 | 54 | */ |
54 | 55 | onLoad: function (options) { |
55 | 56 | |
57 | + //定义第一次进入 | |
58 | + this.data.fir_in=1; | |
59 | + | |
56 | 60 | self = this; |
57 | 61 | if(options.index){ |
58 | 62 | this.setData({currentIndex:1}); //查看我的礼包 |
... | ... | @@ -92,9 +96,50 @@ Page({ |
92 | 96 | */ |
93 | 97 | onShow: function () { |
94 | 98 | |
95 | - util.fy_back('',0) | |
96 | 99 | this.data.is_summit_ing=0; |
97 | - t_pay.set_fir(); | |
100 | + | |
101 | + | |
102 | + var th=this; | |
103 | + //判断是不是第一次进入 | |
104 | + if(this.data.fir_in){ | |
105 | + this.data.fir_in=0; | |
106 | + }else{ | |
107 | + //富友插件支付 | |
108 | + util.fy_back('',0) | |
109 | + t_pay.set_fir(); | |
110 | + | |
111 | + //-- 通联的第三方支付的返回优化 -- | |
112 | + util.is_pay_ok("none","none",function (){ | |
113 | + if(!th.data.ok_order_sn) return false; | |
114 | + | |
115 | + var b_url="/api/weshop/libao/libaoFormvip/page"; | |
116 | + var rq_data={ | |
117 | + store_id: app.globalData.setting.stoid, | |
118 | + user_id: app.globalData.user_id, | |
119 | + number: th.data.ok_order_sn | |
120 | + }; | |
121 | + | |
122 | + getApp().request.promiseGet(b_url, | |
123 | + {data:rq_data}).then(res=>{ | |
124 | + if(ut.ajax_ok(res)){ | |
125 | + var item=res.data.data.pageData[0]; | |
126 | + if(item.fbillstate==1){ | |
127 | + //支付支付,返回首页 | |
128 | + util.m_toast('支付成功'); | |
129 | + }else{ | |
130 | + //支付支付,返回首页 | |
131 | + util.m_toast('支付失败'); | |
132 | + } | |
133 | + } | |
134 | + }) | |
135 | + }); | |
136 | + | |
137 | + } | |
138 | + | |
139 | + | |
140 | + | |
141 | + | |
142 | + | |
98 | 143 | getApp().check_can_share(); |
99 | 144 | if(app.globalData.userInfo) { |
100 | 145 | if(!this.data.isLogin) { |
... | ... | @@ -306,7 +351,7 @@ Page({ |
306 | 351 | },function (e){ |
307 | 352 | th.data.is_summit_ing=0; |
308 | 353 | getApp().my_warnning(e, 0, th); |
309 | - }) | |
354 | + },th) | |
310 | 355 | // var url = "/api/weshop/libao/libaoFormvip/libaoOrder"; |
311 | 356 | // getApp().request.post(url, |
312 | 357 | // { | ... | ... |
packageA/pages/myGiftDetails/myGiftDetails.js
... | ... | @@ -24,8 +24,10 @@ Page({ |
24 | 24 | * 生命周期函数--监听页面加载 |
25 | 25 | */ |
26 | 26 | onLoad: function (options) { |
27 | + //定义第一次进入 | |
28 | + this.data.fir_in=1; | |
27 | 29 | |
28 | - self = this; | |
30 | + self = this; | |
29 | 31 | |
30 | 32 | // 如果从商品详情页点击促销栏里的礼包跳转过来的话,不显示底部按钮 |
31 | 33 | // showBtn 控制按钮是否显示 |
... | ... | @@ -68,9 +70,60 @@ Page({ |
68 | 70 | * 生命周期函数--监听页面显示 |
69 | 71 | */ |
70 | 72 | onShow: function () { |
71 | - this.data.is_summit_ing=0; | |
72 | - ut.fy_back('',0) | |
73 | - t_pay.set_fir(); | |
73 | + | |
74 | + this.data.is_summit_ing=0; | |
75 | + var th=this; | |
76 | + //判断是不是第一次进入 | |
77 | + if(this.data.fir_in){ | |
78 | + this.data.fir_in=0; | |
79 | + }else{ | |
80 | + ut.fy_back('',0) | |
81 | + t_pay.set_fir(); | |
82 | + | |
83 | + //-- 通联的第三方支付的返回优化 -- | |
84 | + ut.is_pay_ok("/packageA/pages/libao_payment/payment?type=2","none",function (){ | |
85 | + | |
86 | + console.log('is_pay_ok'); | |
87 | + console.log(th.data.ok_order_sn); | |
88 | + | |
89 | + if(!th.data.ok_order_sn) return false; | |
90 | + | |
91 | + var b_url="/api/weshop/libao/libaoFormvip/page"; | |
92 | + var rq_data={ | |
93 | + store_id: app.globalData.setting.stoid, | |
94 | + user_id: app.globalData.user_id, | |
95 | + number: th.data.ok_order_sn | |
96 | + }; | |
97 | + | |
98 | + getApp().request.promiseGet(b_url, | |
99 | + {data:rq_data}).then(res=>{ | |
100 | + | |
101 | + console.log('is_pay_ok2'); | |
102 | + console.log('1111111'); | |
103 | + | |
104 | + if(ut.ajax_ok(res)){ | |
105 | + | |
106 | + var item=res.data.data.pageData[0]; | |
107 | + if(item.fbillstate==1){ | |
108 | + //支付支付,返回首页 | |
109 | + ut.m_toast('支付成功'); | |
110 | + setTimeout(()=>{ | |
111 | + getApp().goto("/packageA/pages/libao_payment/payment?type=2"); | |
112 | + },1000) | |
113 | + | |
114 | + }else{ | |
115 | + //支付支付,返回首页 | |
116 | + ut.m_toast('支付失败'); | |
117 | + setTimeout(()=>{ | |
118 | + getApp().goto("/pages/index/index/index"); | |
119 | + },1000) | |
120 | + } | |
121 | + } | |
122 | + }) | |
123 | + }); | |
124 | + | |
125 | + } | |
126 | + | |
74 | 127 | getApp().check_can_share(); |
75 | 128 | if(app.globalData.userInfo) { |
76 | 129 | if(!this.data.isLogin) { |
... | ... | @@ -248,7 +301,7 @@ Page({ |
248 | 301 | },function (msg){ |
249 | 302 | th.data.is_summit_ing=0; |
250 | 303 | getApp().my_warnning(msg, 0, th); |
251 | - }) | |
304 | + },th) | |
252 | 305 | |
253 | 306 | // var url = "/api/weshop/libao/libaoFormvip/libaoOrder"; |
254 | 307 | // getApp().request.post(url, | ... | ... |
packageA/pages/serviceCard_pd/cart/cart.js
1 | 1 | var t = getApp(), app = t, a = t.request, e = require("../../../../utils/common.js"), |
2 | - s = require("../../../../utils/util.js"), o = require("../../../../utils/md5.js"), to = getApp(); | |
2 | + s = require("../../../../utils/util.js"),ut=s, o = require("../../../../utils/md5.js"), to = getApp(); | |
3 | 3 | var oo = t.globalData.setting, os = oo; |
4 | 4 | var regeneratorRuntime = require('../../../../utils/runtime.js'); |
5 | 5 | var util_pay = require("../../../../utils/pay.js"); |
... | ... | @@ -71,7 +71,8 @@ Page({ |
71 | 71 | }, |
72 | 72 | onLoad: function (t) { |
73 | 73 | console.log("onLoad_pt_cart"); |
74 | - | |
74 | + //定义第一次进入 | |
75 | + this.data.fir_in=1; | |
75 | 76 | |
76 | 77 | var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, }); |
77 | 78 | var appD = getApp().get_b_now(); |
... | ... | @@ -245,12 +246,45 @@ Page({ |
245 | 246 | //----------子页返回父页触发---------- |
246 | 247 | onShow: function () { |
247 | 248 | |
248 | - s.fy_back('',0); | |
249 | + var th = this; | |
250 | + //判断是不是第一次进入 | |
251 | + if(this.data.fir_in){ | |
252 | + this.data.fir_in=0; | |
253 | + }else{ | |
254 | + s.fy_back('',0); | |
255 | + t_pay.set_fir(); | |
256 | + util_pay.set_fir(); | |
257 | + | |
258 | + var back_url="/packageA/pages/serviceCard_pd/team_success/team_success?ordersn=" + th.data.order_sn; | |
259 | + | |
260 | + //-- 通联的第三方支付的返回优化 -- | |
261 | + ut.is_pay_ok(back_url,"/pages/user/order_list/order_list?index=2&tabindex=1",function (){ | |
262 | + if(!th.data.order_id) return false; | |
263 | + getApp().request.promiseGet("/api/weshop/rechargeServicelist/page",{ | |
264 | + data: { store_id: os.stoid, order_id: th.data.order_id} | |
265 | + }).then(res=>{ | |
266 | + if(ut.ajax_ok(res)){ | |
267 | + var item=res.data.data.pageData[0]; | |
268 | + if(item.pt_status==1 || item.pt_status==2){ | |
269 | + //支付支付,返回首页 | |
270 | + ut.m_toast('支付成功'); | |
271 | + setTimeout(()=>{ | |
272 | + getApp().re_to(back_url); | |
273 | + },1000) | |
274 | + | |
275 | + }else{ | |
276 | + //支付支付,返回首页 | |
277 | + ut.m_toast('支付失败'); | |
278 | + setTimeout(()=>{ | |
279 | + getApp().re_to("/pages/user/order_list/order_list?index=2&tabindex=1"); | |
280 | + },1000) | |
281 | + } | |
282 | + } | |
283 | + }) | |
284 | + }); | |
285 | + } | |
249 | 286 | |
250 | - t_pay.set_fir(); | |
251 | - util_pay.set_fir(); | |
252 | 287 | |
253 | - var th = this; | |
254 | 288 | if (th.data.isclose == 0) { |
255 | 289 | wx.navigateTo({ |
256 | 290 | url: "/pages/index/index/index" | ... | ... |
packageA/pages/serviceCard_pd/cart_wk/cart_wk.js
... | ... | @@ -59,6 +59,8 @@ Page({ |
59 | 59 | * 生命周期函数--监听页面加载 |
60 | 60 | */ |
61 | 61 | onLoad: function (options) { |
62 | + //定义第一次进入 | |
63 | + this.data.fir_in=1; | |
62 | 64 | |
63 | 65 | //清空is_pick_up |
64 | 66 | getApp().request.put("/api/weshop/useraddress/updatePickUp", { |
... | ... | @@ -94,11 +96,49 @@ Page({ |
94 | 96 | */ |
95 | 97 | onShow: function () { |
96 | 98 | |
97 | - ut.fy_back('',0); | |
98 | 99 | this.data.paying=0; |
99 | - util_pay.set_fir(); | |
100 | - getApp().check_can_share(); | |
100 | + | |
101 | 101 | var th = this; |
102 | + //判断是不是第一次进入 | |
103 | + if(this.data.fir_in){ | |
104 | + this.data.fir_in=0; | |
105 | + }else{ | |
106 | + ut.fy_back('',0); | |
107 | + util_pay.set_fir(); | |
108 | + | |
109 | + | |
110 | + var back_url="/pages/payment/pay_success/pay_success?order_id=" + th.data.order.order_id + "&type=1&card=1"; | |
111 | + //-- 通联的第三方支付的返回优化 -- | |
112 | + ut.is_pay_ok(back_url,"/pages/user/order_list/order_list?index=2&tabindex=1",function (){ | |
113 | + if(!th.data.wk_pyed) return false; | |
114 | + getApp().request.promiseGet("/api/weshop/rechargeServicelist/page",{ | |
115 | + data: { store_id: os.stoid, order_id: th.data.order.order_id} | |
116 | + }).then(res=>{ | |
117 | + if(ut.ajax_ok(res)){ | |
118 | + var item=res.data.data.pageData[0]; | |
119 | + if(item.pt_status==4 || item.pt_status==5){ | |
120 | + //支付支付,返回首页 | |
121 | + ut.m_toast('支付成功'); | |
122 | + setTimeout(()=>{ | |
123 | + getApp().re_to(back_url); | |
124 | + },1000) | |
125 | + | |
126 | + }else{ | |
127 | + //支付支付,返回首页 | |
128 | + ut.m_toast('支付失败'); | |
129 | + setTimeout(()=>{ | |
130 | + getApp().re_to("/pages/user/order_list/order_list?index=2&tabindex=1"); | |
131 | + },1000) | |
132 | + } | |
133 | + } | |
134 | + }) | |
135 | + }); | |
136 | + | |
137 | + } | |
138 | + | |
139 | + | |
140 | + | |
141 | + getApp().check_can_share(); | |
102 | 142 | if (th.data.isclose == 0) { |
103 | 143 | wx.navigateTo({ |
104 | 144 | url: "/pages/index/index/index" |
... | ... | @@ -606,6 +646,7 @@ Page({ |
606 | 646 | return false; |
607 | 647 | } |
608 | 648 | |
649 | + th.data.wk_pyed=1; | |
609 | 650 | util_pay.pay_data(t,function (){ |
610 | 651 | var allmoney = th.data.allpice; |
611 | 652 | th.jumpPaymentPage(th.data.order.order_id, allmoney); | ... | ... |
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
... | ... | @@ -128,6 +128,9 @@ Page({ |
128 | 128 | }, |
129 | 129 | onLoad: function (t) { |
130 | 130 | |
131 | + //定义第一次进入 | |
132 | + this.data.fir_in=1; | |
133 | + | |
131 | 134 | // console.log('收到的传参', t); |
132 | 135 | wx.setNavigationBarTitle({ |
133 | 136 | title: '填写订单', |
... | ... | @@ -654,11 +657,48 @@ Page({ |
654 | 657 | //----------子页返回父页触发---------- |
655 | 658 | onShow: function () { |
656 | 659 | |
657 | - var fy=ut.fy_back('/pages/user/order_list/order_list',1); | |
658 | - if(fy) return false; | |
659 | - | |
660 | 660 | var th = this; |
661 | - util_pay.set_fir(); | |
661 | + | |
662 | + //判断是不是第一次进入 | |
663 | + if(this.data.fir_in){ | |
664 | + this.data.fir_in=0; | |
665 | + }else{ | |
666 | + var fy=ut.fy_back('/pages/user/order_list/order_list',1); | |
667 | + if(fy) return false; | |
668 | + util_pay.set_fir(); | |
669 | + | |
670 | + var back="/packageC/pages/luckyGo/luckyGo_details/luckyGo_details?type=1&ordersn=" + this.data.ok_order_sn + | |
671 | + "&group_id=" + th.data.param.group_id + "&goods_id=" + th.data.param.goods_id + | |
672 | + "&goods_name=" + th.data.bn_goods.goods_name; | |
673 | + | |
674 | + //-- 通联的第三方支付的返回优化 -- | |
675 | + ut.is_pay_ok(back,'/pages/user/order_list/order_list',function (){ | |
676 | + if(!th.data.ok_order_sn) return false; | |
677 | + getApp().request.promiseGet("/api/weshop/order/page", | |
678 | + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ | |
679 | + if(ut.ajax_ok(res)){ | |
680 | + var item=res.data.data.pageData[0]; | |
681 | + if(item.pay_status==1){ | |
682 | + //支付支付,返回首页 | |
683 | + ut.m_toast('支付成功'); | |
684 | + setTimeout(()=>{ | |
685 | + getApp().re_to(back); | |
686 | + },1000) | |
687 | + | |
688 | + }else{ | |
689 | + //支付支付,返回首页 | |
690 | + ut.m_toast('支付失败'); | |
691 | + setTimeout(()=>{ | |
692 | + getApp().re_to("/pages/user/order_list/order_list"); | |
693 | + },1000) | |
694 | + } | |
695 | + } | |
696 | + }) | |
697 | + }); | |
698 | + | |
699 | + } | |
700 | + | |
701 | + | |
662 | 702 | |
663 | 703 | if (th.data.isclose == 0) { |
664 | 704 | wx.navigateTo({ |
... | ... | @@ -1477,6 +1517,8 @@ Page({ |
1477 | 1517 | // order_sn: data.data, |
1478 | 1518 | // type:1, |
1479 | 1519 | // }, 1); |
1520 | + | |
1521 | + th.data.ok_order_sn=data.data; | |
1480 | 1522 | util_pay.pay(data.data, function () { |
1481 | 1523 | setTimeout(function () { |
1482 | 1524 | // wx.reLaunch({ | ... | ... |
packageC/pages/presell/cart/cart.js
... | ... | @@ -147,6 +147,9 @@ Page({ |
147 | 147 | }, |
148 | 148 | onLoad: function (t) { |
149 | 149 | |
150 | + //定义第一次进入 | |
151 | + this.data.fir_in=1; | |
152 | + | |
150 | 153 | if (t.order_id) this.data.order_id = t.order_id; |
151 | 154 | if (t.order_sn) this.data.order_sn = t.order_sn; |
152 | 155 | |
... | ... | @@ -190,17 +193,65 @@ Page({ |
190 | 193 | is_no_by: {}, |
191 | 194 | is_by: {} |
192 | 195 | }) |
196 | + this.data.fir_in=0; | |
193 | 197 | }, |
194 | 198 | |
195 | 199 | //----------子页返回父页触发---------- |
196 | 200 | onShow: function () { |
201 | + | |
197 | 202 | this.data.paying=0; |
198 | 203 | |
199 | - var fy= ut.fy_back("/pages/user/order_list/order_list",1); | |
200 | - if(fy) return false; | |
204 | + console.log('onshow-2222'); | |
201 | 205 | |
202 | - util_pay.set_fir(); | |
203 | 206 | var th = this; |
207 | + //判断是不是第一次进入 | |
208 | + if(this.data.fir_in){ | |
209 | + this.data.fir_in=0; | |
210 | + }else{ | |
211 | + | |
212 | + console.log('onshow-3333'); | |
213 | + //-- 富友支付的 -- | |
214 | + var fy= ut.fy_back("/pages/user/order_list/order_list",1); | |
215 | + if(fy) return false; | |
216 | + util_pay.set_fir(); | |
217 | + | |
218 | + //-- 通联的第三方支付的返回优化 -- | |
219 | + ut.is_pay_ok("back","back",function (){ | |
220 | + | |
221 | + console.log('onshow-444'); | |
222 | + console.log(th.data.ok_order_sn); | |
223 | + | |
224 | + if(!th.data.ok_order_sn) return false; | |
225 | + getApp().request.promiseGet("/api/weshop/order/page", | |
226 | + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ | |
227 | + if(ut.ajax_ok(res)){ | |
228 | + | |
229 | + console.log('onshow-444'); | |
230 | + console.log(res); | |
231 | + | |
232 | + var item=res.data.data.pageData[0]; | |
233 | + if(item.pay_status==1){ | |
234 | + //支付支付,返回首页 | |
235 | + ut.m_toast('支付成功'); | |
236 | + setTimeout(()=>{ | |
237 | + wx.navigateBack(); | |
238 | + },1000) | |
239 | + | |
240 | + }else{ | |
241 | + //支付支付,返回首页 | |
242 | + ut.m_toast('支付失败'); | |
243 | + setTimeout(()=>{ | |
244 | + wx.navigateBack(); | |
245 | + },1000) | |
246 | + } | |
247 | + } | |
248 | + }) | |
249 | + }); | |
250 | + | |
251 | + } | |
252 | + | |
253 | + | |
254 | + | |
204 | 255 | th.setData({ show_submit: 0 }); //让提交先掩藏 |
205 | 256 | th.data.g_cart_q_time = null; |
206 | 257 | if (th.data.isclose == 0) { |
... | ... | @@ -2519,6 +2570,9 @@ Page({ |
2519 | 2570 | return false; |
2520 | 2571 | } |
2521 | 2572 | |
2573 | + //-- 订单OK -- | |
2574 | + th.data.ok_order_sn=th.data.order.order_sn; | |
2575 | + | |
2522 | 2576 | util_pay.pay_data(t,function (){ |
2523 | 2577 | //---用余额支付--- |
2524 | 2578 | getApp().my_warnning("支付成功", 1, th); |
... | ... | @@ -2981,6 +3035,8 @@ Page({ |
2981 | 3035 | type: 1 //正常单 |
2982 | 3036 | }, 1);--*/ |
2983 | 3037 | |
3038 | + | |
3039 | + th.data.ok_order_sn=this.data.order.order_sn; | |
2984 | 3040 | util_pay.pay(this.data.order.order_sn, function () { |
2985 | 3041 | wx.showToast({ title: '支付成功' }) |
2986 | 3042 | wx.navigateBack(); | ... | ... |
packageC/pages/presell/cart/cart2.js
... | ... | @@ -157,6 +157,10 @@ Page({ |
157 | 157 | }) |
158 | 158 | }, |
159 | 159 | onLoad: function (t) { |
160 | + | |
161 | + //定义第一次进入 | |
162 | + this.data.fir_in=1; | |
163 | + | |
160 | 164 | wx.setNavigationBarTitle({ title: "填写订单", }) |
161 | 165 | var th = this; |
162 | 166 | |
... | ... | @@ -191,19 +195,51 @@ Page({ |
191 | 195 | //----------子页返回父页触发---------- |
192 | 196 | onShow: function () { |
193 | 197 | var th = this; |
194 | - var fy= ut.fy_back('',0,function (){ | |
195 | - var cps = getCurrentPages(); | |
196 | - if (cps.length > 1) { | |
197 | - wx.navigateBack({ delta: 1 }) | |
198 | - } else { | |
199 | - getApp().goto("/pages/index/index/index"); | |
200 | - } | |
198 | + //判断是不是第一次进入 | |
199 | + if(this.data.fir_in){ | |
200 | + this.data.fir_in=0; | |
201 | + }else{ | |
202 | + //富友支付插件 | |
203 | + var fy= ut.fy_back('',0,function (){ | |
204 | + var cps = getCurrentPages(); | |
205 | + if (cps.length > 1) { | |
206 | + wx.navigateBack({ delta: 1 }) | |
207 | + } else { | |
208 | + getApp().goto("/pages/index/index/index"); | |
209 | + } | |
201 | 210 | |
202 | - }) | |
203 | - if(fy) return false; | |
211 | + }) | |
212 | + if(fy) return false; | |
213 | + util_pay.set_fir(); | |
214 | + | |
215 | + //-- 通联的第三方支付的返回优化 -- | |
216 | + ut.is_pay_ok("/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn, | |
217 | + "/pages/user/order_list/order_list",function (){ | |
218 | + if(!th.data.ok_order_sn) return false; | |
219 | + getApp().request.promiseGet("/api/weshop/order/page", | |
220 | + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ | |
221 | + if(ut.ajax_ok(res)){ | |
222 | + var item=res.data.data.pageData[0]; | |
223 | + if(item.pay_status==1){ | |
224 | + //支付支付,返回首页 | |
225 | + ut.m_toast('支付成功'); | |
226 | + setTimeout(()=>{ | |
227 | + getApp().re_to("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn); | |
228 | + },1000) | |
229 | + | |
230 | + }else{ | |
231 | + //支付支付,返回首页 | |
232 | + ut.m_toast('支付失败'); | |
233 | + setTimeout(()=>{ | |
234 | + getApp().goto("/pages/index/index/index"); | |
235 | + },1000) | |
236 | + } | |
237 | + } | |
238 | + }) | |
239 | + }); | |
240 | + } | |
204 | 241 | |
205 | 242 | |
206 | - util_pay.set_fir(); | |
207 | 243 | th.data.g_cart_q_time = null; |
208 | 244 | if (th.data.isclose == 0) { |
209 | 245 | wx.navigateTo({ |
... | ... | @@ -1667,6 +1703,8 @@ Page({ |
1667 | 1703 | //void e.jumpToCart4({ |
1668 | 1704 | // order_sn: data.data, |
1669 | 1705 | //}, 1); |
1706 | + th.data.ok_order_sn=data.data; | |
1707 | + | |
1670 | 1708 | util_pay.pay(data.data, function () { |
1671 | 1709 | //app.my_warnning("支付成功",1,th); |
1672 | 1710 | //setTimeout(function () { | ... | ... |
packageC/pages/presell/cart/cart2_pre.js
... | ... | @@ -78,6 +78,9 @@ Page({ |
78 | 78 | }) |
79 | 79 | }, |
80 | 80 | onLoad: function (t) { |
81 | + //定义第一次进入 | |
82 | + this.data.fir_in=1; | |
83 | + | |
81 | 84 | wx.setNavigationBarTitle({ |
82 | 85 | title: "填写订单", |
83 | 86 | }); |
... | ... | @@ -280,9 +283,42 @@ Page({ |
280 | 283 | |
281 | 284 | var fy=ut.fy_back("/pages/user/order_list/order_list",1); |
282 | 285 | if(fy) return false; |
283 | - | |
284 | 286 | util_pay.set_fir(); |
285 | 287 | var th = this; |
288 | + //判断是不是第一次进入 | |
289 | + if(this.data.fir_in){ | |
290 | + this.data.fir_in=0; | |
291 | + }else{ | |
292 | + | |
293 | + //-- 支付完成后的跳转的时间 -- | |
294 | + var ok_url = "/packageC/pages/presell/cart/cart?order_sn=" +this.data.ok_order_sn; | |
295 | + var err_url="/pages/user/order_list/order_list"; | |
296 | + //-- 通联的第三方支付的返回优化 -- | |
297 | + ut.is_pay_ok(ok_url,err_url,function (){ | |
298 | + if(!th.data.ok_order_sn) return false; | |
299 | + getApp().request.promiseGet("/api/weshop/order/page", | |
300 | + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ | |
301 | + if(ut.ajax_ok(res)){ | |
302 | + var item=res.data.data.pageData[0]; | |
303 | + if(item.pay_time){ | |
304 | + //支付支付,返回首页 | |
305 | + ut.m_toast('支付成功'); | |
306 | + setTimeout(()=>{ | |
307 | + getApp().re_to(ok_url); | |
308 | + },1000) | |
309 | + | |
310 | + }else{ | |
311 | + //支付支付,返回首页 | |
312 | + ut.m_toast('支付失败'); | |
313 | + setTimeout(()=>{ | |
314 | + getApp().re_to(err_url); | |
315 | + },1000) | |
316 | + } | |
317 | + } | |
318 | + }) | |
319 | + }); | |
320 | + } | |
321 | + | |
286 | 322 | if (th.data.isclose == 0) { |
287 | 323 | wx.navigateTo({ |
288 | 324 | url: "/pages/index/index/index" |
... | ... | @@ -918,6 +954,8 @@ Page({ |
918 | 954 | //要进行判断,如果是用微信支付,就要跳转到支付界面 |
919 | 955 | if (order_amount && parseFloat(order_amount) > 0) { |
920 | 956 | th.setData({ isclose: 0 }); |
957 | + | |
958 | + th.data.ok_order_sn=data.data; | |
921 | 959 | util_pay.pay(data.data, function () { |
922 | 960 | var url = "/packageC/pages/presell/cart/cart?order_sn=" + data.data; |
923 | 961 | setTimeout(function () { | ... | ... |
packageD/pages/user/deposit/prepaid/msg/msg.js
packageD/pages/user/deposit/prepaid/prepaid.js
... | ... | @@ -15,6 +15,10 @@ Page({ |
15 | 15 | perpaid: [], //数据, |
16 | 16 | paying:0 |
17 | 17 | }, |
18 | + onLoad:function (){ | |
19 | + //定义第一次进入 | |
20 | + this.data.fir_in=1; | |
21 | + }, | |
18 | 22 | /* 生命周期函数--监听页面初次渲染完成*/ |
19 | 23 | onReady: function() { |
20 | 24 | var th=this; |
... | ... | @@ -96,19 +100,49 @@ Page({ |
96 | 100 | */ |
97 | 101 | onShow: function () { |
98 | 102 | |
103 | + var th=this; | |
104 | + //判断是不是第一次进入 | |
105 | + if(this.data.fir_in){ | |
106 | + this.data.fir_in=0; | |
107 | + }else{ | |
108 | + //-- 富友插件 -- | |
109 | + ut.fy_back('',0) | |
110 | + t_pay.set_fir(); | |
111 | + | |
112 | + //-- 通联的第三方支付的返回优化 -- | |
113 | + ut.is_pay_ok("/packageD/pages/user/deposit/prepaid/msg/msg","none",function (){ | |
114 | + if(!th.data.ok_order_sn) return false; | |
115 | + var ck_url="/api/weshop/recharge/get/"+os.stoid+"/"+th.data.ok_order_sn; | |
116 | + getApp().request.promiseGet(ck_url,{}).then(res=>{ | |
117 | + if(res.data.code==0 && res.data.data){ | |
118 | + var item=res.data.data; | |
119 | + if(item.pay_status==1){ | |
120 | + //支付支付,返回首页 | |
121 | + ut.m_toast('支付成功'); | |
122 | + setTimeout(()=>{ | |
123 | + getApp().re_to("/packageD/pages/user/deposit/prepaid/msg/msg"); | |
124 | + },1000) | |
99 | 125 | |
126 | + }else{ | |
127 | + //支付支付,返回首页 | |
128 | + ut.m_toast('支付失败'); | |
129 | + | |
130 | + } | |
131 | + } | |
132 | + }) | |
133 | + }); | |
134 | + } | |
100 | 135 | |
101 | 136 | wx.setNavigationBarTitle({ |
102 | 137 | title: "流动资金转预存", |
103 | 138 | }) |
104 | 139 | |
105 | 140 | this.data.paying=0; |
106 | - ut.fy_back('',0) | |
107 | - t_pay.set_fir(); | |
108 | 141 | |
109 | - if(getApp().globalData.user_id && !this.data.is_get){ | |
110 | - this.yuck(); | |
111 | - } | |
142 | + | |
143 | + if(getApp().globalData.user_id && !this.data.is_get){ | |
144 | + this.yuck(); | |
145 | + } | |
112 | 146 | |
113 | 147 | }, |
114 | 148 | //确定充值 |
... | ... | @@ -170,6 +204,8 @@ Page({ |
170 | 204 | var parentSn = msg.order_sn; |
171 | 205 | var store_id = os.stoid; |
172 | 206 | t_pay.set_pay_url("/api/weshop/order/pay/createRechargeOrder"); |
207 | + | |
208 | + e.data.ok_order_sn=parentSn; | |
173 | 209 | t_pay.pay({ |
174 | 210 | parentSn: parentSn, |
175 | 211 | store_id: store_id | ... | ... |
packageD/pages/user/integral/integral.js
... | ... | @@ -208,6 +208,9 @@ Page({ |
208 | 208 | */ |
209 | 209 | onLoad: function (options) { |
210 | 210 | |
211 | + //定义第一次进入 | |
212 | + this.data.fir_in=1; | |
213 | + | |
211 | 214 | var th=this; |
212 | 215 | getApp().request.get("/api/wx/weappSendlist/page", { |
213 | 216 | data: { |
... | ... | @@ -258,6 +261,8 @@ Page({ |
258 | 261 | var store_id = os.stoid; |
259 | 262 | |
260 | 263 | t_pay.set_pay_url("/api/weshop/order/pay/createRechargeOrder"); |
264 | + | |
265 | + th.data.ok_order_sn=parentSn; | |
261 | 266 | t_pay.pay({ |
262 | 267 | parentSn: parentSn, |
263 | 268 | store_id: store_id |
... | ... | @@ -290,10 +295,8 @@ Page({ |
290 | 295 | // }) |
291 | 296 | }) |
292 | 297 | }) |
293 | - | |
294 | - | |
295 | - | |
296 | - }, | |
298 | + | |
299 | + }, | |
297 | 300 | //------支付成功页面-------- |
298 | 301 | jumpPaymentPage: function () { |
299 | 302 | console.log("支付成功页面2333"); |
... | ... | @@ -331,9 +334,44 @@ Page({ |
331 | 334 | */ |
332 | 335 | onShow: function () { |
333 | 336 | |
334 | - ut.fy_back('',0); | |
337 | + | |
338 | + var th=this; | |
339 | + //判断是不是第一次进入 | |
340 | + if(this.data.fir_in){ | |
341 | + this.data.fir_in=0; | |
342 | + }else{ | |
343 | + //-- 富友的插件 -- | |
344 | + ut.fy_back('',0); | |
345 | + t_pay.set_fir(); | |
346 | + | |
347 | + //-- 通联的第三方支付的返回优化 -- | |
348 | + ut.is_pay_ok("/packageD/pages/user/integral/msg/msg",'none',function (){ | |
349 | + | |
350 | + console.log('show--11') | |
351 | + console.log(th.data.ok_order_sn); | |
352 | + | |
353 | + if(!th.data.ok_order_sn) return false; | |
354 | + var ck_url="/api/weshop/recharge/get/"+os.stoid+"/"+th.data.ok_order_sn; | |
355 | + getApp().request.promiseGet(ck_url,{}).then(res=>{ | |
356 | + if(res.data.code==0 && res.data.data){ | |
357 | + var item=res.data.data; | |
358 | + if(item.pay_status==1){ | |
359 | + //支付支付,返回首页 | |
360 | + ut.m_toast('支付成功'); | |
361 | + setTimeout(()=>{ | |
362 | + getApp().re_to("/packageD/pages/user/integral/msg/msg"); | |
363 | + },1000) | |
364 | + | |
365 | + }else{ | |
366 | + //支付支付,返回首页 | |
367 | + ut.m_toast('支付失败'); | |
368 | + } | |
369 | + } | |
370 | + }) | |
371 | + }); | |
372 | + } | |
373 | + | |
335 | 374 | this.data.paying=0; |
336 | - t_pay.set_fir(); | |
337 | 375 | getApp().check_can_share(); |
338 | 376 | //--先判断会员状态-- |
339 | 377 | var user_info = getApp().globalData.userInfo; | ... | ... |
packageD/pages/user/integral/msg/msg.js
packageE/pages/cart/cart2/cart2.js
... | ... | @@ -196,6 +196,8 @@ Page({ |
196 | 196 | |
197 | 197 | onLoad: function (t) { |
198 | 198 | |
199 | + this.data.fir_in=1; | |
200 | + | |
199 | 201 | wx.setNavigationBarTitle({ title: "填写订单", }) |
200 | 202 | var th = this; |
201 | 203 | this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, }); |
... | ... | @@ -271,15 +273,47 @@ Page({ |
271 | 273 | //----------子页返回父页触发---------- |
272 | 274 | onShow: function () { |
273 | 275 | |
274 | - //富友支付取消支付强行回去 | |
275 | - var fy=ut.fy_back("/pages/user/order_list/order_list",1); | |
276 | - if(fy) return false; | |
277 | - | |
278 | - util_pay.set_fir(); | |
279 | 276 | |
280 | 277 | var th = this; |
281 | - th.data.g_cart_q_time = null; | |
278 | + //判断是不是第一次进入 | |
279 | + if(this.data.fir_in){ | |
280 | + this.data.fir_in=0; | |
281 | + }else{ | |
282 | + //富友支付取消支付强行回去 | |
283 | + var fy=ut.fy_back("/pages/user/order_list/order_list",1); | |
284 | + if(fy) return false; | |
285 | + util_pay.set_fir(); | |
286 | + | |
287 | + //-- 通联的第三方支付的返回优化 -- | |
288 | + ut.is_pay_ok("/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn, | |
289 | + "/pages/user/order_list/order_list",function (){ | |
290 | + //支付信息会先记录着 | |
291 | + if(!th.data.ok_order_sn) return false; | |
292 | + getApp().request.promiseGet("/api/weshop/order/page", | |
293 | + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ | |
294 | + if(ut.ajax_ok(res)){ | |
295 | + var item=res.data.data.pageData[0]; | |
296 | + if(item.pay_status==1){ | |
297 | + //支付支付,返回首页 | |
298 | + ut.m_toast('支付成功'); | |
299 | + setTimeout(()=>{ | |
300 | + getApp().re_to("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn); | |
301 | + },1000) | |
282 | 302 | |
303 | + }else{ | |
304 | + //支付支付,返回首页 | |
305 | + ut.m_toast('支付失败'); | |
306 | + setTimeout(()=>{ | |
307 | + getApp().goto("/pages/index/index/index"); | |
308 | + },1000) | |
309 | + } | |
310 | + } | |
311 | + }) | |
312 | + }); | |
313 | + } | |
314 | + | |
315 | + | |
316 | + th.data.g_cart_q_time = null; | |
283 | 317 | if (th.data.isclose == 0) { |
284 | 318 | wx.navigateTo({ |
285 | 319 | url: "/pages/index/index/index" |
... | ... | @@ -5183,8 +5217,7 @@ Page({ |
5183 | 5217 | // order_sn: data.data, |
5184 | 5218 | //}, 1); |
5185 | 5219 | |
5186 | - | |
5187 | - | |
5220 | + th.data.ok_order_sn=data.data; | |
5188 | 5221 | util_pay.pay(data.data, async function () { |
5189 | 5222 | //app.my_warnning("支付成功",1,th); |
5190 | 5223 | //setTimeout(function () { | ... | ... |
packageE/pages/cart/cart2_inte/cart2_inte.js
... | ... | @@ -110,6 +110,8 @@ Page({ |
110 | 110 | }) |
111 | 111 | }, |
112 | 112 | onLoad: function (t) { |
113 | + | |
114 | + this.data.fir_in=1; | |
113 | 115 | wx.setNavigationBarTitle({ title: "填写订单", }) |
114 | 116 | var th = this; |
115 | 117 | th.data.param = t; |
... | ... | @@ -204,20 +206,52 @@ Page({ |
204 | 206 | //----------子页返回父页触发---------- |
205 | 207 | onShow: function () { |
206 | 208 | |
207 | - var fy=ut.fy_back('',1,function (){ | |
208 | - var cps = getCurrentPages(); | |
209 | - if (cps.length > 1) { | |
210 | - wx.navigateBack({ delta: 1 }) | |
211 | - } else { | |
212 | - getApp().goto("/pages/index/index/index"); | |
213 | - } | |
214 | - }); | |
215 | 209 | |
216 | - if(fy) return false; | |
210 | + var th = this; | |
211 | + //判断是不是第一次进入 | |
212 | + if(this.data.fir_in){ | |
213 | + this.data.fir_in=0; | |
214 | + }else{ | |
215 | + //-- 富有的支付插件 -- | |
216 | + var fy=ut.fy_back('',1,function (){ | |
217 | + var cps = getCurrentPages(); | |
218 | + if (cps.length > 1) { | |
219 | + wx.navigateBack({ delta: 1 }) | |
220 | + } else { | |
221 | + getApp().goto("/pages/index/index/index"); | |
222 | + } | |
223 | + }); | |
224 | + if(fy) return false; | |
225 | + util_pay.set_fir(); | |
226 | + | |
227 | + //-- 通联的第三方支付的返回优化 -- | |
228 | + ut.is_pay_ok("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn, | |
229 | + "/pages/user/order_list/order_list",function (){ | |
230 | + if(!th.data.ok_order_sn) return false; | |
231 | + getApp().request.promiseGet("/api/weshop/order/page", | |
232 | + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ | |
233 | + if(ut.ajax_ok(res)){ | |
234 | + var item=res.data.data.pageData[0]; | |
235 | + if(item.pay_status==1){ | |
236 | + //支付支付,返回首页 | |
237 | + ut.m_toast('支付成功'); | |
238 | + setTimeout(()=>{ | |
239 | + getApp().re_to("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn); | |
240 | + },1000) | |
241 | + | |
242 | + }else{ | |
243 | + //支付支付,返回首页 | |
244 | + ut.m_toast('支付失败'); | |
245 | + setTimeout(()=>{ | |
246 | + getApp().goto("/pages/index/index/index"); | |
247 | + },1000) | |
248 | + } | |
249 | + } | |
250 | + }) | |
251 | + }); | |
252 | + } | |
217 | 253 | |
218 | - util_pay.set_fir(); | |
219 | 254 | |
220 | - var th = this; | |
221 | 255 | th.data.g_cart_q_time = null; |
222 | 256 | |
223 | 257 | if (th.data.isclose == 0) { |
... | ... | @@ -1330,6 +1364,8 @@ Page({ |
1330 | 1364 | //void e.jumpToCart4({ |
1331 | 1365 | // order_sn: data.data, |
1332 | 1366 | //}, 1); |
1367 | + | |
1368 | + th.data.ok_order_sn=data.data; | |
1333 | 1369 | util_pay.pay(data.data, function () { |
1334 | 1370 | //app.my_warnning("支付成功",1,th); |
1335 | 1371 | //setTimeout(function () { | ... | ... |
packageE/pages/cart/cart2_pt/cart2_pt.js
... | ... | @@ -585,7 +585,8 @@ Page({ |
585 | 585 | if(fy) return false; |
586 | 586 | util_pay.set_fir(); |
587 | 587 | //-- 通联的第三方支付的返回优化 -- |
588 | - ut.is_pay_ok("/pages/team/team_success/team_success?ordersn=" + th.data.ok_order_sn,null,function (){ | |
588 | + ut.is_pay_ok("/pages/team/team_success/team_success?ordersn=" + th.data.ok_order_sn, | |
589 | + "/pages/user/order_list/order_list",function (){ | |
589 | 590 | if(!th.data.ok_order_sn) return false; |
590 | 591 | getApp().request.promiseGet("/api/weshop/order/page", |
591 | 592 | {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ | ... | ... |
packageE/pages/user/cardinfo/cardinfo.js
... | ... | @@ -50,6 +50,9 @@ Page({ |
50 | 50 | */ |
51 | 51 | onLoad: function (options) { |
52 | 52 | |
53 | + //定义第一次进入 | |
54 | + this.data.fir_in=1; | |
55 | + | |
53 | 56 | //--先判断会员状态-- |
54 | 57 | var user_info = getApp().globalData.userInfo; |
55 | 58 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
... | ... | @@ -683,8 +686,53 @@ Page({ |
683 | 686 | */ |
684 | 687 | onShow: function () { |
685 | 688 | this.data.paying=0; |
686 | - ut.fy_back('',0); | |
687 | - t_pay.set_fir(); | |
689 | + var th=this; | |
690 | + //判断是不是第一次进入 | |
691 | + if(this.data.fir_in){ | |
692 | + this.data.fir_in=0; | |
693 | + }else{ | |
694 | + //-- 富友支付插件的优化 -- | |
695 | + ut.fy_back('',0); | |
696 | + t_pay.set_fir(); | |
697 | + | |
698 | + //-- 通联的第三方支付的返回优化 -- | |
699 | + ut.is_pay_ok("func",'none',function (){ | |
700 | + | |
701 | + console.log('1111'); | |
702 | + console.log(th.data.ok_order_sn); | |
703 | + | |
704 | + if(!th.data.ok_order_sn) return false; | |
705 | + | |
706 | + var ck_url="/api/weshop/recharge/get/"+os.stoid+"/"+th.data.ok_order_sn; | |
707 | + getApp().request.promiseGet(ck_url,{}).then(res=>{ | |
708 | + if(res.data.code==0 && res.data.data){ | |
709 | + | |
710 | + var item=res.data.data; | |
711 | + | |
712 | + console.log('222'); | |
713 | + console.log(item); | |
714 | + | |
715 | + if(item.pay_status==1){ | |
716 | + //支付支付,返回首页 | |
717 | + th.success(); //支付成功提示 | |
718 | + }else{ | |
719 | + //支付支付,返回首页 | |
720 | + ut.m_toast('支付失败'); | |
721 | + } | |
722 | + } | |
723 | + }) | |
724 | + }, | |
725 | + //支付成功后的提示 | |
726 | + function (){ | |
727 | + | |
728 | + console.log('2222'); | |
729 | + console.log(th.data.ok_order_sn); | |
730 | + | |
731 | + th.success(); //支付成功提示 | |
732 | + }); | |
733 | + } | |
734 | + | |
735 | + | |
688 | 736 | //同步初始化 |
689 | 737 | this.init(); |
690 | 738 | |
... | ... | @@ -748,10 +796,7 @@ Page({ |
748 | 796 | |
749 | 797 | //-----立即续费的功能------ |
750 | 798 | xufei:async function(){ |
751 | - | |
752 | - | |
753 | - | |
754 | - var th = this,is_card = 0,end_time=0; | |
799 | + var th = this,is_card = 0,end_time=0; | |
755 | 800 | await getApp().request.promiseGet("/store/storemoduleendtime/page?store_id="+os.stoid+"&type=3", |
756 | 801 | {1:1}).then(res => { |
757 | 802 | if (ut.ajax_ok(res)) { |
... | ... | @@ -789,7 +834,6 @@ Page({ |
789 | 834 | if(this.data.paying) return false; |
790 | 835 | this.data.paying=1; |
791 | 836 | |
792 | - | |
793 | 837 | var item = th.data.user_card; |
794 | 838 | var req = {}; |
795 | 839 | req.cardId = item.CardId; |
... | ... | @@ -801,7 +845,7 @@ Page({ |
801 | 845 | t_pay.pay(req, th.success, function (e) { |
802 | 846 | th.data.paying=0; |
803 | 847 | getApp().my_warnning("支付失败", 0, th); |
804 | - }); | |
848 | + },th); | |
805 | 849 | |
806 | 850 | }, |
807 | 851 | |
... | ... | @@ -872,7 +916,7 @@ Page({ |
872 | 916 | t_pay.pay(req, th.success, function () { |
873 | 917 | th.data.paying=0; |
874 | 918 | getApp().my_warnning("支付失败", 0, th); |
875 | - }); | |
919 | + },th); | |
876 | 920 | }, |
877 | 921 | //显示弹出框 |
878 | 922 | show_change:function () { this.setData({is_show_change_pop:1}); }, | ... | ... |
packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js
1 | 1 | var i = require("../../../../../utils/util.js"); |
2 | +var ut=i; | |
2 | 3 | var com = require("../public/buy_com.js"); |
3 | 4 | var e = getApp(), |
4 | 5 | a = e.globalData.setting, |
... | ... | @@ -74,6 +75,9 @@ Page({ |
74 | 75 | onLoad: function (options) { |
75 | 76 | var th=this; |
76 | 77 | |
78 | + //定义第一次进入 | |
79 | + this.data.fir_in=1; | |
80 | + | |
77 | 81 | this.setData({ |
78 | 82 | params: options, |
79 | 83 | now:Date.parse(new Date()) / 1000, |
... | ... | @@ -143,10 +147,9 @@ Page({ |
143 | 147 | onShow: function () { |
144 | 148 | var th=this; |
145 | 149 | this.setData({submit:0}) |
146 | - | |
147 | - com.set_py_fir(); | |
150 | + | |
148 | 151 | getApp().check_can_share(); |
149 | - var th=this; | |
152 | + | |
150 | 153 | //--先判断会员状态-- |
151 | 154 | getApp().is_Single_page(this, function () { |
152 | 155 | var user_info = getApp().globalData.userInfo; |
... | ... | @@ -164,23 +167,66 @@ Page({ |
164 | 167 | }) |
165 | 168 | this.init(); |
166 | 169 | |
167 | - setTimeout(()=> { | |
168 | - i.fy_back('', 0, function () { | |
170 | + //判断是不是第一次进入 | |
171 | + if(this.data.fir_in){ | |
172 | + this.data.fir_in=0; | |
173 | + }else{ | |
174 | + //富友支付插件 | |
175 | + com.set_py_fir(); | |
176 | + | |
177 | + setTimeout(() => { | |
178 | + i.fy_back('', 0, function () { | |
169 | 179 | |
170 | - console.log(getApp().globalData.py_month_bg, '111111'); | |
171 | - console.log(th.data.back_ord, '22222'); | |
180 | + console.log(getApp().globalData.py_month_bg, '111111'); | |
181 | + console.log(th.data.back_ord, '22222'); | |
172 | 182 | |
173 | - if (getApp().globalData.py_month_bg && th.data.back_ord) { | |
174 | - getApp().globalData.fuyou_clear = 1; | |
175 | - var b_ord = th.data.back_ord; | |
176 | - com.reduce(b_ord, os.stoid); | |
177 | - //要进行清空粗粒 | |
178 | - getApp().globalData.py_month_bg = 0; | |
179 | - th.data.back_ord = null; | |
183 | + if (getApp().globalData.py_month_bg && th.data.back_ord) { | |
184 | + getApp().globalData.fuyou_clear = 1; | |
185 | + var b_ord = th.data.back_ord; | |
186 | + com.reduce(b_ord, os.stoid); | |
187 | + //要进行清空粗粒 | |
188 | + getApp().globalData.py_month_bg = 0; | |
189 | + th.data.back_ord = null; | |
180 | 190 | |
181 | - } | |
182 | - }) | |
183 | - },1000) | |
191 | + } | |
192 | + }) | |
193 | + | |
194 | + var money = th.data.payMoney; | |
195 | + var bk_url = "/packageE/pages/user/monthgiftbag/payment/payment?money=" + money + "&order_sn=" + th.data.back_ord; | |
196 | + //-- 通联的第三方支付的返回优化 -- | |
197 | + ut.is_pay_ok(bk_url, "none", function () { | |
198 | + if (!th.data.back_ord) return false; | |
199 | + //订单查询的接口 | |
200 | + getApp().request.promiseGet("/api/weshop/marketing/marketingMonthgiftbagRecord/page", | |
201 | + { | |
202 | + data: { | |
203 | + store_id: os.stoid, | |
204 | + order_sn: th.data.back_ord, | |
205 | + user_id: getApp().globalData.user_id | |
206 | + } | |
207 | + }).then(res => { | |
208 | + if (ut.ajax_ok(res)) { | |
209 | + | |
210 | + var item = res.data.data.pageData[0]; | |
211 | + if (item.pay_state == 1) { | |
212 | + //支付支付,返回首页 | |
213 | + ut.m_toast('支付成功'); | |
214 | + th.data.back_ord=null; | |
215 | + setTimeout(()=>{ | |
216 | + getApp().goto(bk_url); | |
217 | + },1500) | |
218 | + | |
219 | + } else { | |
220 | + //支付支付,返回首页 | |
221 | + ut.m_toast('支付失败'); | |
222 | + } | |
223 | + } | |
224 | + }) | |
225 | + }, null, null, 1); | |
226 | + | |
227 | + | |
228 | + }, 1000) | |
229 | + } | |
184 | 230 | }, |
185 | 231 | //获取搜索门店输入的值 |
186 | 232 | input_store: function(e) { | ... | ... |
packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js
... | ... | @@ -83,6 +83,8 @@ Page({ |
83 | 83 | sec_i:-1,//选中分类门店 下标 |
84 | 84 | }, |
85 | 85 | onLoad: function (options) { |
86 | + //定义第一次进入 | |
87 | + this.data.fir_in=1; | |
86 | 88 | |
87 | 89 | var th = this; |
88 | 90 | console.log('分享参数---'); |
... | ... | @@ -412,7 +414,10 @@ Page({ |
412 | 414 | onShow: function () { |
413 | 415 | var th=this; |
414 | 416 | this.setData({submit:0}) |
415 | - com.set_py_fir(); | |
417 | + | |
418 | + //res = res.data.data.result; | |
419 | + //if (!res) return false; | |
420 | + | |
416 | 421 | getApp().check_can_share(this); |
417 | 422 | getApp().is_Single_page(this, function () { |
418 | 423 | //--先判断会员状态-- |
... | ... | @@ -429,25 +434,64 @@ Page({ |
429 | 434 | } |
430 | 435 | }) |
431 | 436 | |
432 | - setTimeout(()=>{ | |
433 | - ut.fy_back('',0,function (){ | |
434 | - if(getApp().globalData.py_month_bg && th.data.back_ord){ | |
435 | - getApp().globalData.fuyou_clear=1; | |
436 | - var b_ord=th.data.back_ord; | |
437 | - com.reduce(b_ord,os.stoid); | |
438 | - //要进行清空粗粒 | |
439 | - getApp().globalData.py_month_bg=0; | |
440 | - th.data.back_ord=null; | |
441 | 437 | |
442 | - } | |
443 | - }) | |
444 | - },1000) | |
438 | + //判断是不是第一次进入 | |
439 | + if(this.data.fir_in){ | |
440 | + this.data.fir_in=0; | |
441 | + }else { | |
442 | + com.set_py_fir(); | |
443 | + | |
444 | + setTimeout(() => { | |
445 | + ut.fy_back('', 0, function () { | |
446 | + if (getApp().globalData.py_month_bg && th.data.back_ord) { | |
447 | + getApp().globalData.fuyou_clear = 1; | |
448 | + var b_ord = th.data.back_ord; | |
449 | + com.reduce(b_ord, os.stoid); | |
450 | + //要进行清空粗粒 | |
451 | + getApp().globalData.py_month_bg = 0; | |
452 | + th.data.back_ord = null; | |
453 | + | |
454 | + } | |
455 | + }) | |
456 | + | |
457 | + var money=th.data.payMoney; | |
458 | + var bk_url = "/packageE/pages/user/monthgiftbag/payment/payment?money=" + money + "&order_sn=" + th.data.back_ord; | |
459 | + | |
460 | + //-- 通联的第三方支付的返回优化 -- | |
461 | + ut.is_pay_ok(bk_url,"none",function (){ | |
462 | + if(!th.data.back_ord) return false; | |
463 | + getApp().request.promiseGet("/api/weshop/marketing/marketingMonthgiftbagRecord/page", | |
464 | + {data:{store_id:os.stoid,order_sn:th.data.back_ord,user_id:getApp().globalData.user_id}}).then(res=>{ | |
465 | + | |
466 | + if(ut.ajax_ok(res)){ | |
467 | + var item=res.data.data.pageData[0]; | |
468 | + if(item.pay_state==1){ | |
469 | + //支付支付,返回首页 | |
470 | + ut.m_toast('支付成功'); | |
471 | + th.data.back_ord=null; | |
472 | + setTimeout(()=>{ | |
473 | + getApp().goto(bk_url); | |
474 | + },1000) | |
475 | + | |
476 | + }else{ | |
477 | + //支付支付,返回首页 | |
478 | + ut.m_toast('支付失败'); | |
479 | + setTimeout(()=>{ | |
480 | + getApp().goto("/pages/index/index/index"); | |
481 | + },1000) | |
482 | + } | |
483 | + } | |
484 | + }) | |
485 | + },null,null,1); | |
486 | + | |
487 | + }, 1000) | |
488 | + } | |
445 | 489 | |
446 | 490 | }, |
447 | 491 | GetBuyPrice: function (e) { |
448 | 492 | var that = this.data; |
449 | 493 | var th = this; |
450 | - let scene =this.data.scene; | |
494 | + let scene=this.data.scene; | |
451 | 495 | if (scene==1154) { |
452 | 496 | wx.navigateTo({ |
453 | 497 | url: '/packageE/pages/togoin/togoin', | ... | ... |
pages/cart/cart_wk/cart_wk.js
... | ... | @@ -60,6 +60,9 @@ Page({ |
60 | 60 | */ |
61 | 61 | onLoad: function (options) { |
62 | 62 | |
63 | + //定义第一次进入 | |
64 | + this.data.fir_in=1; | |
65 | + | |
63 | 66 | //清空is_pick_up |
64 | 67 | getApp().request.put("/api/weshop/useraddress/updatePickUp", { |
65 | 68 | data: { user_id: getApp().globalData.user_id, is_pickup: 0 }, |
... | ... | @@ -94,11 +97,47 @@ Page({ |
94 | 97 | */ |
95 | 98 | onShow: function () { |
96 | 99 | |
97 | - ut.fy_back('',0); | |
98 | - this.data.paying=0; | |
99 | - util_pay.set_fir(); | |
100 | - getApp().check_can_share(); | |
101 | 100 | var th = this; |
101 | + //判断是不是第一次进入 | |
102 | + if(this.data.fir_in){ | |
103 | + this.data.fir_in=0; | |
104 | + }else{ | |
105 | + //-- 富友插件的优化 -- | |
106 | + ut.fy_back('',0); | |
107 | + this.data.paying=0; | |
108 | + util_pay.set_fir(); | |
109 | + | |
110 | + //-- 通联的第三方支付的返回优化 -- | |
111 | + ut.is_pay_ok("/pages/payment/pay_success/pay_success?type=1&order_sn=" + this.data.ok_order_sn,'back',function (){ | |
112 | + if(!th.data.ok_order_sn) return false; | |
113 | + getApp().request.promiseGet("/api/weshop/order/page", | |
114 | + {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ | |
115 | + | |
116 | + if(ut.ajax_ok(res)){ | |
117 | + var item=res.data.data.pageData[0]; | |
118 | + //已经支付尾款,或者所有的会员都已经支付尾款 | |
119 | + if(item.pt_status==4 || item.pt_status==5){ | |
120 | + //支付支付,返回首页 | |
121 | + ut.m_toast('支付成功'); | |
122 | + setTimeout(()=>{ | |
123 | + getApp().re_to("/pages/payment/pay_success/pay_success?type=1&order_sn=" + th.data.ok_order_sn); | |
124 | + },1000) | |
125 | + | |
126 | + }else{ | |
127 | + //支付支付,返回首页 | |
128 | + ut.m_toast('支付失败'); | |
129 | + setTimeout(()=>{ | |
130 | + getApp().goto("/pages/index/index/index"); | |
131 | + },1000) | |
132 | + } | |
133 | + } | |
134 | + }) | |
135 | + }); | |
136 | + | |
137 | + } | |
138 | + | |
139 | + getApp().check_can_share(); | |
140 | + | |
102 | 141 | if (th.data.isclose == 0) { |
103 | 142 | wx.navigateTo({ |
104 | 143 | url: "/pages/index/index/index" |
... | ... | @@ -652,6 +691,8 @@ Page({ |
652 | 691 | return false; |
653 | 692 | } |
654 | 693 | |
694 | + //-- 把订单号记录起来 -- | |
695 | + th.data.ok_order_sn=th.data.order.order_sn; | |
655 | 696 | util_pay.pay_data(t,function (){ |
656 | 697 | var allmoney = th.data.allpice; |
657 | 698 | th.jumpPaymentPage(th.data.order.order_sn, allmoney); | ... | ... |
pages/giftpack/buygiftpack/giftpackbuy.js
1 | 1 | var i = require("../../../utils/util.js"); |
2 | +var ut=i; | |
2 | 3 | var com = require("../public/buy_com.js"); |
3 | 4 | var e = getApp(), |
4 | 5 | a = e.globalData.setting, |
... | ... | @@ -74,6 +75,9 @@ Page({ |
74 | 75 | onLoad: function (options) { |
75 | 76 | var th=this; |
76 | 77 | |
78 | + //定义第一次进入 | |
79 | + this.data.fir_in=1; | |
80 | + | |
77 | 81 | this.setData({ |
78 | 82 | params: options, |
79 | 83 | now:Date.parse(new Date()) / 1000, |
... | ... | @@ -143,10 +147,51 @@ Page({ |
143 | 147 | onShow: function () { |
144 | 148 | |
145 | 149 | this.setData({submit:0}) |
146 | - i.fy_back('',0); | |
147 | - com.set_py_fir(); | |
148 | - getApp().check_can_share(); | |
149 | 150 | var th=this; |
151 | + | |
152 | + //判断是不是第一次进入 | |
153 | + if(this.data.fir_in){ | |
154 | + this.data.fir_in=0; | |
155 | + }else{ | |
156 | + //富友支付插件 | |
157 | + i.fy_back('',0); | |
158 | + com.set_py_fir(); | |
159 | + | |
160 | + //-- 通联的第三方支付的返回优化 -- | |
161 | + var money=th.data.payMoney; | |
162 | + var back_url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + th.data.ok_order_sn; | |
163 | + | |
164 | + ut.is_pay_ok(back_url,'none',function (){ | |
165 | + if(!th.data.ok_order_sn) return false; | |
166 | + getApp().request.promiseGet("/api/weshop/marketing/my/giftbag/detail/get", | |
167 | + {data:{storeId:os.stoid,orderSn:th.data.ok_order_sn,userId:getApp().globalData.user_id}}).then(res=>{ | |
168 | + | |
169 | + th.data.ok_order_sn=null; | |
170 | + | |
171 | + if(res.data.code==0 && res.data.data){ | |
172 | + var item=res.data.data; | |
173 | + if(item.payState==1){ | |
174 | + //支付支付,返回首页 | |
175 | + ut.m_toast('支付成功'); | |
176 | + setTimeout(()=>{ | |
177 | + getApp().goto(back_url); | |
178 | + },1000) | |
179 | + | |
180 | + }else{ | |
181 | + //支付支付,返回首页 | |
182 | + ut.m_toast('支付失败'); | |
183 | + } | |
184 | + } | |
185 | + }) | |
186 | + },null,null,1); | |
187 | + | |
188 | + | |
189 | + } | |
190 | + | |
191 | + | |
192 | + | |
193 | + getApp().check_can_share(); | |
194 | + | |
150 | 195 | //--先判断会员状态-- |
151 | 196 | getApp().is_Single_page(this, function () { |
152 | 197 | var user_info = getApp().globalData.userInfo; | ... | ... |
pages/giftpack/giftpacklist/giftpacklist.js
... | ... | @@ -82,6 +82,9 @@ Page({ |
82 | 82 | }, |
83 | 83 | onLoad: function (options) { |
84 | 84 | |
85 | + //定义第一次进入 | |
86 | + this.data.fir_in=1; | |
87 | + | |
85 | 88 | var th = this; |
86 | 89 | |
87 | 90 | this.setData({ |
... | ... | @@ -170,8 +173,45 @@ Page({ |
170 | 173 | |
171 | 174 | onShow: function () { |
172 | 175 | this.setData({submit:0}) |
173 | - ut.fy_back('',0); | |
174 | - com.set_py_fir(); | |
176 | + | |
177 | + var th=this; | |
178 | + //判断是不是第一次进入 | |
179 | + if(this.data.fir_in){ | |
180 | + this.data.fir_in=0; | |
181 | + }else{ | |
182 | + //富友支付插件的判断 | |
183 | + ut.fy_back('',0); | |
184 | + com.set_py_fir(); | |
185 | + | |
186 | + //-- 通联的第三方支付的返回优化 -- | |
187 | + var money=th.data.payMoney; | |
188 | + var back_url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + th.data.ok_order_sn; | |
189 | + | |
190 | + ut.is_pay_ok(back_url,'none',function (){ | |
191 | + if(!th.data.ok_order_sn) return false; | |
192 | + getApp().request.promiseGet("/api/weshop/marketing/my/giftbag/detail/get", | |
193 | + {data:{storeId:os.stoid,orderSn:th.data.ok_order_sn,userId:getApp().globalData.user_id}}).then(res=>{ | |
194 | + | |
195 | + th.data.ok_order_sn=null; | |
196 | + if(res.data.code==0 && res.data.data){ | |
197 | + var item=res.data.data; | |
198 | + if(item.payState==1){ | |
199 | + //支付支付,返回首页 | |
200 | + ut.m_toast('支付成功'); | |
201 | + setTimeout(()=>{ | |
202 | + getApp().goto(back_url); | |
203 | + },1000) | |
204 | + | |
205 | + }else{ | |
206 | + //支付支付,返回首页 | |
207 | + ut.m_toast('支付失败'); | |
208 | + } | |
209 | + } | |
210 | + }) | |
211 | + },null,null,1); | |
212 | + } | |
213 | + | |
214 | + | |
175 | 215 | getApp().check_can_share(this); |
176 | 216 | getApp().is_Single_page(this, function () { |
177 | 217 | //--先判断会员状态-- | ... | ... |
pages/giftpack/public/buy_com.js
... | ... | @@ -251,9 +251,6 @@ module.exports = { |
251 | 251 | function (res) { |
252 | 252 | if (res.data.code == 0 && res.data.data) { |
253 | 253 | |
254 | - | |
255 | - | |
256 | - | |
257 | 254 | switch(that.data.buyType){ |
258 | 255 | case 1://立即兑换 |
259 | 256 | var order_sn = res.data.data; |
... | ... | @@ -266,6 +263,7 @@ module.exports = { |
266 | 263 | case 2://立即购买 |
267 | 264 | |
268 | 265 | var order_sn = res.data.data.orderSn; |
266 | + that.data.ok_order_sn=order_sn; | |
269 | 267 | |
270 | 268 | var money=that.data.payMoney; |
271 | 269 | var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; | ... | ... |
pages/user/order_detail/order_detail.js
... | ... | @@ -16,6 +16,9 @@ Page({ |
16 | 16 | }, |
17 | 17 | onLoad: function(e) { |
18 | 18 | |
19 | + //定义第一次进入 | |
20 | + this.data.fir_in=1; | |
21 | + | |
19 | 22 | var th=this; |
20 | 23 | var r = void 0 !== e.isGoup && e.isGoup; |
21 | 24 | |
... | ... | @@ -64,9 +67,45 @@ Page({ |
64 | 67 | }), this.requestOrderDetail(e.order_id), wx.removeStorageSync("order:order_detail:update"); |
65 | 68 | }, |
66 | 69 | onShow: function() { |
67 | - ut.fy_back('',0) | |
70 | + | |
71 | + var th=this; | |
68 | 72 | this.setData({paying:0}); |
69 | - py.set_fir(); | |
73 | + | |
74 | + //判断是不是第一次进入 | |
75 | + if(this.data.fir_in){ | |
76 | + this.data.fir_in=0; | |
77 | + }else{ | |
78 | + //富友支付 | |
79 | + ut.fy_back('',0) | |
80 | + py.set_fir(); | |
81 | + | |
82 | + //通联第三方 | |
83 | + //-- 通联的第三方支付的返回优化 -- | |
84 | + ut.is_pay_ok("back","none",function (){ | |
85 | + if(!th.data.ok_order_sn) return false; | |
86 | + getApp().request.promiseGet("/api/weshop/order/page", | |
87 | + {data:{store_id:os.stoid,order_sn:th.data.ok_order_sn}}).then(res=>{ | |
88 | + if(ut.ajax_ok(res)){ | |
89 | + var item=res.data.data.pageData[0]; | |
90 | + if(item.pay_status==1){ | |
91 | + //支付支付,返回首页 | |
92 | + ut.m_toast('支付成功'); | |
93 | + setTimeout(()=>{ | |
94 | + wx.navigateBack(); | |
95 | + },1000) | |
96 | + | |
97 | + }else{ | |
98 | + //支付支付,返回首页 | |
99 | + ut.m_toast('支付失败'); | |
100 | + setTimeout(()=>{ | |
101 | + wx.navigateBack(); | |
102 | + },1000) | |
103 | + } | |
104 | + } | |
105 | + }) | |
106 | + }); | |
107 | + } | |
108 | + | |
70 | 109 | wx.getStorageSync("order:order_detail:update") && (wx.removeStorageSync("order:order_detail:update"), |
71 | 110 | this.requestOrderDetail(this.data.order.order_id)); |
72 | 111 | }, |
... | ... | @@ -1132,6 +1171,7 @@ Page({ |
1132 | 1171 | } |
1133 | 1172 | |
1134 | 1173 | |
1174 | + th.data.ok_order_sn=this.data.order.order_sn; | |
1135 | 1175 | py.pay(this.data.order.order_sn, function() { |
1136 | 1176 | th.setData({paying:0}); |
1137 | 1177 | wx.showToast({title: '支付成功'}) | ... | ... |
pages/user/plus/plus.js
... | ... | @@ -56,8 +56,11 @@ Page({ |
56 | 56 | * 生命周期函数--监听页面加载 |
57 | 57 | */ |
58 | 58 | onLoad: function (options) { |
59 | - var that = this, | |
60 | - th = that; | |
59 | + | |
60 | + //定义第一次进入 | |
61 | + this.data.fir_in=1; | |
62 | + | |
63 | + var that = this,th = that; | |
61 | 64 | var store_id = getApp().globalData.setting.stoid; |
62 | 65 | //获取用户设备信息,屏幕宽度 |
63 | 66 | wx.getSystemInfo({ |
... | ... | @@ -130,17 +133,60 @@ Page({ |
130 | 133 | onShow: function () { |
131 | 134 | var user_info = getApp().globalData.userInfo; |
132 | 135 | if (!user_info) return false; |
133 | - ut.fy_back('',0); | |
136 | + | |
137 | + var th = this,that = th; | |
138 | + | |
139 | + //判断是不是第一次进入 | |
140 | + if(this.data.fir_in){ | |
141 | + this.data.fir_in=0; | |
142 | + }else{ | |
143 | + //富友插件支付 | |
144 | + ut.fy_back('',0); | |
145 | + t_pay.set_fir(); | |
146 | + //-- 通联的第三方支付的返回优化 -- | |
147 | + ut.is_pay_ok("func","func",function (){ | |
148 | + | |
149 | + if(!th.data.ok_order_sn) return false; | |
150 | + var ck_url="/api/weshop/recharge/get/"+os.stoid+"/"+th.data.ok_order_sn; | |
151 | + getApp().request.promiseGet(ck_url,{}).then(res=>{ | |
152 | + | |
153 | + if(res.data.code==0 && res.data.data){ | |
154 | + var item=res.data.data; | |
155 | + if(item.pay_status==1){ | |
156 | + //支付支付,返回首页 | |
157 | + th.success() | |
158 | + | |
159 | + }else{ | |
160 | + //支付支付,返回首页 | |
161 | + getApp().my_warnning('支付失败', 0, th); | |
162 | + th.setData({ | |
163 | + is_select:0, | |
164 | + focus:true, | |
165 | + }) | |
166 | + } | |
167 | + } | |
168 | + }) | |
169 | + }, //成功的回调 | |
170 | + function (){ | |
171 | + th.success(); | |
172 | + },//失败的回调 | |
173 | + function (){ | |
174 | + | |
175 | + getApp().my_warnning('支付失败', 0, th); | |
176 | + th.setData({ | |
177 | + is_select:0, | |
178 | + focus:true, | |
179 | + }) | |
180 | + | |
181 | + }); | |
182 | + } | |
134 | 183 | |
135 | 184 | this.setData({ |
136 | 185 | is_select:0, |
137 | 186 | focus:true, |
138 | 187 | }) |
139 | - t_pay.set_fir(); | |
140 | 188 | |
141 | - var th = this, | |
142 | - that = th, | |
143 | - app_d = getApp().globalData; | |
189 | + var app_d = getApp().globalData; | |
144 | 190 | var store_id = os.stoid; |
145 | 191 | var fir_leader = this.data.fir_leader; |
146 | 192 | |
... | ... | @@ -196,9 +242,9 @@ Page({ |
196 | 242 | var userInfo = e.data.data; |
197 | 243 | if (userInfo['card_field'] && !getApp().globalData.is_card_back) { |
198 | 244 | var u_url = "/packageE/pages/user/cardinfo/cardinfo"; |
199 | - wx.reLaunch({ | |
200 | - url: u_url | |
201 | - }) | |
245 | + // wx.reLaunch({ | |
246 | + // url: u_url | |
247 | + // }) | |
202 | 248 | } |
203 | 249 | }, |
204 | 250 | }); |
... | ... | @@ -476,7 +522,7 @@ Page({ |
476 | 522 | is_select:0, |
477 | 523 | focus:true, |
478 | 524 | }) |
479 | - }); | |
525 | + },th); | |
480 | 526 | } |
481 | 527 | }, |
482 | 528 | //返回会员页面 |
... | ... | @@ -506,13 +552,12 @@ Page({ |
506 | 552 | t_pay.set_pay_url('/api/weshop/plus/create/plus/order'); |
507 | 553 | t_pay.pay(req, th.success, function (msg) { |
508 | 554 | if(!msg) msg="支付失败"; |
509 | - | |
510 | 555 | getApp().my_warnning(msg, 0, th); |
511 | 556 | th.setData({ |
512 | 557 | is_select:0, |
513 | 558 | focus:true, |
514 | 559 | }) |
515 | - }); | |
560 | + },th); | |
516 | 561 | } |
517 | 562 | } else { |
518 | 563 | getApp().my_warnning(res.data.msg, 0, th); | ... | ... |
utils/pay.js
... | ... | @@ -49,6 +49,9 @@ module.exports = { |
49 | 49 | wx.hideLoading(); |
50 | 50 | if(t.data.code==0){ |
51 | 51 | |
52 | + | |
53 | + var is_pos_pay=t.data.data.is_pos_pay; | |
54 | + //-- 富有的插件支付 -- | |
52 | 55 | if(t.data.data.is_fuioupay){ |
53 | 56 | const plugin = requirePlugin('fuiou-pay') |
54 | 57 | getApp().globalData.no_clear=1; |
... | ... | @@ -84,12 +87,26 @@ module.exports = { |
84 | 87 | },1000) |
85 | 88 | |
86 | 89 | }) |
90 | + } | |
91 | + //-- 通联的支付插件 -- | |
92 | + else if(is_pos_pay){ | |
93 | + | |
94 | + var p_data=t.data.data; | |
95 | + delete p_data.is_pos_pay; //清理掉,不然签名不通过 | |
96 | + wx.openEmbeddedMiniProgram({ | |
97 | + appId: 'wxef277996acc166c3', | |
98 | + extraData: p_data, | |
99 | + fail(){ | |
100 | + //-- 取消不支付 -- | |
101 | + i.wx_paying=0; | |
102 | + "function" == typeof a && a(); | |
103 | + } | |
104 | + }) | |
105 | + | |
87 | 106 | }else{ |
88 | 107 | i.weixinPay(t.data.data, e, a); |
89 | 108 | } |
90 | 109 | |
91 | - | |
92 | - | |
93 | 110 | }else{ |
94 | 111 | i.wx_paying=0; |
95 | 112 | getApp().confirmBox(t.data.msg); |
... | ... | @@ -125,6 +142,7 @@ module.exports = { |
125 | 142 | fail('支付参数错误'); |
126 | 143 | return false; |
127 | 144 | } |
145 | + //富友插件的优化 | |
128 | 146 | if(ob.is_fuioupay){ |
129 | 147 | const plugin = requirePlugin('fuiou-pay') |
130 | 148 | |
... | ... | @@ -150,7 +168,24 @@ module.exports = { |
150 | 168 | fail(msg) |
151 | 169 | |
152 | 170 | }) |
153 | - }else { | |
171 | + } | |
172 | + //-- 通联的支付插件 -- | |
173 | + else if(ob.is_pos_pay){ | |
174 | + | |
175 | + var p_data=t.data.data; | |
176 | + delete p_data.is_pos_pay; //清理掉,不然签名不通过 | |
177 | + wx.openEmbeddedMiniProgram({ | |
178 | + appId: 'wxef277996acc166c3', | |
179 | + extraData: p_data, | |
180 | + fail(){ | |
181 | + //-- 取消不支付 -- | |
182 | + i.wx_paying=0; | |
183 | + "function" == typeof a && a(); | |
184 | + } | |
185 | + }) | |
186 | + | |
187 | + } | |
188 | + else { | |
154 | 189 | this.weixinPay(ob, succ, fail); |
155 | 190 | } |
156 | 191 | }, | ... | ... |
utils/pay2.js
... | ... | @@ -10,7 +10,8 @@ module.exports = { |
10 | 10 | this.wx_paying=0; |
11 | 11 | }, |
12 | 12 | //-- createRechargeOrder create/plus/order -- |
13 | - pay: function(dd, succ,fail) { | |
13 | + // get_order是通联专用,获取订单号 | |
14 | + pay: function(dd, succ,fail,th) { | |
14 | 15 | if(this.wx_paying) return false; |
15 | 16 | this.wx_paying=1; |
16 | 17 | wx.showLoading(); |
... | ... | @@ -24,6 +25,7 @@ module.exports = { |
24 | 25 | "function" == typeof succ && succ(1); |
25 | 26 | }else{ |
26 | 27 | |
28 | + var is_pos_pay=t.data.data.is_pos_pay; | |
27 | 29 | if(t.data.data.is_fuioupay){ |
28 | 30 | const plugin = requirePlugin('fuiou-pay') |
29 | 31 | getApp().globalData.no_clear=1; |
... | ... | @@ -51,6 +53,32 @@ module.exports = { |
51 | 53 | fail(msg) |
52 | 54 | i.wx_paying=0; |
53 | 55 | }) |
56 | + } | |
57 | + //-- 通联的支付插件 -- | |
58 | + else if(is_pos_pay){ | |
59 | + var p_data=t.data.data; | |
60 | + delete p_data.is_pos_pay; //清理掉,不然签名不通过 | |
61 | + | |
62 | + if(th){ | |
63 | + | |
64 | + var ordno=p_data.reqsn; | |
65 | + if(ordno.indexOf('_')){ | |
66 | + var str_arr=ordno.split('_'); | |
67 | + ordno=str_arr[0]; | |
68 | + } | |
69 | + th.data.ok_order_sn=ordno; | |
70 | + } | |
71 | + | |
72 | + wx.openEmbeddedMiniProgram({ | |
73 | + appId: 'wxef277996acc166c3', | |
74 | + extraData: p_data, | |
75 | + fail(){ | |
76 | + | |
77 | + //-- 取消不支付 -- | |
78 | + i.wx_paying=0; | |
79 | + "function" == typeof fail && fail('取消支付'); | |
80 | + } | |
81 | + }) | |
54 | 82 | }else { |
55 | 83 | i.weixinPay(t.data.data, succ, fail); |
56 | 84 | } |
... | ... | @@ -75,9 +103,11 @@ module.exports = { |
75 | 103 | }, |
76 | 104 | |
77 | 105 | //-- 这里是专享礼包的调用 -- |
78 | - pay_data:function (t,succ,fail){ | |
106 | + pay_data:function (t,succ,fail,get_order){ | |
79 | 107 | var th=this; |
80 | 108 | var ob=t.data.data.result; |
109 | + this.wx_paying=1; | |
110 | + | |
81 | 111 | if(!ob){ |
82 | 112 | this.set_fir(); |
83 | 113 | fail('支付参数错误'); |
... | ... | @@ -113,7 +143,28 @@ module.exports = { |
113 | 143 | fail(msg) |
114 | 144 | |
115 | 145 | }) |
116 | - }else { | |
146 | + } | |
147 | + | |
148 | + //-- 通联的支付插件 -- | |
149 | + else if(ob.is_pos_pay){ | |
150 | + var p_data=ob; | |
151 | + delete p_data.is_pos_pay; //清理掉,不然签名不通过 | |
152 | + if(get_order){ | |
153 | + get_order(p_data.reqsn); //把单号返回 | |
154 | + } | |
155 | + | |
156 | + wx.openEmbeddedMiniProgram({ | |
157 | + appId: 'wxef277996acc166c3', | |
158 | + extraData: p_data, | |
159 | + fail(){ | |
160 | + //-- 取消不支付 -- | |
161 | + th.wx_paying=0; | |
162 | + "function" == typeof a && a(); | |
163 | + } | |
164 | + }) | |
165 | + } | |
166 | + | |
167 | + else { | |
117 | 168 | this.weixinPay(ob, succ, fail); |
118 | 169 | } |
119 | 170 | }, | ... | ... |
utils/util.js
... | ... | @@ -799,7 +799,7 @@ module.exports = { |
799 | 799 | return false |
800 | 800 | }, |
801 | 801 | |
802 | - //优惠促销的数据的格式话 | |
802 | + //-- 优惠促销的数据的格式话 -- | |
803 | 803 | format_yh_act(fir_act){ |
804 | 804 | var more_arr = []; |
805 | 805 | if(fir_act){ |
... | ... | @@ -874,6 +874,99 @@ module.exports = { |
874 | 874 | } |
875 | 875 | return more_arr |
876 | 876 | }, |
877 | + | |
878 | + //-- 长的提示框 -- | |
879 | + m_toast(txt){ | |
880 | + wx.showToast({ | |
881 | + title: txt, | |
882 | + icon: 'none', | |
883 | + duration: 2500 | |
884 | + }) | |
885 | + }, | |
886 | + //-- 支付的结果判断是不是完成了,通联支付pos收银的返回 -- | |
887 | + /** | |
888 | + * | |
889 | + * @param back_url 如果是地址,就跳转,如果是back,就返回。如果是func,就是要回调 | |
890 | + * @param err_url 如果是地址,就跳转,如果是back,就返回。如果是func,就是要回调,如果是none,就没有反应,提示而已 | |
891 | + * @param func 因为是物理键的返回,所以要调用结果,查询结果 | |
892 | + * @param success //成功的回调函数, 当back_url是func | |
893 | + * @param fail //失败的回调函数, 当err_url是func | |
894 | + * @param is_navigateTo //跳转的页面是不是要is_re_to | |
895 | + */ | |
896 | + is_pay_ok(back_url,err_url,func,success,fail,is_navigateTo){ | |
897 | + if(!err_url){ | |
898 | + err_url="/pages/index/index/index"; | |
899 | + } | |
900 | + | |
901 | + | |
902 | + | |
903 | + let options = wx.getEnterOptionsSync(); | |
904 | + if (options.scene == '1038' && options.referrerInfo.appId=='wxef277996acc166c3') { | |
905 | + let extraData = options.referrerInfo.extraData; | |
906 | + if (!extraData) { | |
907 | + if(func) func(); | |
908 | + } else { | |
909 | + // "支付成功"; | |
910 | + if (extraData.code == 'success') { | |
911 | + this.m_toast("支付成功") | |
912 | + //支付失败 | |
913 | + setTimeout(function () { | |
914 | + if(back_url=='back') { | |
915 | + wx.navigateBack(); | |
916 | + } | |
917 | + else if(back_url=='func'){ | |
918 | + success(); | |
919 | + } | |
920 | + else if(back_url!='none'){ | |
921 | + | |
922 | + if(is_navigateTo){ | |
923 | + getApp().goto(back_url) //跳到tabbar页 | |
924 | + }else{ | |
925 | + wx.redirectTo({ url: back_url}); | |
926 | + } | |
927 | + | |
928 | + | |
929 | + } | |
930 | + },2000) | |
931 | + } | |
932 | + // "支付已取消"; | |
933 | + else if (extraData.code == 'cancel') { | |
934 | + this.m_toast("取消支付") | |
935 | + //支付失败 | |
936 | + setTimeout(function () { | |
937 | + if(err_url=='back'){ | |
938 | + wx.navigateBack(); | |
939 | + } | |
940 | + else if(err_url=='func'){ | |
941 | + fail(); | |
942 | + } | |
943 | + else if(err_url!='none'){ | |
944 | + if(is_navigateTo){ | |
945 | + getApp.goto({ url: err_url, }) //跳到tabbar页 | |
946 | + }else { | |
947 | + wxd.redirectTo(err_url); | |
948 | + } | |
949 | + } | |
950 | + | |
951 | + },2000) | |
952 | + } | |
953 | + // "支付失败:" + extraData.errmsg; | |
954 | + else { | |
955 | + this.m_toast("支付失败:" + extraData.errmsg) | |
956 | + //支付失败 | |
957 | + setTimeout(function () { | |
958 | + if(err_url=='back'){ | |
959 | + wx.navigateBack(); | |
960 | + }else{ | |
961 | + getApp().goto(err_url); | |
962 | + } | |
963 | + },2000) | |
964 | + } | |
965 | + | |
966 | + } | |
967 | + | |
968 | + } | |
969 | + }, | |
877 | 970 | |
878 | 971 | unserialize: unserialize, |
879 | 972 | _throttle:_throttle, | ... | ... |