From 909540bd2c1dfa0d019a4fe35a6a1504f8200752 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Sat, 9 Apr 2022 15:53:49 +0800 Subject: [PATCH] 1. 赠品数量错误 2. 按钮错误 --- pages/cart/cart2/cart2.js | 65 ++++++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index 9d06804..4d8099c 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -2585,33 +2585,38 @@ Page({ //--如果有赠品的时候,赠品也要提交--- if (th.data.buy_now_gift_goods) { - var gift_gg = th.data.buy_now_gift_goods; - var g_goods = { - 'goods_id': gift_gg.goods_id, - 'goods_name': gift_gg.goods_name, - 'goods_sn': gift_gg.goods_sn, - 'goods_num': gift_gg.buynum, - 'market_price': gift_gg.market_price, - 'goods_price': 0, - 'member_goods_price': 0, - 'store_id': oo.stoid, - 'is_gift': 1, - 'gift_id': gift_gg.gift_id, - 'prom_id': gift_gg.prom_id, - }; - //-- 把导购的信息填入-- - if (gg.guide_id) { - g_goods.guide_id = gg.guide_id; - g_goods.guide_type = gg.guide_type; - //调用接口判断是不是会员 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { - if (res.data.code == 0) { - g_goods.guide_name = res.data.data.salesman; - g_goods.guide_sn = res.data.data.salesman_no; - } - }) + var gift_gg_arr = th.data.buy_now_gift_goods; + for(let i in gift_gg_arr){ + let gift_gg=gift_gg_arr[i]; + var g_goods = { + 'goods_id': gift_gg.goods_id, + 'goods_name': gift_gg.goods_name, + 'goods_sn': gift_gg.goods_sn, + 'goods_num': gift_gg.buynum, + 'market_price': gift_gg.market_price, + 'goods_price': 0, + 'member_goods_price': 0, + 'store_id': oo.stoid, + 'is_gift': 1, + 'gift_id': gift_gg.gift_id, + 'prom_id': gift_gg.prom_id, + }; + //-- 把导购的信息填入-- + if (gg.guide_id) { + g_goods.guide_id = gg.guide_id; + g_goods.guide_type = gg.guide_type; + //调用接口判断是不是会员 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { + if (res.data.code == 0) { + g_goods.guide_name = res.data.data.salesman; + g_goods.guide_sn = res.data.data.salesman_no; + } + }) + } + item.order_goods.push(g_goods); + } - item.order_goods.push(g_goods); + } pdata.push(item); } else { @@ -4768,7 +4773,10 @@ Page({ if (res.confirm) { func(); } else if (res.cancel) { - console.log('用户点击取消') + console.log('用户点击取消'); + th.setData({ + submit:0, + }) } } }) @@ -4790,6 +4798,9 @@ Page({ if (!is_ok) { getApp().confirmBox("请选择赠品"); + th.setData({ + submit:0, + }) return false; } func(); -- libgit2 0.21.4