Commit c731240086b03c6fc4557affabc68d8db74b4266
1 parent
1c666d38
wx_paying不使用全局
Showing
26 changed files
with
87 additions
and
37 deletions
packageA/pages/cart2_ser/cart2_ser.js
@@ -274,6 +274,7 @@ Page({ | @@ -274,6 +274,7 @@ Page({ | ||
274 | 274 | ||
275 | //----------子页返回父页触发---------- | 275 | //----------子页返回父页触发---------- |
276 | onShow: function() { | 276 | onShow: function() { |
277 | + t_pay.set_fir(); | ||
277 | var th = this; | 278 | var th = this; |
278 | if (th.data.isclose == 0) { | 279 | if (th.data.isclose == 0) { |
279 | wx.navigateTo({ | 280 | wx.navigateTo({ |
packageA/pages/chongzhiDetails/chongzhiDetails.js
@@ -22,7 +22,7 @@ Page({ | @@ -22,7 +22,7 @@ Page({ | ||
22 | * 生命周期函数--监听页面加载 | 22 | * 生命周期函数--监听页面加载 |
23 | */ | 23 | */ |
24 | onLoad: function (options) { | 24 | onLoad: function (options) { |
25 | - | 25 | + |
26 | const self = this; | 26 | const self = this; |
27 | if(options.type) | 27 | if(options.type) |
28 | self.setData({type:options.type}); | 28 | self.setData({type:options.type}); |
@@ -106,6 +106,7 @@ Page({ | @@ -106,6 +106,7 @@ Page({ | ||
106 | * 生命周期函数--监听页面显示 | 106 | * 生命周期函数--监听页面显示 |
107 | */ | 107 | */ |
108 | onShow: function () { | 108 | onShow: function () { |
109 | + t_pay.set_fir(); | ||
109 | getApp().check_can_share(); | 110 | getApp().check_can_share(); |
110 | }, | 111 | }, |
111 | 112 |
packageA/pages/details_serviceCard/details_serviceCard.js
@@ -17,6 +17,7 @@ Page({ | @@ -17,6 +17,7 @@ Page({ | ||
17 | * 生命周期函数--监听页面加载 | 17 | * 生命周期函数--监听页面加载 |
18 | */ | 18 | */ |
19 | onLoad: function(options) { | 19 | onLoad: function(options) { |
20 | + | ||
20 | self = this; | 21 | self = this; |
21 | this.data.options = options; | 22 | this.data.options = options; |
22 | 23 | ||
@@ -43,6 +44,7 @@ Page({ | @@ -43,6 +44,7 @@ Page({ | ||
43 | * 生命周期函数--监听页面显示 | 44 | * 生命周期函数--监听页面显示 |
44 | */ | 45 | */ |
45 | onShow: function() { | 46 | onShow: function() { |
47 | + t_pay.set_fir(); | ||
46 | getApp().check_can_share(); | 48 | getApp().check_can_share(); |
47 | if (app.globalData.userInfo) { | 49 | if (app.globalData.userInfo) { |
48 | if (!this.data.isLogin) { | 50 | if (!this.data.isLogin) { |
packageA/pages/myGift/myGift.js
@@ -50,7 +50,8 @@ Page({ | @@ -50,7 +50,8 @@ Page({ | ||
50 | * 生命周期函数--监听页面加载 | 50 | * 生命周期函数--监听页面加载 |
51 | */ | 51 | */ |
52 | onLoad: function (options) { | 52 | onLoad: function (options) { |
53 | - self = this; | 53 | + |
54 | + self = this; | ||
54 | if(options.index){ | 55 | if(options.index){ |
55 | this.setData({currentIndex:1}); //查看我的礼包 | 56 | this.setData({currentIndex:1}); //查看我的礼包 |
56 | } | 57 | } |
@@ -88,7 +89,7 @@ Page({ | @@ -88,7 +89,7 @@ Page({ | ||
88 | * 生命周期函数--监听页面显示 | 89 | * 生命周期函数--监听页面显示 |
89 | */ | 90 | */ |
90 | onShow: function () { | 91 | onShow: function () { |
91 | - | 92 | + t_pay.set_fir(); |
92 | getApp().check_can_share(); | 93 | getApp().check_can_share(); |
93 | if(app.globalData.userInfo) { | 94 | if(app.globalData.userInfo) { |
94 | if(!this.data.isLogin) { | 95 | if(!this.data.isLogin) { |
packageA/pages/myGiftDetails/myGiftDetails.js
@@ -23,7 +23,8 @@ Page({ | @@ -23,7 +23,8 @@ Page({ | ||
23 | * 生命周期函数--监听页面加载 | 23 | * 生命周期函数--监听页面加载 |
24 | */ | 24 | */ |
25 | onLoad: function (options) { | 25 | onLoad: function (options) { |
26 | - self = this; | 26 | + |
27 | + self = this; | ||
27 | 28 | ||
28 | // 如果从商品详情页点击促销栏里的礼包跳转过来的话,不显示底部按钮 | 29 | // 如果从商品详情页点击促销栏里的礼包跳转过来的话,不显示底部按钮 |
29 | // showBtn 控制按钮是否显示 | 30 | // showBtn 控制按钮是否显示 |
@@ -66,6 +67,7 @@ Page({ | @@ -66,6 +67,7 @@ Page({ | ||
66 | * 生命周期函数--监听页面显示 | 67 | * 生命周期函数--监听页面显示 |
67 | */ | 68 | */ |
68 | onShow: function () { | 69 | onShow: function () { |
70 | + t_pay.set_fir(); | ||
69 | getApp().check_can_share(); | 71 | getApp().check_can_share(); |
70 | if(app.globalData.userInfo) { | 72 | if(app.globalData.userInfo) { |
71 | if(!this.data.isLogin) { | 73 | if(!this.data.isLogin) { |
packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
@@ -129,6 +129,7 @@ Page({ | @@ -129,6 +129,7 @@ Page({ | ||
129 | 129 | ||
130 | onLoad: function (t) { | 130 | onLoad: function (t) { |
131 | wx.setNavigationBarTitle({ title: "填写订单", }) | 131 | wx.setNavigationBarTitle({ title: "填写订单", }) |
132 | + | ||
132 | var th = this; | 133 | var th = this; |
133 | this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, }); | 134 | this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, }); |
134 | th.data.param = t; | 135 | th.data.param = t; |
@@ -156,6 +157,7 @@ Page({ | @@ -156,6 +157,7 @@ Page({ | ||
156 | 157 | ||
157 | //----------子页返回父页触发---------- | 158 | //----------子页返回父页触发---------- |
158 | onShow: function () { | 159 | onShow: function () { |
160 | + util_pay.set_fir(); | ||
159 | var th = this; | 161 | var th = this; |
160 | th.setData({ show_submit: 0 }); //让提交先掩藏 | 162 | th.setData({ show_submit: 0 }); //让提交先掩藏 |
161 | th.data.g_cart_q_time = null; | 163 | th.data.g_cart_q_time = null; |
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
@@ -597,6 +597,7 @@ Page({ | @@ -597,6 +597,7 @@ Page({ | ||
597 | //----------子页返回父页触发---------- | 597 | //----------子页返回父页触发---------- |
598 | onShow: function () { | 598 | onShow: function () { |
599 | var th = this; | 599 | var th = this; |
600 | + util_pay.set_fir(); | ||
600 | 601 | ||
601 | if (th.data.isclose == 0) { | 602 | if (th.data.isclose == 0) { |
602 | wx.navigateTo({ | 603 | wx.navigateTo({ |
packageC/pages/presell/cart/cart.js
@@ -157,6 +157,7 @@ Page({ | @@ -157,6 +157,7 @@ Page({ | ||
157 | 157 | ||
158 | //----------子页返回父页触发---------- | 158 | //----------子页返回父页触发---------- |
159 | onShow: function () { | 159 | onShow: function () { |
160 | + util_pay.set_fir(); | ||
160 | var th = this; | 161 | var th = this; |
161 | th.setData({ show_submit: 0 }); //让提交先掩藏 | 162 | th.setData({ show_submit: 0 }); //让提交先掩藏 |
162 | th.data.g_cart_q_time = null; | 163 | th.data.g_cart_q_time = null; |
packageC/pages/presell/cart/cart2.js
@@ -160,6 +160,7 @@ Page({ | @@ -160,6 +160,7 @@ Page({ | ||
160 | //----------子页返回父页触发---------- | 160 | //----------子页返回父页触发---------- |
161 | onShow: function () { | 161 | onShow: function () { |
162 | var th = this; | 162 | var th = this; |
163 | + util_pay.set_fir(); | ||
163 | th.data.g_cart_q_time = null; | 164 | th.data.g_cart_q_time = null; |
164 | if (th.data.isclose == 0) { | 165 | if (th.data.isclose == 0) { |
165 | wx.navigateTo({ | 166 | wx.navigateTo({ |
packageC/pages/presell/cart/cart2_pre.js
@@ -251,6 +251,7 @@ Page({ | @@ -251,6 +251,7 @@ Page({ | ||
251 | 251 | ||
252 | //----------子页返回父页触发---------- | 252 | //----------子页返回父页触发---------- |
253 | onShow: function () { | 253 | onShow: function () { |
254 | + util_pay.set_fir(); | ||
254 | var th = this; | 255 | var th = this; |
255 | if (th.data.isclose == 0) { | 256 | if (th.data.isclose == 0) { |
256 | wx.navigateTo({ | 257 | wx.navigateTo({ |
packageD/pages/user/deposit/prepaid/prepaid.js
@@ -16,7 +16,8 @@ Page({ | @@ -16,7 +16,8 @@ Page({ | ||
16 | }, | 16 | }, |
17 | /* 生命周期函数--监听页面初次渲染完成*/ | 17 | /* 生命周期函数--监听页面初次渲染完成*/ |
18 | onReady: function() { | 18 | onReady: function() { |
19 | - var th=this; | 19 | + var th=this; |
20 | + | ||
20 | 21 | ||
21 | getApp().request.get("/api/wx/weappSendlist/page", { | 22 | getApp().request.get("/api/wx/weappSendlist/page", { |
22 | data: { | 23 | data: { |
@@ -96,6 +97,7 @@ Page({ | @@ -96,6 +97,7 @@ Page({ | ||
96 | wx.setNavigationBarTitle({ | 97 | wx.setNavigationBarTitle({ |
97 | title: "流动资金转预存", | 98 | title: "流动资金转预存", |
98 | }) | 99 | }) |
100 | + t_pay.set_fir(); | ||
99 | 101 | ||
100 | if(getApp().globalData.user_id && !this.data.is_get){ | 102 | if(getApp().globalData.user_id && !this.data.is_get){ |
101 | this.yuck(); | 103 | this.yuck(); |
packageD/pages/user/integral/integral.js
@@ -207,7 +207,7 @@ Page({ | @@ -207,7 +207,7 @@ Page({ | ||
207 | * 生命周期函数--监听页面加载 | 207 | * 生命周期函数--监听页面加载 |
208 | */ | 208 | */ |
209 | onLoad: function (options) { | 209 | onLoad: function (options) { |
210 | - | 210 | + |
211 | var th=this; | 211 | var th=this; |
212 | getApp().request.get("/api/wx/weappSendlist/page", { | 212 | getApp().request.get("/api/wx/weappSendlist/page", { |
213 | data: { | 213 | data: { |
@@ -325,7 +325,8 @@ Page({ | @@ -325,7 +325,8 @@ Page({ | ||
325 | * 生命周期函数--监听页面显示 | 325 | * 生命周期函数--监听页面显示 |
326 | */ | 326 | */ |
327 | onShow: function () { | 327 | onShow: function () { |
328 | - getApp().check_can_share(); | 328 | + t_pay.set_fir(); |
329 | + getApp().check_can_share(); | ||
329 | //--先判断会员状态-- | 330 | //--先判断会员状态-- |
330 | var user_info = getApp().globalData.userInfo; | 331 | var user_info = getApp().globalData.userInfo; |
331 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 332 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
packageE/pages/cart/cart2/cart2.js
@@ -152,6 +152,7 @@ Page({ | @@ -152,6 +152,7 @@ Page({ | ||
152 | 152 | ||
153 | }, | 153 | }, |
154 | onLoad: function (t) { | 154 | onLoad: function (t) { |
155 | + | ||
155 | wx.setNavigationBarTitle({ title: "填写订单", }) | 156 | wx.setNavigationBarTitle({ title: "填写订单", }) |
156 | var th = this; | 157 | var th = this; |
157 | this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, }); | 158 | this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, }); |
@@ -200,6 +201,7 @@ Page({ | @@ -200,6 +201,7 @@ Page({ | ||
200 | 201 | ||
201 | //----------子页返回父页触发---------- | 202 | //----------子页返回父页触发---------- |
202 | onShow: function () { | 203 | onShow: function () { |
204 | + util_pay.set_fir(); | ||
203 | var th = this; | 205 | var th = this; |
204 | th.data.g_cart_q_time = null; | 206 | th.data.g_cart_q_time = null; |
205 | 207 |
packageE/pages/user/cardinfo/cardinfo.js
@@ -9,7 +9,6 @@ var t = getApp(), | @@ -9,7 +9,6 @@ var t = getApp(), | ||
9 | var regeneratorRuntime = require('../../../../utils/runtime.js'); | 9 | var regeneratorRuntime = require('../../../../utils/runtime.js'); |
10 | //wx.downloadFile把线上地址设为本地地址 | 10 | //wx.downloadFile把线上地址设为本地地址 |
11 | Page({ | 11 | Page({ |
12 | - | ||
13 | /** | 12 | /** |
14 | * 页面的初始数据 | 13 | * 页面的初始数据 |
15 | */ | 14 | */ |
@@ -50,6 +49,7 @@ Page({ | @@ -50,6 +49,7 @@ Page({ | ||
50 | * 生命周期函数--监听页面加载 | 49 | * 生命周期函数--监听页面加载 |
51 | */ | 50 | */ |
52 | onLoad: function (options) { | 51 | onLoad: function (options) { |
52 | + | ||
53 | //--先判断会员状态-- | 53 | //--先判断会员状态-- |
54 | var user_info = getApp().globalData.userInfo; | 54 | var user_info = getApp().globalData.userInfo; |
55 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 55 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
@@ -682,6 +682,7 @@ Page({ | @@ -682,6 +682,7 @@ Page({ | ||
682 | * 生命周期函数--监听页面显示 | 682 | * 生命周期函数--监听页面显示 |
683 | */ | 683 | */ |
684 | onShow: function () { | 684 | onShow: function () { |
685 | + t_pay.set_fir(); | ||
685 | //同步初始化 | 686 | //同步初始化 |
686 | this.init(); | 687 | this.init(); |
687 | 688 |
packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js
@@ -139,6 +139,7 @@ Page({ | @@ -139,6 +139,7 @@ Page({ | ||
139 | this.getList(); | 139 | this.getList(); |
140 | }, | 140 | }, |
141 | onShow: function () { | 141 | onShow: function () { |
142 | + com.set_py_fir(); | ||
142 | getApp().check_can_share(); | 143 | getApp().check_can_share(); |
143 | var th=this; | 144 | var th=this; |
144 | //--先判断会员状态-- | 145 | //--先判断会员状态-- |
packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js
@@ -198,6 +198,7 @@ Page({ | @@ -198,6 +198,7 @@ Page({ | ||
198 | }, | 198 | }, |
199 | 199 | ||
200 | onShow: function () { | 200 | onShow: function () { |
201 | + com.set_py_fir(); | ||
201 | getApp().check_can_share(); | 202 | getApp().check_can_share(); |
202 | getApp().is_Single_page(this, function () { | 203 | getApp().is_Single_page(this, function () { |
203 | //--先判断会员状态-- | 204 | //--先判断会员状态-- |
packageE/pages/user/monthgiftbag/giftpacklist/giftpacklist.js
@@ -173,6 +173,7 @@ Page({ | @@ -173,6 +173,7 @@ Page({ | ||
173 | }, | 173 | }, |
174 | 174 | ||
175 | onShow: function () { | 175 | onShow: function () { |
176 | + com.set_py_fir(); | ||
176 | getApp().check_can_share(); | 177 | getApp().check_can_share(); |
177 | getApp().is_Single_page(this, function () { | 178 | getApp().is_Single_page(this, function () { |
178 | //--先判断会员状态-- | 179 | //--先判断会员状态-- |
packageE/pages/user/monthgiftbag/public/buy_com.js
1 | -//-- const subscribe = require("../../../../../../MdUNIApp_new2/packageD/pages/subscribe/subscribe"); -- | ||
2 | const t_pay = require("../../../../../utils/pay2.js"); | 1 | const t_pay = require("../../../../../utils/pay2.js"); |
3 | module.exports = { | 2 | module.exports = { |
3 | + set_py_fir(){ | ||
4 | + t_pay.set_fir(); | ||
5 | + }, | ||
4 | //开启定位 | 6 | //开启定位 |
5 | wait_for_store_config: function (th) { | 7 | wait_for_store_config: function (th) { |
6 | var t_time = setInterval(function () { | 8 | var t_time = setInterval(function () { |
pages/giftpack/buygiftpack/giftpackbuy.js
@@ -139,6 +139,7 @@ Page({ | @@ -139,6 +139,7 @@ Page({ | ||
139 | this.getList(); | 139 | this.getList(); |
140 | }, | 140 | }, |
141 | onShow: function () { | 141 | onShow: function () { |
142 | + com.set_py_fir(); | ||
142 | getApp().check_can_share(); | 143 | getApp().check_can_share(); |
143 | var th=this; | 144 | var th=this; |
144 | //--先判断会员状态-- | 145 | //--先判断会员状态-- |
pages/giftpack/giftpacklist/giftpacklist.js
@@ -165,6 +165,7 @@ Page({ | @@ -165,6 +165,7 @@ Page({ | ||
165 | }, | 165 | }, |
166 | 166 | ||
167 | onShow: function () { | 167 | onShow: function () { |
168 | + com.set_py_fir(); | ||
168 | getApp().check_can_share(); | 169 | getApp().check_can_share(); |
169 | getApp().is_Single_page(this, function () { | 170 | getApp().is_Single_page(this, function () { |
170 | //--先判断会员状态-- | 171 | //--先判断会员状态-- |
pages/giftpack/public/buy_com.js
1 | const t_pay = require("../../../utils/pay2.js"); | 1 | const t_pay = require("../../../utils/pay2.js"); |
2 | module.exports = { | 2 | module.exports = { |
3 | + set_py_fir(){ | ||
4 | + t_pay.set_fir(); | ||
5 | + }, | ||
3 | //开启定位 | 6 | //开启定位 |
4 | wait_for_store_config: function (th) { | 7 | wait_for_store_config: function (th) { |
5 | var t_time = setInterval(function () { | 8 | var t_time = setInterval(function () { |
pages/user/order_detail/order_detail.js
@@ -15,6 +15,7 @@ Page({ | @@ -15,6 +15,7 @@ Page({ | ||
15 | conf:null, | 15 | conf:null, |
16 | }, | 16 | }, |
17 | onLoad: function(e) { | 17 | onLoad: function(e) { |
18 | + | ||
18 | var th=this; | 19 | var th=this; |
19 | var r = void 0 !== e.isGoup && e.isGoup; | 20 | var r = void 0 !== e.isGoup && e.isGoup; |
20 | 21 | ||
@@ -63,6 +64,7 @@ Page({ | @@ -63,6 +64,7 @@ Page({ | ||
63 | }), this.requestOrderDetail(e.order_id), wx.removeStorageSync("order:order_detail:update"); | 64 | }), this.requestOrderDetail(e.order_id), wx.removeStorageSync("order:order_detail:update"); |
64 | }, | 65 | }, |
65 | onShow: function() { | 66 | onShow: function() { |
67 | + py.set_fir(); | ||
66 | wx.getStorageSync("order:order_detail:update") && (wx.removeStorageSync("order:order_detail:update"), | 68 | wx.getStorageSync("order:order_detail:update") && (wx.removeStorageSync("order:order_detail:update"), |
67 | this.requestOrderDetail(this.data.order.order_id)); | 69 | this.requestOrderDetail(this.data.order.order_id)); |
68 | }, | 70 | }, |
pages/user/order_list/order_list.js
@@ -78,6 +78,7 @@ Page({ | @@ -78,6 +78,7 @@ Page({ | ||
78 | searchContent: '', | 78 | searchContent: '', |
79 | }, | 79 | }, |
80 | onLoad: function (t) { | 80 | onLoad: function (t) { |
81 | + | ||
81 | self = this; | 82 | self = this; |
82 | // 设置日期选择器的结束时间为当前日期 | 83 | // 设置日期选择器的结束时间为当前日期 |
83 | var now = new Date(); | 84 | var now = new Date(); |
@@ -108,6 +109,7 @@ Page({ | @@ -108,6 +109,7 @@ Page({ | ||
108 | s.init(this, "", "orderList"); | 109 | s.init(this, "", "orderList"); |
109 | }, | 110 | }, |
110 | onShow: function () { | 111 | onShow: function () { |
112 | + t_pay.set_fir(); | ||
111 | var th = this; | 113 | var th = this; |
112 | //---查看会员的等级价--- | 114 | //---查看会员的等级价--- |
113 | getApp().getConfig2(function (e) { | 115 | getApp().getConfig2(function (e) { |
pages/user/plus/plus.js
@@ -9,7 +9,6 @@ var t = getApp(), | @@ -9,7 +9,6 @@ var t = getApp(), | ||
9 | t_pay = require("../../../utils/pay2.js"); | 9 | t_pay = require("../../../utils/pay2.js"); |
10 | var regeneratorRuntime = require('../../../utils/runtime.js'); | 10 | var regeneratorRuntime = require('../../../utils/runtime.js'); |
11 | 11 | ||
12 | - | ||
13 | Page({ | 12 | Page({ |
14 | /** | 13 | /** |
15 | * 页面的初始数据 | 14 | * 页面的初始数据 |
@@ -129,6 +128,8 @@ Page({ | @@ -129,6 +128,8 @@ Page({ | ||
129 | var user_info = getApp().globalData.userInfo; | 128 | var user_info = getApp().globalData.userInfo; |
130 | if (!user_info) return false; | 129 | if (!user_info) return false; |
131 | 130 | ||
131 | + t_pay.set_fir(); | ||
132 | + | ||
132 | var th = this, | 133 | var th = this, |
133 | that = th, | 134 | that = th, |
134 | app_d = getApp().globalData; | 135 | app_d = getApp().globalData; |
utils/pay.js
1 | -var t = getApp(), n = t.request,wx_paying=0; | 1 | +var t = getApp(), n = t.request; |
2 | 2 | ||
3 | module.exports = { | 3 | module.exports = { |
4 | + wx_paying:0, | ||
5 | + set_fir(){ | ||
6 | + this.wx_paying=0; | ||
7 | + }, | ||
4 | url: "/api/weshop/order/pay/createOrder", | 8 | url: "/api/weshop/order/pay/createOrder", |
5 | rechange: function(t, e, a) { | 9 | rechange: function(t, e, a) { |
6 | var i = this; | 10 | var i = this; |
@@ -21,8 +25,8 @@ module.exports = { | @@ -21,8 +25,8 @@ module.exports = { | ||
21 | }, | 25 | }, |
22 | pay: function(t, e, a,sto,type) { | 26 | pay: function(t, e, a,sto,type) { |
23 | 27 | ||
24 | - if(wx_paying) return false; | ||
25 | - wx_paying=1; | 28 | + if(this.wx_paying) return false; |
29 | + this.wx_paying=1; | ||
26 | 30 | ||
27 | var i = this; | 31 | var i = this; |
28 | var dd = { | 32 | var dd = { |
@@ -56,13 +60,13 @@ module.exports = { | @@ -56,13 +60,13 @@ module.exports = { | ||
56 | console.log(plugin, plugin.fuioupay) | 60 | console.log(plugin, plugin.fuioupay) |
57 | plugin.fuioupay(parseInt(t.data.data.amt),paramsJson,function (res){ | 61 | plugin.fuioupay(parseInt(t.data.data.amt),paramsJson,function (res){ |
58 | console.log(res); | 62 | console.log(res); |
59 | - wx_paying=0; | 63 | + i.wx_paying=0; |
60 | getApp().showSuccess("支付成功!", e); | 64 | getApp().showSuccess("支付成功!", e); |
61 | 65 | ||
62 | },function (error){ | 66 | },function (error){ |
63 | console.log("插件支付错误",error); | 67 | console.log("插件支付错误",error); |
64 | //支付失败的时候 | 68 | //支付失败的时候 |
65 | - | 69 | + i.wx_paying=0; |
66 | var msg='取消支付'; | 70 | var msg='取消支付'; |
67 | if(error.code){ | 71 | if(error.code){ |
68 | msg=error.code+":"+error.message; | 72 | msg=error.code+":"+error.message; |
@@ -74,7 +78,7 @@ module.exports = { | @@ -74,7 +78,7 @@ module.exports = { | ||
74 | url: "/pages/user/order_list/order_list", | 78 | url: "/pages/user/order_list/order_list", |
75 | }); | 79 | }); |
76 | },1000) | 80 | },1000) |
77 | - wx_paying=0; | 81 | + |
78 | }) | 82 | }) |
79 | }else{ | 83 | }else{ |
80 | i.weixinPay(t.data.data, e, a); | 84 | i.weixinPay(t.data.data, e, a); |
@@ -83,33 +87,35 @@ module.exports = { | @@ -83,33 +87,35 @@ module.exports = { | ||
83 | 87 | ||
84 | 88 | ||
85 | }else{ | 89 | }else{ |
90 | + i.wx_paying=0; | ||
86 | getApp().confirmBox(t.data.msg); | 91 | getApp().confirmBox(t.data.msg); |
87 | setTimeout(function(){ | 92 | setTimeout(function(){ |
88 | wx.redirectTo({ | 93 | wx.redirectTo({ |
89 | url: "/pages/user/order_list/order_list", | 94 | url: "/pages/user/order_list/order_list", |
90 | }); | 95 | }); |
91 | },1000) | 96 | },1000) |
92 | - wx_paying=0; | 97 | + |
93 | } | 98 | } |
94 | return false; | 99 | return false; |
95 | }, | 100 | }, |
96 | fail: function() { | 101 | fail: function() { |
97 | console.log('======fail', ) | 102 | console.log('======fail', ) |
98 | wx.hideLoading(); | 103 | wx.hideLoading(); |
99 | - wx_paying=0; | 104 | + i.wx_paying=0; |
100 | "function" == typeof a && a(); | 105 | "function" == typeof a && a(); |
101 | }, | 106 | }, |
102 | failStatus: function() { | 107 | failStatus: function() { |
103 | wx.hideLoading(); | 108 | wx.hideLoading(); |
104 | - wx_paying=0; | 109 | + i.wx_paying=0; |
105 | "function" == typeof a && a(); | 110 | "function" == typeof a && a(); |
106 | } | 111 | } |
107 | }); | 112 | }); |
108 | }, | 113 | }, |
109 | weixinPay: function(n, e, a) { | 114 | weixinPay: function(n, e, a) { |
115 | + var th=this; | ||
110 | if(!n) return false; | 116 | if(!n) return false; |
111 | 117 | ||
112 | - getApp().globalData.no_clear=1; | 118 | + getApp().globalData.no_clear=1; |
113 | 119 | ||
114 | //有的话用最新的支付方式 | 120 | //有的话用最新的支付方式 |
115 | if(n.orderInfo) { | 121 | if(n.orderInfo) { |
@@ -121,11 +127,11 @@ module.exports = { | @@ -121,11 +127,11 @@ module.exports = { | ||
121 | paySign: n.paySign, | 127 | paySign: n.paySign, |
122 | orderInfo: n.orderInfo, // 需要新增的 订单 信息 | 128 | orderInfo: n.orderInfo, // 需要新增的 订单 信息 |
123 | success (n) { | 129 | success (n) { |
124 | - wx_paying=0; | 130 | + th.wx_paying=0; |
125 | t.showSuccess("支付成功!", e); | 131 | t.showSuccess("支付成功!", e); |
126 | }, | 132 | }, |
127 | fail (n) { | 133 | fail (n) { |
128 | - wx_paying=0; | 134 | + th.wx_paying=0; |
129 | if(!n.errMsg ) { | 135 | if(!n.errMsg ) { |
130 | getApp().showWarning("支付失败"); | 136 | getApp().showWarning("支付失败"); |
131 | "function" == typeof fail && fail(); | 137 | "function" == typeof fail && fail(); |
@@ -146,11 +152,11 @@ module.exports = { | @@ -146,11 +152,11 @@ module.exports = { | ||
146 | signType: n.signType, | 152 | signType: n.signType, |
147 | paySign: n.paySign, | 153 | paySign: n.paySign, |
148 | success: function (n) { | 154 | success: function (n) { |
149 | - wx_paying=0; | 155 | + th.wx_paying=0; |
150 | console.log(n), t.showSuccess("支付成功!", e); | 156 | console.log(n), t.showSuccess("支付成功!", e); |
151 | }, | 157 | }, |
152 | fail: function (n) { | 158 | fail: function (n) { |
153 | - wx_paying=0; | 159 | + th.wx_paying=0; |
154 | console.log(n), "requestPayment:fail" == n.errMsg ? t.showWarning("支付失败") : "requestPayment:fail cancel" == n.errMsg ? t.showWarning("您已取消支付") : | 160 | console.log(n), "requestPayment:fail" == n.errMsg ? t.showWarning("支付失败") : "requestPayment:fail cancel" == n.errMsg ? t.showWarning("您已取消支付") : |
155 | t.confirmBox("支付失败:" + n.errMsg.substr("requestPayment:fail ".length)), | 161 | t.confirmBox("支付失败:" + n.errMsg.substr("requestPayment:fail ".length)), |
156 | "function" == typeof a && a(); | 162 | "function" == typeof a && a(); |
utils/pay2.js
1 | -var t = getApp(), n = t.request,wx_paying=0; | 1 | +var t = getApp(), n = t.request; |
2 | 2 | ||
3 | module.exports = { | 3 | module.exports = { |
4 | + wx_paying:0, | ||
4 | url: "/api/weshop/plus/create/plus/order", | 5 | url: "/api/weshop/plus/create/plus/order", |
5 | set_pay_url:function (url){ | 6 | set_pay_url:function (url){ |
6 | this.url=url;//让链接地址进行赋值 | 7 | this.url=url;//让链接地址进行赋值 |
7 | }, | 8 | }, |
9 | + set_fir(){ | ||
10 | + this.wx_paying=0; | ||
11 | + }, | ||
8 | //-- createRechargeOrder create/plus/order -- | 12 | //-- createRechargeOrder create/plus/order -- |
9 | pay: function(dd, succ,fail) { | 13 | pay: function(dd, succ,fail) { |
10 | - if(wx_paying) return false; | ||
11 | - wx_paying=1; | 14 | + if(this.wx_paying) return false; |
15 | + this.wx_paying=1; | ||
12 | wx.showLoading(); | 16 | wx.showLoading(); |
13 | var i = this; | 17 | var i = this; |
14 | n.post(this.url, { | 18 | n.post(this.url, { |
@@ -31,7 +35,7 @@ module.exports = { | @@ -31,7 +35,7 @@ module.exports = { | ||
31 | console.log(plugin, plugin.fuioupay) | 35 | console.log(plugin, plugin.fuioupay) |
32 | plugin.fuioupay(parseInt(t.data.data.amt),paramsJson,function (res){ | 36 | plugin.fuioupay(parseInt(t.data.data.amt),paramsJson,function (res){ |
33 | console.log(res); | 37 | console.log(res); |
34 | - wx_paying=0; | 38 | + i.wx_paying=0; |
35 | "function" == typeof succ && succ(); | 39 | "function" == typeof succ && succ(); |
36 | },function (error){ | 40 | },function (error){ |
37 | console.log("插件支付错误",error); | 41 | console.log("插件支付错误",error); |
@@ -42,26 +46,26 @@ module.exports = { | @@ -42,26 +46,26 @@ module.exports = { | ||
42 | msg=error.code+":"+error.message; | 46 | msg=error.code+":"+error.message; |
43 | } | 47 | } |
44 | fail(msg) | 48 | fail(msg) |
45 | - wx_paying=0; | 49 | + i.wx_paying=0; |
46 | }) | 50 | }) |
47 | }else { | 51 | }else { |
48 | i.weixinPay(t.data.data, succ, fail); | 52 | i.weixinPay(t.data.data, succ, fail); |
49 | } | 53 | } |
50 | } | 54 | } |
51 | }else{ | 55 | }else{ |
52 | - wx_paying=0; | 56 | + i.wx_paying=0; |
53 | "function" == typeof fail && fail(t.data.msg); | 57 | "function" == typeof fail && fail(t.data.msg); |
54 | } | 58 | } |
55 | return false; | 59 | return false; |
56 | }, | 60 | }, |
57 | fail: function() { | 61 | fail: function() { |
58 | wx.hideLoading(); | 62 | wx.hideLoading(); |
59 | - wx_paying=0; | 63 | + i.wx_paying=0; |
60 | "function" == typeof fail && fail(); | 64 | "function" == typeof fail && fail(); |
61 | }, | 65 | }, |
62 | failStatus: function() { | 66 | failStatus: function() { |
63 | wx.hideLoading(); | 67 | wx.hideLoading(); |
64 | - wx_paying=0; | 68 | + i.wx_paying=0; |
65 | "function" == typeof fail && fail(); | 69 | "function" == typeof fail && fail(); |
66 | } | 70 | } |
67 | }); | 71 | }); |
@@ -69,8 +73,10 @@ module.exports = { | @@ -69,8 +73,10 @@ module.exports = { | ||
69 | 73 | ||
70 | //-- 这里是专享礼包的调用 -- | 74 | //-- 这里是专享礼包的调用 -- |
71 | pay_data:function (t,succ,fail){ | 75 | pay_data:function (t,succ,fail){ |
76 | + var th=this; | ||
72 | var ob=t.data.data.result; | 77 | var ob=t.data.data.result; |
73 | if(!ob){ | 78 | if(!ob){ |
79 | + this.set_fir(); | ||
74 | fail('支付参数错误'); | 80 | fail('支付参数错误'); |
75 | return false; | 81 | return false; |
76 | } | 82 | } |
@@ -85,10 +91,10 @@ module.exports = { | @@ -85,10 +91,10 @@ module.exports = { | ||
85 | console.log(plugin, plugin.fuioupay) | 91 | console.log(plugin, plugin.fuioupay) |
86 | plugin.fuioupay(parseInt(ob.amt),paramsJson,function (res){ | 92 | plugin.fuioupay(parseInt(ob.amt),paramsJson,function (res){ |
87 | console.log(res); | 93 | console.log(res); |
88 | - wx_paying=0; | 94 | + th.wx_paying=0; |
89 | "function" == typeof succ && succ(); | 95 | "function" == typeof succ && succ(); |
90 | },function (error){ | 96 | },function (error){ |
91 | - wx_paying=0; | 97 | + th.wx_paying=0; |
92 | console.log("插件支付错误",error); | 98 | console.log("插件支付错误",error); |
93 | //支付失败的时候 | 99 | //支付失败的时候 |
94 | //getApp().confirmBox(error.code+error.message); | 100 | //getApp().confirmBox(error.code+error.message); |
@@ -104,8 +110,12 @@ module.exports = { | @@ -104,8 +110,12 @@ module.exports = { | ||
104 | } | 110 | } |
105 | }, | 111 | }, |
106 | weixinPay: function(n, succ,fail) { | 112 | weixinPay: function(n, succ,fail) { |
107 | - if(!n) return false; | 113 | + if(!n){ |
114 | + this.set_fir(); | ||
115 | + return false; | ||
116 | + } | ||
108 | 117 | ||
118 | + var th=this; | ||
109 | getApp().globalData.no_clear=1; | 119 | getApp().globalData.no_clear=1; |
110 | 120 | ||
111 | wx.requestPayment({ | 121 | wx.requestPayment({ |
@@ -115,11 +125,11 @@ module.exports = { | @@ -115,11 +125,11 @@ module.exports = { | ||
115 | signType: n.signType, | 125 | signType: n.signType, |
116 | paySign: n.paySign, | 126 | paySign: n.paySign, |
117 | success: function(n) { | 127 | success: function(n) { |
118 | - wx_paying=0; | 128 | + th.wx_paying=0; |
119 | "function" == typeof succ && succ(); | 129 | "function" == typeof succ && succ(); |
120 | }, | 130 | }, |
121 | fail: function(n) { | 131 | fail: function(n) { |
122 | - wx_paying=0; | 132 | + th.wx_paying=0; |
123 | var msg=''; | 133 | var msg=''; |
124 | switch (n.errMsg){ | 134 | switch (n.errMsg){ |
125 | case "requestPayment:fail": msg="支付失败";break; | 135 | case "requestPayment:fail": msg="支付失败";break; |