diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml index 80bc77c..01807e8 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml @@ -15,7 +15,7 @@ ¥ {{sele_g[card_field]}} - ¥ {{sele_g.shop_price}} + ¥ {{sele_g.market_price}} ¥ {{prom_price || filters.div100(luckGoInfo.group_price)}} @@ -195,7 +195,7 @@ 库存不足 - 立即购买 + 立即购买 @@ -212,7 +212,7 @@ 配送不匹配 - 确定 + 确定 diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index c8b4439..26fffe7 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js @@ -303,7 +303,7 @@ Page({ prom_id, }); } - console.log('type********>>',this.data.prom_type); + // console.log('type********>>',this.data.prom_type); //-- 自定义海报 -- // getApp().request.promiseGet("/api/weshop/goods/poster/page", { // data: { store_id: os.stoid, type: 1, is_use: 1 } @@ -448,7 +448,6 @@ Page({ var user = getApp().globalData.userInfo; if (!user) return false; clearInterval(ti); - if (user.card_field && user['card_expiredate']) { var str = user['card_expiredate'].replace(/-/g, '/'); var end = new Date(str); @@ -1198,18 +1197,20 @@ Page({ open_ind_store: ind }); //如果是秒杀的话,要看redis够不够 - if (this.data.prom_type == 1) { - this.getactLen(function (num) { - if (num < th.data.goodsInputNum) { - getApp().my_warnning("秒杀库存不足!", 0, th); - return false; - } else { - th.add_cart_func(t); - } - }); - } else { - th.add_cart_func(t); - } + // if (this.data.prom_type == 1) { + // this.getactLen(function (num) { + // if (num < th.data.goodsInputNum) { + // getApp().my_warnning("秒杀库存不足!", 0, th); + // return false; + // } else { + // th.add_cart_func(t); + // } + // }); + // } else { + // th.add_cart_func(t); + // } + + th.add_cart_func(t); }, @@ -1662,13 +1663,13 @@ Page({ switch (condition_t) { case 0: //按钱 if (newd.goods_price >= condition_t) { - newd.prom_type = 3; + newd.prom_type = 9; newd.prom_id = prom_d[i].prom_id; } break case 1://按购买数量 if (newd.goods_num >= condition_t) { - newd.prom_type = 3; + newd.prom_type = 9; newd.prom_id = prom_d[i].prom_id; } break; @@ -1707,6 +1708,7 @@ Page({ // this.data.shippingCost < 0 || this.data.select.stock <= 0 || (Object.assign(e, { // action: "buy_now" // }), + var th = this; this.setData({ openSpecModal: 0, openSpecModal_inte: 0, @@ -1714,34 +1716,42 @@ Page({ openSpecModal_pt: 0, }) - if (e.prom_type == 9) { - s.set_b_now(e); - var url = "/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id; - getApp().goto(url); - } else { + // if (e.prom_type == 9) { + // s.set_b_now(e); + // // var url = ''; + // var url = "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id; + // getApp().goto(url); + // } else + + // if(e.prom_type == 9){ + if(true){ //要判断积分购的普通购买有没有参加优惠活动 - if (e.is_integral_normal == 1) { + if (e.is_normal == 1) { this.check_nor_promgood(e.goods_id, function (res) { if (res && res.cat_id) { - e.prom_type = 3; - e.prom_id = res.cat_id + e.prom_type = 0; + e.prom_id = res.cat_id; } s.set_b_now(e); /*-- wx.redirectTo({ url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id, });--*/ - getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id) + + console.log('11111111111111111111111111======》'); + getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id); + // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&group_id=" + th.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + th.data.luckGoInfo.lc_alert); }) } else { - // console.log('xxxxxxxxxxxxx======》', this.data.prom_id); - s.set_b_now(e); + //console.log('222222222222222222222222222222======》'); + //s.set_b_now(e); /*-- wx.redirectTo({ url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id, });--*/ - getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&group_id=" + this.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + this.data.luckGoInfo.lc_alert); + //getApp().goto("/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&goods_id=" + e.goods_id) + // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&group_id=" + this.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + this.data.luckGoInfo.lc_alert); } } @@ -3756,6 +3766,9 @@ Page({ var th = this; var ind = parseInt(e.currentTarget.dataset.ind); + + console.log('当前ind========>>>>', ind); + //ind == 1是普通购买 if (ind == 1) { //如果拼单的sku data是空的,就要先获取一下 @@ -3845,18 +3858,17 @@ Page({ //-----------------拼单生成方法--------------------- addCart_pt: function () { - var th = this; if (this.data.is_normal == 0) { //看一下有没有起购数,如果有起购数,要计算起购数 - var qnum = parseFloat(th.data.prom_act.minbuynum); - if (qnum > 0 && th.data.goodsInputNum < qnum) { - getApp().confirmBox("拼团商品至少要买" + qnum + "件!"); - return false; - } + // var qnum = parseFloat(th.data.prom_act.minbuynum); + // if (qnum > 0 && th.data.goodsInputNum < qnum) { + // getApp().confirmBox("拼团商品至少要买" + qnum + "件!"); + // return false; + // } - th.addcart_pt_func(); + this.addcart_pt_func(); } else { - th.addcart_pt_func(); + this.addcart_pt_func(); } }, @@ -3868,73 +3880,75 @@ Page({ var e = this, th = e, o = this.data.sele_g; - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); + // if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); //----------添加到购物车时,要判断限购数量,-------- e.get_buy_num(o, async function (ee) { //---判断商品是否超出限购--- - if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { - if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { - wx.showModal({ - title: '提示', - content: '超出商品限购' - }); - - 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.g_buy_num != null && th.data.sele_g.viplimited > 0) { + // if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { + // wx.showModal({ + // title: '提示', + // content: '超出商品限购' + // }); + + // 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.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) { - if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { - wx.showModal({ - title: '提示', - content: '超出商品活动限购' - }); - - 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.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) { + // if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { + // wx.showModal({ + // title: '提示', + // content: '超出商品活动限购' + // }); + + // var num = th.data.prom_buy_limit - th.data.prom_buy_num; + // if (num < 0) num = 0; + // th.setData({ goodsInputNum: num }) + // return false; + // } + // } var redis_num = 0 //不是普通购买的时候 - if (th.data.is_normal != 1) { - //-------判断活动是否抢光--------- - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/6/" + th.data.sele_g.prom_id, { - 1: 1 - }).then(res => { - redis_num = res.data.data; - }) - - if (th.data.goodsInputNum > redis_num) { - wx.showModal({ - title: '提示', - content: '超出商品活动库存' - }); + // if (th.data.is_normal != 1) { + // //-------判断活动是否抢光--------- + // await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/6/" + th.data.sele_g.prom_id, { + // 1: 1 + // }).then(res => { + // redis_num = res.data.data; + // }) + + // if (th.data.goodsInputNum > redis_num) { + // wx.showModal({ + // title: '提示', + // content: '超出商品活动库存' + // }); + + // th.setData({ goodsInputNum: redis_num }) + + // return false; + // } + // } - th.setData({ goodsInputNum: redis_num }) - - return false; - } - } - - if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); - if (th.data.goodsInputNum > o.store_count) { - th.setData({ goodsInputNum: o.store_count }) - return s.my_warnning("超出商品库存", 0, th); - } + // if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); + // if (th.data.goodsInputNum > o.store_count) { + // th.setData({ goodsInputNum: o.store_count }) + // return s.my_warnning("超出商品库存", 0, th); + // } if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) this.setData({ sto_sele_name: "" }); if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); + //--------------此时操作的数据------------ var newd = { goods_id: o.goods_id, @@ -4006,10 +4020,12 @@ Page({ th.data.sto_sele_distr = 1; } - } else if (th.data.prom_type == 3) { - newd.prom_type = 0; - newd.prom_id = 0; } + + // else if (th.data.prom_type == 3) { + // newd.prom_type = 0; + // newd.prom_id = 0; + // } newd['pick_name'] = th.data.sto_sele_name; newd['pick_dis'] = th.data.sto_sele_distr; @@ -4020,20 +4036,24 @@ Page({ //判断一下有没有全局优惠活动 th.check_nor_promgood(newd.goods_id, function (e) { if (e && e.act_id) { - newd['prom_type'] = 3; + newd['prom_type'] = 0; newd['prom_id'] = e.act_id; } - th.buyNow(newd) - }) + console.log('aaaaa'); + th.buyNow(newd); + }); } - else th.buyNow_pt(newd); + else { + console.log('bbbb'); + th.buyNow_pt(newd); + }; }) }, //----------立即购买_pt----------- buyNow_pt: function (e) { s.set_b_now(e); wx.navigateTo({ - url: "/packageC/pages/luckyGo_cart/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id, + url: "/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&goods_id=" + e.goods_id, }); },