Commit 6f4760500ca000380a1886840f338b6ef7435a73
1 parent
40d4f298
优惠促销商品限购的,在待支付的时候,要判断商品的限购
Showing
2 changed files
with
60 additions
and
0 deletions
pages/user/order_detail/order_detail.js
@@ -933,6 +933,36 @@ Page({ | @@ -933,6 +933,36 @@ Page({ | ||
933 | yh_check=0; | 933 | yh_check=0; |
934 | } | 934 | } |
935 | } | 935 | } |
936 | + | ||
937 | + //--- 要判断一下优惠促销的商品的限购 --- | ||
938 | + if(yh_check){ | ||
939 | + var pro_gd_limit_num=0; | ||
940 | + var p_limit_rs= await getApp().request.promisePost('/api/weshop/promgoods/getPromGoodsLimitNum',{ | ||
941 | + data:{ | ||
942 | + store_id:os.stoid,goods_id:gg.goods_id,prom_id:gg.prom_id,prom_type:3 | ||
943 | + } | ||
944 | + }) | ||
945 | + if(p_limit_rs && p_limit_rs.data.code==0){ | ||
946 | + pro_gd_limit_num=p_limit_rs.data.data | ||
947 | + } | ||
948 | + //-- 如果有商品限购的时候 -- | ||
949 | + if(pro_gd_limit_num>0){ | ||
950 | + var pro_by_num=0; | ||
951 | + var lrs= { | ||
952 | + store_id: os.stoid,user_id: getApp().globalData.user_id, | ||
953 | + goods_id: gg.goods_id, prom_type: 3, | ||
954 | + prom_id: gg.prom_id, isnew:1 | ||
955 | + }; | ||
956 | + var gd_limit_rs=await getApp().promiseGet('/api/weshop/ordergoods/getUserBuyGoodsNum',{data:lrs}); | ||
957 | + if(gd_limit_rs && gd_limit_rs.data.code==0){ | ||
958 | + pro_by_num=gd_limit_rs.data.data.promgoodsbuynum | ||
959 | + } | ||
960 | + if(pro_gd_limit_num<=pro_by_num){ | ||
961 | + yh_check=0; | ||
962 | + } | ||
963 | + } | ||
964 | + } | ||
965 | + | ||
936 | //-- 优惠促销活动没有超出限购的话 -- | 966 | //-- 优惠促销活动没有超出限购的话 -- |
937 | if(yh_check){ | 967 | if(yh_check){ |
938 | if(!the_yh_map[gg.prom_id]) the_yh_map[gg.prom_id]=[]; | 968 | if(!the_yh_map[gg.prom_id]) the_yh_map[gg.prom_id]=[]; |
pages/user/order_list/order_list.js
@@ -1225,6 +1225,36 @@ Page({ | @@ -1225,6 +1225,36 @@ Page({ | ||
1225 | yh_check=0; | 1225 | yh_check=0; |
1226 | } | 1226 | } |
1227 | } | 1227 | } |
1228 | + | ||
1229 | + //--- 要判断一下优惠促销的商品的限购 --- | ||
1230 | + if(yh_check){ | ||
1231 | + var pro_gd_limit_num=0; | ||
1232 | + var p_limit_rs= await getApp().request.promisePost('/api/weshop/promgoods/getPromGoodsLimitNum',{ | ||
1233 | + data:{ | ||
1234 | + store_id:os.stoid,goods_id:gg.goods_id,prom_id:gg.prom_id,prom_type:3 | ||
1235 | + } | ||
1236 | + }) | ||
1237 | + if(p_limit_rs && p_limit_rs.data.code==0){ | ||
1238 | + pro_gd_limit_num=p_limit_rs.data.data | ||
1239 | + } | ||
1240 | + //-- 如果有商品限购的时候 -- | ||
1241 | + if(pro_gd_limit_num>0){ | ||
1242 | + var pro_by_num=0; | ||
1243 | + var lrs= { | ||
1244 | + store_id: os.stoid,user_id: getApp().globalData.user_id, | ||
1245 | + goods_id: gg.goods_id, prom_type: 3, | ||
1246 | + prom_id: gg.prom_id, isnew:1 | ||
1247 | + }; | ||
1248 | + var gd_limit_rs=await getApp().promiseGet('/api/weshop/ordergoods/getUserBuyGoodsNum',{data:lrs}); | ||
1249 | + if(gd_limit_rs && gd_limit_rs.data.code==0){ | ||
1250 | + pro_by_num=gd_limit_rs.data.data.promgoodsbuynum | ||
1251 | + } | ||
1252 | + if(pro_gd_limit_num<=pro_by_num){ | ||
1253 | + yh_check=0; | ||
1254 | + } | ||
1255 | + } | ||
1256 | + } | ||
1257 | + | ||
1228 | //-- 优惠促销活动没有超出限购的话 -- | 1258 | //-- 优惠促销活动没有超出限购的话 -- |
1229 | if(yh_check){ | 1259 | if(yh_check){ |
1230 | if(!the_yh_map[gg.prom_id]) the_yh_map[gg.prom_id]=[]; | 1260 | if(!the_yh_map[gg.prom_id]) the_yh_map[gg.prom_id]=[]; |