diff --git a/packageA/pages/details_serviceCard/details_serviceCard.js b/packageA/pages/details_serviceCard/details_serviceCard.js index 2da4ff8..e0b6576 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:加入购物车 @@ -288,17 +288,57 @@ Page({ 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 prom_id = details.list[0].prom_id > 0 ? details.list[0].prom_id : 0; + var card_id = details.list[0].card_id; + var prom_type = details.list[0].prom_type > 0 ? details.list[0].prom_type : 0; + var is_pd_normal = details.list[0].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; + }; + }); + + // 获取限购数 + var user_id = getApp().globalData.user_id; + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id, {}).then(res => { + if (res.data.code == 0) { + limitNum = res.data.data.buy_limit; + } + }); + + var snum = limitNum - boughtNum; + var snum = limitNum - boughtNum; + if (snum <= 0) { + wx.showModal({ + title: '超出限购数量', + }); + return false; + } + + } + //----先看会员在购物车中是否加入了该商品----- - app.request.get("/api/weshop/cartService/page", { + app.request.get("/api/weshop/cartService/page", { data: { store_id: app.globalData.setting.stoid, user_id: this.data.userInfo.user_id, @@ -306,13 +346,30 @@ Page({ pick_id: details.list[0].pickup_id, }, success: function(re) { - //-------如果购物车中有相关的数据--------- if (re.data.data.total > 0) { var item = re.data.data.pageData[0]; + var totalNum = details.list[0].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: details.list[0].qty + item.goods_num, + goods_num: totalNum, money: details.list[0].price, store_id: app.globalData.setting.stoid, }; @@ -321,6 +378,7 @@ Page({ updata['guide_id'] = getApp().globalData.guide_id; updata['guide_type'] = 1; } + getApp().request.put("/api/weshop/cartService/update", { data: updata, success: function(t) { @@ -333,6 +391,8 @@ Page({ // th.closeSpecModal(); } }); + + } else { getApp().request.post("/api/weshop/cartService/save", { diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js index 5294c44..8b46ef0 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,127 +847,96 @@ Page({ return false; }; - // 秒杀活动 - 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 = 0; - await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum?store_id="+os.stoid+"&user_id="+getApp().globalData.user_id+"&card_id="+th.data.options.goods_id+"&prom_type="+th.data.options.prom_type+"&prom_id="+th.data.options.prom_id, { - }).then(res => { - gd_buy_num = !res.data.data.promcardbuynum ? 0 : res.data.data.promcardbuynum; - }); - - - // 检查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; - }; - }); - - - // 有库存的情况下,走秒杀活动流程 否则 走正常购买流程 - // 没有库存,已抢光的情况下,走正常购买流程 - if(redisNum > 0 && !this.data.is_normal) { - // 输入的数量 - var t = th.data.goodsInputNum; - // 获取购物车同款数量 - var cartGoodsNum = 0; - - // 购物车 - if (action != "buy") { - await getApp().request.promiseGet("/api/weshop/cartService/page?store_id="+os.stoid+"&user_id="+oo.user_id+"&service_id="+th.data.data.id, - { }).then(res => { - if (res.data.data.pageData.length > 0) { - const tmpObj = res.data.data.pageData; - - tmpObj.forEach(v => { - cartGoodsNum += parseInt(v.goods_num); - }); - - } - - }); + // 库存 + var redisNums = 0; + // 限购数 + var limitNum = 0; + // 已购买数量 + var boughtNum = 0; + + // 秒杀活动 + 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; + }; - // 输入的数量 + 购物车同款商品的数量 - t = parseInt(t) + parseInt(cartGoodsNum); - } - - // 剩余购买数量 - let num = th.data.sele_g.viplimited - gd_buy_num; - num = num < 0 ? 0 : num; - - if (t > redisNum) { - wx.showToast({ + if(limited > res) { + if(curNum > res) { // t当前增减的数量 + wx.showModal({ title: '超出活动库存', - icon: 'none' - }); - - // 开启限购 - if (th.data.sele_g.viplimited > 0) { - - if (action != "buy") { - if (t > num) { - th.setData({goodsInputNum: num - cartGoodsNum < 0 ? 0 : num - cartGoodsNum}); - } - if (redisNum < num) { - th.setData({goodsInputNum: redisNum - cartGoodsNum < 0 ? 0 : redisNum - cartGoodsNum}); - } - } else { - if (num > redisNum) { - th.setData({goodsInputNum: redisNum}); - } else { - th.setData({goodsInputNum: num}); - } - } - - - - - } else { - th.setData({goodsInputNum: redisNum}); - } - - return false; - } - - // 以下小于等于库存 - if (t <= redisNum) { - if (th.data.sele_g.viplimited > 0) { - - if (t > num) { - wx.showToast({ - title: '超出活动限购数量', - icon: 'none' - }); - - if (num > redisNum) { - th.setData({goodsInputNum: redisNum}); - } else { - th.setData({goodsInputNum: num}); - } - return false; - } - - } - } + }); + th.setData({ + goodsInputNum: res, + }); + return false; + }; + }; - + if(limited <= res) { + if(curNum > limited) { + wx.showModal({ + title: '超出限购数量', + }); + th.setData({ + goodsInputNum: canBuyNum, + }); + return false; + }; + }; + + + }); + + + }; + }); + }; + }; - if(action=="buy"){ // 立即购买 + if(action=="buy"){ //--------------此时操作的数据------------ var newd = { id: th.data.data.id, @@ -1001,30 +958,11 @@ 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 { // 购物车 - - // 购买数量大于0的才能加入到购物车 - if (th.data.goodsInputNum <= 0) { - th.closeSpecModal(); - return false; - } - + } else { + var newd = { service_id: th.data.data.id, service_sn:th.data.data.service_sn, @@ -1050,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", { @@ -1076,10 +1002,33 @@ Page({ //-------如果购物车中有相关的数据--------- if (re.data.data.total > 0) { - var item = re.data.data.pageData[0]; + var item = re.data.data.pageData[0]; + 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; + } else { + totalNum = redisNums; + } + } else { + if (totalNum > snum) + totalNum = snum; + } + } + 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, }; @@ -1106,7 +1055,7 @@ Page({ getApp().my_warnning('加入购物车成功', 1, th, 450); var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; th.setData({ - cartGoodsNum: c_num + cartGoodsNum: totalNum }); th.closeSpecModal(); } @@ -1159,142 +1108,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>limited) { + 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}); - }); + // }); }, @@ -1326,12 +1254,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, }); }, @@ -3288,19 +3214,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); }, @@ -3539,7 +3464,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, @@ -3567,6 +3492,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, + }); + } + } + }); + + + }, + + diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index a39b752..b16ff8e 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -2073,7 +2073,9 @@ Page({ icon: 'none', }); th.setData({[txt]: redis_num}); - await e.doCheckAll(); + t.goods_num = redis_num; + await th.doCheckAll(); + await th.update_cart_ser(t, pitem, item); return false; }; @@ -2114,14 +2116,22 @@ Page({ 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; }; @@ -2138,7 +2148,9 @@ Page({ }); if (num <= 0) num = 1; th.setData({[txt]: num - cartGoodsNum}); - await e.doCheckAll(); + t.goods_num = num - cartGoodsNum; + await th.doCheckAll(); + await th.update_cart_ser(t, pitem, item); return false; };