Commit 2f71cbd81fe406f789ee0a794d43e6f697592499
1 parent
d96fb29f
处理0库存的情况
Showing
1 changed file
with
26 additions
and
0 deletions
packageA/pages/goodsInfo/goodsInfo.js
| @@ -980,6 +980,19 @@ Page({ | @@ -980,6 +980,19 @@ Page({ | ||
| 980 | newd['prom_type'] = 0; | 980 | newd['prom_type'] = 0; |
| 981 | newd['prom_price'] = this.data.data.shop_price; | 981 | newd['prom_price'] = this.data.data.shop_price; |
| 982 | }; | 982 | }; |
| 983 | + | ||
| 984 | + // 判断是否为0库存的情况 | ||
| 985 | + var tmpRedisNum = 0; | ||
| 986 | + // 检查redis库存量 | ||
| 987 | + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/1/" + prom_id, {}).then(res => { | ||
| 988 | + if (res.data.code == 0) { | ||
| 989 | + tmpRedisNum = res.data.data; | ||
| 990 | + }; | ||
| 991 | + }); | ||
| 992 | + if(this.data.prom_type == 1 && tmpRedisNum == 0) { | ||
| 993 | + newd['prom_type'] = 0; | ||
| 994 | + newd['prom_price'] = this.data.data.shop_price; | ||
| 995 | + }; | ||
| 983 | 996 | ||
| 984 | // console.log('newd++++++++', newd); | 997 | // console.log('newd++++++++', newd); |
| 985 | th.buyNow(newd); | 998 | th.buyNow(newd); |
| @@ -1011,6 +1024,19 @@ Page({ | @@ -1011,6 +1024,19 @@ Page({ | ||
| 1011 | }; | 1024 | }; |
| 1012 | }; | 1025 | }; |
| 1013 | 1026 | ||
| 1027 | + // 判断是否为0库存的情况 | ||
| 1028 | + var tmpRedisNum = 0; | ||
| 1029 | + // 检查redis库存量 | ||
| 1030 | + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/1/" + prom_id, {}).then(res => { | ||
| 1031 | + if (res.data.code == 0) { | ||
| 1032 | + tmpRedisNum = res.data.data; | ||
| 1033 | + }; | ||
| 1034 | + }); | ||
| 1035 | + if(th.data.options.prom_type == 1 && tmpRedisNum == 0) { | ||
| 1036 | + newd['prom_type'] = 0; | ||
| 1037 | + newd['money'] = th.data.data.shop_price; | ||
| 1038 | + }; | ||
| 1039 | + | ||
| 1014 | //----先看会员在购物车中是否加入了该商品----- | 1040 | //----先看会员在购物车中是否加入了该商品----- |
| 1015 | getApp().request.get("/api/weshop/cartService/page", { | 1041 | getApp().request.get("/api/weshop/cartService/page", { |
| 1016 | data: { | 1042 | data: { |