diff --git a/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js b/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js index ccc853c..3a1f24b 100644 --- a/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js +++ b/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js @@ -121,22 +121,22 @@ Page({ tabs: ['门店自提', '快递邮寄'], currentTabIndex: 1, - in_zhact_gdmap:{}, //不同门店参与同一活动的限购 - hid_inp:1, - user_note:{}, - zuhe_map_good:{}, + in_zhact_gdmap: {}, //不同门店参与同一活动的限购 + hid_inp: 1, + user_note: {}, + zuhe_map_good: {}, }, - + onLoad: function (t) { - wx.setNavigationBarTitle({title: "填写订单",}) + wx.setNavigationBarTitle({ title: "填写订单", }) var th = this; - this.setData({is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,}); + this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, }); th.data.param = t; //清理一下,确保最新的系统配置 getApp().globalData.config2 = null; //清空is_pick_up getApp().request.put("/api/weshop/useraddress/updatePickUp", { - data: {user_id: getApp().globalData.user_id, is_pickup: 0}, + data: { user_id: getApp().globalData.user_id, is_pickup: 0 }, success: function (s) { } }); @@ -144,7 +144,7 @@ Page({ }, onUnload: function () { - this.setData({isclose: 1}) + this.setData({ isclose: 1 }) }, onHide: function () { this.setData({ @@ -157,7 +157,7 @@ Page({ //----------子页返回父页触发---------- onShow: function () { var th = this; - th.setData({show_submit: 0}); //让提交先掩藏 + th.setData({ show_submit: 0 }); //让提交先掩藏 th.data.g_cart_q_time = null; if (th.data.isclose == 0) { @@ -190,20 +190,20 @@ Page({ th.data.is_summit_ing = 0; //更换地址回来要重新调用计算价钱的接口 if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) { - th.setData({user_addr: ie}); + th.setData({ user_addr: ie }); if (th.data.is_b_now == 1) { if (th.data.bn_goods) { - th.setData({add_back: 1}); + th.setData({ add_back: 1 }); //th.calculatePrice2(); } } else { if (th.data.cartlist) { - th.setData({add_back: 1}); + th.setData({ add_back: 1 }); //th.calculatePrice(); } } } else { - th.setData({user_addr: ie}); + th.setData({ user_addr: ie }); } var going = 0; @@ -257,34 +257,34 @@ Page({ //-- 获取所有的等级卡, -- getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid, {}).then(res => { - if (res.data.code == 0) { - var plusCard = res.data.data; - //-- 循环判断,拿到最贵的那张卡 -- - for (var ih in plusCard) { - if (plusCard[ih].IsStopBuy == true) { - continue; - } - if (max_price < 0) { - max_price = plusCard[ih].CardFee; - name = 'card' + plusCard[ih]['CorrPrice']; - show_card = plusCard[ih]; - } else { - if (max_price < plusCard[ih].CardFee) { + if (res.data.code == 0) { + var plusCard = res.data.data; + //-- 循环判断,拿到最贵的那张卡 -- + for (var ih in plusCard) { + if (plusCard[ih].IsStopBuy == true) { + continue; + } + if (max_price < 0) { max_price = plusCard[ih].CardFee; name = 'card' + plusCard[ih]['CorrPrice']; show_card = plusCard[ih]; + } else { + if (max_price < plusCard[ih].CardFee) { + max_price = plusCard[ih].CardFee; + name = 'card' + plusCard[ih]['CorrPrice']; + show_card = plusCard[ih]; + } } } - } - if (show_card) { - name = name.toLowerCase(); - th.setData({card_name: name, show_card: show_card}) + if (show_card) { + name = name.toLowerCase(); + th.setData({ card_name: name, show_card: show_card }) + } } - } - //-----先获取物流,再获取用户信息,再展示页面----- - th.get_wuliu(th.get_info(th.show_page)); - }) + //-----先获取物流,再获取用户信息,再展示页面----- + th.get_wuliu(th.get_info(th.show_page)); + }) } else { //-----先获取物流,再获取用户信息,再展示页面----- th.get_wuliu(th.get_info(th.show_page)); @@ -303,10 +303,10 @@ Page({ if (th.data.is_default_logistics) { //如果第一个不是开启默认,说明要让用户自己选 if (!e[0].is_default) { - th.setData({is_default_logistics: 0}); + th.setData({ is_default_logistics: 0 }); } } - th.setData({wu_arr: e}) + th.setData({ wu_arr: e }) typeof func == "function" && func(); }) }, @@ -320,7 +320,7 @@ Page({ getuser_addr: function (func) { var th = this; a.get("/api/weshop/useraddress/page", { - data: {user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random()}, + data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random() }, success: function (su) { /*--- var user_addr=[ @@ -345,7 +345,7 @@ Page({ } if (item == undefined) item = null; - if (!item) th.setData({user_addr: null}); //地址为空的时候,要清空,因为返回的时候,有缓存 + if (!item) th.setData({ user_addr: null }); //地址为空的时候,要清空,因为返回的时候,有缓存 func(item); } @@ -360,19 +360,19 @@ Page({ //会员的信息,要获取最新 var user = getApp().globalData.userInfo; getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, { - data: {r: Math.random()}, + data: { r: Math.random() }, success: function (e) { getApp().globalData.userInfo = e.data.data; - th.setData({userinfo: e.data.data}); + th.setData({ userinfo: e.data.data }); //选获取地址 th.getuser_addr(function (addr) { - th.setData({user_addr: addr}); + th.setData({ user_addr: addr }); //--------------------------立即购买------------------ if (ta.is_bnow == 1) { //读取门店 to.get_allsto(function (e) { - th.setData({allsto: e}); + th.setData({ allsto: e }); //获取立即购买的商品信息 th.get_buy_goods(ta.goods_id); }); @@ -380,7 +380,7 @@ Page({ //------------------------购物车结算---------------------- //读取门店 to.get_allsto(function (e) { - th.setData({allsto: e}); + th.setData({ allsto: e }); //-------获取购物车已经选择的商品-------- th.get_cart(); }) @@ -389,12 +389,12 @@ Page({ //获取提现金额 getApp().request.get("/api/weshop/withdrawals/summoney", { - data: {user_id: to.globalData.user_id, store_id: oo.stoid, status: 0}, + data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 }, success: function (su) { if (su.data.code == 0) { var yuer = parseFloat(th.data.userinfo.user_money - (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2); - th.setData({txmon: su.data.data.summoney, yuer: yuer}); + th.setData({ txmon: su.data.data.summoney, yuer: yuer }); } } }); @@ -418,7 +418,7 @@ Page({ var arr = new Array(); var carr = su.data.data.pageData; th.data.cartlist_y = carr; //存储原始购物车列表 - th.data.in_zhact_gdmap={}; + th.data.in_zhact_gdmap = {}; //---是不是购买等级卡成功的返回---等级卡显示的判断--- var is_card_back = getApp().globalData.is_card_back; @@ -427,7 +427,7 @@ Page({ var item1 = carr[i]; //把已经购买了多少见的内容填入 - var goodsbuynum=0,promgoodsbuynum=0; + var goodsbuynum = 0, promgoodsbuynum = 0; //--要获得商品,该用户买了多少件,同步应用-- await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { data: { @@ -445,7 +445,7 @@ Page({ goodsbuynum = buy_num_data.goodsbuynum; }) //如果有购买活动 - item1.promgoodsbuynum=promgoodsbuynum; + item1.promgoodsbuynum = promgoodsbuynum; //要把优惠活动加入,prom_goods_map中,赠品不要运算 if (item1.prom_type == 3 && item1.is_gift != 1) { @@ -455,9 +455,9 @@ Page({ //要把组合购的东西拿出来算一下 if (item1.prom_type == 7) { var isok = 1; - var is_flag=1; + var is_flag = 1; //如果有组合购 - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item1.prom_id+'/'+getApp().globalData.userInfo.user_id; + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item1.prom_id + '/' + getApp().globalData.userInfo.user_id; await getApp().request.promiseGet(url, {}).then(res => { if (res.data.code == 0 && res.data.data) { //如果活动已经结束 @@ -488,16 +488,16 @@ Page({ data: req_data }).then(res => { if (ut.ajax_ok(res)) { - var gdlist = res.data.data.pageData; - gdlist.forEach(i=>{ - if(item1.goods_id==i.goods_id&&!is_flag){ - item1.prom_type=0; - item1.prom_type1=0; - item1.prom_id=0; - item1.prom_id1=0 + var gdlist = res.data.data.pageData; + gdlist.forEach(i => { + if (item1.goods_id == i.goods_id && !is_flag) { + item1.prom_type = 0; + item1.prom_type1 = 0; + item1.prom_id = 0; + item1.prom_id1 = 0 } }) - th.data.zuhe_map_good[item1.prom_id]=gdlist; + th.data.zuhe_map_good[item1.prom_id] = gdlist; } }) } @@ -532,7 +532,7 @@ Page({ item.original_img = oo.imghost + item.original_img; - var car_item=item; + var car_item = item; /*----接口要弄出来的,先顶着-----*/ var pcid = car_item.pick_id; var find = 0; @@ -560,7 +560,7 @@ Page({ break; } arr[j].exp_type = e_t; - if (e_t == 0) th.setData({is_all_zt: 0}); + if (e_t == 0) th.setData({ is_all_zt: 0 }); //} //-- 把等级卡会优惠多少钱装进去 -- @@ -603,7 +603,7 @@ Page({ break; } //如果是物流的话,全部自提的控制要弄成0 - if (e_t == 0) th.setData({is_all_zt: 0}); + if (e_t == 0) th.setData({ is_all_zt: 0 }); var narr = new Array(); narr.push(car_item); @@ -662,11 +662,11 @@ Page({ var offline_price = 0; var offline_num = 0; for (var c = 0; c < item.length; c++) { - if(th.data.sales_rules!=2){ - item[c].offline_price=0; + if (th.data.sales_rules != 2) { + item[c].offline_price = 0; } //-- 如果这个商品是线下取价的时候 -- - if (item[c].offline_price > 0 && item[c].prom_type != 7 ) { + if (item[c].offline_price > 0 && item[c].prom_type != 7) { offline_price += (item[c].goods_price - item[c].offline_price) * item[c].goods_num; offline_num += item[c].goods_num; } @@ -689,10 +689,10 @@ Page({ //存储不同活动的商品列表 u_item.zh_prom_goods = {}; for (let var1 in obj) { - var h_item=obj[var1]; - var gdlist= th.data.zuhe_map_good[h_item.prom_id]; - //获取活动需要的商品列表 - // u_item.zh_prom_goods[h_item.prom_id]=gdlist; + var h_item = obj[var1]; + var gdlist = th.data.zuhe_map_good[h_item.prom_id]; + //获取活动需要的商品列表 + // u_item.zh_prom_goods[h_item.prom_id]=gdlist; // var h_item = obj[var1]; // var gdlist = null; // var url1 = "/api/weshop/prom/zhbuyGoods/page"; @@ -710,7 +710,7 @@ Page({ // } // }) //获取活动需要的商品列表 - u_item.zh_prom_goods[h_item.prom_id] = {gdlist: gdlist, act: h_item.act}; + u_item.zh_prom_goods[h_item.prom_id] = { gdlist: gdlist, act: h_item.act }; } zh_calc.fir_set_arr(u_item, th); } @@ -723,7 +723,7 @@ Page({ setTimeout(function () { var frozenQuan = null; var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; - app.request.promiseGet(url0, {1: 1}).then(res => { + app.request.promiseGet(url0, { 1: 1 }).then(res => { if (res.data.code == 0) { frozenQuan = res.data.data; th.data.frozenQuan = frozenQuan; @@ -794,7 +794,7 @@ Page({ th.data.card_name = th.data.userinfo.card_field; gg.goods_price = gd[th.data.card_name]; getApp().globalData.is_card_back = 0; - th.setData({card_cut_price: 0}); + th.setData({ card_cut_price: 0 }); //如果是秒杀的返回 if (gd.prom_type == 1) gd.prom_type = 0; } else { @@ -802,13 +802,13 @@ Page({ //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 -- if (!gg.collocation_goods && gd['prom_type'] != 6 && th.data.card_name && gd[th.data.card_name] > 0 && gg.goods_price > gd[th.data.card_name] && !th.data.userinfo.card_field) { var cut_p = (gg.goods_price - gd[th.data.card_name]) * gg.goods_num; - th.setData({card_cut_price: cut_p}); + th.setData({ card_cut_price: cut_p }); } } - gd.prom_type=gg.prom_type; - gd.prom_id=gg.prom_id; + gd.prom_type = gg.prom_type; + gd.prom_id = gg.prom_id; switch (gd.prom_type) { case 0: @@ -872,7 +872,7 @@ Page({ ob.exp_sum_type = data.gift_exp_sum_type; //商品的物流计算方式 ob.uniform_exp_sum = data.gift_uniform_exp_sum //统一运费的金额 - th.setData({buy_now_gift_goods: ob}); + th.setData({ buy_now_gift_goods: ob }); } } @@ -900,7 +900,7 @@ Page({ t.data.data.guide_id = gg.guide_id; t.data.data.guide_type = gg.guide_type; } - th.setData({collocation_goods: gg.collocation_goods}); + th.setData({ collocation_goods: gg.collocation_goods }); var cart_arr = new Array(); //var narr=gg.collocation_goods; @@ -915,7 +915,7 @@ Page({ for (var hi in narr) { var dis_t = narr[hi].distr_type; if (dis_t == 2) { - th.setData({is_all_zt: 0}); + th.setData({ is_all_zt: 0 }); et = 0; } if (dis_t > 0) { @@ -957,7 +957,7 @@ Page({ if (gg.prom_type == 5) { var frozenQuan = null; var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; - app.request.promiseGet(url0, {1: 1}).then(res => { + app.request.promiseGet(url0, { 1: 1 }).then(res => { if (res.data.code == 0) { frozenQuan = res.data.data; th.data.frozenQuan = frozenQuan; @@ -978,13 +978,13 @@ Page({ case 1: //---秒杀----- var quanlist = null; getApp().request.get("/api/weshop/activitylist/getSJGoodsPriceNew/" + gd.store_id - + "/" + gd.goods_id + "/1/" + gd.prom_id+"/"+app.globalData.user_id, { + + "/" + gd.goods_id + "/1/" + gd.prom_id + "/" + app.globalData.user_id, { success: async function (tt) { if (tt.data.code == 0) { //t.data.data.shop_price = tt.data.data.prom_price; t.data.data.shop_price = tt.data.data.prom_user_price; - th.data.ckeck_quan_price=0; - gd.is_xz_yh=1; + th.data.ckeck_quan_price = 0; + gd.is_xz_yh = 1; } else { t.data.data.prom_id = 0; t.data.data.prom_type = 0; @@ -1006,7 +1006,7 @@ Page({ //计算价格 th.calculatePrice2(); //获取优惠券,如果有券的钱,就调用 - if(th.data.ckeck_quan_price>0) th.get_buy_now_quan(); + if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan(); } }); @@ -1014,7 +1014,7 @@ Page({ case 2: //--- 团购 --- var quanlist = null; - getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" +os.stoid + "/" +gd.goods_id+"/"+ gd.prom_id, { + getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gd.goods_id + "/" + gd.prom_id, { success: async function (tt) { if (tt.data.code == 0) { //t.data.data.shop_price = tt.data.data.prom_price; @@ -1024,12 +1024,12 @@ Page({ t.data.data.prom_type = 0; } - if(tt.data.data.isQuan){ + if (tt.data.data.isQuan) { th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; th.data.check_quan_ware_list = t.data.data.erpwareid + ""; - }else{ - gd.is_xz_yh=1; + } else { + gd.is_xz_yh = 1; } th.setData({ @@ -1045,7 +1045,7 @@ Page({ //-- 计算价格 -- th.calculatePrice2(); //获取优惠券,如果有券的钱,就调用 - if(th.data.ckeck_quan_price>0) th.get_buy_now_quan(); + if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan(); } }); @@ -1060,14 +1060,14 @@ Page({ checkAddressList: function () { var t = this; return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ - title: "请先填写或选择收货地址~", - success: function (a) { - a.confirm ? t.enterAddressPage() : wx.navigateBack(); - }, - fail: function () { - wx.navigateBack(); - } - }), !1); + title: "请先填写或选择收货地址~", + success: function (a) { + a.confirm ? t.enterAddressPage() : wx.navigateBack(); + }, + fail: function () { + wx.navigateBack(); + } + }), !1); }, showInvoice: function () { this.setData({ @@ -1086,7 +1086,7 @@ Page({ }, keyUpChangeNum: function (t) { var index = t.currentTarget.dataset.index; - var txt="user_note."+index; + var txt = "user_note." + index; this.setData({ maxWord: t.detail.value.length, [txt]: t.detail.value @@ -1176,7 +1176,7 @@ Page({ } var pt_res = null; - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { is_json: 1, data: pt_data }).then(res => { @@ -1231,11 +1231,11 @@ Page({ 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}]; + 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}) + cart_item.g_coupon_num.push({ 'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num }) } } @@ -1243,11 +1243,11 @@ Page({ 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}]; + 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}) + cart_item.g_lb_num.push({ 'l_id': item_map.s_libao, "num": item_map.s_lb_num }) } } } @@ -1272,7 +1272,7 @@ Page({ var all_cutprice = 0; //所有的优惠减 var all_zh_cutprice = 0; //所有的组合优惠减 var all_order_prom = 0; //所有的订单优惠 - var out_of_weight=0; //超出多少重量 + var out_of_weight = 0; //超出多少重量 var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : 0); var freight_free = ee.freight_free; //全场满多少包邮 var weight_free = ee.weight_free; //多少kg内包邮 @@ -1283,7 +1283,7 @@ Page({ if (no_ex_id && freight_free > 0) { //-----------获取不包邮区域,不包邮商品------- await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { - data: {store_id: os.stoid, id: no_ex_id} + data: { store_id: os.stoid, id: no_ex_id } }).then(res => { if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { by_qc = res.data.data[0]; @@ -1303,7 +1303,7 @@ Page({ //调用函数计算每件商品的单价 await th.calc_per(c_arr); //调用函数计算每件组合购商品的单价, - await zh_calc.calc_zh_split_price(c_arr,th); + await zh_calc.calc_zh_split_price(c_arr, th); //调用函数计算,优惠券优惠什么商品价格,优惠券优惠什么商品 await th.get_cart_quan(c_arr); //---循环购物车--- @@ -1326,7 +1326,7 @@ Page({ var cart_item = c_arr[i]; //就是每一单的意思 var pickid = cart_item.pickup_id; var o_price = 0; - var o_price_no_zh=0; //参与订单优惠叠加--组合购的金额汇总 + var o_price_no_zh = 0; //参与订单优惠叠加--组合购的金额汇总 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; var item = c_arr[i].goods; //就是每一单的从表的意思 @@ -1334,8 +1334,8 @@ Page({ var quan_price = 0; var coupon_price = 0; var quan_no = null; - var is_has_zh=c_arr[i].is_has_zh; - var zh_prom_goods=c_arr[i].zh_prom_goods; //组合购计算的原始数据存储空间 + var is_has_zh = c_arr[i].is_has_zh; + var zh_prom_goods = c_arr[i].zh_prom_goods; //组合购计算的原始数据存储空间 if (th.data.using_quan[pickid] != null && th.data.using_quan[pickid] != undefined) quan_no = th.data.using_quan[pickid].coupon_no; @@ -1363,43 +1363,42 @@ Page({ //--------循环计算总价----------- for (var j = 0; j < item.length; j++) { - if(item[j].prom_type!=7){ + if (item[j].prom_type != 7) { o_price_no_zh += item[j].goods_price * item[j].goods_num; } //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 - else if(zh_prom_goods && zh_prom_goods[item[j].prom_id] && zh_prom_goods[item[j].prom_id].act.is_orderyh ) - { + else if (zh_prom_goods && zh_prom_goods[item[j].prom_id] && zh_prom_goods[item[j].prom_id].act.is_orderyh) { o_price_no_zh += item[j].goods_price * item[j].goods_num; } o_price += item[j].goods_price * item[j].goods_num; //判断是否有设置限制重量包邮 - if(item[j]['is_past']!==1 && item[j]['exp_sum_type']==2){ + if (item[j]['is_past'] !== 1 && item[j]['exp_sum_type'] == 2) { if (goods_weight < 0) goods_weight = 0; - //累积商品重量 每种商品的重量 * 数量 + //累积商品重量 每种商品的重量 * 数量 goods_weight += item[j]['weight'] * item[j]['goods_num']; - if(weight_free > 0){ - out_of_weight = (weight_free*1000) - goods_weight; + if (weight_free > 0) { + out_of_weight = (weight_free * 1000) - goods_weight; } } } //判断是不是有组合购的金额 var f_o_price = o_price; //如果又优惠的钱,就要减价 - if (c_arr[i].cut_price > 0){ + if (c_arr[i].cut_price > 0) { o_price -= c_arr[i].cut_price; - o_price_no_zh-=c_arr[i].cut_price; + o_price_no_zh -= c_arr[i].cut_price; } //如果有组合购优惠的钱,就要减价 - if (c_arr[i].zh_cut_price>0 || c_arr[i].zh_cut_price<0){ + if (c_arr[i].zh_cut_price > 0 || c_arr[i].zh_cut_price < 0) { o_price -= c_arr[i].zh_cut_price; - if(o_price_no_zh>0){ + if (o_price_no_zh > 0) { //找到那些可以订单优惠叠加的 - for(let ij in zh_prom_goods){ - let kitem=zh_prom_goods[ij]; - var is_has_zh=kitem.is_has_zh; - if(kitem.act.is_orderyh) - o_price_no_zh-=kitem.cut_price; + for (let ij in zh_prom_goods) { + let kitem = zh_prom_goods[ij]; + var is_has_zh = kitem.is_has_zh; + if (kitem.act.is_orderyh) + o_price_no_zh -= kitem.cut_price; } } } @@ -1407,12 +1406,12 @@ Page({ //-- 计算线下取价的功能 -- if (cart_item.is_offline == 1) { o_price = o_price - cart_item.offline_price; - o_price_no_zh-=c_arr[i].offline_price; + o_price_no_zh -= c_arr[i].offline_price; } //判断包邮券的钱,组合购的商品不使用优惠券 var q_conditin = 0; q_conditin = o_price - quan_price; - if(is_has_zh){ + if (is_has_zh) { q_conditin = o_price_no_zh - quan_price; } cart_item.goods_price = f_o_price.toFixed(2); //商品总费用,用f_o_price来计算 @@ -1426,12 +1425,17 @@ Page({ if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) { if (th.check_by_area(by_qc.region_list)) { freight_free = 0; + goods_weight = -1; + out_of_weight = 0; th.data.is_no_by[pickid] = 1; } } //如果有设置不包邮区商品 if (by_qc.goods_list != "" && by_qc.goods_list != undefined && by_qc != null && freight_free > 0) { freight_free = 0; + goods_weight = -1; + out_of_weight = 0; + th.data.is_no_by[pickid] = 1; no_ex_good = by_qc.goods_list; } } @@ -1446,7 +1450,7 @@ Page({ store_id: os.stoid, isuse: 0, //condition: q_conditin, - condition:cart_item.ckeck_quan_price, + condition: cart_item.ckeck_quan_price, user_id: getApp().globalData.user_id, pageSize: 2000 } @@ -1471,7 +1475,7 @@ Page({ } if (arr) { th.data.get_by_quan_list_cart[pickid] = arr; - th.setData({get_by_quan_list_cart:th.data.get_by_quan_list_cart}); + th.setData({ get_by_quan_list_cart: th.data.get_by_quan_list_cart }); //if (th.data.is_b_now) { // th.setData({get_by_quan_list: arr}); //} @@ -1496,7 +1500,7 @@ Page({ if (ut.isContained(arr, arr2)) { getApp().my_warnning("全场不包邮商品和包邮券的重复", 0, th); th.data.using_quan[pickid] = {}; - th.setData({using_quan: th.data.using_quan}) + th.setData({ using_quan: th.data.using_quan }) return false; } var n_arr = ut.mergeArray(arr, arr2); @@ -1522,7 +1526,7 @@ Page({ } //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮 - if (o_price - quan_price >= freight_free && freight_free > 0 && !is_good_no_by && th.data.is_no_by[pickid] != 1) { + if (o_price - quan_price >= freight_free && freight_free > 0 && !is_good_no_by && th.data.is_no_by[pickid] != 1 && out_of_weight >= 0) { continue; } @@ -1535,7 +1539,7 @@ Page({ if (no_ex_good) no_ex_good_arr = no_ex_good.split(','); //----------------如果是选择了物流--------------------- - if (cart_item.exp_type == 0 && item[j].is_free_shipping == 0 && (!no_ex_good_arr || no_ex_good_arr.indexOf(item[j].goods_id + '') > -1 )) { + if (cart_item.exp_type == 0 && item[j].is_free_shipping == 0 && (!no_ex_good_arr || no_ex_good_arr.indexOf(item[j].goods_id + '') > -1)) { //如果地址不为空 if (th.data.user_addr != null) { @@ -1545,7 +1549,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']; @@ -1559,12 +1563,10 @@ Page({ } } - }else{ - if(item[j]['exp_sum_type']==2){ - if(out_of_weight !==0){ - goods_weight=-1; - out_of_weight=0; - } + } else { + if (item[j]['exp_sum_type'] == 2 && out_of_weight !== 0) { + goods_weight = -1; + out_of_weight = 0; } } } @@ -1576,8 +1578,8 @@ Page({ if (th.data.wu_arr && th.data.wu_arr[cart_item.wind]) code = th.data.wu_arr[cart_item.wind].code; cart_item.shipping_price = - th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight, - goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs); + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, + goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs, pickid); if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) { if (cart_item.shipping_price == 0) th.data.is_by[pickid] = 1; //已经全场包邮,就不要选择券了 @@ -1596,19 +1598,19 @@ Page({ var order_prom_id = 0; var o_condition = cart_item.order_amount; //看一下是不是不用组合购的订单优惠的叠加 - if(is_has_zh){ - o_condition=o_price_no_zh-quan_price; + if (is_has_zh) { + o_condition = o_price_no_zh - quan_price; } var order_m = 0; //---判断是不是有订单优惠--- - await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { - data: {store_id: os.stoid, orderAmount: o_condition} + await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { + data: { store_id: os.stoid, orderAmount: o_condition } }).then(res => { if (res.data.code == 0) { var ord_prom = res.data.data; //么有使用券,或者活动没有限制使用优惠券 - if(quan_price<=0 || !ord_prom.is_xz_yh) { + if (quan_price <= 0 || !ord_prom.is_xz_yh) { order_prom_id = ord_prom['id']; switch (ord_prom['type']) { case 0: @@ -1749,7 +1751,7 @@ Page({ } } var set_txt = "cartlist[" + iter + "].can_num"; - th.setData({[set_txt]: num}); + th.setData({ [set_txt]: num }); } }, @@ -1781,10 +1783,10 @@ Page({ allpice = parseFloat(allpice).toFixed(2); var txt = "formData.all_price"; - th.setData({[txt]: allpice,}); + th.setData({ [txt]: allpice, }); if (cut_price) { var c_txt = "formData.cut_price"; - th.setData({[c_txt]: cut_price,}); + th.setData({ [c_txt]: cut_price, }); } @@ -1798,7 +1800,7 @@ Page({ to.getwuliuprice(async function (rs) { var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; - var out_of_weight=null; //超出多少重量 + 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; @@ -1852,7 +1854,7 @@ Page({ arr.push(item); } if (arr) { - th.setData({get_by_quan_list: arr}); + th.setData({ get_by_quan_list: arr }); } th.data.isget_by_quan[th.data.bn_pick] = 1; } @@ -1868,8 +1870,8 @@ 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; + if (weight_free > 0) { + out_of_weight = (weight_free * 1000) - goods_weight; } break; case 3: @@ -1881,7 +1883,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; - + th.data.is_no_by[th.data.bn_pick] = 0; var no_by_data = null; @@ -1892,7 +1894,7 @@ Page({ if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice) - cut_price - quan_price) { //-----------获取不包邮区域,不包邮商品------- await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { - data: {store_id: os.stoid, id: no_ex_id} + data: { store_id: os.stoid, id: no_ex_id } }).then(res => { if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { no_by_data = res.data.data[0]; @@ -1900,7 +1902,7 @@ Page({ if (res.data.data[0].region_list) { if (th.check_by_area(res.data.data[0].region_list)) { freight_free = 0; - out_of_weight=0; + out_of_weight = 0; th.data.is_no_by[th.data.bn_pick] = 1; } } @@ -1908,7 +1910,7 @@ Page({ if (res.data.data[0].goods_list && freight_free) { if (th.check_by_goods(res.data.data[0].goods_list)) { freight_free = 0; - out_of_weight=0; + out_of_weight = 0; th.data.is_no_by[th.data.bn_pick] = 1; } } @@ -1919,12 +1921,12 @@ Page({ th.data.is_by[th.data.bn_pick] = 0; //--------------开始计算物流------------------ var shipping_price = - th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight, - goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs); + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, + goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs,th.data.bn_pick); //如果有赠品的时候,也要计算赠品的物流费用 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,out_of_weight, + shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, out_of_weight, parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); } @@ -1934,18 +1936,18 @@ Page({ shipping_price = parseFloat(shipping_price).toFixed(2); var wl_txt = "formData.shipping_price"; - th.setData({[wl_txt]: shipping_price,}) + th.setData({ [wl_txt]: shipping_price, }) } else { var wl_txt = "formData.shipping_price"; - th.setData({[wl_txt]: 0,}) + th.setData({ [wl_txt]: 0, }) } if (quan_no) { if (th.data.using_quan[bn_pick].isby == 1) { shipping_price = 0; var wl_txt = "formData.shipping_price"; - th.setData({[wl_txt]: 0,}) + th.setData({ [wl_txt]: 0, }) } } //-----------------支付价,优惠券不减物流----------------- @@ -1966,7 +1968,7 @@ Page({ var ord_prom = th.data.order_prom[th.data.bn_pick]; //么有使用券,或者活动没有限制使用优惠券 - if(coupon_price<=0 || !ord_prom.is_xz_yh) { + if (coupon_price <= 0 || !ord_prom.is_xz_yh) { order_prom_id = ord_prom['id']; switch (ord_prom['type']) { case 0: @@ -1984,7 +1986,7 @@ Page({ if (order_prom_id > 0) { var order_prom_txt1 = "formData.order_prom_id"; var order_prom_txt2 = "formData.order_prom_amount"; - th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) + th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount }) } total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); @@ -1994,7 +1996,7 @@ Page({ order_m = order_m.toFixed(2); var atxt = "formData.total_amount"; - th.setData({[atxt]: total_m,}) + th.setData({ [atxt]: total_m, }) var txt = "formData.user_money"; var txt2 = "formData.order_amount"; @@ -2004,44 +2006,44 @@ Page({ if (th.data.bn_use_money == 1) { if (amoney > order_m) { order_m = parseFloat(order_m).toFixed(2); - th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 }) } else { order_m = parseFloat(order_m) - parseFloat(amoney); order_m = order_m.toFixed(2); - th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) } } else { - th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) } //优惠活动送积分 if (good.s_intValue) { txt = "formData.give_integral"; - th.setData({[txt]: good.s_intValue}); + th.setData({ [txt]: good.s_intValue }); } //优惠送券 if (good.s_coupon_id) { var i_txt = "formData.give_coupon_id"; //这个是json格式的 var i_txt1 = "formData.g_coupon_num"; - var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; + var ob = [{ "num": good.s_coupon_num, "c_id": good.s_coupon_id }]; ob = JSON.stringify(ob); - th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); + th.setData({ [i_txt]: good.s_coupon_id, [i_txt1]: ob }); } //优惠礼包 if (good.s_libao) { var l_txt = "formData.give_lb_id"; //这个是json格式的 var l_txt1 = "formData.g_lb_num"; - var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; + var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }]; ob = JSON.stringify(ob); - th.setData({[l_txt]: good.s_libao, [l_txt1]: ob}); + th.setData({ [l_txt]: good.s_libao, [l_txt1]: ob }); } }) } else { var order_prom_txt1 = "formData.order_prom_id"; var order_prom_txt2 = "formData.order_prom_amount"; - th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0}) + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 }) total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); @@ -2051,7 +2053,7 @@ Page({ total_m = total_m.toFixed(2); order_m = order_m.toFixed(2); - th.setData({[atxt]: total_m,}) + th.setData({ [atxt]: total_m, }) var txt = "formData.user_money"; var txt2 = "formData.order_amount"; @@ -2061,37 +2063,37 @@ Page({ if (th.data.bn_use_money == 1) { if (amoney > order_m) { order_m = parseFloat(order_m).toFixed(2); - th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 }) } else { order_m = parseFloat(order_m) - parseFloat(amoney); order_m = order_m.toFixed(2); - th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) } } else { - th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) } //优惠活动送积分 if (good.s_intValue) { txt = "formData.give_integral"; - th.setData({[txt]: good.s_intValue}); + th.setData({ [txt]: good.s_intValue }); } //优惠送券 if (good.s_coupon_id) { var i_txt = "formData.give_coupon_id"; //这个是json格式的 var i_txt1 = "formData.g_coupon_num"; - var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; + var ob = [{ "num": good.s_coupon_num, "c_id": good.s_coupon_id }]; ob = JSON.stringify(ob); - th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); + th.setData({ [i_txt]: good.s_coupon_id, [i_txt1]: ob }); } //优惠礼包 if (good.s_libao) { var l_txt = "formData.give_lb_id"; //这个是json格式的 var l_txt1 = "formData.g_lb_num"; - var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; + var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }]; ob = JSON.stringify(ob); - th.setData({[l_txt]: good.s_coupon_id, [l_txt1]: ob}); + th.setData({ [l_txt]: good.s_coupon_id, [l_txt1]: ob }); } } @@ -2102,7 +2104,7 @@ Page({ }, //--------------------提交订单----------------------- - async submitForm(t){ + async submitForm(t) { var sub_value = t; if (this.data.is_summit_ing == 1) return false; //--提交中退出-- @@ -2174,7 +2176,7 @@ Page({ } //--判断优惠活动的提交-- - if (th.data.formData.cut_price > 0 ) { + if (th.data.formData.cut_price > 0) { order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2); var ob = [{ "prom_id": th.data.bn_goods.prom_id, @@ -2237,7 +2239,7 @@ Page({ goods.guide_id = gg.guide_id; goods.guide_type = gg.guide_type; //调用接口判断是不是会员 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { if (res.data.code == 0) { goods.guide_name = res.data.data.salesman; goods.guide_sn = res.data.data.salesman_no; @@ -2289,7 +2291,7 @@ Page({ } var pt_res = null; - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { is_json: 1, data: pt_data }).then(res => { @@ -2409,14 +2411,14 @@ Page({ order_prom_list.order_prom_amount = t_item.order_prom_amount; } - order_prom_list.discount_amount =0; + order_prom_list.discount_amount = 0; //--判断优惠活动的提交-- if (t_item.cut_price > 0) { order_prom_list.discount_amount += t_item.cut_price; order_prom_list.prom_pt_json = JSON.stringify(t_item.prom_pt_json); } //--判断组合优惠活动的提交-- - if (t_item.zh_cut_price > 0 || t_item.zh_cut_price<0) { + if (t_item.zh_cut_price > 0 || t_item.zh_cut_price < 0) { order_prom_list.discount_amount += t_item.zh_cut_price; order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json); } @@ -2431,11 +2433,11 @@ Page({ order_prom_list.give_lb_id = t_item.s_libao; order_prom_list.g_lb_num = JSON.stringify(t_item.g_lb_num); } - if (Object.keys(order_prom_list).length > 0){ - if(order_prom_list.discount_amount) - order_prom_list.discount_amount= parseFloat(order_prom_list.discount_amount).toFixed(2); - if(order_prom_list.order_prom_amount) - order_prom_list.order_prom_amount= parseFloat(order_prom_list.order_prom_amount).toFixed(2); + if (Object.keys(order_prom_list).length > 0) { + if (order_prom_list.discount_amount) + order_prom_list.discount_amount = parseFloat(order_prom_list.discount_amount).toFixed(2); + if (order_prom_list.order_prom_amount) + order_prom_list.order_prom_amount = parseFloat(order_prom_list.order_prom_amount).toFixed(2); item.order_prom_list = order_prom_list; } @@ -2459,7 +2461,7 @@ Page({ //-------------让商品添加到商品列表-------------------- for (var k = 0; k < t_item.goods.length; k++) { var g_item = t_item.goods[k]; - if(g_item.goods_num<=0) continue; + if (g_item.goods_num <= 0) continue; var goods = { 'goods_id': g_item.goods_id, 'goods_name': g_item.goods_name, @@ -2472,7 +2474,7 @@ Page({ }; //-- 线下取价也要写入,组合购的商品不能去线下价格 -- - if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type!=7) { + if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type != 7) { goods.goods_price = g_item.offline_price; goods.member_goods_price = g_item.offline_price; goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); @@ -2483,7 +2485,7 @@ Page({ if (t_item.quan_youhui_list && t_item.coupon_price) { for (var kk in t_item.quan_youhui_list) { var you_item = t_item.quan_youhui_list[kk]; - if (g_item.prom_type!=7 && g_item.erpwareid == you_item.WareId) { + if (g_item.prom_type != 7 && g_item.erpwareid == you_item.WareId) { goods.quan_num = you_item.WareCashSum; goods.quan_no = you_item.CashRepNo; } @@ -2493,7 +2495,7 @@ Page({ //--判断活动的类型-- switch (g_item.prom_type) { case 1: - case 2: + case 2: goods.prom_type = g_item.prom_type; goods.prom_id = g_item.prom_id; break; @@ -2535,7 +2537,7 @@ Page({ } //把优惠的平摊结果写进去 - if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account!=undefined)) { + if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account != undefined)) { if (g_item.account >= 0) goods.account = g_item.account; if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu; item.is_discount_amount = 1; @@ -2546,7 +2548,7 @@ Page({ goods.guide_id = g_item.guide_id; goods.guide_type = g_item.guide_type; //调用接口判断是不是会员 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => { + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => { if (res.data.code == 0) { goods.guide_name = res.data.data.salesman; goods.guide_sn = res.data.data.salesman_no; @@ -2572,7 +2574,7 @@ Page({ if (pdata.length == 0) return; var str = JSON.stringify(pdata); - wx.showLoading({title: "加载中"}); + wx.showLoading({ title: "加载中" }); wx.request({ url: oo.url + '/api/weshop/order/createWxdOrder', data: str, @@ -2603,7 +2605,7 @@ Page({ }) //要进行判断,如果是用微信支付,就要跳转到支付界面 if (order_amount > 0) { - th.setData({isclose: 0}); + th.setData({ isclose: 0 }); //void e.jumpToCart4({ // order_sn: data.data, //}, 1); @@ -2618,12 +2620,12 @@ Page({ }, function () { //支付失败 setTimeout(function () { - var cps=getCurrentPages(); - if(cps.length>1){ - wx.navigateBack({delta: 1}) - }else{ - getApp().goto("/pages/index/index/index"); - } + var cps = getCurrentPages(); + if (cps.length > 1) { + wx.navigateBack({ delta: 1 }) + } else { + getApp().goto("/pages/index/index/index"); + } }, 1000) }, oo.stoid); @@ -2641,7 +2643,7 @@ Page({ if (t.data.code == 0) { //app.my_warnning("支付成功",1,th); //setTimeout(function () { - th.setData({isclose: 0}); + th.setData({ isclose: 0 }); wx.redirectTo({ url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data, }) @@ -2666,7 +2668,7 @@ Page({ cancelText: '取消', confirmText: '确定', showCancel: true, - success(res){ + success(res) { if (res.cancel) { return; } else if (res.confirm) { @@ -2700,11 +2702,11 @@ Page({ }, //---确认线下门店的数量足不足--- - async check_store_num(goods_id, pick, goods_num, func){ + async check_store_num(goods_id, pick, goods_num, func) { var lock = 0, pick_no, plist, erpwareid; //先读取门店的lock await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { - data: {store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000} + data: { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 } }).then(res => { if (res.data.code == 0 && res.data.data.total > 0) { for (var i in res.data.data.pageData) @@ -2713,7 +2715,7 @@ Page({ }) //先获取门店的编号 await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, { - data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick } }).then(res => { if (res.data.code == 0) { pick_no = res.data.data.pickup_no; @@ -2721,7 +2723,7 @@ Page({ }) //先获取商品的线下库存 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { - data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick } }).then(res => { if (res.data.code == 0) { erpwareid = res.data.data.erpwareid; @@ -2729,7 +2731,7 @@ Page({ }) //读取线下的门店库存 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { - data: {storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000} + data: { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000 } }).then(res => { if (res.data.code == 0) { plist = res.data.data.pageData[0]; @@ -2771,11 +2773,11 @@ Page({ wl_txt = t.currentTarget.dataset.wl_txt, ont = t.currentTarget.dataset.ont; - th.setData({[txt]: ty}); + th.setData({ [txt]: ty }); var iszt = 1; if (ty == 0) { - th.setData({is_all_zt: 0}); + th.setData({ is_all_zt: 0 }); } else { for (var i = 0; i < th.data.cartlist.length; i++) { var item = th.data.cartlist[i]; @@ -2785,7 +2787,7 @@ Page({ } } - th.setData({is_all_zt: iszt}); + th.setData({ is_all_zt: iszt }); var ind = t.currentTarget.dataset.ind; var c_item = th.data.cartlist[ind]; @@ -2793,7 +2795,7 @@ Page({ if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1) { th.data.using_quan[pickid] = {}; - th.setData({using_quan: th.data.using_quan}); + th.setData({ using_quan: th.data.using_quan }); } @@ -2805,7 +2807,7 @@ Page({ for (var i = 0; i < wu_arr.length; i++) { if (wu_arr[i].shipping_code == def_exp_code) { var set_txt = "cartlist" - th.setData({wl_txt: i}); + th.setData({ wl_txt: i }); } } } @@ -2818,9 +2820,9 @@ Page({ setexptype: function (t) { var th = this; var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; - th.setData({bn_exp_type: ty}); + th.setData({ bn_exp_type: ty }); if (ty == 0) { - th.setData({is_all_zt: 0}); + th.setData({ is_all_zt: 0 }); } //当物流为空的时候。 @@ -2833,7 +2835,7 @@ Page({ if (ty == 1) { th.data.isget_by_quan = {}; if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) { - th.setData({using_quan: {}}); + th.setData({ using_quan: {} }); } } @@ -2843,7 +2845,7 @@ Page({ if (wu_arr != null && wu_arr != "") { for (var i = 0; i < wu_arr.length; i++) { if (wu_arr[i].shipping_code == def_exp_code) { - th.setData({index: i}); + th.setData({ index: i }); } } } @@ -2855,17 +2857,17 @@ Page({ //--------立即购买时,使用余额-------- set_bn_useyuer: function () { var th = this; - th.setData({bn_use_money: !th.data.bn_use_money}); + th.setData({ bn_use_money: !th.data.bn_use_money }); th.calculatePrice2(); }, set_js_useyuer: function () { var th = this; - th.setData({js_use_money: !th.data.js_use_money}); + th.setData({ js_use_money: !th.data.js_use_money }); th.calculatePrice(); }, //-------------------计算物流--------------- - calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight, - goods_piece, user_addr, freight_free, o_price, rs) { + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight, + goods_piece, user_addr, freight_free, o_price, rs, pickid) { var price = 0, th = this; price += parseFloat(o_shipping_price); //如果是包邮 @@ -2896,7 +2898,7 @@ Page({ } } //------超出重量---------- - if(out_of_weight < 0 && o_price >= freight_free){ + if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) { fw_price = parseFloat(item['money']); var out_of_weight = Math.abs(out_of_weight); if (out_of_weight > item['first_weight']) { @@ -2942,13 +2944,13 @@ Page({ //----------立即购买,选择物流------------- bindPickerChange: function (e) { var ind = e.detail.value - this.setData({index: ind}); + this.setData({ index: ind }); this.calculatePrice2(); }, //----------购物车结算,选择物流------------- bindPickerChange_w: function (e) { var ind = e.detail.value, txt = e.currentTarget.dataset.txt; - this.setData({[txt]: ind}); + this.setData({ [txt]: ind }); this.calculatePrice(); }, @@ -2962,7 +2964,7 @@ Page({ if (bn == 1) { - th.setData({open_quan: 1, selected_quan_pick: pickid, disabled: 1}); + th.setData({ open_quan: 1, selected_quan_pick: pickid, disabled: 1 }); } else { //---多单打开券的时候,就要判断券在其他门店是否有使用--- var quanlist = th.data.cartlist[cindx].quan_list; @@ -2988,9 +2990,9 @@ Page({ else get_by_quan_list_cart[i].show_red = 0; } - th.setData({by_quan_list_cart: get_by_quan_list_cart}); + th.setData({ by_quan_list_cart: get_by_quan_list_cart }); } else { - th.setData({by_quan_list_cart: null}); + th.setData({ by_quan_list_cart: null }); } console.log("2222222券的列表", quanlist); @@ -3006,7 +3008,7 @@ Page({ }, close_coupon: function (e) { var th = this; - th.setData({open_quan: 0, disabled: 0}); + th.setData({ open_quan: 0, disabled: 0 }); }, //---判断券时候在已经选择的列表中--- @@ -3077,14 +3079,14 @@ Page({ for (var i in quanlist) { quanlist[i].show_red = 0; } - this.setData({selected_quan_list: quanlist}); + this.setData({ selected_quan_list: quanlist }); var by_quanlist = this.data.get_by_quan_list; if (by_quanlist) { //---所有的券的显示红色选择都清理一遍--- for (var inb in by_quanlist) { by_quanlist[inb].show_red = 0; } - this.setData({get_by_quan_list: by_quanlist}); + this.setData({ get_by_quan_list: by_quanlist }); } var by_cart_list = this.data.by_quan_list_cart; @@ -3093,7 +3095,7 @@ Page({ for (var inc in by_cart_list) { by_cart_list[inc].show_red = 0; } - this.setData({by_quan_list_cart: by_cart_list}); + this.setData({ by_quan_list_cart: by_cart_list }); } var using_quan = this.data.using_quan; @@ -3105,9 +3107,9 @@ Page({ using_quan[th.data.selected_quan_pick].is_nouse_red = 1; } else { - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 }; } - this.setData({using_quan: using_quan, is_coupon: 2222}); + this.setData({ using_quan: using_quan, is_coupon: 2222 }); return; } @@ -3124,9 +3126,9 @@ Page({ using_quan[th.data.selected_quan_pick].is_nouse_red = 0; } else { - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 }; } - this.setData({using_quan: using_quan}); + this.setData({ using_quan: using_quan }); }, @@ -3141,7 +3143,7 @@ Page({ for (var ind in by_quanlist) { by_quanlist[ind].show_red = 0; } - this.setData({get_by_quan_list: by_quanlist}); + this.setData({ get_by_quan_list: by_quanlist }); } //--购物车过来的包邮券-- @@ -3151,7 +3153,7 @@ Page({ for (var ind in by_cart_list) { by_cart_list[ind].show_red = 0; } - this.setData({by_quan_list_cart: by_cart_list}); + this.setData({ by_quan_list_cart: by_cart_list }); } //普通券 var quanlist = this.data.selected_quan_list; @@ -3160,7 +3162,7 @@ Page({ for (var ind in quanlist) { quanlist[ind].show_red = 0; } - this.setData({selected_quan_list: quanlist}); + this.setData({ selected_quan_list: quanlist }); } var th = this; @@ -3171,9 +3173,9 @@ Page({ using_quan[th.data.selected_quan_pick].is_nouse_red = 1; } else { - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 }; } - this.setData({using_quan: using_quan, is_coupon: 2222}); + this.setData({ using_quan: using_quan, is_coupon: 2222 }); return; } @@ -3202,9 +3204,9 @@ Page({ using_quan[th.data.selected_quan_pick].is_nouse_red = 0; } else { - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 }; } - this.setData({using_quan: using_quan}); + this.setData({ using_quan: using_quan }); }, //--确认使用券--- @@ -3264,14 +3266,14 @@ Page({ //选择了的券,看是不是点击了不使用券,点击了不使用优惠券 if (using_quan[pickid]) { if (using_quan[pickid].is_nouse_red == 1) { - using_quan[pickid] = {is_nouse_red: 1}; - th.setData({using_quan: using_quan}); + using_quan[pickid] = { is_nouse_red: 1 }; + th.setData({ using_quan: using_quan }); if (th.data.is_b_now == 1) { th.calculatePrice2(); } else { th.calculatePrice(); } - th.setData({open_quan: 0}); + th.setData({ open_quan: 0 }); return; } } @@ -3290,16 +3292,16 @@ Page({ }; using_quan[pickid].isby = 1; } else { - using_quan[pickid] = {coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0}; + using_quan[pickid] = { coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 }; using_quan[pickid].isby = 0; } - this.setData({using_quan: using_quan}); + this.setData({ using_quan: using_quan }); if (th.data.is_b_now == 1) { th.calculatePrice2(); } else { th.calculatePrice(); } - th.setData({open_quan: 0}); + th.setData({ open_quan: 0 }); }, cart_set_err: function (e) { @@ -3336,7 +3338,7 @@ Page({ var wu_arr_txt = e.currentTarget.dataset.txt; var w_sele_index = e.currentTarget.dataset.w_sele_index; var is_express = null; - var ob = {open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1}; + var ob = { open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1 }; //--如果是多个门店的时候-- if (w_sele_index != undefined) { @@ -3347,20 +3349,20 @@ Page({ }, // 关闭物流的弹窗 close_express: function () { - this.setData({open_express: 0, disabled: 0}); + this.setData({ open_express: 0, disabled: 0 }); }, // 选择物流 click_express_name: function (e) { var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode; var index = e.currentTarget.dataset.idxe; - var ob = {is_express: index, is_shipping_code: shippingcode, disabled: 0}; + var ob = { is_express: index, is_shipping_code: shippingcode, disabled: 0 }; ob[this.data.wu_arr_txt] = index; this.setData(ob); }, //点击确定物流 determine_expres: function (e) { - this.setData({open_express: 0}); + this.setData({ open_express: 0 }); if (this.data.is_b_now == 1) this.calculatePrice2(); else @@ -3380,7 +3382,7 @@ Page({ obj[txt] = is_open; this.setData(obj); - this.setData({disabled: 1}) + this.setData({ disabled: 1 }) }, clik_coupons2: function (e) { @@ -3395,7 +3397,7 @@ Page({ obj[txt] = is_open; this.setData(obj); - this.setData({disabled: 1}) + this.setData({ disabled: 1 }) }, @@ -3404,11 +3406,11 @@ Page({ var th = this; var is_shipping_code = this.data.is_shipping_code getApp().request.put("/api/weshop/users/update", { - data: {user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code}, + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code }, success: function (rse) { if (rse.data.code == 0) { getApp().globalData.userInfo.def_exp_code = is_shipping_code; - th.setData({open_express: 0}); + th.setData({ open_express: 0 }); //----计算此时购物车的价格---- if (th.data.is_b_now == 1) th.calculatePrice2(); else th.calculatePrice(); @@ -3418,7 +3420,7 @@ Page({ }, //更新下默认,在onshow里面 - update_code(){ + update_code() { var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; //--定时器,判断wu_arr不未空-- var uii = setInterval(function () { @@ -3432,7 +3434,7 @@ Page({ } //--如果是立即购买-- if (th.data.is_b_now == 1) { - th.setData({index: m_wind, is_express: m_wind}); + th.setData({ index: m_wind, is_express: m_wind }); } else { var ui = setInterval(function () { if (th.data.cartlist) { @@ -3440,7 +3442,7 @@ Page({ for (var i in c_arr) { c_arr[i].wind = m_wind; } - th.setData({cartlist: c_arr, is_express: m_wind}) + th.setData({ cartlist: c_arr, is_express: m_wind }) clearInterval(ui); } }, 500) @@ -3479,13 +3481,13 @@ Page({ } //--如果是团购,要判断有没有限制使用优惠券 - if(gd.prom_type == 2){ - var prom1=null; + if (gd.prom_type == 2) { + var prom1 = null; await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gd.goods_id + "/" + gd.prom_id, { }).then(res => { if (res.data.code == 0) prom1 = res.data.data; }) - if(!prom1.isQuan){ + if (!prom1.isQuan) { continue; } } @@ -3555,10 +3557,10 @@ Page({ if (th.data.is_b_now) { if (arr && arr.length > 0) { var quanlist = arr[0].quan_list; - th.setData({selected_quan_list: quanlist, cartlist: arr}) + th.setData({ selected_quan_list: quanlist, cartlist: arr }) } } else { - th.setData({cartlist: arr}) + th.setData({ cartlist: arr }) th.set_can_num(); } @@ -3578,7 +3580,7 @@ Page({ if (th.data.is_close_quan != 1 && th.data.bn_goods.is_xz_yh != 1) { var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; var url = "/api/weshop/couponList/getUseCouponList"; - app.request.promiseGet(url0, {1: 1}).then(res => { + app.request.promiseGet(url0, { 1: 1 }).then(res => { if (res.data.code == 0) { frozenQuan = res.data.data; th.data.frozenQuan = frozenQuan; @@ -3596,7 +3598,7 @@ Page({ quanlist = res.data.data.pageData; if (quanlist) { quanlist = th.check_is_frozenQuan(quanlist, frozenQuan); - th.setData({selected_quan_list: quanlist}) + th.setData({ selected_quan_list: quanlist }) } } } @@ -3624,7 +3626,7 @@ Page({ if (!goods_id) goods_id = this.data.bn_goods.goods_id; for (var i in arr) { var item = arr[i]; - if (goods_id == item) return 0; + if (goods_id == item) return 0; } return 1; }, @@ -3695,7 +3697,7 @@ Page({ if (this.data.is_b_now == 1) pick = this.data.bn_pick; //---获取订单优惠--- getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { - data: {store_id: os.stoid, orderAmount: condition} + data: { store_id: os.stoid, orderAmount: condition } }).then(res => { if (res.data.code == 0) { var data = res.data.data; @@ -3717,7 +3719,7 @@ Page({ var ob = map[pickid][item.prom_id]; ob.price += item.goods_price * item.goods_num; ob.goods_num += item.goods_num; - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num }); } else { var prom = null; @@ -3733,7 +3735,7 @@ Page({ ob.is_bz = prom.is_bz; ob.is_xz_yh = prom.is_xz_yh; ob.goods = new Array(); - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num }); map[pickid][item.prom_id] = ob; } } else { @@ -3750,7 +3752,7 @@ Page({ ob.is_bz = prom.is_bz; ob.is_xz_yh = prom.is_xz_yh; ob.goods = new Array(); - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num }); var obj = {}; obj[item.prom_id] = ob; @@ -3760,7 +3762,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, 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; @@ -3776,8 +3778,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: @@ -3795,7 +3798,7 @@ Page({ if (no_by_data && no_by_data.region_list) { if (th.check_by_area(no_by_data.region_list)) { gift_freight_free = 0; - out_of_weight=0; + out_of_weight = 0; th.data.is_no_by[th.data.bn_pick] = 1; } } @@ -3803,14 +3806,15 @@ Page({ if (no_by_data && no_by_data.goods_list && gift_freight_free) { if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { gift_freight_free = 0; - out_of_weight=0; + out_of_weight = 0; + th.data.is_no_by[th.data.bn_pick] = 1; //th.data.is_no_by[th.data.bn_pick]=1; } } var t_shipping_price = - this.calculatewuliu(code, gift_shipping_price, goods_weight,out_of_weight, - goods_piece, user_addr, gift_freight_free, allpice, rs); + this.calculatewuliu(code, gift_shipping_price, goods_weight, out_of_weight, + goods_piece, user_addr, gift_freight_free, allpice, rs, th.data.bn_pick); return t_shipping_price; }, @@ -3867,7 +3871,7 @@ Page({ //跳转关闭弹出框的显示 close_offline: function () { - this.setData({is_offline_show: 0}); + this.setData({ is_offline_show: 0 }); }, //立即购买显示弹出框 @@ -3875,7 +3879,7 @@ Page({ var off_price = this.data.bn_goods.shop_price - this.data.bn_goods.offline_price; //是不是线下 var is_get_offline = this.data.bn_goods.is_offline; - this.setData({is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline}); + this.setData({ is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline }); }, //确定使用线下取价 @@ -3883,14 +3887,14 @@ Page({ var bn_goods = this.data.bn_goods; if (bn_goods && bn_goods.prom_type == 0) { bn_goods.is_offline = 1; - this.setData({is_offline_show: 0, bn_goods: bn_goods}); + this.setData({ is_offline_show: 0, bn_goods: bn_goods }); this.calculatePrice2(); } //就是购物车结算时的 else { var index = this.data.pop_offline_index; var txt = "cartlist[" + index + "].is_offline"; - this.setData({[txt]: 1, is_offline_show: 0,}); + this.setData({ [txt]: 1, is_offline_show: 0, }); this.data.old_cartlist[index].is_offline = 1; this.calculatePrice(); } @@ -3902,14 +3906,14 @@ Page({ var bn_goods = this.data.bn_goods; if (bn_goods && bn_goods.prom_type == 0) { bn_goods.is_offline = 0; - this.setData({is_offline_show: 0, bn_goods: bn_goods}); + this.setData({ is_offline_show: 0, bn_goods: bn_goods }); this.calculatePrice2(); } //就是购物车结算时的 else { var index = this.data.pop_offline_index; var txt = "cartlist[" + index + "].is_offline"; - this.setData({[txt]: 0, is_offline_show: 0,}) + this.setData({ [txt]: 0, is_offline_show: 0, }) this.data.old_cartlist[index].is_offline = 0; this.calculatePrice(); } @@ -3930,19 +3934,19 @@ Page({ }); }, - set_hid_inp:function (e) { + set_hid_inp: function (e) { var index = e.currentTarget.dataset.index; var txt = "cartlist[" + index + "].focus"; - this.setData({[txt]:1}) + this.setData({ [txt]: 1 }) }, - clear_hid_inp:function (e) { + clear_hid_inp: function (e) { var index = e.currentTarget.dataset.index; var txt = "cartlist[" + index + "].focus"; - this.setData({[txt]:0}) + this.setData({ [txt]: 0 }) }, - go_url:function (e) { + go_url: function (e) { var url = e.currentTarget.dataset.url; getApp().goto(url); } diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index 46c7434..28f5edc 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -1647,8 +1647,8 @@ Page({ is_good_no_by = th.check_by_goods(no_ex_good, item[j].goods_id); } - //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮 - if (o_price - quan_price >= freight_free && freight_free > 0 && !is_good_no_by && th.data.is_no_by[pickid] != 1) { + //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮 并且没有超出重量 + if (o_price - quan_price >= freight_free && freight_free > 0 && !is_good_no_by && th.data.is_no_by[pickid] != 1 && out_of_weight >=0 ) { continue; } @@ -1670,15 +1670,14 @@ Page({ //统一运费 o_shipping_price += item[j]['uniform_exp_sum']; break; - case 2: - +'' - if (goods_weight < 0) goods_weight = 0; - //累积商品重量 每种商品的重量 * 数量 - goods_weight += item[j]['weight'] * item[j]['goods_num']; - if (weight_free > 0) { - out_of_weight = (weight_free * 1000) - goods_weight; - } - break; + // case 2: + // if (goods_weight < 0) goods_weight = 0; + // //累积商品重量 每种商品的重量 * 数量 + // goods_weight += item[j]['weight'] * item[j]['goods_num']; + // if (weight_free > 0) { + // out_of_weight = (weight_free * 1000) - goods_weight; + // } + // break; case 3: if (goods_piece < 0) goods_piece = 0; //累积商品数量 @@ -1686,6 +1685,11 @@ Page({ break; } } + }else{ + if(item[j]['exp_sum_type']==2 && out_of_weight!==0){ + goods_weight = -1; + out_of_weight = 0; + } } }