Commit da3bce01487d256b3272393afe368c7c2275e244
Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into test
Showing
1 changed file
with
55 additions
and
3 deletions
packageC/pages/presell/cart/cart.js
| @@ -2097,7 +2097,7 @@ Page({ | @@ -2097,7 +2097,7 @@ Page({ | ||
| 2097 | if(!ord_prom && !is_get){ | 2097 | if(!ord_prom && !is_get){ |
| 2098 | if(o_condition > 0 && this.data.pre_arr.is_useorderyh){ | 2098 | if(o_condition > 0 && this.data.pre_arr.is_useorderyh){ |
| 2099 | await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { | 2099 | await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { |
| 2100 | - data: { store_id: os.stoid, orderAmount: condition } | 2100 | + data: { store_id: os.stoid, orderAmount: o_condition } |
| 2101 | }).then(res => { | 2101 | }).then(res => { |
| 2102 | if (res.data.code == 0) { | 2102 | if (res.data.code == 0) { |
| 2103 | ord_prom = res.data.data; | 2103 | ord_prom = res.data.data; |
| @@ -2107,11 +2107,12 @@ Page({ | @@ -2107,11 +2107,12 @@ Page({ | ||
| 2107 | } | 2107 | } |
| 2108 | 2108 | ||
| 2109 | 2109 | ||
| 2110 | + var bn_pick = th.data.pickup.pickup_id | ||
| 2110 | //如果同意参与订单优惠 | 2111 | //如果同意参与订单优惠 |
| 2111 | if (ord_prom) { | 2112 | if (ord_prom) { |
| 2112 | //th.check_is_order_prom(o_condition,async function (ord_price) { | 2113 | //th.check_is_order_prom(o_condition,async function (ord_price) { |
| 2113 | var ord_price=o_condition; | 2114 | var ord_price=o_condition; |
| 2114 | - var bn_pick = th.data.pickup.pickup_id | 2115 | + |
| 2115 | var order_prom_amount = 0; | 2116 | var order_prom_amount = 0; |
| 2116 | var order_prom_id = 0; | 2117 | var order_prom_id = 0; |
| 2117 | var order_m = 0; | 2118 | var order_m = 0; |
| @@ -2227,6 +2228,57 @@ Page({ | @@ -2227,6 +2228,57 @@ Page({ | ||
| 2227 | var o_condition1 = parseFloat(o_condition) - parseFloat(th.data.presell.presell_deposit); | 2228 | var o_condition1 = parseFloat(o_condition) - parseFloat(th.data.presell.presell_deposit); |
| 2228 | if (o_condition1 < 0) o_condition1 = 0; | 2229 | if (o_condition1 < 0) o_condition1 = 0; |
| 2229 | 2230 | ||
| 2231 | + if(th.data.exp_type == 2) { | ||
| 2232 | + var good = th.data.goods; | ||
| 2233 | + //--------------开始计算物流------------------ | ||
| 2234 | + var shipping_price = 0; | ||
| 2235 | + var lon = 0; | ||
| 2236 | + var lat = 0; | ||
| 2237 | + //-- 获取距离 -- | ||
| 2238 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { | ||
| 2239 | + is_json: 1, data: {address: th.data.user_addr.more_address + th.data.user_addr.address} | ||
| 2240 | + }).then(res => { | ||
| 2241 | + if (res.data.code == 0) { | ||
| 2242 | + var data = JSON.parse(res.data.data); | ||
| 2243 | + if (data.status == 0) { | ||
| 2244 | + lon = data.result.location.lng; | ||
| 2245 | + lat = data.result.location.lat; | ||
| 2246 | + } | ||
| 2247 | + } | ||
| 2248 | + }) | ||
| 2249 | + var gd_w = good['weight'] * good['buynum']; | ||
| 2250 | + //-- 获取距离 -- | ||
| 2251 | + var req_data = { | ||
| 2252 | + store_id: os.stoid, | ||
| 2253 | + order_amount: parseFloat(o_condition1), | ||
| 2254 | + lon: lon, lat: lat, | ||
| 2255 | + pickup_id: bn_pick, | ||
| 2256 | + goods_weight: gd_w, | ||
| 2257 | + } | ||
| 2258 | + | ||
| 2259 | + var is_next = 1; | ||
| 2260 | + //获取同城配送参数 | ||
| 2261 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", { | ||
| 2262 | + is_json: 1, | ||
| 2263 | + data: req_data | ||
| 2264 | + }).then(res => { | ||
| 2265 | + if (res.data.code == 0) { | ||
| 2266 | + shipping_price = res.data.data; | ||
| 2267 | + } else { | ||
| 2268 | + is_next = 0; | ||
| 2269 | + wx.showToast({ | ||
| 2270 | + title: res.data.msg, icon: 'none', duration: 2000 | ||
| 2271 | + }) | ||
| 2272 | + } | ||
| 2273 | + }) | ||
| 2274 | + if (!is_next) { | ||
| 2275 | + th.setData({show_submit: 1, disabled_btn: 1}) | ||
| 2276 | + return false | ||
| 2277 | + } | ||
| 2278 | + exp_price = parseFloat(shipping_price).toFixed(2); | ||
| 2279 | + } | ||
| 2280 | + | ||
| 2281 | + | ||
| 2230 | var the_price=parseFloat(o_condition1) + parseFloat(exp_price); | 2282 | var the_price=parseFloat(o_condition1) + parseFloat(exp_price); |
| 2231 | 2283 | ||
| 2232 | if(the_price<th.data.goods.use_commission){ | 2284 | if(the_price<th.data.goods.use_commission){ |
| @@ -2352,7 +2404,7 @@ Page({ | @@ -2352,7 +2404,7 @@ Page({ | ||
| 2352 | tail_pay_type: ind,//0微信支付 1余额支付 | 2404 | tail_pay_type: ind,//0微信支付 1余额支付 |
| 2353 | }; | 2405 | }; |
| 2354 | 2406 | ||
| 2355 | - if (th.data.exp_type == 0) { | 2407 | + if (th.data.exp_type == 0 || th.data.exp_type==2 ) { |
| 2356 | var index = th.data.index; | 2408 | var index = th.data.index; |
| 2357 | dd.shipping_code = th.data.wu_arr[index].code; | 2409 | dd.shipping_code = th.data.wu_arr[index].code; |
| 2358 | dd.shipping_name = th.data.wu_arr[index].name; | 2410 | dd.shipping_name = th.data.wu_arr[index].name; |