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,6 +1465,7 @@ Page({ | ||
| 1465 | //-------------------计算订单价格------------------- | 1465 | //-------------------计算订单价格------------------- |
| 1466 | calculatePrice:async function (t, s) { | 1466 | calculatePrice:async function (t, s) { |
| 1467 | var th = this; | 1467 | var th = this; |
| 1468 | + th.setData({submit:1}); | ||
| 1468 | 1469 | ||
| 1469 | wx.showLoading({ | 1470 | wx.showLoading({ |
| 1470 | title: "处理中.", | 1471 | title: "处理中.", |
| @@ -1992,7 +1993,7 @@ Page({ | @@ -1992,7 +1993,7 @@ Page({ | ||
| 1992 | [atxt]: all_total_m, [atxt1]: all_order_m, | 1993 | [atxt]: all_total_m, [atxt1]: all_order_m, |
| 1993 | [atxt2]: all_price, [atxt3]: all_user_m, [atxt4]: all_shipping_m, | 1994 | [atxt2]: all_price, [atxt3]: all_user_m, [atxt4]: all_shipping_m, |
| 1994 | [atxt5]: all_coupon_price_m, [atxt6]: all_cutprice, | 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 | th.data.order_prom_list_cart = c_arr; | 1998 | th.data.order_prom_list_cart = c_arr; |
| 1998 | th.set_can_num(); | 1999 | th.set_can_num(); |
| @@ -2043,6 +2044,7 @@ Page({ | @@ -2043,6 +2044,7 @@ Page({ | ||
| 2043 | return false; | 2044 | return false; |
| 2044 | } | 2045 | } |
| 2045 | 2046 | ||
| 2047 | + th.setData({submit:1}); | ||
| 2046 | wx.showLoading({ | 2048 | wx.showLoading({ |
| 2047 | title: "处理中.", | 2049 | title: "处理中.", |
| 2048 | mask:true | 2050 | mask:true |
| @@ -2368,14 +2370,14 @@ Page({ | @@ -2368,14 +2370,14 @@ Page({ | ||
| 2368 | if (th.data.bn_use_money == 1) { | 2370 | if (th.data.bn_use_money == 1) { |
| 2369 | if (amoney > order_m) { | 2371 | if (amoney > order_m) { |
| 2370 | order_m = parseFloat(order_m).toFixed(2); | 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 | } else { | 2374 | } else { |
| 2373 | order_m = parseFloat(order_m) - parseFloat(amoney); | 2375 | order_m = parseFloat(order_m) - parseFloat(amoney); |
| 2374 | order_m = order_m.toFixed(2); | 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 | } else { | 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 | if (good.s_intValue) { | 2383 | if (good.s_intValue) { |
| @@ -2435,14 +2437,14 @@ Page({ | @@ -2435,14 +2437,14 @@ Page({ | ||
| 2435 | if (th.data.bn_use_money == 1) { | 2437 | if (th.data.bn_use_money == 1) { |
| 2436 | if (amoney > order_m) { | 2438 | if (amoney > order_m) { |
| 2437 | order_m = parseFloat(order_m).toFixed(2); | 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 | } else { | 2441 | } else { |
| 2440 | order_m = parseFloat(order_m) - parseFloat(amoney); | 2442 | order_m = parseFloat(order_m) - parseFloat(amoney); |
| 2441 | order_m = order_m.toFixed(2); | 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 | } else { | 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 | if (good.s_intValue) { | 2450 | if (good.s_intValue) { |
| @@ -2928,10 +2930,6 @@ Page({ | @@ -2928,10 +2930,6 @@ Page({ | ||
| 2928 | var df_price = 0; | 2930 | var df_price = 0; |
| 2929 | var df_room_ids = ""; | 2931 | var df_room_ids = ""; |
| 2930 | 2932 | ||
| 2931 | - | ||
| 2932 | - | ||
| 2933 | - | ||
| 2934 | - | ||
| 2935 | //-------------让商品添加到商品列表-------------------- | 2933 | //-------------让商品添加到商品列表-------------------- |
| 2936 | for (var k = 0; k < t_item.goods.length; k++) { | 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,10 +396,12 @@ Page({ | ||
| 396 | //---------计算立即购买---------- | 396 | //---------计算立即购买---------- |
| 397 | calculatePrice2:async function () { | 397 | calculatePrice2:async function () { |
| 398 | 398 | ||
| 399 | - wx.showLoading({ | 399 | + this.setData({submit:1}); |
| 400 | + | ||
| 401 | + wx.showLoading({ | ||
| 400 | title: "处理中.", | 402 | title: "处理中.", |
| 401 | mask:true | 403 | mask:true |
| 402 | - }) | 404 | + }) |
| 403 | 405 | ||
| 404 | var th = this, good = this.data.bn_goods; | 406 | var th = this, good = this.data.bn_goods; |
| 405 | //-----------计算商品总价-------------- | 407 | //-----------计算商品总价-------------- |
| @@ -533,14 +535,14 @@ Page({ | @@ -533,14 +535,14 @@ Page({ | ||
| 533 | //--------------如果使用余额--------------------- | 535 | //--------------如果使用余额--------------------- |
| 534 | if (th.data.bn_use_money == 1 && th.data.yuer > 0) { | 536 | if (th.data.bn_use_money == 1 && th.data.yuer > 0) { |
| 535 | if (parseFloat(th.data.yuer) > total_m) { | 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 | } else { | 539 | } else { |
| 538 | order_m = parseFloat(order_m) - parseFloat(th.data.yuer); | 540 | order_m = parseFloat(order_m) - parseFloat(th.data.yuer); |
| 539 | order_m = order_m.toFixed(2); | 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 | } else { | 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 | wx.hideLoading(); | 548 | wx.hideLoading(); |
pages/cart/cart2_pt/cart2_pt.wxml
| @@ -158,7 +158,7 @@ | @@ -158,7 +158,7 @@ | ||
| 158 | <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> | 158 | <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> |
| 159 | <!-- <view class="co-red big"></view> --> | 159 | <!-- <view class="co-red big"></view> --> |
| 160 | </view> | 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 | </view> | 162 | </view> |
| 163 | </form> | 163 | </form> |
| 164 | 164 |
pages/cart/cart_wk/cart_wk.js
| @@ -40,6 +40,7 @@ Page({ | @@ -40,6 +40,7 @@ Page({ | ||
| 40 | show_pay_type: 0, | 40 | show_pay_type: 0, |
| 41 | 41 | ||
| 42 | teamgroup: null, | 42 | teamgroup: null, |
| 43 | + submit:1, //默认按钮是灰色 | ||
| 43 | }, | 44 | }, |
| 44 | 45 | ||
| 45 | /** | 46 | /** |
| @@ -71,7 +72,7 @@ Page({ | @@ -71,7 +72,7 @@ Page({ | ||
| 71 | * 生命周期函数--监听页面显示 | 72 | * 生命周期函数--监听页面显示 |
| 72 | */ | 73 | */ |
| 73 | onShow: function () { | 74 | onShow: function () { |
| 74 | - getApp().check_can_share(); | 75 | + getApp().check_can_share(); |
| 75 | var th = this; | 76 | var th = this; |
| 76 | if (th.data.isclose == 0) { | 77 | if (th.data.isclose == 0) { |
| 77 | wx.navigateTo({ | 78 | wx.navigateTo({ |
| @@ -96,7 +97,7 @@ Page({ | @@ -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 | get_wuliu(func) { | 102 | get_wuliu(func) { |
| 102 | var th = this, | 103 | var th = this, |
| @@ -330,6 +331,8 @@ Page({ | @@ -330,6 +331,8 @@ Page({ | ||
| 330 | 331 | ||
| 331 | //--计算物流的值-- | 332 | //--计算物流的值-- |
| 332 | if (type == 0) { | 333 | if (type == 0) { |
| 334 | + | ||
| 335 | + th.setData({submit:0}) | ||
| 333 | th.calculate_wuliu(); | 336 | th.calculate_wuliu(); |
| 334 | } else { | 337 | } else { |
| 335 | var allpice = parseFloat(th.data.order.order_amount) | 338 | var allpice = parseFloat(th.data.order.order_amount) |
| @@ -348,11 +351,19 @@ Page({ | @@ -348,11 +351,19 @@ Page({ | ||
| 348 | }, | 351 | }, |
| 349 | //--弹起支付框-- | 352 | //--弹起支付框-- |
| 350 | to_pay() { | 353 | to_pay() { |
| 354 | + | ||
| 355 | + | ||
| 356 | + //如果有再计算价格的过程中,不能提交订单 | ||
| 357 | + if(submit){ return false} | ||
| 358 | + | ||
| 351 | //--物流支付时要有地址-- | 359 | //--物流支付时要有地址-- |
| 352 | if (this.data.exp_type == 0 && this.data.user_addr == null) { | 360 | if (this.data.exp_type == 0 && this.data.user_addr == null) { |
| 353 | return getApp().my_warnning("请选择收货地址", 0, this); | 361 | return getApp().my_warnning("请选择收货地址", 0, this); |
| 354 | } | 362 | } |
| 355 | 363 | ||
| 364 | + | ||
| 365 | + | ||
| 366 | + | ||
| 356 | this.setData({ show_pay_type: 1 }); | 367 | this.setData({ show_pay_type: 1 }); |
| 357 | }, | 368 | }, |
| 358 | 369 | ||
| @@ -474,6 +485,8 @@ Page({ | @@ -474,6 +485,8 @@ Page({ | ||
| 474 | 485 | ||
| 475 | //----计算物流的钱---- | 486 | //----计算物流的钱---- |
| 476 | async calculate_wuliu() { | 487 | async calculate_wuliu() { |
| 488 | + //让按钮变灰色 | ||
| 489 | + th.setData({submit:1}); | ||
| 477 | var to = getApp(), th = this; | 490 | var to = getApp(), th = this; |
| 478 | //to.getwuliuprice(async function (rs) { | 491 | //to.getwuliuprice(async function (rs) { |
| 479 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1, good = th.data.goods; | 492 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1, good = th.data.goods; |
| @@ -568,13 +581,14 @@ Page({ | @@ -568,13 +581,14 @@ Page({ | ||
| 568 | await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{ | 581 | await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{ |
| 569 | if(res.data.code==0){ | 582 | if(res.data.code==0){ |
| 570 | shipping_price=res.data.data; is_ok=1; | 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 | if(!is_ok){ | 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 | wx.hideLoading(); | 592 | wx.hideLoading(); |
| 579 | return false; | 593 | return false; |
| 580 | } | 594 | } |
| @@ -584,11 +598,11 @@ Page({ | @@ -584,11 +598,11 @@ Page({ | ||
| 584 | allpice = allpice.toFixed(2); | 598 | allpice = allpice.toFixed(2); |
| 585 | 599 | ||
| 586 | exp_price = parseFloat(exp_price); | 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 | } else { | 602 | } else { |
| 589 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; | 603 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; |
| 590 | allpice = allpice.toFixed(2); | 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,7 +110,7 @@ | ||
| 110 | <text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price,2)}}</text> | 110 | <text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price,2)}}</text> |
| 111 | </view> --> | 111 | </view> --> |
| 112 | <view class='zf_left'>支付合计:<text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price,2)}}</text></view> | 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 | </view> | 114 | </view> |
| 115 | 115 | ||
| 116 | <!--支付的方式选择,0微信支付 1余额支付--> | 116 | <!--支付的方式选择,0微信支付 1余额支付--> |
pages/cart/cart_wk/cart_wk.wxss
| @@ -288,7 +288,11 @@ page { | @@ -288,7 +288,11 @@ page { | ||
| 288 | color: #c4182e; | 288 | color: #c4182e; |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | -/*----------nyf新增,地址---------*/ | 291 | +.zf_btn.gray{ |
| 292 | + background-color:darkgrey; | ||
| 293 | +} | ||
| 294 | + | ||
| 295 | + /*----------nyf新增,地址---------*/ | ||
| 292 | .add_new{ | 296 | .add_new{ |
| 293 | box-sizing: border-box; | 297 | box-sizing: border-box; |
| 294 | height: 92rpx; | 298 | height: 92rpx; |