diff --git a/packageC/pages/presell/cart/cart.js b/packageC/pages/presell/cart/cart.js index 75812e0..50c890e 100644 --- a/packageC/pages/presell/cart/cart.js +++ b/packageC/pages/presell/cart/cart.js @@ -2097,7 +2097,7 @@ Page({ if(!ord_prom && !is_get){ if(o_condition > 0 && this.data.pre_arr.is_useorderyh){ await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { - data: { store_id: os.stoid, orderAmount: condition } + data: { store_id: os.stoid, orderAmount: o_condition } }).then(res => { if (res.data.code == 0) { ord_prom = res.data.data; @@ -2107,11 +2107,12 @@ Page({ } + var bn_pick = th.data.pickup.pickup_id //如果同意参与订单优惠 if (ord_prom) { //th.check_is_order_prom(o_condition,async function (ord_price) { var ord_price=o_condition; - var bn_pick = th.data.pickup.pickup_id + var order_prom_amount = 0; var order_prom_id = 0; var order_m = 0; @@ -2227,6 +2228,57 @@ Page({ var o_condition1 = parseFloat(o_condition) - parseFloat(th.data.presell.presell_deposit); if (o_condition1 < 0) o_condition1 = 0; + if(th.data.exp_type == 2) { + var good = th.data.goods; + //--------------开始计算物流------------------ + var shipping_price = 0; + var lon = 0; + var lat = 0; + //-- 获取距离 -- + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { + is_json: 1, data: {address: th.data.user_addr.more_address + th.data.user_addr.address} + }).then(res => { + if (res.data.code == 0) { + var data = JSON.parse(res.data.data); + if (data.status == 0) { + lon = data.result.location.lng; + lat = data.result.location.lat; + } + } + }) + var gd_w = good['weight'] * good['buynum']; + //-- 获取距离 -- + var req_data = { + store_id: os.stoid, + order_amount: parseFloat(o_condition1), + lon: lon, lat: lat, + pickup_id: bn_pick, + goods_weight: gd_w, + } + + var is_next = 1; + //获取同城配送参数 + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", { + is_json: 1, + data: req_data + }).then(res => { + if (res.data.code == 0) { + shipping_price = res.data.data; + } else { + is_next = 0; + wx.showToast({ + title: res.data.msg, icon: 'none', duration: 2000 + }) + } + }) + if (!is_next) { + th.setData({show_submit: 1, disabled_btn: 1}) + return false + } + exp_price = parseFloat(shipping_price).toFixed(2); + } + + var the_price=parseFloat(o_condition1) + parseFloat(exp_price); if(the_price