Commit 65e5759a935157df4529162924682fe45de1170a

Authored by abson
1 parent 6a43cac4

拼团尾款,幸运购尾款 不包邮地区不包邮商品控制

packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
@@ -1548,7 +1548,7 @@ Page({ @@ -1548,7 +1548,7 @@ Page({
1548 //统一运费 1548 //统一运费
1549 o_shipping_price += item[j]['uniform_exp_sum']; 1549 o_shipping_price += item[j]['uniform_exp_sum'];
1550 break; 1550 break;
1551 - // case 2: //1464行已计算 不必重复计算 注释为:判断是否有设置限制重量包邮 1551 + // case 2:
1552 // +'' 1552 // +''
1553 // if (goods_weight < 0) goods_weight = 0; 1553 // if (goods_weight < 0) goods_weight = 0;
1554 // //累积商品重量 每种商品的重量 * 数量 1554 // //累积商品重量 每种商品的重量 * 数量
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
@@ -31,6 +31,7 @@ Page({ @@ -31,6 +31,7 @@ Page({
31 firstEnter: !0, 31 firstEnter: !0,
32 //页面获取的参数 32 //页面获取的参数
33 param: null, 33 param: null,
  34 + is_no_by: {},
34 postdata: null, 35 postdata: null,
35 //提交订单的格式 36 //提交订单的格式
36 formData: { 37 formData: {
@@ -73,62 +74,62 @@ Page({ @@ -73,62 +74,62 @@ Page({
73 card_name: '', //显示的卡的名称 74 card_name: '', //显示的卡的名称
74 card_cut_price: null, //减价多少钱 75 card_cut_price: null, //减价多少钱
75 }, 76 },
76 -  
77 - onLoad: function(t) {  
78 - 77 +
  78 + onLoad: function (t) {
  79 +
79 // console.log('收到的传参', t); 80 // console.log('收到的传参', t);
80 wx.setNavigationBarTitle({ 81 wx.setNavigationBarTitle({
81 - title: '填写订单', 82 + title: '填写订单',
82 }); 83 });
83 self = this; 84 self = this;
84 this.setData({ 85 this.setData({
85 is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, 86 is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,
86 param: t, 87 param: t,
87 }); 88 });
88 - 89 +
89 var appD = getApp().get_b_now(); 90 var appD = getApp().get_b_now();
90 91
91 this.data.postdata = appD; 92 this.data.postdata = appD;
92 -  
93 - 93 +
  94 +
94 // 获取幸运购活动团team_id 95 // 获取幸运购活动团team_id
95 this.get_teamId({ 96 this.get_teamId({
96 store_id: oo.stoid, 97 store_id: oo.stoid,
97 user_id: getApp().globalData.user_id, 98 user_id: getApp().globalData.user_id,
98 aid: t.group_id, 99 aid: t.group_id,
99 }); 100 });
100 -  
101 -  
102 -  
103 - 101 +
  102 +
  103 +
  104 +
104 //如果期号有值01 105 //如果期号有值01
105 // if (appD.qh) { 106 // if (appD.qh) {
106 // th.data.qh = appD.qh; 107 // th.data.qh = appD.qh;
107 // th.data.pt_listno = appD.qh; 108 // th.data.pt_listno = appD.qh;
108 // } 109 // }
109 -  
110 - 110 +
  111 +
111 112
112 this.setData({//01 113 this.setData({//01
113 // kt_type: appD.kt_type 114 // kt_type: appD.kt_type
114 }); 115 });
115 - 116 +
116 // 01 117 // 01
117 // if (appD.is_pt_tz) th.data.is_pt_tz = appD.is_pt_tz; 118 // if (appD.is_pt_tz) th.data.is_pt_tz = appD.is_pt_tz;
118 - 119 +
119 120
120 //先获取物流,再获取用户信息,再展示页面 121 //先获取物流,再获取用户信息,再展示页面
121 // this.get_wuliu(th.get_info(th.show_page)); 122 // this.get_wuliu(th.get_info(th.show_page));
122 }, 123 },
123 -  
124 - onUnload: function() { 124 +
  125 + onUnload: function () {
125 this.setData({ 126 this.setData({
126 isclose: 1 127 isclose: 1
127 }) 128 })
128 }, 129 },
129 130
130 //------获取会员信息-----先获取用户信息,在进行下一步--- 131 //------获取会员信息-----先获取用户信息,在进行下一步---
131 - get_info: function(func) { 132 + get_info: function (func) {
132 var user_id = t.globalData.user_id; 133 var user_id = t.globalData.user_id;
133 to.auth.get_u(func); 134 to.auth.get_u(func);
134 }, 135 },
@@ -137,7 +138,7 @@ Page({ @@ -137,7 +138,7 @@ Page({
137 get_wuliu(func) { 138 get_wuliu(func) {
138 var th = this; 139 var th = this;
139 // console.log("getwuliu4545"); 140 // console.log("getwuliu4545");
140 - to.getwuliu(function(e) { 141 + to.getwuliu(function (e) {
141 if (th.data.is_default_logistics) { 142 if (th.data.is_default_logistics) {
142 //如果第一个不是开启默认,说明要让用户自己选 143 //如果第一个不是开启默认,说明要让用户自己选
143 if (!e[0].is_default) { 144 if (!e[0].is_default) {
@@ -154,7 +155,7 @@ Page({ @@ -154,7 +155,7 @@ Page({
154 }, 155 },
155 156
156 //------获取会员收货地址----- 157 //------获取会员收货地址-----
157 - getuser_addr: function(func) { 158 + getuser_addr: function (func) {
158 if (to.globalData.baddr != null) { 159 if (to.globalData.baddr != null) {
159 var user_addr = to.globalData.baddr; 160 var user_addr = to.globalData.baddr;
160 to.globalData.baddr = null; 161 to.globalData.baddr = null;
@@ -166,7 +167,7 @@ Page({ @@ -166,7 +167,7 @@ Page({
166 store_id: oo.stoid, 167 store_id: oo.stoid,
167 pageSize: 600 168 pageSize: 600
168 }, 169 },
169 - success: function(su) { 170 + success: function (su) {
170 171
171 var user_addr = su.data.data.pageData; 172 var user_addr = su.data.data.pageData;
172 var item = null; 173 var item = null;
@@ -188,7 +189,7 @@ Page({ @@ -188,7 +189,7 @@ Page({
188 } 189 }
189 }, 190 },
190 //----------------展示页面,是再获取用户信息之后-------------- 191 //----------------展示页面,是再获取用户信息之后--------------
191 - show_page: function() { 192 + show_page: function () {
192 var th = this; 193 var th = this;
193 //th.setData({ userinfo: to.globalData.userInfo}); 会员信息要时时获取 194 //th.setData({ userinfo: to.globalData.userInfo}); 会员信息要时时获取
194 var user = getApp().globalData.userInfo; 195 var user = getApp().globalData.userInfo;
@@ -196,7 +197,7 @@ Page({ @@ -196,7 +197,7 @@ Page({
196 data: { 197 data: {
197 r: Math.random() 198 r: Math.random()
198 }, 199 },
199 - success: function(e) { 200 + success: function (e) {
200 201
201 getApp().globalData.userInfo = e.data.data; 202 getApp().globalData.userInfo = e.data.data;
202 th.setData({ 203 th.setData({
@@ -212,11 +213,11 @@ Page({ @@ -212,11 +213,11 @@ Page({
212 store_id: oo.stoid, 213 store_id: oo.stoid,
213 status: 0 214 status: 0
214 }, 215 },
215 - success: function(su) { 216 + success: function (su) {
216 if (su.data.code == 0) { 217 if (su.data.code == 0) {
217 var yuer = parseFloat(th.data.userinfo.user_money - 218 var yuer = parseFloat(th.data.userinfo.user_money -
218 (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed( 219 (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(
219 - 2); 220 + 2);
220 if (yuer < 0) yuer = 0; 221 if (yuer < 0) yuer = 0;
221 th.setData({ 222 th.setData({
222 txmon: su.data.data.summoney, 223 txmon: su.data.data.summoney,
@@ -230,13 +231,13 @@ Page({ @@ -230,13 +231,13 @@ Page({
230 }, 231 },
231 232
232 //-----获取立即购买的商品信息---- 233 //-----获取立即购买的商品信息----
233 - get_buy_goods: function() { 234 + get_buy_goods: function () {
234 var th = this, 235 var th = this,
235 a = getApp().request; 236 a = getApp().request;
236 var gg = th.data.postdata; 237 var gg = th.data.postdata;
237 //调用商品 238 //调用商品
238 a.get("/api/weshop/goods/get/" + oo.stoid + "/" + gg.goods_id, { 239 a.get("/api/weshop/goods/get/" + oo.stoid + "/" + gg.goods_id, {
239 - success: function(t) { 240 + success: function (t) {
240 var gd = t.data.data; 241 var gd = t.data.data;
241 if (!gd) return false; 242 if (!gd) return false;
242 243
@@ -313,12 +314,12 @@ Page({ @@ -313,12 +314,12 @@ Page({
313 314
314 th.calculatePrice2(); 315 th.calculatePrice2();
315 } 316 }
316 - 317 +
317 else { //01 318 else { //01
318 319
319 //--阶梯团很特殊,不能用总表来拿价格-- 320 //--阶梯团很特殊,不能用总表来拿价格--
320 getApp().request.get("/api/weshop/teamlist/get/" + oo.stoid + "/" + gd.prom_id, { 321 getApp().request.get("/api/weshop/teamlist/get/" + oo.stoid + "/" + gd.prom_id, {
321 - success: function(tt) { 322 + success: function (tt) {
322 323
323 if (tt.data.code == 0) { 324 if (tt.data.code == 0) {
324 var pt_data = tt.data.data; 325 var pt_data = tt.data.data;
@@ -363,13 +364,13 @@ Page({ @@ -363,13 +364,13 @@ Page({
363 } 364 }
364 }); 365 });
365 } 366 }
366 - 367 +
367 } 368 }
368 }); 369 });
369 }, 370 },
370 371
371 //----------子页返回父页触发---------- 372 //----------子页返回父页触发----------
372 - onShow: function() { 373 + onShow: function () {
373 var th = this; 374 var th = this;
374 375
375 if (th.data.isclose == 0) { 376 if (th.data.isclose == 0) {
@@ -377,7 +378,7 @@ Page({ @@ -377,7 +378,7 @@ Page({
377 url: "/pages/index/index/index" 378 url: "/pages/index/index/index"
378 }) 379 })
379 } else { 380 } else {
380 - this.getuser_addr(function(ie) { 381 + this.getuser_addr(function (ie) {
381 //更换地址回来要重新调用计算价钱的接口 382 //更换地址回来要重新调用计算价钱的接口
382 th.setData({ 383 th.setData({
383 user_addr: ie 384 user_addr: ie
@@ -399,7 +400,7 @@ Page({ @@ -399,7 +400,7 @@ Page({
399 400
400 401
401 //先获取是否有关闭使用优惠券 402 //先获取是否有关闭使用优惠券
402 - getApp().getConfig2(function(ee) { 403 + getApp().getConfig2(function (ee) {
403 var json_d = JSON.parse(ee.switch_list); 404 var json_d = JSON.parse(ee.switch_list);
404 th.data.json_d = json_d; 405 th.data.json_d = json_d;
405 th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 406 th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
@@ -460,40 +461,40 @@ Page({ @@ -460,40 +461,40 @@ Page({
460 461
461 }, 462 },
462 //---------------检查是否有收货地址------------------- 463 //---------------检查是否有收货地址-------------------
463 - checkAddressList: function() { 464 + checkAddressList: function () {
464 var t = this; 465 var t = this;
465 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ 466 return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({
466 title: "请先填写或选择收货地址~", 467 title: "请先填写或选择收货地址~",
467 - success: function(a) { 468 + success: function (a) {
468 a.confirm ? t.enterAddressPage() : wx.navigateBack(); 469 a.confirm ? t.enterAddressPage() : wx.navigateBack();
469 }, 470 },
470 - fail: function() { 471 + fail: function () {
471 wx.navigateBack(); 472 wx.navigateBack();
472 } 473 }
473 }), !1); 474 }), !1);
474 }, 475 },
475 - showInvoice: function() { 476 + showInvoice: function () {
476 this.setData({ 477 this.setData({
477 invoiceToggle: !this.data.invoiceToggle 478 invoiceToggle: !this.data.invoiceToggle
478 }); 479 });
479 }, 480 },
480 - keyUpChangePay1: function(t) { 481 + keyUpChangePay1: function (t) {
481 this.setData({ 482 this.setData({
482 payWithUserMoney: !(t.detail.value.length > 0) 483 payWithUserMoney: !(t.detail.value.length > 0)
483 }); 484 });
484 }, 485 },
485 - keyUpChangePay2: function(t) { 486 + keyUpChangePay2: function (t) {
486 this.setData({ 487 this.setData({
487 payWithPoints: !(t.detail.value.length > 0) 488 payWithPoints: !(t.detail.value.length > 0)
488 }); 489 });
489 }, 490 },
490 - keyUpChangeNum: function(t) { 491 + keyUpChangeNum: function (t) {
491 this.setData({ 492 this.setData({
492 maxWord: t.detail.value.length 493 maxWord: t.detail.value.length
493 }); 494 });
494 }, 495 },
495 //---------计算立即购买---------- 496 //---------计算立即购买----------
496 - calculatePrice2: function() { 497 + calculatePrice2: function () {
497 console.log('calculatePrice2'); 498 console.log('calculatePrice2');
498 var th = this, 499 var th = this,
499 good = this.data.bn_goods; 500 good = this.data.bn_goods;
@@ -506,20 +507,20 @@ Page({ @@ -506,20 +507,20 @@ Page({
506 }); 507 });
507 console.log(th.data.formData); 508 console.log(th.data.formData);
508 509
509 - to.getConfig2(function(ee) {  
510 - to.getwuliuprice(function(rs) { 510 + to.getConfig2(function (ee) {
  511 + to.getwuliuprice(async function (rs) {
511 console.log('calculatePrice2222'); 512 console.log('calculatePrice2222');
512 console.log(rs); 513 console.log(rs);
513 var o_shipping_price = 0, 514 var o_shipping_price = 0,
514 goods_weight = -1, 515 goods_weight = -1,
515 goods_piece = -1; 516 goods_piece = -1;
516 - var out_of_weight=null; //超出多少重量  
517 - var freight_free = ee.freight_free; //全场满多少包邮  
518 - var weight_free = ee.weight_free; //多少kg内包邮  
519 - var no_ex_id = ee.no_ex_id; 517 + var out_of_weight = null; //超出多少重量
  518 + var freight_free = ee.freight_free; //全场满多少包邮
  519 + var weight_free = ee.weight_free; //多少kg内包邮
  520 + var no_ex_id = ee.no_ex_id;
520 //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- 521 //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------
521 if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != 522 if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type !=
522 - 3 || th.data.bn_goods.is_normal == 1)) { 523 + 3 || th.data.bn_goods.is_normal == 1)) {
523 switch (good['exp_sum_type']) { 524 switch (good['exp_sum_type']) {
524 case 1: 525 case 1:
525 //统一运费 526 //统一运费
@@ -529,9 +530,9 @@ Page({ @@ -529,9 +530,9 @@ Page({
529 if (goods_weight < 0) goods_weight = 0; 530 if (goods_weight < 0) goods_weight = 0;
530 //累积商品重量 每种商品的重量 * 数量 531 //累积商品重量 每种商品的重量 * 数量
531 goods_weight += good['weight'] * good['buynum']; 532 goods_weight += good['weight'] * good['buynum'];
532 - if(weight_free > 0){  
533 - out_of_weight = (weight_free * 1000 ) - goods_weight;  
534 - } 533 + if (weight_free > 0) {
  534 + out_of_weight = (weight_free * 1000) - goods_weight;
  535 + }
535 break; 536 break;
536 case 3: 537 case 3:
537 if (goods_piece < 0) goods_piece = 0; 538 if (goods_piece < 0) goods_piece = 0;
@@ -542,10 +543,40 @@ Page({ @@ -542,10 +543,40 @@ Page({
542 543
543 console.log(o_shipping_price + ":" + goods_weight + ":" + goods_piece); 544 console.log(o_shipping_price + ":" + goods_weight + ":" + goods_piece);
544 console.log(th.data.wu_arr); 545 console.log(th.data.wu_arr);
  546 + th.data.is_no_by[th.data.bn_pick] = 0;
  547 + var no_by_data = null;
545 var code = th.data.wu_arr[th.data.index].code; 548 var code = th.data.wu_arr[th.data.index].code;
546 var freight_free = ee.freight_free; //全场满多少包邮 549 var freight_free = ee.freight_free; //全场满多少包邮
  550 +
  551 + //有不包邮区域,且不免运费
  552 + if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice)) {
  553 + //-----------获取不包邮区域,不包邮商品-------
  554 + await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", {
  555 + data: { store_id: os.stoid, id: no_ex_id }
  556 + }).then(res => {
  557 + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  558 + no_by_data = res.data.data[0];
  559 + //如果有设置不包邮区域的时候
  560 + if (res.data.data[0].region_list) {
  561 + if (th.check_by_area(res.data.data[0].region_list)) {
  562 + freight_free = 0;
  563 + // out_of_weight = 0;
  564 + th.data.is_no_by[th.data.bn_pick] = 1;
  565 + }
  566 + }
  567 + //如果有设置不包邮商品
  568 + if (res.data.data[0].goods_list && freight_free) {
  569 + if (th.check_by_goods(res.data.data[0].goods_list)) {
  570 + freight_free = 0;
  571 + // out_of_weight = 0;
  572 + th.data.is_no_by[th.data.bn_pick] = 1;
  573 + }
  574 + }
  575 + }
  576 + })
  577 + }
547 var shipping_price = 578 var shipping_price =
548 - th.calculatewuliu(code, o_shipping_price, goods_weight, 579 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
549 goods_piece, th.data.user_addr, freight_free, allpice, rs); 580 goods_piece, th.data.user_addr, freight_free, allpice, rs);
550 581
551 shipping_price = parseFloat(shipping_price).toFixed(2); 582 shipping_price = parseFloat(shipping_price).toFixed(2);
@@ -604,7 +635,7 @@ Page({ @@ -604,7 +635,7 @@ Page({
604 // 提交订单前弹出确认对话框 635 // 提交订单前弹出确认对话框
605 submitConfirm(e) { 636 submitConfirm(e) {
606 // is_show为0不显示温馨提示,为1显示温馨提示 637 // is_show为0不显示温馨提示,为1显示温馨提示
607 - if(this.data.param.is_show == 1) { 638 + if (this.data.param.is_show == 1) {
608 wx.showModal({ 639 wx.showModal({
609 title: '温馨提示', 640 title: '温馨提示',
610 content: this.data.param.alert, 641 content: this.data.param.alert,
@@ -620,12 +651,12 @@ Page({ @@ -620,12 +651,12 @@ Page({
620 } else { 651 } else {
621 this.submitForm(e); 652 this.submitForm(e);
622 }; 653 };
623 - 654 +
624 }, 655 },
625 656
626 657
627 //--------------------提交订单----------------------- 658 //--------------------提交订单-----------------------
628 - submitForm: async function(t) { 659 + submitForm: async function (t) {
629 if (this.data.is_summit_ing == 1) return false; //--提交中退出-- 660 if (this.data.is_summit_ing == 1) return false; //--提交中退出--
630 this.data.is_summit_ing = 1; 661 this.data.is_summit_ing = 1;
631 662
@@ -637,7 +668,7 @@ Page({ @@ -637,7 +668,7 @@ Page({
637 668
638 //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候 669 //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候
639 if (th.data.bn_exp_type == 0 && th.data.user_addr == null && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 670 if (th.data.bn_exp_type == 0 && th.data.user_addr == null && (th.data.kt_type != 3 || th.data.bn_goods.is_normal ==
640 - 1)) { 671 + 1)) {
641 ff = false; 672 ff = false;
642 getApp().my_warnning("请选择收货地址", 0, this); 673 getApp().my_warnning("请选择收货地址", 0, this);
643 this.data.is_summit_ing = 0; 674 this.data.is_summit_ing = 0;
@@ -703,8 +734,8 @@ Page({ @@ -703,8 +734,8 @@ Page({
703 // if (!th.data.bn_goods.is_normal) { 734 // if (!th.data.bn_goods.is_normal) {
704 // item.is_zsorder = th.data.kt_type + 1; //开团类型 01 735 // item.is_zsorder = th.data.kt_type + 1; //开团类型 01
705 // } 736 // }
706 -  
707 - 737 +
  738 +
708 //老会员成为分销下线需要的参数 739 //老会员成为分销下线需要的参数
709 if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) { 740 if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) {
710 //判断一下分享人是不是分享商 741 //判断一下分享人是不是分享商
@@ -723,7 +754,7 @@ Page({ @@ -723,7 +754,7 @@ Page({
723 item.team_qh = th.data.qh; 754 item.team_qh = th.data.qh;
724 item.pt_listno = th.data.qh; 755 item.pt_listno = th.data.qh;
725 } 756 }
726 - 757 +
727 758
728 var gg = to.get_b_now(); 759 var gg = to.get_b_now();
729 var goods = { 760 var goods = {
@@ -784,7 +815,7 @@ Page({ @@ -784,7 +815,7 @@ Page({
784 header: { 815 header: {
785 'content-type': 'application/json' 816 'content-type': 'application/json'
786 }, // 设置请求的 header 817 }, // 设置请求的 header
787 - success: function(res) { 818 + success: function (res) {
788 819
789 wx.hideLoading(); 820 wx.hideLoading();
790 if (res.statusCode == 200) { 821 if (res.statusCode == 200) {
@@ -801,7 +832,7 @@ Page({ @@ -801,7 +832,7 @@ Page({
801 } 832 }
802 } 833 }
803 var order_amount = 0; 834 var order_amount = 0;
804 - pdata.forEach(function(em, ind) { 835 + pdata.forEach(function (em, ind) {
805 order_amount += em.order_amount; 836 order_amount += em.order_amount;
806 }) 837 })
807 //要进行判断,如果是用微信支付,就要跳转到支付界面 838 //要进行判断,如果是用微信支付,就要跳转到支付界面
@@ -813,23 +844,23 @@ Page({ @@ -813,23 +844,23 @@ Page({
813 // order_sn: data.data, 844 // order_sn: data.data,
814 // type:1, 845 // type:1,
815 // }, 1); 846 // }, 1);
816 - util_pay.pay(data.data, function() {  
817 - setTimeout(function() { 847 + util_pay.pay(data.data, function () {
  848 + setTimeout(function () {
818 // wx.reLaunch({ 849 // wx.reLaunch({
819 // //url: "/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data, 850 // //url: "/pages/payment/pay_success/pay_success?type=1&order_sn="+data.data,
820 // url: "/pages/team/team_success/team_success?ordersn=" + data.data, 851 // url: "/pages/team/team_success/team_success?ordersn=" + data.data,
821 // }) 852 // })
822 - 853 +
823 wx.redirectTo({ 854 wx.redirectTo({
824 url: "/packageC/pages/luckyGo/luckyGo_details/luckyGo_details?type=1&ordersn=" + data.data + 855 url: "/packageC/pages/luckyGo/luckyGo_details/luckyGo_details?type=1&ordersn=" + data.data +
825 "&group_id=" + th.data.param.group_id + "&goods_id=" + th.data.param.goods_id + 856 "&group_id=" + th.data.param.group_id + "&goods_id=" + th.data.param.goods_id +
826 "&goods_name=" + th.data.bn_goods.goods_name, 857 "&goods_name=" + th.data.bn_goods.goods_name,
827 }); 858 });
828 - 859 +
829 }, 1000) 860 }, 1000)
830 - }, function() { 861 + }, function () {
831 //支付失败 862 //支付失败
832 - setTimeout(function() { 863 + setTimeout(function () {
833 //wx.navigateBack({ delta: 1 }) 864 //wx.navigateBack({ delta: 1 })
834 wx.reLaunch({ 865 wx.reLaunch({
835 url: "/pages/user/order_list/order_list", 866 url: "/pages/user/order_list/order_list",
@@ -851,7 +882,7 @@ Page({ @@ -851,7 +882,7 @@ Page({
851 //return false; 882 //return false;
852 getApp().request.post("/api/weshop/order/pay/createOrder", { 883 getApp().request.post("/api/weshop/order/pay/createOrder", {
853 data: dd, 884 data: dd,
854 - success: function(t) { 885 + success: function (t) {
855 // console.log(t); 886 // console.log(t);
856 // app.my_warnning("支付成功",1,th); 887 // app.my_warnning("支付成功",1,th);
857 wx.hideLoading(); 888 wx.hideLoading();
@@ -866,9 +897,9 @@ Page({ @@ -866,9 +897,9 @@ Page({
866 title: '支付成功', 897 title: '支付成功',
867 icon: 'success', 898 icon: 'success',
868 duration: 2000, 899 duration: 2000,
869 - success: function() { 900 + success: function () {
870 // 幸运购 901 // 幸运购
871 - setTimeout(function() { 902 + setTimeout(function () {
872 wx.redirectTo({ 903 wx.redirectTo({
873 url: "/packageC/pages/luckyGo/luckyGo_details/luckyGo_details?type=1&ordersn=" + data.data + 904 url: "/packageC/pages/luckyGo/luckyGo_details/luckyGo_details?type=1&ordersn=" + data.data +
874 "&group_id=" + th.data.param.group_id + "&goods_id=" + th.data.param.goods_id + 905 "&group_id=" + th.data.param.group_id + "&goods_id=" + th.data.param.goods_id +
@@ -905,12 +936,12 @@ Page({ @@ -905,12 +936,12 @@ Page({
905 title: t.data.msg, 936 title: t.data.msg,
906 icon: 'none', 937 icon: 'none',
907 duration: 2000, 938 duration: 2000,
908 - success: function() { 939 + success: function () {
909 940
910 // wx.reLaunch({ 941 // wx.reLaunch({
911 // url: "/pages/user/order_list/order_list", 942 // url: "/pages/user/order_list/order_list",
912 // }) 943 // })
913 - 944 +
914 }, 945 },
915 }) 946 })
916 }; 947 };
@@ -928,20 +959,20 @@ Page({ @@ -928,20 +959,20 @@ Page({
928 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); 959 console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode);
929 } 960 }
930 }, 961 },
931 - fail: function() { 962 + fail: function () {
932 th.data.is_summit_ing = 0; //是否提交中 963 th.data.is_summit_ing = 0; //是否提交中
933 wx.hideLoading(); 964 wx.hideLoading();
934 console.log("index.js wx.request CheckCallUser fail"); 965 console.log("index.js wx.request CheckCallUser fail");
935 }, 966 },
936 - complete: function() {} 967 + complete: function () { }
937 }) 968 })
938 }, 969 },
939 -  
940 -  
941 -  
942 -  
943 -  
944 - useCoupon: function() { 970 +
  971 +
  972 +
  973 +
  974 +
  975 + useCoupon: function () {
945 if (this.data.order.couponNum <= 0) { 976 if (this.data.order.couponNum <= 0) {
946 //return t.showWarning("无可用优惠券"); 977 //return t.showWarning("无可用优惠券");
947 getApp().my_warnning("无可用优惠券", 0, this); 978 getApp().my_warnning("无可用优惠券", 0, this);
@@ -954,11 +985,11 @@ Page({ @@ -954,11 +985,11 @@ Page({
954 url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a) 985 url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a)
955 }); 986 });
956 }, 987 },
957 -  
958 -  
959 -  
960 -  
961 - enterAddressPage: function() { 988 +
  989 +
  990 +
  991 +
  992 + enterAddressPage: function () {
962 getApp().globalData.is_cart_old = 1; 993 getApp().globalData.is_cart_old = 1;
963 this.data.enterAddressPage = !0, wx.navigateTo({ 994 this.data.enterAddressPage = !0, wx.navigateTo({
964 url: "/pages/user/address_list/address_list" 995 url: "/pages/user/address_list/address_list"
@@ -969,7 +1000,7 @@ Page({ @@ -969,7 +1000,7 @@ Page({
969 1000
970 1001
971 //--------立即购买时,选择自提和物流----------- 1002 //--------立即购买时,选择自提和物流-----------
972 - setexptype_w: function(t) { 1003 + setexptype_w: function (t) {
973 var th = this; 1004 var th = this;
974 var ty = t.currentTarget.dataset.t, 1005 var ty = t.currentTarget.dataset.t,
975 txt = t.currentTarget.dataset.txt; 1006 txt = t.currentTarget.dataset.txt;
@@ -1001,7 +1032,7 @@ Page({ @@ -1001,7 +1032,7 @@ Page({
1001 1032
1002 1033
1003 //--------立即购买时,选择自提和物流---------- 1034 //--------立即购买时,选择自提和物流----------
1004 - setexptype: function(t) { 1035 + setexptype: function (t) {
1005 var th = this; 1036 var th = this;
1006 var ty = t.currentTarget.dataset.t; 1037 var ty = t.currentTarget.dataset.t;
1007 th.setData({ 1038 th.setData({
@@ -1019,19 +1050,19 @@ Page({ @@ -1019,19 +1050,19 @@ Page({
1019 1050
1020 1051
1021 //--------立即购买时,使用余额-------- 1052 //--------立即购买时,使用余额--------
1022 - set_bn_useyuer: function() { 1053 + set_bn_useyuer: function () {
1023 var th = this; 1054 var th = this;
1024 th.setData({ 1055 th.setData({
1025 bn_use_money: !th.data.bn_use_money 1056 bn_use_money: !th.data.bn_use_money
1026 }); 1057 });
1027 th.calculatePrice2(); 1058 th.calculatePrice2();
1028 }, 1059 },
1029 -  
1030 -  
1031 -  
1032 -  
1033 -  
1034 - set_js_useyuer: function() { 1060 +
  1061 +
  1062 +
  1063 +
  1064 +
  1065 + set_js_useyuer: function () {
1035 var th = this; 1066 var th = this;
1036 th.setData({ 1067 th.setData({
1037 js_use_money: !th.data.js_use_money 1068 js_use_money: !th.data.js_use_money
@@ -1043,7 +1074,7 @@ Page({ @@ -1043,7 +1074,7 @@ Page({
1043 1074
1044 1075
1045 //-------------------计算物流--------------- 1076 //-------------------计算物流---------------
1046 - calculatewuliu: function(code, o_shipping_price, goods_weight, 1077 + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight,
1047 goods_piece, user_addr, freight_free, o_price, rs) { 1078 goods_piece, user_addr, freight_free, o_price, rs) {
1048 var price = 0, 1079 var price = 0,
1049 th = this; 1080 th = this;
@@ -1077,15 +1108,15 @@ Page({ @@ -1077,15 +1108,15 @@ Page({
1077 } 1108 }
1078 } 1109 }
1079 //------超出重量---------- 1110 //------超出重量----------
1080 - if(out_of_weight < 0 && o_price >= freight_free){  
1081 - fw_price = parseFloat(item['money']);  
1082 - var out_of_weight = Math.abs(out_of_weight);  
1083 - if (out_of_weight > item['first_weight']) {  
1084 - var fw = out_of_weight - item['first_weight'];  
1085 - var n = Math.ceil(fw / item['second_weight'])  
1086 - fw_price = fw_price + n * parseFloat(item['add_money']);  
1087 - }  
1088 - } 1111 + if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) {
  1112 + fw_price = parseFloat(item['money']);
  1113 + var out_of_weight = Math.abs(out_of_weight);
  1114 + if (out_of_weight > item['first_weight']) {
  1115 + var fw = out_of_weight - item['first_weight'];
  1116 + var n = Math.ceil(fw / item['second_weight'])
  1117 + fw_price = fw_price + n * parseFloat(item['add_money']);
  1118 + }
  1119 + }
1089 //------按件数---------- 1120 //------按件数----------
1090 if (goods_piece > 0) { 1121 if (goods_piece > 0) {
1091 fp_price = parseFloat(item['piecemoney']); 1122 fp_price = parseFloat(item['piecemoney']);
@@ -1102,7 +1133,7 @@ Page({ @@ -1102,7 +1133,7 @@ Page({
1102 1133
1103 1134
1104 //------------循环获取config----------- 1135 //------------循环获取config-----------
1105 - get_wuliu_config: function(region_id, code, rs) { 1136 + get_wuliu_config: function (region_id, code, rs) {
1106 var item = null, 1137 var item = null,
1107 rslist = rs.pageData; 1138 rslist = rs.pageData;
1108 for (var i = 0; i < rslist.length; i++) { 1139 for (var i = 0; i < rslist.length; i++) {
@@ -1112,12 +1143,42 @@ Page({ @@ -1112,12 +1143,42 @@ Page({
1112 } 1143 }
1113 return item; 1144 return item;
1114 }, 1145 },
1115 -  
1116 -  
1117 -  
1118 - 1146 + //检查立即购买的商品是不是不包邮
  1147 + check_good: function (arr, goods_id) {
  1148 + if (!goods_id) goods_id = this.data.bn_goods.goods_id;
  1149 + for (var i in arr) {
  1150 + var item = arr[i];
  1151 + if (goods_id == item) return 0;
  1152 + }
  1153 + return 1;
  1154 + },
  1155 + check_by_goods: function (goods_list, goods_id) {
  1156 + var arr = goods_list.split(",");
  1157 + var check = this.check_good(arr, goods_id);
  1158 + return !check;
  1159 + },
  1160 +
  1161 + check_by_area: function (region_list) {
  1162 + var arr = region_list.split(",");
  1163 + var check = this.check_area(arr);
  1164 + return !check;
  1165 + },
  1166 + //检查区域是不是包邮
  1167 + check_area: function (arr) {
  1168 + var user_addr = this.data.user_addr;
  1169 + if (!user_addr) return 0;
  1170 + for (var i in arr) {
  1171 + var item = arr[i];
  1172 + if (user_addr.twon == item || user_addr.district == item
  1173 + || user_addr.city == item || user_addr.province == item) {
  1174 + return 0;
  1175 + }
  1176 + }
  1177 + return 1;
  1178 + },
  1179 +
1119 //-------循环获取config,code default------- 1180 //-------循环获取config,code default-------
1120 - get_wuliu_default: function(code, rs) { 1181 + get_wuliu_default: function (code, rs) {
1121 var item = null, 1182 var item = null,
1122 rslist = rs.pageData; 1183 rslist = rs.pageData;
1123 for (var i = 0; i < rslist.length; i++) { 1184 for (var i = 0; i < rslist.length; i++) {
@@ -1134,7 +1195,7 @@ Page({ @@ -1134,7 +1195,7 @@ Page({
1134 1195
1135 1196
1136 //----------立即购买,选择物流------------- 1197 //----------立即购买,选择物流-------------
1137 - bindPickerChange: function(e) { 1198 + bindPickerChange: function (e) {
1138 var ind = e.detail.value 1199 var ind = e.detail.value
1139 this.setData({ 1200 this.setData({
1140 index: ind 1201 index: ind
@@ -1159,24 +1220,24 @@ Page({ @@ -1159,24 +1220,24 @@ Page({
1159 1220
1160 1221
1161 1222
1162 - cart_set_err: function(e) { 1223 + cart_set_err: function (e) {
1163 var txt = e.currentTarget.dataset.err; 1224 var txt = e.currentTarget.dataset.err;
1164 var ob = {}; 1225 var ob = {};
1165 ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif"; 1226 ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif";
1166 this.setData(ob); 1227 this.setData(ob);
1167 }, 1228 },
1168 -  
1169 -  
1170 - 1229 +
  1230 +
  1231 +
1171 1232
1172 // 开启物流的弹窗 1233 // 开启物流的弹窗
1173 - show_wu_arr: function(e) { 1234 + show_wu_arr: function (e) {
1174 this.setData({ 1235 this.setData({
1175 open_express: 1 1236 open_express: 1
1176 }); 1237 });
1177 }, 1238 },
1178 -  
1179 - 1239 +
  1240 +
1180 1241
1181 //更新下默认,在onshow里面 1242 //更新下默认,在onshow里面
1182 update_code() { 1243 update_code() {
@@ -1184,7 +1245,7 @@ Page({ @@ -1184,7 +1245,7 @@ Page({
1184 m_wind = 0, 1245 m_wind = 0,
1185 def_exp_code = getApp().globalData.userInfo.def_exp_code; 1246 def_exp_code = getApp().globalData.userInfo.def_exp_code;
1186 1247
1187 - var uii = setInterval(function() { 1248 + var uii = setInterval(function () {
1188 if (th.data.wu_arr) { 1249 if (th.data.wu_arr) {
1189 clearInterval(uii); 1250 clearInterval(uii);
1190 for (var k = 0; k < th.data.wu_arr.length; k++) { 1251 for (var k = 0; k < th.data.wu_arr.length; k++) {
@@ -1201,21 +1262,21 @@ Page({ @@ -1201,21 +1262,21 @@ Page({
1201 } 1262 }
1202 }, 500) 1263 }, 500)
1203 }, 1264 },
1204 -  
1205 - 1265 +
  1266 +
1206 1267
1207 // 关闭物流的弹窗 1268 // 关闭物流的弹窗
1208 - close_express: function() { 1269 + close_express: function () {
1209 this.setData({ 1270 this.setData({
1210 open_express: 0 1271 open_express: 0
1211 }); 1272 });
1212 }, 1273 },
1213 -  
1214 -  
1215 -  
1216 - 1274 +
  1275 +
  1276 +
  1277 +
1217 // 选择物流 1278 // 选择物流
1218 - click_express_name: function(e) { 1279 + click_express_name: function (e) {
1219 var express_name = e.currentTarget.dataset.name, 1280 var express_name = e.currentTarget.dataset.name,
1220 shippingcode = e.currentTarget.dataset.shippingcode; 1281 shippingcode = e.currentTarget.dataset.shippingcode;
1221 var index = e.currentTarget.dataset.idxe; 1282 var index = e.currentTarget.dataset.idxe;
@@ -1231,18 +1292,18 @@ Page({ @@ -1231,18 +1292,18 @@ Page({
1231 1292
1232 1293
1233 //点击确定物流 1294 //点击确定物流
1234 - determine_expres: function(e) { 1295 + determine_expres: function (e) {
1235 this.setData({ 1296 this.setData({
1236 open_express: 0 1297 open_express: 0
1237 }); 1298 });
1238 this.calculatePrice2(); 1299 this.calculatePrice2();
1239 }, 1300 },
1240 -  
1241 -  
1242 -  
1243 - 1301 +
  1302 +
  1303 +
  1304 +
1244 //设置默认物流 1305 //设置默认物流
1245 - select_default_logistics: function() { 1306 + select_default_logistics: function () {
1246 var th = this; 1307 var th = this;
1247 var is_shipping_code = this.data.is_shipping_code 1308 var is_shipping_code = this.data.is_shipping_code
1248 getApp().request.put("/api/weshop/users/update", { 1309 getApp().request.put("/api/weshop/users/update", {
@@ -1251,7 +1312,7 @@ Page({ @@ -1251,7 +1312,7 @@ Page({
1251 store_id: oo.stoid, 1312 store_id: oo.stoid,
1252 def_exp_code: is_shipping_code 1313 def_exp_code: is_shipping_code
1253 }, 1314 },
1254 - success: function(rse) { 1315 + success: function (rse) {
1255 if (rse.data.code == 0) { 1316 if (rse.data.code == 0) {
1256 getApp().globalData.userInfo.def_exp_code = is_shipping_code; 1317 getApp().globalData.userInfo.def_exp_code = is_shipping_code;
1257 th.setData({ 1318 th.setData({
@@ -1270,12 +1331,12 @@ Page({ @@ -1270,12 +1331,12 @@ Page({
1270 1331
1271 1332
1272 //跳转到购买卡 1333 //跳转到购买卡
1273 - buycard: function() { 1334 + buycard: function () {
1274 getApp().goto("/pages/user/plus/plus"); 1335 getApp().goto("/pages/user/plus/plus");
1275 getApp().globalData.plus_buy_back = 1; 1336 getApp().globalData.plus_buy_back = 1;
1276 }, 1337 },
1277 -  
1278 - 1338 +
  1339 +
1279 // 获取team_id 1340 // 获取team_id
1280 get_teamId(options) { 1341 get_teamId(options) {
1281 let aid = options.aid; 1342 let aid = options.aid;
@@ -1283,8 +1344,8 @@ Page({ @@ -1283,8 +1344,8 @@ Page({
1283 let user_id = options.user_id; 1344 let user_id = options.user_id;
1284 let url = `/api/weshop/prom/luckyActivity/page?store_id=${store_id}&is_end=0&timetype=1&id=${aid}`; 1345 let url = `/api/weshop/prom/luckyActivity/page?store_id=${store_id}&is_end=0&timetype=1&id=${aid}`;
1285 getApp().request.get(url, { 1346 getApp().request.get(url, {
1286 - success: function(res) {  
1287 - if(res.data.code == 0) { 1347 + success: function (res) {
  1348 + if (res.data.code == 0) {
1288 let team_id = res.data.data.pageData[0]['team_id']; 1349 let team_id = res.data.data.pageData[0]['team_id'];
1289 wx.setStorage({ 1350 wx.setStorage({
1290 key: 'team_id', 1351 key: 'team_id',
@@ -1294,10 +1355,10 @@ Page({ @@ -1294,10 +1355,10 @@ Page({
1294 } 1355 }
1295 }); 1356 });
1296 }, 1357 },
1297 -  
1298 -  
1299 -  
1300 -  
1301 -  
1302 - 1358 +
  1359 +
  1360 +
  1361 +
  1362 +
  1363 +
1303 }); 1364 });
packageC/pages/presell/cart/cart.js
@@ -1648,7 +1648,7 @@ Page({ @@ -1648,7 +1648,7 @@ Page({
1648 if (no_by_data && no_by_data.region_list) { 1648 if (no_by_data && no_by_data.region_list) {
1649 if (th.check_by_area(no_by_data.region_list)) { 1649 if (th.check_by_area(no_by_data.region_list)) {
1650 gift_freight_free = 0; 1650 gift_freight_free = 0;
1651 - out_of_weight = 0; 1651 + // out_of_weight = 0;
1652 th.data.is_no_by[bn_pick] = 1; 1652 th.data.is_no_by[bn_pick] = 1;
1653 } 1653 }
1654 } 1654 }
@@ -1656,7 +1656,7 @@ Page({ @@ -1656,7 +1656,7 @@ Page({
1656 if (no_by_data && no_by_data.goods_list && gift_freight_free) { 1656 if (no_by_data && no_by_data.goods_list && gift_freight_free) {
1657 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { 1657 if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) {
1658 gift_freight_free = 0; 1658 gift_freight_free = 0;
1659 - out_of_weight = 0; 1659 + // out_of_weight = 0;
1660 th.data.is_no_by[bn_pick] = 1; 1660 th.data.is_no_by[bn_pick] = 1;
1661 } 1661 }
1662 } 1662 }
pages/cart/cart_wk/cart_wk.js
1 // pages/cart/cart_wk/cart_wk.js 1 // pages/cart/cart_wk/cart_wk.js
2 var t = getApp(), 2 var t = getApp(),
3 - oo = t.globalData.setting; 3 + oo = t.globalData.setting,
  4 + os=oo;
4 var regeneratorRuntime = require('../../../utils/runtime.js'); 5 var regeneratorRuntime = require('../../../utils/runtime.js');
5 6
6 Page({ 7 Page({
@@ -19,7 +20,7 @@ Page({ @@ -19,7 +20,7 @@ Page({
19 /*----------物流选择--------*/ 20 /*----------物流选择--------*/
20 wu_arr: null, 21 wu_arr: null,
21 index: 0, 22 index: 0,
22 - is_express:0, 23 + is_express: 0,
23 //申请提现的金额 24 //申请提现的金额
24 txmon: 0, 25 txmon: 0,
25 yuer: 0, 26 yuer: 0,
@@ -33,7 +34,7 @@ Page({ @@ -33,7 +34,7 @@ Page({
33 //------物流费用------ 34 //------物流费用------
34 exp_price: 0, 35 exp_price: 0,
35 enterAddressPage: 0, //进入地址页面 36 enterAddressPage: 0, //进入地址页面
36 - 37 + is_no_by: {},
37 allpice: 0, 38 allpice: 0,
38 show_pay_type: 0, 39 show_pay_type: 0,
39 40
@@ -59,7 +60,7 @@ Page({ @@ -59,7 +60,7 @@ Page({
59 var json_d = JSON.parse(e.switch_list); 60 var json_d = JSON.parse(e.switch_list);
60 th.data.json_d = json_d; 61 th.data.json_d = json_d;
61 var is_default_logistics = json_d.is_default_logistics; 62 var is_default_logistics = json_d.is_default_logistics;
62 - th.setData({is_default_logistics:is_default_logistics}); 63 + th.setData({ is_default_logistics: is_default_logistics });
63 64
64 th.get_wuliu(th.get_info(th.show_page)); 65 th.get_wuliu(th.get_info(th.show_page));
65 }, 1) 66 }, 1)
@@ -97,7 +98,7 @@ Page({ @@ -97,7 +98,7 @@ Page({
97 //---------------获取物流--------------- 98 //---------------获取物流---------------
98 get_wuliu(func) { 99 get_wuliu(func) {
99 var th = this, 100 var th = this,
100 - to = getApp(); 101 + to = getApp();
101 to.getwuliu(function (e) { 102 to.getwuliu(function (e) {
102 //如果第一个不是开启默认,说明要让用户自己选 103 //如果第一个不是开启默认,说明要让用户自己选
103 if (!e[0].is_default) { 104 if (!e[0].is_default) {
@@ -243,7 +244,7 @@ Page({ @@ -243,7 +244,7 @@ Page({
243 tail_money = parseFloat(tail_money); 244 tail_money = parseFloat(tail_money);
244 order.tail_money = tail_money; 245 order.tail_money = tail_money;
245 246
246 - if(!goods) return false; 247 + if (!goods) return false;
247 //--判断物流-- 248 //--判断物流--
248 if (goods.distr_type) 249 if (goods.distr_type)
249 distr_type = goods.distr_type; 250 distr_type = goods.distr_type;
@@ -415,15 +416,62 @@ Page({ @@ -415,15 +416,62 @@ Page({
415 }); 416 });
416 }, 417 },
417 418
  419 + //检查区域是不是包邮
  420 + check_area: function (arr) {
  421 + var user_addr = this.data.user_addr;
  422 + if (!user_addr) return 0;
  423 + for (var i in arr) {
  424 + var item = arr[i];
  425 + if (user_addr.twon == item || user_addr.district == item
  426 + || user_addr.city == item || user_addr.province == item) {
  427 + return 0;
  428 + }
  429 + }
  430 + return 1;
  431 + },
  432 +
  433 + //检查立即购买的商品是不是不包邮
  434 + check_good: function (arr, goods_id) {
  435 + if (!goods_id) goods_id = this.data.goods.goods_id;
  436 + for (var i in arr) {
  437 + var item = arr[i];
  438 + if (goods_id == item) return 0;
  439 + }
  440 + return 1;
  441 + },
  442 + check_by_area: function (region_list) {
  443 + var arr = region_list.split(",");
  444 + var check = this.check_area(arr);
  445 + return !check;
  446 + },
  447 + check_by_goods: function (goods_list, goods_id) {
  448 + var arr = goods_list.split(",");
  449 + var check = this.check_good(arr, goods_id);
  450 + return !check;
  451 + },
  452 +
418 //----计算物流的钱---- 453 //----计算物流的钱----
419 calculate_wuliu() { 454 calculate_wuliu() {
420 var to = getApp(), th = this; 455 var to = getApp(), th = this;
421 to.getConfig2(function (ee) { 456 to.getConfig2(function (ee) {
422 - to.getwuliuprice(function (rs) {  
423 - var o_shipping_price = 0,goods_weight = -1,goods_piece = -1,good=th.data.goods;  
424 - var out_of_weight=null; //超出多少重量 457 + to.getwuliuprice(async function (rs) {
  458 + var o_shipping_price = 0, goods_weight = -1, goods_piece = -1, good = th.data.goods;
  459 + var out_of_weight = null; //超出多少重量
  460 + var no_ex_id = ee.no_ex_id;
425 var freight_free = ee.freight_free; //全场满多少包邮 461 var freight_free = ee.freight_free; //全场满多少包邮
426 var weight_free = ee.weight_free; //多少kg内包邮 462 var weight_free = ee.weight_free; //多少kg内包邮
  463 + var no_ex_good = null;
  464 + var by_qc = {};
  465 + if (no_ex_id && freight_free > 0) {
  466 + //-----------获取不包邮区域,不包邮商品-------
  467 + await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", {
  468 + data: { store_id: os.stoid, id: no_ex_id }
  469 + }).then(res => {
  470 + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  471 + by_qc = res.data.data[0];
  472 + }
  473 + })
  474 + };
427 //-----------当地址不为空,且是物流时,计算物流费用---------- 475 //-----------当地址不为空,且是物流时,计算物流费用----------
428 if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { 476 if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) {
429 switch (good['exp_sum_type']) { 477 switch (good['exp_sum_type']) {
@@ -435,8 +483,8 @@ Page({ @@ -435,8 +483,8 @@ Page({
435 if (goods_weight < 0) goods_weight = 0; 483 if (goods_weight < 0) goods_weight = 0;
436 //累积商品重量 每种商品的重量 * 数量 484 //累积商品重量 每种商品的重量 * 数量
437 goods_weight += good['weight'] * th.data.order.order_goods['goods_num']; 485 goods_weight += good['weight'] * th.data.order.order_goods['goods_num'];
438 - if(weight_free > 0){  
439 - out_of_weight = (weight_free * 1000 ) - goods_weight; 486 + if (weight_free > 0) {
  487 + out_of_weight = (weight_free * 1000) - goods_weight;
440 } 488 }
441 break; 489 break;
442 case 3: 490 case 3:
@@ -446,10 +494,39 @@ Page({ @@ -446,10 +494,39 @@ Page({
446 break; 494 break;
447 } 495 }
448 var code = th.data.wu_arr[th.data.index].code; 496 var code = th.data.wu_arr[th.data.index].code;
  497 + th.data.is_no_by[th.data.bn_pick] = 0;
  498 + var no_by_data = null;
449 //--全部金额-- 499 //--全部金额--
450 var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money; 500 var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money;
  501 + //有不包邮区域,且不免运费
  502 + if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice)) {
  503 + //-----------获取不包邮区域,不包邮商品-------
  504 + await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", {
  505 + data: { store_id: os.stoid, id: no_ex_id }
  506 + }).then(res => {
  507 + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  508 + no_by_data = res.data.data[0];
  509 + //如果有设置不包邮区域的时候
  510 + if (res.data.data[0].region_list) {
  511 + if (th.check_by_area(res.data.data[0].region_list)) {
  512 + freight_free = 0;
  513 + // out_of_weight = 0;
  514 + th.data.is_no_by[th.data.bn_pick] = 1;
  515 + }
  516 + }
  517 + //如果有设置不包邮商品
  518 + if (res.data.data[0].goods_list && freight_free) {
  519 + if (th.check_by_goods(res.data.data[0].goods_list)) {
  520 + freight_free = 0;
  521 + // out_of_weight = 0;
  522 + th.data.is_no_by[th.data.bn_pick] = 1;
  523 + }
  524 + }
  525 + }
  526 + })
  527 + }
451 var shipping_price = 528 var shipping_price =
452 - th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight, 529 + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
453 goods_piece, th.data.user_addr, freight_free, allpice, rs); 530 goods_piece, th.data.user_addr, freight_free, allpice, rs);
454 var exp_price = parseFloat(shipping_price).toFixed(2); 531 var exp_price = parseFloat(shipping_price).toFixed(2);
455 allpice = parseFloat(exp_price) + parseFloat(allpice); 532 allpice = parseFloat(exp_price) + parseFloat(allpice);
@@ -467,12 +544,12 @@ Page({ @@ -467,12 +544,12 @@ Page({
467 }, 544 },
468 545
469 //----------------计算物流--------------- 546 //----------------计算物流---------------
470 - calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight, 547 + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight,
471 goods_piece, user_addr, freight_free, o_price, rs) { 548 goods_piece, user_addr, freight_free, o_price, rs) {
472 var price = 0, th = this; 549 var price = 0, th = this;
473 price += parseFloat(o_shipping_price); 550 price += parseFloat(o_shipping_price);
474 //如果是包邮 551 //如果是包邮
475 - if (freight_free > 0 && o_price >= freight_free && out_of_weight>=0) { return 0; } 552 + if (freight_free > 0 && o_price >= freight_free && out_of_weight >= 0) { return 0; }
476 if (user_addr == null) { return 0; } 553 if (user_addr == null) { return 0; }
477 //计算物流的config item; 554 //计算物流的config item;
478 var item = null; 555 var item = null;
@@ -494,14 +571,14 @@ Page({ @@ -494,14 +571,14 @@ Page({
494 fw_price = fw_price + n * parseFloat(item['add_money']); 571 fw_price = fw_price + n * parseFloat(item['add_money']);
495 } 572 }
496 } 573 }
497 - //------超出重量----------  
498 - if(out_of_weight < 0 && o_price >= freight_free){ 574 + //------超出重量----------
  575 + if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) {
499 fw_price = parseFloat(item['money']); 576 fw_price = parseFloat(item['money']);
500 var out_of_weight = Math.abs(out_of_weight); 577 var out_of_weight = Math.abs(out_of_weight);
501 if (out_of_weight > item['first_weight']) { 578 if (out_of_weight > item['first_weight']) {
502 - var fw = out_of_weight - item['first_weight'];  
503 - var n = Math.ceil(fw / item['second_weight'])  
504 - fw_price = fw_price + n * parseFloat(item['add_money']); 579 + var fw = out_of_weight - item['first_weight'];
  580 + var n = Math.ceil(fw / item['second_weight'])
  581 + fw_price = fw_price + n * parseFloat(item['add_money']);
505 } 582 }
506 } 583 }
507 //------按件数---------- 584 //------按件数----------