diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index 63a045c..00cf952 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -357,7 +357,20 @@ Page({ } else if (this.data.bn_goods.yck_off == 1) { this.setData({ [txt]: 2 }) } - this.calculatePrice2()//计算金额 + //搭配购直接购买特殊处理 + if(this.data.collocation_goods){ + let txt = 'cartlist[0].yck_off'; + let txt1 = 'old_cartlist[0].yck_off'; + if (this.data.cartlist[0].yck_off == 2) { + this.setData({ [txt]: 1, [txt1]: 1 }) + } else if (this.data.cartlist[0].yck_off == 1) { + this.setData({ [txt]: 2, [txt1]: 2 }) + } + this.calculatePrice()//计算金额 + }else{ + this.calculatePrice2()//计算金额 + } + }, //计算商品预存款前置方法------------------------------------ async beforAdvancesum(cartList) { @@ -1895,7 +1908,7 @@ Page({ calculatePrice: async function (qfunc) { var th = this; th.setData({ submit: 1 }); - + wx.showLoading({ title: "处理中.", mask: true @@ -2102,7 +2115,7 @@ Page({ var back_data = null; var quan_no_goods_arr = null; - var ord_prom =null; + var ord_prom = null; //---判断是不是有订单优惠--- await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { @@ -2160,7 +2173,7 @@ Page({ //-- 如果没有订单优惠,或者订单优惠中有勾选包邮模板 -- - if(!ord_prom || ord_prom.is_post_temp) { + if (!ord_prom || ord_prom.is_post_temp) { var user_addr = th.data.user_addr; var req_d = { province: user_addr.province, city: user_addr.city, district: user_addr.district, @@ -2351,7 +2364,7 @@ Page({ var order_m = 0; //么有使用券,或者活动没有限制使用优惠券 - if(ord_prom && (quan_price <= 0 || !ord_prom.is_xz_yh)){ + if (ord_prom && (quan_price <= 0 || !ord_prom.is_xz_yh)) { order_prom_id = ord_prom['id']; switch (ord_prom['type']) { case 0: @@ -2438,7 +2451,33 @@ Page({ //预存金额使用参与计算 if (th.data.udata && th.data.udata.Balance > 0 && cart_item.order_amount * 1 > 0) { + + if (!cart_item.sto) { + console.log('没有线下门店id'); + //获取门店信息 + await getApp().request.promiseGet("/api/weshop/pickup/list", { + data: { + store_id: os.stoid, + ids: th.data.bn_pick + } + }).then(res => { + if (ut.ajax_ok(res)) { + console.log(res); + if (res.data.code == 0) { + let resData = res.data.data.pageData + if (resData && resData[0]) { + let keyid = resData[0].keyid + + cart_item.sto={ + keyid + } + } + } + } + }) + } let cart_yc = await th.beforAdvancesum(cart_item) + if (!cart_item.yck_off) { cart_item.yck_off = cart_yc.yck_off } @@ -2463,7 +2502,20 @@ Page({ [yct4]: cart_item.pre_json, [yct44]: cart_item.pre_json, }) - + //搭配购直接购买特殊处理 + if(th.data.collocation_goods){ + let yct1 = 'bn_goods.yck_off'; + let yct2 = 'bn_goods.yck'; + let yct3 = 'bn_goods.yckid'; + let yct4 = 'bn_goods.pre_json'; + th.setData({ + [yct1]: cart_item.yck_off, + [yct2]: cart_item.yck, + [yct3]: cart_item.yckid, + [yct4]: cart_item.pre_json, + }) + } + //-------------------- if (cart_item.yck_off && cart_item.yck_off == 2) { let order_amount = (cart_item.order_amount - cart_item.yck).toFixed(2); let yck = 0 @@ -2702,7 +2754,7 @@ Page({ var quan_no = null; if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) quan_no = th.data.using_quan[bn_pick].coupon_no; - + if (quan_no) { //如果是一件代发就不要找商品 if (th.data.using_quan[bn_pick].isby != 1 && !good.whsle_id) { @@ -2715,7 +2767,7 @@ Page({ WareIds: th.data.check_quan_ware_list } }).then(res => { - + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { quan_price = res.data.data[0].WareCashSum; } @@ -2734,9 +2786,9 @@ Page({ var ord_prom = null; var is_ord_prom_post = 0; - if(condition>0 && th.data.bn_is_order_yh) { + if (condition > 0 && th.data.bn_is_order_yh) { await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { - data: {store_id: os.stoid, orderAmount: condition, user_id: getApp().globalData.user_id} + data: { store_id: os.stoid, orderAmount: condition, user_id: getApp().globalData.user_id } }).then(res => { if (res.data.code == 0) { var data = res.data.data; @@ -2810,7 +2862,7 @@ Page({ var back_data = null; //判断是不是包邮模板,bn_is_post_temp 和 订单优惠的包邮模板一起控制 - if(th.data.bn_is_post_temp && (!ord_prom || is_ord_prom_post)){ + if (th.data.bn_is_post_temp && (!ord_prom || is_ord_prom_post)) { await getApp().request.promisePost("/api/weshop/order/areaFreight", { is_json: 1, data: req_d @@ -2966,7 +3018,7 @@ Page({ var order_prom_amount = 0; var order_prom_id = 0; - if (ord_prom && o_condition>0) { + if (ord_prom && o_condition > 0) { //么有使用券,或者活动没有限制使用优惠券 if (coupon_price <= 0 || !ord_prom.is_xz_yh) { order_prom_id = ord_prom['id']; @@ -3022,12 +3074,13 @@ Page({ } }) } + if (th.data.bn_goods.keyid) { let cart_yc = await th.beforAdvancesum({ order_amount: order_m, goods: [{ goods_sn: th.data.bn_goods.goods_sn, - goods_price: th.data.bn_goods.shop_price || th.data.bn_goods.goods_price, + goods_price: th.data.bn_goods.shop_price || th.data.bn_goods.goods_price, goods_num: th.data.bn_goods.buynum || th.data.bn_goods.goods_num, }], sto: { @@ -3076,6 +3129,15 @@ Page({ // all_yck_arr.push(yck) //真实预存款抵扣金额 // all_pre_json.push(good.pre_json) // all_prestore = parseFloat(all_prestore); //真实预存款抵扣金额总和 + }else{ + let atxt10 = "formData.prestore"; //预存金额 + let atxt11 = "formData.pre_json"; //预存json + let atxt12 = "formData.all_yck_arr"; //预存真实抵扣列表 + th.setData({ + [atxt10]: 0, + [atxt11]: '', + [atxt12]: [], + }) } } } else { @@ -3476,7 +3538,7 @@ Page({ order_prom_list.order_prom_id = th.data.formData.order_prom_id; order_prom_list.order_prom_amount = th.data.formData.order_prom_amount; } - + //--判断优惠活动的提交-- if (th.data.formData.cut_price > 0) { @@ -4055,7 +4117,7 @@ Page({ if (pdata.length == 0) return; //如果有使用预存,要处理 - if (th.data.formData && th.data.formData.prestore * 1 > 0 && th.data.bn_goods.yck_off==2) { + if (th.data.formData && th.data.formData.prestore * 1 > 0 ) { let formData = th.data.formData let pre_json = formData.pre_json let all_yck_arr = formData.all_yck_arr diff --git a/packageE/pages/cart/cart2/cart2.wxss b/packageE/pages/cart/cart2/cart2.wxss index 450859d..6b8a7c6 100644 --- a/packageE/pages/cart/cart2/cart2.wxss +++ b/packageE/pages/cart/cart2/cart2.wxss @@ -154,6 +154,7 @@ page { } .use-item>view{ display: flex; + align-items: center; } .use-item.bfff{ background-color: #fff;