diff --git a/components/add_purchase/add_purchase.js b/components/add_purchase/add_purchase.js index 66b440f..2e05b59 100644 --- a/components/add_purchase/add_purchase.js +++ b/components/add_purchase/add_purchase.js @@ -3131,7 +3131,8 @@ Component({ data: { store_id: os.stoid, user_id: user_id, - goods_id: gd.goods_id, isnew: 1 + goods_id: gd.goods_id, isnew: 1, + timetype:gd.viplimited_timetype }, success: function (t) { if (t.data.code == 0) { diff --git a/packageA/pages/prom_list/prom_list.js b/packageA/pages/prom_list/prom_list.js index 7e16ca3..dd809a5 100644 --- a/packageA/pages/prom_list/prom_list.js +++ b/packageA/pages/prom_list/prom_list.js @@ -783,7 +783,7 @@ Page({ }); var num= th.data.data.viplimited-gd_buy_num; - if(num<0) num=0; + if(num<=0) num=1 th.setData({goodsInputNum:num}) return false; } @@ -797,7 +797,7 @@ Page({ }); var num=th.data.prom_buy_limit- th.data.prom_buy_num ; - if(num<0) num=0; + if(num<=0) num=1; th.setData({goodsInputNum:num}) return false; } @@ -1472,7 +1472,8 @@ Page({ store_id: os.stoid, user_id: user_id, goods_id: gd.goods_id, - isnew:1 + isnew:1, + timetype:gd.viplimited_timetype }, success: function(t) { if (t.data.code == 0) { diff --git a/packageB/pages/zuhegou/index/index.js b/packageB/pages/zuhegou/index/index.js index 78ada49..184d4e1 100644 --- a/packageB/pages/zuhegou/index/index.js +++ b/packageB/pages/zuhegou/index/index.js @@ -869,7 +869,7 @@ Page({ //开始调用接口 getApp().request.get(url, { data: req_data, - success: function (res) { + success: async function (res) { th.data.loading = 0; th.setData({ is_get: 1 @@ -879,6 +879,16 @@ Page({ var list = th.data.list; if (!list) list = []; + for (let it = 0; it < res.data.data.pageData.length; it++) { + var g_ite=res.data.data.pageData[it]; + //获取单品的现在的活动状态 + var rs_gd=await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + g_ite.goods_id, {}); + if(rs_gd && rs_gd.data.code==0 && rs_gd.data.data){ + g_ite.viplimited_timetype= rs_gd.data.data.viplimited_timetype; + } + + } + //当是下拉刷新的时候 if (th.data.page > 1 && th.data.cart_list) { //下拉之后也要重新计算一下金额 @@ -2392,7 +2402,8 @@ Page({ goods_id: gd.goods_id, prom_type: 7, prom_id: th.data.act.id, - isnew:1 + isnew:1, + timetype:gd.viplimited_timetype }, }).then(res2 => { var g_buy_num = 0; @@ -2887,7 +2898,8 @@ Page({ goods_id: item_j.goods_id, prom_type: 7, prom_id: th.data.act.id, - isnew:1 + isnew:1, + timetype:item_j.viplimited_timetype }, }).then(res2 => { if (res2.data.code == 0) { @@ -2964,7 +2976,8 @@ Page({ goods_id: item_j.goods_id, prom_type: 7, prom_id: th.data.act.id, - isnew:1 + isnew:1, + timetype:item_j.viplimited_timetype }, }).then(res2 => { if (res2.data.code == 0) { diff --git a/packageB/pages/zuhegou/preindex/index.js b/packageB/pages/zuhegou/preindex/index.js index 02b4707..72679d5 100644 --- a/packageB/pages/zuhegou/preindex/index.js +++ b/packageB/pages/zuhegou/preindex/index.js @@ -1745,7 +1745,8 @@ Page({ goods_id: gd.goods_id, prom_type: 7, prom_id: th.data.act.id, - isnew:1 + isnew:1, + timetype:gd.viplimited_timetype }, }).then(res2 => { var g_buy_num = 0; @@ -2122,7 +2123,8 @@ Page({ goods_id: item_j.goods_id, prom_type: 7, prom_id: th.data.act.id, - isnew:1 + isnew:1, + timetype:item_j.viplimited_timetype }, }).then(res2 => { if (res2.data.code == 0) { @@ -2199,7 +2201,8 @@ Page({ goods_id: item_j.goods_id, prom_type: 7, prom_id: th.data.act.id, - isnew:1 + isnew:1, + timetype:item_j.viplimited_timetype }, }).then(res2 => { if (res2.data.code == 0) { diff --git a/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js b/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js index c9efe7d..6a2761a 100644 --- a/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js +++ b/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js @@ -479,7 +479,8 @@ Page({ goods_id: item1.goods_id, prom_type: item1.prom_type, prom_id: item1.prom_id, - isnew:1 + isnew:1, + timetype:item1.viplimited_timetype }, }).then(res => { var buy_num_data = res.data.data; diff --git a/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.js b/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.js index 510a2fa..3bd29f4 100644 --- a/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.js +++ b/packageC/pages/luckyGo/luckyGo_order/luckyGo_order.js @@ -768,6 +768,8 @@ Page({ store_id: os.stoid, user_id: getApp().globalData.user_id, goods_id: good.goods_id, + timetype:good.viplimited_timetype + }; if(b_item.prom_type==7){ req_data.prom_type=7; @@ -839,6 +841,7 @@ Page({ store_id: os.stoid, user_id: getApp().globalData.user_id, goods_id: good.goods_id, + timetype:good.viplimited_timetype }; if(prom){ diff --git a/packageC/pages/payForAnother/payForAnother.js b/packageC/pages/payForAnother/payForAnother.js index cad3426..fc2cd17 100644 --- a/packageC/pages/payForAnother/payForAnother.js +++ b/packageC/pages/payForAnother/payForAnother.js @@ -447,7 +447,8 @@ Page({ goods_id: item1.goods_id, prom_type: item1.prom_type, prom_id: item1.prom_id, - isnew:1 + isnew:1, + timetype:item1.viplimited_timetype }, }).then(res => { var buy_num_data = res.data.data; diff --git a/packageC/pages/presell/cart/cart.js b/packageC/pages/presell/cart/cart.js index c3a4c4e..21530c7 100644 --- a/packageC/pages/presell/cart/cart.js +++ b/packageC/pages/presell/cart/cart.js @@ -3333,7 +3333,8 @@ Page({ goods_id: good.goods_id, prom_type: good.prom_type, prom_id: good.prom_id, - isnew: 1 + isnew: 1, + timetype:good.viplimited_timetype }, }).then(res => { var buy_num_data = res.data.data; diff --git a/packageC/pages/presell/pregoodsInfo/goodsInfo.js b/packageC/pages/presell/pregoodsInfo/goodsInfo.js index 7e2f6ca..7fba225 100644 --- a/packageC/pages/presell/pregoodsInfo/goodsInfo.js +++ b/packageC/pages/presell/pregoodsInfo/goodsInfo.js @@ -2570,7 +2570,8 @@ Page({ store_id: os.stoid, user_id: user_id, goods_id: gd.goods_id, - isnew:1 + isnew:1, + timetype:gd.viplimited_timetype }, success: function (t) { if (t.data.code == 0) { diff --git a/packageD/pages/shop/order_detail/order_detail.js b/packageD/pages/shop/order_detail/order_detail.js index a166134..1509f2f 100644 --- a/packageD/pages/shop/order_detail/order_detail.js +++ b/packageD/pages/shop/order_detail/order_detail.js @@ -341,7 +341,8 @@ Page({ user_id: getApp().globalData.user_id, goods_id: good.goods_id, prom_type: good.prom_type, - prom_id: good.prom_id + prom_id: good.prom_id, + timetype:good.viplimited_timetype }, }).then(res => { var buy_num_data = res.data.data; @@ -1283,6 +1284,7 @@ Page({ store_id: os.stoid, user_id: getApp().globalData.user_id, goods_id: good.goods_id, + timetype:good.viplimited_timetype }; if(b_item.prom_type==7){ req_data.prom_type=7; @@ -1354,6 +1356,7 @@ Page({ store_id: os.stoid, user_id: getApp().globalData.user_id, goods_id: good.goods_id, + timetype:good.viplimited_timetype }; if(prom){ diff --git a/packageG/pages/team/team_show/team_show.js b/packageG/pages/team/team_show/team_show.js index 5100894..af27f9b 100644 --- a/packageG/pages/team/team_show/team_show.js +++ b/packageG/pages/team/team_show/team_show.js @@ -331,13 +331,14 @@ Page({ var user_id=getApp().globalData.user_id; var promgoodsbuynum=0; var goodsbuynum=0; - getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { data: { store_id: os.stoid, user_id: user_id, goods_id: gd.goods_id, - prom_type: gd.prom_type, - prom_id: gd.prom_id, isnew:1 + prom_type: 6, + prom_id: th.data.teamlist.id, isnew:1, + timetype:gd.viplimited_timetype }, }).then(res=>{ @@ -349,15 +350,18 @@ Page({ //先判断限购 if (num+goodsbuynum>gd.viplimited && gd.viplimited>0) { getApp().confirmBox("超出商品限购"); + th.inp_val(gd.viplimited-goodsbuynum); return false; } if (num+promgoodsbuynum>th.data.teamlist.buy_limit && th.data.teamlist.buy_limit>0) { getApp().confirmBox("超出活动限购"); + th.inp_val(th.data.teamlist.buy_limit-promgoodsbuynum); return false; } //判断库存 if ( num>gd.store_count) { getApp().confirmBox("超出商品库存"); + th.inp_val(gd.store_count); return false; } var r_num=0; @@ -372,6 +376,7 @@ Page({ //--判断库存--- if ( num>r_num) { getApp().confirmBox("超出商品库存"); + th.inp_val(r_num); return false; } @@ -380,11 +385,12 @@ Page({ minusStatus: minusStatus, }) + return true; + }, - /*输入框事件*/ - bindManual: function(e) { - var num = e.detail.value; + inp_val(num){ + if(!num || num<1) num=1; var minusStatus = num > 1 ? 'normal' : 'disable'; this.setData({ num: num, @@ -392,6 +398,17 @@ Page({ }) }, + /*输入框事件*/ + bindManual: async function(e) { + var num = e.detail.value; + var minusStatus = num > 1 ? 'normal' : 'disable'; + // this.setData({ + // num: num, + // minusStatus: minusStatus + // }) + this.check_num(num,minusStatus); + }, + //---------------初始化代码---------------- async init(tg_id) { var goods_id = 0, //商品ID, @@ -898,6 +915,10 @@ Page({ //购买前的判断redis async buy_check_redis(func){ + + var ck= await this.check_num(this.data.num,1); + if(!ck) return false; + //获取redis中的数量 var r_num=0,prom_type=6,prom_id=this.data.teamlist.id; await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, {