diff --git a/components/diy_pingd_buy/diy_pingd_buy.js b/components/diy_pingd_buy/diy_pingd_buy.js index be709c4..26d126f 100644 --- a/components/diy_pingd_buy/diy_pingd_buy.js +++ b/components/diy_pingd_buy/diy_pingd_buy.js @@ -104,7 +104,11 @@ Component({ var url= "/api/weshop/teamlist/pageteam/2?page=1&pageSize=9"; getApp().request.promiseGet(url, { data: { - store_id: os.stoid,is_end: 0,is_show: 1, + store_id: + os.stoid, + is_end: 0, + is_show: 1, + user_id: getApp().globalData.user_id, } }).then(res => { if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){ @@ -139,7 +143,7 @@ Component({ //--三个三个一组--- for(var i=0;i< all_array.length;i+=3){ arr.push(all_array.slice(i,i+3)); - } + } /*--熏染到前台--*/ th.setData({goods_array:arr}); var newTime = ut.gettimestamp(); diff --git a/packageA/pages/distribution/myteam/myteam.wxml b/packageA/pages/distribution/myteam/myteam.wxml index 23f27bb..0ca7b99 100644 --- a/packageA/pages/distribution/myteam/myteam.wxml +++ b/packageA/pages/distribution/myteam/myteam.wxml @@ -12,7 +12,7 @@ {{item.nickname}} 分销会员 - 普通会员 + 普通会员 {{filter.format_time(item.reg_time)}} diff --git a/packageB/pages/zuhegou/index/index.js b/packageB/pages/zuhegou/index/index.js index af5ec6c..29d9dcf 100644 --- a/packageB/pages/zuhegou/index/index.js +++ b/packageB/pages/zuhegou/index/index.js @@ -1972,15 +1972,8 @@ Page({ if (this.data.act.is_bzyh && zhqty_bz.length > 0) { if (zhqty_bz.length > 1) { let zhqty_bz_arr = []; - let zhqty_bz_flag = zhqty_bz.every((item1, i) => { - var bz_num = be * item1['zhqty']; //超量倍增 - var num = item1['num'] - item1['zhqty']; //购买数量减去超量 - if (bz_num > num) { - zhqty_bz_arr.push(item1); - zhqty_bz.splice(i, 1) - } - return bz_num <= num; - }) + let zhqty_bz_flag=this.zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr); + if (zhqty_bz_flag) { for (let i = 0; i < zhqty_bz.length; i++) { var vv = zhqty_bz[i]; @@ -1995,11 +1988,12 @@ Page({ } } } else { + zhqty_len=1; let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) { - return o['num'] + return o['num']; })); let new_arr = zhqty_bz_arr.filter(ii => { - return ii['num'] == min_bz_num + return ii['num'] == min_bz_num; }) var vv = new_arr[0]; var bz_num = be * new_arr[0].zhqty; //超量倍增 @@ -2018,16 +2012,20 @@ Page({ } bz_num_ok = be * vv.zhqty; } - - for (let j = 0; j < bz_num_ok; j++) { - let index = no_in_arr.findIndex(i => { - return vv.goods_id === i.goods_id - }) - if (index > -1) { - delete_num++ - no_in_arr.splice(index, 1) + + for(let i = 0; i < zhqty_bz.length; i++){ + let item1=zhqty_bz[i]; + for (let j = 0; j < be * item1['zhqty']; j++) { + let index = no_in_arr.findIndex(i => { + return item1.goods_id === i.goods_id + }) + if (index > -1) { + // delete_num++ + no_in_arr.splice(index, 1) + } } } + aprice += be * aprice; } } else { var vv = zhqty_bz[0]; @@ -2258,6 +2256,20 @@ Page({ } if (func) func(list) - } + }, + zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr){ + let zhqty_bz_flag =true; + for(let i=0;i num) { + zhqty_bz_flag=false; + zhqty_bz_arr.push(item); + // zhqty_bz.splice(i,1) + } + } + return zhqty_bz_flag; + } }) \ No newline at end of file diff --git a/packageB/pages/zuhegou/list/list.wxml b/packageB/pages/zuhegou/list/list.wxml index f58b305..da472f6 100644 --- a/packageB/pages/zuhegou/list/list.wxml +++ b/packageB/pages/zuhegou/list/list.wxml @@ -63,7 +63,7 @@ 没有相关内容 - + diff --git a/packageC/pages/group_list/group_list.wxml b/packageC/pages/group_list/group_list.wxml index 7d63580..1e04a00 100644 --- a/packageC/pages/group_list/group_list.wxml +++ b/packageC/pages/group_list/group_list.wxml @@ -44,7 +44,7 @@ - + \ No newline at end of file diff --git a/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js b/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js index efeb85c..a3b8843 100644 --- a/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js +++ b/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js @@ -1374,13 +1374,11 @@ Page({ o_price += item[j].goods_price * item[j].goods_num; //判断是否有设置限制重量包邮 - if(weight_free){ - if( item[j]['exp_sum_type']==2 ){ - if (goods_weight < 0) goods_weight = 0; - //累积商品重量 每种商品的重量 * 数量 - goods_weight += item[j]['weight'] * item[j]['goods_num']; - out_of_weight = (weight_free*1000) - goods_weight; - } + if(item[j]['is_past']!==1 && item[j]['exp_sum_type']==2 && weight_free>0){ + if (goods_weight < 0) goods_weight = 0; + //累积商品重量 每种商品的重量 * 数量 + goods_weight += item[j]['weight'] * item[j]['goods_num']; + out_of_weight = (weight_free*1000) - goods_weight; } } //判断是不是有组合购的金额 @@ -1560,9 +1558,11 @@ Page({ } }else{ - if(goods_weight && out_of_weight !== 0){ - goods_weight=-1; - out_of_weight=0; + if(item[j]['exp_sum_type']==2){ + if(out_of_weight !==0){ + goods_weight=-1; + out_of_weight=0; + } } } } @@ -1866,7 +1866,9 @@ Page({ if (goods_weight < 0) goods_weight = 0; //累积商品重量 每种商品的重量 * 数量 goods_weight += good['weight'] * good['buynum']; - out_of_weight = (weight_free * 1000 ) - goods_weight; + if(weight_free > 0){ + out_of_weight = (weight_free * 1000 ) - goods_weight; + } break; case 3: if (goods_piece < 0) goods_piece = 0; @@ -2863,7 +2865,7 @@ Page({ var price = 0, th = this; price += parseFloat(o_shipping_price); //如果是包邮 - if (freight_free > 0 && o_price >= freight_free && out_of_weight > 0) { + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { return 0; } if (user_addr == null) { @@ -2881,7 +2883,7 @@ Page({ item = item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight >= 0 && item['money'] && out_of_weight > 0) { + if (goods_weight >= 0 && item['money']) { fw_price = parseFloat(item['money']); if (goods_weight > item['first_weight']) { var fw = goods_weight - item['first_weight']; @@ -2890,11 +2892,14 @@ Page({ } } //------超出重量---------- - if(out_of_weight < 0){ + if(out_of_weight < 0 && o_price >= freight_free){ fw_price = parseFloat(item['money']); var out_of_weight = Math.abs(out_of_weight); - var n = Math.ceil(out_of_weight / item['second_weight']) - fw_price = fw_price + n * parseFloat(item['add_money']); + if (out_of_weight > item['first_weight']) { + var fw = out_of_weight - item['first_weight']; + var n = Math.ceil(fw / item['second_weight']) + fw_price = fw_price + n * parseFloat(item['add_money']); + } } //------按件数---------- if (goods_piece > 0 && item['piecemoney']) { diff --git a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js index 79d7362..e4222b5 100644 --- a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js +++ b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js @@ -513,6 +513,10 @@ Page({ var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; + var out_of_weight=null; //超出多少重量 + var freight_free = ee.freight_free; //全场满多少包邮 + var weight_free = ee.weight_free; //多少kg内包邮 + var no_ex_id = ee.no_ex_id; //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) { @@ -525,6 +529,9 @@ Page({ if (goods_weight < 0) goods_weight = 0; //累积商品重量 每种商品的重量 * 数量 goods_weight += good['weight'] * good['buynum']; + if(weight_free > 0){ + out_of_weight = (weight_free * 1000 ) - goods_weight; + } break; case 3: if (goods_piece < 0) goods_piece = 0; @@ -1042,7 +1049,7 @@ Page({ th = this; price += parseFloat(o_shipping_price); //如果是包邮 - if (freight_free > 0 && o_price >= freight_free) { + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { return 0; } if (user_addr == null) { @@ -1061,7 +1068,7 @@ Page({ item = item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight > 0) { + if (goods_weight > 0 && item['money']) { fw_price = parseFloat(item['money']); if (goods_weight > item['first_weight']) { var fw = goods_weight - item['first_weight']; @@ -1069,6 +1076,16 @@ Page({ fw_price = fw_price + n * parseFloat(item['add_money']); } } + //------超出重量---------- + if(out_of_weight < 0 && o_price >= freight_free){ + fw_price = parseFloat(item['money']); + var out_of_weight = Math.abs(out_of_weight); + if (out_of_weight > item['first_weight']) { + var fw = out_of_weight - item['first_weight']; + var n = Math.ceil(fw / item['second_weight']) + fw_price = fw_price + n * parseFloat(item['add_money']); + } + } //------按件数---------- if (goods_piece > 0) { fp_price = parseFloat(item['piecemoney']); diff --git a/packageC/pages/presell/cart/cart.js b/packageC/pages/presell/cart/cart.js index 9374ed6..2703208 100644 --- a/packageC/pages/presell/cart/cart.js +++ b/packageC/pages/presell/cart/cart.js @@ -852,12 +852,12 @@ Page({ th.calculatePrice2(); }, //-------------------计算物流--------------- - calculatewuliu: function (code, o_shipping_price, goods_weight, + calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight, goods_piece, user_addr, freight_free, o_price, rs) { var price = 0, th = this; price += parseFloat(o_shipping_price); //如果是包邮 - if (freight_free > 0 && o_price >= freight_free) { + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0) { return 0; } if (user_addr == null) { @@ -883,6 +883,16 @@ Page({ fw_price = fw_price + n * parseFloat(item['add_money']); } } + //------超出重量---------- + if(out_of_weight < 0 && o_price >= freight_free){ + fw_price = parseFloat(item['money']); + var out_of_weight = Math.abs(out_of_weight); + if (out_of_weight > item['first_weight']) { + var fw = out_of_weight - item['first_weight']; + var n = Math.ceil(fw / item['second_weight']) + fw_price = fw_price + n * parseFloat(item['add_money']); + } + } //------按件数---------- if (goods_piece > 0 && item['piecemoney']) { fp_price = parseFloat(item['piecemoney']); @@ -1713,6 +1723,9 @@ Page({ var quan_no = null; var bn_pick=th.data.pickup.pickup_id; var allpice =th.data.all_price; + var out_of_weight=null; //超出多少重量 + var freight_free = ee.freight_free; //全场满多少包邮 + var weight_free = ee.weight_free; //多少kg内包邮 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; @@ -1793,6 +1806,9 @@ Page({ if (goods_weight < 0) goods_weight = 0; //累积商品重量 每种商品的重量 * 数量 goods_weight += good['weight'] * th.data.order.order_goods['goods_num']; + if(weight_free > 0){ + out_of_weight = (weight_free * 1000 ) - goods_weight; + } break; case 3: if (goods_piece < 0) goods_piece = 0; @@ -1802,7 +1818,6 @@ Page({ } var code = th.data.wu_arr[th.data.index].code; - var freight_free = ee.freight_free; //全场满多少包邮 var shipping_price = th.calculatewuliu(code, o_shipping_price, goods_weight, goods_piece, th.data.user_addr, freight_free, allpice, rs); diff --git a/packageC/pages/presell/cart/cart2.js b/packageC/pages/presell/cart/cart2.js index 075c2c2..9cc7c3b 100644 --- a/packageC/pages/presell/cart/cart2.js +++ b/packageC/pages/presell/cart/cart2.js @@ -734,7 +734,7 @@ Page({ //如果有赠品的时候,也要计算赠品的物流费用 if (th.data.buy_now_gift_goods) { - shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,gift_weight_free, + shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,out_of_weight,gift_weight_free, parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); } @@ -1693,7 +1693,7 @@ Page({ item = item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight >= 0 && item['money'] && out_of_weight > 0) { + if (goods_weight >= 0 && item['money']) { fw_price = parseFloat(item['money']); if (goods_weight > item['first_weight']) { var fw = goods_weight - item['first_weight']; @@ -1703,7 +1703,7 @@ Page({ } //------超出重量---------- - if(out_of_weight < 0){ + if(out_of_weight < 0 && o_price >= freight_free){ fw_price = parseFloat(item['money']); var out_of_weight = Math.abs(out_of_weight); var n = Math.ceil(out_of_weight / item['second_weight']) @@ -2540,7 +2540,7 @@ Page({ }, //计算立即购买赠品的物流费用 - get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { + get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free,out_of_weight,allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { var good = this.data.buy_now_gift_goods; var goods_weight = -1, goods_piece = -1; var gift_shipping_price = 0; @@ -2556,8 +2556,9 @@ Page({ //累积商品重量 每种商品的重量 * 数量 goods_weight += good['weight'] * good['buynum']; if (goods_weight1 > 0) { + out_of_weight = gift_weight_free - goods_weight; + //不能调换位置 下面goods_weight会变大 goods_weight += goods_weight1; - out_of_weight = (gift_weight_free*1000) - goods_weight; } break; case 3: diff --git a/packageC/pages/presell/cart/cart2_pre.js b/packageC/pages/presell/cart/cart2_pre.js index 39a3410..cbf65f4 100644 --- a/packageC/pages/presell/cart/cart2_pre.js +++ b/packageC/pages/presell/cart/cart2_pre.js @@ -342,7 +342,11 @@ Page({ app.getConfig2(function (ee) { app.getwuliuprice(function (rs) { - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; + var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; + var out_of_weight=null; //超出多少重量 + var freight_free = ee.freight_free; //全场满多少包邮 + var weight_free = ee.weight_free; //多少kg内包邮 + var no_ex_id = ee.no_ex_id; //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){ @@ -353,7 +357,11 @@ Page({ case 2: if (goods_weight < 0) goods_weight = 0; //累积商品重量 每种商品的重量 * 数量 - goods_weight += good['weight'] * good['buynum'];break; + goods_weight += good['weight'] * good['buynum']; + if(weight_free > 0){ + out_of_weight = (weight_free * 1000 ) - goods_weight; + } + break; case 3: if (goods_piece < 0) goods_piece = 0; //累积商品数量 @@ -361,9 +369,8 @@ Page({ } var code = th.data.wu_arr[th.data.index].code; - var freight_free = ee.freight_free; //全场满多少包邮 var shipping_price= - th.calculatewuliu(code, o_shipping_price, goods_weight, + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight, goods_piece, th.data.user_addr, freight_free, allpice, rs); shipping_price = parseFloat(shipping_price).toFixed(2); @@ -701,12 +708,12 @@ Page({ }, //-------------------计算物流--------------- - calculatewuliu:function(code, o_shipping_price, goods_weight, + calculatewuliu:function(code, o_shipping_price, goods_weight,out_of_weight, goods_piece,user_addr, freight_free, o_price, rs){ var price =0,th=this; price +=parseFloat(o_shipping_price); //如果是包邮 - if (freight_free > 0 && o_price >= freight_free){ return 0;} + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0){ return 0;} if (user_addr==null) { return 0; } //计算物流的config item; var item=null; @@ -720,7 +727,7 @@ Page({ item=item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight>0) { + if (goods_weight >= 0 && item['money']) { fw_price =parseFloat(item['money']); if (goods_weight > item['first_weight']){ var fw = goods_weight - item['first_weight']; @@ -728,6 +735,16 @@ Page({ fw_price = fw_price + n * parseFloat(item['add_money']); } } + //------超出重量---------- + if(out_of_weight < 0 && o_price >= freight_free){ + fw_price = parseFloat(item['money']); + var out_of_weight = Math.abs(out_of_weight); + if (out_of_weight > item['first_weight']) { + var fw = out_of_weight - item['first_weight']; + var n = Math.ceil(fw / item['second_weight']) + fw_price = fw_price + n * parseFloat(item['add_money']); + } + } //------按件数---------- if (goods_piece > 0) { fp_price = parseFloat(item['piecemoney']); diff --git a/pages/cart/cart/zh_calculate.js b/pages/cart/cart/zh_calculate.js index 04fae18..e68c1b0 100644 --- a/pages/cart/cart/zh_calculate.js +++ b/pages/cart/cart/zh_calculate.js @@ -239,15 +239,8 @@ module.exports = { if (act.is_bzyh && zhqty_bz.length > 0) { if (zhqty_bz.length > 1) { let zhqty_bz_arr = []; - let zhqty_bz_flag = zhqty_bz.every((item1, i) => { - var bz_num = be * item1['zhqty']; //超量倍增 - var num = item1['num'] - item1['zhqty']; //购买数量减去超量 - if (bz_num > num) { - zhqty_bz_arr.push(item1); - zhqty_bz.splice(i, 1) - } - return bz_num <= num; - }) + let zhqty_bz_flag=this.zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr); + if (zhqty_bz_flag) { for (let i = 0; i < zhqty_bz.length; i++) { var vv = zhqty_bz[i]; @@ -262,11 +255,12 @@ module.exports = { } } } else { + zhqty_len=1; let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) { - return o['num'] + return o['num']; })); let new_arr = zhqty_bz_arr.filter(ii => { - return ii['num'] == min_bz_num + return ii['num'] == min_bz_num; }) var vv = new_arr[0]; var bz_num = be * new_arr[0].zhqty; //超量倍增 @@ -285,18 +279,22 @@ module.exports = { } bz_num_ok = be * vv.zhqty; } - - for (let j = 0; j < bz_num_ok; j++) { - let index = no_in_arr.findIndex(i => { - return vv.goods_id === i.goods_id - }) - if (index > -1) { - delete_num++ - no_in_arr.splice(index, 1) + + for(let i = 0; i < zhqty_bz.length; i++){ + let item1=zhqty_bz[i]; + for (let j = 0; j < be * item1['zhqty']; j++) { + let index = no_in_arr.findIndex(i => { + return item1.goods_id === i.goods_id + }) + if (index > -1) { + // delete_num++ + no_in_arr.splice(index, 1) + } } } + aprice += be * aprice; } - } else { + } else { var vv = zhqty_bz[0]; var bz_num = be * vv.zhqty; //超量倍增 var num = vv['num'] - vv.zhqty; //购买数量减去超量 @@ -310,14 +308,11 @@ module.exports = { // be=be-bz_num_ok; if (num % vv.zhqty == 0) { be = num / vv.zhqty; - // bz_num_ok = num; } else { be = Math.floor(num / vv.zhqty) - // bz_num_ok = num - (be * vv.zhqty); } bz_num_ok = be * vv.zhqty; } - // be=vv.num; for (let j = 0; j < bz_num_ok; j++) { let index = no_in_arr.findIndex(i => { return vv.goods_id === i.goods_id @@ -496,7 +491,22 @@ module.exports = { } } return dest; - } + }, + + zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr){ + let zhqty_bz_flag =true; + for(let i=0;i num) { + zhqty_bz_flag=false; + zhqty_bz_arr.push(item); + // zhqty_bz.splice(i,1) + } + } + return zhqty_bz_flag; + } } \ No newline at end of file diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index f414b42..df36eac 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -1001,9 +1001,9 @@ Page({ //-- 搭配促销的门店配送方式的修复 -- et = 1; - distr_t = 0; + distr_t = 0; // 配送方式 0=用户自选 1=自提 2=物流 for (var hi in narr) { - var dis_t = narr[hi].distr_type; + var dis_t = narr[hi].distr_type; if (dis_t == 2) { th.setData({is_all_zt: 0}); et = 0; @@ -1012,10 +1012,9 @@ Page({ distr_t = dis_t; } } - //自选的时候,系统配置了默认的配送方式是物流的时候 if (distr_t == 0 && th.data.json_d.pickupway && th.data.json_d.pickupway == 1) { - et = 0; + et = 2; } @@ -1484,13 +1483,11 @@ Page({ o_price += item[j].goods_price * item[j].goods_num; //判断是否有设置限制重量包邮,先看商品有没有包邮 - if(item[j]['is_past']!==1 && weight_free){ - if( item[j]['exp_sum_type']==2 ){ - if (goods_weight < 0) goods_weight = 0; - //累积商品重量 每种商品的重量 * 数量 - goods_weight += item[j]['weight'] * item[j]['goods_num']; - out_of_weight = (weight_free*1000) - goods_weight; - } + if(item[j]['is_past']!==1 && item[j]['exp_sum_type']==2 && weight_free>0){ + if (goods_weight < 0) goods_weight = 0; + //累积商品重量 每种商品的重量 * 数量 + goods_weight += item[j]['weight'] * item[j]['goods_num']; + out_of_weight = (weight_free*1000) - goods_weight; } } //判断是不是有组合购的金额 @@ -1666,7 +1663,7 @@ Page({ o_shipping_price += item[j]['uniform_exp_sum']; break; // case 2: //1464行已计算 不必重复计算 注释为:判断是否有设置限制重量包邮 - // +'' + // +'' // if (goods_weight < 0) goods_weight = 0; // //累积商品重量 每种商品的重量 * 数量 // goods_weight += item[j]['weight'] * item[j]['goods_num']; @@ -1679,12 +1676,14 @@ Page({ break; } } - }else{ - if(goods_weight && out_of_weight !==0){ - goods_weight=-1; - out_of_weight=0; + if(item[j]['exp_sum_type']==2){ + if(out_of_weight !==0){ + goods_weight=-1; + out_of_weight=0; + } } + } } @@ -1999,7 +1998,9 @@ Page({ //dw //累积商品重量 每种商品的重量 * 数量 goods_weight += good['weight'] * good['buynum']; - out_of_weight = (weight_free * 1000 ) - goods_weight; + if(weight_free > 0){ + out_of_weight = (weight_free * 1000 ) - goods_weight; + } break; case 3: if (goods_piece < 0) goods_piece = 0; @@ -2253,6 +2254,7 @@ Page({ this.data.is_summit_ing = 1; var th = this, pdata = new Array(); var ff = true; + //------------立即购买------------- if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { @@ -2263,14 +2265,13 @@ Page({ if (!ff) return false; var addr = th.data.user_addr; if (th.data.bn_exp_type == 1) addr = null; - if (th.data.bn_exp_type == 0) if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) { getApp().my_warnning("读取物流失败", 0, th); th.data.is_summit_ing = 0; return false; } - + var item = { 'user_id': to.globalData.user_id, 'consignee': addr == null ? "" : addr.consignee, @@ -2490,6 +2491,7 @@ Page({ } pdata.push(item); } else { + //---------购物车的结算--------- if (th.data.is_all_zt == 0 && th.data.user_addr == null) { th.data.is_summit_ing = 0; @@ -2499,6 +2501,7 @@ Page({ if (!ff) return false; var addr = th.data.user_addr; + // 自提,地址数据清空 exp_type设置为1 if (th.data.is_all_zt == 1) addr = null; var val_arr = th.data.user_note; @@ -2509,8 +2512,8 @@ Page({ return false; } - var order_prom_list_cart = th.data.order_prom_list_cart; - + var order_prom_list_cart =  th.data.order_prom_list_cart;; + console.log('xxxxxxxxxxxxxxxx', order_prom_list_cart) //--组装推送数据-- for (var i = 0; i < order_prom_list_cart.length; i++) { var t_item = order_prom_list_cart[i]; @@ -2738,7 +2741,7 @@ Page({ } - + if (pdata.length == 0) return; var str = JSON.stringify(pdata); @@ -3055,7 +3058,7 @@ Page({ item = item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight >= 0 && item['money'] && out_of_weight > 0) { + if (goods_weight >= 0 && item['money']) { fw_price = parseFloat(item['money']); if (goods_weight > item['first_weight']) { var fw = goods_weight - item['first_weight']; @@ -3064,11 +3067,9 @@ Page({ } } //------超出重量---------- - if(out_of_weight < 0){ + if(out_of_weight < 0 && o_price >= freight_free){ fw_price = parseFloat(item['money']); var out_of_weight = Math.abs(out_of_weight); - // var n = Math.ceil(out_of_weight / item['second_weight']) - // fw_price = fw_price + n * parseFloat(item['add_money']); if (out_of_weight > item['first_weight']) { var fw = out_of_weight - item['first_weight']; var n = Math.ceil(fw / item['second_weight']) @@ -3985,7 +3986,7 @@ Page({ }, //计算立即购买赠品的物流费用 - get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { + get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,out_of_weight, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) { var good = this.data.buy_now_gift_goods; var goods_weight = -1, goods_piece = -1; var gift_shipping_price = 0; diff --git a/pages/cart/cart2/zh_calculate.js b/pages/cart/cart2/zh_calculate.js index 0475ca1..a1c204e 100644 --- a/pages/cart/cart2/zh_calculate.js +++ b/pages/cart/cart2/zh_calculate.js @@ -152,15 +152,7 @@ module.exports = { if (act.is_bzyh && zhqty_bz.length > 0) { if (zhqty_bz.length > 1) { let zhqty_bz_arr = []; - let zhqty_bz_flag = zhqty_bz.every((item1, i) => { - var bz_num = be * item1['zhqty']; //超量倍增 - var num = item1['num'] - item1['zhqty']; //购买数量减去超量 - if (bz_num > num) { - zhqty_bz_arr.push(item1); - zhqty_bz.splice(i, 1) - } - return bz_num <= num; - }) + let zhqty_bz_flag=this.zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr); if (zhqty_bz_flag) { for (let i = 0; i < zhqty_bz.length; i++) { var vv = zhqty_bz[i]; @@ -175,11 +167,12 @@ module.exports = { } } } else { + zhqty_len=1; let min_bz_num = Math.min.apply(Math, zhqty_bz_arr.map(function (o) { - return o['num'] + return o['num']; })); let new_arr = zhqty_bz_arr.filter(ii => { - return ii['num'] == min_bz_num + return ii['num'] == min_bz_num; }) var vv = new_arr[0]; var bz_num = be * new_arr[0].zhqty; //超量倍增 @@ -198,18 +191,22 @@ module.exports = { } bz_num_ok = be * vv.zhqty; } - - for (let j = 0; j < bz_num_ok; j++) { - let index = no_in_arr.findIndex(i => { - return vv.goods_id === i.goods_id - }) - if (index > -1) { - delete_num++ - no_in_arr.splice(index, 1) + + for(let i = 0; i < zhqty_bz.length; i++){ + let item1=zhqty_bz[i]; + for (let j = 0; j < be * item1['zhqty']; j++) { + let index = no_in_arr.findIndex(i => { + return item1.goods_id === i.goods_id + }) + if (index > -1) { + // delete_num++ + no_in_arr.splice(index, 1) + } } } + aprice += be * aprice; } - } else { + } else { var vv = zhqty_bz[0]; var bz_num = be * vv.zhqty; //超量倍增 var num = vv['num'] - vv.zhqty; //购买数量减去超量 @@ -223,19 +220,16 @@ module.exports = { // be=be-bz_num_ok; if (num % vv.zhqty == 0) { be = num / vv.zhqty; - // bz_num_ok = num; } else { be = Math.floor(num / vv.zhqty) - // bz_num_ok = num - (be * vv.zhqty); } bz_num_ok = be * vv.zhqty; } - // be=vv.num; for (let j = 0; j < bz_num_ok; j++) { let index = no_in_arr.findIndex(i => { return vv.goods_id === i.goods_id }) - if(index > -1){ + if (index > -1) { delete_num++ no_in_arr.splice(index, 1) } @@ -515,6 +509,20 @@ module.exports = { } + }, + zhqty_bz_fun(zhqty_bz,be,zhqty_bz_arr){ + let zhqty_bz_flag =true; + for(let i=0;i num) { + zhqty_bz_flag=false; + zhqty_bz_arr.push(item); + // zhqty_bz.splice(i,1) + } + } + return zhqty_bz_flag; } diff --git a/pages/cart/cart2_inte/cart2_inte.js b/pages/cart/cart2_inte/cart2_inte.js index 0f2a7f6..140cdb9 100644 --- a/pages/cart/cart2_inte/cart2_inte.js +++ b/pages/cart/cart2_inte/cart2_inte.js @@ -442,6 +442,9 @@ Page({ to.getwuliuprice(async function (rs) { var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; + var out_of_weight=null; //超出多少重量 + var freight_free = ee.freight_free; //全场满多少包邮 + var weight_free = ee.weight_free; //多少kg内包邮 //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past!=1 ){ @@ -452,7 +455,11 @@ Page({ case 2: if (goods_weight < 0) goods_weight = 0; //累积商品重量 每种商品的重量 * 数量 - goods_weight += good['weight'] * good['buynum'];break; + goods_weight += good['weight'] * good['buynum']; + if(weight_free > 0){ + out_of_weight = (weight_free * 1000 ) - goods_weight; + } + break; case 3: if (goods_piece < 0) goods_piece = 0; //累积商品数量 @@ -461,8 +468,7 @@ Page({ var code =""; if(th.data.wu_arr && th.data.wu_arr[th.data.index]) code=th.data.wu_arr[th.data.index].code; - var freight_free = ee.freight_free; //全场满多少包邮 - var no_ex_id=ee.no_ex_id; + var no_ex_id=ee.no_ex_id; th.data.is_no_by[th.data.bn_pick]=0; var no_by_data=null; @@ -496,7 +502,7 @@ Page({ th.data.is_by[th.data.bn_pick]=0; //--------------开始计算物流------------------ var shipping_price= - th.calculatewuliu(code, o_shipping_price, goods_weight, + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight, goods_piece, th.data.user_addr, freight_free, allpice-cut_price, rs); if(shipping_price<=0){ th.data.is_by[th.data.bn_pick]=1; //已经是包邮了,就不要选择包邮券 @@ -919,12 +925,12 @@ Page({ th.calculatePrice(); }, //-------------------计算物流--------------- - calculatewuliu:function(code, o_shipping_price, goods_weight, + calculatewuliu:function(code, o_shipping_price, goods_weight,out_of_weight, goods_piece,user_addr, freight_free, o_price, rs){ var price =0,th=this; price +=parseFloat(o_shipping_price); //如果是包邮 - if (freight_free > 0 && o_price >= freight_free){ return 0;} + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0){ return 0;} if (user_addr==null) { return 0; } //计算物流的config item; var item=null; @@ -938,7 +944,7 @@ Page({ item=item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight>=0 && item['money']) { + if (goods_weight >= 0 && item['money']) { fw_price =parseFloat(item['money']); if (goods_weight > item['first_weight']){ var fw = goods_weight - item['first_weight']; @@ -946,6 +952,16 @@ Page({ fw_price = fw_price + n * parseFloat(item['add_money']); } } + //------超出重量---------- + if(out_of_weight < 0 && o_price >= freight_free){ + fw_price = parseFloat(item['money']); + var out_of_weight = Math.abs(out_of_weight); + if (out_of_weight > item['first_weight']) { + var fw = out_of_weight - item['first_weight']; + var n = Math.ceil(fw / item['second_weight']) + fw_price = fw_price + n * parseFloat(item['add_money']); + } + } //------按件数---------- if (goods_piece > 0 && item['piecemoney']) { fp_price = parseFloat(item['piecemoney']); diff --git a/pages/cart/cart2_pt/cart2_pt.js b/pages/cart/cart2_pt/cart2_pt.js index 377b76f..a7b4506 100644 --- a/pages/cart/cart2_pt/cart2_pt.js +++ b/pages/cart/cart2_pt/cart2_pt.js @@ -395,7 +395,6 @@ Page({ }, //---------计算立即购买---------- calculatePrice2: function () { - console.log('calculatePrice2'); var th = this, good = this.data.bn_goods; //-----------计算商品总价-------------- var allpice = good.shop_price * good.buynum; @@ -408,7 +407,10 @@ Page({ to.getwuliuprice(function (rs) { console.log('calculatePrice2222'); console.log(rs); - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; + var o_shipping_price = 0,goods_weight = -1,goods_piece = -1; + var out_of_weight=null; //超出多少重量 + var freight_free = ee.freight_free; //全场满多少包邮 + var weight_free = ee.weight_free; //多少kg内包邮 //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){ switch (good['exp_sum_type']) { @@ -418,7 +420,12 @@ Page({ case 2: if (goods_weight < 0) goods_weight = 0; //累积商品重量 每种商品的重量 * 数量 - goods_weight += good['weight'] * good['buynum'];break; + goods_weight += good['weight'] * good['buynum']; + if(weight_free > 0){ + out_of_weight = (weight_free * 1000 ) - goods_weight; + } + break; + // goods_weight += good['weight'] * good['buynum'];break; case 3: if (goods_piece < 0) goods_piece = 0; //累积商品数量 @@ -430,7 +437,7 @@ Page({ var code = th.data.wu_arr[th.data.index].code; var freight_free = ee.freight_free; //全场满多少包邮 var shipping_price= - th.calculatewuliu(code, o_shipping_price, goods_weight, + th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight, goods_piece, th.data.user_addr, freight_free, allpice, rs); shipping_price = parseFloat(shipping_price).toFixed(2); @@ -586,6 +593,7 @@ Page({ }) } + //--商品的房间号-- if(gg.room_id && gg.room_id>0){ item.room_ids=gg.room_id; @@ -774,12 +782,12 @@ Page({ }, //-------------------计算物流--------------- - calculatewuliu:function(code, o_shipping_price, goods_weight, + calculatewuliu:function(code, o_shipping_price, goods_weight,out_of_weight, goods_piece,user_addr, freight_free, o_price, rs){ var price =0,th=this; price +=parseFloat(o_shipping_price); //如果是包邮 - if (freight_free > 0 && o_price >= freight_free){ return 0;} + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0){ return 0;} if (user_addr==null) { return 0; } //计算物流的config item; var item=null; @@ -793,7 +801,7 @@ Page({ item=item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight>=0) { + if (goods_weight >= 0 && item['money']) { fw_price =parseFloat(item['money']); if (goods_weight > item['first_weight']){ var fw = goods_weight - item['first_weight']; @@ -801,8 +809,18 @@ Page({ fw_price = fw_price + n * parseFloat(item['add_money']); } } + //------超出重量---------- + if(out_of_weight < 0 && o_price >= freight_free){ + fw_price = parseFloat(item['money']); + var out_of_weight = Math.abs(out_of_weight); + if (out_of_weight > item['first_weight']) { + var fw = out_of_weight - item['first_weight']; + var n = Math.ceil(fw / item['second_weight']) + fw_price = fw_price + n * parseFloat(item['add_money']); + } + } //------按件数---------- - if (goods_piece > 0) { + if (goods_piece > 0 ) { fp_price = parseFloat(item['piecemoney']); if (goods_piece > item['first_piece']) { var fp = goods_piece - item['first_piece']; diff --git a/pages/cart/cart_wk/cart_wk.js b/pages/cart/cart_wk/cart_wk.js index f55f477..0ff9d42 100644 --- a/pages/cart/cart_wk/cart_wk.js +++ b/pages/cart/cart_wk/cart_wk.js @@ -420,10 +420,10 @@ Page({ var to = getApp(), th = this; to.getConfig2(function (ee) { to.getwuliuprice(function (rs) { - var o_shipping_price = 0, - goods_weight = -1, - goods_piece = -1, - good = th.data.goods; + var o_shipping_price = 0,goods_weight = -1,goods_piece = -1,good=th.data.goods; + var out_of_weight=null; //超出多少重量 + var freight_free = ee.freight_free; //全场满多少包邮 + var weight_free = ee.weight_free; //多少kg内包邮 //-----------当地址不为空,且是物流时,计算物流费用---------- if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { switch (good['exp_sum_type']) { @@ -435,6 +435,9 @@ Page({ if (goods_weight < 0) goods_weight = 0; //累积商品重量 每种商品的重量 * 数量 goods_weight += good['weight'] * th.data.order.order_goods['goods_num']; + if(weight_free > 0){ + out_of_weight = (weight_free * 1000 ) - goods_weight; + } break; case 3: if (goods_piece < 0) goods_piece = 0; @@ -443,7 +446,6 @@ Page({ break; } var code = th.data.wu_arr[th.data.index].code; - var freight_free = ee.freight_free; //全场满多少包邮 //--全部金额-- var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money; var shipping_price = @@ -470,7 +472,7 @@ Page({ var price = 0, th = this; price += parseFloat(o_shipping_price); //如果是包邮 - if (freight_free > 0 && o_price >= freight_free) { return 0; } + if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0) { return 0; } if (user_addr == null) { return 0; } //计算物流的config item; var item = null; @@ -484,7 +486,7 @@ Page({ item = item.config; if (item == null) return o_shipping_price; //------按重量---------- - if (goods_weight > 0) { + if (goods_weight >= 0 && item['money']) { fw_price = parseFloat(item['money']); if (goods_weight > item['first_weight']) { var fw = goods_weight - item['first_weight']; @@ -492,6 +494,16 @@ Page({ fw_price = fw_price + n * parseFloat(item['add_money']); } } + //------超出重量---------- + if(out_of_weight < 0 && o_price >= freight_free){ + fw_price = parseFloat(item['money']); + var out_of_weight = Math.abs(out_of_weight); + if (out_of_weight > item['first_weight']) { + var fw = out_of_weight - item['first_weight']; + var n = Math.ceil(fw / item['second_weight']) + fw_price = fw_price + n * parseFloat(item['add_money']); + } + } //------按件数---------- if (goods_piece > 0) { fp_price = parseFloat(item['piecemoney']); diff --git a/pages/team/team_show/team_show.js b/pages/team/team_show/team_show.js index 110ef29..0f00042 100644 --- a/pages/team/team_show/team_show.js +++ b/pages/team/team_show/team_show.js @@ -94,18 +94,29 @@ Page({ }, onLoad: function(options) { - wx.setNavigationBarTitle({ title: "拼团订单",}) //var postdata=getApp().globalData.to_group; var postdata=options; - var tg_id = postdata.tg_id, first_leader=options.first_leader; + var tg_id = postdata.tg_id, first_leader=options.first_leader,goods_id=options.goods_id; //如果tg_id是空的话 - if(tg_id==undefined || tg_id==null || tg_id==""){ + if(tg_id==null ||goods_id==null){ var tg_id_str=decodeURIComponent(postdata.scene); tg_id_str=tg_id_str.split("_"); - tg_id=tg_id_str[0]; - if(tg_id_str.length>1){ - first_leader=tg_id_str[1]; + console.log(tg_id_str.length); + //tg_id_str[0] teamgroup.id tg_id_str[1] user_id tg_id_str[2] goods_id + switch(tg_id_str.length){ + case 1: + tg_id=tg_id_str[0]; + break; + case 2: + tg_id=tg_id_str[0]; + first_leader=tg_id_str[1]; + break; + case 3: + tg_id=tg_id_str[0]; + first_leader=tg_id_str[1]; + goods_id=tg_id_str[2]; + break; } } //--判断一下是不是导购-- @@ -118,14 +129,13 @@ Page({ } }) } - - this.setData({tg_id: tg_id }); + this.setData({tg_id: tg_id,goods_id}); getApp().globalData.to_group=null; - var th=this; - getApp().getConfig2(function(e) { - th.setData({ bconfig: e,}); - th.wait_for_store_config(); //获取默认的门店 + var th=this; + getApp().getConfig2(function(e) { + th.setData({ bconfig: e,}); + th.wait_for_store_config(); //获取默认的门店 }) }, @@ -358,17 +368,47 @@ Page({ max_num = 0, min_price = 0, th=this, - that=th; + that=th, + flag=null; + await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2",{ + data:{ + store_id: os.stoid, + is_end: 0, + is_show: 1, + user_id: getApp().globalData.user_id, + pageSize:1000 + } + }).then(res=>{ + let pd_list=res.data.data.pageData; + if(res.data.code==0 && pd_list.length>0){ + flag =pd_list.some(pd=>{ + // if(th.data.goods_id){ + return pd.goods_id==th.data.goods_id; + // } + }) + } + }) + if(!flag){ + wx.showToast({title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000}); + setTimeout(function () { + ut.wx_back(); + }, 1000) + return false; + } //获取活动从表信息team_id,listno团编号(券号) await getApp().request.promiseGet("/api/weshop/teamgroup/get/"+os.stoid+"/"+tg_id, { }).then(res => { + + if(res.data.code !=0 ){ + getApp().showWarning(res.data.msg); + th.go_back(); + return false; + } - - if(res.data.code==0 && res.data && res.data.data ) { + if(res.data && res.data.data ) { teamgroup = res.data.data; - //获取当前时间,并且判断剩余时间 var nt = ut.gettimestamp(); var buy_start_date = ut.formatTime(teamgroup.buy_start_date, "yyyy-MM-dd hh:mm:ss"); @@ -388,7 +428,6 @@ Page({ } } - }) //判断是不是要继续的开关 @@ -433,36 +472,10 @@ Page({ //获取活动表的信息根据活动team_id await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + teamgroup.team_id, { data: {} - }).then(async res => { - var flag=null; + }).then(res => { if (res.data.code == 0) { teamlist = res.data.data; goods_id = res.data.data.goods_id; - - await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1",{ - data:{ - store_id: os.stoid, - is_end: 0, - is_show: 1, - user_id: getApp().globalData.user_id, - pageSize:1000 - } - }).then(res=>{ - let pd_list=res.data.data.pageData; - if(res.data.code==0 && pd_list.length>0){ - flag =pd_list.some(pd=>{ - return pd.goods_id==teamlist['goods_id'] - }) - } - }) - if(!flag){ - wx.showToast({title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000}); - // setTimeout(function () { - ut.wx_back(); - // }, 2000) - return false; - } - //----------查看阶梯团------------ if (teamlist.ct_rylist != "" && teamlist.ct_rylist != null && teamlist.ct_rylist != undefined) { var ct_rylist = JSON.parse(teamlist.ct_rylist); diff --git a/pages/team/team_success/team_success.js b/pages/team/team_success/team_success.js index 0bb3b38..f833456 100644 --- a/pages/team/team_success/team_success.js +++ b/pages/team/team_success/team_success.js @@ -398,19 +398,26 @@ Page({ var app = getApp(); var unit = that.data.screenWidth / 750 * 1.35; var scene=th.data.teamgroup.id; + var goods_id=th.data.teamlist.goods_id; var user_id=getApp().globalData.user_id?getApp().globalData.user_id:0; if(user_id>0){ scene+="_"+user_id; } + if(goods_id !==""){ + scene+="_"+goods_id; + } //二微码 var path3 = os.url+ "/api/wx/open/app/user/getWeAppEwm/"+ os.stoid+"?sceneValue="+scene+"&pageValue=pages/team/team_show/team_show"; + console.log(path3,6000); + //读取文件成功则OK-- wx.getImageInfo({ src: path3, success:function (res) { + console.log(res,5000); //回调写法 th.get_head_temp(th.get_goods_temp,function () { var vpath = res.path; @@ -812,7 +819,8 @@ Page({ onShareAppMessage: function (e) { var th=this; var scene=this.data.teamgroup.id; - var url="/pages/team/team_show/team_show?tg_id="+scene; + var goods_id=this.data.teamlist.goods_id; + var url="/pages/team/team_show/team_show?tg_id="+scene+"&goods_id"+goods_id; //--分享图片-- var img=th.data.iurl+th.data.teamlist.share_imgurl; //--把会员分享出去-- @@ -828,7 +836,6 @@ Page({ if(th.data.teamlist.share_title){ share_title=th.data.teamlist.share_title; } - console.log(url,3000); return { path:url, title: share_title,