From c63edec0aa520ab3c92fb675643fc39cbfd51858 Mon Sep 17 00:00:00 2001 From: taiwan Date: Fri, 11 Mar 2022 16:18:16 +0800 Subject: [PATCH] 服务卡秒杀修改 --- packageA/pages/goodsInfo/goodsInfo.js | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------- packageA/pages/goodsInfo/goodsInfo.wxml | 43 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 126 insertions(+), 65 deletions(-) diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js index 5e4814a..4c84cfc 100644 --- a/packageA/pages/goodsInfo/goodsInfo.js +++ b/packageA/pages/goodsInfo/goodsInfo.js @@ -211,6 +211,8 @@ Page({ prom_r_null: 0, hiddenCS: true, //控制客服操作菜单显示和控制 + + openSpecModal_flash_normal: 0, }, //------初始化加载---------- @@ -281,14 +283,15 @@ Page({ } }) } + var c_guide_id=t.c_guide_id; if(c_guide_id){ th.data.c_guide_id=c_guide_id; } - getApp().getConfig(function(e) { - ee.setData({sto_sele_name_1:e.store_name}) - }) + getApp().getConfig(function(e) { + ee.setData({sto_sele_name_1:e.store_name}) + }) //----获取系统参数----- getApp().getConfig2(function (e) { @@ -453,12 +456,13 @@ Page({ }); - }, + + }, onReady() { - - setTimeout(()=>{ + // 用于控制保障服务折叠图标的显示 + setTimeout(() => { wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => { if(res.length != 0) { @@ -1037,11 +1041,9 @@ Page({ var th = this; // if(this.data.prom_act.is_shop_buy && this.data.options.prom_type != 1) { - // if(th.data.is_normal) { - if(t<=0) return false; - th.setData({goodsInputNum:t}); - // } else { + if(t == 0) return false; + // th.setData({goodsInputNum:t}); if(this.data.options.prom_type == 1 && !this.data.openSpecModal_flash_normal) { @@ -1050,7 +1052,7 @@ 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.prom_act.is_shop_buy) { if (th.data.sele_g.viplimited > 0) { var gd_buy_num = th.data.sele_g.buy_num; @@ -1065,9 +1067,9 @@ Page({ th.setData({goodsInputNum: num}) return false; } - } + }; - }; + // }; //如果是普通购买的情况下 @@ -1105,7 +1107,7 @@ Page({ return false; } } - var e = th.data.sele_g.store_count; + 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) { @@ -3123,7 +3125,7 @@ Page({ isshow: 1, }); // this.get_sku(os.stoid, this.data.data, gid); - // this.get_sto(); + this.get_sto(); // this.check_is_youhui(gid, 1); this.data.is_normal = 1; }, @@ -3155,20 +3157,19 @@ Page({ if (!user_id) user_id = 0; if (prom_type == 1 && prom_id == 0) { - // this.setData({ - // prom_type: 0, isshow: 1, - // }); - - // //获取门店 - // this.get_sto(); - // this.get_sku(o.stoid, this.data.data, gid); - // this.check_has_flash(); - // this.data.is_normal = 1; - // this.check_is_youhui(gid, 1); - // return false; + this.setData({ + prom_type: 0, isshow: 1, + }); + + //获取门店 + this.get_sto(); + // this.get_sku(o.stoid, this.data.data, gid); + this.check_has_flash(); + this.data.is_normal = 1; + // this.check_is_youhui(gid, 1); + return false; } - //if (prom_type != 3 && prom_type!=0){ //---判断秒杀---- if (prom_type == 1 && prom_id > 0) { //-------判断活动是否抢光--------- @@ -3362,51 +3363,81 @@ Page({ //-------------获取购买数量的总函数---------------- get_buy_num: function (gd, func) { - - var th = this, - user_id = getApp().globalData.user_id; - - + // var map = this.data.g_buy_num, + var th = this, + user_id = getApp().globalData.user_id; + if (user_id == null) { + // map.set(gd.goods_id, 0); + th.setData({ + // g_buy_num: map, + prom_buy_num: 0, + }); + "function" == typeof func && func(); + return false; + } + + // if (map.has(gd.goods_id)) { + // "function" == typeof func && func(); + // } else { //----获取商品购买数---- getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { data: { store_id: os.stoid, user_id: user_id, - goods_id: this.data.gid, + goods_id: gd.goods_id }, success: function (t) { if (t.data.code == 0) { - var g_buy_num = t.data.data.goodsbuynum; + // var g_buy_num = t.data.data.goodsbuynum; - // 如果是秒杀的时候 + //如果是秒杀的时候 // if (th.data.prom_type == 0 && gd.prom_type == 1) { // gd.prom_type = 0; // } - - //----获取活动购买数---- - getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { - data: { - store_id: os.stoid, - user_id: user_id, - goods_id: th.data.gid, - prom_type: th.data.prom_type, - prom_id: th.data.prom_id - }, - //-----获取----- - success: function (tt) { - if (tt.data.code == 0) { - th.setData({ - prom_buy_num: tt.data.data.goodsbuynum, - }); - "function" == typeof func && func(); - } - } - }); - - + // //如果全场优惠,商品做了秒杀 + // if (th.data.prom_type == 3 && gd.prom_type == 1) { + // gd.prom_type = 0; + // } + // //如果全场阶梯优惠,商品做了秒杀 + // if (th.data.prom_type == 10 && gd.prom_type == 1) { + // gd.prom_type = 0; + // } + + + if (th.data.prom_type == 1) { + //----获取活动购买数---- + getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { + data: { + store_id: os.stoid, + user_id: user_id, + goods_id: th.data.options.goods_id, + prom_type: th.data.options.prom_type, + prom_id: th.data.options.prom_id + }, + //-----获取----- + success: function (tt) { + if (tt.data.code == 0) { + // map.set(gd.goods_id, g_buy_num); + th.setData({ + // g_buy_num: map, + prom_buy_num: tt.data.data.goodsbuynum, + goodsbuynum: t.data.data.goodsbuynum, + }); + "function" == typeof func && func(); + } + } + }); + } else { + // map.set(gd.goods_id, g_buy_num); + // th.setData({ + // g_buy_num: map + // }); + "function" == typeof func && func(); + }; } - }, + } }); + // } }, @@ -4034,6 +4065,7 @@ Page({ + diff --git a/packageA/pages/goodsInfo/goodsInfo.wxml b/packageA/pages/goodsInfo/goodsInfo.wxml index 64b0378..8bf7b0f 100644 --- a/packageA/pages/goodsInfo/goodsInfo.wxml +++ b/packageA/pages/goodsInfo/goodsInfo.wxml @@ -90,8 +90,7 @@ - - + @@ -99,22 +98,50 @@ - - {{filters.toFix(prom_price,2)}} + {{filters.toFix(data.shop_price,2)}} + {{data.goods_name}} - + + + + + 总数量:{{prom_act.goods_num+prom_act.virtual}}件 + + 限购:{{prom_act.buy_limit}}件 + 限购:不限 + + + 已购:0件 + + + + 已购:{{prom_act.buy_num+prom_act.virtual}}件 + + + + 总数量:{{prom_act.goods_num}}件 + 限购:{{prom_act.buy_limit}}件 + 限购:不限 + 已购:{{prom_act.buy_num}}件 + + + + + 销量:{{data.sales_sum}} 有效天数:{{data.validDays?data.validDays:'不限'}} - + @@ -187,6 +214,8 @@ + + @@ -561,7 +590,7 @@ 单独购买 - 即将开始 + 即将开始 即将开始 -- libgit2 0.21.4