Commit 2fd00563c39aee27360530664a1e7e33481bebbb
1 parent
382df4a5
1. 秒杀 团购 普通购买 拼团 拼团尾款 再计算价格的时候,优化按钮灰色!
Showing
6 changed files
with
45 additions
and
27 deletions
pages/cart/cart2/cart2.js
... | ... | @@ -1465,6 +1465,7 @@ Page({ |
1465 | 1465 | //-------------------计算订单价格------------------- |
1466 | 1466 | calculatePrice:async function (t, s) { |
1467 | 1467 | var th = this; |
1468 | + th.setData({submit:1}); | |
1468 | 1469 | |
1469 | 1470 | wx.showLoading({ |
1470 | 1471 | title: "处理中.", |
... | ... | @@ -1992,7 +1993,7 @@ Page({ |
1992 | 1993 | [atxt]: all_total_m, [atxt1]: all_order_m, |
1993 | 1994 | [atxt2]: all_price, [atxt3]: all_user_m, [atxt4]: all_shipping_m, |
1994 | 1995 | [atxt5]: all_coupon_price_m, [atxt6]: all_cutprice, |
1995 | - [atxt7]: all_order_prom, show_submit: 1, [atxt8]: all_zh_cutprice, [atxt9]: all_ladder_cutprice | |
1996 | + [atxt7]: all_order_prom, show_submit: 1, [atxt8]: all_zh_cutprice, [atxt9]: all_ladder_cutprice,submit:0 | |
1996 | 1997 | }) |
1997 | 1998 | th.data.order_prom_list_cart = c_arr; |
1998 | 1999 | th.set_can_num(); |
... | ... | @@ -2043,6 +2044,7 @@ Page({ |
2043 | 2044 | return false; |
2044 | 2045 | } |
2045 | 2046 | |
2047 | + th.setData({submit:1}); | |
2046 | 2048 | wx.showLoading({ |
2047 | 2049 | title: "处理中.", |
2048 | 2050 | mask:true |
... | ... | @@ -2368,14 +2370,14 @@ Page({ |
2368 | 2370 | if (th.data.bn_use_money == 1) { |
2369 | 2371 | if (amoney > order_m) { |
2370 | 2372 | order_m = parseFloat(order_m).toFixed(2); |
2371 | - th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 }) | |
2373 | + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1,submit:0 }) | |
2372 | 2374 | } else { |
2373 | 2375 | order_m = parseFloat(order_m) - parseFloat(amoney); |
2374 | 2376 | order_m = order_m.toFixed(2); |
2375 | - th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) | |
2377 | + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1,submit:0 }) | |
2376 | 2378 | } |
2377 | 2379 | } else { |
2378 | - th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) | |
2380 | + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1,submit:0 }) | |
2379 | 2381 | } |
2380 | 2382 | //优惠活动送积分 |
2381 | 2383 | if (good.s_intValue) { |
... | ... | @@ -2435,14 +2437,14 @@ Page({ |
2435 | 2437 | if (th.data.bn_use_money == 1) { |
2436 | 2438 | if (amoney > order_m) { |
2437 | 2439 | order_m = parseFloat(order_m).toFixed(2); |
2438 | - th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 }) | |
2440 | + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 ,submit:0}) | |
2439 | 2441 | } else { |
2440 | 2442 | order_m = parseFloat(order_m) - parseFloat(amoney); |
2441 | 2443 | order_m = order_m.toFixed(2); |
2442 | - th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) | |
2444 | + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1,submit:0 }) | |
2443 | 2445 | } |
2444 | 2446 | } else { |
2445 | - th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) | |
2447 | + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1,submit:0 }) | |
2446 | 2448 | } |
2447 | 2449 | //优惠活动送积分 |
2448 | 2450 | if (good.s_intValue) { |
... | ... | @@ -2928,10 +2930,6 @@ Page({ |
2928 | 2930 | var df_price = 0; |
2929 | 2931 | var df_room_ids = ""; |
2930 | 2932 | |
2931 | - | |
2932 | - | |
2933 | - | |
2934 | - | |
2935 | 2933 | //-------------让商品添加到商品列表-------------------- |
2936 | 2934 | for (var k = 0; k < t_item.goods.length; k++) { |
2937 | 2935 | ... | ... |
pages/cart/cart2_pt/cart2_pt.js
... | ... | @@ -396,10 +396,12 @@ Page({ |
396 | 396 | //---------计算立即购买---------- |
397 | 397 | calculatePrice2:async function () { |
398 | 398 | |
399 | - wx.showLoading({ | |
399 | + this.setData({submit:1}); | |
400 | + | |
401 | + wx.showLoading({ | |
400 | 402 | title: "处理中.", |
401 | 403 | mask:true |
402 | - }) | |
404 | + }) | |
403 | 405 | |
404 | 406 | var th = this, good = this.data.bn_goods; |
405 | 407 | //-----------计算商品总价-------------- |
... | ... | @@ -533,14 +535,14 @@ Page({ |
533 | 535 | //--------------如果使用余额--------------------- |
534 | 536 | if (th.data.bn_use_money == 1 && th.data.yuer > 0) { |
535 | 537 | if (parseFloat(th.data.yuer) > total_m) { |
536 | - th.setData({ [txt]: total_m, [txt2]: 0 }) | |
538 | + th.setData({ [txt]: total_m, [txt2]: 0,submit:0 }) | |
537 | 539 | } else { |
538 | 540 | order_m = parseFloat(order_m) - parseFloat(th.data.yuer); |
539 | 541 | order_m = order_m.toFixed(2); |
540 | - th.setData({ [txt]: th.data.yuer, [txt2]: order_m }) | |
542 | + th.setData({ [txt]: th.data.yuer, [txt2]: order_m,submit:0 }) | |
541 | 543 | } |
542 | 544 | } else { |
543 | - th.setData({ [txt]: 0, [txt2]: order_m }) | |
545 | + th.setData({ [txt]: 0, [txt2]: order_m,submit:0 }) | |
544 | 546 | } |
545 | 547 | |
546 | 548 | wx.hideLoading(); | ... | ... |
pages/cart/cart2_pt/cart2_pt.wxml
... | ... | @@ -158,7 +158,7 @@ |
158 | 158 | <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> |
159 | 159 | <!-- <view class="co-red big"></view> --> |
160 | 160 | </view> |
161 | - <button class="tips-btn" formType="submit" id="submitOrder">提交订单</button> | |
161 | + <button disabled="{{submit}}" class="tips-btn" formType="submit" id="submitOrder">提交订单</button> | |
162 | 162 | </view> |
163 | 163 | </form> |
164 | 164 | ... | ... |
pages/cart/cart_wk/cart_wk.js
... | ... | @@ -40,6 +40,7 @@ Page({ |
40 | 40 | show_pay_type: 0, |
41 | 41 | |
42 | 42 | teamgroup: null, |
43 | + submit:1, //默认按钮是灰色 | |
43 | 44 | }, |
44 | 45 | |
45 | 46 | /** |
... | ... | @@ -71,7 +72,7 @@ Page({ |
71 | 72 | * 生命周期函数--监听页面显示 |
72 | 73 | */ |
73 | 74 | onShow: function () { |
74 | - getApp().check_can_share(); | |
75 | + getApp().check_can_share(); | |
75 | 76 | var th = this; |
76 | 77 | if (th.data.isclose == 0) { |
77 | 78 | wx.navigateTo({ |
... | ... | @@ -96,7 +97,7 @@ Page({ |
96 | 97 | /** |
97 | 98 | * 用户点击右上角分享 |
98 | 99 | */ |
99 | - onShareAppMessage: function () { getApp().globalData.no_clear=1 }, | |
100 | + onShareAppMessage: function () { getApp().globalData.no_clear=1 }, | |
100 | 101 | //---------------获取物流--------------- |
101 | 102 | get_wuliu(func) { |
102 | 103 | var th = this, |
... | ... | @@ -330,6 +331,8 @@ Page({ |
330 | 331 | |
331 | 332 | //--计算物流的值-- |
332 | 333 | if (type == 0) { |
334 | + | |
335 | + th.setData({submit:0}) | |
333 | 336 | th.calculate_wuliu(); |
334 | 337 | } else { |
335 | 338 | var allpice = parseFloat(th.data.order.order_amount) |
... | ... | @@ -348,11 +351,19 @@ Page({ |
348 | 351 | }, |
349 | 352 | //--弹起支付框-- |
350 | 353 | to_pay() { |
354 | + | |
355 | + | |
356 | + //如果有再计算价格的过程中,不能提交订单 | |
357 | + if(submit){ return false} | |
358 | + | |
351 | 359 | //--物流支付时要有地址-- |
352 | 360 | if (this.data.exp_type == 0 && this.data.user_addr == null) { |
353 | 361 | return getApp().my_warnning("请选择收货地址", 0, this); |
354 | 362 | } |
355 | 363 | |
364 | + | |
365 | + | |
366 | + | |
356 | 367 | this.setData({ show_pay_type: 1 }); |
357 | 368 | }, |
358 | 369 | |
... | ... | @@ -474,6 +485,8 @@ Page({ |
474 | 485 | |
475 | 486 | //----计算物流的钱---- |
476 | 487 | async calculate_wuliu() { |
488 | + //让按钮变灰色 | |
489 | + th.setData({submit:1}); | |
477 | 490 | var to = getApp(), th = this; |
478 | 491 | //to.getwuliuprice(async function (rs) { |
479 | 492 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1, good = th.data.goods; |
... | ... | @@ -568,13 +581,14 @@ Page({ |
568 | 581 | await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{ |
569 | 582 | if(res.data.code==0){ |
570 | 583 | shipping_price=res.data.data; is_ok=1; |
584 | + }else{ | |
585 | + wx.showToast({ | |
586 | + title: "计算物流错误:"+res.data.msg, icon: 'none',duration: 2000 | |
587 | + }) | |
571 | 588 | } |
572 | 589 | }) |
573 | 590 | if(!is_ok){ |
574 | - wx.showToast({ | |
575 | - title: "计算物流错误", icon: 'none',duration: 2000 | |
576 | - }) | |
577 | - th.setData({ show_submit:0 }); | |
591 | + th.setData({ submit:0 }); | |
578 | 592 | wx.hideLoading(); |
579 | 593 | return false; |
580 | 594 | } |
... | ... | @@ -584,11 +598,11 @@ Page({ |
584 | 598 | allpice = allpice.toFixed(2); |
585 | 599 | |
586 | 600 | exp_price = parseFloat(exp_price); |
587 | - th.setData({ exp_price: exp_price, allpice: allpice }) | |
601 | + th.setData({ exp_price: exp_price, allpice: allpice,submit:0 }) | |
588 | 602 | } else { |
589 | 603 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; |
590 | 604 | allpice = allpice.toFixed(2); |
591 | - th.setData({ exp_price: 0, allpice: allpice }) | |
605 | + th.setData({ exp_price: 0, allpice: allpice,submit:0}) | |
592 | 606 | } |
593 | 607 | //}); |
594 | 608 | ... | ... |
pages/cart/cart_wk/cart_wk.wxml
... | ... | @@ -110,7 +110,7 @@ |
110 | 110 | <text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price,2)}}</text> |
111 | 111 | </view> --> |
112 | 112 | <view class='zf_left'>支付合计:<text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price,2)}}</text></view> |
113 | - <view class='zf_btn' bindtap="to_pay">支付尾款</view> | |
113 | + <view class="zf_btn {{submit?'gray':''}}" bindtap="to_pay">支付尾款</view> | |
114 | 114 | </view> |
115 | 115 | |
116 | 116 | <!--支付的方式选择,0微信支付 1余额支付--> | ... | ... |
pages/cart/cart_wk/cart_wk.wxss