diff --git a/app.js b/app.js index a9b91af..5aa28a8 100644 --- a/app.js +++ b/app.js @@ -671,24 +671,30 @@ App({ //清空登录时候缓存的值 onHide: function () { - if(!this.globalData.no_clear) { - this.globalData.is_test = 0; - this.globalData.guide_id = null; //导购清空 - this.globalData.first_leader = null; //分享的会员清空 - this.globalData.wuliu = null; //关闭要把物流清空 - this.globalData.room_id = null; //关闭要把房间号关闭 - this.globalData.room_goods_id = null; //关闭要把物流清空 - this.globalData.config2 = null; //清除config2的缓存 - this.globalData.config = null; //清除config的缓存 - this.globalData.gr_index = 0; //商品分组的序列 - this.globalData.pk_store = null; - this.globalData.wxapp_buy_obj = null; - this.globalData.dis_buy_obj = null; //等级卡的购买记录 - this.globalData.storeFooter = null; //底部的导航 - this.globalData.full_screen = null; //全屏 - }else{ - this.globalData.no_clear=0; - } + var th=this; + setTimeout(function () { + console.log("app onhide"); + console.log(th.globalData.no_clear); + if(!th.globalData.no_clear) { + th.globalData.is_test = 0; + th.globalData.guide_id = null; //导购清空 + th.globalData.first_leader = null; //分享的会员清空 + th.globalData.wuliu = null; //关闭要把物流清空 + th.globalData.room_id = null; //关闭要把房间号关闭 + th.globalData.room_goods_id = null; //关闭要把物流清空 + th.globalData.config2 = null; //清除config2的缓存 + th.globalData.config = null; //清除config的缓存 + th.globalData.gr_index = 0; //商品分组的序列 + th.globalData.pk_store = null; + th.globalData.wxapp_buy_obj = null; + th.globalData.dis_buy_obj = null; //等级卡的购买记录 + th.globalData.storeFooter = null; //底部的导航 + th.globalData.full_screen = null; //全屏 + }else{ + th.globalData.no_clear=0; + } + },600) + }, clear_word: function (word) { diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js index 5e4814a..cd3f351 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) { @@ -922,7 +926,7 @@ Page({ newd['prom_price'] = this.data.prom_price; }; - if(this.data.prom_act.is_shop_buy) { + if(this.data.prom_act.is_shop_buy&& this.data.prom_r_null == 1) { newd['prom_type'] = 0; newd['prom_price'] = this.data.data.shop_price; }; @@ -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 @@ 单独购买 - 即将开始 + 即将开始 即将开始 diff --git a/pages/cart/cart2/c_filter.wxs b/pages/cart/cart2/c_filter.wxs index 01114fe..630d400 100644 --- a/pages/cart/cart2/c_filter.wxs +++ b/pages/cart/cart2/c_filter.wxs @@ -45,7 +45,7 @@ var filters = { if (ind == 2) return "指定品类"; if (ind == 11) return "指定用途"; if (ind == 12) return "指定分类1"; - if (ind == 13) return "全场通用"; + if (ind == 13) return "自定义"; if (ind == 20) return "指定单品"; return ""; }, diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 7c4b123..9768921 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -382,19 +382,46 @@ Page({ flash_data.forEach(function (val, ind) { if(val.user_price) val.price=val.user_price; - if (val.start_time > nt) flash_data[ind].status = 0; - else if (val.end_time > nt) flash_data[ind].status = 1; - if (val.buy_num >= val.goods_num) flash_data[ind].status = 2; + if (val.start_time > nt) { + flash_data[ind].status = 0; + } else if (val.end_time > nt) { + flash_data[ind].status = 1; + } + + if (val.buy_num >= val.goods_num){ + flash_data[ind].status = 2; + } }); - var arr = new Array(); - //--三个三个一组--- - for (var i = 0; i < flash_data.length; i += 3) { - arr.push(flash_data.slice(i, i + 3)); + var promisies = []; + for (const key in flash_data) { + if (Object.hasOwnProperty.call(flash_data, key)) { + const val = flash_data[key]; + promisies[key] = getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + os.stoid + "/1/" + val.id, + {} + ).then(res => { + if (res.data.code == 0) { + if (res.data.data <= 0) flash_data[key].status = 2; + }; + }); + } } - th.setData({ - saleGoods: arr + + Promise.all(promisies).then((values) => { + var arr = new Array(); + //--三个三个一组--- + for (var i = 0; i < flash_data.length; i += 3) { + arr.push(flash_data.slice(i, i + 3)); + } + + th.setData({ + saleGoods: arr + }); }); + + + } }); @@ -1179,6 +1206,8 @@ Page({ var url=e.currentTarget.dataset.url; getApp().goto(url); }, + +