Commit ddb7d3fda74f8d07a0d082643a0dae99a436e6a9

Authored by yvan.ni
1 parent 36ee21dd

支付的优化设置

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,51 @@ 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=" + this.data.ok_order_sn,null,function (){
  229 + if(!th.data.ok_order_sn) return false;
  230 + getApp().request.promiseGet("/api/weshop/order/page",
  231 + {data:{store_id:os.stoid,parent_sn:this.data.ok_order_sn}}).then(res=>{
  232 + if(ut.ajax_ok(res)){
  233 + var item=res.data.data.pageData[i];
  234 + if(item.pay_status==1){
  235 + //支付支付,返回首页
  236 + ut.m_toast('支付成功');
  237 + setTimeout(()=>{
  238 + getApp().goto("/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn);
  239 + },1000)
  240 +
  241 + }else{
  242 + //支付支付,返回首页
  243 + ut.m_toast('支付失败');
  244 + setTimeout(()=>{
  245 + getApp().goto("/pages/index/index/index");
  246 + },1000)
  247 + }
  248 + }
  249 + })
  250 + });
  251 + }
217 252  
218   - util_pay.set_fir();
219 253  
220   - var th = this;
221 254 th.data.g_cart_q_time = null;
222 255  
223 256 if (th.data.isclose == 0) {
... ... @@ -1330,6 +1363,8 @@ Page({
1330 1363 //void e.jumpToCart4({
1331 1364 // order_sn: data.data,
1332 1365 //}, 1);
  1366 +
  1367 + th.data.ok_order_sn=data.data;
1333 1368 util_pay.pay(data.data, function () {
1334 1369 //app.my_warnning("支付成功",1,th);
1335 1370 //setTimeout(function () {
... ...
pages/cart/cart2_pt/cart2_pt.js
... ... @@ -101,7 +101,7 @@ Page({
101 101 })
102 102 },
103 103 onLoad: function (t) {
104   - console.log("onLoad_pt_cart");
  104 + this.data.fir_in=1;
105 105 var th = this;
106 106 getApp().getConfig2(function (e) {
107 107 th.setData({
... ... @@ -575,12 +575,43 @@ Page({
575 575 //----------子页返回父页触发----------
576 576 onShow: function () {
577 577  
578   - var fy=ut.fy_back("/pages/user/order_list/order_list",1);
579   - if(fy) return false;
  578 + var th = this;
  579 + //判断是不是第一次进入
  580 + if(this.data.fir_in){
  581 + this.data.fir_in=0;
  582 + }else{
  583 + //-- 富有的支付 --
  584 + var fy=ut.fy_back("/pages/user/order_list/order_list",1);
  585 + if(fy) return false;
  586 + util_pay.set_fir();
  587 + //-- 通联的第三方支付的返回优化 --
  588 + ut.is_pay_ok("/pages/team/team_success/team_success?ordersn=" + this.data.ok_order_sn,null,function (){
  589 + if(!th.data.ok_order_sn) return false;
  590 + getApp().request.promiseGet("/api/weshop/order/page",
  591 + {data:{store_id:os.stoid,parent_sn:this.data.ok_order_sn}}).then(res=>{
  592 + if(ut.ajax_ok(res)){
  593 + var item=res.data.data.pageData[i];
  594 + if(item.pay_status==1){
  595 + //支付支付,返回首页
  596 + ut.m_toast('支付成功');
  597 + setTimeout(()=>{
  598 + getApp().goto("/pages/team/team_success/team_success?ordersn=" + this.data.ok_order_sn);
  599 + },1000)
  600 +
  601 + }else{
  602 + //支付支付,返回首页
  603 + ut.m_toast('支付失败');
  604 + setTimeout(()=>{
  605 + getApp().goto("/pages/index/index/index");
  606 + },1000)
  607 + }
  608 + }
  609 + })
  610 + });
  611 +
  612 + }
580 613  
581   - util_pay.set_fir();
582 614  
583   - var th = this;
584 615 if (th.data.isclose == 0) {
585 616 wx.navigateTo({
586 617 url: "/pages/index/index/index"
... ... @@ -1339,6 +1370,7 @@ Page({
1339 1370 // order_sn: data.data,
1340 1371 // type:1,
1341 1372 // }, 1);
  1373 + th.data.ok_order_sn=data.data;
1342 1374 util_pay.pay(data.data, function () {
1343 1375 setTimeout(function () {
1344 1376 wx.reLaunch({
... ...
utils/util.js
... ... @@ -874,7 +874,8 @@ module.exports = {
874 874 }
875 875 return more_arr
876 876 },
877   -
  877 +
  878 + //-- 长的提示框 --
878 879 m_toast(txt){
879 880 wx.showToast({
880 881 title: txt,
... ...