diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index 532967a..206902f 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -12,7 +12,6 @@ Component({ lifetimes: { attached: function() { - var th=this; getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ var dis=rs.data.data; @@ -99,7 +98,7 @@ Component({ //设置自定义页面的列表 set_list:function(data){ var itemList = data.data; - itemList = JSON.parse(itemList); + itemList = JSON.parse(itemList); this.setData({ list:itemList, backgroundColor: data.bkcolor, diff --git a/packageA/pages/cart2_ser/cart2_ser.js b/packageA/pages/cart2_ser/cart2_ser.js index 2d0351e..9e6f702 100644 --- a/packageA/pages/cart2_ser/cart2_ser.js +++ b/packageA/pages/cart2_ser/cart2_ser.js @@ -477,16 +477,34 @@ Page({ getApp().showWarning("未找到门店"); return false; } - var goods = { - 'card_id': gg.service_id, - 'itemid': gg.erpItemID, - 'qty': gg.goods_num, - 'price': gg.money, - 'pickup_id': gg.pick_id, - 'pickup_keyid': list[i].keyid, - 'prom_type': gg.prom_type, //促销活动类型 - 'prom_id': gg.prom_id, //促销活动id - }; + + + if (gg.prom_type == 1 && gg.is_pd_normal == 0) { + // 秒杀活动购买 + var goods = { + 'card_id': gg.service_id, + 'itemid': gg.erpItemID, + 'qty': gg.goods_num, + 'price': gg.money, + 'pickup_id': gg.pick_id, + 'pickup_keyid': list[i].keyid, + 'prom_type': gg.prom_type, //促销活动类型 + 'prom_id': gg.prom_id, //促销活动id + }; + } else { + // 普通购买 + var goods = { + 'card_id': gg.service_id, + 'itemid': gg.erpItemID, + 'qty': gg.goods_num, + 'price': gg.money, + 'pickup_id': gg.pick_id, + 'pickup_keyid': list[i].keyid, + }; + } + + + //--导购分享过来的id-- if (gg.guide_id) { goods.guide_id = gg.guide_id; diff --git a/packageA/pages/details_serviceCard/details_serviceCard.js b/packageA/pages/details_serviceCard/details_serviceCard.js index 2da4ff8..58d8e54 100644 --- a/packageA/pages/details_serviceCard/details_serviceCard.js +++ b/packageA/pages/details_serviceCard/details_serviceCard.js @@ -228,7 +228,7 @@ Page({ // 再来一单 - buy2(t) { + buy2: async function(t) { let details = this.data.details; var th = this; var ind = 1; // 1:加入购物车 @@ -236,7 +236,7 @@ Page({ // var action= t.currentTarget.dataset.action; var action = 'add'; // // if(!ind) ind = t.currentTarget.dataset.openspecmodal_ind; - + var user_id = getApp().globalData.user_id; th.setData({ open_ind_store: ind }); @@ -261,95 +261,172 @@ Page({ // th.buyNow(newd); } else { - var newd = { - // service_id: th.data.data.id, - // service_sn:th.data.data.service_sn, - // service_name:th.data.data.goods_name, - // goods_num: th.data.goodsInputNum, - // pick_id: th.data.sto_sele_id, - // user_id:oo.user_id, - // store_id:os.stoid, - // money:th.data.data.shop_price, - - service_id: details.list[0].card_id, - service_sn: details.list[0].service_sn, - service_name: details.list[0].service_name, - goods_num: details.list[0].qty, - pick_id: details.list[0].pickup_id, - user_id: this.data.userInfo.user_id, - store_id: app.globalData.setting.stoid, - money: details.list[0].price, - }; - if (getApp().globalData.guide_id) { - newd['guide_id'] = getApp().globalData.guide_id; - newd['guide_type'] = 0; - }; - // 秒杀:单独购买的情况下,加入购物车显示的是零售价,否则显示秒杀活动价 - if(details.list[0].prom_type == 1) { - newd['prom_type'] = details.list[0].prom_type; - newd['prom_id'] = details.list[0].prom_id; - // if(th.data.openSpecModal_flash_normal) { - // newd['money'] = th.data.data.shop_price; - // newd['is_pd_normal'] = 1; - // } else { - // newd['money'] = th.data.prom_price; - // }; - }; - + var len = details.list.length; + // 底导航购物车红点显示的数量 + var c_num = 0; + // 多商品 + for (let i = 0; i < len; i++) { + + var newd = { + // service_id: th.data.data.id, + // service_sn:th.data.data.service_sn, + // service_name:th.data.data.goods_name, + // goods_num: th.data.goodsInputNum, + // pick_id: th.data.sto_sele_id, + // user_id:oo.user_id, + // store_id:os.stoid, + // money:th.data.data.shop_price, + + service_id: details.list[i].card_id, + service_sn: details.list[i].service_sn, + service_name: details.list[i].service_name, + goods_num: details.list[i].qty, + pick_id: details.list[i].pickup_id, + user_id: user_id, + store_id: app.globalData.setting.stoid, + money: details.list[i].price, + }; + if (getApp().globalData.guide_id) { + newd['guide_id'] = getApp().globalData.guide_id; + newd['guide_type'] = 0; + }; + // 秒杀:单独购买的情况下,加入购物车显示的是零售价,否则显示秒杀活动价 + if(details.list[i].prom_type == 1) { + newd['prom_type'] = details.list[i].prom_type; + newd['prom_id'] = details.list[i].prom_id; + }; - //----先看会员在购物车中是否加入了该商品----- - app.request.get("/api/weshop/cartService/page", { - data: { - store_id: app.globalData.setting.stoid, - user_id: this.data.userInfo.user_id, - service_id: details.list[0].card_id, - pick_id: details.list[0].pickup_id, - }, - success: function(re) { - - //-------如果购物车中有相关的数据--------- - if (re.data.data.total > 0) { - var item = re.data.data.pageData[0]; - var updata = { - id: item.id, - goods_num: details.list[0].qty + item.goods_num, - money: details.list[0].price, - store_id: app.globalData.setting.stoid, - }; + var prom_id = details.list[i].prom_id > 0 ? details.list[i].prom_id : 0; + var card_id = details.list[i].card_id; + var prom_type = details.list[i].prom_type > 0 ? details.list[i].prom_type : 0; + var is_pd_normal = details.list[i].is_pd_normal; + // 库存 + var redisNums = 0; + // 限购数 + var limitNum = 0; + // 已购买数量 + var boughtNum = 0; + + // 秒杀活动中购买 + if (prom_type == 1 && !is_pd_normal) { + + // 获取已购数量 + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum?store_id="+os.stoid+"&user_id="+getApp().globalData.user_id+"&card_id="+card_id+"&prom_type="+prom_type+"&prom_id="+prom_id, { + }).then(res => { + boughtNum = !res.data.data.promcardbuynum ? 0 : res.data.data.promcardbuynum; + }); + + // 获取库存 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/1/" + prom_id, {}).then(res => { + if (res.data.code == 0) { + redisNums = !res.data.data ? 0 : res.data.data; + }; + }); - if (getApp().globalData.guide_id) { - updata['guide_id'] = getApp().globalData.guide_id; - updata['guide_type'] = 1; - } - getApp().request.put("/api/weshop/cartService/update", { - data: updata, - success: function(t) { - // getApp().my_warnning('加入购物车成功', 1, th, 450); - var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; - th.setData({ - cartGoodsNum: c_num + // 获取限购数 + var is_end = 1; + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id, {}).then(res => { + if (res.data.code == 0) { + is_end = res.data.data.is_end; + limitNum = res.data.data.buy_limit; + } + }); + // 判断活动是否结束 + if (is_end == 1) { + wx.showModal({ + title: details.list[i].service_name + '\n\t活动已经结束', }); - app.goto('/pages/cart/cart/cart'); - // th.closeSpecModal(); + return false; } - }); - } else { - getApp().request.post("/api/weshop/cartService/save", { - data: newd, - success: function(t) { - // getApp().my_warnning('加入购物车成功', 1, th, 450); - var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; - th.setData({ - cartGoodsNum: c_num + + var snum = limitNum - boughtNum; + if (snum <= 0) { + wx.showModal({ + title: '超出活动限购数量', + }); + return false; + } + + } + + + //----先看会员在购物车中是否加入了该商品----- + app.request.get("/api/weshop/cartService/page", { + data: { + store_id: app.globalData.setting.stoid, + user_id: user_id, + service_id: details.list[i].card_id, + pick_id: details.list[i].pickup_id, + }, + success: function(re) { + //-------如果购物车中有相关的数据--------- + if (re.data.data.total > 0) { + var item = re.data.data.pageData[0]; + var totalNum = details.list[i].qty + item.goods_num; + + if (prom_type == 1 && !is_pd_normal) { + // 秒杀购物车购买 修正数量 剩余购买数量 + var snum = limitNum - boughtNum; + + if (totalNum >= redisNums){ + if (redisNums > snum) { + totalNum = snum; + } else { + totalNum = redisNums; + } + } else { + if (totalNum > snum) + totalNum = snum; + } + } + + var updata = { + id: item.id, + goods_num: totalNum, + money: details.list[i].price, + store_id: app.globalData.setting.stoid, + }; + + if (getApp().globalData.guide_id) { + updata['guide_id'] = getApp().globalData.guide_id; + updata['guide_type'] = 1; + } + + getApp().request.put("/api/weshop/cartService/update", { + data: updata, + success: function(t) { + // getApp().my_warnning('加入购物车成功', 1, th, 450); + c_num += th.data.cartGoodsNum + th.data.goodsInputNum; + th.setData({ + cartGoodsNum: c_num + }); + + // th.closeSpecModal(); + } + }); + + + } else { + + getApp().request.post("/api/weshop/cartService/save", { + data: newd, + success: function(t) { + // getApp().my_warnning('加入购物车成功', 1, th, 450); + c_num += th.data.cartGoodsNum + th.data.goodsInputNum; + th.setData({ + cartGoodsNum: c_num + }); + + // th.closeSpecModal(); + } }); - app.goto('/pages/cart/cart/cart'); - // th.closeSpecModal(); } - }); - } - } - }); + } + }); + + } + app.goto('/pages/cart/cart/cart'); } }, diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js index 7435a37..328caf6 100644 --- a/packageA/pages/goodsInfo/goodsInfo.js +++ b/packageA/pages/goodsInfo/goodsInfo.js @@ -447,7 +447,7 @@ Page({ sto_sele_name: e.pickup_name, sto_sele_id: e.pickup_id, sto_sele_distr: e.distr_type, - sto_sele_keyid:e.keyid, + sto_sele_keyid:e.keyid, }) } } @@ -562,6 +562,9 @@ Page({ // <---- 秒杀 + + + @@ -826,21 +829,7 @@ Page({ }); }, - //获取redis中的数量 - async getactLen(func) { - var r_num = 0, - prom_type = this.data.prom_type, - prom_id = this.data.prom_id; - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { - 1: 1 - }).then(res => { - var em = res; - if (em.data.code == 0) { - r_num = em.data.data; - } - }) - func(r_num); - }, + //------------加入购物车-------------- addCart: async function(t) { @@ -848,8 +837,7 @@ Page({ var ind = t.currentTarget.dataset.openSpecModal_ind; var action= t.currentTarget.dataset.action; if(!ind) ind = t.currentTarget.dataset.openspecmodal_ind; - // 活动ID - var prom_id = th.data.prom_id; + th.setData({ open_ind_store: ind }); @@ -859,145 +847,96 @@ Page({ return false; }; + // 库存 + var redisNums = 0; + // 限购数 + var limitNum = 0; + // 已购买数量 + var boughtNum = 0; - if(this.data.prom_type == 1) { - - this.data.sele_g.viplimited = this.data.sele_g.buy_limit; - - // 每人限购数 - th.data.sele_g.viplimited = th.data.sele_g.buy_limit; - - // 已经付款的单数 - var gd_buy_num = !th.data.sele_g.buy_num ? 0 : th.data.sele_g.buy_num; - - // 检查redis库存量 - var redisNum = 0; - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/1/" + prom_id, {}).then(res => { - if (res.data.code == 0) { - redisNum = !res.data.data ? 0 : res.data.data; - }; - }); - - // 获取购物车同款数量 判断是否超库存 - var cartGoodsNum = 0; - await getApp().request.promiseGet("/api/weshop/cartService/page?store_id="+os.stoid+"&user_id="+oo.user_id+"&service_id="+th.data.data.id+"&pick_id="+th.data.sto_sele_id, - { }).then(res => { - if (res.data.data.pageData.length > 0) { - const tmpObj = res.data.data.pageData[0]; - cartGoodsNum = !tmpObj.goods_num ? 0 : tmpObj.goods_num; - } - - }); - - // 有库存的情况下,走秒杀活动流程 否则 走正常购买流程 - // 没有库存,已抢光的情况下,走正常购买流程 - if(redisNum > 0 && !this.data.is_normal) { - // 输入的数量 - var t = th.data.goodsInputNum; - - if (t > redisNum) { - wx.showToast({ + // 秒杀活动 + if(this.data.prom_type == 1) { + // 如果是秒杀活动下的单独购买,is_normal为1 + if(this.data.openSpecModal_flash_normal) this.data.is_normal = 1; + + if(!this.data.is_normal) {// 秒杀购买 + + // 获取redis当前可以购买的数量 + // 如果数量为0,设置和显示已抢光 + // 否则,进一步判断是否超出限购或超出库存 + await this.getactLen().then(async function(res) { + redisNums = res; + let curNum = th.data.goodsInputNum; + // res: redis可购买数量 + console.log('当前可以购买的数量:', res); + if(res <= 0) { + // 可购买数量<=0, 设置和显示已抢光 + th.setData({ + prom_r_null: 1, + }); + wx.showModal({ + title: '超出活动库存', + }); + return false; + } else { + // 可购买数量>0 + // 计算自己还可以购买的数量 + // 自己还可购买的数量c = 每人活动限购数量a - 自己已经购买的数量b + // 如果限购数量a>redis可购买数量d,当增加数量t>d, 提示超出库存 + // 如果限购数量a<=redis可购买数量d, 当增加数量t>a,提示超出限购 + let actInfo = th.data.sele_g; + await th.get_buy_num2().then(function (data) { + let limited = actInfo.buy_limit; // 限购数量a + let promcardbuynum = data.data.data.promcardbuynum; + let buyedNum = promcardbuynum; // 自己已经购买的数量b + let canBuyNum = limited - buyedNum; // 自己还可购买的数量c + limitNum = limited; + boughtNum = buyedNum; + + if(canBuyNum <= 0) { + canBuyNum = 0; + }; + + if(canBuyNum > res) { + if(curNum > res) { // t当前增减的数量 + wx.showModal({ title: '超出活动库存', - icon: 'none' - }); - - // 开启限购 - if (th.data.sele_g.viplimited > 0) { - - let num = th.data.sele_g.viplimited - gd_buy_num; - if (action !="buy") { - // 购物车 - if (num > redisNum) { - th.setData({goodsInputNum: redisNum - cartGoodsNum < 0 ? 0 : redisNum - cartGoodsNum}); - } else { - th.setData({goodsInputNum: num - cartGoodsNum < 0 ? 0 : num - cartGoodsNum}); - } - } else { - // 立即购买 - if (num > redisNum) { - th.setData({goodsInputNum: redisNum}); - } else { - th.setData({goodsInputNum: num}); - } - } - - - } else { - th.setData({goodsInputNum: redisNum}); - } - - return false; - } - + }); + th.setData({ + goodsInputNum: res, + }); + return false; + }; + }; - - // 跳过<立即购买> 购物车 - if (action !="buy") { - - // 输入的数量 + 购物车同款商品的数量 - var maxNum = parseInt(t) + parseInt(cartGoodsNum); - - // 是否开启个人限购 - if (th.data.sele_g.viplimited > 0) { - - if (maxNum + gd_buy_num > th.data.sele_g.buy_limit) { - wx.showToast({ - title: '超出活动限购数量', - icon: 'none' - }); - - // 可购买数量 - let num = th.data.sele_g.viplimited - gd_buy_num - cartGoodsNum; - th.setData({goodsInputNum: num}); - return false; - } - - } - - if (maxNum > redisNum) { - wx.showToast({ - title: '超出活动库存', - icon: 'none' + if(canBuyNum <= res) { + if(curNum > canBuyNum) { + wx.showModal({ + title: '超出限购数量', + }); + th.setData({ + goodsInputNum: canBuyNum, }); - // 可购买数量 - let num = redisNum - cartGoodsNum; - th.setData({goodsInputNum: num}); return false; - } - - } else { - // 以下为立即购买 - // 是否开启个人限购 - if (th.data.sele_g.viplimited > 0) { - - if (t + gd_buy_num > th.data.sele_g.viplimited) { - wx.showToast({ - title: '超出活动限购数量', - icon: 'none' - }); - - let num = th.data.sele_g.viplimited - gd_buy_num; - if (num > redisNum) { - th.setData({goodsInputNum: redisNum}); - } else { - th.setData({goodsInputNum: num}); - } - return false; - } - - }; - - } - + }; + + + }); + + + }; + }); + }; + }; - if(action=="buy"){ // 立即购买 + if(action=="buy"){ //--------------此时操作的数据------------ var newd = { id: th.data.data.id, @@ -1019,23 +958,10 @@ Page({ newd['prom_type'] = 0; newd['prom_price'] = this.data.data.shop_price; }; - - // 判断是否为0库存的情况 - var tmpRedisNum = 0; - // 检查redis库存量 - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/1/" + prom_id, {}).then(res => { - if (res.data.code == 0) { - tmpRedisNum = res.data.data; - }; - }); - if(this.data.prom_type == 1 && tmpRedisNum == 0) { - newd['prom_type'] = 0; - newd['prom_price'] = this.data.data.shop_price; - }; // console.log('newd++++++++', newd); th.buyNow(newd); - } else { // 购物车 + } else { var newd = { service_id: th.data.data.id, @@ -1062,19 +988,7 @@ Page({ newd['money'] = th.data.prom_price; }; }; - - // 判断是否为0库存的情况 - var tmpRedisNum = 0; - // 检查redis库存量 - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/1/" + prom_id, {}).then(res => { - if (res.data.code == 0) { - tmpRedisNum = res.data.data; - }; - }); - if(th.data.options.prom_type == 1 && tmpRedisNum == 0) { - newd['prom_type'] = 0; - newd['money'] = th.data.data.shop_price; - }; + //----先看会员在购物车中是否加入了该商品----- getApp().request.get("/api/weshop/cartService/page", { @@ -1082,16 +996,92 @@ Page({ store_id: os.stoid, user_id: oo.user_id, service_id: th.data.data.id, - pick_id: th.data.sto_sele_id, }, success: function(re) { - - //-------如果购物车中有相关的数据--------- + //-------如果购物车中有相关的数据--------- if (re.data.data.total > 0) { - var item = re.data.data.pageData[0]; + var item = null; + // 多门店问题 + var cartGoodsNum = 0; + const tmpObj = re.data.data.pageData; + for (let i = 0; i < tmpObj.length; i++) { + if (th.data.sto_sele_id != tmpObj[i].pick_id) { + cartGoodsNum += parseInt(tmpObj[i].goods_num); + } else { + item = tmpObj[i]; + } + } + // 当前门店同类商品还没加入到购物车 但是有其他门店的同类商品 + if (th.data.prom_type == 1 && !th.data.is_normal && !item) { + + // 秒杀购物车购买 修正数量 + var snum = limitNum - boughtNum; + if (snum <= 0) { + wx.showModal({ + title: '超出限购数量', + }); + return false; + } + + var cSnum = snum- cartGoodsNum <= 0 ? 0 : snum- cartGoodsNum; + var cRedisNums = redisNums- cartGoodsNum <= 0 ? 0 : redisNums- cartGoodsNum; + + if (newd['goods_num'] >= redisNums){ + if (redisNums > snum) { + newd['goods_num'] = cSnum; + } else { + newd['goods_num'] = cRedisNums; + } + } else { + if (newd['goods_num'] > snum) newd['goods_num'] = cSnum; + } + + if (newd['goods_num'] <= 0) { + getApp().my_warnning('加入购物车成功', 1, th, 450); + th.closeSpecModal(); + return false; + } + getApp().request.post("/api/weshop/cartService/save", { + data: newd, + success: function(t) { + getApp().my_warnning('加入购物车成功', 1, th, 450); + var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; + th.setData({ + cartGoodsNum: c_num + }); + th.closeSpecModal(); + } + }); + return false; + } + + // 以下为当前门店同类商品已经加入到购物车 + var totalNum = th.data.goodsInputNum + item.goods_num; + + // 秒杀购物车购买 修正数量 + if (th.data.prom_type == 1 && !th.data.is_normal) { + var snum = limitNum - boughtNum; + if (snum <= 0) { + wx.showModal({ + title: '超出限购数量', + }); + return false; + } + if (totalNum >= redisNums){ + if (redisNums > snum) { + totalNum = snum- cartGoodsNum; + } else { + totalNum = redisNums- cartGoodsNum; + } + } else { + if (totalNum > snum) + totalNum = snum- cartGoodsNum; + } + } + var updata = { id: item.id, - goods_num: th.data.goodsInputNum + item.goods_num, + goods_num: totalNum, money: th.data.data.shop_price, store_id: os.stoid, }; @@ -1124,7 +1114,6 @@ Page({ } }); } else { - getApp().request.post("/api/weshop/cartService/save", { data: newd, success: function(t) { @@ -1171,142 +1160,121 @@ Page({ }, //------检查数量是不是超出限购------ - checkCartNum: function(t) { + checkCartNum: async function(t) { + var th = this; - if(this.data.prom_type != 1) { - this.setData({goodsInputNum: t}); - return false; + if(!th.data.def_pick_store) { + wx.showModal({title: '请选择门店',}); + return false; }; - var th = this; - - // if(this.data.prom_act.is_shop_buy && this.data.options.prom_type != 1) { - - if(t == 0) return false; - // th.setData({goodsInputNum:t}); + // 非秒杀活动 + if(this.data.prom_type != 1) { + this.setData({ + goodsInputNum: t, + }); + }; - // 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; - - //--判断商品是否超出限购-- - // 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 (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.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(this.data.prom_type == 1) { + // 如果是秒杀活动下的单独购买,is_normal为1 + if(this.data.openSpecModal_flash_normal) this.data.is_normal = 1; + + if(this.data.is_normal) {// 单独购买 + this.setData({ + goodsInputNum: t, + }); + } else {// 秒杀购买 + + // 获取redis当前可以购买的数量 + // 如果数量为0,设置和显示已抢光 + // 否则,进一步判断是否超出限购或超出库存 + await this.getactLen().then(async function(res) { + // res: redis可购买数量 + console.log('当前可以购买的数量:', res); + if(res <= 0) { + // 可购买数量<=0, 设置和显示已抢光 + th.setData({ + prom_r_null: 1, + }); + } else { + // 可购买数量>0 + // 计算自己还可以购买的数量 + // 自己还可购买的数量c = 每人活动限购数量a - 自己已经购买的数量b + // 如果限购数量a>redis可购买数量d,当增加数量t>d, 提示超出库存 + // 如果限购数量a<=redis可购买数量d, 当增加数量t>a,提示超出限购 + let actInfo = th.data.sele_g; + await th.get_buy_num2().then(function (data) { + let limited = actInfo.buy_limit; // 限购数量a + let promcardbuynum = data.data.data.promcardbuynum; + let buyedNum = promcardbuynum; // 自己已经购买的数量b + let canBuyNum = limited - buyedNum; // 自己还可购买的数量c + + if(canBuyNum <= 0) { + canBuyNum = 0; + }; + + if(limited > res) { + if(t > res) { // t当前增减的数量 + wx.showModal({ + title: '超出活动库存', }); - - if (t > redis_num) { - wx.showToast({ - // title: '超出商品活动库存', - title: '超出活动库存', - icon: 'none', - }); - th.setData({goodsInputNum: redis_num}) - return false; - } + th.setData({ + goodsInputNum: res, + }); + return false; }; - - //--秒杀:判断商品是否超出活动限购-- - if (th.data.sele_g.viplimited > 0 && !th.data.is_normal && th.data.prom_type == 1) { - var gd_buy_num = th.data.promcardbuynum; - - // 如果限购数量>活动库存数量,增加数量时会先超过库存数量,此时应该提示“超出活动库存”; - // 如果限购数量<=活动库存数量,增加数量时会先超过限购数量,此时应提示“超出活动限购数量” - if(th.data.sele_g.viplimited > th.data.sele_g.goods_num) { - - // 计算还可以购买的数量:库存量 - 已购数 - var num = th.data.sele_g.goods_num - gd_buy_num; - if(num < 0) num = 0; - if(t > num) { - wx.showToast({ - title: '超出活动库存', - icon: 'none', - }); - - th.setData({goodsInputNum: num}) - return false; - - }; - - } else { - if ((t + gd_buy_num> th.data.sele_g.viplimited) && (t<=th.data.sele_g.goods_num)) { - wx.showToast({ - title: '超出活动限购数量', - icon: 'none', - }); - - var num = th.data.sele_g.viplimited - gd_buy_num; - if (num <= 0) num = 1; - th.setData({goodsInputNum: num}) - return false; - }; - }; - - - + }; + + if(limited <= res) { + if(t>canBuyNum) { + wx.showModal({ + title: '超出限购数量', + }); + th.setData({ + goodsInputNum: canBuyNum, + }); + return false; }; - - //--秒杀:判断商品是否超出活动限购-- - // 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: '超出商品活动限购', - // }); + }; + + th.setData({ + goodsInputNum: t, + }); + }); + }; + }); - // var num = th.data.prom_buy_limit - th.data.prom_buy_num; - // if (num < 0) num = 0; - // th.setData({goodsInputNum: num}) - // return false; - // }; - // }; + } + + + }; + + + + + + // 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; - } - } - - th.setData({goodsInputNum: t}); + // 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; + // } + // } + + + // th.setData({goodsInputNum: t}); - }); + // }); }, @@ -1338,12 +1306,10 @@ Page({ return false; } - var ind = t.currentTarget.dataset.ind; - + var ind = t.currentTarget.dataset.ind; this.setData({ openSpecModal: !0, - openSpecModal_ind: ind, - goodsInputNum: 1, + openSpecModal_ind: ind, }); }, @@ -3300,19 +3266,18 @@ Page({ //获取redis中的数量 - async getactLen(func) { - var r_num = 0, - prom_type = this.data.prom_type, - prom_id = this.data.prom_id; - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { + async getactLen() { + let prom_type = this.data.options.prom_type; + let prom_id = this.data.options.prom_id; + return await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, { 1: 1 }).then(res => { - var em = res; - if (em.data.code == 0) { - r_num = em.data.data; - } + if (res.data.code == 0) { + // 当前可以购买的数量 + let r_num = res.data.data; + return r_num; + }; }) - func(r_num); }, @@ -3551,7 +3516,7 @@ Page({ //----获取商品购买数---- if (th.data.prom_type == 1) { //----获取活动购买数---- - getApp().request.get("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { + getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { data: { store_id: os.stoid, user_id: user_id, @@ -3579,6 +3544,49 @@ Page({ }, + get_buy_num2: async function () { + // 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; + // } + + + //----获取商品购买数---- + + //----获取活动购买数---- + return await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { + data: { + store_id: os.stoid, + user_id: user_id, + card_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, + promcardbuynum: tt.data.data.promcardbuynum, + cardbuynum: tt.data.data.cardbuynum, + }); + } + } + }); + + + }, + + @@ -3619,6 +3627,17 @@ Page({ //-- 秒杀的普通购买 -- openSpecModel_Nor: function () { + + // 是否授权登陆 + var user_info = getApp().globalData.userInfo; + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + wx.navigateTo({ + url: '/pages/togoin/togoin', + }) + return false; + } + + this.data.g_buy_num = new Map(); var th = this; this.setData({open_ind_store: 5, goodsInputNum: 1});//拼团直接给4 diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 51ecbfe..b16ff8e 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -1079,9 +1079,10 @@ Page({ if (a = isNaN(t.detail.value) || t.detail.value < 1 ? 1 : parseInt(t.detail.value)) { var s = { goods_num: a, - goods_id: e.goods_id, + goods_id: e.service_id, id: e.id, store_id: oo.stoid, + is_pd_normal: e.is_pd_normal }; if(e.prom_type) { s.prom_type = e.prom_type; @@ -1102,7 +1103,7 @@ Page({ addNum_ser: function (t) { if (!this.data.is_load) return false; if (this.data.up_dating == 1) return false; - this.data.up_dating = 1; + // this.data.up_dating = 1; var a = t.currentTarget.dataset.item; var b = t.currentTarget.dataset.pitems; @@ -1113,6 +1114,7 @@ Page({ id: a.id, goods_id: a.service_id, store_id: oo.stoid, + is_pd_normal: a.is_pd_normal }; if(a.prom_type) { e.prom_type = a.prom_type; @@ -1134,7 +1136,7 @@ Page({ if (!this.data.is_load) return false; if (this.data.up_dating == 1) return false; - this.data.up_dating = 1; + // this.data.up_dating = 1; var a = t.currentTarget.dataset.item; var b = t.currentTarget.dataset.pitems; @@ -1150,9 +1152,11 @@ Page({ var e = { goods_num: a.goods_num - 1, id: a.id, - goods_id: a.goods_id, - store_id: oo.stoid + goods_id: a.service_id, + store_id: oo.stoid, + is_pd_normal: a.is_pd_normal }; + this.postCardList_ser(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems); } }, @@ -2025,104 +2029,139 @@ Page({ e.setData({ [txt]: t.goods_num }); - - - if(t.prom_type == 1) { - var txt = "service_data[" + pitem + "].goods[" + item + "].goods_num"; - var redis_num = 0; - - //------判断活动是否抢光----- - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + - t.store_id + "/" + t.prom_type + "/" + t.prom_id, { - 1: 1 - }).then(res => { - redis_num = res.data.data; - }); - - // 检测库存 - if(redis_num == 0) { - wx.showToast({ - title: '超出活动库存', - icon: 'none', - }); - th.setData({[txt]: redis_num}); - await e.doCheckAll(); - return false; - }; - var buylimit = 0 - await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + t.store_id + "/" + getApp().globalData.user_id + "/" + t.prom_id, { + // 1.秒杀活动 + // 2.活动开始 + if(t.prom_type == 1 && t.is_pd_normal == 0) { + var txt = "service_data[" + pitem + "].goods[" + item + "].goods_num"; + var redis_num = 0; + + // 获取其他门店,同类商品的数量 + var cartGoodsNum = 0; + await getApp().request.promiseGet("/api/weshop/cartService/page?store_id="+t.store_id+"&user_id="+getApp().globalData.user_id+"&service_id="+t.goods_id, + { }).then(res => { + if (res.data.data.pageData.length > 0) { + const tmpObj = res.data.data.pageData; + tmpObj.forEach(v => { + if (t.id != v.id) { + cartGoodsNum += parseInt(v.goods_num); + } - }).then(res => { - if(res.data.code == 0) { - - th.data.sele_g = res.data.data; - th.data.sele_g.viplimited = res.data.data.buy_limit; - buylimit = !res.data.data.buy_limit ? 0 : res.data.data.buy_limit; - }; }); + } + }); + // 当前商品数量包括其他门店 + var totalNum = 0 + if (cartGoodsNum > 0) { + totalNum = t.goods_num + cartGoodsNum; + } else { + totalNum = t.goods_num; + } - //----获取用户活动购买数---- - var gd_buy_num = 0; - await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum?store_id="+t.store_id+"&user_id="+getApp().globalData.user_id+"&card_id="+t.goods_id+"&prom_type="+t.prom_type+"&prom_id="+t.prom_id, { - }).then(tt => { - if (tt.data.code == 0) { - gd_buy_num = !tt.data.promcardbuynum ? 0 : tt.data.promcardbuynum; - th.setData({ - promcardbuynum: !tt.data.promcardbuynum ? 0 : tt.data.promcardbuynum, - cardbuynum: tt.data.data.cardbuynum, - }); - }; + //获取当前商品活动库存 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + + t.store_id + "/" + t.prom_type + "/" + t.prom_id, { + 1: 1 + }).then(res => { + redis_num = res.data.data; + }); + + // 检测库存 + if(redis_num == 0) { + wx.showToast({ + title: '超出活动库存', + icon: 'none', + }); + th.setData({[txt]: redis_num}); + t.goods_num = redis_num; + await th.doCheckAll(); + await th.update_cart_ser(t, pitem, item); + return false; + }; + + // 限购数量 + var buylimit = 0 + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + t.store_id + "/" + getApp().globalData.user_id + "/" + t.prom_id, { + + }).then(res => { + if(res.data.code == 0) { + th.data.sele_g = res.data.data; + th.data.sele_g.viplimited = res.data.data.buy_limit; + buylimit = !res.data.data.buy_limit ? 0 : res.data.data.buy_limit; + }; + }); + + //用户已经成功付款购买的数量 + var gd_buy_num = 0; + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum?store_id="+t.store_id+"&user_id="+getApp().globalData.user_id+"&card_id="+t.card_id+"&prom_type="+t.prom_type+"&prom_id="+t.prom_id, { + }).then(tt => { + if (tt.data.code == 0) { + gd_buy_num = !tt.data.data.promcardbuynum ? 0 : tt.data.data.promcardbuynum; + th.setData({ + promcardbuynum: !tt.data.data.promcardbuynum ? 0 : tt.data.data.promcardbuynum, + cardbuynum: tt.data.data.cardbuynum, }); + }; + }); - - + // 剩余购买数 + let num = buylimit - gd_buy_num; - if(t.goods_num > redis_num) { - wx.showToast({ - title: '超出活动库存', - icon: 'none', - }); - // 开启限购 - if (buylimit > 0) { - let num = buylimit - gd_buy_num; - if (num > redis_num) { - th.setData({[txt]: redis_num}); - } else { - th.setData({[txt]: num}); - } - } else { - th.setData({[txt]: redis_num}); - } + if(totalNum > redis_num) { + wx.showToast({ + title: '超出活动库存', + icon: 'none', + }); + // 开启限购 + if (buylimit > 0) { + if (num > redis_num) { + th.setData({[txt]: redis_num-cartGoodsNum}); + t.goods_num = redis_num-cartGoodsNum; + await th.doCheckAll(); + await th.update_cart_ser(t, pitem, item); + } else { + th.setData({[txt]: num - cartGoodsNum}); + t.goods_num = num - cartGoodsNum; + await th.doCheckAll(); + await th.update_cart_ser(t, pitem, item); + } + } else { + th.setData({[txt]: redis_num - cartGoodsNum}); + t.goods_num = redis_num - cartGoodsNum; + await th.doCheckAll(); + await th.update_cart_ser(t, pitem, item); + } - await e.doCheckAll(); - return false; - }; + return false; + }; + + //--秒杀:判断商品是否超出活动限购-- + if (buylimit > 0) { + + // 如果限购数量<=活动库存数量,增加数量时会先超过限购数量,此时应提示“超出活动限购数量” + if(totalNum > num) { + // 计算还可以购买的数量:库存量 - 已购数 + wx.showToast({ + title: '超出活动限购', + icon: 'none', + }); + if (num <= 0) num = 1; + th.setData({[txt]: num - cartGoodsNum}); + t.goods_num = num - cartGoodsNum; + await th.doCheckAll(); + await th.update_cart_ser(t, pitem, item); + return false; + }; - //--秒杀:判断商品是否超出活动限购-- - if (buylimit > 0) { - - // 如果限购数量<=活动库存数量,增加数量时会先超过限购数量,此时应提示“超出活动限购数量” - if(t.goods_num + gd_buy_num > buylimit) { - // 计算还可以购买的数量:库存量 - 已购数 - wx.showToast({ - title: '超出活动限购', - icon: 'none', - }); - let num = buylimit - gd_buy_num; - if (num <= 0) num = 1; - th.setData({[txt]: num}); - await e.doCheckAll(); - return false; - }; - - } - - - } - await e.doCheckAll(); - await e.update_cart_ser(t, pitem, item); + } + + + } + + + await e.doCheckAll(); + await e.update_cart_ser(t, pitem, item); }, @@ -2336,7 +2375,6 @@ Page({ update_cart_ser: function (t, pitem, item) { var e = this; - console.log('t===>', t); getApp().request.put("/api/weshop/cartService/update", { data: t, success: async function (ee) { diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index ac11b9e..3300684 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -3855,15 +3855,20 @@ Page({ if (prom_pt_json) { for (let oj in prom_pt_json) { let item_j = prom_pt_json[oj]; - //要对一下阶梯优惠促销的功能 if (item_j.ladder_prom_id) { - //看一下要不要限制使用优惠券 if (th.data.ladder_map[item_j.ladder_prom_id] && th.data.ladder_map[item_j.ladder_prom_id].is_usecoupon) { continue; } - + cut_price += parseFloat(item_j.dis); + } + //要对一下组合购促销的功能 + if (item_j.zhprom_id) { + //看一下要不要限制使用优惠券 + if (th.data.zhhe_act_map[item_j.zhprom_id] && th.data.zhhe_act_map[item_j.zhprom_id].is_xz_yh) { + continue; + } cut_price += parseFloat(item_j.dis); } } diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index a5695bc..d041c64 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -490,61 +490,8 @@ - - - - - - - 选择门店 - - 更多门店 - - - - - {{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.fulladdress}} - - - - - - - 领券 - - - - - 满{{item.condition}}减{{item.money}} - - - - - - - - - + + - @@ -664,7 +610,61 @@ - + + + + 领券 + + + + + 满{{item.condition}}减{{item.money}} + + + + + + + + + + + + + + + + 选择门店 + + 更多门店 + + + + + {{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.fulladdress}} + + + @@ -676,7 +676,6 @@ - diff --git a/pages/goods/search/g_filter.wxs b/pages/goods/search/g_filter.wxs index 7b575ba..605179a 100644 --- a/pages/goods/search/g_filter.wxs +++ b/pages/goods/search/g_filter.wxs @@ -1,108 +1,105 @@ var g_filters = { - //-- 判断是不是有等级价 -- - is_has_rank:function(rank_switch,item){ - if(!rank_switch) return false; - if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true} - return false; - }, - - //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- - get_card_price:function(goods,all_card,type){ - var price1=parseFloat(goods['cardprice1']); - var price2=parseFloat(goods['cardprice2']); - var price3=parseFloat(goods['cardprice3']); - if(!all_card){ - if(type==0) return 0; - return ""; - } - - var arr=[]; - var min_price= 0; - var min_name=""; - - var min_price=null; - var min_name=null; - //---设置对应的价格名字---- - for(var i=0;i<3;i++) { - var vl=all_card[i]; - if(!vl) continue; - if(vl['CorrPrice']=="Price1" && price1>0) - { - if(min_price==null) { - min_price=price1;min_name=vl['CardName']; - } - else if(price10) - { - if(min_price==null) { - min_price=price2;min_name=vl['CardName']; - } - else if(price20) - { - if(min_price==null) { - min_price=price3;min_name=vl['CardName']; - } - else if(price37 ) min_name=min_name.substring(0, 8); - return min_name; - }, + //-- 判断是不是有等级价 -- + is_has_rank: function (rank_switch, item) { + if (!rank_switch) return false; + if (item.cardprice1 || item.cardprice2 || item.cardprice3) { return true } + return false; + }, + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- + get_card_price: function (goods, all_card, type) { + var price1 = parseFloat(goods['cardprice1']); + var price2 = parseFloat(goods['cardprice2']); + var price3 = parseFloat(goods['cardprice3']); + if (!all_card) { + if (type == 0) return 0; + return ""; + } - get_goods_url:function(item){ + var arr = []; + var min_price = 0; + var min_name = ""; - var url1="/pages/goods/goodsInfo/goodsInfo?goods_id="+item.goods_id - // 预售活动 - if(item.prom_type==8){ - url1="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id - } - // 如果是幸运购活动商品 - if(item.prom_type == 9){ - url1 = "/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=" + item.goods_id + "&group_id=" + item.prom_id - } - - if(item.prom_type==1 && item.prom_id>0){ - url1="/pages/goods/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id+"&prom_type=1"; - } - return url1; - } + var min_price = null; + var min_name = null; + //---设置对应的价格名字---- + for (var i = 0; i < 3; i++) { + var vl = all_card[i]; + if (!vl) continue; + if (vl['CorrPrice'] == "Price1" && price1 > 0) { + if (min_price == null) { + min_price = price1; min_name = vl['CardName']; + } + else if (price1 < min_price) { + min_price = price1; min_name = vl['CardName']; + } + } + if (vl['CorrPrice'] == "Price2" && price2 > 0) { + if (min_price == null) { + min_price = price2; min_name = vl['CardName']; + } + else if (price2 < min_price) { + min_price = price2; min_name = vl['CardName']; + } + } + + if (vl['CorrPrice'] == "Price3" && price3 > 0) { + if (min_price == null) { + min_price = price3; min_name = vl['CardName']; + } + else if (price3 < min_price) { + min_price = price3; min_name = vl['CardName']; + } + } + + } + if (min_price == null) { + if (type == 0) return 0; + return ""; + } + + //if(type==0) return arr.length; + //--进行排序,升序--- + /*--- + arr.sort(function(a,b){ + if (a.price < b.price) { + return -1; + } else if (a.fee == b.fee) { + return 0; + } else { + return 1; + } + })--*/ + //-- 获取最下价钱,和相应的卡的名称 -- + //min_price=min.price; + //min_name=min.name; + if (type == 0) return min_price.toFixed(2); + if (min_name.length > 7) min_name = min_name.substring(0, 8); + return min_name; + }, + + + get_goods_url: function (item) { + + var url1 = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + item.goods_id + // 预售活动 + if (item.prom_type == 8) { + url1 = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + item.goods_id + "&prom_id=" + item.prom_id + } + // 如果是幸运购活动商品 + if (item.prom_type == 9) { + url1 = "/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=" + item.goods_id + "&group_id=" + item.prom_id + } + + if (item.prom_type == 1 && item.prom_id > 0) { + url1 = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + item.goods_id + "&prom_id=" + item.prom_id + "&prom_type=1"; + } + return url1; + } } module.exports = { - is_has_rank:g_filters.is_has_rank, - get_card_price:g_filters.get_card_price, - get_goods_url:g_filters.get_goods_url + is_has_rank: g_filters.is_has_rank, + get_card_price: g_filters.get_card_price, + get_goods_url: g_filters.get_goods_url } \ No newline at end of file diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 72f8320..03fc98f 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -525,7 +525,6 @@ Page({ backgroundColor: temp_data.top_color, // 必写项 }) } - } }) diff --git a/pages/user/address_list/address_list.js b/pages/user/address_list/address_list.js index e9d8e0e..fd4f77f 100644 --- a/pages/user/address_list/address_list.js +++ b/pages/user/address_list/address_list.js @@ -56,10 +56,8 @@ Page({ var arr1 = e.data.addresses; var arr2 = t.data.data.pageData; var arr3 = [...arr1, ...arr2]; - var ismore = 0; if (arr3.length == t.data.data.total) ismore = 1 - e.setData({ addresses: arr3, total: t.data.data.total, ismore: ismore, is_address_read:1 diff --git a/pages/user/address_list/address_list.wxml b/pages/user/address_list/address_list.wxml index 363b580..5e667d8 100644 --- a/pages/user/address_list/address_list.wxml +++ b/pages/user/address_list/address_list.wxml @@ -32,7 +32,7 @@ - +