diff --git a/packageC/pages/presell/cart/cart.js b/packageC/pages/presell/cart/cart.js index 8c3c9b5..3071d1f 100644 --- a/packageC/pages/presell/cart/cart.js +++ b/packageC/pages/presell/cart/cart.js @@ -654,6 +654,13 @@ Page({ quan_price = res.data.data[0].WareCashSum; } }) + }else{ + th.setData({quan_price:0}); + if(th.data.using_quan[bn_pick].isby==1){ + var txt="using_quan["+bn_pick+"]"; + th.setData({[txt]:{}}); + } + } if(quan_price>0){ @@ -697,11 +704,13 @@ Page({ th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) } - o_condition1=parseFloat(o_condition1)-parseFloat(th.data.presell.presell_deposit); - th.setData({ exp_price: 0, order_m: o_condition1 }) + o_condition1=parseFloat(o_condition1)-parseFloat(th.data.presell.presell_deposit); + if(o_condition1<0) o_condition1=0; + th.setData({ exp_price: 0, order_m: o_condition1 }) }) }else{ o_condition=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit); + if(o_condition<0) o_condition=0; th.setData({ exp_price: 0, order_m: o_condition }) } } @@ -742,168 +751,6 @@ Page({ }); }, - calc_per: async function (c_arr) { - var th = this; - //-- 循环处理 -- - for (var i in c_arr) { - var cart_item = c_arr[i]; //就是每一单的意思 - var pickid = cart_item.pickup_id; - var ord_goods = c_arr[i].goods; //就是每一单的从表的意思 - var o_price = 0, q_conditin = 0; - //--------循环计算总价----------- - for (var j = 0; j < ord_goods.length; j++) { - o_price += ord_goods[j].goods_price * ord_goods[j].goods_num; - } - - //---如果该门店的相关活动,就要算一下减价-- - if (th.data.prom_goods_map[pickid]) { - var ob = th.data.prom_goods_map[pickid]; - for (var ii in ob) { - var item_map = ob[ii]; - if (item_map.bs == undefined || item_map.bs == null) { - //等待,获取一下优惠活动的信息 - await getApp().request.promiseGet("/api/weshop/goods/getDiscount", { - data: { - price: item_map.price, prom_id: item_map.prom_id, - goods_num: item_map.goods_num, user_id: getApp().globalData.user_id, - is_bz: item_map.is_bz - } - }).then(res => { - if (res.data.code == 0 && res.data.data.condition) { - var get_data = res.data.data; - item_map.is_bz = get_data.is_bz; //是不是倍增 - item_map.bs = get_data.bs; //是不是倍数 - item_map.is_past = get_data.is_past; //是不是包邮 - item_map.prom_price = get_data.price >= 0 ? get_data.price : item_map.price; - item_map.s_intValue = get_data.intValue; - item_map.s_coupon_id = get_data.coupon_id; - item_map.s_coupon_num = get_data.coupon_num; - if (get_data.gift_id && get_data.goodsinfo) { - item_map.gift_id = get_data.gift_id; - item_map.gift_goods_id = get_data.goods_id; - item_map.gift_goods_name = get_data.goods_name; - item_map.gift_goods_color = get_data.goodsinfo.goods_color ? get_data.goodsinfo.goods_color : ''; - item_map.gift_goods_spec = get_data.goodsinfo.goods_spec ? get_data.goodsinfo.goods_spec : ''; - item_map.gift_original_img = get_data.goodsinfo.original_img; - item_map.gift_limit_num = get_data.limit_num; - item_map.gift_storecount = get_data.gift_storecount; - item_map.gift_weight = get_data.goodsinfo.weight; - item_map.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type; - item_map.uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; - - } - item_map.s_libao = get_data.libao; - item_map.s_lb_num = get_data.lb_num; - } - }) - } - - //有活动,且优惠活动并没有限制使用优惠券,且有减价 - //--看有没有减价-- - //if(item_map.prom_price>=0 && item_map.price-item_map.prom_price){ - if (item_map.price - item_map.prom_price && item_map.prom_price !== null) { - if (cart_item.prom_pt_json) { - cart_item.prom_pt_json.push({ - "prom_id": item_map.prom_id, - "dis": (item_map.price - item_map.prom_price).toFixed(2), - "ispt": 0 - }) - } else { - cart_item.prom_pt_json = [{ - "prom_id": item_map.prom_id, - "dis": (item_map.price - item_map.prom_price).toFixed(2), - "ispt": 0 - }]; - } - - //-- 如果系统要平摊到单品 -- - - var pt_data = { - 'prom_id': item_map.prom_id, - 'dis': parseFloat((item_map.price - item_map.prom_price).toFixed(2)), - 'goods': item_map.goods - } - - var pt_res = null; - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { - is_json: 1, - data: pt_data - }).then(res => { - if (res.data.code == 0) { - pt_res = res.data.data; - } - }) - if (pt_res) { - for (var io in item_map.goods) { - //平摊赋值 - item_map.goods[io].account_fir = th.arr_get_goods(item_map.goods[io].goods_id, pt_res).fisrt_account; - item_map.goods[io].account_yu_fir = th.arr_get_goods(item_map.goods[io].goods_id, pt_res).fisrt_account_yu; - if (!th.data.ispt_goods) { - item_map.goods[io].account = item_map.goods[io].account_fir; - item_map.goods[io].account_yu = item_map.goods[io].account_yu_fir; - } - } - } - - - o_price -= (item_map.price - item_map.prom_price); - //如果有限制使用优惠券,就要减掉参与的活动商品的钱 - if (!item_map.is_xz_yh) q_conditin = o_price; - } - - //--------循环计算商品是不是包邮,是不是使用优惠券,此时循环是商品从表----------- - for (var j = 0; j < ord_goods.length; j++) { - if (ord_goods[j].is_gift) continue; - if (ord_goods[j].prom_type == 3 && ord_goods[j].prom_id == item_map.prom_id) { - ord_goods[j].is_xz_yh = item_map.is_xz_yh; - ord_goods[j].is_past = item_map.is_past; - ord_goods[j].account_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_fir; - ord_goods[j].account_yu_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu_fir; - ord_goods[j].account = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account; - ord_goods[j].account_yu = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu; - } - } - - - //--优惠多少钱-- - if (!cart_item.cut_price) cart_item.cut_price = 0; - //-- -- - if (item_map.price != undefined && item_map.price != null - && item_map.prom_price != undefined && item_map.prom_price != null) - cart_item.cut_price += (item_map.price - item_map.prom_price); - //---如果有送积分--- - if (item_map.s_intValue) { - if (!cart_item.s_intValue) cart_item.s_intValue = 0; - cart_item.s_intValue += item_map.s_intValue; - } - //-- 如果有送优惠券的情况 -- - if (item_map.s_coupon_id) { - if (!cart_item.s_coupon_id) { - cart_item.s_coupon_id = item_map.s_coupon_id + ""; - cart_item.g_coupon_num = [{'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num}]; - } - else { - cart_item.s_coupon_id += "," + item_map.s_coupon_id; - cart_item.g_coupon_num.push({'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num}) - } - } - - //-- 如果有送优包邮券的情况 -- - if (item_map.s_libao) { - if (!cart_item.s_libao) { - cart_item.s_libao = item_map.s_libao + ""; - cart_item.g_lb_num = [{'l_id': item_map.s_libao, "num": item_map.s_lb_num}]; - } - else { - cart_item.s_libao += "," + item_map.s_libao; - cart_item.g_lb_num.push({'l_id': item_map.s_libao, "num": item_map.s_lb_num}) - } - } - } - } - } - }, - set_can_num: function () { var th = this; //-- 这个地方,循环计算几张优惠券可用-- @@ -1257,20 +1104,13 @@ Page({ var txt = ""; var txt1 = ""; var quan_item = null; - if (th.data.is_b_now) { + quan_item = this.data.get_by_quan_list[ind]; txt = "get_by_quan_list[" + ind + "].show_red"; var obj = {}; obj[txt] = 1; this.setData(obj); - } else { - txt = "by_quan_list_cart[" + ind + "].show_red"; - quan_item = th.data.by_quan_list_cart[ind]; - var obj = {}; - obj[txt] = 1; - this.setData(obj); - th.data.get_by_quan_list_cart[pickid] = JSON.parse(JSON.stringify(th.data.by_quan_list_cart)); //要把选中的弄回数组 - } + if (using_quan[th.data.selected_quan_pick]) { using_quan[th.data.selected_quan_pick].is_nouse_red = 0; @@ -1888,15 +1728,17 @@ Page({ } }) - if(quan_price>0) { - if (quan_price 0) { + if (quan_price < th.data.tail_pay) th.setData({quan_price: quan_price}) else { - th.setData({quan_price: th.data.tail_pay}) - quan_price=th.data.tail_pay; + th.setData({quan_price: th.data.tail_pay}) + quan_price = th.data.tail_pay; } - }else{ + } else { th.setData({quan_price: 0}) } + }else{ + th.setData({quan_price: 0}) } }else{ th.setData({quan_price: 0}) @@ -1905,7 +1747,7 @@ Page({ //-----------当地址不为空,且是物流时,计算物流费用---------- if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { //看是不是有调用过包邮券,如果活动可以使用优化券的情况下 - if (!th.data.isget_by_quan[bn_pick] && th.data.is_usecoupon) { + if (!th.data.isget_by_quan[bn_pick] && th.data.act.is_usecoupon) { var condition = allpice - quan_price; //--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额,见到优惠券的钱--- getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", { @@ -2009,12 +1851,14 @@ Page({ ord_price=parseFloat(ord_price)-parseFloat(th.data.presell.presell_deposit); + if(ord_price<0) ord_price=0; th.setData({ exp_price: exp_price, order_m: ord_price +parseFloat(exp_price) }) }) }else{ - var o_condition1=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit); + var o_condition1=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit); + if(o_condition1<0) o_condition1=0; th.setData({ exp_price: exp_price, order_m: parseFloat(o_condition1)+parseFloat(exp_price) }) } }, @@ -2068,7 +1912,13 @@ Page({ //显示支付选择 show_pay: function () { - this.setData({show_pay_type: 1}); + //不用钱直接支付 + if(this.data.order_m<=0){ + this.to_pay_type(1); + }else{ + this.setData({show_pay_type: 1}); + } + }, //关闭支付 close_show_pay: function () { @@ -2221,7 +2071,6 @@ Page({ this.calculatePrice2(); }, - //--------立即支付---------- async jumpToCart4(e) { var th=this; @@ -2598,7 +2447,6 @@ Page({ }, - //--------取消订单--------- cancelOrder: function(e) { var t = this,th=t, ord_id = this.data.order.order_id,order=this.data.order; diff --git a/packageC/pages/presell/cart/cart.wxml b/packageC/pages/presell/cart/cart.wxml index 9753dbd..27587d7 100644 --- a/packageC/pages/presell/cart/cart.wxml +++ b/packageC/pages/presell/cart/cart.wxml @@ -340,8 +340,8 @@ {{filters.toFix(order_m,2)}} - - + + @@ -461,7 +461,7 @@ - + @@ -472,9 +472,7 @@ - - 包邮券 - + 包邮券 满{{item.condition}}元可用 @@ -487,9 +485,7 @@ - - {{filter.get_type_card(0)}} - + {{filter.get_type_card(0)}} 包邮券 diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js index 9893bf2..3beac21 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.js +++ b/packageC/pages/presell/goodsInfo/goodsInfo.js @@ -1139,9 +1139,13 @@ Page({ }) app.set_b_now(e); - getApp().goto("/packageC/pages/presell/cart/cart2_pre"); - + //如果是全额付款的话 + if(this.data.presellForm.presell_type==1){ + getApp().goto("/packageC/pages/presell/cart/cart2") + }else{ + getApp().goto("/packageC/pages/presell/cart/cart2_pre"); + } }, //----------增加购买数量----------- diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.wxml b/packageC/pages/presell/goodsInfo/goodsInfo.wxml index e220d2e..5679ee4 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.wxml +++ b/packageC/pages/presell/goodsInfo/goodsInfo.wxml @@ -116,12 +116,14 @@ 总数量:{{presellList.presell_sumqty+presellList.virtual_qty}}件 - 限购:{{presellList.vip_butyqty}}件 + 限购:{{presellList.vip_butyqty}}件 + 限购:不限 已购:{{presellList.buy_goodnum+presellList.virtual_qty}}件 总数量:{{presellList.presell_sumqty}}件 - 限购:{{presellList.vip_butyqty}}件 + 限购:{{presellList.vip_butyqty}}件 + 限购:不限 已购:{{presellList.buy_goodnum}}件