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 ed69f2c..8febce7 100644 --- a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js +++ b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js @@ -537,11 +537,12 @@ Page({ var cut_good_weight = 0; for (let i in gd_arr_list) { let item = gd_arr_list[i]; - if (back_data && back_data['is_by_all'] && !back_data.no_free_goods) { - continue; - } - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) { - if (item['exp_sum_type'] == 2) { + + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { + + + if (item['exp_sum_type'] == 2) { + goods_weight += item['weight'] * item['buynum']; cut_good_weight += item['weight'] * item['buynum']; } if (back_data.weight_free > 0) { diff --git a/packageC/pages/presell/cart/cart.js b/packageC/pages/presell/cart/cart.js index 6c7eb10..7fc3c63 100644 --- a/packageC/pages/presell/cart/cart.js +++ b/packageC/pages/presell/cart/cart.js @@ -1821,12 +1821,11 @@ Page({ var cut_good_weight = 0; for (let i in gd_arr_list) { let item = gd_arr_list[i]; - if (back_data && back_data['is_by_all'] && !back_data.no_free_goods) { - continue; - } - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) { + + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { if (item['exp_sum_type'] == 2) { - cut_good_weight += item['weight'] * item['buynum']; + goods_weight += item['weight'] * item['buynum']; + cut_good_weight += item['weight'] * item['buynum']; } if (back_data.weight_free > 0) { out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; diff --git a/packageC/pages/presell/cart/cart2.js b/packageC/pages/presell/cart/cart2.js index a7df533..a3b371f 100644 --- a/packageC/pages/presell/cart/cart2.js +++ b/packageC/pages/presell/cart/cart2.js @@ -697,10 +697,8 @@ Page({ var cut_good_weight = 0; for (let i in gd_arr_list) { let item = gd_arr_list[i]; - if (back_data && back_data['is_by_all'] && !back_data.no_free_goods) { - continue; - } - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) { + + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { if (item['exp_sum_type'] == 2) { cut_good_weight += item['weight'] * item['buynum']; } diff --git a/packageC/pages/presell/cart/cart2_pre.js b/packageC/pages/presell/cart/cart2_pre.js index 750209c..4a882e4 100644 --- a/packageC/pages/presell/cart/cart2_pre.js +++ b/packageC/pages/presell/cart/cart2_pre.js @@ -366,17 +366,17 @@ Page({ var cut_good_weight = 0; for (let i in gd_arr_list) { let item = data[i]; - if (back_data && back_data['is_by_all'] && !back_data.no_free_goods) { - continue; - } - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) { + + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { if (item['exp_sum_type'] == 2) { - cut_good_weight += item['weight'] * item['buynum']; - } - if (back_data.weight_free > 0) { - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; + goods_weight += item['weight'] * item['buynum']; + cut_good_weight += item['weight'] * item['buynum']; } - continue; + if (back_data.weight_free > 0) { + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; + } + continue; + } switch (item['exp_sum_type']) { diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index a3ae08d..dd7dd02 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -1737,17 +1737,18 @@ Page({ if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1 && th.data.is_quan_by[pickid]) { continue; } - if (back_data && back_data['is_by_all'] && !back_data.no_free_goods) { - continue; - } - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item[j].goods_id) == -1) { - if (item[j]['exp_sum_type'] == 2) { + + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item[j].goods_id) == -1)) { + + if (item[j]['exp_sum_type'] == 2) { cut_good_weight += item[j]['weight'] * item[j]['goods_num']; + goods_weight += item[j]['weight'] * item[j]['goods_num']; } - if (back_data.weight_free > 0) { - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; - } - continue; + if (back_data.weight_free > 0) { + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; + } + continue; + } switch (item[j]['exp_sum_type']) { @@ -2128,17 +2129,17 @@ Page({ var cut_good_weight = 0; for (let i in gd_arr_list) { let item = gd_arr_list[i]; - if (back_data && back_data['is_by_all']) { - if(!back_data.no_free_goods || !back_data.no_free_goods.length) continue; - } - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) { + + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { if (item['exp_sum_type'] == 2) { - cut_good_weight += item['weight'] * item['buynum']; - } - if (back_data.weight_free > 0) { - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; + goods_weight += item['weight'] * item['buynum']; + cut_good_weight += item['weight'] * item['buynum']; } - continue; + if (back_data.weight_free > 0) { + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; + } + continue; + } switch (item['exp_sum_type']) { diff --git a/pages/cart/cart2_inte/cart2_inte.js b/pages/cart/cart2_inte/cart2_inte.js index 46f596d..c62df2c 100644 --- a/pages/cart/cart2_inte/cart2_inte.js +++ b/pages/cart/cart2_inte/cart2_inte.js @@ -451,12 +451,10 @@ Page({ var cut_good_weight = 0; for (let i in gd_arr_list) { let item = gd_arr_list[i]; - if (back_data && back_data['is_by_all']) { - if(!back_data.no_free_goods || !back_data.no_free_goods.length) continue; - } - - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) { + + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1) ) { if (item['exp_sum_type'] == 2) { + goods_weight += item['weight'] * item['buynum']; cut_good_weight += item['weight'] * item['buynum']; } if (back_data.weight_free > 0) { diff --git a/pages/cart/cart2_pt/cart2_pt.js b/pages/cart/cart2_pt/cart2_pt.js index 62a1635..a31009f 100644 --- a/pages/cart/cart2_pt/cart2_pt.js +++ b/pages/cart/cart2_pt/cart2_pt.js @@ -428,10 +428,8 @@ Page({ var cut_good_weight = 0; for (let i in gd_arr_list) { let item = gd_arr_list[i]; - if (back_data && back_data['is_by_all'] && !back_data.no_free_goods) { - continue; - } - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) { + + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { if (item['exp_sum_type'] == 2) { cut_good_weight += item['weight'] * item['buynum']; } diff --git a/pages/cart/cart_wk/cart_wk.js b/pages/cart/cart_wk/cart_wk.js index 261c02e..0d0d3cb 100644 --- a/pages/cart/cart_wk/cart_wk.js +++ b/pages/cart/cart_wk/cart_wk.js @@ -491,12 +491,11 @@ Page({ var cut_good_weight = 0; for (let i in gd_arr_list) { let item = gd_arr_list[i]; - if (back_data && back_data['is_by_all']) { - if(!back_data.no_free_goods || !back_data.no_free_goods.length) continue; - } - if (back_data && back_data['is_by_all'] && back_data.no_free_goods.indexOf(item.goods_id) == -1) { + + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { if (item['exp_sum_type'] == 2) { - cut_good_weight += item['weight'] * item['buynum']; + goods_weight += item['weight'] * item['buynum']; + cut_good_weight += item['weight'] * item['buynum']; } if (back_data.weight_free > 0) { out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index 541124f..2da23ec 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -228,6 +228,11 @@ Page({ giftTitle: res.data.data.giftTitle, default_color: res.data.data.bgcolor }) + + if(res.data.data.iswarelbtype==1) { + th.setData({iswarelbtype:1}) + } + if (!res.data.data.giftRemark || res.data.data.giftRemark == '') { th.setData({ giftRemark: '暂无详情......' diff --git a/pages/giftpack/giftpacklist/giftpacklist.wxml b/pages/giftpack/giftpacklist/giftpacklist.wxml index 07f7ad8..b145b27 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.wxml +++ b/pages/giftpack/giftpacklist/giftpacklist.wxml @@ -18,13 +18,13 @@ - {{"兑换结束时间:"+giftDate}} + {{"兑换结束时间:"+giftDate}} {{"活动结束时间:"+giftDate}} - + {{"兑换时间:领取后"+exchangeDay+"天内兑换"}} diff --git a/pages/giftpack/mygiftpack/mygiftpack.wxml b/pages/giftpack/mygiftpack/mygiftpack.wxml index 3adf1e9..8b9b359 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.wxml +++ b/pages/giftpack/mygiftpack/mygiftpack.wxml @@ -81,7 +81,8 @@ {{"零售价:¥"+item.giftPosPrice}} - + + {{"兑换截至日期:"+item.endTime}} @@ -89,6 +90,7 @@ {{"距兑换开始时间: "+item.starTime}} + diff --git a/pages/team/team_success/team_success.wxml b/pages/team/team_success/team_success.wxml index b6e6d69..14ae682 100644 --- a/pages/team/team_success/team_success.wxml +++ b/pages/team/team_success/team_success.wxml @@ -96,7 +96,8 @@ 团长 - + + diff --git a/utils/util.js b/utils/util.js index c5dbcd7..6dc7f0a 100644 --- a/utils/util.js +++ b/utils/util.js @@ -514,6 +514,83 @@ function wx_back() { } } + +//-------------------计算物流--------------- +function calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, + goods_piece, user_addr, back_data,rs) { + var price = 0; + price += parseFloat(o_shipping_price); + if (user_addr == null) { + return 0; + } + //如果是包邮 + if (back_data && back_data.is_by_all && !back_data.no_free_goods && out_of_weight >= 0) { + return 0; + } + //计算物流的config item; + var item = null; + + //------------循环获取config----------- + function get_wuliu_config(region_id, code, rs) { + var item = null, rslist = rs.pageData; + for (var i = 0; i < rslist.length; i++) { + if (rslist[i].code == code && rslist[i].region_id == region_id) { + item = rslist[i]; + } + } + return item; + } + //-------循环获取config,code default------- + function get_wuliu_default(code, rs) { + var item = null, rslist = rs.pageData; + for (var i = 0; i < rslist.length; i++) { + if (rslist[i].shipping_code == code && rslist[i].is_default == 1) { + item = rslist[i]; + } + } + return item; + } + + //先根据 镇 县 区找计算的config + item = get_wuliu_config(user_addr.district, code, rs); + if (item == null) item = get_wuliu_config(user_addr.city, code, rs); + if (item == null) item = get_wuliu_config(user_addr.province, code, rs); + if (item == null) item = get_wuliu_default(code, rs); + if (item == null) return o_shipping_price; + var fw_price = 0, fp_price = 0; + item = item.config; + if (item == null) return o_shipping_price; + + //------超出重量---------- + if (back_data && back_data.is_by_all && out_of_weight<0){ + goods_weight+=out_of_weight; + if(goods_weight<=0) goods_weight=-1; + } + + //------按重量---------- + if (goods_weight >= 0 && item['money']) { + fw_price = parseFloat(item['money']); + if (goods_weight > item['first_weight']) { + var fw = goods_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']); + if (goods_piece > item['first_piece']) { + var fp = goods_piece - item['first_piece']; + var m = Math.ceil(fp / item['second_piece']) + fp_price = fp_price + m * parseFloat(item['add_piecemoney']); + } + } + + var rspice = parseFloat(price + fw_price + fp_price); + return rspice; +} + module.exports = { formatTime: function(e, r) { var t = e ? new Date(1e3 * e) : new Date(), n = t.getFullYear(), o = t.getMonth() + 1, a = t.getDate(), u = t.getHours(), i = t.getMinutes(), f = t.getSeconds(), s = function(e) { @@ -627,4 +704,5 @@ module.exports = { ajax_ok2:ajax_ok2, //将JS数组对象按其某个键值重组成Map对象 wx_back:wx_back, _debounce, + calculatewuliu:calculatewuliu, //计算物流的函数进行抽象 };