diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index 002df07..b723660 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -336,8 +336,8 @@ Page({ }); } }) - }, + //购物车预存开启关闭 prestore(e) { let ind = e.currentTarget.dataset.ind; @@ -2110,6 +2110,15 @@ Page({ quan_price += q_data[k].WareCashSum; } }) + + if(cart_item.quan_youhui_list){ + for (var kk in cart_item.quan_youhui_list) { + var you_item = cart_item.quan_youhui_list[kk]; + //-- 对券的价格进行平摊 -- + await th.split_set_goods_quanprice(you_item, cart_item); + } + } + } @@ -2144,9 +2153,12 @@ Page({ if( [1,2,6].indexOf(item[jc].prom_type)>-1){ if(!item[jc].is_order_yh){ no_order_yh+=item[jc].goods_price * item[jc].goods_num; + if(item[jc].quan_num) no_order_yh-=item[jc].quan_num; //券要把他补回去 + } if(!item[jc].is_post_temp){ no_post_temp+=item[jc].goods_price * item[jc].goods_num; + if(item[jc].quan_num) no_post_temp-=item[jc].quan_num; //券要把他补回去 } } } @@ -5897,17 +5909,25 @@ Page({ } if (q_s_num > parseFloat(coupon_price) || q_s_num < parseFloat(coupon_price)) { + var pri = Math.floor(coupon_price * 100) / 100 - Math.floor(q_s_num * 100) / 100 + var is_ok=0; for (var ik in arr) { if (arr[ik].goods_num == 1) { var id = arr[ik].idx; - var pri = Math.floor(coupon_price * 100) / 100 - Math.floor(q_s_num * 100) / 100 t_item.goods[id].quan_num += pri; + is_ok=1; break; } } + if(!is_ok){ + var id2 = arr[0].idx; + t_item.goods[id2].quan_num += pri; + } + } } }, + //订阅消息提醒 sendsm: function (func) { let th = this; diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index 997f92e..c893087 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -1471,22 +1471,31 @@ Page({ b_item.price = good[card_field]; } - var url = "/api/weshop/activitylist/getGoodActInfo"; + var url = "/api/weshop/activitylist/listGoodActInfo2New"; var req_data = { - store_id: g_item.store_id, goodsidlist: g_item.goods_id, is_detail: 1, user_id: user_id, timetype: 0 + store_id: g_item.store_id, goods_id: g_item.goods_id, user_id: user_id }; await getApp().request.promiseGet(url, { data: req_data }).then(res => { if (res.data.code == 0) { - var list = res.data.data; - for (let i in list) { - let item = list[i]; - if (item.prom_type == 1) { good.prom_type = 1; good.prom_id = item.act_id; } + + var arr = res.data.data; + //-- 预热也要计算 -- + var arr2 = arr.filter(function (e) { + return e.s_time < ut.gettimestamp(); + }) + + if (arr2.length == 1) { + good.prom_type = 1; good.prom_id = item.act_id; + } + else if (arr2.length > 1) { + good.prom_type = g_item.prom_type; good.prom_id = g_item.prom_id; } } }) - if (!prom) { - //--判断商品当前的活动情况-- - switch (good.prom_type) { + + + //--判断商品当前的活动情况-- + switch (good.prom_type) { case 1: var flash = null; await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" + getApp().globalData.user_id + "/" + good.prom_id, {}).then(res => { @@ -1558,7 +1567,7 @@ Page({ }) break; } - } + //如果有优惠促销的时候,要看下商品的优惠活动有没有过期 if ((g_item.prom_type == 3 || good.prom_type == 3) && good.whsle_id <= 0) { @@ -1896,11 +1905,15 @@ Page({ } if (g_item.prom_type) { + //3,5,7,10加入购物车,统一prom_type为0 + if([3,5,7,10].indexOf(g_item.prom_type)>-1){ + g_item.prom_type=0; + g_item.prom_id=0; + } newd['prom_type'] = g_item.prom_type; newd['prom_id'] = g_item.prom_id; } - var b_cart_goods = null; await getApp().request.promiseGet("/api/weshop/cart/page", { data: { @@ -1917,10 +1930,29 @@ Page({ } }) + //-- 判断购物车是不是有重复 -- + var is_has=0; + if(b_cart_goods) { + for (let jr = 0; jr < b_cart_goods.length; jr++) { + var b_cart_item = b_cart_goods[jr]; + if (g_item.prom_type == 0) { + if ([0, 3, 5, 7, 10].indexOf(b_cart_item.prom_type) > -1) { + is_has = b_cart_item.id; + break + } + } else { + if (b_cart_goods.prom_type == g_item.prom_type && b_cart_goods.prom_id == g_item.prom_id) { + is_has = b_cart_item.id; + break + } + } + } + } + //-- 如果就加入过购物车 -- - if (b_cart_goods) { + if (is_has) { var updata = { - id: b_cart_goods.id, + id: is_has_cart, goods_num: newd.goods_num + b_cart_goods.goods_num, goods_price: newd.goods_price, member_goods_price: newd.goods_price,