Commit b661d29e076fee34cf77f236c5440dfefe3b48fc
1 parent
f3c2a294
购物车控制指定门店销售
Showing
1 changed file
with
24 additions
and
0 deletions
pages/cart/cart/cart.js
| @@ -797,6 +797,30 @@ Page({ | @@ -797,6 +797,30 @@ Page({ | ||
| 797 | continue; | 797 | continue; |
| 798 | } | 798 | } |
| 799 | 799 | ||
| 800 | + //把活动写入 | ||
| 801 | + item.prom=prom; | ||
| 802 | + | ||
| 803 | + //判断团购的限购 | ||
| 804 | + if (item.goods_num + promgoodsbuynum > prom.buy_limit && prom.buy_limit > 0) { | ||
| 805 | + var cbuy = prom.buy_limit - promgoodsbuynum; | ||
| 806 | + if (cbuy <= 0) { | ||
| 807 | + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
| 808 | + // a.delete(url, {}); | ||
| 809 | + th.disInvalid(item, 2); | ||
| 810 | + continue; | ||
| 811 | + } | ||
| 812 | + //-- 购物车更新 -- | ||
| 813 | + var updata1 = { | ||
| 814 | + id: item.id, | ||
| 815 | + goods_num: cbuy, | ||
| 816 | + store_id: os.stoid, | ||
| 817 | + user_id: getApp().globalData.userInfo.user_id | ||
| 818 | + }; | ||
| 819 | + getApp().request.put("/api/weshop/cart/update", { | ||
| 820 | + data: updata1, | ||
| 821 | + }) | ||
| 822 | + item.goods_num = cbuy; | ||
| 823 | + } | ||
| 800 | 824 | ||
| 801 | } | 825 | } |
| 802 | 826 |