Commit 07a03b59b0f2d12fc739b6de899a67033e71fb73
1 parent
5637d9a5
支付的优化
Showing
5 changed files
with
120 additions
and
11 deletions
packageA/pages/cart2_ser/cart2_ser.js
packageA/pages/details_serviceCard/details_serviceCard.js
| @@ -20,6 +20,9 @@ Page({ | @@ -20,6 +20,9 @@ Page({ | ||
| 20 | */ | 20 | */ |
| 21 | onLoad: function(options) { | 21 | onLoad: function(options) { |
| 22 | 22 | ||
| 23 | + //定义第一次进入 | ||
| 24 | + this.data.fir_in=1; | ||
| 25 | + | ||
| 23 | self = this; | 26 | self = this; |
| 24 | this.data.options = options; | 27 | this.data.options = options; |
| 25 | 28 | ||
| @@ -47,8 +50,85 @@ Page({ | @@ -47,8 +50,85 @@ Page({ | ||
| 47 | */ | 50 | */ |
| 48 | onShow: function() { | 51 | onShow: function() { |
| 49 | this.data.is_summit_ing=0; | 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 | + ck_url = "/api/weshop/rechargeServicelist/page"; | ||
| 75 | + req_data = {store_id: os.stoid, order_id: order_id}; | ||
| 76 | + } else { | ||
| 77 | + ck_url = "/api/weshop/recharge/user/page"; | ||
| 78 | + req_data = {store_id: os.stoid, order_id: order_id, user_id: getApp().globalData.user_id}; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + //-- 通联的第三方支付的返回优化 -- | ||
| 82 | + ut.is_pay_ok(back_url, err_url, function () { | ||
| 83 | + | ||
| 84 | + if (!th.data.details) return false; | ||
| 85 | + | ||
| 86 | + getApp().request.promiseGet(ck_url, | ||
| 87 | + {data: req_data}).then(res => { | ||
| 88 | + if (ut.ajax_ok(res)) { | ||
| 89 | + var item = res.data.data.pageData[0]; | ||
| 90 | + if (parseInt(prom_type) == 6) { | ||
| 91 | + if (item.pt_status == 1 || item.pt_status == 2) { | ||
| 92 | + //支付支付,返回首页 | ||
| 93 | + ut.m_toast('支付成功'); | ||
| 94 | + setTimeout(() => { | ||
| 95 | + getApp().re_to(back_url); | ||
| 96 | + }, 1000) | ||
| 97 | + | ||
| 98 | + } else { | ||
| 99 | + //支付支付,返回首页 | ||
| 100 | + ut.m_toast('支付失败'); | ||
| 101 | + setTimeout(() => { | ||
| 102 | + getApp().re_to(back_url); | ||
| 103 | + }, 1000) | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + } else { | ||
| 107 | + if (item.pay_status == 1) { | ||
| 108 | + //支付支付,返回首页 | ||
| 109 | + ut.m_toast('支付成功'); | ||
| 110 | + setTimeout(() => { | ||
| 111 | + getApp().re_to(back_url); | ||
| 112 | + }, 1000) | ||
| 113 | + | ||
| 114 | + } else { | ||
| 115 | + //支付支付,返回首页 | ||
| 116 | + ut.m_toast('支付失败'); | ||
| 117 | + setTimeout(() => { | ||
| 118 | + getApp().re_to(back_url); | ||
| 119 | + }, 1000) | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + | ||
| 124 | + } | ||
| 125 | + }) | ||
| 126 | + }); | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + | ||
| 52 | getApp().check_can_share(); | 132 | getApp().check_can_share(); |
| 53 | if (app.globalData.userInfo) { | 133 | if (app.globalData.userInfo) { |
| 54 | if (!this.data.isLogin) { | 134 | if (!this.data.isLogin) { |
packageA/pages/myGift/myGift.js
| @@ -4,6 +4,7 @@ let self = null; | @@ -4,6 +4,7 @@ let self = null; | ||
| 4 | var os = app.globalData.setting; | 4 | var os = app.globalData.setting; |
| 5 | var t_pay = require("../../../utils/pay2.js"); | 5 | var t_pay = require("../../../utils/pay2.js"); |
| 6 | var util = require('../../../utils/util.js'); | 6 | var util = require('../../../utils/util.js'); |
| 7 | +var ut=util; | ||
| 7 | 8 | ||
| 8 | Page({ | 9 | Page({ |
| 9 | 10 | ||
| @@ -110,11 +111,19 @@ Page({ | @@ -110,11 +111,19 @@ Page({ | ||
| 110 | //-- 通联的第三方支付的返回优化 -- | 111 | //-- 通联的第三方支付的返回优化 -- |
| 111 | util.is_pay_ok("none","none",function (){ | 112 | util.is_pay_ok("none","none",function (){ |
| 112 | if(!th.data.ok_order_sn) return false; | 113 | 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=>{ | 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=>{ | ||
| 115 | if(ut.ajax_ok(res)){ | 124 | if(ut.ajax_ok(res)){ |
| 116 | var item=res.data.data.pageData[0]; | 125 | var item=res.data.data.pageData[0]; |
| 117 | - if(item.pay_status==1){ | 126 | + if(item.fbillstate==1){ |
| 118 | //支付支付,返回首页 | 127 | //支付支付,返回首页 |
| 119 | util.m_toast('支付成功'); | 128 | util.m_toast('支付成功'); |
| 120 | }else{ | 129 | }else{ |
packageA/pages/myGiftDetails/myGiftDetails.js
| @@ -82,12 +82,29 @@ Page({ | @@ -82,12 +82,29 @@ Page({ | ||
| 82 | 82 | ||
| 83 | //-- 通联的第三方支付的返回优化 -- | 83 | //-- 通联的第三方支付的返回优化 -- |
| 84 | ut.is_pay_ok("/packageA/pages/libao_payment/payment?type=2","none",function (){ | 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 | + | ||
| 85 | if(!th.data.ok_order_sn) return false; | 89 | if(!th.data.ok_order_sn) return false; |
| 86 | - getApp().request.promiseGet("/api/weshop/order/page", | ||
| 87 | - {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{ | 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 | + | ||
| 88 | if(ut.ajax_ok(res)){ | 104 | if(ut.ajax_ok(res)){ |
| 105 | + | ||
| 89 | var item=res.data.data.pageData[0]; | 106 | var item=res.data.data.pageData[0]; |
| 90 | - if(item.pay_status==1){ | 107 | + if(item.fbillstate==1){ |
| 91 | //支付支付,返回首页 | 108 | //支付支付,返回首页 |
| 92 | ut.m_toast('支付成功'); | 109 | ut.m_toast('支付成功'); |
| 93 | setTimeout(()=>{ | 110 | setTimeout(()=>{ |
| @@ -107,7 +124,6 @@ Page({ | @@ -107,7 +124,6 @@ Page({ | ||
| 107 | 124 | ||
| 108 | } | 125 | } |
| 109 | 126 | ||
| 110 | - | ||
| 111 | getApp().check_can_share(); | 127 | getApp().check_can_share(); |
| 112 | if(app.globalData.userInfo) { | 128 | if(app.globalData.userInfo) { |
| 113 | if(!this.data.isLogin) { | 129 | if(!this.data.isLogin) { |
| @@ -285,7 +301,7 @@ Page({ | @@ -285,7 +301,7 @@ Page({ | ||
| 285 | },function (msg){ | 301 | },function (msg){ |
| 286 | th.data.is_summit_ing=0; | 302 | th.data.is_summit_ing=0; |
| 287 | getApp().my_warnning(msg, 0, th); | 303 | getApp().my_warnning(msg, 0, th); |
| 288 | - }) | 304 | + },th) |
| 289 | 305 | ||
| 290 | // var url = "/api/weshop/libao/libaoFormvip/libaoOrder"; | 306 | // var url = "/api/weshop/libao/libaoFormvip/libaoOrder"; |
| 291 | // getApp().request.post(url, | 307 | // getApp().request.post(url, |
utils/pay2.js
| @@ -73,9 +73,10 @@ module.exports = { | @@ -73,9 +73,10 @@ module.exports = { | ||
| 73 | appId: 'wxef277996acc166c3', | 73 | appId: 'wxef277996acc166c3', |
| 74 | extraData: p_data, | 74 | extraData: p_data, |
| 75 | fail(){ | 75 | fail(){ |
| 76 | + | ||
| 76 | //-- 取消不支付 -- | 77 | //-- 取消不支付 -- |
| 77 | i.wx_paying=0; | 78 | i.wx_paying=0; |
| 78 | - "function" == typeof a && a(); | 79 | + "function" == typeof fail && fail('取消支付'); |
| 79 | } | 80 | } |
| 80 | }) | 81 | }) |
| 81 | }else { | 82 | }else { |