From 1462382812c82757a1b3a122825091ded944456a Mon Sep 17 00:00:00 2001 From: taiwan Date: Mon, 14 Mar 2022 16:37:07 +0800 Subject: [PATCH] 服务卡项修改 --- packageA/pages/goodsInfo/goodsInfo.js | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------- packageA/pages/goodsInfo/goodsInfo.wxml | 52 +++++++++++++++++++++++++++++++--------------------- 2 files changed, 143 insertions(+), 89 deletions(-) diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js index d604836..cdc2607 100644 --- a/packageA/pages/goodsInfo/goodsInfo.js +++ b/packageA/pages/goodsInfo/goodsInfo.js @@ -884,8 +884,8 @@ Page({ // } //000000 - - if(this.data.options.prom_type == 1 && !this.data.prom_act.is_shop_buy) { + this.data.sele_g.viplimited = this.data.sele_g.buy_limit; + if(this.data.sele_g.viplimited > 0 && !this.data.is_normal && this.data.prom_type == 1) { var t = th.data.goodsInputNum; th.data.sele_g.viplimited = th.data.sele_g.buy_limit; if (th.data.sele_g.viplimited > 0) { @@ -954,7 +954,16 @@ Page({ if(getApp().globalData.guide_id) { newd['guide_id'] = getApp().globalData.guide_id; newd['guide_type']=0; - } + }; + // 秒杀:单独购买的情况下,加入购物车显示的是零售价,否则显示秒杀活动价 + if(th.data.options.prom_type == 1) { + if(th.data.openSpecModal_flash_normal) { + newd['money'] = th.data.data.shop_price; + } else { + newd['money'] = th.data.prom_price; + }; + }; + //----先看会员在购物车中是否加入了该商品----- getApp().request.get("/api/weshop/cartService/page", { @@ -975,6 +984,15 @@ Page({ money: th.data.data.shop_price, store_id: os.stoid, }; + + // 秒杀:单独购买的情况下,加入购物车显示的是零售价,否则显示秒杀活动价 + if(th.data.options.prom_type == 1) { + if(th.data.openSpecModal_flash_normal) { + updata['money'] = th.data.data.shop_price; + } else { + updata['money'] = th.data.prom_price; + }; + }; if (getApp().globalData.guide_id) { updata['guide_id'] = getApp().globalData.guide_id; @@ -1048,7 +1066,7 @@ Page({ if(t == 0) return false; // th.setData({goodsInputNum:t}); - if(this.data.options.prom_type == 1 && !this.data.openSpecModal_flash_normal) { + // if(this.data.options.prom_type == 1 && !this.data.openSpecModal_flash_normal) { this.get_buy_num(this.data.sele_g, async function () { th.data.sele_g.viplimited = th.data.sele_g.buy_limit; @@ -1057,84 +1075,109 @@ Page({ // if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { // if(!th.data.prom_act.is_shop_buy) { - if (th.data.sele_g.viplimited > 0) { - var gd_buy_num = th.data.sele_g.buy_num; + // if (th.data.sele_g.viplimited > 0) { + // var gd_buy_num = th.data.sele_g.buy_num; - if (t + gd_buy_num> th.data.sele_g.viplimited) { - wx.showModal({ - title: '超出商品限购', - }); + // if (t + gd_buy_num> th.data.sele_g.viplimited) { + // wx.showModal({ + // title: '超出商品限购', + // }); - var num = th.data.sele_g.viplimited - gd_buy_num; - if (num <= 0) num = 1; - th.setData({goodsInputNum: num}) - return false; - } - }; + // var num = th.data.sele_g.viplimited - gd_buy_num; + // if (num <= 0) num = 1; + // th.setData({goodsInputNum: num}) + // return false; + // } + // }; - // }; + // 单独购买 + if(th.data.openSpecModal_flash_normal) th.data.is_normal = 1; + + // 秒杀:判断活动是否抢光 + if (th.data.sele_g.prom_type == 1 && !th.data.is_normal) { + var redis_num = 0; + //------判断活动是否抢光----- + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + os.stoid + "/" + th.data.sele_g.prom_type + "/" + th.data.sele_g.prom_id, { + 1: 1 + }).then(res => { + redis_num = res.data.data; + }); + + if (t > redis_num) { + wx.showModal({ + // title: '超出商品活动库存', + title: '来晚了,已被抢光~', + }); + th.setData({goodsInputNum: redis_num}) + return false; + } + }; - //如果是普通购买的情况下 - if(th.data.openSpecModal_flash_normal) th.data.is_normal=1; - - //--判断商品是否超出活动限购-- - if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && !th.data.is_normal) { - if (t + th.data.prom_buy_num > th.data.prom_buy_limit) { - wx.showModal({ - title: '超出商品活动限购', - }); - - var num = th.data.prom_buy_limit - th.data.prom_buy_num; - if (num < 0) num = 0; - th.setData({goodsInputNum: num}) - return false; - } - } + //--秒杀:判断商品是否超出活动限购-- + if (th.data.sele_g.viplimited > 0 && !th.data.is_normal && th.data.prom_type == 1) { + var gd_buy_num = th.data.sele_g.buy_num; + + if (t + gd_buy_num> th.data.sele_g.viplimited) { + wx.showModal({ + title: '超出商品活动限购', + }); + + var num = th.data.sele_g.viplimited - gd_buy_num; + if (num <= 0) num = 1; + th.setData({goodsInputNum: num}) + return false; + } + }; - if (th.data.sele_g.prom_type == 1 && !th.data.is_normal) { - var redis_num = 0; - //------判断活动是否抢光----- - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + - os.stoid + "/" + th.data.sele_g.prom_type + "/" + th.data.sele_g.prom_id, { - 1: 1 - }).then(res => { - redis_num = res.data.data; - }); + //--秒杀:判断商品是否超出活动限购-- + // if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && !th.data.is_normal) { + // if (t + th.data.prom_buy_num > th.data.prom_buy_limit) { + // wx.showModal({ + // title: '超出商品活动限购', + // }); + + // var num = th.data.prom_buy_limit - th.data.prom_buy_num; + // if (num < 0) num = 0; + // th.setData({goodsInputNum: num}) + // return false; + // }; + // }; - if (t > redis_num) { - wx.showModal({ - title: '超出商品活动库存', - }); - th.setData({goodsInputNum: redis_num}) - return false; - } - } - var e = th.data.sele_g.goods_num; + + + + + // var e = th.data.sele_g.goods_num; var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 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)) { if (!th.data.def_pick_store) { wx.showModal({title: '请选择门店',}); return false; } else { - e = th.data.def_pick_store.CanOutQty; + // e = th.data.def_pick_store.CanOutQty; } } - if (!e) e = 0; - //库存不足,不增加 - if (e < t) { - wx.showModal({title: '库存不足',}); - if (e < 0) e = 0; - th.setData({goodsInputNum: e}); - return false; - } - t > e || 0 == e ? t = e : t < 1 && (t = 1); + + // 单独购买时 + if(th.data.openSpecModal_flash_normal && th.data.prom_type == 1) { + // if (!e) e = 0; + // //库存不足,不增加 + // if (e < t) { + // wx.showModal({title: '购买数量不能超出库存',}); + // if (e < 0) e = 0; + // th.setData({goodsInputNum: e}); + // return false; + // }; + // t > e || 0 == e ? t = e : t < 1 && (t = 1); + }; + th.setData({goodsInputNum: t}); - // th.is_show_more_buy(); - + }) - }; + // }; @@ -3386,9 +3429,9 @@ Page({ //----获取商品购买数---- getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { data: { - store_id: os.stoid, - user_id: user_id, - goods_id: gd.goods_id + store_id: os.stoid, + user_id: user_id, + goods_id: gd.goods_id, }, success: function (t) { if (t.data.code == 0) { @@ -3439,7 +3482,8 @@ Page({ "function" == typeof func && func(); }; } - } + }, + }); // } }, diff --git a/packageA/pages/goodsInfo/goodsInfo.wxml b/packageA/pages/goodsInfo/goodsInfo.wxml index 467cbd9..bd74c7d 100644 --- a/packageA/pages/goodsInfo/goodsInfo.wxml +++ b/packageA/pages/goodsInfo/goodsInfo.wxml @@ -16,6 +16,7 @@ - + - - + @@ -110,26 +113,27 @@ - + 总数量:{{prom_act.goods_num+prom_act.virtual}}件 限购:{{prom_act.buy_limit}}件 限购:不限 + 已购:{{prom_act.buy_num+prom_act.virtual}}件 - + - + - + @@ -635,7 +639,10 @@ + + + @@ -650,14 +657,14 @@ + + {{def_pick_store.pickup_name}} - 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} - - + 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} @@ -668,6 +675,9 @@ 更多门店 + + + (库存不足) (库存不足) @@ -722,10 +732,8 @@ 库存不足 - 加入购物车 - + 加入购物车 + {{sele_g.offline_price?"券后购买":"立即购买"}} @@ -745,13 +753,15 @@ {{sele_g.offline_price?"券后购买":"立即购买"}} + - + + -- libgit2 0.21.4