Commit 8ec986dcf3ea3588144ffb73ca86e51a1257350e

Authored by yvan.ni
1 parent bd037a68

预售同城配送 运费计算异常

packageC/pages/presell/cart/cart.js
... ... @@ -2107,11 +2107,12 @@ Page({
2107 2107 }
2108 2108  
2109 2109  
  2110 + var bn_pick = th.data.pickup.pickup_id
2110 2111 //如果同意参与订单优惠
2111 2112 if (ord_prom) {
2112 2113 //th.check_is_order_prom(o_condition,async function (ord_price) {
2113 2114 var ord_price=o_condition;
2114   - var bn_pick = th.data.pickup.pickup_id
  2115 +
2115 2116 var order_prom_amount = 0;
2116 2117 var order_prom_id = 0;
2117 2118 var order_m = 0;
... ... @@ -2227,6 +2228,57 @@ Page({
2227 2228 var o_condition1 = parseFloat(o_condition) - parseFloat(th.data.presell.presell_deposit);
2228 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 2282 var the_price=parseFloat(o_condition1) + parseFloat(exp_price);
2231 2283  
2232 2284 if(the_price<th.data.goods.use_commission){
... ...