Commit d1f73fbbba098216479cce824940a8819d729a22

Authored by 后端研发-苏泰源
2 parents 08d3358a 54919013

Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev

pages/cart/cart2/cart2.js
... ... @@ -5,10 +5,8 @@ var regeneratorRuntime = require('../../../utils/runtime.js');
5 5 var util_pay = require("../../../utils/pay.js");
6 6 var zh_calc = require("zh_calculate.js");
7 7 var ladder_calc = require("ladder_calculate.js");
8   -
9 8 // 防抖函数用定时器
10 9 let timer;
11   -
12 10 Page({
13 11 data: {
14 12 url: t.globalData.setting.url,
... ... @@ -93,13 +91,11 @@ Page({
93 91 is_coupon: 1, //选择券的控制属性
94 92 is_shipping_code: "",//插入用户默认地址
95 93 wu_arr_txt: "", //要更新的物流的字段
96   -
97 94 sales_rules: 1, //默认是显示线上库存
98 95 isget_by_quan: {}, //是否调用了接口获取包邮券
99 96 get_by_quan_list: null, //立即购买的
100 97 get_by_quan_list_cart: {}, //购物车的
101 98 by_quan_list_cart: null, //点击选择的包邮列表
102   -
103 99 //如果是全场包邮了,或者是全场不包邮了,就不要选包邮券
104 100 is_no_by: {},
105 101 is_by: {},
... ... @@ -2347,15 +2343,15 @@ Page({
2347 2343 }
2348 2344 }
2349 2345 })
  2346 + this.setData({
  2347 + submit:1,
  2348 + })
2350 2349 },
2351 2350  
2352 2351 //--------------------提交订单-----------------------
2353 2352 async submit_func() {
2354   - if (this.data.is_summit_ing == 1) return false; //--提交中退出--
2355   - this.data.is_summit_ing = 1;
2356 2353 var th = this, pdata = new Array();
2357 2354 var ff = true;
2358   -
2359 2355 //------------立即购买-------------
2360 2356 if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) {
2361 2357 if (th.data.bn_exp_type == 0 && th.data.user_addr == null) {
... ... @@ -2981,6 +2977,9 @@ Page({
2981 2977 console.log("index.js wx.request CheckCallUser fail");
2982 2978 },
2983 2979 complete: function () {
  2980 + this.setData({
  2981 + submit:0,
  2982 + })
2984 2983 }
2985 2984 })
2986 2985  
... ... @@ -4370,15 +4369,22 @@ Page({
4370 4369 },
4371 4370 //订阅消息提醒
4372 4371 sendsm: function (func) {
  4372 + let th =this;
4373 4373 var template_id = this.data.template_id;
4374 4374 // //授权订阅
4375 4375 wx.requestSubscribeMessage({
4376 4376 tmplIds: [template_id],
4377 4377 success(res) {
4378 4378 func();
  4379 + th.setData({
  4380 + submit:0,
  4381 + })
4379 4382 },
4380 4383 fail(res) {
4381 4384 func();
  4385 + th.setData({
  4386 + submit:0,
  4387 + })
4382 4388 }
4383 4389 })
4384 4390  
... ...
pages/cart/cart2/cart2.wxml
... ... @@ -455,7 +455,7 @@
455 455 <view class="payable">应付金额:<text class="co-red"><text class="fs24">¥</text>{{formData.order_amount}}</text></view>
456 456 <!-- <view class="co-red big"></view> -->
457 457 </view>
458   - <button class="tips-btn" formType="submit" id="submitOrder" bindtap="requestSubscribe">提交订单</button>
  458 + <button class="tips-btn" formType="submit" id="submitOrder" disabled="{{submit}}" bindtap="requestSubscribe">提交订单</button>
459 459 </view>
460 460 </form>
461 461  
... ...
pages/giftpack/buygiftpack/giftpackbuy.js
... ... @@ -29,14 +29,20 @@ Page({
29 29 first_leader: e.globalData.first_leader || 0, // 推荐人ID
30 30 },
31 31 onLoad: function (options) {
32   -
  32 + this.setData({
  33 + params: options,
  34 + })
  35 +
  36 + },
  37 + init() {
33 38 var th = this;
34   - var my_confirm = th.selectComponent("#my_confirm"); //组件的id
35   - my_confirm.open_cancel(0);
36   - th.setData({
  39 + let options = this.data?.params;
  40 + this.setData({
37 41 getStorageID: a.stoid,
38 42 getUserID: d.user_id
39 43 });
  44 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  45 + my_confirm.open_cancel(0);
40 46 //-- 获取分享人的ID --
41 47 var first_leader = options.first_leader || getApp().globalData.first_leader;
42 48 if (first_leader) {
... ... @@ -52,8 +58,6 @@ Page({
52 58 }
53 59 })
54 60 }
55   -
56   -
57 61 getApp().request.promiseGet("/api/weshop/ad/page?pid=901&store_id=" + os.stoid, {
58 62 data: {
59 63 enabled: 1
... ... @@ -72,19 +76,18 @@ Page({
72 76 });
73 77 }
74 78 })
75   -
76   -
  79 + this.getList();
77 80 },
78 81 onShow: function () {
79 82 //--先判断会员状态--
80   - getApp().is_Single_page(this,function(){
  83 + getApp().is_Single_page(this, function () {
81 84 var user_info = getApp().globalData.userInfo;
82 85 if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
83   - getApp().goto('/pages/togoin/togoin');
84   - return false;
  86 + getApp().goto('/pages/togoin/togoin');
  87 + return false;
85 88 }
86   - this.getList();
87 89 })
  90 + this.init();
88 91 },
89 92  
90 93 //购买礼包
... ... @@ -190,7 +193,7 @@ Page({
190 193 if (getApp().globalData.guide_id) {
191 194 json.guide_id = getApp().globalData.guide_id;
192 195 }
193   - console.log(json,'json');
  196 + console.log(json, 'json');
194 197 var data = JSON.stringify(json);
195 198 var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";
196 199 getApp().request.json_post(url, json,
... ... @@ -201,7 +204,7 @@ Page({
201 204 getApp().my_warnning(res.data.msg, 0, th);
202 205 }
203 206 },
204   - function (res) {})
  207 + function (res) { })
205 208  
206 209 })
207 210  
... ... @@ -245,7 +248,7 @@ Page({
245 248 getApp().my_warnning(res.data.msg, 0, th);
246 249 }
247 250 },
248   - function (res) {})
  251 + function (res) { })
249 252 })
250 253 },
251 254  
... ... @@ -271,12 +274,14 @@ Page({
271 274 wareCard: arr3,
272 275 total: res.data.data.total,
273 276 ismore: ismore,
274   - is_read: 1
  277 + is_read: 1,
  278 + is_get:1
275 279 }), wx.stopPullDownRefresh(); //停止下拉刷新
276 280 } else {
277 281 th.setData({
278 282 is_read: 1,
279   - ismore: 1
  283 + ismore: 1,
  284 + is_get:1
280 285 })
281 286 }
282 287 }
... ... @@ -326,7 +331,7 @@ Page({
326 331 if (pagePath.indexOf('/') != 0) {
327 332 pagePath = '/' + pagePath;
328 333 }
329   - pagePath += "?first_leader="+this.data.getUserID;
  334 + pagePath += "?first_leader=" + this.data.getUserID;
330 335 return {
331 336 title: "专享礼包",
332 337 path: pagePath,
... ... @@ -340,7 +345,7 @@ Page({
340 345 if (pagePath.indexOf('/') != 0) {
341 346 pagePath = '/' + pagePath;
342 347 }
343   - pagePath += "?first_leader="+this.data.getUserID;
  348 + pagePath += "?first_leader=" + this.data.getUserID;
344 349 return {
345 350 title: '专享礼包',
346 351 imageUrl: this.data.ad_data.ad_code,
... ...
pages/giftpack/buygiftpack/giftpackbuy.wxml
... ... @@ -94,7 +94,7 @@
94 94 </view>
95 95 </view>
96 96 </block>
97   - <block wx:if="{{is_read && wareCard.length<1}}">
  97 + <block wx:if="{{is_read && wareCard.length<1 && is_get}}">
98 98 <view class="foot_empty">
99 99 <view>
100 100 <image src="{{iurl+'/miniapp/images/giftbag/gift07.png'}}" lazy-load="true"></image>
... ...
pages/giftpack/giftpacklist/giftpacklist.js
... ... @@ -32,14 +32,22 @@ Page({
32 32 first_leader: e.globalData.first_leader || 0, // 推荐人ID
33 33 },
34 34 onLoad: function (options) {
  35 + this.setData({
  36 + params:options,
  37 + })
  38 + },
  39 + init(){
  40 + let options = this.data?.params;
35 41 var th = this;
36   - th.setData({
  42 + this.setData({
  43 + getUserID: d.user_id,
  44 + getStorageID: a.stoid,
  45 + })
  46 + this.setData({
37 47 isBuy: options.isBuy,
38 48 getGiftID: options.lbId,
39 49 orderSn: options.orderSn,
40   - getUserID: d.user_id,
41 50 })
42   -
43 51 if (options.lbId) th.data.lbId = options.lbId;
44 52 //-- 获取分享人的ID --
45 53 var first_leader = options.first_leader || getApp().globalData.first_leader;
... ... @@ -57,6 +65,11 @@ Page({
57 65 })
58 66 }
59 67 th.close();
  68 + if (this.data.isBuy == 0) {
  69 + this.GetMyGiftList();
  70 + } else {
  71 + this.GetBuyGiftList();
  72 + }
60 73 },
61 74  
62 75 onShow: function () {
... ... @@ -67,11 +80,7 @@ Page({
67 80 getApp().goto('/pages/togoin/togoin');
68 81 return false;
69 82 }
70   - if (this.data.isBuy == 0) {
71   - this.GetMyGiftList();
72   - } else {
73   - this.GetBuyGiftList();
74   - }
  83 + this.init();
75 84 })
76 85 },
77 86 GetBuyPrice: function (e) {
... ...
pages/giftpack/mygiftpack/mygiftpack.js
... ... @@ -25,19 +25,24 @@ Page({
25 25 curpage: 1, //当前分页数
26 26 pageSize: 10, //页大小
27 27 total: 0, //总数量
28   - ad_data:null,
  28 + ad_data: null,
29 29 first_leader: e.globalData.first_leader || 0, // 推荐人ID
30 30 },
  31 + onLoad: function (options) {
  32 + this.setData({
  33 + params: options,
  34 + })
  35 + },
31 36  
32   - onLoad: function(options) {
  37 + init() {
  38 + let options = this.data?.params;
33 39 var th = this;
34   - th.setData({
  40 + this.setData({
35 41 getStorageID: a.stoid,
36 42 getUserID: d.user_id,
37 43 loadingType: 0,
38 44 getDate: i.formatTime(new Date().getTime())
39 45 });
40   -
41 46 //-- 获取分享人的ID --
42 47 var first_leader = options.first_leader || getApp().globalData.first_leader;
43 48 if (first_leader) {
... ... @@ -53,39 +58,39 @@ Page({
53 58 }
54 59 })
55 60 }
56   -
57   - getApp().request.promiseGet("/api/weshop/ad/page?pid=901&store_id=" + os.stoid, {
58   - data: {
59   - enabled: 1
60   - }
61   - }).then(res => {
62   - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){
63   - var a = res.data.data.pageData;
64   - var tt = {
65   - 'ad_code': os.imghost + a[0].ad_code,
66   - 'media_link': '',
67   - 'ad_weapplink':a[0].ad_weapplink,
68   - 'bgcolor':a[0].bgcolor,
69   - };
70   - th.setData({ad_data:tt});
71   - }
72   - })
73 61  
  62 + getApp().request.promiseGet("/api/weshop/ad/page?pid=901&store_id=" + os.stoid, {
  63 + data: {
  64 + enabled: 1
  65 + }
  66 + }).then(res => {
  67 + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) {
  68 + var a = res.data.data.pageData;
  69 + var tt = {
  70 + 'ad_code': os.imghost + a[0].ad_code,
  71 + 'media_link': '',
  72 + 'ad_weapplink': a[0].ad_weapplink,
  73 + 'bgcolor': a[0].bgcolor,
  74 + };
  75 + th.setData({ ad_data: tt });
  76 + }
  77 + })
  78 + this.getList();
74 79 },
75   - onShow: function() {
  80 + onShow: function () {
76 81 //--先判断会员状态--
77   - getApp().is_Single_page(this,function () {
  82 + getApp().is_Single_page(this, function () {
78 83 var user_info = getApp().globalData.userInfo;
79 84 if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
80   - getApp().goto('/pages/togoin/togoin');
81   - return false;
  85 + getApp().goto('/pages/togoin/togoin');
  86 + return false;
82 87 }
83   - this.getList();
  88 + this.init()
84 89 })
85   -
  90 +
86 91  
87 92 },
88   - getList: function() {
  93 + getList: function () {
89 94 var th = this;
90 95  
91 96 getApp().request.get('/api/weshop/marketing/my/giftbag/page', {
... ... @@ -96,7 +101,7 @@ Page({
96 101 page: th.data.curpage,
97 102 pageSize: th.data.pageSize
98 103 },
99   - success: function(res) {
  104 + success: function (res) {
100 105 if (res.data.code == 0) {
101 106 th.data.curpage++;
102 107 var arr1 = th.data.wareCard;
... ... @@ -108,12 +113,14 @@ Page({
108 113 wareCard: arr3,
109 114 total: res.data.data.total,
110 115 ismore: ismore,
111   - is_read: 1
  116 + is_read: 1,
  117 + is_get:1,
112 118 }), wx.stopPullDownRefresh(); //停止下拉刷新
113 119 } else {
114 120 th.setData({
115 121 is_read: 1,
116   - ismore:1
  122 + ismore: 1,
  123 + is_get:1,
117 124 })
118 125 }
119 126  
... ... @@ -123,7 +130,7 @@ Page({
123 130  
124 131 },
125 132 //销毁界面跳转
126   - redirectTo: function(e) {
  133 + redirectTo: function (e) {
127 134 var th = this;
128 135 var url = e.currentTarget.dataset.url;
129 136 //销毁跳转
... ... @@ -132,13 +139,13 @@ Page({
132 139 });
133 140 },
134 141 //不销毁界面跳转
135   - navigateTo: function(e) {
  142 + navigateTo: function (e) {
136 143 var th = this;
137 144 var url = e.currentTarget.dataset.url;
138 145 getApp().goto(url);
139 146 },
140 147 //下拉事件
141   - onReachBottom: function() {
  148 + onReachBottom: function () {
142 149 var th = this;
143 150 if (th.data.total <= th.data.pageSize) return;
144 151 if (th.data.ismore) return;
... ... @@ -146,7 +153,7 @@ Page({
146 153 },
147 154  
148 155 //图片失败,默认图片
149   - bind_bnerr2: function(e) {
  156 + bind_bnerr2: function (e) {
150 157 var _errImg = e.target.dataset.errorimg;
151 158 var _errObj = {};
152 159 _errObj[_errImg] = "/miniapp/images/default_g_img.gif";
... ... @@ -154,33 +161,33 @@ Page({
154 161 },
155 162  
156 163  
157   -//--- 分享设置 --
158   -onShareAppMessage: function (e) {
159   - var curPage=this;
160   - var pagePath = curPage.route; //当前页面url
161   - if (pagePath.indexOf('/') != 0) {
162   - pagePath = '/' + pagePath;
163   - }
164   - pagePath += "?first_leader="+ this.data.getUserID;
165   - return {
166   - title: "专享礼包",
167   - path:pagePath,
168   - }
169   -},
  164 + //--- 分享设置 --
  165 + onShareAppMessage: function (e) {
  166 + var curPage = this;
  167 + var pagePath = curPage.route; //当前页面url
  168 + if (pagePath.indexOf('/') != 0) {
  169 + pagePath = '/' + pagePath;
  170 + }
  171 + pagePath += "?first_leader=" + this.data.getUserID;
  172 + return {
  173 + title: "专享礼包",
  174 + path: pagePath,
  175 + }
  176 + },
170 177  
171   - onShareTimeline() {
172   - var curPage=this;
173   - var pagePath = curPage.route; //当前页面url
174   - if (pagePath.indexOf('/') != 0) {
175   - pagePath = '/' + pagePath;
  178 + onShareTimeline() {
  179 + var curPage = this;
  180 + var pagePath = curPage.route; //当前页面url
  181 + if (pagePath.indexOf('/') != 0) {
  182 + pagePath = '/' + pagePath;
  183 + }
  184 + pagePath += "?first_leader=" + this.data.getUserID;
  185 + return {
  186 + title: '专享礼包',
  187 + imageUrl: this.data.ad_data.ad_code,
  188 + path: pagePath,
176 189 }
177   - pagePath += "?first_leader="+ this.data.getUserID;
178   - return {
179   - title: '专享礼包',
180   - imageUrl: this.data.ad_data.ad_code,
181   - path: pagePath,
182   - }
183   - },
  190 + },
184 191  
185 192  
186 193 });
187 194 \ No newline at end of file
... ...
pages/giftpack/mygiftpack/mygiftpack.wxml
... ... @@ -96,7 +96,7 @@
96 96 </view>
97 97 </view>
98 98 </block>
99   - <block wx:if="{{is_read && wareCard.length<1}}">
  99 + <block wx:if="{{is_read && wareCard.length<1 && is_get}}">
100 100 <view class="foot_empty">
101 101 <view>
102 102 <image src="{{iurl+'/miniapp/images/giftbag/gift07.png'}}" lazy-load="true"></image>
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -3664,7 +3664,6 @@ Page({
3664 3664 pageSize: 1000
3665 3665 }
3666 3666 }).then(res => {
3667   -
3668 3667 let pd_list = res.data.data.pageData;
3669 3668 if (res.data.code == 0 && pd_list.length > 0) {
3670 3669 flag = pd_list.some(pd => {
... ... @@ -4394,6 +4393,7 @@ Page({
4394 4393 go_cj_team: function (e) {
4395 4394 var ind = e.currentTarget.dataset.ind;
4396 4395 var item = this.data.teamgroup[ind];
  4396 + var goods_id = e.currentTarget.dataset.goodsid;
4397 4397 var id = item.id;
4398 4398 var th = this;
4399 4399  
... ... @@ -4438,15 +4438,17 @@ Page({
4438 4438 getApp().goto("/pages/team/team_success/team_success?ordersn=" + odr.order_sn);
4439 4439  
4440 4440 } else {
  4441 + console.log(222,goods_id)
4441 4442 wx.navigateTo({
4442   - url: "/pages/team/team_show/team_show?tg_id=" + id,
  4443 + url: "/pages/team/team_show/team_show?tg_id=" + id +"&goods_id="+goods_id,
4443 4444 });
4444 4445 }
4445 4446 }
4446 4447 //--跳转到参团--
4447 4448 else {
  4449 + console.log(1111,th.data.goods_id)
4448 4450 wx.navigateTo({
4449   - url: "/pages/team/team_show/team_show?tg_id=" + id,
  4451 + url: "/pages/team/team_show/team_show?tg_id=" + id+"&goods_id="+goods_id,
4450 4452 });
4451 4453 }
4452 4454 }
... ...
pages/goods/goodsInfo/goodsInfo.wxml
... ... @@ -216,7 +216,7 @@
216 216 </view>
217 217 </view>
218 218 <view class='group' wx:for="{{teamgroup}}" wx:for-index="t_ind" wx:key="teamgroup">
219   - <view class='group-list' bindtap="go_cj_team" data-ind="{{t_ind}}">
  219 + <view class='group-list' bindtap="go_cj_team" data-ind="{{t_ind}}" data-goodsid="{{data.goods_id}}">
220 220 <!-- <view class="flex ai_c"> -->
221 221 <!-- //选项框头像 -->
222 222 <view class='gtou'>
... ...
utils/pay.js
1   -var t = getApp(), n = t.request;
  1 +var t = getApp(), n = t.request,wx_paying=0;
2 2  
3 3 module.exports = {
4 4 url: "/api/weshop/order/pay/createOrder",
... ... @@ -20,6 +20,10 @@ module.exports = {
20 20 });
21 21 },
22 22 pay: function(t, e, a,sto,type) {
  23 +
  24 + if(wx_paying) return false;
  25 + wx_paying=1;
  26 +
23 27 var i = this;
24 28 var dd = {
25 29 parent_sn: t,
... ... @@ -28,9 +32,11 @@ module.exports = {
28 32 };
29 33 if (type == 1) dd.type = 1;
30 34  
  35 + wx.showLoading();
31 36 n.post(this.url, {
32 37 data: dd,
33 38 success: function(t) {
  39 + wx.hideLoading();
34 40 if(t.data.code==0){
35 41 i.weixinPay(t.data.data, e, a);
36 42 }else{
... ... @@ -39,14 +45,19 @@ module.exports = {
39 45 wx.redirectTo({
40 46 url: "/pages/user/order_list/order_list",
41 47 });
42   - },1000)
  48 + },1000)
  49 + wx_paying=0;
43 50 }
44 51 return false;
45 52 },
46 53 fail: function() {
  54 + wx.hideLoading();
  55 + wx_paying=0;
47 56 "function" == typeof a && a();
48 57 },
49 58 failStatus: function() {
  59 + wx.hideLoading();
  60 + wx_paying=0;
50 61 "function" == typeof a && a();
51 62 }
52 63 });
... ... @@ -64,9 +75,11 @@ module.exports = {
64 75 paySign: n.paySign,
65 76 orderInfo: n.orderInfo, // 需要新增的 订单 信息
66 77 success (n) {
  78 + wx_paying=0;
67 79 t.showSuccess("支付成功!", e);
68 80 },
69 81 fail (n) {
  82 + wx_paying=0;
70 83 if(!n.errMsg ) {
71 84 getApp().showWarning("支付失败");
72 85 "function" == typeof fail && fail();
... ... @@ -87,9 +100,11 @@ module.exports = {
87 100 signType: n.signType,
88 101 paySign: n.paySign,
89 102 success: function (n) {
  103 + wx_paying=0;
90 104 console.log(n), t.showSuccess("支付成功!", e);
91 105 },
92 106 fail: function (n) {
  107 + wx_paying=0;
93 108 console.log(n), "requestPayment:fail" == n.errMsg ? t.showWarning("支付失败") : "requestPayment:fail cancel" == n.errMsg ? t.showWarning("您已取消支付") :
94 109 t.confirmBox("支付失败:" + n.errMsg.substr("requestPayment:fail ".length)),
95 110 "function" == typeof a && a();
... ...
utils/pay2.js
1   -var t = getApp(), n = t.request;
  1 +var t = getApp(), n = t.request,wx_paying=0;
2 2  
3 3 module.exports = {
4 4 url: "/api/weshop/plus/create/plus/order",
5 5 pay: function(dd, succ,fail) {
  6 +
  7 + if(wx_paying) return false;
  8 + wx_paying=1;
  9 +
  10 + wx.showLoading();
6 11 var i = this;
7 12 n.post(this.url, {
8 13 data: dd,
9 14 success: function(t) {
  15 + wx.hideLoading();
10 16 if(t.data.code==0){
11 17 if(t.data.data=="升级成功"){
12 18 "function" == typeof succ && succ(1);
... ... @@ -19,9 +25,13 @@ module.exports = {
19 25 return false;
20 26 },
21 27 fail: function() {
  28 + wx.hideLoading();
  29 + wx_paying=0;
22 30 "function" == typeof fail && fail();
23 31 },
24 32 failStatus: function() {
  33 + wx.hideLoading();
  34 + wx_paying=0;
25 35 "function" == typeof fail && fail();
26 36 }
27 37 });
... ... @@ -35,9 +45,11 @@ module.exports = {
35 45 signType: n.signType,
36 46 paySign: n.paySign,
37 47 success: function(n) {
  48 + wx_paying=0;
38 49 "function" == typeof succ && succ();
39 50 },
40 51 fail: function(n) {
  52 + wx_paying=0;
41 53 "function" == typeof fail && fail();
42 54 }
43 55 });
... ...