Commit c63edec0aa520ab3c92fb675643fc39cbfd51858
1 parent
e93f44fc
服务卡秒杀修改
Showing
2 changed files
with
126 additions
and
65 deletions
packageA/pages/goodsInfo/goodsInfo.js
| @@ -211,6 +211,8 @@ Page({ | @@ -211,6 +211,8 @@ Page({ | ||
| 211 | prom_r_null: 0, | 211 | prom_r_null: 0, |
| 212 | 212 | ||
| 213 | hiddenCS: true, //控制客服操作菜单显示和控制 | 213 | hiddenCS: true, //控制客服操作菜单显示和控制 |
| 214 | + | ||
| 215 | + openSpecModal_flash_normal: 0, | ||
| 214 | }, | 216 | }, |
| 215 | 217 | ||
| 216 | //------初始化加载---------- | 218 | //------初始化加载---------- |
| @@ -281,14 +283,15 @@ Page({ | @@ -281,14 +283,15 @@ Page({ | ||
| 281 | } | 283 | } |
| 282 | }) | 284 | }) |
| 283 | } | 285 | } |
| 286 | + | ||
| 284 | var c_guide_id=t.c_guide_id; | 287 | var c_guide_id=t.c_guide_id; |
| 285 | if(c_guide_id){ | 288 | if(c_guide_id){ |
| 286 | th.data.c_guide_id=c_guide_id; | 289 | th.data.c_guide_id=c_guide_id; |
| 287 | } | 290 | } |
| 288 | 291 | ||
| 289 | - getApp().getConfig(function(e) { | ||
| 290 | - ee.setData({sto_sele_name_1:e.store_name}) | ||
| 291 | - }) | 292 | + getApp().getConfig(function(e) { |
| 293 | + ee.setData({sto_sele_name_1:e.store_name}) | ||
| 294 | + }) | ||
| 292 | 295 | ||
| 293 | //----获取系统参数----- | 296 | //----获取系统参数----- |
| 294 | getApp().getConfig2(function (e) { | 297 | getApp().getConfig2(function (e) { |
| @@ -453,12 +456,13 @@ Page({ | @@ -453,12 +456,13 @@ Page({ | ||
| 453 | 456 | ||
| 454 | }); | 457 | }); |
| 455 | 458 | ||
| 456 | - }, | 459 | + |
| 460 | + }, | ||
| 457 | 461 | ||
| 458 | 462 | ||
| 459 | onReady() { | 463 | onReady() { |
| 460 | - | ||
| 461 | - setTimeout(()=>{ | 464 | + // 用于控制保障服务折叠图标的显示 |
| 465 | + setTimeout(() => { | ||
| 462 | wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => { | 466 | wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => { |
| 463 | 467 | ||
| 464 | if(res.length != 0) { | 468 | if(res.length != 0) { |
| @@ -1037,11 +1041,9 @@ Page({ | @@ -1037,11 +1041,9 @@ Page({ | ||
| 1037 | var th = this; | 1041 | var th = this; |
| 1038 | 1042 | ||
| 1039 | // if(this.data.prom_act.is_shop_buy && this.data.options.prom_type != 1) { | 1043 | // if(this.data.prom_act.is_shop_buy && this.data.options.prom_type != 1) { |
| 1040 | - // if(th.data.is_normal) { | ||
| 1041 | 1044 | ||
| 1042 | - if(t<=0) return false; | ||
| 1043 | - th.setData({goodsInputNum:t}); | ||
| 1044 | - // } else { | 1045 | + if(t == 0) return false; |
| 1046 | + // th.setData({goodsInputNum:t}); | ||
| 1045 | 1047 | ||
| 1046 | if(this.data.options.prom_type == 1 && !this.data.openSpecModal_flash_normal) { | 1048 | if(this.data.options.prom_type == 1 && !this.data.openSpecModal_flash_normal) { |
| 1047 | 1049 | ||
| @@ -1050,7 +1052,7 @@ Page({ | @@ -1050,7 +1052,7 @@ Page({ | ||
| 1050 | 1052 | ||
| 1051 | //--判断商品是否超出限购-- | 1053 | //--判断商品是否超出限购-- |
| 1052 | // if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { | 1054 | // if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { |
| 1053 | - if(!th.data.prom_act.is_shop_buy) { | 1055 | + // if(!th.data.prom_act.is_shop_buy) { |
| 1054 | 1056 | ||
| 1055 | if (th.data.sele_g.viplimited > 0) { | 1057 | if (th.data.sele_g.viplimited > 0) { |
| 1056 | var gd_buy_num = th.data.sele_g.buy_num; | 1058 | var gd_buy_num = th.data.sele_g.buy_num; |
| @@ -1065,9 +1067,9 @@ Page({ | @@ -1065,9 +1067,9 @@ Page({ | ||
| 1065 | th.setData({goodsInputNum: num}) | 1067 | th.setData({goodsInputNum: num}) |
| 1066 | return false; | 1068 | return false; |
| 1067 | } | 1069 | } |
| 1068 | - } | 1070 | + }; |
| 1069 | 1071 | ||
| 1070 | - }; | 1072 | + // }; |
| 1071 | 1073 | ||
| 1072 | 1074 | ||
| 1073 | //如果是普通购买的情况下 | 1075 | //如果是普通购买的情况下 |
| @@ -1105,7 +1107,7 @@ Page({ | @@ -1105,7 +1107,7 @@ Page({ | ||
| 1105 | return false; | 1107 | return false; |
| 1106 | } | 1108 | } |
| 1107 | } | 1109 | } |
| 1108 | - var e = th.data.sele_g.store_count; | 1110 | + var e = th.data.sele_g.goods_num; |
| 1109 | var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 | 1111 | var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 |
| 1110 | if (th.data.sales_rules == 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { | 1112 | if (th.data.sales_rules == 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { |
| 1111 | if (!th.data.def_pick_store) { | 1113 | if (!th.data.def_pick_store) { |
| @@ -3123,7 +3125,7 @@ Page({ | @@ -3123,7 +3125,7 @@ Page({ | ||
| 3123 | isshow: 1, | 3125 | isshow: 1, |
| 3124 | }); | 3126 | }); |
| 3125 | // this.get_sku(os.stoid, this.data.data, gid); | 3127 | // this.get_sku(os.stoid, this.data.data, gid); |
| 3126 | - // this.get_sto(); | 3128 | + this.get_sto(); |
| 3127 | // this.check_is_youhui(gid, 1); | 3129 | // this.check_is_youhui(gid, 1); |
| 3128 | this.data.is_normal = 1; | 3130 | this.data.is_normal = 1; |
| 3129 | }, | 3131 | }, |
| @@ -3155,20 +3157,19 @@ Page({ | @@ -3155,20 +3157,19 @@ Page({ | ||
| 3155 | if (!user_id) user_id = 0; | 3157 | if (!user_id) user_id = 0; |
| 3156 | 3158 | ||
| 3157 | if (prom_type == 1 && prom_id == 0) { | 3159 | if (prom_type == 1 && prom_id == 0) { |
| 3158 | - // this.setData({ | ||
| 3159 | - // prom_type: 0, isshow: 1, | ||
| 3160 | - // }); | ||
| 3161 | - | ||
| 3162 | - // //获取门店 | ||
| 3163 | - // this.get_sto(); | ||
| 3164 | - // this.get_sku(o.stoid, this.data.data, gid); | ||
| 3165 | - // this.check_has_flash(); | ||
| 3166 | - // this.data.is_normal = 1; | ||
| 3167 | - // this.check_is_youhui(gid, 1); | ||
| 3168 | - // return false; | 3160 | + this.setData({ |
| 3161 | + prom_type: 0, isshow: 1, | ||
| 3162 | + }); | ||
| 3163 | + | ||
| 3164 | + //获取门店 | ||
| 3165 | + this.get_sto(); | ||
| 3166 | + // this.get_sku(o.stoid, this.data.data, gid); | ||
| 3167 | + this.check_has_flash(); | ||
| 3168 | + this.data.is_normal = 1; | ||
| 3169 | + // this.check_is_youhui(gid, 1); | ||
| 3170 | + return false; | ||
| 3169 | } | 3171 | } |
| 3170 | 3172 | ||
| 3171 | - //if (prom_type != 3 && prom_type!=0){ | ||
| 3172 | //---判断秒杀---- | 3173 | //---判断秒杀---- |
| 3173 | if (prom_type == 1 && prom_id > 0) { | 3174 | if (prom_type == 1 && prom_id > 0) { |
| 3174 | //-------判断活动是否抢光--------- | 3175 | //-------判断活动是否抢光--------- |
| @@ -3362,51 +3363,81 @@ Page({ | @@ -3362,51 +3363,81 @@ Page({ | ||
| 3362 | 3363 | ||
| 3363 | //-------------获取购买数量的总函数---------------- | 3364 | //-------------获取购买数量的总函数---------------- |
| 3364 | get_buy_num: function (gd, func) { | 3365 | get_buy_num: function (gd, func) { |
| 3365 | - | ||
| 3366 | - var th = this, | ||
| 3367 | - user_id = getApp().globalData.user_id; | ||
| 3368 | - | ||
| 3369 | - | 3366 | + // var map = this.data.g_buy_num, |
| 3367 | + var th = this, | ||
| 3368 | + user_id = getApp().globalData.user_id; | ||
| 3369 | + if (user_id == null) { | ||
| 3370 | + // map.set(gd.goods_id, 0); | ||
| 3371 | + th.setData({ | ||
| 3372 | + // g_buy_num: map, | ||
| 3373 | + prom_buy_num: 0, | ||
| 3374 | + }); | ||
| 3375 | + "function" == typeof func && func(); | ||
| 3376 | + return false; | ||
| 3377 | + } | ||
| 3378 | + | ||
| 3379 | + // if (map.has(gd.goods_id)) { | ||
| 3380 | + // "function" == typeof func && func(); | ||
| 3381 | + // } else { | ||
| 3370 | //----获取商品购买数---- | 3382 | //----获取商品购买数---- |
| 3371 | getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { | 3383 | getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { |
| 3372 | data: { | 3384 | data: { |
| 3373 | store_id: os.stoid, | 3385 | store_id: os.stoid, |
| 3374 | user_id: user_id, | 3386 | user_id: user_id, |
| 3375 | - goods_id: this.data.gid, | 3387 | + goods_id: gd.goods_id |
| 3376 | }, | 3388 | }, |
| 3377 | success: function (t) { | 3389 | success: function (t) { |
| 3378 | if (t.data.code == 0) { | 3390 | if (t.data.code == 0) { |
| 3379 | - var g_buy_num = t.data.data.goodsbuynum; | 3391 | + // var g_buy_num = t.data.data.goodsbuynum; |
| 3380 | 3392 | ||
| 3381 | - // 如果是秒杀的时候 | 3393 | + //如果是秒杀的时候 |
| 3382 | // if (th.data.prom_type == 0 && gd.prom_type == 1) { | 3394 | // if (th.data.prom_type == 0 && gd.prom_type == 1) { |
| 3383 | // gd.prom_type = 0; | 3395 | // gd.prom_type = 0; |
| 3384 | // } | 3396 | // } |
| 3385 | - | ||
| 3386 | - //----获取活动购买数---- | ||
| 3387 | - getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { | ||
| 3388 | - data: { | ||
| 3389 | - store_id: os.stoid, | ||
| 3390 | - user_id: user_id, | ||
| 3391 | - goods_id: th.data.gid, | ||
| 3392 | - prom_type: th.data.prom_type, | ||
| 3393 | - prom_id: th.data.prom_id | ||
| 3394 | - }, | ||
| 3395 | - //-----获取----- | ||
| 3396 | - success: function (tt) { | ||
| 3397 | - if (tt.data.code == 0) { | ||
| 3398 | - th.setData({ | ||
| 3399 | - prom_buy_num: tt.data.data.goodsbuynum, | ||
| 3400 | - }); | ||
| 3401 | - "function" == typeof func && func(); | ||
| 3402 | - } | ||
| 3403 | - } | ||
| 3404 | - }); | ||
| 3405 | - | ||
| 3406 | - | 3397 | + // //如果全场优惠,商品做了秒杀 |
| 3398 | + // if (th.data.prom_type == 3 && gd.prom_type == 1) { | ||
| 3399 | + // gd.prom_type = 0; | ||
| 3400 | + // } | ||
| 3401 | + // //如果全场阶梯优惠,商品做了秒杀 | ||
| 3402 | + // if (th.data.prom_type == 10 && gd.prom_type == 1) { | ||
| 3403 | + // gd.prom_type = 0; | ||
| 3404 | + // } | ||
| 3405 | + | ||
| 3406 | + | ||
| 3407 | + if (th.data.prom_type == 1) { | ||
| 3408 | + //----获取活动购买数---- | ||
| 3409 | + getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { | ||
| 3410 | + data: { | ||
| 3411 | + store_id: os.stoid, | ||
| 3412 | + user_id: user_id, | ||
| 3413 | + goods_id: th.data.options.goods_id, | ||
| 3414 | + prom_type: th.data.options.prom_type, | ||
| 3415 | + prom_id: th.data.options.prom_id | ||
| 3416 | + }, | ||
| 3417 | + //-----获取----- | ||
| 3418 | + success: function (tt) { | ||
| 3419 | + if (tt.data.code == 0) { | ||
| 3420 | + // map.set(gd.goods_id, g_buy_num); | ||
| 3421 | + th.setData({ | ||
| 3422 | + // g_buy_num: map, | ||
| 3423 | + prom_buy_num: tt.data.data.goodsbuynum, | ||
| 3424 | + goodsbuynum: t.data.data.goodsbuynum, | ||
| 3425 | + }); | ||
| 3426 | + "function" == typeof func && func(); | ||
| 3427 | + } | ||
| 3428 | + } | ||
| 3429 | + }); | ||
| 3430 | + } else { | ||
| 3431 | + // map.set(gd.goods_id, g_buy_num); | ||
| 3432 | + // th.setData({ | ||
| 3433 | + // g_buy_num: map | ||
| 3434 | + // }); | ||
| 3435 | + "function" == typeof func && func(); | ||
| 3436 | + }; | ||
| 3407 | } | 3437 | } |
| 3408 | - }, | 3438 | + } |
| 3409 | }); | 3439 | }); |
| 3440 | + // } | ||
| 3410 | }, | 3441 | }, |
| 3411 | 3442 | ||
| 3412 | 3443 | ||
| @@ -4034,6 +4065,7 @@ Page({ | @@ -4034,6 +4065,7 @@ Page({ | ||
| 4034 | 4065 | ||
| 4035 | 4066 | ||
| 4036 | 4067 | ||
| 4068 | + | ||
| 4037 | 4069 | ||
| 4038 | 4070 | ||
| 4039 | 4071 |
packageA/pages/goodsInfo/goodsInfo.wxml
| @@ -90,8 +90,7 @@ | @@ -90,8 +90,7 @@ | ||
| 90 | </view> | 90 | </view> |
| 91 | 91 | ||
| 92 | 92 | ||
| 93 | - <!-- <block> --> | ||
| 94 | - | 93 | + <block> |
| 95 | <view class="goods-price rel"> | 94 | <view class="goods-price rel"> |
| 96 | <view class="co-red" style="overflow: hidden"> | 95 | <view class="co-red" style="overflow: hidden"> |
| 97 | <view class="market-price" style="overflow: hidden"></view> | 96 | <view class="market-price" style="overflow: hidden"></view> |
| @@ -99,22 +98,50 @@ | @@ -99,22 +98,50 @@ | ||
| 99 | 98 | ||
| 100 | <view> | 99 | <view> |
| 101 | <!-- 秒杀价 --> | 100 | <!-- 秒杀价 --> |
| 102 | - <!-- <view class="co-red" wx:if="{{options.prom_type == 1}}"><text class="rel yuan fs28">¥</text>{{filters.toFix(prom_price,2)}}</view> --> | ||
| 103 | - <!-- 手店价 --> | ||
| 104 | <view class="co-red" wx:if="{{options.prom_type == 1}}"><text class="rel yuan fs28">¥</text>{{filters.toFix(prom_price,2)}}</view> | 101 | <view class="co-red" wx:if="{{options.prom_type == 1}}"><text class="rel yuan fs28">¥</text>{{filters.toFix(prom_price,2)}}</view> |
| 102 | + <!-- 手店价 --> | ||
| 105 | <view class="co-red" wx:else><text class="rel yuan fs28">¥</text>{{filters.toFix(data.shop_price,2)}}</view> | 103 | <view class="co-red" wx:else><text class="rel yuan fs28">¥</text>{{filters.toFix(data.shop_price,2)}}</view> |
| 104 | + <!-- <view class="word-line fs20 xc-qtunit-price"> | ||
| 105 | + 零售价¥{{filters.toFix(data.market_price,2)}} | ||
| 106 | + </view> --> | ||
| 106 | <view class="goods-title"> | 107 | <view class="goods-title"> |
| 107 | <view class="goods-name elli">{{data.goods_name}}</view> | 108 | <view class="goods-name elli">{{data.goods_name}}</view> |
| 108 | </view> | 109 | </view> |
| 109 | </view> | 110 | </view> |
| 110 | 111 | ||
| 111 | - <view class="goods-num"> | 112 | + |
| 113 | + <block wx:if="{{prom_type==1}}"> | ||
| 114 | + <view class="goods-num"> | ||
| 115 | + <block wx:if="prom_st>0"> | ||
| 116 | + <view class="stock">总数量:{{prom_act.goods_num+prom_act.virtual}}件</view> | ||
| 117 | + | ||
| 118 | + <view class="stock" wx:if="{{prom_act.buy_limit>0}}">限购:{{prom_act.buy_limit}}件</view> | ||
| 119 | + <view class="stock" wx:else>限购:不限</view> | ||
| 120 | + | ||
| 121 | + <block wx:if="{{prom_st==0}}"> | ||
| 122 | + <view class="sales">已购:0件</view> | ||
| 123 | + </block> | ||
| 124 | + | ||
| 125 | + <block wx:else> | ||
| 126 | + <view class="sales">已购:{{prom_act.buy_num+prom_act.virtual}}件</view> | ||
| 127 | + </block> | ||
| 128 | + </block> | ||
| 129 | + <block wx:else> | ||
| 130 | + <view class="stock">总数量:{{prom_act.goods_num}}件</view> | ||
| 131 | + <view class="stock" wx:if="{{prom_act.buy_limit>0}}">限购:{{prom_act.buy_limit}}件</view> | ||
| 132 | + <view class="stock" wx:else>限购:不限</view> | ||
| 133 | + <view class="sales">已购:{{prom_act.buy_num}}件</view> | ||
| 134 | + </block> | ||
| 135 | + </view> | ||
| 136 | + </block> | ||
| 137 | + | ||
| 138 | + <view class="goods-num" wx:else> | ||
| 112 | <view class="sales">销量:{{data.sales_sum}}</view> | 139 | <view class="sales">销量:{{data.sales_sum}}</view> |
| 113 | <view class="sales">有效天数:{{data.validDays?data.validDays:'不限'}}</view> | 140 | <view class="sales">有效天数:{{data.validDays?data.validDays:'不限'}}</view> |
| 114 | </view> | 141 | </view> |
| 115 | 142 | ||
| 116 | </view> | 143 | </view> |
| 117 | - <!-- </block> --> | 144 | + </block> |
| 118 | 145 | ||
| 119 | 146 | ||
| 120 | 147 | ||
| @@ -187,6 +214,8 @@ | @@ -187,6 +214,8 @@ | ||
| 187 | </view> | 214 | </view> |
| 188 | </view> | 215 | </view> |
| 189 | 216 | ||
| 217 | + | ||
| 218 | + | ||
| 190 | 219 | ||
| 191 | <!-- 保障服务 --> | 220 | <!-- 保障服务 --> |
| 192 | <view class="bz_view flex bdt16 ai_c" wx:if="{{store_config.service_bz}}"> | 221 | <view class="bz_view flex bdt16 ai_c" wx:if="{{store_config.service_bz}}"> |
| @@ -561,7 +590,7 @@ | @@ -561,7 +590,7 @@ | ||
| 561 | <!-- is_shop_buy支持以原价购买 --> | 590 | <!-- is_shop_buy支持以原价购买 --> |
| 562 | <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}"> | 591 | <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}"> |
| 563 | <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view> | 592 | <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view> |
| 564 | - <view class="buy-btn cart-btn lanse">即将开始</view> | 593 | + <view class="buy-btn cart-btn lanse f1">即将开始</view> |
| 565 | </block> | 594 | </block> |
| 566 | <block wx:else> | 595 | <block wx:else> |
| 567 | <view class="buy-btn cart-btn cart-btn-lg lanse set_width f1">即将开始</view> | 596 | <view class="buy-btn cart-btn cart-btn-lg lanse set_width f1">即将开始</view> |