Commit b47b702ef9572165cf2bac2ed11f698832ce91ad
1 parent
d67d567c
专享礼包的优化
Showing
2 changed files
with
85 additions
and
5 deletions
pages/giftpack/buygiftpack/giftpackbuy.js
| 1 | var i = require("../../../utils/util.js"); | 1 | var i = require("../../../utils/util.js"); |
| 2 | +var ut=i; | ||
| 2 | var com = require("../public/buy_com.js"); | 3 | var com = require("../public/buy_com.js"); |
| 3 | var e = getApp(), | 4 | var e = getApp(), |
| 4 | a = e.globalData.setting, | 5 | a = e.globalData.setting, |
| @@ -74,6 +75,9 @@ Page({ | @@ -74,6 +75,9 @@ Page({ | ||
| 74 | onLoad: function (options) { | 75 | onLoad: function (options) { |
| 75 | var th=this; | 76 | var th=this; |
| 76 | 77 | ||
| 78 | + //定义第一次进入 | ||
| 79 | + this.data.fir_in=1; | ||
| 80 | + | ||
| 77 | this.setData({ | 81 | this.setData({ |
| 78 | params: options, | 82 | params: options, |
| 79 | now:Date.parse(new Date()) / 1000, | 83 | now:Date.parse(new Date()) / 1000, |
| @@ -143,10 +147,48 @@ Page({ | @@ -143,10 +147,48 @@ Page({ | ||
| 143 | onShow: function () { | 147 | onShow: function () { |
| 144 | 148 | ||
| 145 | this.setData({submit:0}) | 149 | this.setData({submit:0}) |
| 146 | - i.fy_back('',0); | ||
| 147 | - com.set_py_fir(); | ||
| 148 | - getApp().check_can_share(); | ||
| 149 | var th=this; | 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,parent_sn:th.data.ok_order_sn,userId:getApp().globalData.user_id}}).then(res=>{ | ||
| 168 | + if(ut.ajax_ok(res)){ | ||
| 169 | + var item=res.data.data.pageData[0]; | ||
| 170 | + if(item.pay_status==1){ | ||
| 171 | + //支付支付,返回首页 | ||
| 172 | + ut.m_toast('支付成功'); | ||
| 173 | + setTimeout(()=>{ | ||
| 174 | + getApp().goto(back_url); | ||
| 175 | + },1000) | ||
| 176 | + | ||
| 177 | + }else{ | ||
| 178 | + //支付支付,返回首页 | ||
| 179 | + ut.m_toast('支付失败'); | ||
| 180 | + } | ||
| 181 | + } | ||
| 182 | + }) | ||
| 183 | + }); | ||
| 184 | + | ||
| 185 | + | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + | ||
| 189 | + | ||
| 190 | + getApp().check_can_share(); | ||
| 191 | + | ||
| 150 | //--先判断会员状态-- | 192 | //--先判断会员状态-- |
| 151 | getApp().is_Single_page(this, function () { | 193 | getApp().is_Single_page(this, function () { |
| 152 | var user_info = getApp().globalData.userInfo; | 194 | var user_info = getApp().globalData.userInfo; |
pages/giftpack/giftpacklist/giftpacklist.js
| @@ -82,6 +82,9 @@ Page({ | @@ -82,6 +82,9 @@ Page({ | ||
| 82 | }, | 82 | }, |
| 83 | onLoad: function (options) { | 83 | onLoad: function (options) { |
| 84 | 84 | ||
| 85 | + //定义第一次进入 | ||
| 86 | + this.data.fir_in=1; | ||
| 87 | + | ||
| 85 | var th = this; | 88 | var th = this; |
| 86 | 89 | ||
| 87 | this.setData({ | 90 | this.setData({ |
| @@ -170,8 +173,43 @@ Page({ | @@ -170,8 +173,43 @@ Page({ | ||
| 170 | 173 | ||
| 171 | onShow: function () { | 174 | onShow: function () { |
| 172 | this.setData({submit:0}) | 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,parent_sn:th.data.ok_order_sn,userId:getApp().globalData.user_id}}).then(res=>{ | ||
| 194 | + if(ut.ajax_ok(res)){ | ||
| 195 | + var item=res.data.data.pageData[0]; | ||
| 196 | + if(item.pay_status==1){ | ||
| 197 | + //支付支付,返回首页 | ||
| 198 | + ut.m_toast('支付成功'); | ||
| 199 | + setTimeout(()=>{ | ||
| 200 | + getApp().goto(back_url); | ||
| 201 | + },1000) | ||
| 202 | + | ||
| 203 | + }else{ | ||
| 204 | + //支付支付,返回首页 | ||
| 205 | + ut.m_toast('支付失败'); | ||
| 206 | + } | ||
| 207 | + } | ||
| 208 | + }) | ||
| 209 | + }); | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + | ||
| 175 | getApp().check_can_share(this); | 213 | getApp().check_can_share(this); |
| 176 | getApp().is_Single_page(this, function () { | 214 | getApp().is_Single_page(this, function () { |
| 177 | //--先判断会员状态-- | 215 | //--先判断会员状态-- |