Commit ed6b9b2affe6514a06b5c0855bf40ec1327d6b3f
1 parent
1475fa0f
月包的支付的优化
Showing
2 changed files
with
113 additions
and
30 deletions
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,60 @@ 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 | + var item = res.data.data.pageData[0]; | |
210 | + if (item.pay_status == 1) { | |
211 | + //支付支付,返回首页 | |
212 | + ut.m_toast('支付成功'); | |
213 | + } else { | |
214 | + //支付支付,返回首页 | |
215 | + ut.m_toast('支付失败'); | |
216 | + } | |
217 | + } | |
218 | + }) | |
219 | + }, null, null, 1); | |
220 | + | |
221 | + | |
222 | + }, 1000) | |
223 | + } | |
184 | 224 | }, |
185 | 225 | //获取搜索门店输入的值 |
186 | 226 | 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,19 +434,57 @@ 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_status==1){ | |
469 | + //支付支付,返回首页 | |
470 | + ut.m_toast('支付成功'); | |
471 | + setTimeout(()=>{ | |
472 | + getApp().goto("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn); | |
473 | + },1000) | |
474 | + | |
475 | + }else{ | |
476 | + //支付支付,返回首页 | |
477 | + ut.m_toast('支付失败'); | |
478 | + setTimeout(()=>{ | |
479 | + getApp().goto("/pages/index/index/index"); | |
480 | + },1000) | |
481 | + } | |
482 | + } | |
483 | + }) | |
484 | + },null,null,1); | |
485 | + | |
486 | + }, 1000) | |
487 | + } | |
445 | 488 | |
446 | 489 | }, |
447 | 490 | GetBuyPrice: function (e) { | ... | ... |