Commit 839d40d8b315639eaea70027fd9fa0beb81f4a8c

Authored by yvan.ni
1 parent abb88b5a

支付完后,在有用通联支付的页面,要避免一直提示支付成功的错误

packageA/pages/cart2_ser/cart2_ser.js
... ... @@ -291,7 +291,7 @@ Page({
291 291  
292 292 var back_url="/pages/payment/pay_success/pay_success?card=1&order_id=" + th.data.order_id;
293 293 //-- 通联的第三方支付的返回优化 --
294   - ut.is_pay_ok(back_url,"/pages/user/order_list/order_list?index=2&tabindex=1",function (){
  294 + ut.is_pay_ok(th.data.order_id,back_url,"/pages/user/order_list/order_list?index=2&tabindex=1",function (){
295 295  
296 296 if(!th.data.order_id) return false;
297 297 getApp().request.promiseGet("/api/weshop/recharge/user/page",
... ...
packageA/pages/details_serviceCard/details_serviceCard.js
... ... @@ -62,7 +62,9 @@ Page({
62 62 var back_url='/pages/user/order_list/order_list?index=2&tabindex=1';
63 63 var err_url='/pages/user/order_list/order_list?index=2&tabindex=1';
64 64  
65   - if(th.data.details) {
  65 + //判断是不是有调用支付过
  66 + if(th.data.payed) {
  67 + th.data.payed=0;
66 68 //-- 判断一下活动的类型 --
67 69 var prom_type = th.data.details.list[0].prom_type > 0 ? th.data.details.list[0].prom_type : 0;
68 70 var order_id = th.data.details.order_id;
... ... @@ -81,10 +83,8 @@ Page({
81 83 }
82 84  
83 85 //-- 通联的第三方支付的返回优化 --
84   - ut.is_pay_ok(back_url, err_url, function () {
85   -
  86 + ut.is_pay_ok(th.data.details,back_url, err_url, function () {
86 87 if (!th.data.details) return false;
87   -
88 88 getApp().request.promiseGet(ck_url,
89 89 {data: req_data}).then(res => {
90 90 if (ut.ajax_ok(res)) {
... ... @@ -770,6 +770,8 @@ Page({
770 770 }
771 771  
772 772 if (flag) {
  773 +
  774 + th.data.payed=1;
773 775 t_pay.set_pay_url("/api/weshop/order/pay/createRechargeOrder");
774 776 t_pay.pay({
775 777 parentSn: order_sn,
... ...
packageA/pages/myGift/myGift.js
... ... @@ -109,7 +109,7 @@ Page({
109 109 t_pay.set_fir();
110 110  
111 111 //-- 通联的第三方支付的返回优化 --
112   - util.is_pay_ok("none","none",function (){
  112 + util.is_pay_ok(th.data.ok_order_sn,"none","none",function (){
113 113 if(!th.data.ok_order_sn) return false;
114 114  
115 115 var b_url="/api/weshop/libao/libaoFormvip/page";
... ... @@ -137,9 +137,6 @@ Page({
137 137 }
138 138  
139 139  
140   -
141   -
142   -
143 140 getApp().check_can_share();
144 141 if(app.globalData.userInfo) {
145 142 if(!this.data.isLogin) {
... ...
packageA/pages/myGiftDetails/myGiftDetails.js
... ... @@ -81,11 +81,9 @@ Page({
81 81 t_pay.set_fir();
82 82  
83 83 //-- 通联的第三方支付的返回优化 --
84   - ut.is_pay_ok("/packageA/pages/libao_payment/payment?type=2","none",function (){
85   -
  84 + ut.is_pay_ok(th.data.ok_order_sn,"/packageA/pages/libao_payment/payment?type=2","none",function (){
86 85 console.log('is_pay_ok');
87 86 console.log(th.data.ok_order_sn);
88   -
89 87 if(!th.data.ok_order_sn) return false;
90 88  
91 89 var b_url="/api/weshop/libao/libaoFormvip/page";
... ...
packageA/pages/serviceCard_pd/cart/cart.js
... ... @@ -258,7 +258,7 @@ Page({
258 258 var back_url="/packageA/pages/serviceCard_pd/team_success/team_success?ordersn=" + th.data.order_sn;
259 259  
260 260 //-- 通联的第三方支付的返回优化 --
261   - ut.is_pay_ok(back_url,"/pages/user/order_list/order_list?index=2&tabindex=1",function (){
  261 + ut.is_pay_ok(th.data.order_id,back_url,"/pages/user/order_list/order_list?index=2&tabindex=1",function (){
262 262 if(!th.data.order_id) return false;
263 263 getApp().request.promiseGet("/api/weshop/rechargeServicelist/page",{
264 264 data: { store_id: os.stoid, order_id: th.data.order_id}
... ...
packageA/pages/serviceCard_pd/cart_wk/cart_wk.js
... ... @@ -109,8 +109,9 @@ Page({
109 109  
110 110 var back_url="/pages/payment/pay_success/pay_success?order_id=" + th.data.order.order_id + "&type=1&card=1";
111 111 //-- 通联的第三方支付的返回优化 --
112   - ut.is_pay_ok(back_url,"/pages/user/order_list/order_list?index=2&tabindex=1",function (){
  112 + ut.is_pay_ok(th.data.wk_pyed,back_url,"/pages/user/order_list/order_list?index=2&tabindex=1",function (){
113 113 if(!th.data.wk_pyed) return false;
  114 +
114 115 getApp().request.promiseGet("/api/weshop/rechargeServicelist/page",{
115 116 data: { store_id: os.stoid, order_id: th.data.order.order_id}
116 117 }).then(res=>{
... ...
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
... ... @@ -672,7 +672,7 @@ Page({
672 672 "&goods_name=" + th.data.bn_goods.goods_name;
673 673  
674 674 //-- 通联的第三方支付的返回优化 --
675   - ut.is_pay_ok(back,'/pages/user/order_list/order_list',function (){
  675 + ut.is_pay_ok(th.data.ok_order_sn,back,'/pages/user/order_list/order_list',function (){
676 676 if(!th.data.ok_order_sn) return false;
677 677 getApp().request.promiseGet("/api/weshop/order/page",
678 678 {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{
... ...
packageC/pages/presell/cart/cart.js
... ... @@ -216,7 +216,7 @@ Page({
216 216 util_pay.set_fir();
217 217  
218 218 //-- 通联的第三方支付的返回优化 --
219   - ut.is_pay_ok("back","back",function (){
  219 + ut.is_pay_ok(th.data.ok_order_sn,"back","back",function (){
220 220  
221 221 console.log('onshow-444');
222 222 console.log(th.data.ok_order_sn);
... ...
packageC/pages/presell/cart/cart2.js
... ... @@ -213,7 +213,7 @@ Page({
213 213 util_pay.set_fir();
214 214  
215 215 //-- 通联的第三方支付的返回优化 --
216   - ut.is_pay_ok("/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn,
  216 + ut.is_pay_ok(th.data.ok_order_sn,"/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn,
217 217 "/pages/user/order_list/order_list",function (){
218 218 if(!th.data.ok_order_sn) return false;
219 219 getApp().request.promiseGet("/api/weshop/order/page",
... ...
packageC/pages/presell/cart/cart2_pre.js
... ... @@ -294,7 +294,7 @@ Page({
294 294 var ok_url = "/packageC/pages/presell/cart/cart?order_sn=" +this.data.ok_order_sn;
295 295 var err_url="/pages/user/order_list/order_list";
296 296 //-- 通联的第三方支付的返回优化 --
297   - ut.is_pay_ok(ok_url,err_url,function (){
  297 + ut.is_pay_ok(th.data.ok_order_sn,ok_url,err_url,function (){
298 298 if(!th.data.ok_order_sn) return false;
299 299 getApp().request.promiseGet("/api/weshop/order/page",
300 300 {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{
... ...
packageD/pages/user/deposit/prepaid/prepaid.js
... ... @@ -110,7 +110,7 @@ Page({
110 110 t_pay.set_fir();
111 111  
112 112 //-- 通联的第三方支付的返回优化 --
113   - ut.is_pay_ok("/packageD/pages/user/deposit/prepaid/msg/msg","none",function (){
  113 + ut.is_pay_ok(th.data.ok_order_sn,"/packageD/pages/user/deposit/prepaid/msg/msg","none",function (){
114 114 if(!th.data.ok_order_sn) return false;
115 115 var ck_url="/api/weshop/recharge/get/"+os.stoid+"/"+th.data.ok_order_sn;
116 116 getApp().request.promiseGet(ck_url,{}).then(res=>{
... ...
packageD/pages/user/integral/integral.js
... ... @@ -345,7 +345,7 @@ Page({
345 345 t_pay.set_fir();
346 346  
347 347 //-- 通联的第三方支付的返回优化 --
348   - ut.is_pay_ok("/packageD/pages/user/integral/msg/msg",'none',function (){
  348 + ut.is_pay_ok(th.data.ok_order_sn,"/packageD/pages/user/integral/msg/msg",'none',function (){
349 349  
350 350 console.log('show--11')
351 351 console.log(th.data.ok_order_sn);
... ...
packageE/pages/cart/cart2/cart2.js
... ... @@ -285,7 +285,7 @@ Page({
285 285 util_pay.set_fir();
286 286  
287 287 //-- 通联的第三方支付的返回优化 --
288   - ut.is_pay_ok("/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn,
  288 + ut.is_pay_ok(th.data.ok_order_sn,"/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn,
289 289 "/pages/user/order_list/order_list",function (){
290 290 //支付信息会先记录着
291 291 if(!th.data.ok_order_sn) return false;
... ...
packageE/pages/cart/cart2_inte/cart2_inte.js
... ... @@ -225,7 +225,7 @@ Page({
225 225 util_pay.set_fir();
226 226  
227 227 //-- 通联的第三方支付的返回优化 --
228   - ut.is_pay_ok("/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn,
  228 + ut.is_pay_ok(th.data.ok_order_sn,"/pages/payment/pay_success/pay_success?type=2&order_sn=" + th.data.ok_order_sn,
229 229 "/pages/user/order_list/order_list",function (){
230 230 if(!th.data.ok_order_sn) return false;
231 231 getApp().request.promiseGet("/api/weshop/order/page",
... ...
packageE/pages/cart/cart2_pt/cart2_pt.js
... ... @@ -585,7 +585,7 @@ 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,
  588 + ut.is_pay_ok(th.data.ok_order_sn,"/pages/team/team_success/team_success?ordersn=" + th.data.ok_order_sn,
589 589 "/pages/user/order_list/order_list",function (){
590 590 if(!th.data.ok_order_sn) return false;
591 591 getApp().request.promiseGet("/api/weshop/order/page",
... ...
packageE/pages/user/cardinfo/cardinfo.js
... ... @@ -696,7 +696,7 @@ Page({
696 696 t_pay.set_fir();
697 697  
698 698 //-- 通联的第三方支付的返回优化 --
699   - ut.is_pay_ok("func",'none',function (){
  699 + ut.is_pay_ok(th.data.ok_order_sn,"func",'none',function (){
700 700  
701 701 console.log('1111');
702 702 console.log(th.data.ok_order_sn);
... ...
packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js
... ... @@ -196,7 +196,7 @@ Page({
196 196 var money = th.data.payMoney;
197 197 var bk_url = "/packageE/pages/user/monthgiftbag/payment/payment?money=" + money + "&order_sn=" + th.data.back_ord;
198 198 //-- 通联的第三方支付的返回优化 --
199   - ut.is_pay_ok(bk_url, "none", function () {
  199 + ut.is_pay_ok(th.data.back_ord,bk_url, "none", function () {
200 200 if (!th.data.back_ord) return false;
201 201 //订单查询的接口
202 202 getApp().request.promiseGet("/api/weshop/marketing/marketingMonthgiftbagRecord/page",
... ...
packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js
... ... @@ -460,7 +460,7 @@ Page({
460 460 var money=th.data.payMoney;
461 461 var bk_url = "/packageE/pages/user/monthgiftbag/payment/payment?money=" + money + "&order_sn=" + th.data.back_ord;
462 462 //-- 通联的第三方支付的返回优化 --
463   - ut.is_pay_ok(bk_url,"none",function (){
  463 + ut.is_pay_ok(th.data.back_ord,bk_url,"none",function (){
464 464 if(!th.data.back_ord) return false;
465 465 getApp().request.promiseGet("/api/weshop/marketing/marketingMonthgiftbagRecord/page",
466 466 {data:{store_id:os.stoid,order_sn:th.data.back_ord,user_id:getApp().globalData.user_id}}).then(res=>{
... ...
pages/cart/cart_wk/cart_wk.js
... ... @@ -108,7 +108,7 @@ Page({
108 108 util_pay.set_fir();
109 109  
110 110 //-- 通联的第三方支付的返回优化 --
111   - ut.is_pay_ok("/pages/payment/pay_success/pay_success?type=1&order_sn=" + this.data.ok_order_sn,'back',function (){
  111 + ut.is_pay_ok(th.data.ok_order_sn,"/pages/payment/pay_success/pay_success?type=1&order_sn=" + this.data.ok_order_sn,'back',function (){
112 112 if(!th.data.ok_order_sn) return false;
113 113 getApp().request.promiseGet("/api/weshop/order/page",
114 114 {data:{store_id:os.stoid,parent_sn:th.data.ok_order_sn}}).then(res=>{
... ...
pages/giftpack/buygiftpack/giftpackbuy.js
... ... @@ -163,7 +163,7 @@ Page({
163 163 var money=th.data.payMoney;
164 164 var back_url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + th.data.ok_order_sn;
165 165  
166   - ut.is_pay_ok(back_url,'none',function (){
  166 + ut.is_pay_ok(th.data.ok_order_sn,back_url,'none',function (){
167 167 if(!th.data.ok_order_sn) return false;
168 168 getApp().request.promiseGet("/api/weshop/marketing/my/giftbag/detail/get",
169 169 {data:{storeId:os.stoid,orderSn:th.data.ok_order_sn,userId:getApp().globalData.user_id}}).then(res=>{
... ...
pages/giftpack/giftpacklist/giftpacklist.js
... ... @@ -187,7 +187,7 @@ Page({
187 187 //-- 通联的第三方支付的返回优化 --
188 188 var money=th.data.payMoney;
189 189 var back_url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + th.data.ok_order_sn;
190   - ut.is_pay_ok(back_url,'none',function (){
  190 + ut.is_pay_ok(th.data.ok_order_sn,back_url,'none',function (){
191 191 if(!th.data.ok_order_sn) return false;
192 192 getApp().request.promiseGet("/api/weshop/marketing/my/giftbag/detail/get",
193 193 {data:{storeId:os.stoid,orderSn:th.data.ok_order_sn,userId:getApp().globalData.user_id}}).then(res=>{
... ...
pages/user/order_detail/order_detail.js
... ... @@ -81,8 +81,7 @@ Page({
81 81  
82 82 //通联第三方
83 83 //-- 通联的第三方支付的返回优化 --
84   - ut.is_pay_ok("back","none",function (){
85   - if(!th.data.ok_order_sn) return false;
  84 + ut.is_pay_ok(th.data.ok_order_sn,"back","none",function (){
86 85 getApp().request.promiseGet("/api/weshop/order/page",
87 86 {data:{store_id:os.stoid,order_sn:th.data.ok_order_sn}}).then(res=>{
88 87 if(ut.ajax_ok(res)){
... ... @@ -583,7 +582,6 @@ Page({
583 582 })
584 583  
585 584 if (presellList) {
586   -
587 585 if (good.goods_num > presellList.presell_sumqty - presellList.buy_goodnum) {
588 586 var content = good.goods_name + '购买数量超出商品库存,请取消订单';
589 587 th.toast(content);
... ...
pages/user/plus/plus.js
... ... @@ -144,7 +144,7 @@ Page({
144 144 ut.fy_back('',0);
145 145 t_pay.set_fir();
146 146 //-- 通联的第三方支付的返回优化 --
147   - ut.is_pay_ok("func","func",function (){
  147 + ut.is_pay_ok(th.data.ok_order_sn,"func","func",function (){
148 148  
149 149 if(!th.data.ok_order_sn) return false;
150 150 var ck_url="/api/weshop/recharge/get/"+os.stoid+"/"+th.data.ok_order_sn;
... ...
utils/util.js
... ... @@ -885,7 +885,7 @@ module.exports = {
885 885 },
886 886 //-- 支付的结果判断是不是完成了,通联支付pos收银的返回 --
887 887 /**
888   - *
  888 + * @param ok_order_sn 判断是不是有支付过
889 889 * @param back_url 如果是地址,就跳转,如果是back,就返回。如果是func,就是要回调
890 890 * @param err_url 如果是地址,就跳转,如果是back,就返回。如果是func,就是要回调,如果是none,就没有反应,提示而已
891 891 * @param func 因为是物理键的返回,所以要调用结果,查询结果
... ... @@ -893,12 +893,20 @@ module.exports = {
893 893 * @param fail //失败的回调函数, 当err_url是func
894 894 * @param is_navigateTo //跳转的页面是不是要is_re_to
895 895 */
896   - is_pay_ok(back_url,err_url,func,success,fail,is_navigateTo){
  896 + is_pay_ok(ok_order_sn,back_url,err_url,func,success,fail,is_navigateTo){
  897 +
  898 + if(!ok_order_sn) {
  899 + return false;
  900 + }
897 901 if(!err_url){
898 902 err_url="/pages/index/index/index";
899 903 }
900   -
  904 + //-- getEnterOptionsSync的信息会一直存在,很恶心 --
901 905 let options = wx.getEnterOptionsSync();
  906 +
  907 + console.log("is_pay_ok");
  908 + console.log(options);
  909 +
902 910 if (options.scene == '1038' && options.referrerInfo.appId=='wxef277996acc166c3') {
903 911 let extraData = options.referrerInfo.extraData;
904 912 if (!extraData) {
... ...