diff --git a/packageB/pages/zuhegou/list/list.js b/packageB/pages/zuhegou/list/list.js index 116d46c..ce87de3 100644 --- a/packageB/pages/zuhegou/list/list.js +++ b/packageB/pages/zuhegou/list/list.js @@ -127,46 +127,26 @@ Page({ if(!this.data.ismore) return false; var e = this,th=e, i = "/api/weshop/prom/zhbuy/page?is_end=0&timetype=1&page=" + e.data.currentPage; - var plist=null,alllist=th.data.goodlist; - if(!alllist) alllist=[]; - - await getApp().request.promiseGet(i, - {isShowLoading:1,data:{store_id:os.stoid,user_id:getApp().globalData.user_id}} - ).then(res=>{ - plist=res.data.data.pageData; - console.log("是什么即将开始",plist); - }); - - if(plist.length<=0) { - + // var plist=null,alllist=th.data.goodlist; + // if(!alllist) alllist=[]; + let {goodlist}=this.data; + const {data:res}=await getApp().request.promiseGet(i,{ + isShowLoading:1, + data:{store_id:os.stoid,user_id:getApp().globalData.user_id} + }) + if(res.code==0 && res.data.pageData.length>0){ + if(res.data.page>1){ + goodlist=goodlist.concat(res.data.pageData) + }else{ + goodlist=res.data.pageData; + } + + }else{ getApp().showWarning("没有更多数据"); th.data.ismore=0; - if(e.data.currentPage==1 && this.data.type==1){ - // setTimeout(function () { - // th.data.ismore=1; - // th.setData({type:0}); - // th.requestSalelist(); - // },1000); - } - return false; } - - //--循环读取接口--- - // for(var i=0;i{ - // if(res.data.code==0){ - // plist[i].status=1; - // if(res.data.data<=0) plist[i].status=3; - // } - // }) - // alllist.push(plist[i]); - // } e.data.currentPage++; - // console.log("秒杀商品列表", alllist); - th.setData({goodlist:plist,isshow:1}); + th.setData({goodlist,isshow:1}); }, onPullDownRefresh: function() { diff --git a/pages/goods/goodsInfo/g_filter.wxs b/pages/goods/goodsInfo/g_filter.wxs index 9b22f57..0809be9 100644 --- a/pages/goods/goodsInfo/g_filter.wxs +++ b/pages/goods/goodsInfo/g_filter.wxs @@ -93,7 +93,8 @@ var g_filters = { //折扣数值处理,小数位数为1时,只显示1位;小数位数为2时,才显示2位; num: function(value) { if(value != 0) { - return parseFloat(value); + var r=value.toFixed(2)+""; + return parseFloat(r); } else { return value.toFixed(0); }; diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 63a297b..1499bcd 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -1072,8 +1072,6 @@ Page({ } }, - - //-- 加入购物的函数 -- add_cart_func_inte: function (t) { var i = getApp().request; @@ -1169,8 +1167,11 @@ Page({ if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); - - th.add_cart_next(e, t, a, o, newd); //立即购买下一步 + var i_canbuy=th.data.prom_act.limitqty-th.data.prom_act.buy_num; + if(i_canbuy 0) { + if((th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) && !th.data.is_normal) { if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { wx.showModal({ title: '提示', @@ -1669,7 +1670,7 @@ Page({ } } - if (th.data.sele_g.prom_type == 1 || th.data.sele_g.prom_type == 6) { + if((th.data.sele_g.prom_type == 1 || th.data.sele_g.prom_type == 6) && !th.data.is_normal) { var redis_num = 0; //------判断活动是否抢光----- await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + @@ -1715,7 +1716,7 @@ Page({ checkCartNum_inte: function (t) { var th = this; this.get_buy_num(this.data.data, async function () { - + ; //--判断商品是否超出限购-- if (th.data.g_buy_num != null && th.data.data.viplimited > 0) { @@ -1764,7 +1765,18 @@ Page({ th.setData({ goodsInputNum: redis_num }) return false; } + } + + //判断积分购库存 + if(!th.data.is_normal && th.data.prom_type==4){ + var i_canbuy=th.data.prom_act.limitqty-th.data.prom_act.buy_num; + if(t>i_canbuy){ + wx.showModal({ + title: '超出商品活动库存', + }); + return false; + } } var e = th.data.sele_g.store_count; @@ -2424,7 +2436,7 @@ Page({ th.setData({ prom_type: goodsinfo.prom_type, prom_price: prom.price, - prom_buy_limit: prom.buy_limit, + prom_buy_limit: prom.buy_limit?prom.buy_limit:(prom.limitvipqty? prom.limitvipqty:0), prom_end_time: prom.end_time, prom_start_time: prom.start_time, prom_st: prom_st, @@ -3606,7 +3618,7 @@ Page({ gd.prom_type= 0; } - if (gd.prom_type == 1 || gd.prom_type == 2 || gd.prom_type == 4 || gd.prom_type == 6) { + if (!th.data.is_normal && ( gd.prom_type == 1 || gd.prom_type == 2 || gd.prom_type == 4 || gd.prom_type == 6)) { //----获取活动购买数---- getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", { data: { @@ -3679,8 +3691,14 @@ Page({ var th = this; var ind = parseInt(e.currentTarget.dataset.it); + //如果是拼单活动的普通购买 if (ind == 1) { + + if(!th.data.is_normal) { + th.data.g_buy_num=new Map(); + } + //如果拼单的sku data是空的,就要先获取一下 if (th.data.sku_g_pt) { th.get_sto(1); @@ -3700,6 +3718,10 @@ Page({ th.check_is_youhui(th.data.gid, 1); } else { + if(th.data.is_normal) { + th.data.g_buy_num=new Map(); + } + //拼单商品从这里进,先判断有没有买过商品, getApp().request.get("/api/weshop/order/page", { data: { @@ -5795,11 +5817,16 @@ Page({ //-- 积分购 -- go_pay_integral: function () { + this.data.g_buy_num = new Map(); this.get_sto(0) this.setData({ openSpecModal_inte: 1, goodsInputNum: 1 }); + + }, //-- 积分购普通购买 -- go_pay_integral_normal: function () { + + this.data.g_buy_num = new Map(); var th = this; if (th.data.sku_g_pt) { this.get_sto(1) diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index 09c23f6..9290e29 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -435,11 +435,12 @@ {{data.goods_name}} - - + + -- 88888 -- + 销量:{{data.sales_sum}}件 - 折扣:{{data.disc}}折 + 折扣:{{g_filters.num(data.disc)}}折 {{categories3[0].num}}人评价 @@ -587,7 +588,7 @@ - +