Commit 9163e9969507f73851b85c778146616745726222
1 parent
0e1500db
不包邮地区
Showing
2 changed files
with
314 additions
and
306 deletions
packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
... | ... | @@ -121,22 +121,22 @@ Page({ |
121 | 121 | tabs: ['门店自提', '快递邮寄'], |
122 | 122 | currentTabIndex: 1, |
123 | 123 | |
124 | - in_zhact_gdmap:{}, //不同门店参与同一活动的限购 | |
125 | - hid_inp:1, | |
126 | - user_note:{}, | |
127 | - zuhe_map_good:{}, | |
124 | + in_zhact_gdmap: {}, //不同门店参与同一活动的限购 | |
125 | + hid_inp: 1, | |
126 | + user_note: {}, | |
127 | + zuhe_map_good: {}, | |
128 | 128 | }, |
129 | - | |
129 | + | |
130 | 130 | onLoad: function (t) { |
131 | - wx.setNavigationBarTitle({title: "填写订单",}) | |
131 | + wx.setNavigationBarTitle({ title: "填写订单", }) | |
132 | 132 | var th = this; |
133 | - this.setData({is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,}); | |
133 | + this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow, }); | |
134 | 134 | th.data.param = t; |
135 | 135 | //清理一下,确保最新的系统配置 |
136 | 136 | getApp().globalData.config2 = null; |
137 | 137 | //清空is_pick_up |
138 | 138 | getApp().request.put("/api/weshop/useraddress/updatePickUp", { |
139 | - data: {user_id: getApp().globalData.user_id, is_pickup: 0}, | |
139 | + data: { user_id: getApp().globalData.user_id, is_pickup: 0 }, | |
140 | 140 | success: function (s) { |
141 | 141 | } |
142 | 142 | }); |
... | ... | @@ -144,7 +144,7 @@ Page({ |
144 | 144 | |
145 | 145 | }, |
146 | 146 | onUnload: function () { |
147 | - this.setData({isclose: 1}) | |
147 | + this.setData({ isclose: 1 }) | |
148 | 148 | }, |
149 | 149 | onHide: function () { |
150 | 150 | this.setData({ |
... | ... | @@ -157,7 +157,7 @@ Page({ |
157 | 157 | //----------子页返回父页触发---------- |
158 | 158 | onShow: function () { |
159 | 159 | var th = this; |
160 | - th.setData({show_submit: 0}); //让提交先掩藏 | |
160 | + th.setData({ show_submit: 0 }); //让提交先掩藏 | |
161 | 161 | th.data.g_cart_q_time = null; |
162 | 162 | |
163 | 163 | if (th.data.isclose == 0) { |
... | ... | @@ -190,20 +190,20 @@ Page({ |
190 | 190 | th.data.is_summit_ing = 0; |
191 | 191 | //更换地址回来要重新调用计算价钱的接口 |
192 | 192 | if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) { |
193 | - th.setData({user_addr: ie}); | |
193 | + th.setData({ user_addr: ie }); | |
194 | 194 | if (th.data.is_b_now == 1) { |
195 | 195 | if (th.data.bn_goods) { |
196 | - th.setData({add_back: 1}); | |
196 | + th.setData({ add_back: 1 }); | |
197 | 197 | //th.calculatePrice2(); |
198 | 198 | } |
199 | 199 | } else { |
200 | 200 | if (th.data.cartlist) { |
201 | - th.setData({add_back: 1}); | |
201 | + th.setData({ add_back: 1 }); | |
202 | 202 | //th.calculatePrice(); |
203 | 203 | } |
204 | 204 | } |
205 | 205 | } else { |
206 | - th.setData({user_addr: ie}); | |
206 | + th.setData({ user_addr: ie }); | |
207 | 207 | } |
208 | 208 | var going = 0; |
209 | 209 | |
... | ... | @@ -257,34 +257,34 @@ Page({ |
257 | 257 | //-- 获取所有的等级卡, -- |
258 | 258 | getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid, |
259 | 259 | {}).then(res => { |
260 | - if (res.data.code == 0) { | |
261 | - var plusCard = res.data.data; | |
262 | - //-- 循环判断,拿到最贵的那张卡 -- | |
263 | - for (var ih in plusCard) { | |
264 | - if (plusCard[ih].IsStopBuy == true) { | |
265 | - continue; | |
266 | - } | |
267 | - if (max_price < 0) { | |
268 | - max_price = plusCard[ih].CardFee; | |
269 | - name = 'card' + plusCard[ih]['CorrPrice']; | |
270 | - show_card = plusCard[ih]; | |
271 | - } else { | |
272 | - if (max_price < plusCard[ih].CardFee) { | |
260 | + if (res.data.code == 0) { | |
261 | + var plusCard = res.data.data; | |
262 | + //-- 循环判断,拿到最贵的那张卡 -- | |
263 | + for (var ih in plusCard) { | |
264 | + if (plusCard[ih].IsStopBuy == true) { | |
265 | + continue; | |
266 | + } | |
267 | + if (max_price < 0) { | |
273 | 268 | max_price = plusCard[ih].CardFee; |
274 | 269 | name = 'card' + plusCard[ih]['CorrPrice']; |
275 | 270 | show_card = plusCard[ih]; |
271 | + } else { | |
272 | + if (max_price < plusCard[ih].CardFee) { | |
273 | + max_price = plusCard[ih].CardFee; | |
274 | + name = 'card' + plusCard[ih]['CorrPrice']; | |
275 | + show_card = plusCard[ih]; | |
276 | + } | |
276 | 277 | } |
277 | 278 | } |
278 | - } | |
279 | 279 | |
280 | - if (show_card) { | |
281 | - name = name.toLowerCase(); | |
282 | - th.setData({card_name: name, show_card: show_card}) | |
280 | + if (show_card) { | |
281 | + name = name.toLowerCase(); | |
282 | + th.setData({ card_name: name, show_card: show_card }) | |
283 | + } | |
283 | 284 | } |
284 | - } | |
285 | - //-----先获取物流,再获取用户信息,再展示页面----- | |
286 | - th.get_wuliu(th.get_info(th.show_page)); | |
287 | - }) | |
285 | + //-----先获取物流,再获取用户信息,再展示页面----- | |
286 | + th.get_wuliu(th.get_info(th.show_page)); | |
287 | + }) | |
288 | 288 | } else { |
289 | 289 | //-----先获取物流,再获取用户信息,再展示页面----- |
290 | 290 | th.get_wuliu(th.get_info(th.show_page)); |
... | ... | @@ -303,10 +303,10 @@ Page({ |
303 | 303 | if (th.data.is_default_logistics) { |
304 | 304 | //如果第一个不是开启默认,说明要让用户自己选 |
305 | 305 | if (!e[0].is_default) { |
306 | - th.setData({is_default_logistics: 0}); | |
306 | + th.setData({ is_default_logistics: 0 }); | |
307 | 307 | } |
308 | 308 | } |
309 | - th.setData({wu_arr: e}) | |
309 | + th.setData({ wu_arr: e }) | |
310 | 310 | typeof func == "function" && func(); |
311 | 311 | }) |
312 | 312 | }, |
... | ... | @@ -320,7 +320,7 @@ Page({ |
320 | 320 | getuser_addr: function (func) { |
321 | 321 | var th = this; |
322 | 322 | a.get("/api/weshop/useraddress/page", { |
323 | - data: {user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random()}, | |
323 | + data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random() }, | |
324 | 324 | success: function (su) { |
325 | 325 | /*--- |
326 | 326 | var user_addr=[ |
... | ... | @@ -345,7 +345,7 @@ Page({ |
345 | 345 | } |
346 | 346 | |
347 | 347 | if (item == undefined) item = null; |
348 | - if (!item) th.setData({user_addr: null}); //地址为空的时候,要清空,因为返回的时候,有缓存 | |
348 | + if (!item) th.setData({ user_addr: null }); //地址为空的时候,要清空,因为返回的时候,有缓存 | |
349 | 349 | |
350 | 350 | func(item); |
351 | 351 | } |
... | ... | @@ -360,19 +360,19 @@ Page({ |
360 | 360 | //会员的信息,要获取最新 |
361 | 361 | var user = getApp().globalData.userInfo; |
362 | 362 | getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, { |
363 | - data: {r: Math.random()}, | |
363 | + data: { r: Math.random() }, | |
364 | 364 | success: function (e) { |
365 | 365 | getApp().globalData.userInfo = e.data.data; |
366 | - th.setData({userinfo: e.data.data}); | |
366 | + th.setData({ userinfo: e.data.data }); | |
367 | 367 | |
368 | 368 | //选获取地址 |
369 | 369 | th.getuser_addr(function (addr) { |
370 | - th.setData({user_addr: addr}); | |
370 | + th.setData({ user_addr: addr }); | |
371 | 371 | //--------------------------立即购买------------------ |
372 | 372 | if (ta.is_bnow == 1) { |
373 | 373 | //读取门店 |
374 | 374 | to.get_allsto(function (e) { |
375 | - th.setData({allsto: e}); | |
375 | + th.setData({ allsto: e }); | |
376 | 376 | //获取立即购买的商品信息 |
377 | 377 | th.get_buy_goods(ta.goods_id); |
378 | 378 | }); |
... | ... | @@ -380,7 +380,7 @@ Page({ |
380 | 380 | //------------------------购物车结算---------------------- |
381 | 381 | //读取门店 |
382 | 382 | to.get_allsto(function (e) { |
383 | - th.setData({allsto: e}); | |
383 | + th.setData({ allsto: e }); | |
384 | 384 | //-------获取购物车已经选择的商品-------- |
385 | 385 | th.get_cart(); |
386 | 386 | }) |
... | ... | @@ -389,12 +389,12 @@ Page({ |
389 | 389 | |
390 | 390 | //获取提现金额 |
391 | 391 | getApp().request.get("/api/weshop/withdrawals/summoney", { |
392 | - data: {user_id: to.globalData.user_id, store_id: oo.stoid, status: 0}, | |
392 | + data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 }, | |
393 | 393 | success: function (su) { |
394 | 394 | if (su.data.code == 0) { |
395 | 395 | var yuer = parseFloat(th.data.userinfo.user_money - |
396 | 396 | (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2); |
397 | - th.setData({txmon: su.data.data.summoney, yuer: yuer}); | |
397 | + th.setData({ txmon: su.data.data.summoney, yuer: yuer }); | |
398 | 398 | } |
399 | 399 | } |
400 | 400 | }); |
... | ... | @@ -418,7 +418,7 @@ Page({ |
418 | 418 | var arr = new Array(); |
419 | 419 | var carr = su.data.data.pageData; |
420 | 420 | th.data.cartlist_y = carr; //存储原始购物车列表 |
421 | - th.data.in_zhact_gdmap={}; | |
421 | + th.data.in_zhact_gdmap = {}; | |
422 | 422 | |
423 | 423 | //---是不是购买等级卡成功的返回---等级卡显示的判断--- |
424 | 424 | var is_card_back = getApp().globalData.is_card_back; |
... | ... | @@ -427,7 +427,7 @@ Page({ |
427 | 427 | var item1 = carr[i]; |
428 | 428 | //把已经购买了多少见的内容填入 |
429 | 429 | |
430 | - var goodsbuynum=0,promgoodsbuynum=0; | |
430 | + var goodsbuynum = 0, promgoodsbuynum = 0; | |
431 | 431 | //--要获得商品,该用户买了多少件,同步应用-- |
432 | 432 | await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { |
433 | 433 | data: { |
... | ... | @@ -445,7 +445,7 @@ Page({ |
445 | 445 | goodsbuynum = buy_num_data.goodsbuynum; |
446 | 446 | }) |
447 | 447 | //如果有购买活动 |
448 | - item1.promgoodsbuynum=promgoodsbuynum; | |
448 | + item1.promgoodsbuynum = promgoodsbuynum; | |
449 | 449 | |
450 | 450 | //要把优惠活动加入,prom_goods_map中,赠品不要运算 |
451 | 451 | if (item1.prom_type == 3 && item1.is_gift != 1) { |
... | ... | @@ -455,9 +455,9 @@ Page({ |
455 | 455 | //要把组合购的东西拿出来算一下 |
456 | 456 | if (item1.prom_type == 7) { |
457 | 457 | var isok = 1; |
458 | - var is_flag=1; | |
458 | + var is_flag = 1; | |
459 | 459 | //如果有组合购 |
460 | - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item1.prom_id+'/'+getApp().globalData.userInfo.user_id; | |
460 | + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item1.prom_id + '/' + getApp().globalData.userInfo.user_id; | |
461 | 461 | await getApp().request.promiseGet(url, {}).then(res => { |
462 | 462 | if (res.data.code == 0 && res.data.data) { |
463 | 463 | //如果活动已经结束 |
... | ... | @@ -488,16 +488,16 @@ Page({ |
488 | 488 | data: req_data |
489 | 489 | }).then(res => { |
490 | 490 | if (ut.ajax_ok(res)) { |
491 | - var gdlist = res.data.data.pageData; | |
492 | - gdlist.forEach(i=>{ | |
493 | - if(item1.goods_id==i.goods_id&&!is_flag){ | |
494 | - item1.prom_type=0; | |
495 | - item1.prom_type1=0; | |
496 | - item1.prom_id=0; | |
497 | - item1.prom_id1=0 | |
491 | + var gdlist = res.data.data.pageData; | |
492 | + gdlist.forEach(i => { | |
493 | + if (item1.goods_id == i.goods_id && !is_flag) { | |
494 | + item1.prom_type = 0; | |
495 | + item1.prom_type1 = 0; | |
496 | + item1.prom_id = 0; | |
497 | + item1.prom_id1 = 0 | |
498 | 498 | } |
499 | 499 | }) |
500 | - th.data.zuhe_map_good[item1.prom_id]=gdlist; | |
500 | + th.data.zuhe_map_good[item1.prom_id] = gdlist; | |
501 | 501 | } |
502 | 502 | }) |
503 | 503 | } |
... | ... | @@ -532,7 +532,7 @@ Page({ |
532 | 532 | |
533 | 533 | item.original_img = oo.imghost + item.original_img; |
534 | 534 | |
535 | - var car_item=item; | |
535 | + var car_item = item; | |
536 | 536 | /*----接口要弄出来的,先顶着-----*/ |
537 | 537 | var pcid = car_item.pick_id; |
538 | 538 | var find = 0; |
... | ... | @@ -560,7 +560,7 @@ Page({ |
560 | 560 | break; |
561 | 561 | } |
562 | 562 | arr[j].exp_type = e_t; |
563 | - if (e_t == 0) th.setData({is_all_zt: 0}); | |
563 | + if (e_t == 0) th.setData({ is_all_zt: 0 }); | |
564 | 564 | //} |
565 | 565 | |
566 | 566 | //-- 把等级卡会优惠多少钱装进去 -- |
... | ... | @@ -603,7 +603,7 @@ Page({ |
603 | 603 | break; |
604 | 604 | } |
605 | 605 | //如果是物流的话,全部自提的控制要弄成0 |
606 | - if (e_t == 0) th.setData({is_all_zt: 0}); | |
606 | + if (e_t == 0) th.setData({ is_all_zt: 0 }); | |
607 | 607 | |
608 | 608 | var narr = new Array(); |
609 | 609 | narr.push(car_item); |
... | ... | @@ -662,11 +662,11 @@ Page({ |
662 | 662 | var offline_price = 0; |
663 | 663 | var offline_num = 0; |
664 | 664 | for (var c = 0; c < item.length; c++) { |
665 | - if(th.data.sales_rules!=2){ | |
666 | - item[c].offline_price=0; | |
665 | + if (th.data.sales_rules != 2) { | |
666 | + item[c].offline_price = 0; | |
667 | 667 | } |
668 | 668 | //-- 如果这个商品是线下取价的时候 -- |
669 | - if (item[c].offline_price > 0 && item[c].prom_type != 7 ) { | |
669 | + if (item[c].offline_price > 0 && item[c].prom_type != 7) { | |
670 | 670 | offline_price += (item[c].goods_price - item[c].offline_price) * item[c].goods_num; |
671 | 671 | offline_num += item[c].goods_num; |
672 | 672 | } |
... | ... | @@ -689,10 +689,10 @@ Page({ |
689 | 689 | //存储不同活动的商品列表 |
690 | 690 | u_item.zh_prom_goods = {}; |
691 | 691 | for (let var1 in obj) { |
692 | - var h_item=obj[var1]; | |
693 | - var gdlist= th.data.zuhe_map_good[h_item.prom_id]; | |
694 | - //获取活动需要的商品列表 | |
695 | - // u_item.zh_prom_goods[h_item.prom_id]=gdlist; | |
692 | + var h_item = obj[var1]; | |
693 | + var gdlist = th.data.zuhe_map_good[h_item.prom_id]; | |
694 | + //获取活动需要的商品列表 | |
695 | + // u_item.zh_prom_goods[h_item.prom_id]=gdlist; | |
696 | 696 | // var h_item = obj[var1]; |
697 | 697 | // var gdlist = null; |
698 | 698 | // var url1 = "/api/weshop/prom/zhbuyGoods/page"; |
... | ... | @@ -710,7 +710,7 @@ Page({ |
710 | 710 | // } |
711 | 711 | // }) |
712 | 712 | //获取活动需要的商品列表 |
713 | - u_item.zh_prom_goods[h_item.prom_id] = {gdlist: gdlist, act: h_item.act}; | |
713 | + u_item.zh_prom_goods[h_item.prom_id] = { gdlist: gdlist, act: h_item.act }; | |
714 | 714 | } |
715 | 715 | zh_calc.fir_set_arr(u_item, th); |
716 | 716 | } |
... | ... | @@ -723,7 +723,7 @@ Page({ |
723 | 723 | setTimeout(function () { |
724 | 724 | var frozenQuan = null; |
725 | 725 | var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; |
726 | - app.request.promiseGet(url0, {1: 1}).then(res => { | |
726 | + app.request.promiseGet(url0, { 1: 1 }).then(res => { | |
727 | 727 | if (res.data.code == 0) { |
728 | 728 | frozenQuan = res.data.data; |
729 | 729 | th.data.frozenQuan = frozenQuan; |
... | ... | @@ -794,7 +794,7 @@ Page({ |
794 | 794 | th.data.card_name = th.data.userinfo.card_field; |
795 | 795 | gg.goods_price = gd[th.data.card_name]; |
796 | 796 | getApp().globalData.is_card_back = 0; |
797 | - th.setData({card_cut_price: 0}); | |
797 | + th.setData({ card_cut_price: 0 }); | |
798 | 798 | //如果是秒杀的返回 |
799 | 799 | if (gd.prom_type == 1) gd.prom_type = 0; |
800 | 800 | } else { |
... | ... | @@ -802,13 +802,13 @@ Page({ |
802 | 802 | //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 -- |
803 | 803 | 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) { |
804 | 804 | var cut_p = (gg.goods_price - gd[th.data.card_name]) * gg.goods_num; |
805 | - th.setData({card_cut_price: cut_p}); | |
805 | + th.setData({ card_cut_price: cut_p }); | |
806 | 806 | } |
807 | 807 | } |
808 | 808 | |
809 | 809 | |
810 | - gd.prom_type=gg.prom_type; | |
811 | - gd.prom_id=gg.prom_id; | |
810 | + gd.prom_type = gg.prom_type; | |
811 | + gd.prom_id = gg.prom_id; | |
812 | 812 | |
813 | 813 | switch (gd.prom_type) { |
814 | 814 | case 0: |
... | ... | @@ -872,7 +872,7 @@ Page({ |
872 | 872 | ob.exp_sum_type = data.gift_exp_sum_type; //商品的物流计算方式 |
873 | 873 | ob.uniform_exp_sum = data.gift_uniform_exp_sum //统一运费的金额 |
874 | 874 | |
875 | - th.setData({buy_now_gift_goods: ob}); | |
875 | + th.setData({ buy_now_gift_goods: ob }); | |
876 | 876 | } |
877 | 877 | } |
878 | 878 | |
... | ... | @@ -900,7 +900,7 @@ Page({ |
900 | 900 | t.data.data.guide_id = gg.guide_id; |
901 | 901 | t.data.data.guide_type = gg.guide_type; |
902 | 902 | } |
903 | - th.setData({collocation_goods: gg.collocation_goods}); | |
903 | + th.setData({ collocation_goods: gg.collocation_goods }); | |
904 | 904 | |
905 | 905 | var cart_arr = new Array(); |
906 | 906 | //var narr=gg.collocation_goods; |
... | ... | @@ -915,7 +915,7 @@ Page({ |
915 | 915 | for (var hi in narr) { |
916 | 916 | var dis_t = narr[hi].distr_type; |
917 | 917 | if (dis_t == 2) { |
918 | - th.setData({is_all_zt: 0}); | |
918 | + th.setData({ is_all_zt: 0 }); | |
919 | 919 | et = 0; |
920 | 920 | } |
921 | 921 | if (dis_t > 0) { |
... | ... | @@ -957,7 +957,7 @@ Page({ |
957 | 957 | if (gg.prom_type == 5) { |
958 | 958 | var frozenQuan = null; |
959 | 959 | var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; |
960 | - app.request.promiseGet(url0, {1: 1}).then(res => { | |
960 | + app.request.promiseGet(url0, { 1: 1 }).then(res => { | |
961 | 961 | if (res.data.code == 0) { |
962 | 962 | frozenQuan = res.data.data; |
963 | 963 | th.data.frozenQuan = frozenQuan; |
... | ... | @@ -978,13 +978,13 @@ Page({ |
978 | 978 | case 1: //---秒杀----- |
979 | 979 | var quanlist = null; |
980 | 980 | getApp().request.get("/api/weshop/activitylist/getSJGoodsPriceNew/" + gd.store_id |
981 | - + "/" + gd.goods_id + "/1/" + gd.prom_id+"/"+app.globalData.user_id, { | |
981 | + + "/" + gd.goods_id + "/1/" + gd.prom_id + "/" + app.globalData.user_id, { | |
982 | 982 | success: async function (tt) { |
983 | 983 | if (tt.data.code == 0) { |
984 | 984 | //t.data.data.shop_price = tt.data.data.prom_price; |
985 | 985 | t.data.data.shop_price = tt.data.data.prom_user_price; |
986 | - th.data.ckeck_quan_price=0; | |
987 | - gd.is_xz_yh=1; | |
986 | + th.data.ckeck_quan_price = 0; | |
987 | + gd.is_xz_yh = 1; | |
988 | 988 | } else { |
989 | 989 | t.data.data.prom_id = 0; |
990 | 990 | t.data.data.prom_type = 0; |
... | ... | @@ -1006,7 +1006,7 @@ Page({ |
1006 | 1006 | //计算价格 |
1007 | 1007 | th.calculatePrice2(); |
1008 | 1008 | //获取优惠券,如果有券的钱,就调用 |
1009 | - if(th.data.ckeck_quan_price>0) th.get_buy_now_quan(); | |
1009 | + if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan(); | |
1010 | 1010 | } |
1011 | 1011 | }); |
1012 | 1012 | |
... | ... | @@ -1014,7 +1014,7 @@ Page({ |
1014 | 1014 | |
1015 | 1015 | case 2: //--- 团购 --- |
1016 | 1016 | var quanlist = null; |
1017 | - getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" +os.stoid + "/" +gd.goods_id+"/"+ gd.prom_id, { | |
1017 | + getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gd.goods_id + "/" + gd.prom_id, { | |
1018 | 1018 | success: async function (tt) { |
1019 | 1019 | if (tt.data.code == 0) { |
1020 | 1020 | //t.data.data.shop_price = tt.data.data.prom_price; |
... | ... | @@ -1024,12 +1024,12 @@ Page({ |
1024 | 1024 | t.data.data.prom_type = 0; |
1025 | 1025 | } |
1026 | 1026 | |
1027 | - if(tt.data.data.isQuan){ | |
1027 | + if (tt.data.data.isQuan) { | |
1028 | 1028 | th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; |
1029 | 1029 | th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; |
1030 | 1030 | th.data.check_quan_ware_list = t.data.data.erpwareid + ""; |
1031 | - }else{ | |
1032 | - gd.is_xz_yh=1; | |
1031 | + } else { | |
1032 | + gd.is_xz_yh = 1; | |
1033 | 1033 | } |
1034 | 1034 | |
1035 | 1035 | th.setData({ |
... | ... | @@ -1045,7 +1045,7 @@ Page({ |
1045 | 1045 | //-- 计算价格 -- |
1046 | 1046 | th.calculatePrice2(); |
1047 | 1047 | //获取优惠券,如果有券的钱,就调用 |
1048 | - if(th.data.ckeck_quan_price>0) th.get_buy_now_quan(); | |
1048 | + if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan(); | |
1049 | 1049 | } |
1050 | 1050 | }); |
1051 | 1051 | |
... | ... | @@ -1060,14 +1060,14 @@ Page({ |
1060 | 1060 | checkAddressList: function () { |
1061 | 1061 | var t = this; |
1062 | 1062 | return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ |
1063 | - title: "请先填写或选择收货地址~", | |
1064 | - success: function (a) { | |
1065 | - a.confirm ? t.enterAddressPage() : wx.navigateBack(); | |
1066 | - }, | |
1067 | - fail: function () { | |
1068 | - wx.navigateBack(); | |
1069 | - } | |
1070 | - }), !1); | |
1063 | + title: "请先填写或选择收货地址~", | |
1064 | + success: function (a) { | |
1065 | + a.confirm ? t.enterAddressPage() : wx.navigateBack(); | |
1066 | + }, | |
1067 | + fail: function () { | |
1068 | + wx.navigateBack(); | |
1069 | + } | |
1070 | + }), !1); | |
1071 | 1071 | }, |
1072 | 1072 | showInvoice: function () { |
1073 | 1073 | this.setData({ |
... | ... | @@ -1086,7 +1086,7 @@ Page({ |
1086 | 1086 | }, |
1087 | 1087 | keyUpChangeNum: function (t) { |
1088 | 1088 | var index = t.currentTarget.dataset.index; |
1089 | - var txt="user_note."+index; | |
1089 | + var txt = "user_note." + index; | |
1090 | 1090 | this.setData({ |
1091 | 1091 | maxWord: t.detail.value.length, |
1092 | 1092 | [txt]: t.detail.value |
... | ... | @@ -1176,7 +1176,7 @@ Page({ |
1176 | 1176 | } |
1177 | 1177 | |
1178 | 1178 | var pt_res = null; |
1179 | - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { | |
1179 | + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { | |
1180 | 1180 | is_json: 1, |
1181 | 1181 | data: pt_data |
1182 | 1182 | }).then(res => { |
... | ... | @@ -1231,11 +1231,11 @@ Page({ |
1231 | 1231 | if (item_map.s_coupon_id) { |
1232 | 1232 | if (!cart_item.s_coupon_id) { |
1233 | 1233 | cart_item.s_coupon_id = item_map.s_coupon_id + ""; |
1234 | - cart_item.g_coupon_num = [{'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num}]; | |
1234 | + cart_item.g_coupon_num = [{ 'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num }]; | |
1235 | 1235 | } |
1236 | 1236 | else { |
1237 | 1237 | cart_item.s_coupon_id += "," + item_map.s_coupon_id; |
1238 | - cart_item.g_coupon_num.push({'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num}) | |
1238 | + cart_item.g_coupon_num.push({ 'c_id': item_map.s_coupon_id, "num": item_map.s_coupon_num }) | |
1239 | 1239 | } |
1240 | 1240 | } |
1241 | 1241 | |
... | ... | @@ -1243,11 +1243,11 @@ Page({ |
1243 | 1243 | if (item_map.s_libao) { |
1244 | 1244 | if (!cart_item.s_libao) { |
1245 | 1245 | cart_item.s_libao = item_map.s_libao + ""; |
1246 | - cart_item.g_lb_num = [{'l_id': item_map.s_libao, "num": item_map.s_lb_num}]; | |
1246 | + cart_item.g_lb_num = [{ 'l_id': item_map.s_libao, "num": item_map.s_lb_num }]; | |
1247 | 1247 | } |
1248 | 1248 | else { |
1249 | 1249 | cart_item.s_libao += "," + item_map.s_libao; |
1250 | - cart_item.g_lb_num.push({'l_id': item_map.s_libao, "num": item_map.s_lb_num}) | |
1250 | + cart_item.g_lb_num.push({ 'l_id': item_map.s_libao, "num": item_map.s_lb_num }) | |
1251 | 1251 | } |
1252 | 1252 | } |
1253 | 1253 | } |
... | ... | @@ -1272,7 +1272,7 @@ Page({ |
1272 | 1272 | var all_cutprice = 0; //所有的优惠减 |
1273 | 1273 | var all_zh_cutprice = 0; //所有的组合优惠减 |
1274 | 1274 | var all_order_prom = 0; //所有的订单优惠 |
1275 | - var out_of_weight=0; //超出多少重量 | |
1275 | + var out_of_weight = 0; //超出多少重量 | |
1276 | 1276 | var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : 0); |
1277 | 1277 | var freight_free = ee.freight_free; //全场满多少包邮 |
1278 | 1278 | var weight_free = ee.weight_free; //多少kg内包邮 |
... | ... | @@ -1283,7 +1283,7 @@ Page({ |
1283 | 1283 | if (no_ex_id && freight_free > 0) { |
1284 | 1284 | //-----------获取不包邮区域,不包邮商品------- |
1285 | 1285 | await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { |
1286 | - data: {store_id: os.stoid, id: no_ex_id} | |
1286 | + data: { store_id: os.stoid, id: no_ex_id } | |
1287 | 1287 | }).then(res => { |
1288 | 1288 | if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { |
1289 | 1289 | by_qc = res.data.data[0]; |
... | ... | @@ -1303,7 +1303,7 @@ Page({ |
1303 | 1303 | //调用函数计算每件商品的单价 |
1304 | 1304 | await th.calc_per(c_arr); |
1305 | 1305 | //调用函数计算每件组合购商品的单价, |
1306 | - await zh_calc.calc_zh_split_price(c_arr,th); | |
1306 | + await zh_calc.calc_zh_split_price(c_arr, th); | |
1307 | 1307 | //调用函数计算,优惠券优惠什么商品价格,优惠券优惠什么商品 |
1308 | 1308 | await th.get_cart_quan(c_arr); |
1309 | 1309 | //---循环购物车--- |
... | ... | @@ -1326,7 +1326,7 @@ Page({ |
1326 | 1326 | var cart_item = c_arr[i]; //就是每一单的意思 |
1327 | 1327 | var pickid = cart_item.pickup_id; |
1328 | 1328 | var o_price = 0; |
1329 | - var o_price_no_zh=0; //参与订单优惠叠加--组合购的金额汇总 | |
1329 | + var o_price_no_zh = 0; //参与订单优惠叠加--组合购的金额汇总 | |
1330 | 1330 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; |
1331 | 1331 | var item = c_arr[i].goods; //就是每一单的从表的意思 |
1332 | 1332 | |
... | ... | @@ -1334,8 +1334,8 @@ Page({ |
1334 | 1334 | var quan_price = 0; |
1335 | 1335 | var coupon_price = 0; |
1336 | 1336 | var quan_no = null; |
1337 | - var is_has_zh=c_arr[i].is_has_zh; | |
1338 | - var zh_prom_goods=c_arr[i].zh_prom_goods; //组合购计算的原始数据存储空间 | |
1337 | + var is_has_zh = c_arr[i].is_has_zh; | |
1338 | + var zh_prom_goods = c_arr[i].zh_prom_goods; //组合购计算的原始数据存储空间 | |
1339 | 1339 | |
1340 | 1340 | if (th.data.using_quan[pickid] != null && th.data.using_quan[pickid] != undefined) |
1341 | 1341 | quan_no = th.data.using_quan[pickid].coupon_no; |
... | ... | @@ -1363,43 +1363,42 @@ Page({ |
1363 | 1363 | |
1364 | 1364 | //--------循环计算总价----------- |
1365 | 1365 | for (var j = 0; j < item.length; j++) { |
1366 | - if(item[j].prom_type!=7){ | |
1366 | + if (item[j].prom_type != 7) { | |
1367 | 1367 | o_price_no_zh += item[j].goods_price * item[j].goods_num; |
1368 | 1368 | } |
1369 | 1369 | //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 |
1370 | - else if(zh_prom_goods && zh_prom_goods[item[j].prom_id] && zh_prom_goods[item[j].prom_id].act.is_orderyh ) | |
1371 | - { | |
1370 | + else if (zh_prom_goods && zh_prom_goods[item[j].prom_id] && zh_prom_goods[item[j].prom_id].act.is_orderyh) { | |
1372 | 1371 | o_price_no_zh += item[j].goods_price * item[j].goods_num; |
1373 | 1372 | } |
1374 | 1373 | o_price += item[j].goods_price * item[j].goods_num; |
1375 | 1374 | |
1376 | 1375 | //判断是否有设置限制重量包邮 |
1377 | - if(item[j]['is_past']!==1 && item[j]['exp_sum_type']==2){ | |
1376 | + if (item[j]['is_past'] !== 1 && item[j]['exp_sum_type'] == 2) { | |
1378 | 1377 | if (goods_weight < 0) goods_weight = 0; |
1379 | - //累积商品重量 每种商品的重量 * 数量 | |
1378 | + //累积商品重量 每种商品的重量 * 数量 | |
1380 | 1379 | goods_weight += item[j]['weight'] * item[j]['goods_num']; |
1381 | - if(weight_free > 0){ | |
1382 | - out_of_weight = (weight_free*1000) - goods_weight; | |
1380 | + if (weight_free > 0) { | |
1381 | + out_of_weight = (weight_free * 1000) - goods_weight; | |
1383 | 1382 | } |
1384 | 1383 | } |
1385 | 1384 | } |
1386 | 1385 | //判断是不是有组合购的金额 |
1387 | 1386 | var f_o_price = o_price; |
1388 | 1387 | //如果又优惠的钱,就要减价 |
1389 | - if (c_arr[i].cut_price > 0){ | |
1388 | + if (c_arr[i].cut_price > 0) { | |
1390 | 1389 | o_price -= c_arr[i].cut_price; |
1391 | - o_price_no_zh-=c_arr[i].cut_price; | |
1390 | + o_price_no_zh -= c_arr[i].cut_price; | |
1392 | 1391 | } |
1393 | 1392 | //如果有组合购优惠的钱,就要减价 |
1394 | - if (c_arr[i].zh_cut_price>0 || c_arr[i].zh_cut_price<0){ | |
1393 | + if (c_arr[i].zh_cut_price > 0 || c_arr[i].zh_cut_price < 0) { | |
1395 | 1394 | o_price -= c_arr[i].zh_cut_price; |
1396 | - if(o_price_no_zh>0){ | |
1395 | + if (o_price_no_zh > 0) { | |
1397 | 1396 | //找到那些可以订单优惠叠加的 |
1398 | - for(let ij in zh_prom_goods){ | |
1399 | - let kitem=zh_prom_goods[ij]; | |
1400 | - var is_has_zh=kitem.is_has_zh; | |
1401 | - if(kitem.act.is_orderyh) | |
1402 | - o_price_no_zh-=kitem.cut_price; | |
1397 | + for (let ij in zh_prom_goods) { | |
1398 | + let kitem = zh_prom_goods[ij]; | |
1399 | + var is_has_zh = kitem.is_has_zh; | |
1400 | + if (kitem.act.is_orderyh) | |
1401 | + o_price_no_zh -= kitem.cut_price; | |
1403 | 1402 | } |
1404 | 1403 | } |
1405 | 1404 | } |
... | ... | @@ -1407,12 +1406,12 @@ Page({ |
1407 | 1406 | //-- 计算线下取价的功能 -- |
1408 | 1407 | if (cart_item.is_offline == 1) { |
1409 | 1408 | o_price = o_price - cart_item.offline_price; |
1410 | - o_price_no_zh-=c_arr[i].offline_price; | |
1409 | + o_price_no_zh -= c_arr[i].offline_price; | |
1411 | 1410 | } |
1412 | 1411 | //判断包邮券的钱,组合购的商品不使用优惠券 |
1413 | 1412 | var q_conditin = 0; |
1414 | 1413 | q_conditin = o_price - quan_price; |
1415 | - if(is_has_zh){ | |
1414 | + if (is_has_zh) { | |
1416 | 1415 | q_conditin = o_price_no_zh - quan_price; |
1417 | 1416 | } |
1418 | 1417 | cart_item.goods_price = f_o_price.toFixed(2); //商品总费用,用f_o_price来计算 |
... | ... | @@ -1426,12 +1425,17 @@ Page({ |
1426 | 1425 | if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) { |
1427 | 1426 | if (th.check_by_area(by_qc.region_list)) { |
1428 | 1427 | freight_free = 0; |
1428 | + goods_weight = -1; | |
1429 | + out_of_weight = 0; | |
1429 | 1430 | th.data.is_no_by[pickid] = 1; |
1430 | 1431 | } |
1431 | 1432 | } |
1432 | 1433 | //如果有设置不包邮区商品 |
1433 | 1434 | if (by_qc.goods_list != "" && by_qc.goods_list != undefined && by_qc != null && freight_free > 0) { |
1434 | 1435 | freight_free = 0; |
1436 | + goods_weight = -1; | |
1437 | + out_of_weight = 0; | |
1438 | + th.data.is_no_by[pickid] = 1; | |
1435 | 1439 | no_ex_good = by_qc.goods_list; |
1436 | 1440 | } |
1437 | 1441 | } |
... | ... | @@ -1446,7 +1450,7 @@ Page({ |
1446 | 1450 | store_id: os.stoid, |
1447 | 1451 | isuse: 0, |
1448 | 1452 | //condition: q_conditin, |
1449 | - condition:cart_item.ckeck_quan_price, | |
1453 | + condition: cart_item.ckeck_quan_price, | |
1450 | 1454 | user_id: getApp().globalData.user_id, |
1451 | 1455 | pageSize: 2000 |
1452 | 1456 | } |
... | ... | @@ -1471,7 +1475,7 @@ Page({ |
1471 | 1475 | } |
1472 | 1476 | if (arr) { |
1473 | 1477 | th.data.get_by_quan_list_cart[pickid] = arr; |
1474 | - th.setData({get_by_quan_list_cart:th.data.get_by_quan_list_cart}); | |
1478 | + th.setData({ get_by_quan_list_cart: th.data.get_by_quan_list_cart }); | |
1475 | 1479 | //if (th.data.is_b_now) { |
1476 | 1480 | // th.setData({get_by_quan_list: arr}); |
1477 | 1481 | //} |
... | ... | @@ -1496,7 +1500,7 @@ Page({ |
1496 | 1500 | if (ut.isContained(arr, arr2)) { |
1497 | 1501 | getApp().my_warnning("全场不包邮商品和包邮券的重复", 0, th); |
1498 | 1502 | th.data.using_quan[pickid] = {}; |
1499 | - th.setData({using_quan: th.data.using_quan}) | |
1503 | + th.setData({ using_quan: th.data.using_quan }) | |
1500 | 1504 | return false; |
1501 | 1505 | } |
1502 | 1506 | var n_arr = ut.mergeArray(arr, arr2); |
... | ... | @@ -1522,7 +1526,7 @@ Page({ |
1522 | 1526 | } |
1523 | 1527 | |
1524 | 1528 | //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮 |
1525 | - if (o_price - quan_price >= freight_free && freight_free > 0 && !is_good_no_by && th.data.is_no_by[pickid] != 1) { | |
1529 | + 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) { | |
1526 | 1530 | continue; |
1527 | 1531 | } |
1528 | 1532 | |
... | ... | @@ -1535,7 +1539,7 @@ Page({ |
1535 | 1539 | if (no_ex_good) no_ex_good_arr = no_ex_good.split(','); |
1536 | 1540 | |
1537 | 1541 | //----------------如果是选择了物流--------------------- |
1538 | - 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 )) { | |
1542 | + 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)) { | |
1539 | 1543 | |
1540 | 1544 | //如果地址不为空 |
1541 | 1545 | if (th.data.user_addr != null) { |
... | ... | @@ -1545,7 +1549,7 @@ Page({ |
1545 | 1549 | o_shipping_price += item[j]['uniform_exp_sum']; |
1546 | 1550 | break; |
1547 | 1551 | // case 2: //1464行已计算 不必重复计算 注释为:判断是否有设置限制重量包邮 |
1548 | - // +'' | |
1552 | + // +'' | |
1549 | 1553 | // if (goods_weight < 0) goods_weight = 0; |
1550 | 1554 | // //累积商品重量 每种商品的重量 * 数量 |
1551 | 1555 | // goods_weight += item[j]['weight'] * item[j]['goods_num']; |
... | ... | @@ -1559,12 +1563,10 @@ Page({ |
1559 | 1563 | } |
1560 | 1564 | } |
1561 | 1565 | |
1562 | - }else{ | |
1563 | - if(item[j]['exp_sum_type']==2){ | |
1564 | - if(out_of_weight !==0){ | |
1565 | - goods_weight=-1; | |
1566 | - out_of_weight=0; | |
1567 | - } | |
1566 | + } else { | |
1567 | + if (item[j]['exp_sum_type'] == 2 && out_of_weight !== 0) { | |
1568 | + goods_weight = -1; | |
1569 | + out_of_weight = 0; | |
1568 | 1570 | } |
1569 | 1571 | } |
1570 | 1572 | } |
... | ... | @@ -1576,8 +1578,8 @@ Page({ |
1576 | 1578 | if (th.data.wu_arr && th.data.wu_arr[cart_item.wind]) |
1577 | 1579 | code = th.data.wu_arr[cart_item.wind].code; |
1578 | 1580 | cart_item.shipping_price = |
1579 | - th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight, | |
1580 | - goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs); | |
1581 | + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
1582 | + goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs, pickid); | |
1581 | 1583 | |
1582 | 1584 | if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) { |
1583 | 1585 | if (cart_item.shipping_price == 0) th.data.is_by[pickid] = 1; //已经全场包邮,就不要选择券了 |
... | ... | @@ -1596,19 +1598,19 @@ Page({ |
1596 | 1598 | var order_prom_id = 0; |
1597 | 1599 | var o_condition = cart_item.order_amount; |
1598 | 1600 | //看一下是不是不用组合购的订单优惠的叠加 |
1599 | - if(is_has_zh){ | |
1600 | - o_condition=o_price_no_zh-quan_price; | |
1601 | + if (is_has_zh) { | |
1602 | + o_condition = o_price_no_zh - quan_price; | |
1601 | 1603 | } |
1602 | 1604 | |
1603 | 1605 | var order_m = 0; |
1604 | 1606 | //---判断是不是有订单优惠--- |
1605 | - await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { | |
1606 | - data: {store_id: os.stoid, orderAmount: o_condition} | |
1607 | + await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { | |
1608 | + data: { store_id: os.stoid, orderAmount: o_condition } | |
1607 | 1609 | }).then(res => { |
1608 | 1610 | if (res.data.code == 0) { |
1609 | 1611 | var ord_prom = res.data.data; |
1610 | 1612 | //么有使用券,或者活动没有限制使用优惠券 |
1611 | - if(quan_price<=0 || !ord_prom.is_xz_yh) { | |
1613 | + if (quan_price <= 0 || !ord_prom.is_xz_yh) { | |
1612 | 1614 | order_prom_id = ord_prom['id']; |
1613 | 1615 | switch (ord_prom['type']) { |
1614 | 1616 | case 0: |
... | ... | @@ -1749,7 +1751,7 @@ Page({ |
1749 | 1751 | } |
1750 | 1752 | } |
1751 | 1753 | var set_txt = "cartlist[" + iter + "].can_num"; |
1752 | - th.setData({[set_txt]: num}); | |
1754 | + th.setData({ [set_txt]: num }); | |
1753 | 1755 | } |
1754 | 1756 | }, |
1755 | 1757 | |
... | ... | @@ -1781,10 +1783,10 @@ Page({ |
1781 | 1783 | |
1782 | 1784 | allpice = parseFloat(allpice).toFixed(2); |
1783 | 1785 | var txt = "formData.all_price"; |
1784 | - th.setData({[txt]: allpice,}); | |
1786 | + th.setData({ [txt]: allpice, }); | |
1785 | 1787 | if (cut_price) { |
1786 | 1788 | var c_txt = "formData.cut_price"; |
1787 | - th.setData({[c_txt]: cut_price,}); | |
1789 | + th.setData({ [c_txt]: cut_price, }); | |
1788 | 1790 | |
1789 | 1791 | } |
1790 | 1792 | |
... | ... | @@ -1798,7 +1800,7 @@ Page({ |
1798 | 1800 | to.getwuliuprice(async function (rs) { |
1799 | 1801 | |
1800 | 1802 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; |
1801 | - var out_of_weight=null; //超出多少重量 | |
1803 | + var out_of_weight = null; //超出多少重量 | |
1802 | 1804 | var freight_free = ee.freight_free; //全场满多少包邮 |
1803 | 1805 | var weight_free = ee.weight_free; //多少kg内包邮 |
1804 | 1806 | var no_ex_id = ee.no_ex_id; |
... | ... | @@ -1852,7 +1854,7 @@ Page({ |
1852 | 1854 | arr.push(item); |
1853 | 1855 | } |
1854 | 1856 | if (arr) { |
1855 | - th.setData({get_by_quan_list: arr}); | |
1857 | + th.setData({ get_by_quan_list: arr }); | |
1856 | 1858 | } |
1857 | 1859 | th.data.isget_by_quan[th.data.bn_pick] = 1; |
1858 | 1860 | } |
... | ... | @@ -1868,8 +1870,8 @@ Page({ |
1868 | 1870 | if (goods_weight < 0) goods_weight = 0; |
1869 | 1871 | //累积商品重量 每种商品的重量 * 数量 |
1870 | 1872 | goods_weight += good['weight'] * good['buynum']; |
1871 | - if(weight_free > 0){ | |
1872 | - out_of_weight = (weight_free * 1000 ) - goods_weight; | |
1873 | + if (weight_free > 0) { | |
1874 | + out_of_weight = (weight_free * 1000) - goods_weight; | |
1873 | 1875 | } |
1874 | 1876 | break; |
1875 | 1877 | case 3: |
... | ... | @@ -1881,7 +1883,7 @@ Page({ |
1881 | 1883 | |
1882 | 1884 | var code = ""; |
1883 | 1885 | if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; |
1884 | - | |
1886 | + | |
1885 | 1887 | th.data.is_no_by[th.data.bn_pick] = 0; |
1886 | 1888 | |
1887 | 1889 | var no_by_data = null; |
... | ... | @@ -1892,7 +1894,7 @@ Page({ |
1892 | 1894 | if (no_ex_id && freight_free > 0 && freight_free <= parseFloat(allpice) - cut_price - quan_price) { |
1893 | 1895 | //-----------获取不包邮区域,不包邮商品------- |
1894 | 1896 | await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", { |
1895 | - data: {store_id: os.stoid, id: no_ex_id} | |
1897 | + data: { store_id: os.stoid, id: no_ex_id } | |
1896 | 1898 | }).then(res => { |
1897 | 1899 | if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { |
1898 | 1900 | no_by_data = res.data.data[0]; |
... | ... | @@ -1900,7 +1902,7 @@ Page({ |
1900 | 1902 | if (res.data.data[0].region_list) { |
1901 | 1903 | if (th.check_by_area(res.data.data[0].region_list)) { |
1902 | 1904 | freight_free = 0; |
1903 | - out_of_weight=0; | |
1905 | + out_of_weight = 0; | |
1904 | 1906 | th.data.is_no_by[th.data.bn_pick] = 1; |
1905 | 1907 | } |
1906 | 1908 | } |
... | ... | @@ -1908,7 +1910,7 @@ Page({ |
1908 | 1910 | if (res.data.data[0].goods_list && freight_free) { |
1909 | 1911 | if (th.check_by_goods(res.data.data[0].goods_list)) { |
1910 | 1912 | freight_free = 0; |
1911 | - out_of_weight=0; | |
1913 | + out_of_weight = 0; | |
1912 | 1914 | th.data.is_no_by[th.data.bn_pick] = 1; |
1913 | 1915 | } |
1914 | 1916 | } |
... | ... | @@ -1919,12 +1921,12 @@ Page({ |
1919 | 1921 | th.data.is_by[th.data.bn_pick] = 0; |
1920 | 1922 | //--------------开始计算物流------------------ |
1921 | 1923 | var shipping_price = |
1922 | - th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight, | |
1923 | - goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs); | |
1924 | + th.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
1925 | + goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs,th.data.bn_pick); | |
1924 | 1926 | |
1925 | 1927 | //如果有赠品的时候,也要计算赠品的物流费用 |
1926 | 1928 | if (th.data.buy_now_gift_goods) { |
1927 | - shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,out_of_weight, | |
1929 | + shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, out_of_weight, | |
1928 | 1930 | parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece); |
1929 | 1931 | } |
1930 | 1932 | |
... | ... | @@ -1934,18 +1936,18 @@ Page({ |
1934 | 1936 | |
1935 | 1937 | shipping_price = parseFloat(shipping_price).toFixed(2); |
1936 | 1938 | var wl_txt = "formData.shipping_price"; |
1937 | - th.setData({[wl_txt]: shipping_price,}) | |
1939 | + th.setData({ [wl_txt]: shipping_price, }) | |
1938 | 1940 | |
1939 | 1941 | } else { |
1940 | 1942 | var wl_txt = "formData.shipping_price"; |
1941 | - th.setData({[wl_txt]: 0,}) | |
1943 | + th.setData({ [wl_txt]: 0, }) | |
1942 | 1944 | } |
1943 | 1945 | |
1944 | 1946 | if (quan_no) { |
1945 | 1947 | if (th.data.using_quan[bn_pick].isby == 1) { |
1946 | 1948 | shipping_price = 0; |
1947 | 1949 | var wl_txt = "formData.shipping_price"; |
1948 | - th.setData({[wl_txt]: 0,}) | |
1950 | + th.setData({ [wl_txt]: 0, }) | |
1949 | 1951 | } |
1950 | 1952 | } |
1951 | 1953 | //-----------------支付价,优惠券不减物流----------------- |
... | ... | @@ -1966,7 +1968,7 @@ Page({ |
1966 | 1968 | var ord_prom = th.data.order_prom[th.data.bn_pick]; |
1967 | 1969 | |
1968 | 1970 | //么有使用券,或者活动没有限制使用优惠券 |
1969 | - if(coupon_price<=0 || !ord_prom.is_xz_yh) { | |
1971 | + if (coupon_price <= 0 || !ord_prom.is_xz_yh) { | |
1970 | 1972 | order_prom_id = ord_prom['id']; |
1971 | 1973 | switch (ord_prom['type']) { |
1972 | 1974 | case 0: |
... | ... | @@ -1984,7 +1986,7 @@ Page({ |
1984 | 1986 | if (order_prom_id > 0) { |
1985 | 1987 | var order_prom_txt1 = "formData.order_prom_id"; |
1986 | 1988 | var order_prom_txt2 = "formData.order_prom_amount"; |
1987 | - th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) | |
1989 | + th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount }) | |
1988 | 1990 | } |
1989 | 1991 | |
1990 | 1992 | total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); |
... | ... | @@ -1994,7 +1996,7 @@ Page({ |
1994 | 1996 | order_m = order_m.toFixed(2); |
1995 | 1997 | |
1996 | 1998 | var atxt = "formData.total_amount"; |
1997 | - th.setData({[atxt]: total_m,}) | |
1999 | + th.setData({ [atxt]: total_m, }) | |
1998 | 2000 | |
1999 | 2001 | var txt = "formData.user_money"; |
2000 | 2002 | var txt2 = "formData.order_amount"; |
... | ... | @@ -2004,44 +2006,44 @@ Page({ |
2004 | 2006 | if (th.data.bn_use_money == 1) { |
2005 | 2007 | if (amoney > order_m) { |
2006 | 2008 | order_m = parseFloat(order_m).toFixed(2); |
2007 | - th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) | |
2009 | + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 }) | |
2008 | 2010 | } else { |
2009 | 2011 | order_m = parseFloat(order_m) - parseFloat(amoney); |
2010 | 2012 | order_m = order_m.toFixed(2); |
2011 | - th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) | |
2013 | + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) | |
2012 | 2014 | } |
2013 | 2015 | } else { |
2014 | - th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) | |
2016 | + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) | |
2015 | 2017 | } |
2016 | 2018 | //优惠活动送积分 |
2017 | 2019 | if (good.s_intValue) { |
2018 | 2020 | txt = "formData.give_integral"; |
2019 | - th.setData({[txt]: good.s_intValue}); | |
2021 | + th.setData({ [txt]: good.s_intValue }); | |
2020 | 2022 | } |
2021 | 2023 | //优惠送券 |
2022 | 2024 | if (good.s_coupon_id) { |
2023 | 2025 | var i_txt = "formData.give_coupon_id"; |
2024 | 2026 | //这个是json格式的 |
2025 | 2027 | var i_txt1 = "formData.g_coupon_num"; |
2026 | - var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; | |
2028 | + var ob = [{ "num": good.s_coupon_num, "c_id": good.s_coupon_id }]; | |
2027 | 2029 | ob = JSON.stringify(ob); |
2028 | - th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); | |
2030 | + th.setData({ [i_txt]: good.s_coupon_id, [i_txt1]: ob }); | |
2029 | 2031 | } |
2030 | 2032 | //优惠礼包 |
2031 | 2033 | if (good.s_libao) { |
2032 | 2034 | var l_txt = "formData.give_lb_id"; |
2033 | 2035 | //这个是json格式的 |
2034 | 2036 | var l_txt1 = "formData.g_lb_num"; |
2035 | - var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; | |
2037 | + var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }]; | |
2036 | 2038 | ob = JSON.stringify(ob); |
2037 | - th.setData({[l_txt]: good.s_libao, [l_txt1]: ob}); | |
2039 | + th.setData({ [l_txt]: good.s_libao, [l_txt1]: ob }); | |
2038 | 2040 | } |
2039 | 2041 | }) |
2040 | 2042 | } else { |
2041 | 2043 | |
2042 | 2044 | var order_prom_txt1 = "formData.order_prom_id"; |
2043 | 2045 | var order_prom_txt2 = "formData.order_prom_amount"; |
2044 | - th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0}) | |
2046 | + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 }) | |
2045 | 2047 | |
2046 | 2048 | |
2047 | 2049 | total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); |
... | ... | @@ -2051,7 +2053,7 @@ Page({ |
2051 | 2053 | total_m = total_m.toFixed(2); |
2052 | 2054 | order_m = order_m.toFixed(2); |
2053 | 2055 | |
2054 | - th.setData({[atxt]: total_m,}) | |
2056 | + th.setData({ [atxt]: total_m, }) | |
2055 | 2057 | |
2056 | 2058 | var txt = "formData.user_money"; |
2057 | 2059 | var txt2 = "formData.order_amount"; |
... | ... | @@ -2061,37 +2063,37 @@ Page({ |
2061 | 2063 | if (th.data.bn_use_money == 1) { |
2062 | 2064 | if (amoney > order_m) { |
2063 | 2065 | order_m = parseFloat(order_m).toFixed(2); |
2064 | - th.setData({[txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1}) | |
2066 | + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 }) | |
2065 | 2067 | } else { |
2066 | 2068 | order_m = parseFloat(order_m) - parseFloat(amoney); |
2067 | 2069 | order_m = order_m.toFixed(2); |
2068 | - th.setData({[txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) | |
2070 | + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) | |
2069 | 2071 | } |
2070 | 2072 | } else { |
2071 | - th.setData({[txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1}) | |
2073 | + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) | |
2072 | 2074 | } |
2073 | 2075 | //优惠活动送积分 |
2074 | 2076 | if (good.s_intValue) { |
2075 | 2077 | txt = "formData.give_integral"; |
2076 | - th.setData({[txt]: good.s_intValue}); | |
2078 | + th.setData({ [txt]: good.s_intValue }); | |
2077 | 2079 | } |
2078 | 2080 | //优惠送券 |
2079 | 2081 | if (good.s_coupon_id) { |
2080 | 2082 | var i_txt = "formData.give_coupon_id"; |
2081 | 2083 | //这个是json格式的 |
2082 | 2084 | var i_txt1 = "formData.g_coupon_num"; |
2083 | - var ob = [{"num": good.s_coupon_num, "c_id": good.s_coupon_id}]; | |
2085 | + var ob = [{ "num": good.s_coupon_num, "c_id": good.s_coupon_id }]; | |
2084 | 2086 | ob = JSON.stringify(ob); |
2085 | - th.setData({[i_txt]: good.s_coupon_id, [i_txt1]: ob}); | |
2087 | + th.setData({ [i_txt]: good.s_coupon_id, [i_txt1]: ob }); | |
2086 | 2088 | } |
2087 | 2089 | //优惠礼包 |
2088 | 2090 | if (good.s_libao) { |
2089 | 2091 | var l_txt = "formData.give_lb_id"; |
2090 | 2092 | //这个是json格式的 |
2091 | 2093 | var l_txt1 = "formData.g_lb_num"; |
2092 | - var ob = [{"num": good.s_lb_num, "l_id": good.s_libao}]; | |
2094 | + var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }]; | |
2093 | 2095 | ob = JSON.stringify(ob); |
2094 | - th.setData({[l_txt]: good.s_coupon_id, [l_txt1]: ob}); | |
2096 | + th.setData({ [l_txt]: good.s_coupon_id, [l_txt1]: ob }); | |
2095 | 2097 | } |
2096 | 2098 | } |
2097 | 2099 | |
... | ... | @@ -2102,7 +2104,7 @@ Page({ |
2102 | 2104 | }, |
2103 | 2105 | |
2104 | 2106 | //--------------------提交订单----------------------- |
2105 | - async submitForm(t){ | |
2107 | + async submitForm(t) { | |
2106 | 2108 | var sub_value = t; |
2107 | 2109 | |
2108 | 2110 | if (this.data.is_summit_ing == 1) return false; //--提交中退出-- |
... | ... | @@ -2174,7 +2176,7 @@ Page({ |
2174 | 2176 | } |
2175 | 2177 | |
2176 | 2178 | //--判断优惠活动的提交-- |
2177 | - if (th.data.formData.cut_price > 0 ) { | |
2179 | + if (th.data.formData.cut_price > 0) { | |
2178 | 2180 | order_prom_list.discount_amount = th.data.formData.cut_price.toFixed(2); |
2179 | 2181 | var ob = [{ |
2180 | 2182 | "prom_id": th.data.bn_goods.prom_id, |
... | ... | @@ -2237,7 +2239,7 @@ Page({ |
2237 | 2239 | goods.guide_id = gg.guide_id; |
2238 | 2240 | goods.guide_type = gg.guide_type; |
2239 | 2241 | //调用接口判断是不是会员 |
2240 | - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { | |
2242 | + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { | |
2241 | 2243 | if (res.data.code == 0) { |
2242 | 2244 | goods.guide_name = res.data.data.salesman; |
2243 | 2245 | goods.guide_sn = res.data.data.salesman_no; |
... | ... | @@ -2289,7 +2291,7 @@ Page({ |
2289 | 2291 | } |
2290 | 2292 | |
2291 | 2293 | var pt_res = null; |
2292 | - await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { | |
2294 | + await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", { | |
2293 | 2295 | is_json: 1, |
2294 | 2296 | data: pt_data |
2295 | 2297 | }).then(res => { |
... | ... | @@ -2409,14 +2411,14 @@ Page({ |
2409 | 2411 | order_prom_list.order_prom_amount = t_item.order_prom_amount; |
2410 | 2412 | } |
2411 | 2413 | |
2412 | - order_prom_list.discount_amount =0; | |
2414 | + order_prom_list.discount_amount = 0; | |
2413 | 2415 | //--判断优惠活动的提交-- |
2414 | 2416 | if (t_item.cut_price > 0) { |
2415 | 2417 | order_prom_list.discount_amount += t_item.cut_price; |
2416 | 2418 | order_prom_list.prom_pt_json = JSON.stringify(t_item.prom_pt_json); |
2417 | 2419 | } |
2418 | 2420 | //--判断组合优惠活动的提交-- |
2419 | - if (t_item.zh_cut_price > 0 || t_item.zh_cut_price<0) { | |
2421 | + if (t_item.zh_cut_price > 0 || t_item.zh_cut_price < 0) { | |
2420 | 2422 | order_prom_list.discount_amount += t_item.zh_cut_price; |
2421 | 2423 | order_prom_list.zh_pt_json = JSON.stringify(t_item.zh_pt_json); |
2422 | 2424 | } |
... | ... | @@ -2431,11 +2433,11 @@ Page({ |
2431 | 2433 | order_prom_list.give_lb_id = t_item.s_libao; |
2432 | 2434 | order_prom_list.g_lb_num = JSON.stringify(t_item.g_lb_num); |
2433 | 2435 | } |
2434 | - if (Object.keys(order_prom_list).length > 0){ | |
2435 | - if(order_prom_list.discount_amount) | |
2436 | - order_prom_list.discount_amount= parseFloat(order_prom_list.discount_amount).toFixed(2); | |
2437 | - if(order_prom_list.order_prom_amount) | |
2438 | - order_prom_list.order_prom_amount= parseFloat(order_prom_list.order_prom_amount).toFixed(2); | |
2436 | + if (Object.keys(order_prom_list).length > 0) { | |
2437 | + if (order_prom_list.discount_amount) | |
2438 | + order_prom_list.discount_amount = parseFloat(order_prom_list.discount_amount).toFixed(2); | |
2439 | + if (order_prom_list.order_prom_amount) | |
2440 | + order_prom_list.order_prom_amount = parseFloat(order_prom_list.order_prom_amount).toFixed(2); | |
2439 | 2441 | item.order_prom_list = order_prom_list; |
2440 | 2442 | } |
2441 | 2443 | |
... | ... | @@ -2459,7 +2461,7 @@ Page({ |
2459 | 2461 | //-------------让商品添加到商品列表-------------------- |
2460 | 2462 | for (var k = 0; k < t_item.goods.length; k++) { |
2461 | 2463 | var g_item = t_item.goods[k]; |
2462 | - if(g_item.goods_num<=0) continue; | |
2464 | + if (g_item.goods_num <= 0) continue; | |
2463 | 2465 | var goods = { |
2464 | 2466 | 'goods_id': g_item.goods_id, |
2465 | 2467 | 'goods_name': g_item.goods_name, |
... | ... | @@ -2472,7 +2474,7 @@ Page({ |
2472 | 2474 | }; |
2473 | 2475 | |
2474 | 2476 | //-- 线下取价也要写入,组合购的商品不能去线下价格 -- |
2475 | - if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type!=7) { | |
2477 | + if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type != 7) { | |
2476 | 2478 | goods.goods_price = g_item.offline_price; |
2477 | 2479 | goods.member_goods_price = g_item.offline_price; |
2478 | 2480 | goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); |
... | ... | @@ -2483,7 +2485,7 @@ Page({ |
2483 | 2485 | if (t_item.quan_youhui_list && t_item.coupon_price) { |
2484 | 2486 | for (var kk in t_item.quan_youhui_list) { |
2485 | 2487 | var you_item = t_item.quan_youhui_list[kk]; |
2486 | - if (g_item.prom_type!=7 && g_item.erpwareid == you_item.WareId) { | |
2488 | + if (g_item.prom_type != 7 && g_item.erpwareid == you_item.WareId) { | |
2487 | 2489 | goods.quan_num = you_item.WareCashSum; |
2488 | 2490 | goods.quan_no = you_item.CashRepNo; |
2489 | 2491 | } |
... | ... | @@ -2493,7 +2495,7 @@ Page({ |
2493 | 2495 | //--判断活动的类型-- |
2494 | 2496 | switch (g_item.prom_type) { |
2495 | 2497 | case 1: |
2496 | - case 2: | |
2498 | + case 2: | |
2497 | 2499 | goods.prom_type = g_item.prom_type; |
2498 | 2500 | goods.prom_id = g_item.prom_id; |
2499 | 2501 | break; |
... | ... | @@ -2535,7 +2537,7 @@ Page({ |
2535 | 2537 | } |
2536 | 2538 | |
2537 | 2539 | //把优惠的平摊结果写进去 |
2538 | - if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account!=undefined)) { | |
2540 | + if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account != undefined)) { | |
2539 | 2541 | if (g_item.account >= 0) goods.account = g_item.account; |
2540 | 2542 | if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu; |
2541 | 2543 | item.is_discount_amount = 1; |
... | ... | @@ -2546,7 +2548,7 @@ Page({ |
2546 | 2548 | goods.guide_id = g_item.guide_id; |
2547 | 2549 | goods.guide_type = g_item.guide_type; |
2548 | 2550 | //调用接口判断是不是会员 |
2549 | - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => { | |
2551 | + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => { | |
2550 | 2552 | if (res.data.code == 0) { |
2551 | 2553 | goods.guide_name = res.data.data.salesman; |
2552 | 2554 | goods.guide_sn = res.data.data.salesman_no; |
... | ... | @@ -2572,7 +2574,7 @@ Page({ |
2572 | 2574 | if (pdata.length == 0) return; |
2573 | 2575 | var str = JSON.stringify(pdata); |
2574 | 2576 | |
2575 | - wx.showLoading({title: "加载中"}); | |
2577 | + wx.showLoading({ title: "加载中" }); | |
2576 | 2578 | wx.request({ |
2577 | 2579 | url: oo.url + '/api/weshop/order/createWxdOrder', |
2578 | 2580 | data: str, |
... | ... | @@ -2603,7 +2605,7 @@ Page({ |
2603 | 2605 | }) |
2604 | 2606 | //要进行判断,如果是用微信支付,就要跳转到支付界面 |
2605 | 2607 | if (order_amount > 0) { |
2606 | - th.setData({isclose: 0}); | |
2608 | + th.setData({ isclose: 0 }); | |
2607 | 2609 | //void e.jumpToCart4({ |
2608 | 2610 | // order_sn: data.data, |
2609 | 2611 | //}, 1); |
... | ... | @@ -2618,12 +2620,12 @@ Page({ |
2618 | 2620 | }, function () { |
2619 | 2621 | //支付失败 |
2620 | 2622 | setTimeout(function () { |
2621 | - var cps=getCurrentPages(); | |
2622 | - if(cps.length>1){ | |
2623 | - wx.navigateBack({delta: 1}) | |
2624 | - }else{ | |
2625 | - getApp().goto("/pages/index/index/index"); | |
2626 | - } | |
2623 | + var cps = getCurrentPages(); | |
2624 | + if (cps.length > 1) { | |
2625 | + wx.navigateBack({ delta: 1 }) | |
2626 | + } else { | |
2627 | + getApp().goto("/pages/index/index/index"); | |
2628 | + } | |
2627 | 2629 | |
2628 | 2630 | }, 1000) |
2629 | 2631 | }, oo.stoid); |
... | ... | @@ -2641,7 +2643,7 @@ Page({ |
2641 | 2643 | if (t.data.code == 0) { |
2642 | 2644 | //app.my_warnning("支付成功",1,th); |
2643 | 2645 | //setTimeout(function () { |
2644 | - th.setData({isclose: 0}); | |
2646 | + th.setData({ isclose: 0 }); | |
2645 | 2647 | wx.redirectTo({ |
2646 | 2648 | url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data, |
2647 | 2649 | }) |
... | ... | @@ -2666,7 +2668,7 @@ Page({ |
2666 | 2668 | cancelText: '取消', |
2667 | 2669 | confirmText: '确定', |
2668 | 2670 | showCancel: true, |
2669 | - success(res){ | |
2671 | + success(res) { | |
2670 | 2672 | if (res.cancel) { |
2671 | 2673 | return; |
2672 | 2674 | } else if (res.confirm) { |
... | ... | @@ -2700,11 +2702,11 @@ Page({ |
2700 | 2702 | |
2701 | 2703 | }, |
2702 | 2704 | //---确认线下门店的数量足不足--- |
2703 | - async check_store_num(goods_id, pick, goods_num, func){ | |
2705 | + async check_store_num(goods_id, pick, goods_num, func) { | |
2704 | 2706 | var lock = 0, pick_no, plist, erpwareid; |
2705 | 2707 | //先读取门店的lock |
2706 | 2708 | await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { |
2707 | - data: {store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000} | |
2709 | + data: { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 } | |
2708 | 2710 | }).then(res => { |
2709 | 2711 | if (res.data.code == 0 && res.data.data.total > 0) { |
2710 | 2712 | for (var i in res.data.data.pageData) |
... | ... | @@ -2713,7 +2715,7 @@ Page({ |
2713 | 2715 | }) |
2714 | 2716 | //先获取门店的编号 |
2715 | 2717 | await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, { |
2716 | - data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} | |
2718 | + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick } | |
2717 | 2719 | }).then(res => { |
2718 | 2720 | if (res.data.code == 0) { |
2719 | 2721 | pick_no = res.data.data.pickup_no; |
... | ... | @@ -2721,7 +2723,7 @@ Page({ |
2721 | 2723 | }) |
2722 | 2724 | //先获取商品的线下库存 |
2723 | 2725 | await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { |
2724 | - data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} | |
2726 | + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick } | |
2725 | 2727 | }).then(res => { |
2726 | 2728 | if (res.data.code == 0) { |
2727 | 2729 | erpwareid = res.data.data.erpwareid; |
... | ... | @@ -2729,7 +2731,7 @@ Page({ |
2729 | 2731 | }) |
2730 | 2732 | //读取线下的门店库存 |
2731 | 2733 | await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { |
2732 | - data: {storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000} | |
2734 | + data: { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000 } | |
2733 | 2735 | }).then(res => { |
2734 | 2736 | if (res.data.code == 0) { |
2735 | 2737 | plist = res.data.data.pageData[0]; |
... | ... | @@ -2771,11 +2773,11 @@ Page({ |
2771 | 2773 | wl_txt = t.currentTarget.dataset.wl_txt, |
2772 | 2774 | ont = t.currentTarget.dataset.ont; |
2773 | 2775 | |
2774 | - th.setData({[txt]: ty}); | |
2776 | + th.setData({ [txt]: ty }); | |
2775 | 2777 | var iszt = 1; |
2776 | 2778 | |
2777 | 2779 | if (ty == 0) { |
2778 | - th.setData({is_all_zt: 0}); | |
2780 | + th.setData({ is_all_zt: 0 }); | |
2779 | 2781 | } else { |
2780 | 2782 | for (var i = 0; i < th.data.cartlist.length; i++) { |
2781 | 2783 | var item = th.data.cartlist[i]; |
... | ... | @@ -2785,7 +2787,7 @@ Page({ |
2785 | 2787 | } |
2786 | 2788 | } |
2787 | 2789 | |
2788 | - th.setData({is_all_zt: iszt}); | |
2790 | + th.setData({ is_all_zt: iszt }); | |
2789 | 2791 | |
2790 | 2792 | var ind = t.currentTarget.dataset.ind; |
2791 | 2793 | var c_item = th.data.cartlist[ind]; |
... | ... | @@ -2793,7 +2795,7 @@ Page({ |
2793 | 2795 | |
2794 | 2796 | if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1) { |
2795 | 2797 | th.data.using_quan[pickid] = {}; |
2796 | - th.setData({using_quan: th.data.using_quan}); | |
2798 | + th.setData({ using_quan: th.data.using_quan }); | |
2797 | 2799 | } |
2798 | 2800 | |
2799 | 2801 | |
... | ... | @@ -2805,7 +2807,7 @@ Page({ |
2805 | 2807 | for (var i = 0; i < wu_arr.length; i++) { |
2806 | 2808 | if (wu_arr[i].shipping_code == def_exp_code) { |
2807 | 2809 | var set_txt = "cartlist" |
2808 | - th.setData({wl_txt: i}); | |
2810 | + th.setData({ wl_txt: i }); | |
2809 | 2811 | } |
2810 | 2812 | } |
2811 | 2813 | } |
... | ... | @@ -2818,9 +2820,9 @@ Page({ |
2818 | 2820 | setexptype: function (t) { |
2819 | 2821 | var th = this; |
2820 | 2822 | var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; |
2821 | - th.setData({bn_exp_type: ty}); | |
2823 | + th.setData({ bn_exp_type: ty }); | |
2822 | 2824 | if (ty == 0) { |
2823 | - th.setData({is_all_zt: 0}); | |
2825 | + th.setData({ is_all_zt: 0 }); | |
2824 | 2826 | } |
2825 | 2827 | |
2826 | 2828 | //当物流为空的时候。 |
... | ... | @@ -2833,7 +2835,7 @@ Page({ |
2833 | 2835 | if (ty == 1) { |
2834 | 2836 | th.data.isget_by_quan = {}; |
2835 | 2837 | if (th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) { |
2836 | - th.setData({using_quan: {}}); | |
2838 | + th.setData({ using_quan: {} }); | |
2837 | 2839 | } |
2838 | 2840 | } |
2839 | 2841 | |
... | ... | @@ -2843,7 +2845,7 @@ Page({ |
2843 | 2845 | if (wu_arr != null && wu_arr != "") { |
2844 | 2846 | for (var i = 0; i < wu_arr.length; i++) { |
2845 | 2847 | if (wu_arr[i].shipping_code == def_exp_code) { |
2846 | - th.setData({index: i}); | |
2848 | + th.setData({ index: i }); | |
2847 | 2849 | } |
2848 | 2850 | } |
2849 | 2851 | } |
... | ... | @@ -2855,17 +2857,17 @@ Page({ |
2855 | 2857 | //--------立即购买时,使用余额-------- |
2856 | 2858 | set_bn_useyuer: function () { |
2857 | 2859 | var th = this; |
2858 | - th.setData({bn_use_money: !th.data.bn_use_money}); | |
2860 | + th.setData({ bn_use_money: !th.data.bn_use_money }); | |
2859 | 2861 | th.calculatePrice2(); |
2860 | 2862 | }, |
2861 | 2863 | set_js_useyuer: function () { |
2862 | 2864 | var th = this; |
2863 | - th.setData({js_use_money: !th.data.js_use_money}); | |
2865 | + th.setData({ js_use_money: !th.data.js_use_money }); | |
2864 | 2866 | th.calculatePrice(); |
2865 | 2867 | }, |
2866 | 2868 | //-------------------计算物流--------------- |
2867 | - calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight, | |
2868 | - goods_piece, user_addr, freight_free, o_price, rs) { | |
2869 | + calculatewuliu: function (code, o_shipping_price, goods_weight, out_of_weight, | |
2870 | + goods_piece, user_addr, freight_free, o_price, rs, pickid) { | |
2869 | 2871 | var price = 0, th = this; |
2870 | 2872 | price += parseFloat(o_shipping_price); |
2871 | 2873 | //如果是包邮 |
... | ... | @@ -2896,7 +2898,7 @@ Page({ |
2896 | 2898 | } |
2897 | 2899 | } |
2898 | 2900 | //------超出重量---------- |
2899 | - if(out_of_weight < 0 && o_price >= freight_free){ | |
2901 | + if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) { | |
2900 | 2902 | fw_price = parseFloat(item['money']); |
2901 | 2903 | var out_of_weight = Math.abs(out_of_weight); |
2902 | 2904 | if (out_of_weight > item['first_weight']) { |
... | ... | @@ -2942,13 +2944,13 @@ Page({ |
2942 | 2944 | //----------立即购买,选择物流------------- |
2943 | 2945 | bindPickerChange: function (e) { |
2944 | 2946 | var ind = e.detail.value |
2945 | - this.setData({index: ind}); | |
2947 | + this.setData({ index: ind }); | |
2946 | 2948 | this.calculatePrice2(); |
2947 | 2949 | }, |
2948 | 2950 | //----------购物车结算,选择物流------------- |
2949 | 2951 | bindPickerChange_w: function (e) { |
2950 | 2952 | var ind = e.detail.value, txt = e.currentTarget.dataset.txt; |
2951 | - this.setData({[txt]: ind}); | |
2953 | + this.setData({ [txt]: ind }); | |
2952 | 2954 | this.calculatePrice(); |
2953 | 2955 | }, |
2954 | 2956 | |
... | ... | @@ -2962,7 +2964,7 @@ Page({ |
2962 | 2964 | |
2963 | 2965 | |
2964 | 2966 | if (bn == 1) { |
2965 | - th.setData({open_quan: 1, selected_quan_pick: pickid, disabled: 1}); | |
2967 | + th.setData({ open_quan: 1, selected_quan_pick: pickid, disabled: 1 }); | |
2966 | 2968 | } else { |
2967 | 2969 | //---多单打开券的时候,就要判断券在其他门店是否有使用--- |
2968 | 2970 | var quanlist = th.data.cartlist[cindx].quan_list; |
... | ... | @@ -2988,9 +2990,9 @@ Page({ |
2988 | 2990 | else |
2989 | 2991 | get_by_quan_list_cart[i].show_red = 0; |
2990 | 2992 | } |
2991 | - th.setData({by_quan_list_cart: get_by_quan_list_cart}); | |
2993 | + th.setData({ by_quan_list_cart: get_by_quan_list_cart }); | |
2992 | 2994 | } else { |
2993 | - th.setData({by_quan_list_cart: null}); | |
2995 | + th.setData({ by_quan_list_cart: null }); | |
2994 | 2996 | } |
2995 | 2997 | |
2996 | 2998 | console.log("2222222券的列表", quanlist); |
... | ... | @@ -3006,7 +3008,7 @@ Page({ |
3006 | 3008 | }, |
3007 | 3009 | close_coupon: function (e) { |
3008 | 3010 | var th = this; |
3009 | - th.setData({open_quan: 0, disabled: 0}); | |
3011 | + th.setData({ open_quan: 0, disabled: 0 }); | |
3010 | 3012 | }, |
3011 | 3013 | |
3012 | 3014 | //---判断券时候在已经选择的列表中--- |
... | ... | @@ -3077,14 +3079,14 @@ Page({ |
3077 | 3079 | for (var i in quanlist) { |
3078 | 3080 | quanlist[i].show_red = 0; |
3079 | 3081 | } |
3080 | - this.setData({selected_quan_list: quanlist}); | |
3082 | + this.setData({ selected_quan_list: quanlist }); | |
3081 | 3083 | var by_quanlist = this.data.get_by_quan_list; |
3082 | 3084 | if (by_quanlist) { |
3083 | 3085 | //---所有的券的显示红色选择都清理一遍--- |
3084 | 3086 | for (var inb in by_quanlist) { |
3085 | 3087 | by_quanlist[inb].show_red = 0; |
3086 | 3088 | } |
3087 | - this.setData({get_by_quan_list: by_quanlist}); | |
3089 | + this.setData({ get_by_quan_list: by_quanlist }); | |
3088 | 3090 | } |
3089 | 3091 | |
3090 | 3092 | var by_cart_list = this.data.by_quan_list_cart; |
... | ... | @@ -3093,7 +3095,7 @@ Page({ |
3093 | 3095 | for (var inc in by_cart_list) { |
3094 | 3096 | by_cart_list[inc].show_red = 0; |
3095 | 3097 | } |
3096 | - this.setData({by_quan_list_cart: by_cart_list}); | |
3098 | + this.setData({ by_quan_list_cart: by_cart_list }); | |
3097 | 3099 | } |
3098 | 3100 | |
3099 | 3101 | var using_quan = this.data.using_quan; |
... | ... | @@ -3105,9 +3107,9 @@ Page({ |
3105 | 3107 | using_quan[th.data.selected_quan_pick].is_nouse_red = 1; |
3106 | 3108 | } |
3107 | 3109 | else { |
3108 | - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; | |
3110 | + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 }; | |
3109 | 3111 | } |
3110 | - this.setData({using_quan: using_quan, is_coupon: 2222}); | |
3112 | + this.setData({ using_quan: using_quan, is_coupon: 2222 }); | |
3111 | 3113 | return; |
3112 | 3114 | } |
3113 | 3115 | |
... | ... | @@ -3124,9 +3126,9 @@ Page({ |
3124 | 3126 | using_quan[th.data.selected_quan_pick].is_nouse_red = 0; |
3125 | 3127 | } |
3126 | 3128 | else { |
3127 | - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; | |
3129 | + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 }; | |
3128 | 3130 | } |
3129 | - this.setData({using_quan: using_quan}); | |
3131 | + this.setData({ using_quan: using_quan }); | |
3130 | 3132 | |
3131 | 3133 | }, |
3132 | 3134 | |
... | ... | @@ -3141,7 +3143,7 @@ Page({ |
3141 | 3143 | for (var ind in by_quanlist) { |
3142 | 3144 | by_quanlist[ind].show_red = 0; |
3143 | 3145 | } |
3144 | - this.setData({get_by_quan_list: by_quanlist}); | |
3146 | + this.setData({ get_by_quan_list: by_quanlist }); | |
3145 | 3147 | } |
3146 | 3148 | |
3147 | 3149 | //--购物车过来的包邮券-- |
... | ... | @@ -3151,7 +3153,7 @@ Page({ |
3151 | 3153 | for (var ind in by_cart_list) { |
3152 | 3154 | by_cart_list[ind].show_red = 0; |
3153 | 3155 | } |
3154 | - this.setData({by_quan_list_cart: by_cart_list}); | |
3156 | + this.setData({ by_quan_list_cart: by_cart_list }); | |
3155 | 3157 | } |
3156 | 3158 | //普通券 |
3157 | 3159 | var quanlist = this.data.selected_quan_list; |
... | ... | @@ -3160,7 +3162,7 @@ Page({ |
3160 | 3162 | for (var ind in quanlist) { |
3161 | 3163 | quanlist[ind].show_red = 0; |
3162 | 3164 | } |
3163 | - this.setData({selected_quan_list: quanlist}); | |
3165 | + this.setData({ selected_quan_list: quanlist }); | |
3164 | 3166 | } |
3165 | 3167 | |
3166 | 3168 | var th = this; |
... | ... | @@ -3171,9 +3173,9 @@ Page({ |
3171 | 3173 | using_quan[th.data.selected_quan_pick].is_nouse_red = 1; |
3172 | 3174 | } |
3173 | 3175 | else { |
3174 | - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 1}; | |
3176 | + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 1 }; | |
3175 | 3177 | } |
3176 | - this.setData({using_quan: using_quan, is_coupon: 2222}); | |
3178 | + this.setData({ using_quan: using_quan, is_coupon: 2222 }); | |
3177 | 3179 | return; |
3178 | 3180 | } |
3179 | 3181 | |
... | ... | @@ -3202,9 +3204,9 @@ Page({ |
3202 | 3204 | using_quan[th.data.selected_quan_pick].is_nouse_red = 0; |
3203 | 3205 | } |
3204 | 3206 | else { |
3205 | - using_quan[th.data.selected_quan_pick] = {is_nouse_red: 0}; | |
3207 | + using_quan[th.data.selected_quan_pick] = { is_nouse_red: 0 }; | |
3206 | 3208 | } |
3207 | - this.setData({using_quan: using_quan}); | |
3209 | + this.setData({ using_quan: using_quan }); | |
3208 | 3210 | }, |
3209 | 3211 | |
3210 | 3212 | //--确认使用券--- |
... | ... | @@ -3264,14 +3266,14 @@ Page({ |
3264 | 3266 | //选择了的券,看是不是点击了不使用券,点击了不使用优惠券 |
3265 | 3267 | if (using_quan[pickid]) { |
3266 | 3268 | if (using_quan[pickid].is_nouse_red == 1) { |
3267 | - using_quan[pickid] = {is_nouse_red: 1}; | |
3268 | - th.setData({using_quan: using_quan}); | |
3269 | + using_quan[pickid] = { is_nouse_red: 1 }; | |
3270 | + th.setData({ using_quan: using_quan }); | |
3269 | 3271 | if (th.data.is_b_now == 1) { |
3270 | 3272 | th.calculatePrice2(); |
3271 | 3273 | } else { |
3272 | 3274 | th.calculatePrice(); |
3273 | 3275 | } |
3274 | - th.setData({open_quan: 0}); | |
3276 | + th.setData({ open_quan: 0 }); | |
3275 | 3277 | return; |
3276 | 3278 | } |
3277 | 3279 | } |
... | ... | @@ -3290,16 +3292,16 @@ Page({ |
3290 | 3292 | }; |
3291 | 3293 | using_quan[pickid].isby = 1; |
3292 | 3294 | } else { |
3293 | - using_quan[pickid] = {coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0}; | |
3295 | + using_quan[pickid] = { coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 }; | |
3294 | 3296 | using_quan[pickid].isby = 0; |
3295 | 3297 | } |
3296 | - this.setData({using_quan: using_quan}); | |
3298 | + this.setData({ using_quan: using_quan }); | |
3297 | 3299 | if (th.data.is_b_now == 1) { |
3298 | 3300 | th.calculatePrice2(); |
3299 | 3301 | } else { |
3300 | 3302 | th.calculatePrice(); |
3301 | 3303 | } |
3302 | - th.setData({open_quan: 0}); | |
3304 | + th.setData({ open_quan: 0 }); | |
3303 | 3305 | }, |
3304 | 3306 | |
3305 | 3307 | cart_set_err: function (e) { |
... | ... | @@ -3336,7 +3338,7 @@ Page({ |
3336 | 3338 | var wu_arr_txt = e.currentTarget.dataset.txt; |
3337 | 3339 | var w_sele_index = e.currentTarget.dataset.w_sele_index; |
3338 | 3340 | var is_express = null; |
3339 | - var ob = {open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1}; | |
3341 | + var ob = { open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1 }; | |
3340 | 3342 | |
3341 | 3343 | //--如果是多个门店的时候-- |
3342 | 3344 | if (w_sele_index != undefined) { |
... | ... | @@ -3347,20 +3349,20 @@ Page({ |
3347 | 3349 | }, |
3348 | 3350 | // 关闭物流的弹窗 |
3349 | 3351 | close_express: function () { |
3350 | - this.setData({open_express: 0, disabled: 0}); | |
3352 | + this.setData({ open_express: 0, disabled: 0 }); | |
3351 | 3353 | }, |
3352 | 3354 | // 选择物流 |
3353 | 3355 | click_express_name: function (e) { |
3354 | 3356 | var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode; |
3355 | 3357 | var index = e.currentTarget.dataset.idxe; |
3356 | - var ob = {is_express: index, is_shipping_code: shippingcode, disabled: 0}; | |
3358 | + var ob = { is_express: index, is_shipping_code: shippingcode, disabled: 0 }; | |
3357 | 3359 | ob[this.data.wu_arr_txt] = index; |
3358 | 3360 | this.setData(ob); |
3359 | 3361 | }, |
3360 | 3362 | |
3361 | 3363 | //点击确定物流 |
3362 | 3364 | determine_expres: function (e) { |
3363 | - this.setData({open_express: 0}); | |
3365 | + this.setData({ open_express: 0 }); | |
3364 | 3366 | if (this.data.is_b_now == 1) |
3365 | 3367 | this.calculatePrice2(); |
3366 | 3368 | else |
... | ... | @@ -3380,7 +3382,7 @@ Page({ |
3380 | 3382 | obj[txt] = is_open; |
3381 | 3383 | |
3382 | 3384 | this.setData(obj); |
3383 | - this.setData({disabled: 1}) | |
3385 | + this.setData({ disabled: 1 }) | |
3384 | 3386 | }, |
3385 | 3387 | |
3386 | 3388 | clik_coupons2: function (e) { |
... | ... | @@ -3395,7 +3397,7 @@ Page({ |
3395 | 3397 | obj[txt] = is_open; |
3396 | 3398 | |
3397 | 3399 | this.setData(obj); |
3398 | - this.setData({disabled: 1}) | |
3400 | + this.setData({ disabled: 1 }) | |
3399 | 3401 | }, |
3400 | 3402 | |
3401 | 3403 | |
... | ... | @@ -3404,11 +3406,11 @@ Page({ |
3404 | 3406 | var th = this; |
3405 | 3407 | var is_shipping_code = this.data.is_shipping_code |
3406 | 3408 | getApp().request.put("/api/weshop/users/update", { |
3407 | - data: {user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code}, | |
3409 | + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code }, | |
3408 | 3410 | success: function (rse) { |
3409 | 3411 | if (rse.data.code == 0) { |
3410 | 3412 | getApp().globalData.userInfo.def_exp_code = is_shipping_code; |
3411 | - th.setData({open_express: 0}); | |
3413 | + th.setData({ open_express: 0 }); | |
3412 | 3414 | //----计算此时购物车的价格---- |
3413 | 3415 | if (th.data.is_b_now == 1) th.calculatePrice2(); |
3414 | 3416 | else th.calculatePrice(); |
... | ... | @@ -3418,7 +3420,7 @@ Page({ |
3418 | 3420 | }, |
3419 | 3421 | |
3420 | 3422 | //更新下默认,在onshow里面 |
3421 | - update_code(){ | |
3423 | + update_code() { | |
3422 | 3424 | var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; |
3423 | 3425 | //--定时器,判断wu_arr不未空-- |
3424 | 3426 | var uii = setInterval(function () { |
... | ... | @@ -3432,7 +3434,7 @@ Page({ |
3432 | 3434 | } |
3433 | 3435 | //--如果是立即购买-- |
3434 | 3436 | if (th.data.is_b_now == 1) { |
3435 | - th.setData({index: m_wind, is_express: m_wind}); | |
3437 | + th.setData({ index: m_wind, is_express: m_wind }); | |
3436 | 3438 | } else { |
3437 | 3439 | var ui = setInterval(function () { |
3438 | 3440 | if (th.data.cartlist) { |
... | ... | @@ -3440,7 +3442,7 @@ Page({ |
3440 | 3442 | for (var i in c_arr) { |
3441 | 3443 | c_arr[i].wind = m_wind; |
3442 | 3444 | } |
3443 | - th.setData({cartlist: c_arr, is_express: m_wind}) | |
3445 | + th.setData({ cartlist: c_arr, is_express: m_wind }) | |
3444 | 3446 | clearInterval(ui); |
3445 | 3447 | } |
3446 | 3448 | }, 500) |
... | ... | @@ -3479,13 +3481,13 @@ Page({ |
3479 | 3481 | } |
3480 | 3482 | |
3481 | 3483 | //--如果是团购,要判断有没有限制使用优惠券 |
3482 | - if(gd.prom_type == 2){ | |
3483 | - var prom1=null; | |
3484 | + if (gd.prom_type == 2) { | |
3485 | + var prom1 = null; | |
3484 | 3486 | await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gd.goods_id + "/" + gd.prom_id, { |
3485 | 3487 | }).then(res => { |
3486 | 3488 | if (res.data.code == 0) prom1 = res.data.data; |
3487 | 3489 | }) |
3488 | - if(!prom1.isQuan){ | |
3490 | + if (!prom1.isQuan) { | |
3489 | 3491 | continue; |
3490 | 3492 | } |
3491 | 3493 | } |
... | ... | @@ -3555,10 +3557,10 @@ Page({ |
3555 | 3557 | if (th.data.is_b_now) { |
3556 | 3558 | if (arr && arr.length > 0) { |
3557 | 3559 | var quanlist = arr[0].quan_list; |
3558 | - th.setData({selected_quan_list: quanlist, cartlist: arr}) | |
3560 | + th.setData({ selected_quan_list: quanlist, cartlist: arr }) | |
3559 | 3561 | } |
3560 | 3562 | } else { |
3561 | - th.setData({cartlist: arr}) | |
3563 | + th.setData({ cartlist: arr }) | |
3562 | 3564 | th.set_can_num(); |
3563 | 3565 | } |
3564 | 3566 | |
... | ... | @@ -3578,7 +3580,7 @@ Page({ |
3578 | 3580 | if (th.data.is_close_quan != 1 && th.data.bn_goods.is_xz_yh != 1) { |
3579 | 3581 | var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; |
3580 | 3582 | var url = "/api/weshop/couponList/getUseCouponList"; |
3581 | - app.request.promiseGet(url0, {1: 1}).then(res => { | |
3583 | + app.request.promiseGet(url0, { 1: 1 }).then(res => { | |
3582 | 3584 | if (res.data.code == 0) { |
3583 | 3585 | frozenQuan = res.data.data; |
3584 | 3586 | th.data.frozenQuan = frozenQuan; |
... | ... | @@ -3596,7 +3598,7 @@ Page({ |
3596 | 3598 | quanlist = res.data.data.pageData; |
3597 | 3599 | if (quanlist) { |
3598 | 3600 | quanlist = th.check_is_frozenQuan(quanlist, frozenQuan); |
3599 | - th.setData({selected_quan_list: quanlist}) | |
3601 | + th.setData({ selected_quan_list: quanlist }) | |
3600 | 3602 | } |
3601 | 3603 | } |
3602 | 3604 | } |
... | ... | @@ -3624,7 +3626,7 @@ Page({ |
3624 | 3626 | if (!goods_id) goods_id = this.data.bn_goods.goods_id; |
3625 | 3627 | for (var i in arr) { |
3626 | 3628 | var item = arr[i]; |
3627 | - if (goods_id == item) return 0; | |
3629 | + if (goods_id == item) return 0; | |
3628 | 3630 | } |
3629 | 3631 | return 1; |
3630 | 3632 | }, |
... | ... | @@ -3695,7 +3697,7 @@ Page({ |
3695 | 3697 | if (this.data.is_b_now == 1) pick = this.data.bn_pick; |
3696 | 3698 | //---获取订单优惠--- |
3697 | 3699 | getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { |
3698 | - data: {store_id: os.stoid, orderAmount: condition} | |
3700 | + data: { store_id: os.stoid, orderAmount: condition } | |
3699 | 3701 | }).then(res => { |
3700 | 3702 | if (res.data.code == 0) { |
3701 | 3703 | var data = res.data.data; |
... | ... | @@ -3717,7 +3719,7 @@ Page({ |
3717 | 3719 | var ob = map[pickid][item.prom_id]; |
3718 | 3720 | ob.price += item.goods_price * item.goods_num; |
3719 | 3721 | ob.goods_num += item.goods_num; |
3720 | - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); | |
3722 | + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num }); | |
3721 | 3723 | |
3722 | 3724 | } else { |
3723 | 3725 | var prom = null; |
... | ... | @@ -3733,7 +3735,7 @@ Page({ |
3733 | 3735 | ob.is_bz = prom.is_bz; |
3734 | 3736 | ob.is_xz_yh = prom.is_xz_yh; |
3735 | 3737 | ob.goods = new Array(); |
3736 | - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); | |
3738 | + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num }); | |
3737 | 3739 | map[pickid][item.prom_id] = ob; |
3738 | 3740 | } |
3739 | 3741 | } else { |
... | ... | @@ -3750,7 +3752,7 @@ Page({ |
3750 | 3752 | ob.is_bz = prom.is_bz; |
3751 | 3753 | ob.is_xz_yh = prom.is_xz_yh; |
3752 | 3754 | ob.goods = new Array(); |
3753 | - ob.goods.push({goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num}); | |
3755 | + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num }); | |
3754 | 3756 | |
3755 | 3757 | var obj = {}; |
3756 | 3758 | obj[item.prom_id] = ob; |
... | ... | @@ -3760,7 +3762,7 @@ Page({ |
3760 | 3762 | }, |
3761 | 3763 | |
3762 | 3764 | //计算立即购买赠品的物流费用 |
3763 | - 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) { | |
3765 | + 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) { | |
3764 | 3766 | var good = this.data.buy_now_gift_goods; |
3765 | 3767 | var goods_weight = -1, goods_piece = -1; |
3766 | 3768 | var gift_shipping_price = 0; |
... | ... | @@ -3776,8 +3778,9 @@ Page({ |
3776 | 3778 | //累积商品重量 每种商品的重量 * 数量 |
3777 | 3779 | goods_weight += good['weight'] * good['buynum']; |
3778 | 3780 | if (goods_weight1 > 0) { |
3781 | + out_of_weight = gift_weight_free - goods_weight; | |
3782 | + //不能调换位置 下面goods_weight会变大 | |
3779 | 3783 | goods_weight += goods_weight1; |
3780 | - out_of_weight = (gift_weight_free*1000) - goods_weight; | |
3781 | 3784 | } |
3782 | 3785 | break; |
3783 | 3786 | case 3: |
... | ... | @@ -3795,7 +3798,7 @@ Page({ |
3795 | 3798 | if (no_by_data && no_by_data.region_list) { |
3796 | 3799 | if (th.check_by_area(no_by_data.region_list)) { |
3797 | 3800 | gift_freight_free = 0; |
3798 | - out_of_weight=0; | |
3801 | + out_of_weight = 0; | |
3799 | 3802 | th.data.is_no_by[th.data.bn_pick] = 1; |
3800 | 3803 | } |
3801 | 3804 | } |
... | ... | @@ -3803,14 +3806,15 @@ Page({ |
3803 | 3806 | if (no_by_data && no_by_data.goods_list && gift_freight_free) { |
3804 | 3807 | if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) { |
3805 | 3808 | gift_freight_free = 0; |
3806 | - out_of_weight=0; | |
3809 | + out_of_weight = 0; | |
3810 | + th.data.is_no_by[th.data.bn_pick] = 1; | |
3807 | 3811 | //th.data.is_no_by[th.data.bn_pick]=1; |
3808 | 3812 | } |
3809 | 3813 | } |
3810 | 3814 | |
3811 | 3815 | var t_shipping_price = |
3812 | - this.calculatewuliu(code, gift_shipping_price, goods_weight,out_of_weight, | |
3813 | - goods_piece, user_addr, gift_freight_free, allpice, rs); | |
3816 | + this.calculatewuliu(code, gift_shipping_price, goods_weight, out_of_weight, | |
3817 | + goods_piece, user_addr, gift_freight_free, allpice, rs, th.data.bn_pick); | |
3814 | 3818 | return t_shipping_price; |
3815 | 3819 | |
3816 | 3820 | }, |
... | ... | @@ -3867,7 +3871,7 @@ Page({ |
3867 | 3871 | |
3868 | 3872 | //跳转关闭弹出框的显示 |
3869 | 3873 | close_offline: function () { |
3870 | - this.setData({is_offline_show: 0}); | |
3874 | + this.setData({ is_offline_show: 0 }); | |
3871 | 3875 | }, |
3872 | 3876 | |
3873 | 3877 | //立即购买显示弹出框 |
... | ... | @@ -3875,7 +3879,7 @@ Page({ |
3875 | 3879 | var off_price = this.data.bn_goods.shop_price - this.data.bn_goods.offline_price; |
3876 | 3880 | //是不是线下 |
3877 | 3881 | var is_get_offline = this.data.bn_goods.is_offline; |
3878 | - this.setData({is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline}); | |
3882 | + this.setData({ is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline }); | |
3879 | 3883 | }, |
3880 | 3884 | |
3881 | 3885 | //确定使用线下取价 |
... | ... | @@ -3883,14 +3887,14 @@ Page({ |
3883 | 3887 | var bn_goods = this.data.bn_goods; |
3884 | 3888 | if (bn_goods && bn_goods.prom_type == 0) { |
3885 | 3889 | bn_goods.is_offline = 1; |
3886 | - this.setData({is_offline_show: 0, bn_goods: bn_goods}); | |
3890 | + this.setData({ is_offline_show: 0, bn_goods: bn_goods }); | |
3887 | 3891 | this.calculatePrice2(); |
3888 | 3892 | } |
3889 | 3893 | //就是购物车结算时的 |
3890 | 3894 | else { |
3891 | 3895 | var index = this.data.pop_offline_index; |
3892 | 3896 | var txt = "cartlist[" + index + "].is_offline"; |
3893 | - this.setData({[txt]: 1, is_offline_show: 0,}); | |
3897 | + this.setData({ [txt]: 1, is_offline_show: 0, }); | |
3894 | 3898 | this.data.old_cartlist[index].is_offline = 1; |
3895 | 3899 | this.calculatePrice(); |
3896 | 3900 | } |
... | ... | @@ -3902,14 +3906,14 @@ Page({ |
3902 | 3906 | var bn_goods = this.data.bn_goods; |
3903 | 3907 | if (bn_goods && bn_goods.prom_type == 0) { |
3904 | 3908 | bn_goods.is_offline = 0; |
3905 | - this.setData({is_offline_show: 0, bn_goods: bn_goods}); | |
3909 | + this.setData({ is_offline_show: 0, bn_goods: bn_goods }); | |
3906 | 3910 | this.calculatePrice2(); |
3907 | 3911 | } |
3908 | 3912 | //就是购物车结算时的 |
3909 | 3913 | else { |
3910 | 3914 | var index = this.data.pop_offline_index; |
3911 | 3915 | var txt = "cartlist[" + index + "].is_offline"; |
3912 | - this.setData({[txt]: 0, is_offline_show: 0,}) | |
3916 | + this.setData({ [txt]: 0, is_offline_show: 0, }) | |
3913 | 3917 | this.data.old_cartlist[index].is_offline = 0; |
3914 | 3918 | this.calculatePrice(); |
3915 | 3919 | } |
... | ... | @@ -3930,19 +3934,19 @@ Page({ |
3930 | 3934 | }); |
3931 | 3935 | }, |
3932 | 3936 | |
3933 | - set_hid_inp:function (e) { | |
3937 | + set_hid_inp: function (e) { | |
3934 | 3938 | var index = e.currentTarget.dataset.index; |
3935 | 3939 | var txt = "cartlist[" + index + "].focus"; |
3936 | - this.setData({[txt]:1}) | |
3940 | + this.setData({ [txt]: 1 }) | |
3937 | 3941 | }, |
3938 | 3942 | |
3939 | - clear_hid_inp:function (e) { | |
3943 | + clear_hid_inp: function (e) { | |
3940 | 3944 | var index = e.currentTarget.dataset.index; |
3941 | 3945 | var txt = "cartlist[" + index + "].focus"; |
3942 | - this.setData({[txt]:0}) | |
3946 | + this.setData({ [txt]: 0 }) | |
3943 | 3947 | }, |
3944 | 3948 | |
3945 | - go_url:function (e) { | |
3949 | + go_url: function (e) { | |
3946 | 3950 | var url = e.currentTarget.dataset.url; |
3947 | 3951 | getApp().goto(url); |
3948 | 3952 | } | ... | ... |
pages/cart/cart2/cart2.js
... | ... | @@ -1647,8 +1647,8 @@ Page({ |
1647 | 1647 | is_good_no_by = th.check_by_goods(no_ex_good, item[j].goods_id); |
1648 | 1648 | } |
1649 | 1649 | |
1650 | - //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮 | |
1651 | - if (o_price - quan_price >= freight_free && freight_free > 0 && !is_good_no_by && th.data.is_no_by[pickid] != 1) { | |
1650 | + //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮 并且没有超出重量 | |
1651 | + 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 ) { | |
1652 | 1652 | continue; |
1653 | 1653 | } |
1654 | 1654 | |
... | ... | @@ -1670,15 +1670,14 @@ Page({ |
1670 | 1670 | //统一运费 |
1671 | 1671 | o_shipping_price += item[j]['uniform_exp_sum']; |
1672 | 1672 | break; |
1673 | - case 2: | |
1674 | - +'' | |
1675 | - if (goods_weight < 0) goods_weight = 0; | |
1676 | - //累积商品重量 每种商品的重量 * 数量 | |
1677 | - goods_weight += item[j]['weight'] * item[j]['goods_num']; | |
1678 | - if (weight_free > 0) { | |
1679 | - out_of_weight = (weight_free * 1000) - goods_weight; | |
1680 | - } | |
1681 | - break; | |
1673 | + // case 2: | |
1674 | + // if (goods_weight < 0) goods_weight = 0; | |
1675 | + // //累积商品重量 每种商品的重量 * 数量 | |
1676 | + // goods_weight += item[j]['weight'] * item[j]['goods_num']; | |
1677 | + // if (weight_free > 0) { | |
1678 | + // out_of_weight = (weight_free * 1000) - goods_weight; | |
1679 | + // } | |
1680 | + // break; | |
1682 | 1681 | case 3: |
1683 | 1682 | if (goods_piece < 0) goods_piece = 0; |
1684 | 1683 | //累积商品数量 |
... | ... | @@ -1686,6 +1685,11 @@ Page({ |
1686 | 1685 | break; |
1687 | 1686 | } |
1688 | 1687 | } |
1688 | + }else{ | |
1689 | + if(item[j]['exp_sum_type']==2 && out_of_weight!==0){ | |
1690 | + goods_weight = -1; | |
1691 | + out_of_weight = 0; | |
1692 | + } | |
1689 | 1693 | } |
1690 | 1694 | } |
1691 | 1695 | ... | ... |