Commit dfbb5336669e3e94d9e6e68ea1db735f3e6ff753
1 parent
d4d0df85
商品的多规格的bug优化, 金额和价格的错误~~
Showing
6 changed files
with
94 additions
and
37 deletions
packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml
| ... | ... | @@ -204,7 +204,7 @@ |
| 204 | 204 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view> |
| 205 | 205 | </block> |
| 206 | 206 | <block wx:else> |
| 207 | - <view bindtap="addCart_pt" class="spec-cart-btn spec-buy" data-action="buy">立即购买</view> | |
| 207 | + <view bindtap="addCart_pt" class="spec-cart-btn spec-buy {{sp_seleing?'gray':''}} " data-action="buy">立即购买</view> | |
| 208 | 208 | </block> |
| 209 | 209 | |
| 210 | 210 | </block> |
| ... | ... | @@ -221,7 +221,7 @@ |
| 221 | 221 | <view class="spec-cart-btn spec-buy w100" style="background-color: #dcdcdc;color: #999;">配送不匹配</view> |
| 222 | 222 | </block> |
| 223 | 223 | <block wx:else> |
| 224 | - <view bindtap="addCart_pt" class="spec-cart-btn spec-buy w100" data-action="buy">确定</view> | |
| 224 | + <view bindtap="addCart_pt" class="spec-cart-btn spec-buy w100 {{sp_seleing?'gray':''}}" data-action="buy">确定</view> | |
| 225 | 225 | </block> |
| 226 | 226 | </block> |
| 227 | 227 | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
| ... | ... | @@ -3025,6 +3025,13 @@ Page({ |
| 3025 | 3025 | |
| 3026 | 3026 | //-----------选择属性的按钮事件---------- |
| 3027 | 3027 | sele_spec: function (e) { |
| 3028 | + | |
| 3029 | + //防止重复点击 | |
| 3030 | + if(this.data.sp_seleing){ | |
| 3031 | + return false; | |
| 3032 | + } | |
| 3033 | + this.setData({sp_seleing:1}) | |
| 3034 | + | |
| 3028 | 3035 | var that = this, ee = this, th = this; |
| 3029 | 3036 | var gid = e.currentTarget.dataset.gid; |
| 3030 | 3037 | var nor = e.currentTarget.dataset.nor; |
| ... | ... | @@ -3056,13 +3063,21 @@ Page({ |
| 3056 | 3063 | }); |
| 3057 | 3064 | |
| 3058 | 3065 | |
| 3059 | - that.check_is_youhui(gid, that.data.is_normal); | |
| 3066 | + this.get_sto(that.data.is_normal,()=>{ | |
| 3067 | + that.sele_spec_next(gid,item) | |
| 3068 | + }); | |
| 3069 | + | |
| 3070 | + | |
| 3071 | + }, | |
| 3060 | 3072 | |
| 3061 | - this.get_sto(that.data.is_normal); | |
| 3062 | 3073 | |
| 3063 | 3074 | |
| 3064 | - //默认门店要拿下门店库存 | |
| 3065 | - if (!getApp().is_virtual(item) && !item.whsle_id && that.data.sales_rules >= 2 && that.data.def_pick_store) { | |
| 3075 | + sele_spec_next(gid,item){ | |
| 3076 | + var that = this; | |
| 3077 | + that.check_is_youhui(gid, that.data.is_normal); | |
| 3078 | + | |
| 3079 | + //默认门店要拿下门店库存 | |
| 3080 | + if (!getApp().is_virtual(item) && !item.whsle_id && that.data.sales_rules >= 2 && that.data.def_pick_store) { | |
| 3066 | 3081 | var lock = 0, plist = null; |
| 3067 | 3082 | // //先读取门店的lock,采用链式写法,少用await |
| 3068 | 3083 | // getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { |
| ... | ... | @@ -3099,8 +3114,8 @@ Page({ |
| 3099 | 3114 | |
| 3100 | 3115 | } |
| 3101 | 3116 | |
| 3117 | + that.sele_spec_chech_activity(); | |
| 3102 | 3118 | |
| 3103 | - this.sele_spec_chech_activity(); | |
| 3104 | 3119 | }, |
| 3105 | 3120 | |
| 3106 | 3121 | //选择了不同的规格的时候要判断是不是有活动正在进行中 |
| ... | ... | @@ -3155,7 +3170,8 @@ Page({ |
| 3155 | 3170 | prom_start_time: prom.start_time, |
| 3156 | 3171 | prom_st: prom_st, |
| 3157 | 3172 | prom_act: prom, |
| 3158 | - prom_id: prom.id | |
| 3173 | + prom_id: prom.id, | |
| 3174 | + sp_seleing:0 | |
| 3159 | 3175 | }) |
| 3160 | 3176 | |
| 3161 | 3177 | //却换图片 |
| ... | ... | @@ -3196,13 +3212,14 @@ Page({ |
| 3196 | 3212 | prom_end_time: null, |
| 3197 | 3213 | prom_start_time: null, |
| 3198 | 3214 | prom_st: null, |
| 3215 | + sp_seleing:0 | |
| 3199 | 3216 | }) |
| 3200 | 3217 | |
| 3201 | 3218 | }, |
| 3202 | 3219 | |
| 3203 | 3220 | |
| 3204 | 3221 | //---------拿出门店分类和门店------------ |
| 3205 | - get_sto(e) { | |
| 3222 | + get_sto(e,func) { | |
| 3206 | 3223 | var th = this, that = this; |
| 3207 | 3224 | var is_normal = e; |
| 3208 | 3225 | |
| ... | ... | @@ -3253,9 +3270,9 @@ Page({ |
| 3253 | 3270 | getApp().request.promiseGet("/api/weshop/pickup/list", { |
| 3254 | 3271 | data: dd, |
| 3255 | 3272 | }).then(res => { |
| 3256 | - var e = res; | |
| 3273 | + var e = res; | |
| 3257 | 3274 | |
| 3258 | - if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) { | |
| 3275 | + if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) { | |
| 3259 | 3276 | |
| 3260 | 3277 | //-- 如果有指定门店的时候 -- |
| 3261 | 3278 | if(th.data.sele_g.pickup_ids && th.data.is_normal){ |
| ... | ... | @@ -3346,7 +3363,13 @@ Page({ |
| 3346 | 3363 | th.deal_pickup(e); //--普通门店排版-- |
| 3347 | 3364 | }, 800) |
| 3348 | 3365 | } |
| 3366 | + | |
| 3367 | + if(func) func(); | |
| 3368 | + | |
| 3349 | 3369 | } |
| 3370 | + },err=>{ | |
| 3371 | + ut.m_toast('网络繁忙,请稍后重试'); | |
| 3372 | + wx.hideLoading(); | |
| 3350 | 3373 | }) |
| 3351 | 3374 | }, 200) |
| 3352 | 3375 | |
| ... | ... | @@ -4692,6 +4715,11 @@ Page({ |
| 4692 | 4715 | //-----------------拼单生成方法--------------------- |
| 4693 | 4716 | addCart_pt: function () { |
| 4694 | 4717 | |
| 4718 | + //如果是切换规格的时候,让商品不能提交到确认订单的页面,否则活动会出错,金额也不对 | |
| 4719 | + if(this.data.sp_seleing){ | |
| 4720 | + return false; | |
| 4721 | + } | |
| 4722 | + | |
| 4695 | 4723 | if (this.data.is_normal == 0) { |
| 4696 | 4724 | //看一下有没有起购数,如果有起购数,要计算起购数 |
| 4697 | 4725 | // var qnum = parseFloat(th.data.prom_act.minbuynum); | ... | ... |
pages/goods/goodsInfo/buy_com_pop.wxml
| ... | ... | @@ -153,10 +153,10 @@ |
| 153 | 153 | </view> |
| 154 | 154 | <block wx:else> |
| 155 | 155 | <view class="flex jc_sb"> |
| 156 | - <view class="spec-cart-btn spec-buy w40" bindtap="addCart" | |
| 156 | + <view class="spec-cart-btn spec-buy w40 {{sp_seleing?'gray':''}}" bindtap="addCart" | |
| 157 | 157 | data-action="add" style="background-color: #ffb03f;">加入购物车 |
| 158 | 158 | </view> |
| 159 | - <view class="spec-cart-btn spec-buy w40" bindtap="addCart" | |
| 159 | + <view class="spec-cart-btn spec-buy w40 {{sp_seleing?'gray':''}}" bindtap="addCart" | |
| 160 | 160 | data-action="buy">立即购买 |
| 161 | 161 | </view> |
| 162 | 162 | </view> |
| ... | ... | @@ -172,10 +172,10 @@ |
| 172 | 172 | |
| 173 | 173 | <block wx:else> |
| 174 | 174 | <view class="flex jc_sb"> |
| 175 | - <view class="spec-cart-btn spec-buy w40" bindtap="addCart" | |
| 175 | + <view class="spec-cart-btn spec-buy w40 {{sp_seleing?'gray':''}}" bindtap="addCart" | |
| 176 | 176 | data-action="add" style="background-color: #ffb03f;">加入购物车 |
| 177 | 177 | </view> |
| 178 | - <view class="spec-cart-btn spec-buy w40" bindtap="addCart" | |
| 178 | + <view class="spec-cart-btn spec-buy w40 {{sp_seleing?'gray':''}}" bindtap="addCart" | |
| 179 | 179 | data-action="buy">立即购买 |
| 180 | 180 | </view> |
| 181 | 181 | </view> | ... | ... |
pages/goods/goodsInfo/buy_pt.wxml
| ... | ... | @@ -195,7 +195,7 @@ |
| 195 | 195 | </view> |
| 196 | 196 | </block> |
| 197 | 197 | <block wx:else> |
| 198 | - <view bindtap="addCart_pt" class="spec-cart-btn spec-buy" data-action="buy">立即购买</view> | |
| 198 | + <view bindtap="addCart_pt" class="spec-cart-btn spec-buy {{sp_seleing?'gray':''}}" data-action="buy">立即购买</view> | |
| 199 | 199 | </block> |
| 200 | 200 | </block> |
| 201 | 201 | <!-- 线上销售 --> |
| ... | ... | @@ -206,7 +206,7 @@ |
| 206 | 206 | </view> |
| 207 | 207 | </block> |
| 208 | 208 | <block wx:else> |
| 209 | - <view bindtap="addCart_pt" class="spec-cart-btn spec-buy" data-action="buy">立即购买</view> | |
| 209 | + <view bindtap="addCart_pt" class="spec-cart-btn spec-buy {{sp_seleing?'gray':''}}" data-action="buy">立即购买</view> | |
| 210 | 210 | </block> |
| 211 | 211 | </block> |
| 212 | 212 | </block> |
| ... | ... | @@ -226,7 +226,7 @@ |
| 226 | 226 | <view class="spec-cart-btn spec-buy w100" data-action="add" style="background-color: #dcdcdc;color: #999;">该店不可售</view> |
| 227 | 227 | </block> |
| 228 | 228 | <block wx:else> |
| 229 | - <view bindtap="addCart_pt" class="spec-cart-btn spec-buy w100" data-action="buy">确定</view> | |
| 229 | + <view bindtap="addCart_pt" class="spec-cart-btn spec-buy w100 {{sp_seleing?'gray':''}}" data-action="buy">确定</view> | |
| 230 | 230 | </block> |
| 231 | 231 | </block> |
| 232 | 232 | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
| ... | ... | @@ -1392,6 +1392,10 @@ Page({ |
| 1392 | 1392 | |
| 1393 | 1393 | //------------加入购物车-------------- |
| 1394 | 1394 | addCart: function (t) { |
| 1395 | + //如果是切换规格的时候,让商品不能提交到确认订单的页面,否则活动会出错,金额也不对 | |
| 1396 | + if(this.data.sp_seleing){ | |
| 1397 | + return false; | |
| 1398 | + } | |
| 1395 | 1399 | |
| 1396 | 1400 | var th = this; |
| 1397 | 1401 | var ind = t.currentTarget.dataset.openSpecModal_ind; |
| ... | ... | @@ -3279,6 +3283,12 @@ Page({ |
| 3279 | 3283 | //-----------选择属性的按钮事件---------- |
| 3280 | 3284 | sele_spec: function (e) { |
| 3281 | 3285 | |
| 3286 | + if(this.data.sp_seleing){ | |
| 3287 | + return false; | |
| 3288 | + } | |
| 3289 | + | |
| 3290 | + this.setData({sp_seleing:1}) | |
| 3291 | + | |
| 3282 | 3292 | var that = this; |
| 3283 | 3293 | var th = this; |
| 3284 | 3294 | |
| ... | ... | @@ -3365,22 +3375,27 @@ Page({ |
| 3365 | 3375 | }); |
| 3366 | 3376 | |
| 3367 | 3377 | |
| 3368 | - | |
| 3369 | 3378 | if (nor) { |
| 3370 | 3379 | that.set_sele_g(sku_g) |
| 3371 | - that.get_sto(1); | |
| 3380 | + that.get_sto(1,()=>{ | |
| 3381 | + that.sele_spec_next(that,item,gid,nor); | |
| 3382 | + }); | |
| 3372 | 3383 | } |
| 3373 | - else that.get_sto(); | |
| 3384 | + else that.get_sto(null,()=>{ | |
| 3385 | + that.sele_spec_next(that,item,gid,nor); | |
| 3386 | + }); | |
| 3374 | 3387 | |
| 3388 | + }, | |
| 3375 | 3389 | |
| 3390 | + //-- 选择规格下一步 -- | |
| 3391 | + sele_spec_next(that,item,gid,nor){ | |
| 3376 | 3392 | if (!item.whsle_id && ([1, 2, 4, 6].indexOf(item.prom_type) == -1 || this.data.is_normal == 1)) |
| 3377 | 3393 | that.check_is_youhui(gid, that.data.is_normal, 1); |
| 3378 | 3394 | |
| 3379 | - | |
| 3380 | 3395 | //默认门店要拿下门店库存 |
| 3381 | 3396 | if (that.data.sales_rules >= 2 && that.data.def_pick_store && !that.data.sele_g.whsle_id && [1, 2, 4, 6].indexOf(item.prom_type) == -1) { |
| 3382 | 3397 | var lock = 0, |
| 3383 | - plist = null; | |
| 3398 | + plist = null; | |
| 3384 | 3399 | |
| 3385 | 3400 | that.check_CanOutQty(that.data.sele_g, that.data.def_pick_store, function (CanOutQty) { |
| 3386 | 3401 | that.data.def_pick_store.CanOutQty = CanOutQty; |
| ... | ... | @@ -3391,18 +3406,18 @@ Page({ |
| 3391 | 3406 | }) |
| 3392 | 3407 | |
| 3393 | 3408 | } |
| 3394 | - this.sele_spec_chech_activity(nor); | |
| 3409 | + that.sele_spec_chech_activity(nor); | |
| 3395 | 3410 | |
| 3396 | 3411 | //如果是秒杀,拼团等互动,就不重新算界面 |
| 3397 | 3412 | if ([1, 2, 4, 6, 8, 9].indexOf(this.data.base_nor_prom_type) > -1) { |
| 3398 | 3413 | return false; |
| 3399 | 3414 | } |
| 3400 | 3415 | |
| 3401 | - this.check_has_flash(gid); | |
| 3416 | + that.check_has_flash(gid); | |
| 3402 | 3417 | var url = '/api/weshop/activitylist/listGoodActInfo2New'; |
| 3403 | 3418 | var req_d = { |
| 3404 | 3419 | "store_id": os.stoid, |
| 3405 | - "goods_id": this.data.gid, | |
| 3420 | + "goods_id": that.data.gid, | |
| 3406 | 3421 | "user_id": user_id, |
| 3407 | 3422 | } |
| 3408 | 3423 | getApp().request.get(url, { |
| ... | ... | @@ -3421,7 +3436,7 @@ Page({ |
| 3421 | 3436 | if (arr3 && arr3.length > 0) { |
| 3422 | 3437 | //获取活动信息 |
| 3423 | 3438 | var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + |
| 3424 | - arr3[0].act_id + "/" + getApp().globalData.user_id; | |
| 3439 | + arr3[0].act_id + "/" + getApp().globalData.user_id; | |
| 3425 | 3440 | getApp().request.get(url, { |
| 3426 | 3441 | success: function (e) { |
| 3427 | 3442 | if (e.data.code == 0 && e.data.data) { |
| ... | ... | @@ -3450,9 +3465,7 @@ Page({ |
| 3450 | 3465 | //选择了不同的规格的时候要判断是不是有活动正在进行中 |
| 3451 | 3466 | async sele_spec_chech_activity(nor) { |
| 3452 | 3467 | //---如果是活动的时候--- |
| 3453 | - var prom = null, | |
| 3454 | - goodsinfo = this.data.sele_g, | |
| 3455 | - th = this; | |
| 3468 | + var prom = null,goodsinfo = this.data.sele_g,th = this; | |
| 3456 | 3469 | |
| 3457 | 3470 | //如果是普通购买的时候,要返回原先 |
| 3458 | 3471 | if (goodsinfo.goods_id == this.data.base_nor_goods_id) { |
| ... | ... | @@ -3537,7 +3550,8 @@ Page({ |
| 3537 | 3550 | prom_start_time: prom.start_time, |
| 3538 | 3551 | prom_st: prom_st, |
| 3539 | 3552 | prom_act: prom, |
| 3540 | - prom_id: prom.id | |
| 3553 | + prom_id: prom.id, | |
| 3554 | + sp_seleing:0 | |
| 3541 | 3555 | }) |
| 3542 | 3556 | |
| 3543 | 3557 | var pro_null=null; |
| ... | ... | @@ -3581,7 +3595,10 @@ Page({ |
| 3581 | 3595 | } |
| 3582 | 3596 | } |
| 3583 | 3597 | |
| 3584 | - if (nor) return false; | |
| 3598 | + if (nor){ | |
| 3599 | + th.setData({ sp_seleing:0 }) | |
| 3600 | + return false; | |
| 3601 | + } | |
| 3585 | 3602 | |
| 3586 | 3603 | //---设置普通商品--- |
| 3587 | 3604 | th.setData({ |
| ... | ... | @@ -3591,13 +3608,14 @@ Page({ |
| 3591 | 3608 | prom_end_time: null, |
| 3592 | 3609 | prom_start_time: null, |
| 3593 | 3610 | prom_st: null, |
| 3611 | + sp_seleing:0 | |
| 3594 | 3612 | }) |
| 3595 | 3613 | |
| 3596 | 3614 | }, |
| 3597 | 3615 | |
| 3598 | 3616 | |
| 3599 | 3617 | //---------拿出门店分类和门店------------ |
| 3600 | - get_sto(e) { | |
| 3618 | + get_sto(e,func) { | |
| 3601 | 3619 | console.log('get_sto') |
| 3602 | 3620 | var th = this, |
| 3603 | 3621 | that = this; |
| ... | ... | @@ -3791,12 +3809,16 @@ Page({ |
| 3791 | 3809 | th.deal_pickup(e); //--普通门店排版-- |
| 3792 | 3810 | }, 800) |
| 3793 | 3811 | } |
| 3812 | + if(func) func(); | |
| 3794 | 3813 | }else{ |
| 3795 | 3814 | wx.hideLoading(); |
| 3796 | 3815 | } |
| 3797 | 3816 | } else { |
| 3798 | 3817 | wx.hideLoading(); |
| 3799 | 3818 | } |
| 3819 | + },err=>{ | |
| 3820 | + ut.m_toast('网络繁忙,请稍后重试'); | |
| 3821 | + wx.hideLoading(); | |
| 3800 | 3822 | }) |
| 3801 | 3823 | }, 200) |
| 3802 | 3824 | |
| ... | ... | @@ -3807,6 +3829,7 @@ Page({ |
| 3807 | 3829 | keyword: e.detail.value |
| 3808 | 3830 | }) |
| 3809 | 3831 | }, |
| 3832 | + | |
| 3810 | 3833 | //搜索门店 |
| 3811 | 3834 | searchfn() { |
| 3812 | 3835 | let choice_sort_store = this.data.choice_sort_store |
| ... | ... | @@ -5338,6 +5361,12 @@ Page({ |
| 5338 | 5361 | |
| 5339 | 5362 | //-----------------拼单生成方法--------------------- |
| 5340 | 5363 | addCart_pt: function () { |
| 5364 | + | |
| 5365 | + //如果是切换规格的时候,让商品不能提交到确认订单的页面,否则活动会出错,金额也不对 | |
| 5366 | + if(this.data.sp_seleing){ | |
| 5367 | + return false; | |
| 5368 | + } | |
| 5369 | + | |
| 5341 | 5370 | var th = this; |
| 5342 | 5371 | if (this.data.is_normal == 0) { |
| 5343 | 5372 | //看一下有没有起购数,如果有起购数,要计算起购数 | ... | ... |
pages/goods/goodsInfo/goodsInfo.wxml
| ... | ... | @@ -1465,10 +1465,10 @@ |
| 1465 | 1465 | </view> |
| 1466 | 1466 | </block> |
| 1467 | 1467 | <block wx:else> |
| 1468 | - <view wx:if="{{openSpecModal_ind==1}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn yellow fs32" data-action="add"> | |
| 1468 | + <view wx:if="{{openSpecModal_ind==1}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn yellow {{sp_seleing?'gray':''}}" data-action="add"> | |
| 1469 | 1469 | 加入购物车 |
| 1470 | 1470 | </view> |
| 1471 | - <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy" data-action="buy"> | |
| 1471 | + <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy {{sp_seleing?'gray':''}}" data-action="buy"> | |
| 1472 | 1472 | {{sele_g.offline_price?"券后购买":"立即购买"}} |
| 1473 | 1473 | </view> |
| 1474 | 1474 | </block> |
| ... | ... | @@ -1487,10 +1487,10 @@ |
| 1487 | 1487 | </view> |
| 1488 | 1488 | </block> |
| 1489 | 1489 | <block wx:else> |
| 1490 | - <view wx:if="{{openSpecModal_ind==1}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn yellow fs32" data-action="add"> | |
| 1490 | + <view wx:if="{{openSpecModal_ind==1}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn yellow {{sp_seleing?'gray':''}}" data-action="add"> | |
| 1491 | 1491 | 加入购物车 |
| 1492 | 1492 | </view> |
| 1493 | - <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy" data-action="buy"> | |
| 1493 | + <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy {{sp_seleing?'gray':''}}" data-action="buy"> | |
| 1494 | 1494 | {{sele_g.offline_price?"券后购买":"立即购买"}} |
| 1495 | 1495 | </view> |
| 1496 | 1496 | </block> | ... | ... |