Commit 909540bd2c1dfa0d019a4fe35a6a1504f8200752
1 parent
f1a3ea47
1. 赠品数量错误
2. 按钮错误
Showing
1 changed file
with
38 additions
and
27 deletions
pages/cart/cart2/cart2.js
... | ... | @@ -2585,33 +2585,38 @@ Page({ |
2585 | 2585 | |
2586 | 2586 | //--如果有赠品的时候,赠品也要提交--- |
2587 | 2587 | if (th.data.buy_now_gift_goods) { |
2588 | - var gift_gg = th.data.buy_now_gift_goods; | |
2589 | - var g_goods = { | |
2590 | - 'goods_id': gift_gg.goods_id, | |
2591 | - 'goods_name': gift_gg.goods_name, | |
2592 | - 'goods_sn': gift_gg.goods_sn, | |
2593 | - 'goods_num': gift_gg.buynum, | |
2594 | - 'market_price': gift_gg.market_price, | |
2595 | - 'goods_price': 0, | |
2596 | - 'member_goods_price': 0, | |
2597 | - 'store_id': oo.stoid, | |
2598 | - 'is_gift': 1, | |
2599 | - 'gift_id': gift_gg.gift_id, | |
2600 | - 'prom_id': gift_gg.prom_id, | |
2601 | - }; | |
2602 | - //-- 把导购的信息填入-- | |
2603 | - if (gg.guide_id) { | |
2604 | - g_goods.guide_id = gg.guide_id; | |
2605 | - g_goods.guide_type = gg.guide_type; | |
2606 | - //调用接口判断是不是会员 | |
2607 | - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { | |
2608 | - if (res.data.code == 0) { | |
2609 | - g_goods.guide_name = res.data.data.salesman; | |
2610 | - g_goods.guide_sn = res.data.data.salesman_no; | |
2611 | - } | |
2612 | - }) | |
2588 | + var gift_gg_arr = th.data.buy_now_gift_goods; | |
2589 | + for(let i in gift_gg_arr){ | |
2590 | + let gift_gg=gift_gg_arr[i]; | |
2591 | + var g_goods = { | |
2592 | + 'goods_id': gift_gg.goods_id, | |
2593 | + 'goods_name': gift_gg.goods_name, | |
2594 | + 'goods_sn': gift_gg.goods_sn, | |
2595 | + 'goods_num': gift_gg.buynum, | |
2596 | + 'market_price': gift_gg.market_price, | |
2597 | + 'goods_price': 0, | |
2598 | + 'member_goods_price': 0, | |
2599 | + 'store_id': oo.stoid, | |
2600 | + 'is_gift': 1, | |
2601 | + 'gift_id': gift_gg.gift_id, | |
2602 | + 'prom_id': gift_gg.prom_id, | |
2603 | + }; | |
2604 | + //-- 把导购的信息填入-- | |
2605 | + if (gg.guide_id) { | |
2606 | + g_goods.guide_id = gg.guide_id; | |
2607 | + g_goods.guide_type = gg.guide_type; | |
2608 | + //调用接口判断是不是会员 | |
2609 | + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { | |
2610 | + if (res.data.code == 0) { | |
2611 | + g_goods.guide_name = res.data.data.salesman; | |
2612 | + g_goods.guide_sn = res.data.data.salesman_no; | |
2613 | + } | |
2614 | + }) | |
2615 | + } | |
2616 | + item.order_goods.push(g_goods); | |
2617 | + | |
2613 | 2618 | } |
2614 | - item.order_goods.push(g_goods); | |
2619 | + | |
2615 | 2620 | } |
2616 | 2621 | pdata.push(item); |
2617 | 2622 | } else { |
... | ... | @@ -4768,7 +4773,10 @@ Page({ |
4768 | 4773 | if (res.confirm) { |
4769 | 4774 | func(); |
4770 | 4775 | } else if (res.cancel) { |
4771 | - console.log('用户点击取消') | |
4776 | + console.log('用户点击取消'); | |
4777 | + th.setData({ | |
4778 | + submit:0, | |
4779 | + }) | |
4772 | 4780 | } |
4773 | 4781 | } |
4774 | 4782 | }) |
... | ... | @@ -4790,6 +4798,9 @@ Page({ |
4790 | 4798 | |
4791 | 4799 | if (!is_ok) { |
4792 | 4800 | getApp().confirmBox("请选择赠品"); |
4801 | + th.setData({ | |
4802 | + submit:0, | |
4803 | + }) | |
4793 | 4804 | return false; |
4794 | 4805 | } |
4795 | 4806 | func(); | ... | ... |