Commit 1c1f26043a63cd6713106239f836eb7e5c86cffc
合并OA fu5
Showing
40 changed files
with
2350 additions
and
2049 deletions
components/diy_seckill/diy_seckill.wxml
... | ... | @@ -106,7 +106,7 @@ |
106 | 106 | </view> |
107 | 107 | |
108 | 108 | <view class="o1_right"> |
109 | - <view class="sp_wzi ellipsis-2">{{aitem.title}}</view> | |
109 | + <view class="sp_wzi ellipsis-2">{{aitem.goods_name}}</view> | |
110 | 110 | <view class="o1_sj_kill"> |
111 | 111 | <text>{{aitem.djs.day}}</text> 天 |
112 | 112 | <text>{{aitem.djs.hou}}</text> : | ... | ... |
packageA/pages/distribution/shop/shop.js
... | ... | @@ -87,14 +87,14 @@ Page({ |
87 | 87 | |
88 | 88 | } |
89 | 89 | |
90 | - if (options?.brand_id) { | |
90 | + if (options && options.brand_id) { | |
91 | 91 | this.setData({ |
92 | 92 | brand_id: options.brand_id, |
93 | 93 | is_router:true |
94 | 94 | }) |
95 | 95 | // this.getData(true, '/api/weshop/users/distribut/pagemyshop', this.data.currentQuery); |
96 | 96 | } |
97 | - if (options?.nation_id) { | |
97 | + if (options && options.nation_id) { | |
98 | 98 | this.setData({ |
99 | 99 | nation_id: options.nation_id, |
100 | 100 | is_router:true |
... | ... | @@ -465,7 +465,7 @@ Page({ |
465 | 465 | clickSort(e) { |
466 | 466 | let data = this.data.currentQuery; |
467 | 467 | // data.orderField = 'shop_price'; |
468 | - data.orderField = 'prom_price'; | |
468 | + data.orderField = 'final_price'; | |
469 | 469 | if (data.page) { |
470 | 470 | delete data.page; |
471 | 471 | }; |
... | ... | @@ -533,9 +533,10 @@ Page({ |
533 | 533 | delete data.page; |
534 | 534 | }; |
535 | 535 | if (currentIndex == 0) { |
536 | - if (data.orderField) {// 清除orderField | |
537 | - delete data.orderField; | |
538 | - }; | |
536 | + // if (data.orderField) {// 清除orderField | |
537 | + // delete data.orderField; | |
538 | + // }; | |
539 | + data.orderField = 'shop_price'; | |
539 | 540 | }; |
540 | 541 | if (currentIndex == 1) { |
541 | 542 | data.orderField = 'sales_sum'; |
... | ... | @@ -546,11 +547,14 @@ Page({ |
546 | 547 | |
547 | 548 | if (currentIndex == 3) { |
548 | 549 | // console.log('点击价格'); |
549 | - if (data.orderType) {// 清除orderType | |
550 | - delete data.orderType; | |
551 | - }; | |
550 | + // if (data.orderType) {// 清除orderType | |
551 | + // delete data.orderType; | |
552 | + // }; | |
553 | + data.orderType = 'desc'; | |
552 | 554 | return; |
553 | 555 | }; |
556 | + | |
557 | + | |
554 | 558 | data.orderType = 'desc'; |
555 | 559 | this.data.currentQuery = data; |
556 | 560 | delete data.brand_id; | ... | ... |
packageA/pages/distribution/shop/shop.wxml
... | ... | @@ -51,12 +51,13 @@ |
51 | 51 | <view class="pdl20 c-a" bindtap="search">搜索</view> |
52 | 52 | </view> |
53 | 53 | </view> |
54 | - <view class="flex t-c fs26 bg-white bdb sticky c-a" catchtap="clickTab"> | |
54 | + | |
55 | + <view class="flex t-c fs26 bg-white bdb sticky c-a" bindtap="clickTab"> | |
55 | 56 | <block wx:for="{{tabArr}}"> |
56 | 57 | <view class="f1 pd20 {{currentTabIndex == index ? 'active':''}}" data-index="{{index}}" wx:if="{{index != 3}}"> |
57 | 58 | {{item}} |
58 | 59 | </view> |
59 | - <view class="f1 pd20 {{currentTabIndex == index ? 'active':''}}" data-index="{{index}}" wx:else bindtap="clickSort"> | |
60 | + <view class="f1 pd20 {{currentTabIndex == index ? 'active':''}}" data-index="{{index}}" wx:else catchtap="clickSort"> | |
60 | 61 | {{item}} |
61 | 62 | <text class="iconfont icon-sort2 c-db" wx:if="{{!isSort}}"></text> |
62 | 63 | <text class="t-icon t-icon-sort-up {{isDescending ? 'reverse':''}}" wx:else></text> | ... | ... |
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
... | ... | @@ -934,6 +934,11 @@ Page({ |
934 | 934 | } |
935 | 935 | }) |
936 | 936 | if (!is_next) return false |
937 | + | |
938 | + th.data.lon=lon; | |
939 | + th.data.lat=lat; | |
940 | + th.data.bn_gd_w=gd_w; | |
941 | + th.data.bn_samecity_order_amount=req_data.order_amount; | |
937 | 942 | } |
938 | 943 | |
939 | 944 | //-- 如果是订单优惠的时候,allpice要拿来减掉一些 -- |
... | ... | @@ -1226,6 +1231,13 @@ Page({ |
1226 | 1231 | 'order_goods': new Array(), |
1227 | 1232 | }; |
1228 | 1233 | |
1234 | + if(item.exp_type==2){ | |
1235 | + item.lon=th.data.lon?th.data.lon:0; | |
1236 | + item.lat=th.data.lat?th.data.lat:0; | |
1237 | + item.goods_weight=t_item.gd_w; | |
1238 | + item.samecity_order_amount=t_item.samecity_order_amount; | |
1239 | + } | |
1240 | + | |
1229 | 1241 | //--判断有没有优惠活动-- |
1230 | 1242 | if (th.data.formData.order_prom_amount > 0) { |
1231 | 1243 | var order_prom_list = {}; | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... | ... | @@ -5288,20 +5288,20 @@ Page({ |
5288 | 5288 | //---自定义海报 产品质量保证 |
5289 | 5289 | if(th.data.share_b_img && th.data.poster.show_quality==1 ){ |
5290 | 5290 | var g_path = "../../../../images/share/s_gou.png"; |
5291 | - context.drawImage(g_path, 56 * unit, 650 * unit, 22 * unit, 22 * unit); | |
5291 | + context.drawImage(g_path, 56 * unit, 658 * unit, 22 * unit, 22 * unit); | |
5292 | 5292 | context.setFillStyle("red") |
5293 | 5293 | context.setFontSize(18 * unit) |
5294 | - context.fillText("正品保证", 84 * unit, 670 * unit); | |
5294 | + context.fillText("正品保证", 84 * unit, 678 * unit); | |
5295 | 5295 | |
5296 | - context.drawImage(g_path, 218 * unit, 650 * unit, 22 * unit, 22 * unit); | |
5296 | + context.drawImage(g_path, 218 * unit, 658 * unit, 22 * unit, 22 * unit); | |
5297 | 5297 | context.setFillStyle("red") |
5298 | 5298 | context.setFontSize(18 * unit) |
5299 | - context.fillText("纯实体店", 246 * unit, 670 * unit); | |
5299 | + context.fillText("纯实体店", 246 * unit, 678 * unit); | |
5300 | 5300 | |
5301 | - context.drawImage(g_path, 388 * unit, 650 * unit, 22 * unit, 22 * unit); | |
5301 | + context.drawImage(g_path, 388 * unit, 658 * unit, 22 * unit, 22 * unit); | |
5302 | 5302 | context.setFillStyle("red") |
5303 | 5303 | context.setFontSize(18 * unit) |
5304 | - context.fillText("官方验证", 420 * unit, 670 * unit); | |
5304 | + context.fillText("官方验证", 420 * unit, 678 * unit); | |
5305 | 5305 | |
5306 | 5306 | } |
5307 | 5307 | |
... | ... | @@ -5312,10 +5312,10 @@ Page({ |
5312 | 5312 | |
5313 | 5313 | |
5314 | 5314 | //---画线--- |
5315 | - context.setLineWidth(1 * unit) | |
5316 | - context.moveTo(32 * unit, 680 * unit) | |
5317 | - context.lineTo(520 * unit, 680 * unit) | |
5318 | - context.stroke(); | |
5315 | + // context.setLineWidth(1 * unit) | |
5316 | + // context.moveTo(32 * unit, 680 * unit) | |
5317 | + // context.lineTo(520 * unit, 680 * unit) | |
5318 | + // context.stroke(); | |
5319 | 5319 | |
5320 | 5320 | //---文字--- |
5321 | 5321 | context.setFillStyle("black") |
... | ... | @@ -5431,7 +5431,7 @@ Page({ |
5431 | 5431 | }; |
5432 | 5432 | |
5433 | 5433 | |
5434 | - if(th.data.poster.show_time==1){ | |
5434 | + if(th.data.poster && th.data.poster.show_time==1){ | |
5435 | 5435 | var act_time = ''; |
5436 | 5436 | act_time="截止时间:"+ ut.formatTime(th.data.luckGoInfo.end_time); |
5437 | 5437 | context.setFillStyle("red") | ... | ... |
packageC/pages/luckyGo/luckyGo_order/luckyGo_order.js
... | ... | @@ -1105,12 +1105,17 @@ Page({ |
1105 | 1105 | |
1106 | 1106 | click_contact:function () { |
1107 | 1107 | getApp().globalData.no_clear=1; |
1108 | + }, | |
1109 | + | |
1110 | + //-- 查看物流 -- | |
1111 | + go_wuliu:function (e) { | |
1112 | + getApp().go_wuliu(e); | |
1108 | 1113 | } |
1109 | - | |
1110 | - | |
1111 | - | |
1112 | - | |
1113 | - | |
1114 | + | |
1115 | + | |
1116 | + | |
1117 | + | |
1118 | + | |
1114 | 1119 | |
1115 | 1120 | |
1116 | 1121 | ... | ... |
packageC/pages/luckyGo/luckyGo_order/luckyGo_order.wxml
... | ... | @@ -185,7 +185,9 @@ |
185 | 185 | |
186 | 186 | <view class="tips-btn" wx:if="{{order.order_status==3}}" bindtap="deleteOrderData" data-order_id="{{order.order_id}}" >删除订单</view> |
187 | 187 | |
188 | - <navigator class="tips-btn" hidden="{{!order.shipping_btn}}" url="/pages/user/express/express?order_id={{order.order_id}}">查看物流</navigator> | |
188 | + <navigator bindtap="go_wuliu" class="tips-btn" hidden="{{!order.shipping_btn}}" | |
189 | + data-order_id="{{order.order_id}}" | |
190 | + data-url="/pages/user/express/express?order_id={{order.order_id}}">查看物流</navigator> | |
189 | 191 | |
190 | 192 | <!---has_rt部分退----> |
191 | 193 | <!-- <block wx:if="{{order.return_btn==undefined && order.is_all_return!=1 && order.has_rt!=1}}"> | ... | ... |
packageC/pages/presell/cart/cart.js
... | ... | @@ -117,7 +117,9 @@ Page({ |
117 | 117 | order_id: '', |
118 | 118 | exp_price:0, |
119 | 119 | order_prom_amount:0, |
120 | - paying:0 | |
120 | + paying:0, | |
121 | + | |
122 | + same_ok:1 | |
121 | 123 | }, |
122 | 124 | onLoad: function (t) { |
123 | 125 | |
... | ... | @@ -516,7 +518,7 @@ Page({ |
516 | 518 | //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- |
517 | 519 | if(goods.is_same_city && th.data.is_same_city && goods.whsle_id<=0){ |
518 | 520 | |
519 | - getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+order.pickup_id, {}).then(res=>{ | |
521 | + await getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+order.pickup_id, {}).then(res=>{ | |
520 | 522 | if(res.data.code==0){ |
521 | 523 | var pk=res.data.data; |
522 | 524 | if(pk && pk.is_same_city){ |
... | ... | @@ -659,6 +661,11 @@ Page({ |
659 | 661 | break; //物流 |
660 | 662 | } |
661 | 663 | |
664 | + | |
665 | + if(th.data.show_same_city==1 && th.data.sys_switch.pickupway && th.data.sys_switch.pickupway == 2 ){ | |
666 | + exp_type = 2; | |
667 | + } | |
668 | + | |
662 | 669 | if (th.data.exp_type) { |
663 | 670 | exp_type=th.data.exp_type |
664 | 671 | } |
... | ... | @@ -703,7 +710,7 @@ Page({ |
703 | 710 | async calculatePrice2() { |
704 | 711 | var th = this; |
705 | 712 | if (!this.data.pre_arr) return false; |
706 | - th.setData({ show_submit: 0,disabled_btn:0}) | |
713 | + th.setData({ show_submit: 0,disabled_btn:0 }) | |
707 | 714 | |
708 | 715 | //--计算物流-- |
709 | 716 | if (this.data.exp_type == 0) { |
... | ... | @@ -2112,7 +2119,6 @@ Page({ |
2112 | 2119 | if (ord_prom) { |
2113 | 2120 | //th.check_is_order_prom(o_condition,async function (ord_price) { |
2114 | 2121 | var ord_price=o_condition; |
2115 | - | |
2116 | 2122 | var order_prom_amount = 0; |
2117 | 2123 | var order_prom_id = 0; |
2118 | 2124 | var order_m = 0; |
... | ... | @@ -2194,6 +2200,10 @@ Page({ |
2194 | 2200 | return false |
2195 | 2201 | } |
2196 | 2202 | exp_price = parseFloat(shipping_price).toFixed(2); |
2203 | + th.data.lon=lon; | |
2204 | + th.data.lat=lat; | |
2205 | + th.data.bn_gd_w=gd_w; | |
2206 | + th.data.bn_samecity_order_amount=req_data.order_amount; | |
2197 | 2207 | } |
2198 | 2208 | |
2199 | 2209 | ord_price = parseFloat(ord_price) - parseFloat(th.data.presell.presell_deposit); |
... | ... | @@ -2272,10 +2282,15 @@ Page({ |
2272 | 2282 | } |
2273 | 2283 | }) |
2274 | 2284 | if (!is_next) { |
2275 | - th.setData({show_submit: 1, disabled_btn: 1}) | |
2285 | + | |
2286 | + th.setData({show_submit: 1, disabled_btn: 1,same_ok: 0}) | |
2276 | 2287 | return false |
2277 | 2288 | } |
2278 | 2289 | exp_price = parseFloat(shipping_price).toFixed(2); |
2290 | + th.data.lon=lon; | |
2291 | + th.data.lat=lat; | |
2292 | + th.data.bn_gd_w=gd_w; | |
2293 | + th.data.bn_samecity_order_amount=req_data.order_amount; | |
2279 | 2294 | } |
2280 | 2295 | |
2281 | 2296 | |
... | ... | @@ -2412,6 +2427,14 @@ Page({ |
2412 | 2427 | dd.addressid = th.data.user_addr.address_id; |
2413 | 2428 | } |
2414 | 2429 | |
2430 | + | |
2431 | + if(dd.exp_type==2){ | |
2432 | + dd.lon=th.data.lon?th.data.lon:0; | |
2433 | + dd.lat=th.data.lat?th.data.lat:0; | |
2434 | + dd.goods_weight=th.data.bn_gd_w; | |
2435 | + dd.samecity_order_amount=th.data.bn_samecity_order_amount; | |
2436 | + } | |
2437 | + | |
2415 | 2438 | if (th.data.order_prom_amount > 0) { |
2416 | 2439 | var e = { |
2417 | 2440 | order_prom_id: th.data.order_prom_id, |
... | ... | @@ -2454,6 +2477,13 @@ Page({ |
2454 | 2477 | |
2455 | 2478 | //---用微信支付--- |
2456 | 2479 | if (dd.tail_pay_type == 0) { |
2480 | + | |
2481 | + if(t.data.code!=0){ | |
2482 | + getApp().my_warnning(t.data.msg, 1, th); | |
2483 | + th.data.paying=0; | |
2484 | + return false; | |
2485 | + } | |
2486 | + | |
2457 | 2487 | util_pay.pay_data(t,function (){ |
2458 | 2488 | //---用余额支付--- |
2459 | 2489 | getApp().my_warnning("支付成功", 1, th); |
... | ... | @@ -2543,7 +2573,7 @@ Page({ |
2543 | 2573 | set_wuliu: function (e) { |
2544 | 2574 | var type = e.currentTarget.dataset.type; |
2545 | 2575 | this.setData({ |
2546 | - exp_type: type | |
2576 | + exp_type: type,same_ok:1 | |
2547 | 2577 | }); |
2548 | 2578 | this.calculatePrice2(); |
2549 | 2579 | }, |
... | ... | @@ -3025,8 +3055,12 @@ Page({ |
3025 | 3055 | var th = this; |
3026 | 3056 | th.setData({bn_use_commission: !th.data.bn_use_commission}); |
3027 | 3057 | th.calculatePrice2(); |
3028 | - } | |
3058 | + }, | |
3029 | 3059 | |
3060 | + //-- 查看物流 -- | |
3061 | + go_wuliu:function (e) { | |
3062 | + getApp().go_wuliu(e); | |
3063 | + } | |
3030 | 3064 | |
3031 | 3065 | |
3032 | 3066 | ... | ... |
packageC/pages/presell/cart/cart.wxml
... | ... | @@ -381,7 +381,7 @@ |
381 | 381 | </view> |
382 | 382 | </view> |
383 | 383 | <button wx:if="{{no_start || is_end || is_complete}}" class="tips-btn gray">支付尾款</button> |
384 | - <button wx:else class="tips-btn" bindtap="show_pay" hidden="{{!show_submit}}">支付尾款</button> | |
384 | + <button wx:else class="tips-btn" bindtap="show_pay" hidden="{{!show_submit || !same_ok}}">支付尾款</button> | |
385 | 385 | <!-- 预售 --> |
386 | 386 | <!-- <button class="tips-btn" formType="submit" id="submitOrder">立即支付</button> --> |
387 | 387 | </view> |
... | ... | @@ -396,7 +396,9 @@ |
396 | 396 | </block> |
397 | 397 | |
398 | 398 | <view class="tips-btn2" wx:if="{{order.order_status==3}}" bindtap="deleteOrderData" data-order_id="{{order.order_id}}" >删除订单</view> |
399 | - <navigator class="tips-btn2" hidden="{{!order.shipping_btn}}" url="/pages/user/express/express?order_id={{order.order_id}}">查看物流</navigator> | |
399 | + <navigator bindtap="go_wuliu" class="tips-btn2" hidden="{{!order.shipping_btn}}" | |
400 | + data-order_id="{{order.order_id}}" | |
401 | + data-url="/pages/user/express/express?order_id={{order.order_id}}">查看物流</navigator> | |
400 | 402 | |
401 | 403 | |
402 | 404 | <block wx:if="{{order.return_btn==undefined && order.is_all_return!=1}}"> | ... | ... |
packageC/pages/presell/cart/cart2.js
... | ... | @@ -129,6 +129,8 @@ Page({ |
129 | 129 | dis_config:null, |
130 | 130 | bn_use_commission:0, //是不是使用佣金 |
131 | 131 | |
132 | + same_ok:1 | |
133 | + | |
132 | 134 | }, |
133 | 135 | onLoad: function (t) { |
134 | 136 | wx.setNavigationBarTitle({ title: "填写订单", }) |
... | ... | @@ -232,6 +234,10 @@ Page({ |
232 | 234 | //先获取是否有关闭使用优惠券 |
233 | 235 | getApp().getConfig2(function (ee) { |
234 | 236 | var json_d = JSON.parse(ee.switch_list); |
237 | + | |
238 | + //测试强行写死,后面一定要删除 | |
239 | + //json_d.pickupway=2; | |
240 | + | |
235 | 241 | th.data.json_d = json_d; |
236 | 242 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 |
237 | 243 | var is_default_logistics = json_d.is_default_logistics; |
... | ... | @@ -407,7 +413,7 @@ Page({ |
407 | 413 | //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- |
408 | 414 | if(gd.is_same_city && th.data.is_same_city && gd.whsle_id<=0){ |
409 | 415 | |
410 | - getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+th.data.gg.pick_id, {}).then(res=>{ | |
416 | + await getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+th.data.gg.pick_id, {}).then(res=>{ | |
411 | 417 | if(res.data.code==0){ |
412 | 418 | var pk=res.data.data; |
413 | 419 | if(pk && pk.is_same_city){ |
... | ... | @@ -468,6 +474,10 @@ Page({ |
468 | 474 | break; |
469 | 475 | } |
470 | 476 | |
477 | + if(th.data.show_same_city==1 && th.data.json_d.pickupway && th.data.json_d.pickupway == 2 ){ | |
478 | + et = 2; | |
479 | + } | |
480 | + | |
471 | 481 | |
472 | 482 | var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; |
473 | 483 | if (et == 0 && def_exp_code && !th.data.is_default_logistics) { |
... | ... | @@ -993,7 +1003,16 @@ Page({ |
993 | 1003 | }) |
994 | 1004 | } |
995 | 1005 | }) |
996 | - if(!is_next) return false | |
1006 | + if(!is_next) { | |
1007 | + th.setData({show_submit:1, submit: 0,same_ok:0 }) | |
1008 | + return false | |
1009 | + } | |
1010 | + | |
1011 | + th.data.lon=lon; | |
1012 | + th.data.lat=lat; | |
1013 | + th.data.bn_gd_w=gd_w; | |
1014 | + th.data.bn_samecity_order_amount=req_data.order_amount; | |
1015 | + | |
997 | 1016 | } |
998 | 1017 | |
999 | 1018 | total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); |
... | ... | @@ -1141,6 +1160,13 @@ Page({ |
1141 | 1160 | item.use_commission=th.data.bn_goods.use_commission; |
1142 | 1161 | } |
1143 | 1162 | |
1163 | + if(item.exp_type==2){ | |
1164 | + item.lon=th.data.lon?th.data.lon:0; | |
1165 | + item.lat=th.data.lat?th.data.lat:0; | |
1166 | + item.goods_weight=th.data.bn_gd_w; | |
1167 | + item.samecity_order_amount=th.data.bn_samecity_order_amount; | |
1168 | + } | |
1169 | + | |
1144 | 1170 | //获取立即购买的商品的信息 |
1145 | 1171 | var gg = to.get_b_now(); |
1146 | 1172 | //--商品的房间号-- |
... | ... | @@ -1814,7 +1840,7 @@ Page({ |
1814 | 1840 | setexptype: function (t) { |
1815 | 1841 | var th = this; |
1816 | 1842 | var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; |
1817 | - th.setData({ bn_exp_type: ty }); | |
1843 | + th.setData({ bn_exp_type: ty,same_ok:1 }); | |
1818 | 1844 | if (ty == 0) { |
1819 | 1845 | th.setData({ is_all_zt: 0 }); |
1820 | 1846 | } | ... | ... |
packageC/pages/presell/goodsInfo/goodsInfo.js
... | ... | @@ -2986,7 +2986,7 @@ Page({ |
2986 | 2986 | } |
2987 | 2987 | |
2988 | 2988 | var share_title = th.data.presellForm.share_title; |
2989 | - share_title ? share_title : th.data.data.goods_name; | |
2989 | + share_title=share_title ? share_title : th.data.data.goods_name; | |
2990 | 2990 | |
2991 | 2991 | //---产品名称--- |
2992 | 2992 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 |
... | ... | @@ -3062,10 +3062,10 @@ Page({ |
3062 | 3062 | } |
3063 | 3063 | |
3064 | 3064 | //---画线--- |
3065 | - context.setLineWidth(1 * unit) | |
3066 | - context.moveTo(32 * unit, 662 * unit) | |
3067 | - context.lineTo(520 * unit, 662 * unit) | |
3068 | - context.stroke(); | |
3065 | + // context.setLineWidth(1 * unit) | |
3066 | + // context.moveTo(32 * unit, 662 * unit) | |
3067 | + // context.lineTo(520 * unit, 662 * unit) | |
3068 | + // context.stroke(); | |
3069 | 3069 | |
3070 | 3070 | //---文字--- |
3071 | 3071 | context.setFillStyle("black") | ... | ... |
packageD/pages/AI-test-skin/fail_result/fail_result.js
... | ... | @@ -28,19 +28,19 @@ Page({ |
28 | 28 | * 生命周期函数--监听页面加载 |
29 | 29 | */ |
30 | 30 | onLoad: function (options) { |
31 | - if(options?.fail_result){ | |
31 | + if(options && options.fail_result){ | |
32 | 32 | var fail_result = JSON.parse(options.fail_result); |
33 | 33 | this.setData({ |
34 | 34 | fail_result, |
35 | 35 | }) |
36 | 36 | } |
37 | - if(options?.msg){ | |
37 | + if(options && options.msg){ | |
38 | 38 | this.setData({ |
39 | 39 | msg:options.msg |
40 | 40 | }) |
41 | 41 | } |
42 | 42 | |
43 | - if(options.ce_user_id) this.data.ce_user_id=options.ce_user_id; | |
43 | + if(options && options.ce_user_id) this.data.ce_user_id=options.ce_user_id; | |
44 | 44 | |
45 | 45 | // msg=decodeURIComponent(msg); |
46 | 46 | // this.setData({msg:msg}); | ... | ... |
packageD/pages/shop/order_detail/order_detail.wxml
1 | 1 | <wxs module="filters" src="../../../../utils/filter.wxs"></wxs> |
2 | 2 | <view class="container"> |
3 | - <view class="user-mes" wx:if="{{order.exp_type==0}}"> | |
3 | + <view class="user-mes" wx:if="{{order.exp_type==0 || order.exp_type==2 }}"> | |
4 | 4 | <view class="user-contact"> |
5 | 5 | <text selectable> {{order.consignee}}{{' '}}{{order.mobile}} </text> |
6 | 6 | </view> | ... | ... |
packageD/pages/shop/order_detail/order_detail.wxss
packageE/pages/cart/cart2/cart2.js
... | ... | @@ -150,6 +150,8 @@ Page({ |
150 | 150 | coll_prom:{}, //搭配活动存储 |
151 | 151 | yh_is_xz_yh:{},//优惠促销优惠券使用开关 |
152 | 152 | |
153 | + same_ok:1, //同城配送的控制,默认ok | |
154 | + | |
153 | 155 | }, |
154 | 156 | onLoad: function (t) { |
155 | 157 | |
... | ... | @@ -267,6 +269,10 @@ Page({ |
267 | 269 | //先获取是否有关闭使用优惠券 |
268 | 270 | getApp().getConfig2(function (ee) { |
269 | 271 | var json_d = JSON.parse(ee.switch_list); |
272 | + | |
273 | + //测试强行写死,后面一定要删除 | |
274 | + //json_d.pickupway=2; | |
275 | + | |
270 | 276 | th.data.json_d = json_d; |
271 | 277 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 |
272 | 278 | var is_default_logistics = json_d.is_default_logistics; |
... | ... | @@ -1172,7 +1178,7 @@ Page({ |
1172 | 1178 | }); |
1173 | 1179 | |
1174 | 1180 | if (back_data && parseFloat(back_data)) { |
1175 | - c_item.can_usecommise = parseFloat(back_data); | |
1181 | + c_item.can_usecommise = parseFloat(parseFloat(back_data).toFixed(2)); | |
1176 | 1182 | cart_commission += c_item.can_usecommise; |
1177 | 1183 | } |
1178 | 1184 | |
... | ... | @@ -1229,7 +1235,12 @@ Page({ |
1229 | 1235 | return e.is_same_city != 1 || e.whsle_id > 0 |
1230 | 1236 | }) |
1231 | 1237 | if (!fd || fd.length == 0) { |
1232 | - arr[ik].show_same_city = 1; | |
1238 | + arr[ik].show_same_city = 1; | |
1239 | + if (th.data.json_d.pickupway && th.data.json_d.pickupway == 2) { | |
1240 | + arr[ik].exp_type=2; | |
1241 | + th.setData({ is_all_zt: 0 }); | |
1242 | + } | |
1243 | + | |
1233 | 1244 | } |
1234 | 1245 | } |
1235 | 1246 | } |
... | ... | @@ -1331,6 +1342,11 @@ Page({ |
1331 | 1342 | et = 0; |
1332 | 1343 | break; |
1333 | 1344 | } |
1345 | + | |
1346 | + if(th.data.show_same_city==1 && th.data.json_d.pickupway && th.data.json_d.pickupway == 2 ){ | |
1347 | + et = 2; | |
1348 | + } | |
1349 | + | |
1334 | 1350 | var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; |
1335 | 1351 | |
1336 | 1352 | if (et == 0 && def_exp_code && !th.data.is_default_logistics) { |
... | ... | @@ -2104,6 +2120,9 @@ Page({ |
2104 | 2120 | }) |
2105 | 2121 | //-- to.getwuliuprice(async function (rs) { -- |
2106 | 2122 | |
2123 | + th.data.lon=0; | |
2124 | + th.data.lat=0; | |
2125 | + | |
2107 | 2126 | //是不是区域包邮 |
2108 | 2127 | th.data.is_area_by = 0; |
2109 | 2128 | //当不是区域不包邮的时候,没有不包邮商品的时候 |
... | ... | @@ -2714,7 +2733,15 @@ Page({ |
2714 | 2733 | } |
2715 | 2734 | } |
2716 | 2735 | }) |
2717 | - if (!is_next) return false | |
2736 | + if (!is_next) { | |
2737 | + th.setData({show_submit:1, submit: 0,same_ok:0 }) | |
2738 | + return false | |
2739 | + } | |
2740 | + | |
2741 | + //重量要带出去 | |
2742 | + cart_item.gd_w=gd_w; | |
2743 | + cart_item.samecity_order_amount=req_data.order_amount; | |
2744 | + | |
2718 | 2745 | } |
2719 | 2746 | |
2720 | 2747 | //预存金额使用参与计算 |
... | ... | @@ -2938,6 +2965,10 @@ Page({ |
2938 | 2965 | [atxt11]: all_pre_json, |
2939 | 2966 | [atxt12]: all_yck_arr, |
2940 | 2967 | }) |
2968 | + | |
2969 | + th.data.lon=lon; | |
2970 | + th.data.lat=lat; | |
2971 | + | |
2941 | 2972 | th.data.order_prom_list_cart = c_arr; |
2942 | 2973 | th.set_can_num(); |
2943 | 2974 | wx.hideLoading(); |
... | ... | @@ -3006,6 +3037,13 @@ Page({ |
3006 | 3037 | var cut_price = 0; |
3007 | 3038 | var allpice1 = allpice; |
3008 | 3039 | |
3040 | + th.data.lon=0; | |
3041 | + th.data.lat=0; | |
3042 | + | |
3043 | + //如果有线下取价的时候 | |
3044 | + if (good.is_offline) { | |
3045 | + allpice = good.offline_price * good.buynum; | |
3046 | + } | |
3009 | 3047 | |
3010 | 3048 | if (good.prom_type == 3 && good.prom_price !== null) { |
3011 | 3049 | cut_price = allpice - good.prom_price; |
... | ... | @@ -3019,11 +3057,6 @@ Page({ |
3019 | 3057 | th.setData({ [c_txt]: cut_price, }); |
3020 | 3058 | } |
3021 | 3059 | |
3022 | - //如果有线下取价的时候 | |
3023 | - if (good.is_offline) { | |
3024 | - allpice = good.offline_price * good.buynum; | |
3025 | - } | |
3026 | - | |
3027 | 3060 | //to.getwuliuprice(async function (rs) { |
3028 | 3061 | |
3029 | 3062 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; |
... | ... | @@ -3493,7 +3526,14 @@ Page({ |
3493 | 3526 | |
3494 | 3527 | } |
3495 | 3528 | }) |
3496 | - if (!is_next) return false | |
3529 | + if (!is_next){ | |
3530 | + th.setData({show_submit:1,same_ok:0,submit: 0}) | |
3531 | + return false | |
3532 | + } | |
3533 | + th.data.lon=lon; | |
3534 | + th.data.lat=lat; | |
3535 | + th.data.bn_gd_w=gd_w; | |
3536 | + th.data.bn_samecity_order_amount=req_data.order_amount; | |
3497 | 3537 | } |
3498 | 3538 | |
3499 | 3539 | |
... | ... | @@ -3765,7 +3805,7 @@ Page({ |
3765 | 3805 | var ff = true; |
3766 | 3806 | //------------立即购买------------- |
3767 | 3807 | if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { |
3768 | - if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { | |
3808 | + if ( [0,2].indexOf(th.data.bn_exp_typ) == -1 && th.data.user_addr == null) { | |
3769 | 3809 | ff = false; |
3770 | 3810 | getApp().my_warnning("请选择收货地址", 0, th); |
3771 | 3811 | th.data.is_summit_ing = 0; |
... | ... | @@ -3816,6 +3856,13 @@ Page({ |
3816 | 3856 | item.use_commission = th.data.bn_goods.use_commission; |
3817 | 3857 | } |
3818 | 3858 | |
3859 | + if(item.exp_type==2){ | |
3860 | + item.lon=th.data.lon?th.data.lon:0; | |
3861 | + item.lat=th.data.lat?th.data.lat:0; | |
3862 | + item.goods_weight=th.data.bn_gd_w; | |
3863 | + item.samecity_order_amount=th.data.bn_samecity_order_amount; | |
3864 | + } | |
3865 | + | |
3819 | 3866 | //获取立即购买的商品的信息 |
3820 | 3867 | var gg = to.get_b_now(); |
3821 | 3868 | //--商品的房间号-- |
... | ... | @@ -3823,7 +3870,6 @@ Page({ |
3823 | 3870 | item.room_ids = gg.room_id; |
3824 | 3871 | } |
3825 | 3872 | //群id |
3826 | - | |
3827 | 3873 | if(gg.groupchat_id && gg.groupchat_id!='undefined'){ |
3828 | 3874 | item.groupchat_ids=gg.groupchat_id; |
3829 | 3875 | } |
... | ... | @@ -4117,6 +4163,13 @@ Page({ |
4117 | 4163 | item.use_commission = t_item.can_usecommise; |
4118 | 4164 | } |
4119 | 4165 | |
4166 | + if(item.exp_type==2){ | |
4167 | + item.lon=th.data.lon?th.data.lon:0; | |
4168 | + item.lat=th.data.lat?th.data.lat:0; | |
4169 | + item.goods_weight=t_item.gd_w; | |
4170 | + item.samecity_order_amount=t_item.samecity_order_amount; | |
4171 | + } | |
4172 | + | |
4120 | 4173 | var order_prom_list = {}; |
4121 | 4174 | //--判断有没有优惠活动-- |
4122 | 4175 | if (t_item.order_prom_amount > 0) { |
... | ... | @@ -6285,7 +6338,7 @@ Page({ |
6285 | 6338 | setexptype2: function (e) { |
6286 | 6339 | |
6287 | 6340 | if(this.data.submit) return false; |
6288 | - this.setData({ submit: 1 }); | |
6341 | + this.setData({ submit: 1,same_ok:1 }); | |
6289 | 6342 | |
6290 | 6343 | if(this.data.all_collocation_list){ |
6291 | 6344 | var bn_coll= this.selectComponent('#bn_coll'); |
... | ... | @@ -6304,7 +6357,7 @@ Page({ |
6304 | 6357 | setexptype_w2: function (e) { |
6305 | 6358 | |
6306 | 6359 | if(this.data.submit) return false; |
6307 | - this.setData({ submit: 1 }); | |
6360 | + this.setData({ submit: 1,same_ok:1 }); | |
6308 | 6361 | |
6309 | 6362 | for (let i = 0; i <this.data.cartlist.length ; i++) { |
6310 | 6363 | |
... | ... | @@ -6787,14 +6840,29 @@ Page({ |
6787 | 6840 | } |
6788 | 6841 | |
6789 | 6842 | }else{ |
6790 | - if(item.distr_type==1){ | |
6791 | - wx.showToast({ | |
6792 | - title: "商品的配送方式不一致", | |
6793 | - icon: 'none', | |
6794 | - duration: 2000 | |
6795 | - }) | |
6796 | - th.setData({ submit: 0 }); | |
6797 | - return false; | |
6843 | + | |
6844 | + if(this.data.bn_exp_type==2){ | |
6845 | + | |
6846 | + if(!item.is_same_city){ | |
6847 | + wx.showToast({ | |
6848 | + title: "商品不支持同城配送", | |
6849 | + icon: 'none', | |
6850 | + duration: 2000 | |
6851 | + }) | |
6852 | + th.setData({ submit: 0 }); | |
6853 | + return false; | |
6854 | + } | |
6855 | + | |
6856 | + }else{ | |
6857 | + if(item.distr_type==1){ | |
6858 | + wx.showToast({ | |
6859 | + title: "商品的配送方式不一致", | |
6860 | + icon: 'none', | |
6861 | + duration: 2000 | |
6862 | + }) | |
6863 | + th.setData({ submit: 0 }); | |
6864 | + return false; | |
6865 | + } | |
6798 | 6866 | } |
6799 | 6867 | } |
6800 | 6868 | |
... | ... | @@ -6892,7 +6960,12 @@ Page({ |
6892 | 6960 | //-- 如果是选中 -- |
6893 | 6961 | if (e.selected) { |
6894 | 6962 | |
6895 | - var exp_type=this.data.order_prom_list_cart[cart_index].exp_type; //配送方式 | |
6963 | + var m_cartlist=this.data.old_cartlist; | |
6964 | + if(this.data.order_prom_list_cart){ | |
6965 | + m_cartlist=this.data.order_prom_list_cart; | |
6966 | + } | |
6967 | + | |
6968 | + var exp_type=m_cartlist[cart_index].exp_type; //配送方式 | |
6896 | 6969 | //如果是自提的时候 |
6897 | 6970 | if(exp_type==1){ |
6898 | 6971 | |
... | ... | @@ -6906,13 +6979,29 @@ Page({ |
6906 | 6979 | } |
6907 | 6980 | |
6908 | 6981 | }else{ |
6909 | - if(item.distr_type==1){ | |
6910 | - wx.showToast({ | |
6911 | - title: "商品的配送方式不一致", | |
6912 | - icon: 'none', | |
6913 | - duration: 2000 | |
6914 | - }) | |
6915 | - return false; | |
6982 | + | |
6983 | + if(exp_type==2){ | |
6984 | + | |
6985 | + if(!item.is_same_city){ | |
6986 | + wx.showToast({ | |
6987 | + title: "商品不支持同城配送", | |
6988 | + icon: 'none', | |
6989 | + duration: 2000 | |
6990 | + }) | |
6991 | + th.setData({ submit: 0 }); | |
6992 | + return false; | |
6993 | + } | |
6994 | + | |
6995 | + }else { | |
6996 | + | |
6997 | + if (item.distr_type == 1) { | |
6998 | + wx.showToast({ | |
6999 | + title: "商品的配送方式不一致", | |
7000 | + icon: 'none', | |
7001 | + duration: 2000 | |
7002 | + }) | |
7003 | + return false; | |
7004 | + } | |
6916 | 7005 | } |
6917 | 7006 | } |
6918 | 7007 | |
... | ... | @@ -6969,14 +7058,22 @@ Page({ |
6969 | 7058 | |
6970 | 7059 | //-- 如果有一件代发的商品或者不是同城配送的配送 -- |
6971 | 7060 | if (narr[hi].is_same_city != 1 || narr[hi].whsle_id > 0) { |
6972 | - th.setData({ show_same_city: 0 }) | |
7061 | + //th.setData({ show_same_city: 0 }) | |
6973 | 7062 | } |
7063 | + | |
6974 | 7064 | } |
6975 | 7065 | //自选的时候,系统配置了默认的配送方式是物流的时候 |
6976 | 7066 | if (distr_t == 0 && th.data.json_d.pickupway && th.data.json_d.pickupway == 1) { |
6977 | 7067 | et = 0; th.setData({ is_all_zt: 0 }); |
6978 | 7068 | } |
6979 | 7069 | |
7070 | + //-- 如果是同城配送和默认同城配送的时候 -- | |
7071 | + if(th.data.show_same_city==1 && th.data.json_d.pickupway && th.data.json_d.pickupway == 2) { | |
7072 | + et = 2; th.setData({ is_all_zt: 0 }); | |
7073 | + } | |
7074 | + | |
7075 | + | |
7076 | + | |
6980 | 7077 | var m_wind = th.data.m_wind; |
6981 | 7078 | var ie = { |
6982 | 7079 | pickup_id: gg.pick_id, |
... | ... | @@ -7021,7 +7118,7 @@ Page({ |
7021 | 7118 | }); |
7022 | 7119 | |
7023 | 7120 | if (back_data && parseFloat(back_data)) { |
7024 | - ie.can_usecommise = parseFloat(back_data); | |
7121 | + ie.can_usecommise = parseFloat(parseFloat(back_data).toFixed(2)); | |
7025 | 7122 | cart_commission = ie.can_usecommise; |
7026 | 7123 | } |
7027 | 7124 | ... | ... |
packageE/pages/cart/cart2/cart2.wxml
... | ... | @@ -599,7 +599,8 @@ |
599 | 599 | <view class="payable">应付金额:<text class="co-red"><text class="fs24">¥</text>{{formData.order_amount}}</text></view> |
600 | 600 | <!-- <view class="co-red big"></view> --> |
601 | 601 | </view> |
602 | - <button class="tips-btn" formType="submit" id="submitOrder" disabled="{{submit}}" bindtap="requestSubscribe">提交订单</button> | |
602 | + <button class="tips-btn" formType="submit" id="submitOrder" | |
603 | + disabled="{{submit || !same_ok}}" bindtap="requestSubscribe">提交订单</button> | |
603 | 604 | </view> |
604 | 605 | </form> |
605 | 606 | ... | ... |
pages/cart/cart2_inte/c_filter.wxs renamed to packageE/pages/cart/cart2_inte/c_filter.wxs
packageE/pages/cart/cart2_inte/cart2_inte.js
0 → 100644
1 | +var t = getApp(), app = t, a = t.request, e = require("../../../../utils/common.js"), | |
2 | + s = require("../../../../utils/util.js"), ut = s, o = require("../../../../utils/md5.js"), to = getApp(); | |
3 | +var oo = t.globalData.setting, os = oo; | |
4 | +var regeneratorRuntime = require('../../../../utils/runtime.js'); | |
5 | +var util_pay = require("../../../../utils/pay.js"); | |
6 | + | |
7 | +Page({ | |
8 | + data: { | |
9 | + url: t.globalData.setting.url, | |
10 | + imgUrl: t.globalData.setting.imghost, | |
11 | + goods: null, | |
12 | + order: null, | |
13 | + orderPrices: null, | |
14 | + coupons: null, | |
15 | + coupon: null, | |
16 | + invoiceToggle: !0, | |
17 | + payWithUserMoney: !0, | |
18 | + payWithPoints: !0, | |
19 | + maxWord: 0, | |
20 | + enterAddressPage: !1, | |
21 | + firstEnter: !0, | |
22 | + //页面获取的参数 | |
23 | + param: null, | |
24 | + //提交订单的格式 | |
25 | + formData: { | |
26 | + order_amount: 0,//支付金额 | |
27 | + total_amount: 0,//总价 | |
28 | + all_price: 0,//商品卖的总价 | |
29 | + pay_points: 0,//使用积分 | |
30 | + user_money: 0,//使用余额 | |
31 | + couponCode: "",//使用优惠券(多单就用逗号隔开) | |
32 | + shipping_price: 0,//物流费用 | |
33 | + }, | |
34 | + inv_is_post:0,//积分购是否包邮 | |
35 | + | |
36 | + /*----------------立即购买---------------------*/ | |
37 | + is_b_now: 1, //0是购物车结算 1立即购买 | |
38 | + bn_goods: null, //立即购买时候的调用商品 | |
39 | + bn_use_money: 0,//是否使用余额 | |
40 | + bn_exp_type: 1, //0是物流 1自提 | |
41 | + bn_pick: 0, //选择的门店 | |
42 | + bn_pickname: "", //选择的门店名称 | |
43 | + bn_t_exp_t: 0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流 | |
44 | + | |
45 | + bn_is_order_yh: 1, //是不是订单优惠 | |
46 | + bn_is_post_temp: 1, //是不是进行计算包邮模板 | |
47 | + | |
48 | + bn_plus_cut_price: 0, //显示等级卡会优惠多少钱 | |
49 | + /*------------------------*/ | |
50 | + user_addr: null,//物流 | |
51 | + userinfo: null, //获取会员 | |
52 | + /*----------物流选择--------*/ | |
53 | + wu_arr: null, | |
54 | + index: 0, | |
55 | + w_sele_index: 0, | |
56 | + | |
57 | + //判断页面是返回回来的还是 首次进入的 | |
58 | + isclose: 1, | |
59 | + //申请提现的金额 | |
60 | + txmon: 0, | |
61 | + yuer: 0, | |
62 | + //提交中,不重复提交 | |
63 | + is_summit_ing: 0, | |
64 | + | |
65 | + disabled: 0, | |
66 | + open_express: 0,//控制选择物流名列表 的属性 | |
67 | + | |
68 | + is_express: 0, //选中物流的属性 | |
69 | + expres_name: "", //点击选定 | |
70 | + is_shipping_code: "",//插入用户默认地址 | |
71 | + wu_arr_txt: "", //要更新的物流的字段 | |
72 | + | |
73 | + //如果是全场包邮了,或者是全场不包邮了,就不要选包邮券 | |
74 | + is_no_by: {}, | |
75 | + is_by: {}, | |
76 | + is_quan_by: {}, | |
77 | + //--购买赠送的商品-- | |
78 | + buy_now_gift_goods: null, | |
79 | + //--订单优惠-- | |
80 | + order_prom: {}, | |
81 | + show_submit: 0, //提交按钮变正常显示 | |
82 | + udata: null,//用户预存值,数据 | |
83 | + is_pre_cut:0, //是否可以使用预存 0是不可以1的可以 | |
84 | + | |
85 | + same_ok:1, //同城配送的控制,默认ok | |
86 | + }, | |
87 | + onLoad: function (t) { | |
88 | + wx.setNavigationBarTitle({ title: "填写订单", }) | |
89 | + var th = this; | |
90 | + th.data.param = t; | |
91 | + //清空is_pick_up | |
92 | + getApp().request.put("/api/weshop/useraddress/updatePickUp", { | |
93 | + data: { user_id: getApp().globalData.user_id, is_pickup: 0 }, | |
94 | + success: function (s) { | |
95 | + } | |
96 | + }); | |
97 | + | |
98 | + //先获取是否有关闭使用优惠券 | |
99 | + getApp().getConfig2(function (ee) { | |
100 | + var json_d = JSON.parse(ee.switch_list); | |
101 | + | |
102 | + //测试强行写死,后面一定要删除 | |
103 | + //json_d.pickupway=2; | |
104 | + | |
105 | + th.data.json_d = json_d; | |
106 | + th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 | |
107 | + var is_default_logistics = json_d.is_default_logistics; | |
108 | + var is_same_city = json_d.is_same_city; | |
109 | + th.setData({is_pre_cut:json_d.is_pre_cut, is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, | |
110 | + rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics,is_same_city:is_same_city }); | |
111 | + | |
112 | + var rank_switch = json_d.rank_switch; | |
113 | + var max_price = -1; | |
114 | + var show_card = null; | |
115 | + var name = ""; | |
116 | + //如果有开等级卡的时候, | |
117 | + //因为都是调接口,要返回在计算 | |
118 | + if (rank_switch == 2) { | |
119 | + //-- 获取所有的等级卡, -- | |
120 | + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid, | |
121 | + {}).then(res => { | |
122 | + if (res.data.code == 0) { | |
123 | + var plusCard = res.data.data; | |
124 | + //-- 循环判断,拿到最贵的那张卡 -- | |
125 | + for (var ih in plusCard) { | |
126 | + if (plusCard[ih].IsStopBuy == true) { continue; } | |
127 | + if (max_price < 0) { | |
128 | + max_price = plusCard[ih].CardFee; | |
129 | + name = 'card' + plusCard[ih]['CorrPrice']; | |
130 | + show_card = plusCard[ih]; | |
131 | + } else { | |
132 | + if (max_price < plusCard[ih].CardFee) { | |
133 | + max_price = plusCard[ih].CardFee; | |
134 | + name = 'card' + plusCard[ih]['CorrPrice']; | |
135 | + show_card = plusCard[ih]; | |
136 | + } | |
137 | + } | |
138 | + } | |
139 | + | |
140 | + if (show_card) { | |
141 | + name = name.toLowerCase(); | |
142 | + th.setData({ card_name: name, show_card: show_card }) | |
143 | + } | |
144 | + } | |
145 | + //-----先获取物流,再获取用户信息,再展示页面----- | |
146 | + th.get_wuliu(th.get_info(th.show_page)); | |
147 | + }) | |
148 | + } else { | |
149 | + //-----先获取物流,再获取用户信息,再展示页面----- | |
150 | + th.get_wuliu(th.get_info(th.show_page)); | |
151 | + } | |
152 | + }, 1); | |
153 | + | |
154 | + | |
155 | + //判断是不是佣金抵扣 | |
156 | + getApp().is_distribut(this); | |
157 | + | |
158 | + | |
159 | + }, | |
160 | + onUnload: function () { this.setData({ isclose: 1 }) }, | |
161 | + onHide: function () { | |
162 | + this.setData({ | |
163 | + is_no_by: {}, | |
164 | + is_by: {} | |
165 | + }) | |
166 | + }, | |
167 | + | |
168 | + //----------子页返回父页触发---------- | |
169 | + onShow: function () { | |
170 | + | |
171 | + var fy=ut.fy_back('',1,function (){ | |
172 | + var cps = getCurrentPages(); | |
173 | + if (cps.length > 1) { | |
174 | + wx.navigateBack({ delta: 1 }) | |
175 | + } else { | |
176 | + getApp().goto("/pages/index/index/index"); | |
177 | + } | |
178 | + }); | |
179 | + | |
180 | + if(fy) return false; | |
181 | + | |
182 | + util_pay.set_fir(); | |
183 | + | |
184 | + var th = this; | |
185 | + th.data.g_cart_q_time = null; | |
186 | + | |
187 | + if (th.data.isclose == 0) { | |
188 | + wx.navigateTo({ | |
189 | + url: "/pages/index/index/index" | |
190 | + }) | |
191 | + | |
192 | + } else { | |
193 | + this.getuser_addr(function (ie) { | |
194 | + | |
195 | + //th.data.prom_goods_map={}; | |
196 | + //更换地址回来要重新调用计算价钱的接口 | |
197 | + if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) { | |
198 | + th.setData({ user_addr: ie }); | |
199 | + if (th.data.is_b_now == 1) { | |
200 | + if (th.data.bn_goods) { | |
201 | + th.setData({ add_back: 1 }); | |
202 | + th.calculatePrice2(); | |
203 | + } | |
204 | + } | |
205 | + } else { | |
206 | + th.setData({ user_addr: ie }); | |
207 | + } | |
208 | + var going = 0; | |
209 | + | |
210 | + }); | |
211 | + //--更新默认地址--,看一下是不是跳到地址页面 | |
212 | + if (!getApp().globalData.is_cart_old) { | |
213 | + this.update_code(); | |
214 | + } else { | |
215 | + getApp().globalData.is_cart_old = 0; | |
216 | + } | |
217 | + } | |
218 | + | |
219 | + }, | |
220 | + //获取预存款余额 | |
221 | + async getAdvancesum() { | |
222 | + /*-----获取线下会员的预存款和优惠券的数量-----*/ | |
223 | + let url = "/api/weshop/users/getinfo/" + os.stoid + "/" + getApp().globalData.userInfo.user_id | |
224 | + await getApp().request.promiseGet(url, { | |
225 | + data: { | |
226 | + isShowLoading: 0, | |
227 | + }, | |
228 | + }).then(su => { | |
229 | + if (su.data.code == 0 && su.data.data) { | |
230 | + var data = su.data.data; | |
231 | + if (!data) data = {}; | |
232 | + data.cashcount = parseInt(data.cashcount); | |
233 | + this.setData({ | |
234 | + udata: data, | |
235 | + }); | |
236 | + } | |
237 | + }) | |
238 | + | |
239 | + }, | |
240 | + //购物车预存开启关闭 | |
241 | + prestore(e) { | |
242 | + let ind = e.currentTarget.dataset.ind; | |
243 | + let item = e.currentTarget.dataset.item | |
244 | + let txt = 'cartlist[' + ind + '].yck_off'; | |
245 | + let txt1 = 'old_cartlist[' + ind + '].yck_off'; | |
246 | + if (item.yck_off == 2) { | |
247 | + this.setData({ [txt]: 1, [txt1]: 1 }) | |
248 | + } else if (item.yck_off == 1) { | |
249 | + this.setData({ [txt]: 2, [txt1]: 2 }) | |
250 | + } | |
251 | + this.calculatePrice()//计算金额 | |
252 | + }, | |
253 | + //直接购买预存开启关闭 | |
254 | + prestore2() { | |
255 | + let txt = 'bn_goods.yck_off'; | |
256 | + if (this.data.bn_goods.yck_off == 2) { | |
257 | + this.setData({ [txt]: 1 }) | |
258 | + } else if (this.data.bn_goods.yck_off == 1) { | |
259 | + this.setData({ [txt]: 2 }) | |
260 | + } | |
261 | + this.calculatePrice2()//计算金额 | |
262 | + }, | |
263 | + //计算商品预存款前置方法------------------------------------ | |
264 | + async beforAdvancesum(cartList) { | |
265 | + // let cartList= this.data.cartlist | |
266 | + // let cartList= arr | |
267 | + // let length = cartList.length | |
268 | + if(!this.data.is_pre_cut){ | |
269 | + return {} | |
270 | + } | |
271 | + wx.showLoading({ | |
272 | + title: '加载中', | |
273 | + mask: true | |
274 | + }) | |
275 | + // for (let i = 0; i < length; i++) { | |
276 | + let item = cartList; | |
277 | + let goods = item.goods | |
278 | + let keyid = item.sto.keyid | |
279 | + let listform = [] | |
280 | + goods.map(ite => { | |
281 | + let obj = { | |
282 | + wareno: ite.goods_sn, | |
283 | + price: ite.goods_price, | |
284 | + qty: ite.goods_num | |
285 | + } | |
286 | + listform.push(obj) | |
287 | + }) | |
288 | + let arr = await this.getGoodsAdvancesum(keyid, listform, cartList) | |
289 | + // } | |
290 | + wx.hideLoading() | |
291 | + return arr | |
292 | + }, | |
293 | + //计算商品预存款请求方法------------------------------------ | |
294 | + async getGoodsAdvancesum(storageid, listform, cartList) { | |
295 | + if(!getApp().globalData.config){ | |
296 | + await getApp().request.promiseGet("/api/weshop/store/get/" + os.stoid,{ | |
297 | + }).then(res=>{ | |
298 | + if(res.data.code==0){ | |
299 | + getApp().globalData.config = res.data.data | |
300 | + } | |
301 | + }) | |
302 | + } | |
303 | + if(!getApp().globalData.config) return false; | |
304 | + | |
305 | + let res = await getApp().request.promisePost(`/api/weshop/delphiapi/saveErpApi`, { | |
306 | + data: { | |
307 | + accdb: getApp().globalData.config.erpid, | |
308 | + ApiName: 'api.pos.shop.advancesum.seek', | |
309 | + usercode: "admin", | |
310 | + vipid: this.data.userinfo.erpvipid, | |
311 | + oddsum: "0", | |
312 | + advancesum: cartList.order_amount, | |
313 | + storageid: storageid, | |
314 | + listform | |
315 | + }, | |
316 | + is_json: 1 | |
317 | + }) | |
318 | + console.log('计算商品的预存款'); | |
319 | + console.log(res); | |
320 | + let yck = 0 | |
321 | + let yckid = "" | |
322 | + let yckIdArr = [] | |
323 | + let pre_json = null | |
324 | + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | |
325 | + let resData = res.data.data | |
326 | + resData.map(ite => { | |
327 | + yck += ite.advancesum*1 | |
328 | + yckIdArr.push(ite.advanceitemid) | |
329 | + }) | |
330 | + pre_json = resData | |
331 | + } | |
332 | + yckid = yckIdArr.join() | |
333 | + let obj = {} | |
334 | + if (yck * 1 > 0) { | |
335 | + obj.yck_off = 1 | |
336 | + } else { | |
337 | + obj.yck_off = 0 | |
338 | + } | |
339 | + obj.yck = yck.toFixed(2) | |
340 | + obj.yckid = yckid | |
341 | + obj.pre_json = pre_json | |
342 | + return obj | |
343 | + }, | |
344 | + //-------------------获取物流--------------- | |
345 | + get_wuliu(func) { | |
346 | + var th = this; | |
347 | + to.getwuliu(function (e) { | |
348 | + if (th.data.is_default_logistics) { | |
349 | + //如果第一个不是开启默认,说明要让用户自己选 | |
350 | + if (!e[0].is_default) { | |
351 | + th.setData({ is_default_logistics: 0 }); | |
352 | + } | |
353 | + } | |
354 | + th.setData({ wu_arr: e }) | |
355 | + typeof func == "function" && func(); | |
356 | + }) | |
357 | + }, | |
358 | + //------获取会员信息-----先获取用户信息,在进行下一步--- | |
359 | + get_info: function (func) { | |
360 | + var user_id = t.globalData.user_id; | |
361 | + to.auth.get_u(func); | |
362 | + }, | |
363 | + | |
364 | + //------获取会员收货地址----- | |
365 | + getuser_addr: function (func) { | |
366 | + var th = this; | |
367 | + a.get("/api/weshop/useraddress/page", { | |
368 | + data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random() }, | |
369 | + success: function (su) { | |
370 | + | |
371 | + var item = null; | |
372 | + if (su.data.code == 0 && su.data.data && su.data.data.pageData) { | |
373 | + var user_addr = su.data.data.pageData; | |
374 | + var def_item = null; | |
375 | + for (var i = 0; i < user_addr.length; i++) { | |
376 | + if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; } | |
377 | + if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; } | |
378 | + } | |
379 | + | |
380 | + if (item == null) item = def_item; | |
381 | + if (item == null) item = user_addr[0]; | |
382 | + } | |
383 | + | |
384 | + if (item == undefined) item = null; | |
385 | + if (!item) th.setData({ user_addr: null }); //地址为空的时候,要清空,因为返回的时候,有缓存 | |
386 | + func(item); | |
387 | + } | |
388 | + }); | |
389 | + }, | |
390 | + | |
391 | + //----------------展示页面,是再获取用户信息之后-------------- | |
392 | + show_page:async function () { | |
393 | + var th = this, ta = this.data.param; | |
394 | + //th.setData({ userinfo: getApp().globalData.userInfo,}); | |
395 | + //获取用户预存款 | |
396 | + await th.getAdvancesum() | |
397 | + | |
398 | + var user = getApp().globalData.userInfo; | |
399 | + getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, { | |
400 | + data: { r: Math.random() }, | |
401 | + success: function (e) { | |
402 | + | |
403 | + getApp().globalData.userInfo = e.data.data; | |
404 | + th.setData({ userinfo: e.data.data }); | |
405 | + | |
406 | + //选获取地址 | |
407 | + th.getuser_addr(function (addr) { | |
408 | + th.setData({ user_addr: addr }); | |
409 | + //--------------------------立即购买------------------ | |
410 | + if (ta.is_bnow == 1) { | |
411 | + //读取门店 | |
412 | + to.get_allsto(function (e) { | |
413 | + th.setData({ allsto: e }); | |
414 | + //获取立即购买的商品信息 | |
415 | + th.get_buy_goods(ta.goods_id); | |
416 | + }); | |
417 | + } | |
418 | + }); | |
419 | + //获取提现金额 | |
420 | + getApp().request.get("/api/weshop/withdrawals/summoney", { | |
421 | + data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 }, | |
422 | + success: function (su) { | |
423 | + if (su.data.code == 0) { | |
424 | + var yuer = parseFloat(th.data.userinfo.user_money - | |
425 | + (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2); | |
426 | + th.setData({ txmon: su.data.data.summoney, yuer: yuer }); | |
427 | + } | |
428 | + } | |
429 | + }); | |
430 | + | |
431 | + }, | |
432 | + }) | |
433 | + | |
434 | + | |
435 | + }, | |
436 | + | |
437 | + //-----获取立即购买的商品信息,入口---- | |
438 | + get_buy_goods: function (e) { | |
439 | + var th = this; | |
440 | + var gg = to.get_b_now(); | |
441 | + //--------如果goods_id一样,就是要立即购买----- | |
442 | + if (e == gg.goods_id) { | |
443 | + a.get("/api/weshop/goods/get/" + oo.stoid + "/" + e, { | |
444 | + success: async function (t) { | |
445 | + var gd = t.data.data; | |
446 | + if (!gd) return false; | |
447 | + | |
448 | + //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- | |
449 | + if(gd.is_same_city && th.data.is_same_city && gd.whsle_id<=0){ | |
450 | + | |
451 | + await getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+gg.pick_id, {}).then(res=>{ | |
452 | + if(res.data.code==0){ | |
453 | + var pk=res.data.data; | |
454 | + if(pk && pk.is_same_city){ | |
455 | + th.setData({show_same_city:1}) | |
456 | + } | |
457 | + } | |
458 | + | |
459 | + }) | |
460 | + | |
461 | + } | |
462 | + | |
463 | + | |
464 | + t.data.data.original_img = oo.imghost + t.data.data.original_img; | |
465 | + t.data.data['buynum'] = gg.goods_num; | |
466 | + var distr_t = 0, et = 0 | |
467 | + | |
468 | + if(t.data.data.is_minishop==1 && getApp().is_sp_hao()){ | |
469 | + | |
470 | + if(t.data.data.distr_type==1 || gg.pick_dis==1) { | |
471 | + wx.showToast({ | |
472 | + title: "视频号仅支持物流", | |
473 | + icon: 'none', | |
474 | + duration: 2000 | |
475 | + }) | |
476 | + | |
477 | + setTimeout(function(){ | |
478 | + wx.navigateBack({delta: 1}) | |
479 | + },1000) | |
480 | + | |
481 | + | |
482 | + return false | |
483 | + } | |
484 | + | |
485 | + t.data.data.distr_type=2; | |
486 | + th.setData({show_same_city:0}) | |
487 | + | |
488 | + } | |
489 | + | |
490 | + if (t.data.data.distr_type == 0) { | |
491 | + distr_t = gg.pick_dis; | |
492 | + } else { | |
493 | + distr_t = t.data.data.distr_type; | |
494 | + } | |
495 | + switch (distr_t) { | |
496 | + case 0: | |
497 | + et = 1; | |
498 | + //-- 系统后台有设置要默认的 -- | |
499 | + if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) et = 0; | |
500 | + break; | |
501 | + case 1: et = 1; break; | |
502 | + case 2: et = 0; break; | |
503 | + } | |
504 | + | |
505 | + if(th.data.show_same_city==1 && th.data.json_d.pickupway && th.data.json_d.pickupway == 2 ){ | |
506 | + et = 2; | |
507 | + } | |
508 | + | |
509 | + | |
510 | + if (th.data.bn_goods) et = th.data.bn_exp_type | |
511 | + | |
512 | + var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; | |
513 | + if (et == 0 && def_exp_code && !th.data.is_default_logistics) { | |
514 | + for (var k = 0; k < th.data.wu_arr.length; k++) { | |
515 | + var item = th.data.wu_arr[k]; if (def_exp_code == item.code) { m_wind = k; } | |
516 | + } | |
517 | + } | |
518 | + | |
519 | + //---是不是购买等级卡成功的返回---等级卡显示的判断--- | |
520 | + var is_card_back = getApp().globalData.is_card_back; | |
521 | + if (is_card_back) { | |
522 | + th.data.card_name = th.data.userinfo.card_field; | |
523 | + gg.goods_price = gd[th.data.card_name]; | |
524 | + getApp().globalData.is_card_back = 0; | |
525 | + th.setData({ card_cut_price: 0 }); | |
526 | + //如果是秒杀的返回 | |
527 | + if (gd.prom_type == 4) gd.prom_type = 0; | |
528 | + } else { | |
529 | + //--- 商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格 | |
530 | + //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 -- | |
531 | + 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) { | |
532 | + var cut_p = (gg.goods_price - gd[th.data.card_name]) * gg.goods_num; | |
533 | + th.setData({ card_cut_price: cut_p }); | |
534 | + } | |
535 | + } | |
536 | + | |
537 | + | |
538 | + if(gg.prom_type==4){ | |
539 | + gd.prom_type =4; | |
540 | + gd.prom_id = gg.prom_id; | |
541 | + } | |
542 | + | |
543 | + switch (gd.prom_type) { | |
544 | + case 0: | |
545 | + case 2: | |
546 | + case 3: | |
547 | + case 5: | |
548 | + case 6: | |
549 | + getApp().my_warnning("商品不是积分活动", 0, th); | |
550 | + wx.navigateBack(); | |
551 | + break; | |
552 | + case 4: //-- 积分购 -- | |
553 | + getApp().request.get("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1&timetype=2", { | |
554 | + data: { store_id: os.stoid, goods_id: gg.goods_id, user_id: to.globalData.user_id, }, | |
555 | + success: async function (tt) { | |
556 | + if (tt.data.code == 0 && tt.data.data && tt.data.data.pageData) { | |
557 | + var inte_data = tt.data.data.pageData[0]; | |
558 | + t.data.data.shop_price = inte_data.addmoney; | |
559 | + t.data.data.integral = inte_data.integral; | |
560 | + | |
561 | + //-- 计算获得佣金的金额 -- | |
562 | + if (getApp().globalData.userInfo.is_distribut | |
563 | + && th.data.dis_config && th.data.dis_config.is_yongjin_dk) { | |
564 | + var c_num = getApp().get_commission2(th.data.dis_config,inte_data, gg.goods_num); | |
565 | + t.data.data.use_commission = c_num; | |
566 | + | |
567 | + } | |
568 | + | |
569 | + | |
570 | + if (inte_data.is_order_yh) { | |
571 | + th.data.bn_is_order_yh = 1; | |
572 | + } else { | |
573 | + th.data.bn_is_order_yh = 0; | |
574 | + } | |
575 | + | |
576 | + if (inte_data.is_post_temp) { | |
577 | + th.data.bn_is_post_temp = 1; | |
578 | + } else { | |
579 | + th.data.bn_is_post_temp = 0; | |
580 | + } | |
581 | + | |
582 | + | |
583 | + | |
584 | + th.setData({ | |
585 | + bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et, index: m_wind, | |
586 | + bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et,inv_is_post:inte_data.is_post | |
587 | + }); | |
588 | + //计算价格 | |
589 | + th.calculatePrice2(); | |
590 | + } else { | |
591 | + getApp().my_warnning("商品不是积分活动", 0, th); | |
592 | + wx.navigateBack(); | |
593 | + } | |
594 | + } | |
595 | + }); | |
596 | + break; | |
597 | + } | |
598 | + }, | |
599 | + }); | |
600 | + } | |
601 | + }, | |
602 | + | |
603 | + //---------------检查是否有收货地址------------------- | |
604 | + checkAddressList: function () { | |
605 | + var t = this; | |
606 | + return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ | |
607 | + title: "请先填写或选择收货地址~", | |
608 | + success: function (a) { | |
609 | + a.confirm ? t.enterAddressPage() : wx.navigateBack(); | |
610 | + }, | |
611 | + fail: function () { | |
612 | + wx.navigateBack(); | |
613 | + } | |
614 | + }), !1); | |
615 | + }, | |
616 | + showInvoice: function () { | |
617 | + this.setData({ | |
618 | + invoiceToggle: !this.data.invoiceToggle | |
619 | + }); | |
620 | + }, | |
621 | + keyUpChangePay1: function (t) { | |
622 | + this.setData({ | |
623 | + payWithUserMoney: !(t.detail.value.length > 0) | |
624 | + }); | |
625 | + }, | |
626 | + keyUpChangePay2: function (t) { | |
627 | + this.setData({ | |
628 | + payWithPoints: !(t.detail.value.length > 0) | |
629 | + }); | |
630 | + }, | |
631 | + keyUpChangeNum: function (t) { | |
632 | + this.setData({ | |
633 | + maxWord: t.detail.value.length | |
634 | + }); | |
635 | + }, | |
636 | + | |
637 | + | |
638 | + //---------计算立即购买---------- | |
639 | + //---------计算立即购买---------- | |
640 | + calculatePrice2:async function () { | |
641 | + var th = this, good = this.data.bn_goods; | |
642 | + | |
643 | + this.setData({submit:1}) | |
644 | + wx.showLoading({ title: "处理中.", mask:true }) | |
645 | + //-----------计算商品总价-------------- | |
646 | + var allpice = good.shop_price * good.buynum; | |
647 | + var all_integral = good.integral * good.buynum; | |
648 | + | |
649 | + var cut_price = 0; | |
650 | + if (good.prom_type == 3 && good.prom_price !== null) { | |
651 | + cut_price = allpice - good.prom_price; | |
652 | + } | |
653 | + allpice = parseFloat(allpice).toFixed(2); | |
654 | + | |
655 | + var txt = "formData.all_price"; | |
656 | + th.setData({ [txt]: allpice, }); | |
657 | + if (cut_price) { | |
658 | + var c_txt = "formData.cut_price"; | |
659 | + th.setData({ [c_txt]: cut_price, }); | |
660 | + } | |
661 | + | |
662 | + | |
663 | + //-- 把订单优惠的判断提前,bn_is_order_yh是确定要不要订单优惠的控制 -- | |
664 | + var condition = parseFloat(allpice-cut_price).toFixed(2); | |
665 | + var ord_prom = null; | |
666 | + var is_ord_prom_post = 0; | |
667 | + | |
668 | + if (condition > 0 && th.data.bn_is_order_yh && !th.data.bn_goods.whsle_id) { | |
669 | + await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { | |
670 | + data: { store_id: os.stoid, orderAmount: condition, user_id: getApp().globalData.user_id } | |
671 | + }).then(res => { | |
672 | + if (res.data.code == 0) { | |
673 | + var data = res.data.data; | |
674 | + ord_prom = data; | |
675 | + } | |
676 | + }) | |
677 | + if (ord_prom && ord_prom.is_post_temp) { | |
678 | + is_ord_prom_post = 1; | |
679 | + } | |
680 | + } | |
681 | + | |
682 | + | |
683 | + | |
684 | + //to.getwuliuprice(async function (rs) { | |
685 | + | |
686 | + var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | |
687 | + var out_of_weight = null; //超出多少重量 | |
688 | + | |
689 | + //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- | |
690 | + if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past != 1 && !th.data.inv_is_post) { | |
691 | + | |
692 | + var user_addr=th.data.user_addr; | |
693 | + var req_d = { | |
694 | + province: user_addr.province, city: user_addr.city, district: user_addr.district, | |
695 | + wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid | |
696 | + } | |
697 | + var back_data = null; | |
698 | + //判断是不是包邮模板,bn_is_post_temp 和 订单优惠的包邮模板一起控制 | |
699 | + if (th.data.bn_is_post_temp && (!ord_prom || is_ord_prom_post)) { | |
700 | + await getApp().request.promisePost("/api/weshop/order/areaFreight", { | |
701 | + is_json: 1, data: req_d | |
702 | + }).then(rs => { | |
703 | + if (rs.data.code == 0) back_data = rs.data.data; | |
704 | + }); | |
705 | + } | |
706 | + | |
707 | + var gd_arr_list = []; | |
708 | + gd_arr_list.push(good); | |
709 | + var cut_good_weight = 0; | |
710 | + for (let i in gd_arr_list) { | |
711 | + let item = gd_arr_list[i]; | |
712 | + | |
713 | + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1) ) { | |
714 | + | |
715 | + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) { | |
716 | + if (goods_weight < 0) goods_weight = 0; | |
717 | + goods_weight += item['weight'] * item['buynum']; | |
718 | + cut_good_weight += item['weight'] * item['buynum']; | |
719 | + } | |
720 | + if (back_data.weight_free > 0) { | |
721 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | |
722 | + } | |
723 | + continue; | |
724 | + } | |
725 | + | |
726 | + switch (item['exp_sum_type']) { | |
727 | + case 1: | |
728 | + //统一运费 | |
729 | + o_shipping_price += item['uniform_exp_sum']; | |
730 | + break; | |
731 | + case 2: | |
732 | + if (goods_weight < 0) goods_weight = 0; | |
733 | + //累积商品重量 每种商品的重量 * 数量 | |
734 | + goods_weight += item['weight'] * item['buynum']; | |
735 | + | |
736 | + if (back_data && back_data.is_by_all && !back_data.no_free_goods) { | |
737 | + cut_good_weight += item['weight'] * item['buynum']; | |
738 | + if (back_data.weight_free > 0) { | |
739 | + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | |
740 | + } | |
741 | + } | |
742 | + break; | |
743 | + case 3: | |
744 | + if (goods_piece < 0) goods_piece = 0; | |
745 | + //累积商品数量 | |
746 | + goods_piece += item['buynum']; | |
747 | + break; | |
748 | + } | |
749 | + } | |
750 | + | |
751 | + //如果是正值的时候 | |
752 | + if (out_of_weight >= 0) out_of_weight = -cut_good_weight; | |
753 | + else out_of_weight = -back_data.weight_free * 1000; | |
754 | + | |
755 | + var code = ""; | |
756 | + if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; | |
757 | + //--------------开始计算物流------------------ | |
758 | + var shipping_price=0; | |
759 | + // var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
760 | + // goods_piece, th.data.user_addr, back_data, rs); | |
761 | + | |
762 | + var w_data={ | |
763 | + store_id:os.stoid, code:code, | |
764 | + o_shipping_price:o_shipping_price, | |
765 | + goods_weight:goods_weight, | |
766 | + out_of_weight:out_of_weight,goods_piece:goods_piece, | |
767 | + user_addr_province:th.data.user_addr.province, | |
768 | + user_addr_city:th.data.user_addr.city, | |
769 | + user_addr_district:th.data.user_addr.district, | |
770 | + is_by_all:back_data && back_data.is_by_all?1:0, | |
771 | + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0, | |
772 | + } | |
773 | + | |
774 | + var is_ok=0; | |
775 | + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{ | |
776 | + if(res.data.code==0){ | |
777 | + shipping_price=res.data.data; is_ok=1; | |
778 | + } | |
779 | + }) | |
780 | + | |
781 | + if(!is_ok){ | |
782 | + wx.hideLoading(); | |
783 | + wx.showToast({ | |
784 | + title: "计算物流错误", icon: 'none',duration: 2000 | |
785 | + }) | |
786 | + | |
787 | + return false; | |
788 | + } | |
789 | + | |
790 | + | |
791 | + if (shipping_price <= 0) { | |
792 | + th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券 | |
793 | + } | |
794 | + | |
795 | + shipping_price = parseFloat(shipping_price).toFixed(2); | |
796 | + var wl_txt = "formData.shipping_price"; | |
797 | + th.setData({ [wl_txt]: shipping_price, }) | |
798 | + | |
799 | + } else if(th.data.bn_exp_type == 1 ) { | |
800 | + var wl_txt = "formData.shipping_price"; | |
801 | + th.setData({ [wl_txt]: 0, }) | |
802 | + } | |
803 | + //---如果有选择优惠券的情况下--- | |
804 | + var quan_price = 0, bn_pick = th.data.bn_pick; | |
805 | + | |
806 | + //-----------------支付价,优惠券不减物流----------------- | |
807 | + var total_m = (parseFloat(allpice)).toFixed(2); | |
808 | + var order_m = (parseFloat(allpice - cut_price) - quan_price).toFixed(2); | |
809 | + var coupon_price = quan_price; //优惠券优惠了多少钱 | |
810 | + if (order_m < 0) { | |
811 | + order_m = 0; coupon_price = parseFloat(order_m).toFixed(2); | |
812 | + } | |
813 | + | |
814 | + //--看一下有没有订单优惠-- | |
815 | + var o_condition = parseFloat(order_m); | |
816 | + if (th.data.bn_goods.whsle_id > 0) { | |
817 | + o_condition = 0; | |
818 | + } | |
819 | + | |
820 | + var order_prom_amount = 0; | |
821 | + var order_prom_id = 0; | |
822 | + if (ord_prom && o_condition > 0) { | |
823 | + //么有使用券,或者活动没有限制使用优惠券 | |
824 | + if (coupon_price <= 0 || !ord_prom.is_xz_yh) { | |
825 | + order_prom_id = ord_prom['id']; | |
826 | + switch (ord_prom['type']) { | |
827 | + case 0: | |
828 | + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
829 | + order_prom_amount = (o_condition - order_m).toFixed(2); | |
830 | + break; | |
831 | + case 1: | |
832 | + //-- 如果有优惠促销倍减的时候 -- | |
833 | + var bs = 1; | |
834 | + if (ord_prom.is_bz) { | |
835 | + bs = Math.floor(o_condition / ord_prom.money); | |
836 | + } | |
837 | + | |
838 | + order_m = o_condition - bs * ord_prom['expression'];//满额优惠金额 | |
839 | + order_prom_amount = ord_prom['expression']; | |
840 | + break; | |
841 | + } | |
842 | + } | |
843 | + } | |
844 | + //--订单优惠的显示-- | |
845 | + var order_prom_txt1 = "formData.order_prom_id"; | |
846 | + var order_prom_txt2 = "formData.order_prom_amount"; | |
847 | + if (order_prom_id > 0) { | |
848 | + th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount }) | |
849 | + } else { | |
850 | + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 }) | |
851 | + } | |
852 | + | |
853 | + | |
854 | + | |
855 | + //预存金额使用参与计算 | |
856 | + if (th.data.udata && th.data.udata.Balance > 0 && order_m * 1 > 0) { | |
857 | + if (!th.data.bn_goods.keyid) { | |
858 | + //获取门店信息 | |
859 | + await getApp().request.promiseGet("/api/weshop/pickup/list", { | |
860 | + data: { | |
861 | + store_id: os.stoid, | |
862 | + ids: th.data.bn_pick | |
863 | + } | |
864 | + }).then(res => { | |
865 | + if (ut.ajax_ok(res)) { | |
866 | + console.log(res); | |
867 | + if (res.data.code == 0) { | |
868 | + let resData = res.data.data.pageData | |
869 | + if (resData && resData[0]) { | |
870 | + let keyid = resData[0].keyid | |
871 | + let txt = 'bn_goods.keyid' | |
872 | + th.setData({ | |
873 | + [txt]: keyid | |
874 | + }) | |
875 | + } | |
876 | + } | |
877 | + } | |
878 | + }) | |
879 | + } | |
880 | + if (th.data.bn_goods.keyid) { | |
881 | + let cart_yc = await th.beforAdvancesum({ | |
882 | + order_amount: order_m, | |
883 | + goods: [{ | |
884 | + goods_sn: th.data.bn_goods.goods_sn, | |
885 | + goods_price: th.data.bn_goods.shop_price || th.data.bn_goods.goods_price, | |
886 | + goods_num: th.data.bn_goods.buynum || th.data.bn_goods.goods_num, | |
887 | + }], | |
888 | + sto: { | |
889 | + keyid: th.data.bn_goods.keyid | |
890 | + } | |
891 | + }) | |
892 | + | |
893 | + if (!good.yck_off) { | |
894 | + good.yck_off = cart_yc.yck_off | |
895 | + } | |
896 | + good.yck = cart_yc.yck | |
897 | + good.yckid = cart_yc.yckid | |
898 | + good.pre_json = cart_yc.pre_json | |
899 | + let yct1 = 'bn_goods.yck_off'; | |
900 | + let yct2 = 'bn_goods.yck'; | |
901 | + let yct3 = 'bn_goods.yckid'; | |
902 | + let yct4 = 'bn_goods.pre_json'; | |
903 | + th.setData({ | |
904 | + [yct1]: good.yck_off, | |
905 | + [yct2]: good.yck, | |
906 | + [yct3]: good.yckid, | |
907 | + [yct4]: good.pre_json, | |
908 | + }) | |
909 | + | |
910 | + if (good.yck_off && good.yck_off == 2) { | |
911 | + let order_amount = (order_m - good.yck).toFixed(2); | |
912 | + let yck = 0 | |
913 | + if (order_amount * 1 > 0) { | |
914 | + order_m = order_amount; | |
915 | + // all_prestore+=parseFloat(good.yck); | |
916 | + yck = parseFloat(good.yck) | |
917 | + } else { | |
918 | + // all_prestore+=order_m*1 | |
919 | + yck = parseFloat(order_m) | |
920 | + order_m = 0 | |
921 | + } | |
922 | + let atxt10 = "formData.prestore"; //预存金额 | |
923 | + let atxt11 = "formData.pre_json"; //预存json | |
924 | + let atxt12 = "formData.all_yck_arr"; //预存真实抵扣列表 | |
925 | + th.setData({ | |
926 | + [atxt10]: yck, | |
927 | + [atxt11]: [good.pre_json], | |
928 | + [atxt12]: [yck], | |
929 | + }) | |
930 | + // formData.prestore | |
931 | + // all_yck_arr.push(yck) //真实预存款抵扣金额 | |
932 | + // all_pre_json.push(good.pre_json) | |
933 | + // all_prestore = parseFloat(all_prestore); //真实预存款抵扣金额总和 | |
934 | + } | |
935 | + } | |
936 | + } else { | |
937 | + let yct1 = 'bn_goods.yck_off'; | |
938 | + let yct2 = 'bn_goods.yck'; | |
939 | + let yct3 = 'bn_goods.yckid'; | |
940 | + let yct4 = 'bn_goods.pre_json'; | |
941 | + let atxt10 = "formData.prestore"; //预存金额 | |
942 | + let atxt11 = "formData.pre_json"; //预存json | |
943 | + let atxt12 = "formData.all_yck_arr"; //预存真实抵扣列表 | |
944 | + th.setData({ | |
945 | + [yct2]: 0, | |
946 | + [yct3]: '', | |
947 | + [yct4]: '', | |
948 | + [atxt10]: 0, | |
949 | + [atxt11]: '', | |
950 | + [atxt12]: [], | |
951 | + }) | |
952 | + } | |
953 | + | |
954 | + //判断是否同城配送,而且没有调用过 | |
955 | + if(th.data.bn_exp_type==2 && th.data.user_addr) { | |
956 | + | |
957 | + var lon=0;var lat=0; | |
958 | + //-- 获取距离 -- | |
959 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { | |
960 | + is_json: 1, data: {address:th.data.user_addr.more_address+th.data.user_addr.address} | |
961 | + }).then(res=>{ | |
962 | + if(res.data.code==0){ | |
963 | + var data= JSON.parse(res.data.data); | |
964 | + if(data.status==0){ | |
965 | + lon=data.result.location.lng; | |
966 | + lat=data.result.location.lat; | |
967 | + } | |
968 | + } | |
969 | + }) | |
970 | + | |
971 | + | |
972 | + var gd_w = good['weight'] * good['buynum']; | |
973 | + //-- 获取距离 -- | |
974 | + var req_data = { | |
975 | + store_id: os.stoid, | |
976 | + order_amount: order_m, | |
977 | + lon: lon, lat: lat, | |
978 | + pickup_id: bn_pick, | |
979 | + goods_weight: gd_w | |
980 | + } | |
981 | + | |
982 | + var is_next=1; | |
983 | + //获取同城配送参数 | |
984 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", { | |
985 | + is_json: 1, | |
986 | + data: req_data | |
987 | + }).then(res => { | |
988 | + if (res.data.code == 0) { | |
989 | + var wl_txt = "formData.shipping_price"; | |
990 | + th.setData({ [wl_txt]: res.data.data, }) | |
991 | + }else{ | |
992 | + is_next=0; | |
993 | + wx.showToast({ | |
994 | + title: res.data.msg, icon: 'none', duration: 2000 | |
995 | + }) | |
996 | + } | |
997 | + }) | |
998 | + if(!is_next){ | |
999 | + th.setData({show_submit:1, submit: 0,same_ok:0 }) | |
1000 | + return false | |
1001 | + } | |
1002 | + | |
1003 | + th.data.lon=lon; | |
1004 | + th.data.lat=lat; | |
1005 | + th.data.bn_gd_w=gd_w; | |
1006 | + th.data.bn_samecity_order_amount=req_data.order_amount; | |
1007 | + | |
1008 | + } | |
1009 | + | |
1010 | + | |
1011 | + | |
1012 | + //--看一下有没有订单优惠--0 | |
1013 | + total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); | |
1014 | + order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price); | |
1015 | + var atxt = "formData.total_amount"; | |
1016 | + th.setData({ [atxt]: total_m, }) | |
1017 | + | |
1018 | + var txt = "formData.user_money"; | |
1019 | + var txt2 = "formData.order_amount"; | |
1020 | + var txt4 = "formData.integral"; | |
1021 | + | |
1022 | + | |
1023 | + //-- 最后的金额小于佣金 -- | |
1024 | + if(parseFloat(order_m)<parseFloat(th.data.bn_goods.use_commission)){ | |
1025 | + | |
1026 | + if(th.data.bn_use_commission){ | |
1027 | + wx.showToast({ | |
1028 | + title: '应付金额小于本单佣金,不可使用!', | |
1029 | + icon: 'none', | |
1030 | + duration: 2000 | |
1031 | + }) | |
1032 | + } | |
1033 | + | |
1034 | + th.setData({ | |
1035 | + cart_use_commission:0 | |
1036 | + }); | |
1037 | + | |
1038 | + } | |
1039 | + | |
1040 | + | |
1041 | + var txt5 = "formData.use_commission"; | |
1042 | + if(th.data.bn_use_commission){ | |
1043 | + order_m=(parseFloat(order_m)- parseFloat(th.data.bn_goods.use_commission)).toFixed(2); | |
1044 | + th.setData({[txt5]:th.data.bn_goods.use_commission}) | |
1045 | + } | |
1046 | + | |
1047 | + var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money); | |
1048 | + //--------------如果使用余额--------------------- | |
1049 | + if (th.data.bn_use_money == 1) { | |
1050 | + if (amoney > parseFloat(order_m)) { | |
1051 | + order_m = parseFloat(order_m).toFixed(2); | |
1052 | + th.setData({ [txt]: order_m, [txt2]: 0, [txt4]: all_integral, show_submit: 1,submit:0 }) | |
1053 | + } else { | |
1054 | + order_m = parseFloat(order_m - amoney); | |
1055 | + order_m = order_m.toFixed(2); | |
1056 | + th.setData({ [txt]: amoney, [txt2]: order_m, [txt4]: all_integral, show_submit: 1,submit:0 }) | |
1057 | + } | |
1058 | + } else { | |
1059 | + th.setData({ [txt]: 0, [txt2]: order_m, [txt4]: all_integral, show_submit: 1,submit:0}) | |
1060 | + } | |
1061 | + wx.hideLoading(); | |
1062 | + | |
1063 | + //}); | |
1064 | + | |
1065 | + }, | |
1066 | + | |
1067 | + //--------------------提交订单----------------------- | |
1068 | + async submitForm(t) { | |
1069 | + var sub_value = t; | |
1070 | + this.setData({submit:1}) | |
1071 | + | |
1072 | + if (this.data.is_summit_ing == 1) return false; //--提交中退出-- | |
1073 | + this.data.is_summit_ing = 1; | |
1074 | + var th = this, pdata = new Array(); | |
1075 | + var ff = true; | |
1076 | + //------------立即购买------------- | |
1077 | + if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { | |
1078 | + | |
1079 | + if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { | |
1080 | + ff = false; getApp().my_warnning("请选择收货地址", 0, th); | |
1081 | + th.data.is_summit_ing = 0; | |
1082 | + } | |
1083 | + if (!ff) return false; | |
1084 | + var addr = th.data.user_addr; | |
1085 | + if (th.data.bn_exp_type == 1) addr = null; | |
1086 | + | |
1087 | + if (th.data.bn_exp_type == 0) | |
1088 | + if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) { | |
1089 | + getApp().my_warnning("读取物流失败", 0, th); | |
1090 | + th.data.is_summit_ing = 0; | |
1091 | + return false; | |
1092 | + } | |
1093 | + | |
1094 | + | |
1095 | + var integrals = 0; | |
1096 | + var get_datas = { | |
1097 | + user_id: getApp().globalData.user_id, store_id: o.stoid, | |
1098 | + }; | |
1099 | + await getApp().request.promiseGet("/api/weshop/users/getAllPoints", { | |
1100 | + data: get_datas | |
1101 | + }).then(res => { | |
1102 | + if (res.data.code == 0) { | |
1103 | + integrals = res.data.data.Integral; | |
1104 | + } | |
1105 | + }) | |
1106 | + | |
1107 | + //判断积分的情况 | |
1108 | + if (th.data.formData.integral && parseFloat(th.data.formData.integral) < parseFloat(integrals)) { | |
1109 | + getApp().my_warnning("积分不足", 0, th); | |
1110 | + th.data.is_summit_ing = 0; | |
1111 | + return false; | |
1112 | + } | |
1113 | + | |
1114 | + var item = { | |
1115 | + 'user_id': to.globalData.user_id, | |
1116 | + 'consignee': addr == null ? "" : addr.consignee, | |
1117 | + 'province': addr == null ? 0 : addr.province, | |
1118 | + 'city': addr == null ? 0 : addr.city, | |
1119 | + 'district': addr == null ? 0 : addr.district, | |
1120 | + 'twon': addr == null ? 0 : addr.twon, | |
1121 | + 'address': addr == null ? "" : addr.address, | |
1122 | + 'more_address': addr == null ? "" : addr.more_address, | |
1123 | + //'mobile': th.data.userinfo.mobile, | |
1124 | + 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile, | |
1125 | + 'email': '', | |
1126 | + 'shipping_code': th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code, | |
1127 | + 'shipping_name': th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name, | |
1128 | + 'invoice_title': '', | |
1129 | + 'goods_price': th.data.formData.all_price, //商品总价 | |
1130 | + 'shipping_price': th.data.formData.shipping_price, //物流金额 | |
1131 | + 'user_money': th.data.formData.user_money, //使用余额 | |
1132 | + 'total_amount': th.data.formData.total_amount, //订单总价 | |
1133 | + 'order_amount': th.data.formData.order_amount, //应付 | |
1134 | + 'user_note': t.detail.value.user_note, //用户备注 | |
1135 | + 'store_id': oo.stoid, //商家 | |
1136 | + 'pickup_id': th.data.bn_pick, //门店 | |
1137 | + 'exp_type': th.data.bn_exp_type, //配送方式 | |
1138 | + 'order_goods': new Array(), | |
1139 | + 'integral': th.data.formData.integral, | |
1140 | + }; | |
1141 | + //是不是重新提交 | |
1142 | + if (th.data.is_continue == 1) item.is_continue = 1; | |
1143 | + | |
1144 | + //-- 如果有使用佣金抵扣的话 -- | |
1145 | + if(th.data.bn_use_commission){ | |
1146 | + item.use_commission=th.data.bn_goods.use_commission; | |
1147 | + } | |
1148 | + var order_prom_list = {}; | |
1149 | + //--判断有没有优惠活动-- | |
1150 | + if (th.data.formData.order_prom_amount > 0) { | |
1151 | + order_prom_list.order_prom_id = th.data.formData.order_prom_id; | |
1152 | + order_prom_list.order_prom_amount = th.data.formData.order_prom_amount; | |
1153 | + } | |
1154 | + item.order_prom_list = order_prom_list; | |
1155 | + | |
1156 | + if(item.exp_type==2){ | |
1157 | + item.lon=th.data.lon?th.data.lon:0; | |
1158 | + item.lat=th.data.lat?th.data.lat:0; | |
1159 | + item.goods_weight=th.data.bn_gd_w; | |
1160 | + item.samecity_order_amount=th.data.bn_samecity_order_amount; | |
1161 | + } | |
1162 | + | |
1163 | + | |
1164 | + //获取立即购买的商品的信息 | |
1165 | + var gg = to.get_b_now(); | |
1166 | + //--商品的房间号-- | |
1167 | + if (gg.room_id && gg.room_id > 0) { | |
1168 | + item.room_ids = gg.room_id; | |
1169 | + } | |
1170 | + if(gg.groupchat_id && gg.groupchat_id!='undefined'){ | |
1171 | + item.groupchat_ids=gg.groupchat_id | |
1172 | + } | |
1173 | + | |
1174 | + //老会员成为分销下线需要的参数 | |
1175 | + if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) { | |
1176 | + //判断一下分享人是不是分享商 | |
1177 | + await app.request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.first_leader, {}).then(res => { | |
1178 | + if (res.data.code == 0) { | |
1179 | + var user = res.data.data; | |
1180 | + if (user.is_distribut == 1) { | |
1181 | + item.first_leader = parseInt(getApp().globalData.first_leader); | |
1182 | + } | |
1183 | + } | |
1184 | + }) | |
1185 | + } | |
1186 | + | |
1187 | + | |
1188 | + var goods = { | |
1189 | + 'goods_id': gg.goods_id, | |
1190 | + 'goods_name': gg.goods_name, | |
1191 | + 'goods_sn': gg.goods_sn, | |
1192 | + 'goods_num': gg.goods_num, | |
1193 | + 'market_price': th.data.bn_goods.market_price, | |
1194 | + 'goods_price': th.data.bn_goods.shop_price, | |
1195 | + 'member_goods_price': th.data.bn_goods.shop_price, | |
1196 | + 'store_id': oo.stoid, | |
1197 | + 'prom_type': th.data.bn_goods.prom_type, //促销活动类型 | |
1198 | + 'prom_id': th.data.bn_goods.prom_id, //促销活动id | |
1199 | + }; | |
1200 | + | |
1201 | + if(getApp().globalData.skinface_id){ | |
1202 | + goods.skinface_id=getApp().globalData.skinface_id; | |
1203 | + } | |
1204 | + | |
1205 | + if(th.data.bn_goods.whsle_id){ | |
1206 | + item.is_whsle=1; | |
1207 | + goods.is_whsle_goods=1; | |
1208 | + } | |
1209 | + | |
1210 | + | |
1211 | + //-- 把导购的信息填入-- | |
1212 | + if (gg.guide_id) { | |
1213 | + goods.guide_id = gg.guide_id; | |
1214 | + goods.guide_type = gg.guide_type; | |
1215 | + //调用接口判断是不是会员 | |
1216 | + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { | |
1217 | + if (res.data.code == 0) { | |
1218 | + goods.guide_name = res.data.data.salesman; | |
1219 | + goods.guide_sn = res.data.data.salesman_no; | |
1220 | + } | |
1221 | + }) | |
1222 | + } | |
1223 | + if(gg.groupchat_id && gg.groupchat_id!='undefined'){ | |
1224 | + goods.groupchat_id=gg.groupchat_id | |
1225 | + } | |
1226 | + //--商品的房间号-- | |
1227 | + if (gg.room_id && gg.room_id > 0) { | |
1228 | + goods.room_id = gg.room_id; | |
1229 | + } | |
1230 | + | |
1231 | + item.order_goods.push(goods); | |
1232 | + pdata.push(item); | |
1233 | + } | |
1234 | + | |
1235 | + | |
1236 | + if (pdata.length == 0) return; | |
1237 | + //如果有使用预存,要处理 | |
1238 | + if (th.data.formData && th.data.formData.prestore * 1 > 0 && th.data.bn_goods.yck_off==2) { | |
1239 | + let formData = th.data.formData | |
1240 | + let pre_json = formData.pre_json | |
1241 | + let all_yck_arr = formData.all_yck_arr | |
1242 | + pdata.map((item, i) => { | |
1243 | + item.pre_cut = all_yck_arr[i] ? all_yck_arr[i].toFixed(2) : 0 | |
1244 | + item.pre_preferential = 0 | |
1245 | + item.pre_json = pre_json[i] ? JSON.stringify(pre_json[i]) : '' | |
1246 | + }) | |
1247 | + } | |
1248 | + if (!pdata.keyid && th.data.bn_goods) { | |
1249 | + pdata.map(ite => { | |
1250 | + ite.keyid = th.data.bn_goods.keyid | |
1251 | + }) | |
1252 | + // pdata.keyid = th.data.bn_goods.keyid | |
1253 | + } | |
1254 | + //------------------------------------------ | |
1255 | + | |
1256 | + var str = JSON.stringify(pdata); | |
1257 | + | |
1258 | + wx.showLoading({ title: "加载中" }); | |
1259 | + wx.request({ | |
1260 | + url: oo.url + '/api/weshop/order/createWxdOrder', | |
1261 | + data: str, | |
1262 | + method: 'POST', | |
1263 | + header: { | |
1264 | + 'content-type': 'application/json' | |
1265 | + },// 设置请求的 header | |
1266 | + success: function (res) { | |
1267 | + wx.hideLoading(); | |
1268 | + if (res.statusCode == 200) { | |
1269 | + var data = res.data; | |
1270 | + if (data.code == 0) { | |
1271 | + | |
1272 | + //如果是购物车结算,还要删除购物车 | |
1273 | + if (th.data.is_b_now == 0) { | |
1274 | + var list = th.data.cartlist_y; | |
1275 | + for (var i = 0; i < list.length; i++) { | |
1276 | + //删除购物车 | |
1277 | + a.delete("/api/weshop/cart/del/" + oo.stoid + "/" + list[i].id, {}); | |
1278 | + } | |
1279 | + } | |
1280 | + var order_amount = 0; | |
1281 | + pdata.forEach(function (em, ind) { | |
1282 | + order_amount += em.order_amount; | |
1283 | + }) | |
1284 | + //要进行判断,如果是用微信支付,就要跳转到支付界面 | |
1285 | + if (order_amount > 0) { | |
1286 | + th.setData({ isclose: 0 }); | |
1287 | + //void e.jumpToCart4({ | |
1288 | + // order_sn: data.data, | |
1289 | + //}, 1); | |
1290 | + util_pay.pay(data.data, function () { | |
1291 | + //app.my_warnning("支付成功",1,th); | |
1292 | + //setTimeout(function () { | |
1293 | + wx.redirectTo({ | |
1294 | + url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data | |
1295 | + }) | |
1296 | + //},1000) | |
1297 | + | |
1298 | + }, function () { | |
1299 | + //支付失败 | |
1300 | + setTimeout(function () { | |
1301 | + wx.navigateBack({ delta: 1 }) | |
1302 | + }, 1000) | |
1303 | + }, oo.stoid); | |
1304 | + | |
1305 | + } else { | |
1306 | + var dd = { | |
1307 | + parent_sn: data.data, | |
1308 | + store_id: oo.stoid, | |
1309 | + type: 2, | |
1310 | + }; | |
1311 | + a.post("/api/weshop/order/pay/createOrder", { | |
1312 | + data: dd, | |
1313 | + success: function (t) { | |
1314 | + //console.log(t); | |
1315 | + if (t.data.code == 0) { | |
1316 | + //app.my_warnning("支付成功",1,th); | |
1317 | + //setTimeout(function () { | |
1318 | + th.setData({ isclose: 0 }); | |
1319 | + wx.redirectTo({ | |
1320 | + url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data, | |
1321 | + }) | |
1322 | + //}, 1000) | |
1323 | + } | |
1324 | + }, | |
1325 | + fail: function () { | |
1326 | + | |
1327 | + } | |
1328 | + }); | |
1329 | + } | |
1330 | + | |
1331 | + } | |
1332 | + else { | |
1333 | + //--内容换行-- | |
1334 | + var msg = data.msg; | |
1335 | + //赠品活动已经取消,无法赠送,是否继续买单? | |
1336 | + if (msg.indexOf("是否继续买单") > 0) { | |
1337 | + wx.showModal({ | |
1338 | + title: "提示", | |
1339 | + content: data.msg, | |
1340 | + cancelText: '取消', | |
1341 | + confirmText: '确定', | |
1342 | + showCancel: true, | |
1343 | + success(res) { | |
1344 | + if (res.cancel) { | |
1345 | + th.setData({submit:0}) | |
1346 | + return; | |
1347 | + } else if (res.confirm) { | |
1348 | + th.data.is_continue = 1; | |
1349 | + th.submitForm(sub_value); | |
1350 | + } | |
1351 | + } | |
1352 | + }) | |
1353 | + return; | |
1354 | + } | |
1355 | + if (msg.length > 13) { | |
1356 | + msg = msg.slice(0, 13) + "\r\n" + msg.slice(13); | |
1357 | + } | |
1358 | + getApp().confirmBox(msg); | |
1359 | + th.data.is_summit_ing = 0; //是否提交中 | |
1360 | + } | |
1361 | + } else { | |
1362 | + th.setData({submit:0}) | |
1363 | + th.data.is_summit_ing = 0; //是否提交中 | |
1364 | + console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); | |
1365 | + } | |
1366 | + }, | |
1367 | + fail: function () { | |
1368 | + th.setData({submit:0}) | |
1369 | + th.data.is_summit_ing = 0; | |
1370 | + wx.hideLoading(); | |
1371 | + console.log("index.js wx.request CheckCallUser fail"); | |
1372 | + }, | |
1373 | + complete: function () { } | |
1374 | + }) | |
1375 | + | |
1376 | + }, | |
1377 | + | |
1378 | + //---确认线下门店的数量足不足--- | |
1379 | + async check_store_num(goods_id, pick, goods_num, func) { | |
1380 | + var lock = 0, pick_no, plist, erpwareid; | |
1381 | + //先读取门店的lock | |
1382 | + await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | |
1383 | + data: { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 } | |
1384 | + }).then(res => { | |
1385 | + if (res.data.code == 0 && res.data.data.total > 0) { | |
1386 | + for (var i in res.data.data.pageData) | |
1387 | + lock += res.data.data.pageData[i].outQty; | |
1388 | + } | |
1389 | + }) | |
1390 | + //先获取门店的编号 | |
1391 | + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, { | |
1392 | + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick } | |
1393 | + }).then(res => { | |
1394 | + if (res.data.code == 0) { | |
1395 | + pick_no = res.data.data.pickup_no; | |
1396 | + } | |
1397 | + }) | |
1398 | + //先获取商品的线下库存 | |
1399 | + await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { | |
1400 | + data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick } | |
1401 | + }).then(res => { | |
1402 | + if (res.data.code == 0) { | |
1403 | + erpwareid = res.data.data.erpwareid; | |
1404 | + } | |
1405 | + }) | |
1406 | + //读取线下的门店库存 | |
1407 | + await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | |
1408 | + data: { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid } | |
1409 | + }).then(res => { | |
1410 | + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) { | |
1411 | + plist = res.data.data.pageData[0]; | |
1412 | + } | |
1413 | + }) | |
1414 | + var isok = 1; | |
1415 | + if (goods_num > plist.CanOutQty - lock) { | |
1416 | + isok = 0; | |
1417 | + } | |
1418 | + func(isok); | |
1419 | + }, | |
1420 | + | |
1421 | + useCoupon: function () { | |
1422 | + if (this.data.order.couponNum <= 0) { | |
1423 | + getApp().my_warnning("无可用优惠券", 0, this); | |
1424 | + return; | |
1425 | + } | |
1426 | + | |
1427 | + var a = { | |
1428 | + lid: this.data.coupon ? this.data.coupon.id : "0" | |
1429 | + }; | |
1430 | + wx.navigateTo({ | |
1431 | + url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a) | |
1432 | + }); | |
1433 | + }, | |
1434 | + enterAddressPage: function () { | |
1435 | + getApp().globalData.is_cart_old = 1; | |
1436 | + this.data.isget_by_quan = {}; | |
1437 | + this.data.enterAddressPage = !0, wx.navigateTo({ | |
1438 | + url: "/pages/user/address_list/address_list" | |
1439 | + }); | |
1440 | + }, | |
1441 | + | |
1442 | + | |
1443 | + | |
1444 | + //--------立即购买时,选择自提和物流---------- | |
1445 | + setexptype: function (t) { | |
1446 | + var th = this; | |
1447 | + var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; | |
1448 | + | |
1449 | + th.setData({ bn_exp_type: ty,same_ok:1 }); | |
1450 | + //当物流为空的时候。 | |
1451 | + if (ty == 0 && th.data.wu_arr == null) { | |
1452 | + th.data.isget_by_quan = {}; | |
1453 | + return th.get_wuliu(th.calculatePrice2()); | |
1454 | + } | |
1455 | + | |
1456 | + //--自提就要把包邮券清理掉-- | |
1457 | + if (ty == 1) { | |
1458 | + th.data.isget_by_quan = {}; | |
1459 | + if (th.data.using_quan && th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) { | |
1460 | + th.setData({ using_quan: {} }); | |
1461 | + } | |
1462 | + } | |
1463 | + | |
1464 | + //判断有没有默认的物流地址值 | |
1465 | + if (def_exp_code != "" && def_exp_code != null && def_exp_code != undefined && !th.data.is_default_logistics) { | |
1466 | + var wu_arr = this.data.wu_arr; | |
1467 | + if (wu_arr != null && wu_arr != "") { | |
1468 | + for (var i = 0; i < wu_arr.length; i++) { | |
1469 | + if (wu_arr[i].shipping_code == def_exp_code) { | |
1470 | + th.setData({ index: i }); | |
1471 | + } | |
1472 | + } | |
1473 | + } | |
1474 | + } | |
1475 | + th.calculatePrice2() | |
1476 | + | |
1477 | + }, | |
1478 | + | |
1479 | + //--------立即购买时,使用余额-------- | |
1480 | + set_bn_useyuer: function () { | |
1481 | + var th = this; | |
1482 | + th.setData({ bn_use_money: !th.data.bn_use_money }); | |
1483 | + th.calculatePrice2(); | |
1484 | + }, | |
1485 | + set_js_useyuer: function () { | |
1486 | + var th = this; | |
1487 | + th.setData({ js_use_money: !th.data.js_use_money }); | |
1488 | + th.calculatePrice(); | |
1489 | + }, | |
1490 | + | |
1491 | + //----------立即购买,选择物流------------- | |
1492 | + bindPickerChange: function (e) { | |
1493 | + var ind = e.detail.value | |
1494 | + this.setData({ index: ind }); | |
1495 | + this.calculatePrice2(); | |
1496 | + }, | |
1497 | + //----------购物车结算,选择物流------------- | |
1498 | + bindPickerChange_w: function (e) { | |
1499 | + var ind = e.detail.value, txt = e.currentTarget.dataset.txt; | |
1500 | + this.setData({ [txt]: ind }); | |
1501 | + this.calculatePrice(); | |
1502 | + }, | |
1503 | + | |
1504 | + cart_set_err: function (e) { | |
1505 | + var txt = e.currentTarget.dataset.err; | |
1506 | + var ob = {}; | |
1507 | + ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif"; | |
1508 | + this.setData(ob); | |
1509 | + }, | |
1510 | + | |
1511 | + //// 开启物流的弹窗 | |
1512 | + show_wu_arr: function (e) { | |
1513 | + var wu_arr_txt = e.currentTarget.dataset.txt; | |
1514 | + var w_sele_index = e.currentTarget.dataset.w_sele_index; | |
1515 | + var is_express = null; | |
1516 | + var ob = { open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1 }; | |
1517 | + | |
1518 | + //--如果是多个门店的时候-- | |
1519 | + if (w_sele_index != undefined) { | |
1520 | + is_express = this.data.cartlist[w_sele_index].wind; | |
1521 | + ob['is_express'] = is_express; | |
1522 | + } | |
1523 | + this.setData(ob); | |
1524 | + }, | |
1525 | + // 关闭物流的弹窗 | |
1526 | + close_express: function () { | |
1527 | + this.setData({ open_express: 0, disabled: 0 }); | |
1528 | + }, | |
1529 | + // 选择物流 | |
1530 | + click_express_name: function (e) { | |
1531 | + var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode; | |
1532 | + var index = e.currentTarget.dataset.idxe; | |
1533 | + var ob = { is_express: index, is_shipping_code: shippingcode, disabled: 0 }; | |
1534 | + ob[this.data.wu_arr_txt] = index; | |
1535 | + this.setData(ob); | |
1536 | + }, | |
1537 | + | |
1538 | + //点击确定物流 | |
1539 | + determine_expres: function (e) { | |
1540 | + this.setData({ open_express: 0 }); | |
1541 | + this.calculatePrice2(); | |
1542 | + }, | |
1543 | + | |
1544 | + //设置默认物流 | |
1545 | + select_default_logistics: function () { | |
1546 | + var th = this; | |
1547 | + var is_shipping_code = this.data.is_shipping_code | |
1548 | + getApp().request.put("/api/weshop/users/update", { | |
1549 | + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code }, | |
1550 | + success: function (rse) { | |
1551 | + if (rse.data.code == 0) { | |
1552 | + getApp().globalData.userInfo.def_exp_code = is_shipping_code; | |
1553 | + th.setData({ open_express: 0 }); | |
1554 | + //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19-------- | |
1555 | + //if(th.data.is_b_now==1) th.calculatePrice2(); | |
1556 | + //else th.calculatePrice(); | |
1557 | + th.calculatePrice2(); | |
1558 | + } | |
1559 | + } | |
1560 | + }) | |
1561 | + }, | |
1562 | + | |
1563 | + //更新下默认,在onshow里面 | |
1564 | + update_code() { | |
1565 | + var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; | |
1566 | + | |
1567 | + | |
1568 | + //--定时器,判断wu_arr不未空-- | |
1569 | + var uii = setInterval(function () { | |
1570 | + if (th.data.wu_arr) { | |
1571 | + clearInterval(uii); | |
1572 | + if(th.data.is_default_logistics) return false; | |
1573 | + for (var k = 0; k < th.data.wu_arr.length; k++) { | |
1574 | + var item = th.data.wu_arr[k]; | |
1575 | + if (def_exp_code == item.code) { m_wind = k; } | |
1576 | + } | |
1577 | + //--如果是立即购买-- | |
1578 | + th.setData({ index: m_wind, is_express: m_wind }); | |
1579 | + | |
1580 | + } | |
1581 | + }, 500); | |
1582 | + }, | |
1583 | + | |
1584 | + //检查区域是不是包邮 | |
1585 | + check_area: function (arr) { | |
1586 | + var user_addr = this.data.user_addr; | |
1587 | + for (var i in arr) { | |
1588 | + var item = arr[i]; | |
1589 | + if (user_addr.twon == item || user_addr.district == item | |
1590 | + || user_addr.city == item || user_addr.province == item) { | |
1591 | + return 0; | |
1592 | + } | |
1593 | + } | |
1594 | + return 1; | |
1595 | + }, | |
1596 | + | |
1597 | + //检查立即购买的商品是不是不包邮 | |
1598 | + check_good: function (arr, goods_id) { | |
1599 | + if (!goods_id) goods_id = this.data.bn_goods.goods_id; | |
1600 | + for (var i in arr) { | |
1601 | + var item = arr[i]; | |
1602 | + if (goods_id == item) return 0; | |
1603 | + } | |
1604 | + return 1; | |
1605 | + }, | |
1606 | + check_by_area: function (region_list) { | |
1607 | + var arr = region_list.split(","); | |
1608 | + var check = this.check_area(arr); | |
1609 | + return !check; | |
1610 | + }, | |
1611 | + check_by_goods: function (goods_list, goods_id) { | |
1612 | + var arr = goods_list.split(","); | |
1613 | + var check = this.check_good(arr, goods_id); | |
1614 | + return !check; | |
1615 | + }, | |
1616 | + | |
1617 | + | |
1618 | + //从优惠的映射中拿出商品从表的item | |
1619 | + arr_get_goods: function (goods_id, arr) { | |
1620 | + for (var i in arr) { | |
1621 | + if (arr[i].goods_id == goods_id) return arr[i]; | |
1622 | + } | |
1623 | + }, | |
1624 | + | |
1625 | + //跳转到购买卡 | |
1626 | + buycard: function () { | |
1627 | + getApp().goto("/pages/user/plus/plus"); | |
1628 | + getApp().globalData.plus_buy_back = 1; | |
1629 | + }, | |
1630 | + | |
1631 | + //使用佣金抵扣 | |
1632 | + set_bn_commission:function () { | |
1633 | + var th = this; | |
1634 | + th.setData({bn_use_commission: !th.data.bn_use_commission}); | |
1635 | + th.calculatePrice2(); | |
1636 | + } | |
1637 | + | |
1638 | + | |
1639 | +}); | ... | ... |
pages/cart/cart2_inte/cart2_inte.json renamed to packageE/pages/cart/cart2_inte/cart2_inte.json
packageE/pages/cart/cart2_inte/cart2_inte.wxml
0 → 100644
1 | +<wxs module="filter" src="c_filter.wxs"></wxs> | |
2 | +<wxs src="filter.wxs" module="util"></wxs> | |
3 | +<wxs module="filters" src="../../../../utils/filter.wxs"></wxs> | |
4 | + | |
5 | +<form bindsubmit="submitForm"> | |
6 | + <view class="container"> | |
7 | + | |
8 | + <view class="tab-container" wx:if="{{show_submit}}"> | |
9 | + <view class="tab-wrapper"> | |
10 | + <view hidden="{{bn_t_exp_t==2}}" bindtap='setexptype' data-t='1' class="tab {{bn_exp_type == 1? 'active':''}}" | |
11 | + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view> | |
12 | + | |
13 | + <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" | |
14 | + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> | |
15 | + | |
16 | + <!-- 同城配送 --> | |
17 | + <block wx:if="{{show_same_city}}"> | |
18 | + <view hidden="{{bn_t_exp_t==3}}" bindtap='setexptype' data-t='2' class="tab {{bn_exp_type== 2 ? 'active':''}}" data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}">同城配送</view> | |
19 | + </block> | |
20 | + | |
21 | + </view> | |
22 | + </view> | |
23 | + | |
24 | + | |
25 | + <!--要进行判断地址是否显示----> | |
26 | + <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{(bn_exp_type==1 && is_b_now==1) || (is_all_zt==1 && is_b_now==0)}}'> | |
27 | + <!---默认地址显示------> | |
28 | + <block wx:if="{{user_addr!=null}}"> | |
29 | + | |
30 | + <view class="user-contact"> | |
31 | + <text>收货人:</text>{{user_addr.consignee}}{{' '}}{{user_addr.mobile}}</view> | |
32 | + <view class="location"> | |
33 | + <view class="address">{{user_addr.more_address}}{{' '}}{{user_addr.address}}</view> | |
34 | + <view class="pos-icon"> | |
35 | + <image class="wh100 bdr14" src="{{imgUrl}}/miniapp/images/goodscategory/new_position.png"></image> | |
36 | + </view> | |
37 | + </view> | |
38 | + <view class="update-logistics"> | |
39 | + <!-- <image class="arrow-rigth" src="{{imgUrl}}/miniapp/images/new_position.png"></image> --> | |
40 | + <view class="xc-right"></view> | |
41 | + </view> | |
42 | + </block> | |
43 | + <!---先增地址------> | |
44 | + <block wx:else> | |
45 | + <view class="add_new"> | |
46 | + <image class="addr_jia" src="{{imgUrl}}/miniapp/images/jia.png"></image>添加地址 | |
47 | + </view> | |
48 | + </block> | |
49 | + <!-- <view class="border-img"> | |
50 | + <image class="wh100" src="{{imgUrl}}/miniapp/images/order/new_dividing_line.png"></image> | |
51 | + </view> --> | |
52 | + </view> | |
53 | + | |
54 | + | |
55 | + | |
56 | + <!-- ----立即购买------ --> | |
57 | + <!-- <view class="xc-border xc-border"></view> --> | |
58 | + <block wx:if="{{is_b_now==1}}"> | |
59 | + <view class="use-item bfff bdr_t-14 mgt20"> | |
60 | + <image class="dp" src='{{imgUrl}}/miniapp/images/goodscategory/new_store.png'> </image> | |
61 | + <view>{{bn_pickname}}</view> | |
62 | + <!-- <view>门店:{{bn_pickname}}</view> --> | |
63 | + </view> | |
64 | + <view class="order-detail"> | |
65 | + <view class="goods-img"> | |
66 | + <image class="wh100 bdr14" src="{{bn_goods.original_img}}" binderror='cart_set_err' data-err="bn_goods.original_img"></image> | |
67 | + </view> | |
68 | + <navigator class="order-cont" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{bn_goods.goods_id}}&prom_type={{bn_goods.prom_type}}&prom_id={{bn_goods.prom_id}}"> | |
69 | + <view class="goods-name ellipsis-2">{{bn_goods.goods_name}}</view> | |
70 | + <!-- 商品属性 --> | |
71 | + <view class="flex-vertical fs28 xc-ash color-gray n_guige"> | |
72 | + <view class="goods-color"> | |
73 | + <block><text>{{filters.show_gui_ge(bn_goods.goods_spec,bn_goods.goods_color)}}</text></block> | |
74 | + </view> | |
75 | + </view> | |
76 | + | |
77 | + <!-----商品名称规格------> | |
78 | + <view class="order-num flex-space-between"> | |
79 | + <view class="co-red"> | |
80 | + <text wx:if="{{bn_goods.integral}}" class="fs36">{{bn_goods.integral}}积分</text> | |
81 | + <text wx:if="{{bn_goods.integral && bn_goods.shop_price}}">+</text> | |
82 | + <block wx:if="{{bn_goods.shop_price}}"> ¥<text class="fs36">{{filters.toFix(bn_goods.shop_price,2)}}</text></block> | |
83 | + </view> | |
84 | + <view style="color: red;" wx:if="{{bn_goods.use_commission && bn_goods.use_commission*1>0}}">佣金:{{filters.toFix(bn_goods.use_commission/bn_goods.buynum,2)}}*{{bn_goods.buynum}}</view> | |
85 | + | |
86 | + <view class="goods-num">x{{bn_goods.buynum}}</view> | |
87 | + </view> | |
88 | + </navigator> | |
89 | + | |
90 | + </view> | |
91 | + | |
92 | + <view class="set-mes bdr_b-14"> | |
93 | + <view wx:if="{{order.store_prom}}"> | |
94 | + <icon color="#f23030" size="16" type="info"></icon>{{order.store_prom}} | |
95 | + </view> | |
96 | + | |
97 | + <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" wx:if="{{(selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null}}"> | |
98 | + <view class="work-frame flex-space-between"> | |
99 | + <view class="work"> | |
100 | + 优惠券 <text class="quan_num_show">{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list?get_by_quan_list.length:0)}}张可用</text> | |
101 | + </view> | |
102 | + <view class="xc-right-frame"> | |
103 | + <text wx:if="{{using_quan[bn_pick].is_nouse}}">不使用</text> | |
104 | + <block wx:else> | |
105 | + <text wx:if="{{using_quan[bn_pick].money}}">¥{{using_quan[bn_pick].money}}元优惠券</text> | |
106 | + <text wx:if="{{using_quan[bn_pick].isby}}">包邮券</text> | |
107 | + </block> | |
108 | + <view class="xc-right"></view> | |
109 | + </view> | |
110 | + </view> | |
111 | + </view> | |
112 | + | |
113 | + | |
114 | + | |
115 | + <block wx:if="{{bn_exp_type==0 && !is_default_logistics}}"> | |
116 | + <view class="use-item flex-space-between"> | |
117 | + <view>选择物流</view> | |
118 | + <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 8rpx;"> | |
119 | + <view class="logistics-name">{{wu_arr[index].name}}</view> | |
120 | + <view class="xc-right"></view> | |
121 | + </view> | |
122 | + </view> | |
123 | + </block> | |
124 | + | |
125 | + </view> | |
126 | + | |
127 | + <view class="coupon-mes flex-vertical"> | |
128 | + <view>留言</view> | |
129 | + <view class="leave-word"> | |
130 | + <input placeholder-class="fs28" placeholder='给商家留言,最多100字' bindinput="keyUpChangeNum" disabled="{{disabled}}" | |
131 | + class="word-box" maxlength="100" name="user_note"></input> | |
132 | + </view> | |
133 | + </view> | |
134 | + <!-- 预存款 --> | |
135 | + <view class="set-mes" catchtap="prestore2" wx:if="{{bn_goods.yck_off}}"> | |
136 | + <view class="use-item" style="justify-content: space-between;"> | |
137 | + <view> | |
138 | + <icon color="{{bn_goods.yck_off==2 ? 'red' : '#808080'}}" size="16" type="success"></icon> | |
139 | + <view class="yu_er">使用预存</view> | |
140 | + </view> | |
141 | + <view wx:if="{{bn_goods.yck_off==2 }}">¥{{filters.toFix(bn_goods.yck,2)}}</view> | |
142 | + </view> | |
143 | + </view> | |
144 | + | |
145 | + <!-----使用佣金抵扣,只有佣金小于尾款金额的时候------> | |
146 | + <view class="set-mes bdr_t-14" | |
147 | + wx:if="{{bn_goods.use_commission>0 && can_commission && formData.all_price>0 && bn_goods.use_commission<=formData.all_price}}"> | |
148 | + <view class="use-item" bindtap='set_bn_commission'> | |
149 | + <icon color="{{bn_use_commission?'red':'gray'}}" size="16" type="success"></icon> | |
150 | + <view class="yu_er">使用佣金 :¥{{bn_goods.use_commission}} </view> | |
151 | + </view> | |
152 | + </view> | |
153 | + | |
154 | + <!-- ---使用余额---- --> | |
155 | + <view class="set-mes bdr_t-14" wx:if="{{yuer>0 && formData.all_price>0}}"> | |
156 | + <view class="use-item" bindtap='set_bn_useyuer'> | |
157 | + <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon> | |
158 | + <view class="yu_er">使用余额 :¥{{yuer}} </view> | |
159 | + </view> | |
160 | + </view> | |
161 | + | |
162 | + | |
163 | + | |
164 | + </block> | |
165 | + | |
166 | + <view class="information bdr14"> | |
167 | + <view class="item" wx:if="{{formData.all_price>0}}"> | |
168 | + <view>商品金额</view> | |
169 | + <view class="co-red">¥ {{formData.all_price}}元</view> | |
170 | + </view> | |
171 | + <view class="item" wx:if="{{formData.integral>0}}"> | |
172 | + <view>可用积分{{integral_can}}</view> | |
173 | + <view class="co-red">{{formData.integral}}积分</view> | |
174 | + </view> | |
175 | + <view class="item" wx:if="{{formData.shipping_price>0}}"> | |
176 | + <view>配送费用</view> | |
177 | + <view class="co-red">¥ {{formData.shipping_price}}元</view> | |
178 | + </view> | |
179 | + | |
180 | + <!-- 订单优惠优惠金额 --> | |
181 | + <view class="item" wx:if="{{formData.order_prom_amount>0}}"> | |
182 | + <view>订单优惠</view> | |
183 | + <view class="co-red">- ¥ {{filters.toFix(formData.order_prom_amount,2)}}元</view> | |
184 | + </view> | |
185 | + <!-- 使用预存优惠金额 --> | |
186 | + <view class="item" wx:if="{{formData.prestore>0}}"> | |
187 | + <view>使用预存</view> | |
188 | + <view class="co-red">- ¥ {{filters.toFix(formData.prestore,2)}}元</view> | |
189 | + </view> | |
190 | + <view class="item" wx:if="{{formData.user_money>0}}"> | |
191 | + <view>使用余额</view> | |
192 | + <view class="co-red">- ¥ {{formData.user_money}}元</view> | |
193 | + </view> | |
194 | + </view> | |
195 | + </view> | |
196 | + | |
197 | + <view class="btn-wrap shadow-1" wx:if="{{show_submit}}"> | |
198 | + <view class="pay-amount"> | |
199 | + <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> | |
200 | + <view class="payable">应付积分:<text class="co-red">{{formData.integral}}积分</text></view> | |
201 | + </view> | |
202 | + <button disabled="{{submit || !same_ok}}" class="tips-btn" formType="submit" id="submitOrder">提交订单</button> | |
203 | + </view> | |
204 | +</form> | |
205 | + | |
206 | +<!----弹起选择物流名的列表----> | |
207 | +<view wx:if='{{open_express==1}}'> | |
208 | + <view class="cover-layer flex-center " bindtap='close_express'> | |
209 | + </view> | |
210 | + | |
211 | + <view class="cx-popup radius {{open_express==1?'up' : 'down'}}"> | |
212 | + <view class="tops flex"> | |
213 | + <view class="top-content fs32"> | |
214 | + <view>选择物流名字</view> | |
215 | + </view> | |
216 | + <view class="close-frame" bindtap='close_express'> | |
217 | + <view class="xc-close-express">×</view> | |
218 | + </view> | |
219 | + </view> | |
220 | + <view class="express_list"> | |
221 | + <view wx:for="{{wu_arr}}" wx:for-item="express_list" wx:for-index="idx"> | |
222 | + <view class="express_list_frame" bindtap="click_express_name" data-shippingcode="{{express_list.shipping_code}}" | |
223 | + data-name="{{express_list.name}}" data-idxe="{{idx}}"> | |
224 | + | |
225 | + <block wx:if="{{is_express==idx}}"> | |
226 | + <view class="circle white xc-hook fs20 red-b"><text>Γ</text></view> | |
227 | + </block> | |
228 | + <block wx:else> | |
229 | + <view class="circle xc-hooks"></view> | |
230 | + </block> | |
231 | + <view class="fs30">{{express_list.name}}</view> | |
232 | + | |
233 | + </view> | |
234 | + </view> | |
235 | + </view> | |
236 | + <view class="flex click-buttem"> | |
237 | + <view class="xc-determine flex-center" bindtap="determine_expres"> | |
238 | + <view class="flex-vertical t-c">确定</view> | |
239 | + </view> | |
240 | + <view class="xc-confirms flex-center" bindtap="select_default_logistics"> | |
241 | + <view class="flex-vertical t-c">设为默认</view> | |
242 | + </view> | |
243 | + </view> | |
244 | + | |
245 | + </view> | |
246 | +</view> | |
247 | + | |
248 | +<warn id="warn"></warn> | ... | ... |
pages/cart/cart2_inte/cart2_inte.wxss renamed to packageE/pages/cart/cart2_inte/cart2_inte.wxss
pages/cart/cart2_inte/filter.wxs renamed to packageE/pages/cart/cart2_inte/filter.wxs
packageE/pages/togoin/togoin.wxml
... | ... | @@ -17,9 +17,14 @@ |
17 | 17 | |
18 | 18 | <view bindtap="" class="user-name flex-vertical fs24 jc-center"> |
19 | 19 | <checkbox-group bindchange="isAgree"> |
20 | - <checkbox value="true"/> | |
20 | + <checkbox value="true"> | |
21 | + <label for="true"> | |
22 | + <view class="user-name-txt">我已阅读同意 <text class="gray" catchtap="goto" data-url="/packageA/pages/parseHtml/parseHtml?t=0">《用户使用协议》</text>与<text class="gray" catchtap="goto" data-url="/packageA/pages/parseHtml/parseHtml?t=1">《隐私政策》</text></view> | |
23 | + </label> | |
24 | + </checkbox> | |
21 | 25 | </checkbox-group> |
22 | - <view class="user-name-txt">我已阅读同意 <text class="gray" bindtap="goto" data-url="/packageA/pages/parseHtml/parseHtml?t=0">《用户使用协议》</text>与<text class="gray" bindtap="goto" data-url="/packageA/pages/parseHtml/parseHtml?t=1">《隐私政策》</text></view> | |
26 | + | |
27 | + | |
23 | 28 | </view> |
24 | 29 | |
25 | 30 | <!-- 授权获取基础信息 --> | ... | ... |
pages/cart/cart2_inte/cart2_inte.js
1 | -var t = getApp(), app = t, a = t.request, e = require("../../../utils/common.js"), | |
2 | - s = require("../../../utils/util.js"), ut = s, o = require("../../../utils/md5.js"), to = getApp(); | |
3 | -var oo = t.globalData.setting, os = oo; | |
4 | -var regeneratorRuntime = require('../../../utils/runtime.js'); | |
5 | -var util_pay = require("../../../utils/pay.js"); | |
6 | - | |
1 | +// pages/cart/cart2_inte/cart2_inte.js | |
7 | 2 | Page({ |
8 | - data: { | |
9 | - url: t.globalData.setting.url, | |
10 | - imgUrl: t.globalData.setting.imghost, | |
11 | - goods: null, | |
12 | - order: null, | |
13 | - orderPrices: null, | |
14 | - coupons: null, | |
15 | - coupon: null, | |
16 | - invoiceToggle: !0, | |
17 | - payWithUserMoney: !0, | |
18 | - payWithPoints: !0, | |
19 | - maxWord: 0, | |
20 | - enterAddressPage: !1, | |
21 | - firstEnter: !0, | |
22 | - //页面获取的参数 | |
23 | - param: null, | |
24 | - //提交订单的格式 | |
25 | - formData: { | |
26 | - order_amount: 0,//支付金额 | |
27 | - total_amount: 0,//总价 | |
28 | - all_price: 0,//商品卖的总价 | |
29 | - pay_points: 0,//使用积分 | |
30 | - user_money: 0,//使用余额 | |
31 | - couponCode: "",//使用优惠券(多单就用逗号隔开) | |
32 | - shipping_price: 0,//物流费用 | |
33 | - }, | |
34 | - inv_is_post:0,//积分购是否包邮 | |
35 | - | |
36 | - /*----------------立即购买---------------------*/ | |
37 | - is_b_now: 1, //0是购物车结算 1立即购买 | |
38 | - bn_goods: null, //立即购买时候的调用商品 | |
39 | - bn_use_money: 0,//是否使用余额 | |
40 | - bn_exp_type: 1, //0是物流 1自提 | |
41 | - bn_pick: 0, //选择的门店 | |
42 | - bn_pickname: "", //选择的门店名称 | |
43 | - bn_t_exp_t: 0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流 | |
44 | - | |
45 | - bn_is_order_yh: 1, //是不是订单优惠 | |
46 | - bn_is_post_temp: 1, //是不是进行计算包邮模板 | |
47 | - | |
48 | - bn_plus_cut_price: 0, //显示等级卡会优惠多少钱 | |
49 | - /*------------------------*/ | |
50 | - user_addr: null,//物流 | |
51 | - userinfo: null, //获取会员 | |
52 | - /*----------物流选择--------*/ | |
53 | - wu_arr: null, | |
54 | - index: 0, | |
55 | - w_sele_index: 0, | |
56 | - | |
57 | - //判断页面是返回回来的还是 首次进入的 | |
58 | - isclose: 1, | |
59 | - //申请提现的金额 | |
60 | - txmon: 0, | |
61 | - yuer: 0, | |
62 | - //提交中,不重复提交 | |
63 | - is_summit_ing: 0, | |
64 | - | |
65 | - disabled: 0, | |
66 | - open_express: 0,//控制选择物流名列表 的属性 | |
67 | - | |
68 | - is_express: 0, //选中物流的属性 | |
69 | - expres_name: "", //点击选定 | |
70 | - is_shipping_code: "",//插入用户默认地址 | |
71 | - wu_arr_txt: "", //要更新的物流的字段 | |
72 | - | |
73 | - //如果是全场包邮了,或者是全场不包邮了,就不要选包邮券 | |
74 | - is_no_by: {}, | |
75 | - is_by: {}, | |
76 | - is_quan_by: {}, | |
77 | - //--购买赠送的商品-- | |
78 | - buy_now_gift_goods: null, | |
79 | - //--订单优惠-- | |
80 | - order_prom: {}, | |
81 | - show_submit: 0, //提交按钮变正常显示 | |
82 | - udata: null,//用户预存值,数据 | |
83 | - is_pre_cut:0, //是否可以使用预存 0是不可以1的可以 | |
84 | - }, | |
85 | - onLoad: function (t) { | |
86 | - wx.setNavigationBarTitle({ title: "填写订单", }) | |
87 | - var th = this; | |
88 | - th.data.param = t; | |
89 | - //清空is_pick_up | |
90 | - getApp().request.put("/api/weshop/useraddress/updatePickUp", { | |
91 | - data: { user_id: getApp().globalData.user_id, is_pickup: 0 }, | |
92 | - success: function (s) { | |
93 | - } | |
94 | - }); | |
95 | - | |
96 | - //先获取是否有关闭使用优惠券 | |
97 | - getApp().getConfig2(function (ee) { | |
98 | - var json_d = JSON.parse(ee.switch_list); | |
99 | - th.data.json_d = json_d; | |
100 | - th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 | |
101 | - var is_default_logistics = json_d.is_default_logistics; | |
102 | - var is_same_city = json_d.is_same_city; | |
103 | - th.setData({is_pre_cut:json_d.is_pre_cut, is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, | |
104 | - rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics,is_same_city:is_same_city }); | |
105 | - | |
106 | - var rank_switch = json_d.rank_switch; | |
107 | - var max_price = -1; | |
108 | - var show_card = null; | |
109 | - var name = ""; | |
110 | - //如果有开等级卡的时候, | |
111 | - //因为都是调接口,要返回在计算 | |
112 | - if (rank_switch == 2) { | |
113 | - //-- 获取所有的等级卡, -- | |
114 | - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid, | |
115 | - {}).then(res => { | |
116 | - if (res.data.code == 0) { | |
117 | - var plusCard = res.data.data; | |
118 | - //-- 循环判断,拿到最贵的那张卡 -- | |
119 | - for (var ih in plusCard) { | |
120 | - if (plusCard[ih].IsStopBuy == true) { continue; } | |
121 | - if (max_price < 0) { | |
122 | - max_price = plusCard[ih].CardFee; | |
123 | - name = 'card' + plusCard[ih]['CorrPrice']; | |
124 | - show_card = plusCard[ih]; | |
125 | - } else { | |
126 | - if (max_price < plusCard[ih].CardFee) { | |
127 | - max_price = plusCard[ih].CardFee; | |
128 | - name = 'card' + plusCard[ih]['CorrPrice']; | |
129 | - show_card = plusCard[ih]; | |
130 | - } | |
131 | - } | |
132 | - } | |
133 | - | |
134 | - if (show_card) { | |
135 | - name = name.toLowerCase(); | |
136 | - th.setData({ card_name: name, show_card: show_card }) | |
137 | - } | |
138 | - } | |
139 | - //-----先获取物流,再获取用户信息,再展示页面----- | |
140 | - th.get_wuliu(th.get_info(th.show_page)); | |
141 | - }) | |
142 | - } else { | |
143 | - //-----先获取物流,再获取用户信息,再展示页面----- | |
144 | - th.get_wuliu(th.get_info(th.show_page)); | |
145 | - } | |
146 | - }, 1); | |
147 | - | |
148 | - | |
149 | - //判断是不是佣金抵扣 | |
150 | - getApp().is_distribut(this); | |
151 | - | |
152 | - | |
153 | - }, | |
154 | - onUnload: function () { this.setData({ isclose: 1 }) }, | |
155 | - onHide: function () { | |
156 | - this.setData({ | |
157 | - is_no_by: {}, | |
158 | - is_by: {} | |
159 | - }) | |
160 | - }, | |
161 | - | |
162 | - //----------子页返回父页触发---------- | |
163 | - onShow: function () { | |
164 | - | |
165 | - var fy=ut.fy_back('',1,function (){ | |
166 | - var cps = getCurrentPages(); | |
167 | - if (cps.length > 1) { | |
168 | - wx.navigateBack({ delta: 1 }) | |
169 | - } else { | |
170 | - getApp().goto("/pages/index/index/index"); | |
171 | - } | |
172 | - }); | |
173 | - | |
174 | - if(fy) return false; | |
175 | - | |
176 | - util_pay.set_fir(); | |
177 | - | |
178 | - var th = this; | |
179 | - th.data.g_cart_q_time = null; | |
180 | - | |
181 | - if (th.data.isclose == 0) { | |
182 | - wx.navigateTo({ | |
183 | - url: "/pages/index/index/index" | |
184 | - }) | |
185 | - | |
186 | - } else { | |
187 | - this.getuser_addr(function (ie) { | |
188 | - | |
189 | - //th.data.prom_goods_map={}; | |
190 | - //更换地址回来要重新调用计算价钱的接口 | |
191 | - if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) { | |
192 | - th.setData({ user_addr: ie }); | |
193 | - if (th.data.is_b_now == 1) { | |
194 | - if (th.data.bn_goods) { | |
195 | - th.setData({ add_back: 1 }); | |
196 | - th.calculatePrice2(); | |
197 | - } | |
198 | - } | |
199 | - } else { | |
200 | - th.setData({ user_addr: ie }); | |
201 | - } | |
202 | - var going = 0; | |
203 | - | |
204 | - }); | |
205 | - //--更新默认地址--,看一下是不是跳到地址页面 | |
206 | - if (!getApp().globalData.is_cart_old) { | |
207 | - this.update_code(); | |
208 | - } else { | |
209 | - getApp().globalData.is_cart_old = 0; | |
210 | - } | |
211 | - } | |
212 | - | |
213 | - }, | |
214 | - //获取预存款余额 | |
215 | - async getAdvancesum() { | |
216 | - /*-----获取线下会员的预存款和优惠券的数量-----*/ | |
217 | - let url = "/api/weshop/users/getinfo/" + os.stoid + "/" + getApp().globalData.userInfo.user_id | |
218 | - await getApp().request.promiseGet(url, { | |
219 | - data: { | |
220 | - isShowLoading: 0, | |
221 | - }, | |
222 | - }).then(su => { | |
223 | - if (su.data.code == 0 && su.data.data) { | |
224 | - var data = su.data.data; | |
225 | - if (!data) data = {}; | |
226 | - data.cashcount = parseInt(data.cashcount); | |
227 | - this.setData({ | |
228 | - udata: data, | |
229 | - }); | |
230 | - } | |
231 | - }) | |
232 | - | |
233 | - }, | |
234 | - //购物车预存开启关闭 | |
235 | - prestore(e) { | |
236 | - let ind = e.currentTarget.dataset.ind; | |
237 | - let item = e.currentTarget.dataset.item | |
238 | - let txt = 'cartlist[' + ind + '].yck_off'; | |
239 | - let txt1 = 'old_cartlist[' + ind + '].yck_off'; | |
240 | - if (item.yck_off == 2) { | |
241 | - this.setData({ [txt]: 1, [txt1]: 1 }) | |
242 | - } else if (item.yck_off == 1) { | |
243 | - this.setData({ [txt]: 2, [txt1]: 2 }) | |
244 | - } | |
245 | - this.calculatePrice()//计算金额 | |
246 | - }, | |
247 | - //直接购买预存开启关闭 | |
248 | - prestore2() { | |
249 | - let txt = 'bn_goods.yck_off'; | |
250 | - if (this.data.bn_goods.yck_off == 2) { | |
251 | - this.setData({ [txt]: 1 }) | |
252 | - } else if (this.data.bn_goods.yck_off == 1) { | |
253 | - this.setData({ [txt]: 2 }) | |
254 | - } | |
255 | - this.calculatePrice2()//计算金额 | |
256 | - }, | |
257 | - //计算商品预存款前置方法------------------------------------ | |
258 | - async beforAdvancesum(cartList) { | |
259 | - // let cartList= this.data.cartlist | |
260 | - // let cartList= arr | |
261 | - // let length = cartList.length | |
262 | - if(!this.data.is_pre_cut){ | |
263 | - return {} | |
264 | - } | |
265 | - wx.showLoading({ | |
266 | - title: '加载中', | |
267 | - mask: true | |
268 | - }) | |
269 | - // for (let i = 0; i < length; i++) { | |
270 | - let item = cartList; | |
271 | - let goods = item.goods | |
272 | - let keyid = item.sto.keyid | |
273 | - let listform = [] | |
274 | - goods.map(ite => { | |
275 | - let obj = { | |
276 | - wareno: ite.goods_sn, | |
277 | - price: ite.goods_price, | |
278 | - qty: ite.goods_num | |
279 | - } | |
280 | - listform.push(obj) | |
281 | - }) | |
282 | - let arr = await this.getGoodsAdvancesum(keyid, listform, cartList) | |
283 | - // } | |
284 | - wx.hideLoading() | |
285 | - return arr | |
286 | - }, | |
287 | - //计算商品预存款请求方法------------------------------------ | |
288 | - async getGoodsAdvancesum(storageid, listform, cartList) { | |
289 | - if(!getApp().globalData.config){ | |
290 | - await getApp().request.promiseGet("/api/weshop/store/get/" + os.stoid,{ | |
291 | - }).then(res=>{ | |
292 | - if(res.data.code==0){ | |
293 | - getApp().globalData.config = res.data.data | |
294 | - } | |
295 | - }) | |
296 | - } | |
297 | - if(!getApp().globalData.config) return false; | |
298 | - | |
299 | - let res = await getApp().request.promisePost(`/api/weshop/delphiapi/saveErpApi`, { | |
300 | - data: { | |
301 | - accdb: getApp().globalData.config.erpid, | |
302 | - ApiName: 'api.pos.shop.advancesum.seek', | |
303 | - usercode: "admin", | |
304 | - vipid: this.data.userinfo.erpvipid, | |
305 | - oddsum: "0", | |
306 | - advancesum: cartList.order_amount, | |
307 | - storageid: storageid, | |
308 | - listform | |
309 | - }, | |
310 | - is_json: 1 | |
311 | - }) | |
312 | - console.log('计算商品的预存款'); | |
313 | - console.log(res); | |
314 | - let yck = 0 | |
315 | - let yckid = "" | |
316 | - let yckIdArr = [] | |
317 | - let pre_json = null | |
318 | - if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | |
319 | - let resData = res.data.data | |
320 | - resData.map(ite => { | |
321 | - yck += ite.advancesum*1 | |
322 | - yckIdArr.push(ite.advanceitemid) | |
323 | - }) | |
324 | - pre_json = resData | |
325 | - } | |
326 | - yckid = yckIdArr.join() | |
327 | - let obj = {} | |
328 | - if (yck * 1 > 0) { | |
329 | - obj.yck_off = 1 | |
330 | - } else { | |
331 | - obj.yck_off = 0 | |
332 | - } | |
333 | - obj.yck = yck.toFixed(2) | |
334 | - obj.yckid = yckid | |
335 | - obj.pre_json = pre_json | |
336 | - return obj | |
337 | - }, | |
338 | - //-------------------获取物流--------------- | |
339 | - get_wuliu(func) { | |
340 | - var th = this; | |
341 | - to.getwuliu(function (e) { | |
342 | - if (th.data.is_default_logistics) { | |
343 | - //如果第一个不是开启默认,说明要让用户自己选 | |
344 | - if (!e[0].is_default) { | |
345 | - th.setData({ is_default_logistics: 0 }); | |
346 | - } | |
347 | - } | |
348 | - th.setData({ wu_arr: e }) | |
349 | - typeof func == "function" && func(); | |
350 | - }) | |
351 | - }, | |
352 | - //------获取会员信息-----先获取用户信息,在进行下一步--- | |
353 | - get_info: function (func) { | |
354 | - var user_id = t.globalData.user_id; | |
355 | - to.auth.get_u(func); | |
356 | - }, | |
357 | - | |
358 | - //------获取会员收货地址----- | |
359 | - getuser_addr: function (func) { | |
360 | - var th = this; | |
361 | - a.get("/api/weshop/useraddress/page", { | |
362 | - data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600, t: Math.random() }, | |
363 | - success: function (su) { | |
364 | - | |
365 | - var item = null; | |
366 | - if (su.data.code == 0 && su.data.data && su.data.data.pageData) { | |
367 | - var user_addr = su.data.data.pageData; | |
368 | - var def_item = null; | |
369 | - for (var i = 0; i < user_addr.length; i++) { | |
370 | - if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; } | |
371 | - if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; } | |
372 | - } | |
373 | - | |
374 | - if (item == null) item = def_item; | |
375 | - if (item == null) item = user_addr[0]; | |
376 | - } | |
377 | - | |
378 | - if (item == undefined) item = null; | |
379 | - if (!item) th.setData({ user_addr: null }); //地址为空的时候,要清空,因为返回的时候,有缓存 | |
380 | - func(item); | |
381 | - } | |
382 | - }); | |
383 | - }, | |
384 | - | |
385 | - //----------------展示页面,是再获取用户信息之后-------------- | |
386 | - show_page:async function () { | |
387 | - var th = this, ta = this.data.param; | |
388 | - //th.setData({ userinfo: getApp().globalData.userInfo,}); | |
389 | - //获取用户预存款 | |
390 | - await th.getAdvancesum() | |
391 | - | |
392 | - var user = getApp().globalData.userInfo; | |
393 | - getApp().request.get("/api/weshop/users/get/" + oo.stoid + "/" + user.user_id, { | |
394 | - data: { r: Math.random() }, | |
395 | - success: function (e) { | |
396 | - | |
397 | - getApp().globalData.userInfo = e.data.data; | |
398 | - th.setData({ userinfo: e.data.data }); | |
399 | - | |
400 | - //选获取地址 | |
401 | - th.getuser_addr(function (addr) { | |
402 | - th.setData({ user_addr: addr }); | |
403 | - //--------------------------立即购买------------------ | |
404 | - if (ta.is_bnow == 1) { | |
405 | - //读取门店 | |
406 | - to.get_allsto(function (e) { | |
407 | - th.setData({ allsto: e }); | |
408 | - //获取立即购买的商品信息 | |
409 | - th.get_buy_goods(ta.goods_id); | |
410 | - }); | |
411 | - } | |
412 | - }); | |
413 | - //获取提现金额 | |
414 | - getApp().request.get("/api/weshop/withdrawals/summoney", { | |
415 | - data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 }, | |
416 | - success: function (su) { | |
417 | - if (su.data.code == 0) { | |
418 | - var yuer = parseFloat(th.data.userinfo.user_money - | |
419 | - (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2); | |
420 | - th.setData({ txmon: su.data.data.summoney, yuer: yuer }); | |
421 | - } | |
422 | - } | |
423 | - }); | |
424 | - | |
425 | - }, | |
426 | - }) | |
427 | - | |
428 | - | |
429 | - }, | |
430 | - | |
431 | - //-----获取立即购买的商品信息,入口---- | |
432 | - get_buy_goods: function (e) { | |
433 | - var th = this; | |
434 | - var gg = to.get_b_now(); | |
435 | - //--------如果goods_id一样,就是要立即购买----- | |
436 | - if (e == gg.goods_id) { | |
437 | - a.get("/api/weshop/goods/get/" + oo.stoid + "/" + e, { | |
438 | - success: async function (t) { | |
439 | - var gd = t.data.data; | |
440 | - if (!gd) return false; | |
441 | - | |
442 | - //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- | |
443 | - if(gd.is_same_city && th.data.is_same_city && gd.whsle_id<=0){ | |
444 | - | |
445 | - await getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+gg.pick_id, {}).then(res=>{ | |
446 | - if(res.data.code==0){ | |
447 | - var pk=res.data.data; | |
448 | - if(pk && pk.is_same_city){ | |
449 | - th.setData({show_same_city:1}) | |
450 | - } | |
451 | - } | |
452 | - | |
453 | - }) | |
454 | - | |
455 | - } | |
456 | - | |
457 | - | |
458 | - t.data.data.original_img = oo.imghost + t.data.data.original_img; | |
459 | - t.data.data['buynum'] = gg.goods_num; | |
460 | - var distr_t = 0, et = 0 | |
461 | - | |
462 | - if(t.data.data.is_minishop==1 && getApp().is_sp_hao()){ | |
463 | - | |
464 | - if(t.data.data.distr_type==1 || gg.pick_dis==1) { | |
465 | - wx.showToast({ | |
466 | - title: "视频号仅支持物流", | |
467 | - icon: 'none', | |
468 | - duration: 2000 | |
469 | - }) | |
470 | - | |
471 | - setTimeout(function(){ | |
472 | - wx.navigateBack({delta: 1}) | |
473 | - },1000) | |
474 | - | |
475 | - | |
476 | - return false | |
477 | - } | |
478 | - | |
479 | - t.data.data.distr_type=2; | |
480 | - th.setData({show_same_city:0}) | |
481 | - | |
482 | - } | |
483 | - | |
484 | - if (t.data.data.distr_type == 0) { | |
485 | - distr_t = gg.pick_dis; | |
486 | - } else { | |
487 | - distr_t = t.data.data.distr_type; | |
488 | - } | |
489 | - switch (distr_t) { | |
490 | - case 0: | |
491 | - et = 1; | |
492 | - //-- 系统后台有设置要默认的 -- | |
493 | - if (th.data.json_d.pickupway && th.data.json_d.pickupway == 1) et = 0; | |
494 | - break; | |
495 | - case 1: et = 1; break; | |
496 | - case 2: et = 0; break; | |
497 | - } | |
498 | - | |
499 | - if (th.data.bn_goods) et = th.data.bn_exp_type | |
500 | - | |
501 | - var m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; | |
502 | - if (et == 0 && def_exp_code && !th.data.is_default_logistics) { | |
503 | - for (var k = 0; k < th.data.wu_arr.length; k++) { | |
504 | - var item = th.data.wu_arr[k]; if (def_exp_code == item.code) { m_wind = k; } | |
505 | - } | |
506 | - } | |
507 | - | |
508 | - //---是不是购买等级卡成功的返回---等级卡显示的判断--- | |
509 | - var is_card_back = getApp().globalData.is_card_back; | |
510 | - if (is_card_back) { | |
511 | - th.data.card_name = th.data.userinfo.card_field; | |
512 | - gg.goods_price = gd[th.data.card_name]; | |
513 | - getApp().globalData.is_card_back = 0; | |
514 | - th.setData({ card_cut_price: 0 }); | |
515 | - //如果是秒杀的返回 | |
516 | - if (gd.prom_type == 4) gd.prom_type = 0; | |
517 | - } else { | |
518 | - //--- 商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格 | |
519 | - //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 -- | |
520 | - 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) { | |
521 | - var cut_p = (gg.goods_price - gd[th.data.card_name]) * gg.goods_num; | |
522 | - th.setData({ card_cut_price: cut_p }); | |
523 | - } | |
524 | - } | |
525 | - | |
526 | - | |
527 | - if(gg.prom_type==4){ | |
528 | - gd.prom_type =4; | |
529 | - gd.prom_id = gg.prom_id; | |
530 | - } | |
531 | - | |
532 | - switch (gd.prom_type) { | |
533 | - case 0: | |
534 | - case 2: | |
535 | - case 3: | |
536 | - case 5: | |
537 | - case 6: | |
538 | - getApp().my_warnning("商品不是积分活动", 0, th); | |
539 | - wx.navigateBack(); | |
540 | - break; | |
541 | - case 4: //-- 积分购 -- | |
542 | - getApp().request.get("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1&timetype=2", { | |
543 | - data: { store_id: os.stoid, goods_id: gg.goods_id, user_id: to.globalData.user_id, }, | |
544 | - success: async function (tt) { | |
545 | - if (tt.data.code == 0 && tt.data.data && tt.data.data.pageData) { | |
546 | - var inte_data = tt.data.data.pageData[0]; | |
547 | - t.data.data.shop_price = inte_data.addmoney; | |
548 | - t.data.data.integral = inte_data.integral; | |
549 | - | |
550 | - //-- 计算获得佣金的金额 -- | |
551 | - if (getApp().globalData.userInfo.is_distribut | |
552 | - && th.data.dis_config && th.data.dis_config.is_yongjin_dk) { | |
553 | - var c_num = getApp().get_commission2(th.data.dis_config,inte_data, gg.goods_num); | |
554 | - t.data.data.use_commission = c_num; | |
555 | - | |
556 | - } | |
557 | - | |
558 | - | |
559 | - if (inte_data.is_order_yh) { | |
560 | - th.data.bn_is_order_yh = 1; | |
561 | - } else { | |
562 | - th.data.bn_is_order_yh = 0; | |
563 | - } | |
564 | - | |
565 | - if (inte_data.is_post_temp) { | |
566 | - th.data.bn_is_post_temp = 1; | |
567 | - } else { | |
568 | - th.data.bn_is_post_temp = 0; | |
569 | - } | |
570 | - | |
571 | - | |
572 | - | |
573 | - th.setData({ | |
574 | - bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et, index: m_wind, | |
575 | - bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et,inv_is_post:inte_data.is_post | |
576 | - }); | |
577 | - //计算价格 | |
578 | - th.calculatePrice2(); | |
579 | - } else { | |
580 | - getApp().my_warnning("商品不是积分活动", 0, th); | |
581 | - wx.navigateBack(); | |
582 | - } | |
583 | - } | |
584 | - }); | |
585 | - break; | |
586 | - } | |
587 | - }, | |
588 | - }); | |
589 | - } | |
590 | - }, | |
591 | - | |
592 | - //---------------检查是否有收货地址------------------- | |
593 | - checkAddressList: function () { | |
594 | - var t = this; | |
595 | - return !(!this.data.order || null == this.data.order.userAddress) || (wx.showModal({ | |
596 | - title: "请先填写或选择收货地址~", | |
597 | - success: function (a) { | |
598 | - a.confirm ? t.enterAddressPage() : wx.navigateBack(); | |
599 | - }, | |
600 | - fail: function () { | |
601 | - wx.navigateBack(); | |
602 | - } | |
603 | - }), !1); | |
604 | - }, | |
605 | - showInvoice: function () { | |
606 | - this.setData({ | |
607 | - invoiceToggle: !this.data.invoiceToggle | |
608 | - }); | |
609 | - }, | |
610 | - keyUpChangePay1: function (t) { | |
611 | - this.setData({ | |
612 | - payWithUserMoney: !(t.detail.value.length > 0) | |
613 | - }); | |
614 | - }, | |
615 | - keyUpChangePay2: function (t) { | |
616 | - this.setData({ | |
617 | - payWithPoints: !(t.detail.value.length > 0) | |
618 | - }); | |
619 | - }, | |
620 | - keyUpChangeNum: function (t) { | |
621 | - this.setData({ | |
622 | - maxWord: t.detail.value.length | |
623 | - }); | |
624 | - }, | |
625 | - | |
626 | - | |
627 | - //---------计算立即购买---------- | |
628 | - //---------计算立即购买---------- | |
629 | - calculatePrice2:async function () { | |
630 | - var th = this, good = this.data.bn_goods; | |
631 | - | |
632 | - this.setData({submit:1}) | |
633 | - wx.showLoading({ title: "处理中.", mask:true }) | |
634 | - //-----------计算商品总价-------------- | |
635 | - var allpice = good.shop_price * good.buynum; | |
636 | - var all_integral = good.integral * good.buynum; | |
637 | - | |
638 | - var cut_price = 0; | |
639 | - if (good.prom_type == 3 && good.prom_price !== null) { | |
640 | - cut_price = allpice - good.prom_price; | |
641 | - } | |
642 | - allpice = parseFloat(allpice).toFixed(2); | |
643 | - | |
644 | - var txt = "formData.all_price"; | |
645 | - th.setData({ [txt]: allpice, }); | |
646 | - if (cut_price) { | |
647 | - var c_txt = "formData.cut_price"; | |
648 | - th.setData({ [c_txt]: cut_price, }); | |
649 | - } | |
650 | - | |
651 | - | |
652 | - //-- 把订单优惠的判断提前,bn_is_order_yh是确定要不要订单优惠的控制 -- | |
653 | - var condition = parseFloat(allpice-cut_price).toFixed(2); | |
654 | - var ord_prom = null; | |
655 | - var is_ord_prom_post = 0; | |
656 | - | |
657 | - if (condition > 0 && th.data.bn_is_order_yh && !th.data.bn_goods.whsle_id) { | |
658 | - await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { | |
659 | - data: { store_id: os.stoid, orderAmount: condition, user_id: getApp().globalData.user_id } | |
660 | - }).then(res => { | |
661 | - if (res.data.code == 0) { | |
662 | - var data = res.data.data; | |
663 | - ord_prom = data; | |
664 | - } | |
665 | - }) | |
666 | - if (ord_prom && ord_prom.is_post_temp) { | |
667 | - is_ord_prom_post = 1; | |
668 | - } | |
669 | - } | |
670 | - | |
671 | - | |
672 | - | |
673 | - //to.getwuliuprice(async function (rs) { | |
674 | - | |
675 | - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | |
676 | - var out_of_weight = null; //超出多少重量 | |
677 | - | |
678 | - //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- | |
679 | - if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past != 1 && !th.data.inv_is_post) { | |
680 | 3 | |
681 | - var user_addr=th.data.user_addr; | |
682 | - var req_d = { | |
683 | - province: user_addr.province, city: user_addr.city, district: user_addr.district, | |
684 | - wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid | |
685 | - } | |
686 | - var back_data = null; | |
687 | - //判断是不是包邮模板,bn_is_post_temp 和 订单优惠的包邮模板一起控制 | |
688 | - if (th.data.bn_is_post_temp && (!ord_prom || is_ord_prom_post)) { | |
689 | - await getApp().request.promisePost("/api/weshop/order/areaFreight", { | |
690 | - is_json: 1, data: req_d | |
691 | - }).then(rs => { | |
692 | - if (rs.data.code == 0) back_data = rs.data.data; | |
693 | - }); | |
694 | - } | |
695 | - | |
696 | - var gd_arr_list = []; | |
697 | - gd_arr_list.push(good); | |
698 | - var cut_good_weight = 0; | |
699 | - for (let i in gd_arr_list) { | |
700 | - let item = gd_arr_list[i]; | |
701 | - | |
702 | - if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1) ) { | |
703 | - | |
704 | - if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) { | |
705 | - if (goods_weight < 0) goods_weight = 0; | |
706 | - goods_weight += item['weight'] * item['buynum']; | |
707 | - cut_good_weight += item['weight'] * item['buynum']; | |
708 | - } | |
709 | - if (back_data.weight_free > 0) { | |
710 | - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | |
711 | - } | |
712 | - continue; | |
713 | - } | |
714 | - | |
715 | - switch (item['exp_sum_type']) { | |
716 | - case 1: | |
717 | - //统一运费 | |
718 | - o_shipping_price += item['uniform_exp_sum']; | |
719 | - break; | |
720 | - case 2: | |
721 | - if (goods_weight < 0) goods_weight = 0; | |
722 | - //累积商品重量 每种商品的重量 * 数量 | |
723 | - goods_weight += item['weight'] * item['buynum']; | |
724 | - | |
725 | - if (back_data && back_data.is_by_all && !back_data.no_free_goods) { | |
726 | - cut_good_weight += item['weight'] * item['buynum']; | |
727 | - if (back_data.weight_free > 0) { | |
728 | - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; | |
729 | - } | |
730 | - } | |
731 | - break; | |
732 | - case 3: | |
733 | - if (goods_piece < 0) goods_piece = 0; | |
734 | - //累积商品数量 | |
735 | - goods_piece += item['buynum']; | |
736 | - break; | |
737 | - } | |
738 | - } | |
739 | - | |
740 | - //如果是正值的时候 | |
741 | - if (out_of_weight >= 0) out_of_weight = -cut_good_weight; | |
742 | - else out_of_weight = -back_data.weight_free * 1000; | |
743 | - | |
744 | - var code = ""; | |
745 | - if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; | |
746 | - //--------------开始计算物流------------------ | |
747 | - var shipping_price=0; | |
748 | - // var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
749 | - // goods_piece, th.data.user_addr, back_data, rs); | |
750 | - | |
751 | - var w_data={ | |
752 | - store_id:os.stoid, code:code, | |
753 | - o_shipping_price:o_shipping_price, | |
754 | - goods_weight:goods_weight, | |
755 | - out_of_weight:out_of_weight,goods_piece:goods_piece, | |
756 | - user_addr_province:th.data.user_addr.province, | |
757 | - user_addr_city:th.data.user_addr.city, | |
758 | - user_addr_district:th.data.user_addr.district, | |
759 | - is_by_all:back_data && back_data.is_by_all?1:0, | |
760 | - no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0, | |
761 | - } | |
762 | - | |
763 | - var is_ok=0; | |
764 | - await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{ | |
765 | - if(res.data.code==0){ | |
766 | - shipping_price=res.data.data; is_ok=1; | |
767 | - } | |
768 | - }) | |
769 | - | |
770 | - if(!is_ok){ | |
771 | - wx.hideLoading(); | |
772 | - wx.showToast({ | |
773 | - title: "计算物流错误", icon: 'none',duration: 2000 | |
774 | - }) | |
775 | - | |
776 | - return false; | |
777 | - } | |
778 | - | |
779 | - | |
780 | - if (shipping_price <= 0) { | |
781 | - th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券 | |
782 | - } | |
783 | - | |
784 | - shipping_price = parseFloat(shipping_price).toFixed(2); | |
785 | - var wl_txt = "formData.shipping_price"; | |
786 | - th.setData({ [wl_txt]: shipping_price, }) | |
787 | - | |
788 | - } else if(th.data.bn_exp_type == 1 ) { | |
789 | - var wl_txt = "formData.shipping_price"; | |
790 | - th.setData({ [wl_txt]: 0, }) | |
791 | - } | |
792 | - //---如果有选择优惠券的情况下--- | |
793 | - var quan_price = 0, bn_pick = th.data.bn_pick; | |
794 | - | |
795 | - //-----------------支付价,优惠券不减物流----------------- | |
796 | - var total_m = (parseFloat(allpice)).toFixed(2); | |
797 | - var order_m = (parseFloat(allpice - cut_price) - quan_price).toFixed(2); | |
798 | - var coupon_price = quan_price; //优惠券优惠了多少钱 | |
799 | - if (order_m < 0) { | |
800 | - order_m = 0; coupon_price = parseFloat(order_m).toFixed(2); | |
801 | - } | |
802 | - | |
803 | - //--看一下有没有订单优惠-- | |
804 | - var o_condition = parseFloat(order_m); | |
805 | - if (th.data.bn_goods.whsle_id > 0) { | |
806 | - o_condition = 0; | |
807 | - } | |
808 | - | |
809 | - var order_prom_amount = 0; | |
810 | - var order_prom_id = 0; | |
811 | - if (ord_prom && o_condition > 0) { | |
812 | - //么有使用券,或者活动没有限制使用优惠券 | |
813 | - if (coupon_price <= 0 || !ord_prom.is_xz_yh) { | |
814 | - order_prom_id = ord_prom['id']; | |
815 | - switch (ord_prom['type']) { | |
816 | - case 0: | |
817 | - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 | |
818 | - order_prom_amount = (o_condition - order_m).toFixed(2); | |
819 | - break; | |
820 | - case 1: | |
821 | - //-- 如果有优惠促销倍减的时候 -- | |
822 | - var bs = 1; | |
823 | - if (ord_prom.is_bz) { | |
824 | - bs = Math.floor(o_condition / ord_prom.money); | |
825 | - } | |
826 | - | |
827 | - order_m = o_condition - bs * ord_prom['expression'];//满额优惠金额 | |
828 | - order_prom_amount = ord_prom['expression']; | |
829 | - break; | |
830 | - } | |
831 | - } | |
832 | - } | |
833 | - //--订单优惠的显示-- | |
834 | - var order_prom_txt1 = "formData.order_prom_id"; | |
835 | - var order_prom_txt2 = "formData.order_prom_amount"; | |
836 | - if (order_prom_id > 0) { | |
837 | - th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount }) | |
838 | - } else { | |
839 | - th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 }) | |
840 | - } | |
841 | - | |
842 | - | |
843 | - | |
844 | - //预存金额使用参与计算 | |
845 | - if (th.data.udata && th.data.udata.Balance > 0 && order_m * 1 > 0) { | |
846 | - if (!th.data.bn_goods.keyid) { | |
847 | - //获取门店信息 | |
848 | - await getApp().request.promiseGet("/api/weshop/pickup/list", { | |
849 | - data: { | |
850 | - store_id: os.stoid, | |
851 | - ids: th.data.bn_pick | |
852 | - } | |
853 | - }).then(res => { | |
854 | - if (ut.ajax_ok(res)) { | |
855 | - console.log(res); | |
856 | - if (res.data.code == 0) { | |
857 | - let resData = res.data.data.pageData | |
858 | - if (resData && resData[0]) { | |
859 | - let keyid = resData[0].keyid | |
860 | - let txt = 'bn_goods.keyid' | |
861 | - th.setData({ | |
862 | - [txt]: keyid | |
863 | - }) | |
864 | - } | |
865 | - } | |
866 | - } | |
867 | - }) | |
868 | - } | |
869 | - if (th.data.bn_goods.keyid) { | |
870 | - let cart_yc = await th.beforAdvancesum({ | |
871 | - order_amount: order_m, | |
872 | - goods: [{ | |
873 | - goods_sn: th.data.bn_goods.goods_sn, | |
874 | - goods_price: th.data.bn_goods.shop_price || th.data.bn_goods.goods_price, | |
875 | - goods_num: th.data.bn_goods.buynum || th.data.bn_goods.goods_num, | |
876 | - }], | |
877 | - sto: { | |
878 | - keyid: th.data.bn_goods.keyid | |
879 | - } | |
880 | - }) | |
881 | - | |
882 | - if (!good.yck_off) { | |
883 | - good.yck_off = cart_yc.yck_off | |
884 | - } | |
885 | - good.yck = cart_yc.yck | |
886 | - good.yckid = cart_yc.yckid | |
887 | - good.pre_json = cart_yc.pre_json | |
888 | - let yct1 = 'bn_goods.yck_off'; | |
889 | - let yct2 = 'bn_goods.yck'; | |
890 | - let yct3 = 'bn_goods.yckid'; | |
891 | - let yct4 = 'bn_goods.pre_json'; | |
892 | - th.setData({ | |
893 | - [yct1]: good.yck_off, | |
894 | - [yct2]: good.yck, | |
895 | - [yct3]: good.yckid, | |
896 | - [yct4]: good.pre_json, | |
897 | - }) | |
898 | - | |
899 | - if (good.yck_off && good.yck_off == 2) { | |
900 | - let order_amount = (order_m - good.yck).toFixed(2); | |
901 | - let yck = 0 | |
902 | - if (order_amount * 1 > 0) { | |
903 | - order_m = order_amount; | |
904 | - // all_prestore+=parseFloat(good.yck); | |
905 | - yck = parseFloat(good.yck) | |
906 | - } else { | |
907 | - // all_prestore+=order_m*1 | |
908 | - yck = parseFloat(order_m) | |
909 | - order_m = 0 | |
910 | - } | |
911 | - let atxt10 = "formData.prestore"; //预存金额 | |
912 | - let atxt11 = "formData.pre_json"; //预存json | |
913 | - let atxt12 = "formData.all_yck_arr"; //预存真实抵扣列表 | |
914 | - th.setData({ | |
915 | - [atxt10]: yck, | |
916 | - [atxt11]: [good.pre_json], | |
917 | - [atxt12]: [yck], | |
918 | - }) | |
919 | - // formData.prestore | |
920 | - // all_yck_arr.push(yck) //真实预存款抵扣金额 | |
921 | - // all_pre_json.push(good.pre_json) | |
922 | - // all_prestore = parseFloat(all_prestore); //真实预存款抵扣金额总和 | |
923 | - } | |
924 | - } | |
925 | - } else { | |
926 | - let yct1 = 'bn_goods.yck_off'; | |
927 | - let yct2 = 'bn_goods.yck'; | |
928 | - let yct3 = 'bn_goods.yckid'; | |
929 | - let yct4 = 'bn_goods.pre_json'; | |
930 | - let atxt10 = "formData.prestore"; //预存金额 | |
931 | - let atxt11 = "formData.pre_json"; //预存json | |
932 | - let atxt12 = "formData.all_yck_arr"; //预存真实抵扣列表 | |
933 | - th.setData({ | |
934 | - [yct2]: 0, | |
935 | - [yct3]: '', | |
936 | - [yct4]: '', | |
937 | - [atxt10]: 0, | |
938 | - [atxt11]: '', | |
939 | - [atxt12]: [], | |
940 | - }) | |
941 | - } | |
942 | - | |
943 | - //判断是否同城配送,而且没有调用过 | |
944 | - if(th.data.bn_exp_type==2 && th.data.user_addr) { | |
945 | - | |
946 | - var lon=0;var lat=0; | |
947 | - //-- 获取距离 -- | |
948 | - await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { | |
949 | - is_json: 1, data: {address:th.data.user_addr.more_address+th.data.user_addr.address} | |
950 | - }).then(res=>{ | |
951 | - if(res.data.code==0){ | |
952 | - var data= JSON.parse(res.data.data); | |
953 | - if(data.status==0){ | |
954 | - lon=data.result.location.lng; | |
955 | - lat=data.result.location.lat; | |
956 | - } | |
957 | - } | |
958 | - }) | |
959 | - | |
960 | - | |
961 | - var gd_w = good['weight'] * good['buynum']; | |
962 | - //-- 获取距离 -- | |
963 | - var req_data = { | |
964 | - store_id: os.stoid, | |
965 | - order_amount: order_m, | |
966 | - lon: lon, lat: lat, | |
967 | - pickup_id: bn_pick, | |
968 | - goods_weight: gd_w | |
969 | - } | |
970 | - | |
971 | - var is_next=1; | |
972 | - //获取同城配送参数 | |
973 | - await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", { | |
974 | - is_json: 1, | |
975 | - data: req_data | |
976 | - }).then(res => { | |
977 | - if (res.data.code == 0) { | |
978 | - var wl_txt = "formData.shipping_price"; | |
979 | - th.setData({ [wl_txt]: res.data.data, }) | |
980 | - }else{ | |
981 | - is_next=0; | |
982 | - wx.showToast({ | |
983 | - title: res.data.msg, icon: 'none', duration: 2000 | |
984 | - }) | |
985 | - } | |
986 | - }) | |
987 | - if(!is_next) return false | |
988 | - } | |
989 | - | |
990 | - | |
991 | - | |
992 | - //--看一下有没有订单优惠--0 | |
993 | - total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); | |
994 | - order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price); | |
995 | - var atxt = "formData.total_amount"; | |
996 | - th.setData({ [atxt]: total_m, }) | |
997 | - | |
998 | - var txt = "formData.user_money"; | |
999 | - var txt2 = "formData.order_amount"; | |
1000 | - var txt4 = "formData.integral"; | |
1001 | - | |
1002 | - | |
1003 | - //-- 最后的金额小于佣金 -- | |
1004 | - if(parseFloat(order_m)<parseFloat(th.data.bn_goods.use_commission)){ | |
1005 | - | |
1006 | - if(th.data.bn_use_commission){ | |
1007 | - wx.showToast({ | |
1008 | - title: '应付金额小于本单佣金,不可使用!', | |
1009 | - icon: 'none', | |
1010 | - duration: 2000 | |
1011 | - }) | |
1012 | - } | |
1013 | - | |
1014 | - th.setData({ | |
1015 | - cart_use_commission:0 | |
1016 | - }); | |
1017 | - | |
1018 | - } | |
1019 | - | |
1020 | - | |
1021 | - var txt5 = "formData.use_commission"; | |
1022 | - if(th.data.bn_use_commission){ | |
1023 | - order_m=(parseFloat(order_m)- parseFloat(th.data.bn_goods.use_commission)).toFixed(2); | |
1024 | - th.setData({[txt5]:th.data.bn_goods.use_commission}) | |
1025 | - } | |
1026 | - | |
1027 | - var amoney = parseFloat(th.data.userinfo.user_money - th.data.txmon - th.data.userinfo.frozen_money); | |
1028 | - //--------------如果使用余额--------------------- | |
1029 | - if (th.data.bn_use_money == 1) { | |
1030 | - if (amoney > parseFloat(order_m)) { | |
1031 | - order_m = parseFloat(order_m).toFixed(2); | |
1032 | - th.setData({ [txt]: order_m, [txt2]: 0, [txt4]: all_integral, show_submit: 1,submit:0 }) | |
1033 | - } else { | |
1034 | - order_m = parseFloat(order_m - amoney); | |
1035 | - order_m = order_m.toFixed(2); | |
1036 | - th.setData({ [txt]: amoney, [txt2]: order_m, [txt4]: all_integral, show_submit: 1,submit:0 }) | |
1037 | - } | |
1038 | - } else { | |
1039 | - th.setData({ [txt]: 0, [txt2]: order_m, [txt4]: all_integral, show_submit: 1,submit:0}) | |
1040 | - } | |
1041 | - wx.hideLoading(); | |
1042 | - | |
1043 | - //}); | |
1044 | - | |
1045 | - }, | |
1046 | - | |
1047 | - //--------------------提交订单----------------------- | |
1048 | - async submitForm(t) { | |
1049 | - var sub_value = t; | |
1050 | - this.setData({submit:1}) | |
1051 | - | |
1052 | - if (this.data.is_summit_ing == 1) return false; //--提交中退出-- | |
1053 | - this.data.is_summit_ing = 1; | |
1054 | - var th = this, pdata = new Array(); | |
1055 | - var ff = true; | |
1056 | - //------------立即购买------------- | |
1057 | - if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { | |
1058 | - | |
1059 | - if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { | |
1060 | - ff = false; getApp().my_warnning("请选择收货地址", 0, th); | |
1061 | - th.data.is_summit_ing = 0; | |
1062 | - } | |
1063 | - if (!ff) return false; | |
1064 | - var addr = th.data.user_addr; | |
1065 | - if (th.data.bn_exp_type == 1) addr = null; | |
1066 | - | |
1067 | - if (th.data.bn_exp_type == 0) | |
1068 | - if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) { | |
1069 | - getApp().my_warnning("读取物流失败", 0, th); | |
1070 | - th.data.is_summit_ing = 0; | |
1071 | - return false; | |
1072 | - } | |
1073 | - | |
1074 | - | |
1075 | - var integrals = 0; | |
1076 | - var get_datas = { | |
1077 | - user_id: getApp().globalData.user_id, store_id: o.stoid, | |
1078 | - }; | |
1079 | - await getApp().request.promiseGet("/api/weshop/users/getAllPoints", { | |
1080 | - data: get_datas | |
1081 | - }).then(res => { | |
1082 | - if (res.data.code == 0) { | |
1083 | - integrals = res.data.data.Integral; | |
1084 | - } | |
1085 | - }) | |
1086 | - | |
1087 | - //判断积分的情况 | |
1088 | - if (th.data.formData.integral && parseFloat(th.data.formData.integral) < parseFloat(integrals)) { | |
1089 | - getApp().my_warnning("积分不足", 0, th); | |
1090 | - th.data.is_summit_ing = 0; | |
1091 | - return false; | |
1092 | - } | |
1093 | - | |
1094 | - | |
1095 | - var item = { | |
1096 | - 'user_id': to.globalData.user_id, | |
1097 | - 'consignee': addr == null ? "" : addr.consignee, | |
1098 | - 'province': addr == null ? 0 : addr.province, | |
1099 | - 'city': addr == null ? 0 : addr.city, | |
1100 | - 'district': addr == null ? 0 : addr.district, | |
1101 | - 'twon': addr == null ? 0 : addr.twon, | |
1102 | - 'address': addr == null ? "" : addr.address, | |
1103 | - 'more_address': addr == null ? "" : addr.more_address, | |
1104 | - //'mobile': th.data.userinfo.mobile, | |
1105 | - 'mobile': addr == null ? th.data.userinfo.mobile : addr.mobile, | |
1106 | - 'email': '', | |
1107 | - 'shipping_code': th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code, | |
1108 | - 'shipping_name': th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name, | |
1109 | - 'invoice_title': '', | |
1110 | - 'goods_price': th.data.formData.all_price, //商品总价 | |
1111 | - 'shipping_price': th.data.formData.shipping_price, //物流金额 | |
1112 | - 'user_money': th.data.formData.user_money, //使用余额 | |
1113 | - 'total_amount': th.data.formData.total_amount, //订单总价 | |
1114 | - 'order_amount': th.data.formData.order_amount, //应付 | |
1115 | - 'user_note': t.detail.value.user_note, //用户备注 | |
1116 | - 'store_id': oo.stoid, //商家 | |
1117 | - 'pickup_id': th.data.bn_pick, //门店 | |
1118 | - 'exp_type': th.data.bn_exp_type, //配送方式 | |
1119 | - 'order_goods': new Array(), | |
1120 | - 'integral': th.data.formData.integral, | |
1121 | - }; | |
1122 | - //是不是重新提交 | |
1123 | - if (th.data.is_continue == 1) item.is_continue = 1; | |
1124 | - | |
1125 | - //-- 如果有使用佣金抵扣的话 -- | |
1126 | - if(th.data.bn_use_commission){ | |
1127 | - item.use_commission=th.data.bn_goods.use_commission; | |
1128 | - } | |
1129 | - var order_prom_list = {}; | |
1130 | - //--判断有没有优惠活动-- | |
1131 | - if (th.data.formData.order_prom_amount > 0) { | |
1132 | - order_prom_list.order_prom_id = th.data.formData.order_prom_id; | |
1133 | - order_prom_list.order_prom_amount = th.data.formData.order_prom_amount; | |
1134 | - } | |
1135 | - item.order_prom_list = order_prom_list; | |
1136 | - | |
1137 | - | |
1138 | - //获取立即购买的商品的信息 | |
1139 | - var gg = to.get_b_now(); | |
1140 | - //--商品的房间号-- | |
1141 | - if (gg.room_id && gg.room_id > 0) { | |
1142 | - item.room_ids = gg.room_id; | |
1143 | - } | |
1144 | - if(gg.groupchat_id && gg.groupchat_id!='undefined'){ | |
1145 | - item.groupchat_ids=gg.groupchat_id | |
1146 | - } | |
1147 | - | |
1148 | - //老会员成为分销下线需要的参数 | |
1149 | - if (getApp().globalData.first_leader && !getApp().globalData.userInfo.first_leader) { | |
1150 | - //判断一下分享人是不是分享商 | |
1151 | - await app.request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.first_leader, {}).then(res => { | |
1152 | - if (res.data.code == 0) { | |
1153 | - var user = res.data.data; | |
1154 | - if (user.is_distribut == 1) { | |
1155 | - item.first_leader = parseInt(getApp().globalData.first_leader); | |
1156 | - } | |
1157 | - } | |
1158 | - }) | |
1159 | - } | |
1160 | - | |
1161 | - | |
1162 | - var goods = { | |
1163 | - 'goods_id': gg.goods_id, | |
1164 | - 'goods_name': gg.goods_name, | |
1165 | - 'goods_sn': gg.goods_sn, | |
1166 | - 'goods_num': gg.goods_num, | |
1167 | - 'market_price': th.data.bn_goods.market_price, | |
1168 | - 'goods_price': th.data.bn_goods.shop_price, | |
1169 | - 'member_goods_price': th.data.bn_goods.shop_price, | |
1170 | - 'store_id': oo.stoid, | |
1171 | - 'prom_type': th.data.bn_goods.prom_type, //促销活动类型 | |
1172 | - 'prom_id': th.data.bn_goods.prom_id, //促销活动id | |
1173 | - }; | |
1174 | - | |
1175 | - if(getApp().globalData.skinface_id){ | |
1176 | - goods.skinface_id=getApp().globalData.skinface_id; | |
1177 | - } | |
1178 | - | |
1179 | - if(th.data.bn_goods.whsle_id){ | |
1180 | - item.is_whsle=1; | |
1181 | - goods.is_whsle_goods=1; | |
1182 | - } | |
1183 | - | |
1184 | - | |
1185 | - //-- 把导购的信息填入-- | |
1186 | - if (gg.guide_id) { | |
1187 | - goods.guide_id = gg.guide_id; | |
1188 | - goods.guide_type = gg.guide_type; | |
1189 | - //调用接口判断是不是会员 | |
1190 | - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { | |
1191 | - if (res.data.code == 0) { | |
1192 | - goods.guide_name = res.data.data.salesman; | |
1193 | - goods.guide_sn = res.data.data.salesman_no; | |
1194 | - } | |
1195 | - }) | |
1196 | - } | |
1197 | - if(gg.groupchat_id && gg.groupchat_id!='undefined'){ | |
1198 | - goods.groupchat_id=gg.groupchat_id | |
1199 | - } | |
1200 | - //--商品的房间号-- | |
1201 | - if (gg.room_id && gg.room_id > 0) { | |
1202 | - goods.room_id = gg.room_id; | |
1203 | - } | |
1204 | - | |
1205 | - item.order_goods.push(goods); | |
1206 | - pdata.push(item); | |
1207 | - } | |
1208 | - | |
1209 | - | |
1210 | - if (pdata.length == 0) return; | |
1211 | - //如果有使用预存,要处理 | |
1212 | - if (th.data.formData && th.data.formData.prestore * 1 > 0 && th.data.bn_goods.yck_off==2) { | |
1213 | - let formData = th.data.formData | |
1214 | - let pre_json = formData.pre_json | |
1215 | - let all_yck_arr = formData.all_yck_arr | |
1216 | - pdata.map((item, i) => { | |
1217 | - item.pre_cut = all_yck_arr[i] ? all_yck_arr[i].toFixed(2) : 0 | |
1218 | - item.pre_preferential = 0 | |
1219 | - item.pre_json = pre_json[i] ? JSON.stringify(pre_json[i]) : '' | |
1220 | - }) | |
1221 | - } | |
1222 | - if (!pdata.keyid && th.data.bn_goods) { | |
1223 | - pdata.map(ite => { | |
1224 | - ite.keyid = th.data.bn_goods.keyid | |
1225 | - }) | |
1226 | - // pdata.keyid = th.data.bn_goods.keyid | |
1227 | - } | |
1228 | - //------------------------------------------ | |
1229 | - | |
1230 | - var str = JSON.stringify(pdata); | |
1231 | - | |
1232 | - wx.showLoading({ title: "加载中" }); | |
1233 | - wx.request({ | |
1234 | - url: oo.url + '/api/weshop/order/createWxdOrder', | |
1235 | - data: str, | |
1236 | - method: 'POST', | |
1237 | - header: { | |
1238 | - 'content-type': 'application/json' | |
1239 | - },// 设置请求的 header | |
1240 | - success: function (res) { | |
1241 | - wx.hideLoading(); | |
1242 | - if (res.statusCode == 200) { | |
1243 | - var data = res.data; | |
1244 | - if (data.code == 0) { | |
1245 | - | |
1246 | - //如果是购物车结算,还要删除购物车 | |
1247 | - if (th.data.is_b_now == 0) { | |
1248 | - var list = th.data.cartlist_y; | |
1249 | - for (var i = 0; i < list.length; i++) { | |
1250 | - //删除购物车 | |
1251 | - a.delete("/api/weshop/cart/del/" + oo.stoid + "/" + list[i].id, {}); | |
1252 | - } | |
1253 | - } | |
1254 | - var order_amount = 0; | |
1255 | - pdata.forEach(function (em, ind) { | |
1256 | - order_amount += em.order_amount; | |
1257 | - }) | |
1258 | - //要进行判断,如果是用微信支付,就要跳转到支付界面 | |
1259 | - if (order_amount > 0) { | |
1260 | - th.setData({ isclose: 0 }); | |
1261 | - //void e.jumpToCart4({ | |
1262 | - // order_sn: data.data, | |
1263 | - //}, 1); | |
1264 | - util_pay.pay(data.data, function () { | |
1265 | - //app.my_warnning("支付成功",1,th); | |
1266 | - //setTimeout(function () { | |
1267 | - wx.redirectTo({ | |
1268 | - url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data | |
1269 | - }) | |
1270 | - //},1000) | |
1271 | - | |
1272 | - }, function () { | |
1273 | - //支付失败 | |
1274 | - setTimeout(function () { | |
1275 | - wx.navigateBack({ delta: 1 }) | |
1276 | - }, 1000) | |
1277 | - }, oo.stoid); | |
1278 | - | |
1279 | - } else { | |
1280 | - var dd = { | |
1281 | - parent_sn: data.data, | |
1282 | - store_id: oo.stoid, | |
1283 | - type: 2, | |
1284 | - }; | |
1285 | - a.post("/api/weshop/order/pay/createOrder", { | |
1286 | - data: dd, | |
1287 | - success: function (t) { | |
1288 | - //console.log(t); | |
1289 | - if (t.data.code == 0) { | |
1290 | - //app.my_warnning("支付成功",1,th); | |
1291 | - //setTimeout(function () { | |
1292 | - th.setData({ isclose: 0 }); | |
1293 | - wx.redirectTo({ | |
1294 | - url: "/pages/payment/pay_success/pay_success?type=2&order_sn=" + data.data, | |
1295 | - }) | |
1296 | - //}, 1000) | |
1297 | - } | |
1298 | - }, | |
1299 | - fail: function () { | |
1300 | - | |
1301 | - } | |
1302 | - }); | |
1303 | - } | |
1304 | - | |
1305 | - } | |
1306 | - else { | |
1307 | - //--内容换行-- | |
1308 | - var msg = data.msg; | |
1309 | - //赠品活动已经取消,无法赠送,是否继续买单? | |
1310 | - if (msg.indexOf("是否继续买单") > 0) { | |
1311 | - wx.showModal({ | |
1312 | - title: "提示", | |
1313 | - content: data.msg, | |
1314 | - cancelText: '取消', | |
1315 | - confirmText: '确定', | |
1316 | - showCancel: true, | |
1317 | - success(res) { | |
1318 | - if (res.cancel) { | |
1319 | - th.setData({submit:0}) | |
1320 | - return; | |
1321 | - } else if (res.confirm) { | |
1322 | - th.data.is_continue = 1; | |
1323 | - th.submitForm(sub_value); | |
1324 | - } | |
1325 | - } | |
1326 | - }) | |
1327 | - return; | |
1328 | - } | |
1329 | - if (msg.length > 13) { | |
1330 | - msg = msg.slice(0, 13) + "\r\n" + msg.slice(13); | |
1331 | - } | |
1332 | - getApp().confirmBox(msg); | |
1333 | - th.data.is_summit_ing = 0; //是否提交中 | |
1334 | - } | |
1335 | - } else { | |
1336 | - th.setData({submit:0}) | |
1337 | - th.data.is_summit_ing = 0; //是否提交中 | |
1338 | - console.log("index.js wx.request CheckCallUser statusCode" + res.statusCode); | |
1339 | - } | |
1340 | - }, | |
1341 | - fail: function () { | |
1342 | - th.setData({submit:0}) | |
1343 | - th.data.is_summit_ing = 0; | |
1344 | - wx.hideLoading(); | |
1345 | - console.log("index.js wx.request CheckCallUser fail"); | |
1346 | - }, | |
1347 | - complete: function () { } | |
1348 | - }) | |
1349 | - | |
1350 | - }, | |
4 | + /** | |
5 | + * 页面的初始数据 | |
6 | + */ | |
7 | + data: { | |
1351 | 8 | |
1352 | - //---确认线下门店的数量足不足--- | |
1353 | - async check_store_num(goods_id, pick, goods_num, func) { | |
1354 | - var lock = 0, pick_no, plist, erpwareid; | |
1355 | - //先读取门店的lock | |
1356 | - await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | |
1357 | - data: { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 } | |
1358 | - }).then(res => { | |
1359 | - if (res.data.code == 0 && res.data.data.total > 0) { | |
1360 | - for (var i in res.data.data.pageData) | |
1361 | - lock += res.data.data.pageData[i].outQty; | |
1362 | - } | |
1363 | - }) | |
1364 | - //先获取门店的编号 | |
1365 | - await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, { | |
1366 | - data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick } | |
1367 | - }).then(res => { | |
1368 | - if (res.data.code == 0) { | |
1369 | - pick_no = res.data.data.pickup_no; | |
1370 | - } | |
1371 | - }) | |
1372 | - //先获取商品的线下库存 | |
1373 | - await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { | |
1374 | - data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick } | |
1375 | - }).then(res => { | |
1376 | - if (res.data.code == 0) { | |
1377 | - erpwareid = res.data.data.erpwareid; | |
1378 | - } | |
1379 | - }) | |
1380 | - //读取线下的门店库存 | |
1381 | - await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | |
1382 | - data: { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid } | |
1383 | - }).then(res => { | |
1384 | - if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) { | |
1385 | - plist = res.data.data.pageData[0]; | |
1386 | - } | |
1387 | - }) | |
1388 | - var isok = 1; | |
1389 | - if (goods_num > plist.CanOutQty - lock) { | |
1390 | - isok = 0; | |
1391 | - } | |
1392 | - func(isok); | |
1393 | 9 | }, |
1394 | 10 | |
1395 | - useCoupon: function () { | |
1396 | - if (this.data.order.couponNum <= 0) { | |
1397 | - getApp().my_warnning("无可用优惠券", 0, this); | |
1398 | - return; | |
1399 | - } | |
11 | + /** | |
12 | + * 生命周期函数--监听页面加载 | |
13 | + */ | |
14 | + onLoad(options) { | |
1400 | 15 | |
1401 | - var a = { | |
1402 | - lid: this.data.coupon ? this.data.coupon.id : "0" | |
1403 | - }; | |
1404 | - wx.navigateTo({ | |
1405 | - url: "/pages/user/checkcoupon/checkcoupon?" + s.Obj2Str(a) | |
1406 | - }); | |
1407 | - }, | |
1408 | - enterAddressPage: function () { | |
1409 | - getApp().globalData.is_cart_old = 1; | |
1410 | - this.data.isget_by_quan = {}; | |
1411 | - this.data.enterAddressPage = !0, wx.navigateTo({ | |
1412 | - url: "/pages/user/address_list/address_list" | |
1413 | - }); | |
1414 | 16 | }, |
1415 | 17 | |
1416 | - | |
1417 | - | |
1418 | - //--------立即购买时,选择自提和物流---------- | |
1419 | - setexptype: function (t) { | |
1420 | - var th = this; | |
1421 | - var ty = t.currentTarget.dataset.t, def_exp_code = getApp().globalData.userInfo.def_exp_code; | |
1422 | - th.setData({ bn_exp_type: ty }); | |
1423 | - //当物流为空的时候。 | |
1424 | - if (ty == 0 && th.data.wu_arr == null) { | |
1425 | - th.data.isget_by_quan = {}; | |
1426 | - return th.get_wuliu(th.calculatePrice2()); | |
1427 | - } | |
1428 | - | |
1429 | - //--自提就要把包邮券清理掉-- | |
1430 | - if (ty == 1) { | |
1431 | - th.data.isget_by_quan = {}; | |
1432 | - if (th.data.using_quan && th.data.using_quan[th.data.bn_pick] && th.data.using_quan[th.data.bn_pick].isby == 1) { | |
1433 | - th.setData({ using_quan: {} }); | |
1434 | - } | |
1435 | - } | |
1436 | - | |
1437 | - //判断有没有默认的物流地址值 | |
1438 | - if (def_exp_code != "" && def_exp_code != null && def_exp_code != undefined && !th.data.is_default_logistics) { | |
1439 | - var wu_arr = this.data.wu_arr; | |
1440 | - if (wu_arr != null && wu_arr != "") { | |
1441 | - for (var i = 0; i < wu_arr.length; i++) { | |
1442 | - if (wu_arr[i].shipping_code == def_exp_code) { | |
1443 | - th.setData({ index: i }); | |
1444 | - } | |
1445 | - } | |
1446 | - } | |
1447 | - } | |
1448 | - th.calculatePrice2() | |
18 | + /** | |
19 | + * 生命周期函数--监听页面初次渲染完成 | |
20 | + */ | |
21 | + onReady() { | |
1449 | 22 | |
1450 | 23 | }, |
1451 | 24 | |
1452 | - //--------立即购买时,使用余额-------- | |
1453 | - set_bn_useyuer: function () { | |
1454 | - var th = this; | |
1455 | - th.setData({ bn_use_money: !th.data.bn_use_money }); | |
1456 | - th.calculatePrice2(); | |
1457 | - }, | |
1458 | - set_js_useyuer: function () { | |
1459 | - var th = this; | |
1460 | - th.setData({ js_use_money: !th.data.js_use_money }); | |
1461 | - th.calculatePrice(); | |
1462 | - }, | |
1463 | - | |
1464 | - //----------立即购买,选择物流------------- | |
1465 | - bindPickerChange: function (e) { | |
1466 | - var ind = e.detail.value | |
1467 | - this.setData({ index: ind }); | |
1468 | - this.calculatePrice2(); | |
1469 | - }, | |
1470 | - //----------购物车结算,选择物流------------- | |
1471 | - bindPickerChange_w: function (e) { | |
1472 | - var ind = e.detail.value, txt = e.currentTarget.dataset.txt; | |
1473 | - this.setData({ [txt]: ind }); | |
1474 | - this.calculatePrice(); | |
1475 | - }, | |
25 | + /** | |
26 | + * 生命周期函数--监听页面显示 | |
27 | + */ | |
28 | + onShow() { | |
1476 | 29 | |
1477 | - cart_set_err: function (e) { | |
1478 | - var txt = e.currentTarget.dataset.err; | |
1479 | - var ob = {}; | |
1480 | - ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif"; | |
1481 | - this.setData(ob); | |
1482 | 30 | }, |
1483 | 31 | |
1484 | - //// 开启物流的弹窗 | |
1485 | - show_wu_arr: function (e) { | |
1486 | - var wu_arr_txt = e.currentTarget.dataset.txt; | |
1487 | - var w_sele_index = e.currentTarget.dataset.w_sele_index; | |
1488 | - var is_express = null; | |
1489 | - var ob = { open_express: 1, wu_arr_txt: wu_arr_txt, disabled: 1 }; | |
32 | + /** | |
33 | + * 生命周期函数--监听页面隐藏 | |
34 | + */ | |
35 | + onHide() { | |
1490 | 36 | |
1491 | - //--如果是多个门店的时候-- | |
1492 | - if (w_sele_index != undefined) { | |
1493 | - is_express = this.data.cartlist[w_sele_index].wind; | |
1494 | - ob['is_express'] = is_express; | |
1495 | - } | |
1496 | - this.setData(ob); | |
1497 | - }, | |
1498 | - // 关闭物流的弹窗 | |
1499 | - close_express: function () { | |
1500 | - this.setData({ open_express: 0, disabled: 0 }); | |
1501 | - }, | |
1502 | - // 选择物流 | |
1503 | - click_express_name: function (e) { | |
1504 | - var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode; | |
1505 | - var index = e.currentTarget.dataset.idxe; | |
1506 | - var ob = { is_express: index, is_shipping_code: shippingcode, disabled: 0 }; | |
1507 | - ob[this.data.wu_arr_txt] = index; | |
1508 | - this.setData(ob); | |
1509 | 37 | }, |
1510 | 38 | |
1511 | - //点击确定物流 | |
1512 | - determine_expres: function (e) { | |
1513 | - this.setData({ open_express: 0 }); | |
1514 | - this.calculatePrice2(); | |
1515 | - }, | |
1516 | - | |
1517 | - //设置默认物流 | |
1518 | - select_default_logistics: function () { | |
1519 | - var th = this; | |
1520 | - var is_shipping_code = this.data.is_shipping_code | |
1521 | - getApp().request.put("/api/weshop/users/update", { | |
1522 | - data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code }, | |
1523 | - success: function (rse) { | |
1524 | - if (rse.data.code == 0) { | |
1525 | - getApp().globalData.userInfo.def_exp_code = is_shipping_code; | |
1526 | - th.setData({ open_express: 0 }); | |
1527 | - //----计算此时购物车的价格,这个页面没有calculatePrice(),2021.7.19-------- | |
1528 | - //if(th.data.is_b_now==1) th.calculatePrice2(); | |
1529 | - //else th.calculatePrice(); | |
1530 | - th.calculatePrice2(); | |
1531 | - } | |
1532 | - } | |
1533 | - }) | |
1534 | - }, | |
1535 | - | |
1536 | - //更新下默认,在onshow里面 | |
1537 | - update_code() { | |
1538 | - var th = this, m_wind = 0, def_exp_code = getApp().globalData.userInfo.def_exp_code; | |
1539 | - | |
1540 | - | |
1541 | - //--定时器,判断wu_arr不未空-- | |
1542 | - var uii = setInterval(function () { | |
1543 | - if (th.data.wu_arr) { | |
1544 | - clearInterval(uii); | |
1545 | - if(th.data.is_default_logistics) return false; | |
1546 | - for (var k = 0; k < th.data.wu_arr.length; k++) { | |
1547 | - var item = th.data.wu_arr[k]; | |
1548 | - if (def_exp_code == item.code) { m_wind = k; } | |
1549 | - } | |
1550 | - //--如果是立即购买-- | |
1551 | - th.setData({ index: m_wind, is_express: m_wind }); | |
39 | + /** | |
40 | + * 生命周期函数--监听页面卸载 | |
41 | + */ | |
42 | + onUnload() { | |
1552 | 43 | |
1553 | - } | |
1554 | - }, 500); | |
1555 | 44 | }, |
1556 | 45 | |
1557 | - //检查区域是不是包邮 | |
1558 | - check_area: function (arr) { | |
1559 | - var user_addr = this.data.user_addr; | |
1560 | - for (var i in arr) { | |
1561 | - var item = arr[i]; | |
1562 | - if (user_addr.twon == item || user_addr.district == item | |
1563 | - || user_addr.city == item || user_addr.province == item) { | |
1564 | - return 0; | |
1565 | - } | |
1566 | - } | |
1567 | - return 1; | |
1568 | - }, | |
46 | + /** | |
47 | + * 页面相关事件处理函数--监听用户下拉动作 | |
48 | + */ | |
49 | + onPullDownRefresh() { | |
1569 | 50 | |
1570 | - //检查立即购买的商品是不是不包邮 | |
1571 | - check_good: function (arr, goods_id) { | |
1572 | - if (!goods_id) goods_id = this.data.bn_goods.goods_id; | |
1573 | - for (var i in arr) { | |
1574 | - var item = arr[i]; | |
1575 | - if (goods_id == item) return 0; | |
1576 | - } | |
1577 | - return 1; | |
1578 | - }, | |
1579 | - check_by_area: function (region_list) { | |
1580 | - var arr = region_list.split(","); | |
1581 | - var check = this.check_area(arr); | |
1582 | - return !check; | |
1583 | - }, | |
1584 | - check_by_goods: function (goods_list, goods_id) { | |
1585 | - var arr = goods_list.split(","); | |
1586 | - var check = this.check_good(arr, goods_id); | |
1587 | - return !check; | |
1588 | 51 | }, |
1589 | 52 | |
53 | + /** | |
54 | + * 页面上拉触底事件的处理函数 | |
55 | + */ | |
56 | + onReachBottom() { | |
1590 | 57 | |
1591 | - //从优惠的映射中拿出商品从表的item | |
1592 | - arr_get_goods: function (goods_id, arr) { | |
1593 | - for (var i in arr) { | |
1594 | - if (arr[i].goods_id == goods_id) return arr[i]; | |
1595 | - } | |
1596 | 58 | }, |
1597 | 59 | |
1598 | - //跳转到购买卡 | |
1599 | - buycard: function () { | |
1600 | - getApp().goto("/pages/user/plus/plus"); | |
1601 | - getApp().globalData.plus_buy_back = 1; | |
1602 | - }, | |
60 | + /** | |
61 | + * 用户点击右上角分享 | |
62 | + */ | |
63 | + onShareAppMessage() { | |
1603 | 64 | |
1604 | - //使用佣金抵扣 | |
1605 | - set_bn_commission:function () { | |
1606 | - var th = this; | |
1607 | - th.setData({bn_use_commission: !th.data.bn_use_commission}); | |
1608 | - th.calculatePrice2(); | |
1609 | 65 | } |
1610 | - | |
1611 | - | |
1612 | -}); | |
66 | +}) | |
1613 | 67 | \ No newline at end of file | ... | ... |
pages/cart/cart2_inte/cart2_inte.wxml
1 | -<wxs module="filter" src="c_filter.wxs"></wxs> | |
2 | -<wxs src="filter.wxs" module="util"></wxs> | |
3 | -<wxs module="filters" src="../../../utils/filter.wxs"></wxs> | |
4 | - | |
5 | -<form bindsubmit="submitForm"> | |
6 | - <view class="container"> | |
7 | - | |
8 | - <view class="tab-container" wx:if="{{show_submit}}"> | |
9 | - <view class="tab-wrapper"> | |
10 | - <view hidden="{{bn_t_exp_t==2}}" bindtap='setexptype' data-t='1' class="tab {{bn_exp_type == 1? 'active':''}}" | |
11 | - data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view> | |
12 | - | |
13 | - <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" | |
14 | - data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> | |
15 | - | |
16 | - <!-- 同城配送 --> | |
17 | - <block wx:if="{{show_same_city}}"> | |
18 | - <view hidden="{{bn_t_exp_t==3}}" bindtap='setexptype' data-t='2' class="tab {{bn_exp_type== 2 ? 'active':''}}" data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}">同城配送</view> | |
19 | - </block> | |
20 | - | |
21 | - </view> | |
22 | - </view> | |
23 | - | |
24 | - | |
25 | - <!--要进行判断地址是否显示----> | |
26 | - <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{(bn_exp_type==1 && is_b_now==1) || (is_all_zt==1 && is_b_now==0)}}'> | |
27 | - <!---默认地址显示------> | |
28 | - <block wx:if="{{user_addr!=null}}"> | |
29 | - | |
30 | - <view class="user-contact"> | |
31 | - <text>收货人:</text>{{user_addr.consignee}}{{' '}}{{user_addr.mobile}}</view> | |
32 | - <view class="location"> | |
33 | - <view class="address">{{user_addr.more_address}}{{' '}}{{user_addr.address}}</view> | |
34 | - <view class="pos-icon"> | |
35 | - <image class="wh100 bdr14" src="{{imgUrl}}/miniapp/images/goodscategory/new_position.png"></image> | |
36 | - </view> | |
37 | - </view> | |
38 | - <view class="update-logistics"> | |
39 | - <!-- <image class="arrow-rigth" src="{{imgUrl}}/miniapp/images/new_position.png"></image> --> | |
40 | - <view class="xc-right"></view> | |
41 | - </view> | |
42 | - </block> | |
43 | - <!---先增地址------> | |
44 | - <block wx:else> | |
45 | - <view class="add_new"> | |
46 | - <image class="addr_jia" src="{{imgUrl}}/miniapp/images/jia.png"></image>添加地址 | |
47 | - </view> | |
48 | - </block> | |
49 | - <!-- <view class="border-img"> | |
50 | - <image class="wh100" src="{{imgUrl}}/miniapp/images/order/new_dividing_line.png"></image> | |
51 | - </view> --> | |
52 | - </view> | |
53 | - | |
54 | - | |
55 | - | |
56 | - <!-- ----立即购买------ --> | |
57 | - <!-- <view class="xc-border xc-border"></view> --> | |
58 | - <block wx:if="{{is_b_now==1}}"> | |
59 | - <view class="use-item bfff bdr_t-14 mgt20"> | |
60 | - <image class="dp" src='{{imgUrl}}/miniapp/images/goodscategory/new_store.png'> </image> | |
61 | - <view>{{bn_pickname}}</view> | |
62 | - <!-- <view>门店:{{bn_pickname}}</view> --> | |
63 | - </view> | |
64 | - <view class="order-detail"> | |
65 | - <view class="goods-img"> | |
66 | - <image class="wh100 bdr14" src="{{bn_goods.original_img}}" binderror='cart_set_err' data-err="bn_goods.original_img"></image> | |
67 | - </view> | |
68 | - <navigator class="order-cont" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{bn_goods.goods_id}}&prom_type={{bn_goods.prom_type}}&prom_id={{bn_goods.prom_id}}"> | |
69 | - <view class="goods-name ellipsis-2">{{bn_goods.goods_name}}</view> | |
70 | - <!-- 商品属性 --> | |
71 | - <view class="flex-vertical fs28 xc-ash color-gray n_guige"> | |
72 | - <view class="goods-color"> | |
73 | - <block><text>{{filters.show_gui_ge(bn_goods.goods_spec,bn_goods.goods_color)}}</text></block> | |
74 | - </view> | |
75 | - </view> | |
76 | - | |
77 | - <!-----商品名称规格------> | |
78 | - <view class="order-num flex-space-between"> | |
79 | - <view class="co-red"> | |
80 | - <text wx:if="{{bn_goods.integral}}" class="fs36">{{bn_goods.integral}}积分</text> | |
81 | - <text wx:if="{{bn_goods.integral && bn_goods.shop_price}}">+</text> | |
82 | - <block wx:if="{{bn_goods.shop_price}}"> ¥<text class="fs36">{{filters.toFix(bn_goods.shop_price,2)}}</text></block> | |
83 | - </view> | |
84 | - <view style="color: red;" wx:if="{{bn_goods.use_commission && bn_goods.use_commission*1>0}}">佣金:{{filters.toFix(bn_goods.use_commission/bn_goods.buynum,2)}}*{{bn_goods.buynum}}</view> | |
85 | - | |
86 | - <view class="goods-num">x{{bn_goods.buynum}}</view> | |
87 | - </view> | |
88 | - </navigator> | |
89 | - | |
90 | - </view> | |
91 | - | |
92 | - <view class="set-mes bdr_b-14"> | |
93 | - <view wx:if="{{order.store_prom}}"> | |
94 | - <icon color="#f23030" size="16" type="info"></icon>{{order.store_prom}} | |
95 | - </view> | |
96 | - | |
97 | - <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" wx:if="{{(selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null}}"> | |
98 | - <view class="work-frame flex-space-between"> | |
99 | - <view class="work"> | |
100 | - 优惠券 <text class="quan_num_show">{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list?get_by_quan_list.length:0)}}张可用</text> | |
101 | - </view> | |
102 | - <view class="xc-right-frame"> | |
103 | - <text wx:if="{{using_quan[bn_pick].is_nouse}}">不使用</text> | |
104 | - <block wx:else> | |
105 | - <text wx:if="{{using_quan[bn_pick].money}}">¥{{using_quan[bn_pick].money}}元优惠券</text> | |
106 | - <text wx:if="{{using_quan[bn_pick].isby}}">包邮券</text> | |
107 | - </block> | |
108 | - <view class="xc-right"></view> | |
109 | - </view> | |
110 | - </view> | |
111 | - </view> | |
112 | - | |
113 | - | |
114 | - | |
115 | - <block wx:if="{{bn_exp_type==0 && !is_default_logistics}}"> | |
116 | - <view class="use-item flex-space-between"> | |
117 | - <view>选择物流</view> | |
118 | - <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 8rpx;"> | |
119 | - <view class="logistics-name">{{wu_arr[index].name}}</view> | |
120 | - <view class="xc-right"></view> | |
121 | - </view> | |
122 | - </view> | |
123 | - </block> | |
124 | - | |
125 | - </view> | |
126 | - | |
127 | - <view class="coupon-mes flex-vertical"> | |
128 | - <view>留言</view> | |
129 | - <view class="leave-word"> | |
130 | - <input placeholder-class="fs28" placeholder='给商家留言,最多100字' bindinput="keyUpChangeNum" disabled="{{disabled}}" | |
131 | - class="word-box" maxlength="100" name="user_note"></input> | |
132 | - </view> | |
133 | - </view> | |
134 | - <!-- 预存款 --> | |
135 | - <view class="set-mes" catchtap="prestore2" wx:if="{{bn_goods.yck_off}}"> | |
136 | - <view class="use-item" style="justify-content: space-between;"> | |
137 | - <view> | |
138 | - <icon color="{{bn_goods.yck_off==2 ? 'red' : '#808080'}}" size="16" type="success"></icon> | |
139 | - <view class="yu_er">使用预存</view> | |
140 | - </view> | |
141 | - <view wx:if="{{bn_goods.yck_off==2 }}">¥{{filters.toFix(bn_goods.yck,2)}}</view> | |
142 | - </view> | |
143 | - </view> | |
144 | - | |
145 | - <!-----使用佣金抵扣,只有佣金小于尾款金额的时候------> | |
146 | - <view class="set-mes bdr_t-14" | |
147 | - wx:if="{{bn_goods.use_commission>0 && can_commission && formData.all_price>0 && bn_goods.use_commission<=formData.all_price}}"> | |
148 | - <view class="use-item" bindtap='set_bn_commission'> | |
149 | - <icon color="{{bn_use_commission?'red':'gray'}}" size="16" type="success"></icon> | |
150 | - <view class="yu_er">使用佣金 :¥{{bn_goods.use_commission}} </view> | |
151 | - </view> | |
152 | - </view> | |
153 | - | |
154 | - <!-- ---使用余额---- --> | |
155 | - <view class="set-mes bdr_t-14" wx:if="{{yuer>0 && formData.all_price>0}}"> | |
156 | - <view class="use-item" bindtap='set_bn_useyuer'> | |
157 | - <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon> | |
158 | - <view class="yu_er">使用余额 :¥{{yuer}} </view> | |
159 | - </view> | |
160 | - </view> | |
161 | - | |
162 | - | |
163 | - | |
164 | - </block> | |
165 | - | |
166 | - <view class="information bdr14"> | |
167 | - <view class="item" wx:if="{{formData.all_price>0}}"> | |
168 | - <view>商品金额</view> | |
169 | - <view class="co-red">¥ {{formData.all_price}}元</view> | |
170 | - </view> | |
171 | - <view class="item" wx:if="{{formData.integral>0}}"> | |
172 | - <view>可用积分{{integral_can}}</view> | |
173 | - <view class="co-red">{{formData.integral}}积分</view> | |
174 | - </view> | |
175 | - <view class="item" wx:if="{{formData.shipping_price>0}}"> | |
176 | - <view>配送费用</view> | |
177 | - <view class="co-red">¥ {{formData.shipping_price}}元</view> | |
178 | - </view> | |
179 | - | |
180 | - <!-- 订单优惠优惠金额 --> | |
181 | - <view class="item" wx:if="{{formData.order_prom_amount>0}}"> | |
182 | - <view>订单优惠</view> | |
183 | - <view class="co-red">- ¥ {{filters.toFix(formData.order_prom_amount,2)}}元</view> | |
184 | - </view> | |
185 | - <!-- 使用预存优惠金额 --> | |
186 | - <view class="item" wx:if="{{formData.prestore>0}}"> | |
187 | - <view>使用预存</view> | |
188 | - <view class="co-red">- ¥ {{filters.toFix(formData.prestore,2)}}元</view> | |
189 | - </view> | |
190 | - <view class="item" wx:if="{{formData.user_money>0}}"> | |
191 | - <view>使用余额</view> | |
192 | - <view class="co-red">- ¥ {{formData.user_money}}元</view> | |
193 | - </view> | |
194 | - </view> | |
195 | - </view> | |
196 | - | |
197 | - <view class="btn-wrap shadow-1" wx:if="{{show_submit}}"> | |
198 | - <view class="pay-amount"> | |
199 | - <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> | |
200 | - <view class="payable">应付积分:<text class="co-red">{{formData.integral}}积分</text></view> | |
201 | - </view> | |
202 | - <button disabled="{{submit}}" class="tips-btn" formType="submit" id="submitOrder">提交订单</button> | |
203 | - </view> | |
204 | -</form> | |
205 | - | |
206 | -<!----弹起选择物流名的列表----> | |
207 | -<view wx:if='{{open_express==1}}'> | |
208 | - <view class="cover-layer flex-center " bindtap='close_express'> | |
209 | - </view> | |
210 | - | |
211 | - <view class="cx-popup radius {{open_express==1?'up' : 'down'}}"> | |
212 | - <view class="tops flex"> | |
213 | - <view class="top-content fs32"> | |
214 | - <view>选择物流名字</view> | |
215 | - </view> | |
216 | - <view class="close-frame" bindtap='close_express'> | |
217 | - <view class="xc-close-express">×</view> | |
218 | - </view> | |
219 | - </view> | |
220 | - <view class="express_list"> | |
221 | - <view wx:for="{{wu_arr}}" wx:for-item="express_list" wx:for-index="idx"> | |
222 | - <view class="express_list_frame" bindtap="click_express_name" data-shippingcode="{{express_list.shipping_code}}" | |
223 | - data-name="{{express_list.name}}" data-idxe="{{idx}}"> | |
224 | - | |
225 | - <block wx:if="{{is_express==idx}}"> | |
226 | - <view class="circle white xc-hook fs20 red-b"><text>Γ</text></view> | |
227 | - </block> | |
228 | - <block wx:else> | |
229 | - <view class="circle xc-hooks"></view> | |
230 | - </block> | |
231 | - <view class="fs30">{{express_list.name}}</view> | |
232 | - | |
233 | - </view> | |
234 | - </view> | |
235 | - </view> | |
236 | - <view class="flex click-buttem"> | |
237 | - <view class="xc-determine flex-center" bindtap="determine_expres"> | |
238 | - <view class="flex-vertical t-c">确定</view> | |
239 | - </view> | |
240 | - <view class="xc-confirms flex-center" bindtap="select_default_logistics"> | |
241 | - <view class="flex-vertical t-c">设为默认</view> | |
242 | - </view> | |
243 | - </view> | |
244 | - | |
245 | - </view> | |
246 | -</view> | |
247 | - | |
248 | -<warn id="warn"></warn> | |
1 | +<!--pages/cart/cart2_inte/cart2_inte.wxml--> | |
2 | +<text>pages/cart/cart2_inte/cart2_inte.wxml</text> | ... | ... |
pages/cart/cart2_pt/cart2_pt.js
... | ... | @@ -72,6 +72,8 @@ Page({ |
72 | 72 | |
73 | 73 | bn_is_order_yh:1, //是不是订单优惠 |
74 | 74 | bn_is_post_temp:1, //是不是进行计算包邮模板 |
75 | + | |
76 | + same_ok:1, //同城配送的控制,默认ok | |
75 | 77 | }, |
76 | 78 | onLoad: function (t) { |
77 | 79 | console.log("onLoad_pt_cart"); |
... | ... | @@ -380,6 +382,10 @@ Page({ |
380 | 382 | break; |
381 | 383 | } |
382 | 384 | |
385 | + if(th.data.show_same_city==1 && th.data.json_d.pickupway && th.data.json_d.pickupway == 2 ){ | |
386 | + et = 2; | |
387 | + } | |
388 | + | |
383 | 389 | t.data.data.shop_price = gg.goods_price; |
384 | 390 | //--如果是普通购买的时候-- |
385 | 391 | if (gg.is_normal == 1) { |
... | ... | @@ -564,6 +570,10 @@ Page({ |
564 | 570 | //先获取是否有关闭使用优惠券 |
565 | 571 | getApp().getConfig2(function (ee) { |
566 | 572 | var json_d = JSON.parse(ee.switch_list); |
573 | + | |
574 | + //测试强行写死,后面一定要删除 | |
575 | + //json_d.pickupway=2; | |
576 | + | |
567 | 577 | th.data.json_d = json_d; |
568 | 578 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 |
569 | 579 | var is_default_logistics = json_d.is_default_logistics; |
... | ... | @@ -851,7 +861,17 @@ Page({ |
851 | 861 | }) |
852 | 862 | } |
853 | 863 | }) |
854 | - if (!is_next) return false | |
864 | + if (!is_next){ | |
865 | + th.setData({show_submit:1, submit: 0,same_ok:0 }) | |
866 | + return false | |
867 | + } | |
868 | + | |
869 | + th.data.lon=lon; | |
870 | + th.data.lat=lat; | |
871 | + th.data.bn_gd_w=gd_w; | |
872 | + th.data.bn_samecity_order_amount=req_data.order_amount; | |
873 | + | |
874 | + | |
855 | 875 | } |
856 | 876 | |
857 | 877 | //-- 如果是订单优惠的时候,allpice要拿来减掉一些 -- |
... | ... | @@ -1112,8 +1132,15 @@ Page({ |
1112 | 1132 | 'order_goods': new Array(), |
1113 | 1133 | }; |
1114 | 1134 | |
1135 | + //-- 同城配送检验的参数 -- | |
1136 | + if(item.exp_type==2){ | |
1137 | + item.lon=th.data.lon?th.data.lon:0; | |
1138 | + item.lat=th.data.lat?th.data.lat:0; | |
1139 | + item.goods_weight=th.data.bn_gd_w; | |
1140 | + item.samecity_order_amount=th.data.bn_samecity_order_amount; | |
1141 | + } | |
1115 | 1142 | |
1116 | - //--判断有没有优惠活动-- | |
1143 | + //--判断有没有优惠活动-- | |
1117 | 1144 | if (th.data.formData.order_prom_amount > 0) { |
1118 | 1145 | var order_prom_list = {}; |
1119 | 1146 | order_prom_list.order_prom_id = th.data.formData.order_prom_id; |
... | ... | @@ -1404,7 +1431,7 @@ Page({ |
1404 | 1431 | setexptype_w: function (t) { |
1405 | 1432 | var th = this; |
1406 | 1433 | var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt; |
1407 | - th.setData({ [txt]: ty }); | |
1434 | + th.setData({ [txt]: ty,same_ok:1 }); | |
1408 | 1435 | var iszt = 1; |
1409 | 1436 | if (ty == 0) { |
1410 | 1437 | th.setData({ is_all_zt: 0 }); |
... | ... | @@ -1426,7 +1453,7 @@ Page({ |
1426 | 1453 | setexptype: function (t) { |
1427 | 1454 | var th = this; |
1428 | 1455 | var ty = t.currentTarget.dataset.t; |
1429 | - th.setData({ bn_exp_type: ty }); | |
1456 | + th.setData({ bn_exp_type: ty, same_ok:1 }); | |
1430 | 1457 | //当物流为空的时候。 |
1431 | 1458 | if (ty == 0 && th.data.wu_arr == null) { |
1432 | 1459 | return th.get_wuliu(th.calculatePrice2()); | ... | ... |
pages/cart/cart2_pt/cart2_pt.wxml
... | ... | @@ -198,7 +198,7 @@ |
198 | 198 | <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> |
199 | 199 | <!-- <view class="co-red big"></view> --> |
200 | 200 | </view> |
201 | - <button disabled="{{submit}}" class="tips-btn" formType="submit" id="submitOrder">提交订单</button> | |
201 | + <button disabled="{{submit || !same_ok}}" class="tips-btn" formType="submit" id="submitOrder">提交订单</button> | |
202 | 202 | </view> |
203 | 203 | </form> |
204 | 204 | ... | ... |
pages/cart/cart_wk/cart_wk.js
... | ... | @@ -50,7 +50,8 @@ Page({ |
50 | 50 | bn_is_order_yh:1, //是不是订单优惠 |
51 | 51 | bn_is_post_temp:1, //是不是进行计算包邮模板 |
52 | 52 | |
53 | - paying:0 //支付中 | |
53 | + paying:0, //支付中 | |
54 | + same_ok:1 //同城配送的控制 | |
54 | 55 | |
55 | 56 | }, |
56 | 57 | |
... | ... | @@ -71,6 +72,11 @@ Page({ |
71 | 72 | //--初始化-- |
72 | 73 | getApp().getConfig2(function (e) { |
73 | 74 | var json_d = JSON.parse(e.switch_list); |
75 | + | |
76 | + //测试强行写死,后面一定要删除 | |
77 | + //json_d.pickupway=2; | |
78 | + | |
79 | + | |
74 | 80 | th.data.json_d = json_d; |
75 | 81 | var is_default_logistics = json_d.is_default_logistics; |
76 | 82 | var is_same_city = json_d.is_same_city; |
... | ... | @@ -343,7 +349,7 @@ Page({ |
343 | 349 | |
344 | 350 | //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- |
345 | 351 | if(goods.is_same_city && th.data.is_same_city && goods.whsle_id<=0){ |
346 | - getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+order.pickup_id, {}).then(res=>{ | |
352 | + await getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+order.pickup_id, {}).then(res=>{ | |
347 | 353 | if(res.data.code==0){ |
348 | 354 | var pk=res.data.data; |
349 | 355 | if(pk && pk.is_same_city){ |
... | ... | @@ -369,6 +375,12 @@ Page({ |
369 | 375 | break; //物流 |
370 | 376 | } |
371 | 377 | |
378 | + if(th.data.show_same_city==1 && th.data.json_d.pickupway && th.data.json_d.pickupway == 2 ){ | |
379 | + exp_type = 2; | |
380 | + } | |
381 | + | |
382 | + | |
383 | + | |
372 | 384 | order.order_goods = order_goods; |
373 | 385 | |
374 | 386 | //-- 计算获得佣金的金额 -- |
... | ... | @@ -416,6 +428,7 @@ Page({ |
416 | 428 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; |
417 | 429 | var o_condition = allpice; |
418 | 430 | var ord_prom=null; |
431 | + var order_prom_amount=0; | |
419 | 432 | |
420 | 433 | if (th.data.bn_is_order_yh) { |
421 | 434 | await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { |
... | ... | @@ -432,6 +445,10 @@ Page({ |
432 | 445 | //--计算物流-- |
433 | 446 | if (th.data.exp_type == 0) { |
434 | 447 | th.calculate_wuliu(); |
448 | + return false; | |
449 | + }else if(th.data.exp_type == 2){ | |
450 | + th.calculate_same_city(); | |
451 | + return false; | |
435 | 452 | } else { |
436 | 453 | |
437 | 454 | var order_prom_id=0; |
... | ... | @@ -454,6 +471,10 @@ Page({ |
454 | 471 | } |
455 | 472 | } |
456 | 473 | |
474 | + | |
475 | + | |
476 | + | |
477 | + | |
457 | 478 | //--订单优惠的显示-- |
458 | 479 | var order_prom_txt1 = "formData.order_prom_id"; |
459 | 480 | var order_prom_txt2 = "formData.order_prom_amount"; |
... | ... | @@ -498,7 +519,7 @@ Page({ |
498 | 519 | set_wuliu: function (e) { |
499 | 520 | var type = e.currentTarget.dataset.type, th = this; |
500 | 521 | this.setData({ |
501 | - exp_type: type | |
522 | + exp_type: type,same_ok:1 | |
502 | 523 | }); |
503 | 524 | //--计算物流的值-- |
504 | 525 | if (type == 0) { |
... | ... | @@ -525,6 +546,7 @@ Page({ |
525 | 546 | |
526 | 547 | //如果有再计算价格的过程中,不能提交订单 |
527 | 548 | if(this.data.submit){ return false} |
549 | + if(!this.data.same_ok){ return false} | |
528 | 550 | |
529 | 551 | //--物流支付时要有地址-- |
530 | 552 | if (this.data.exp_type == 0 && this.data.user_addr == null) { |
... | ... | @@ -564,7 +586,7 @@ Page({ |
564 | 586 | tail_pay_type: ind,//0微信支付 1余额支付 |
565 | 587 | }; |
566 | 588 | |
567 | - if (th.data.exp_type == 0) { | |
589 | + if (th.data.exp_type == 0 && th.data.exp_type == 2) { | |
568 | 590 | var index = th.data.index; |
569 | 591 | dd.shipping_code = th.data.wu_arr[index].code; |
570 | 592 | dd.shipping_name = th.data.wu_arr[index].name; |
... | ... | @@ -573,10 +595,18 @@ Page({ |
573 | 595 | } |
574 | 596 | |
575 | 597 | //如果是同城配送的时候 |
576 | - if(th.data.exp_type==2){ | |
577 | - dd.shipping_price = parseFloat(th.data.exp_price); | |
598 | + // if(th.data.exp_type==2){ | |
599 | + // dd.shipping_price = parseFloat(th.data.exp_price); | |
600 | + // } | |
601 | + | |
602 | + if(dd.exp_type==2){ | |
603 | + dd.lon=th.data.lon?th.data.lon:0; | |
604 | + dd.lat=th.data.lat?th.data.lat:0; | |
605 | + dd.goods_weight=th.data.bn_gd_w; | |
606 | + dd.samecity_order_amount=th.data.bn_samecity_order_amount; | |
578 | 607 | } |
579 | 608 | |
609 | + | |
580 | 610 | if(getApp().globalData.scene){ |
581 | 611 | dd.scene=getApp().globalData.scene; |
582 | 612 | } |
... | ... | @@ -612,6 +642,12 @@ Page({ |
612 | 642 | //---用微信支付--- |
613 | 643 | if (dd.tail_pay_type == 0) { |
614 | 644 | |
645 | + if (t.data.code != 0) { | |
646 | + getApp().my_warnning(t.data.msg, 1, th); | |
647 | + th.data.paying=0; | |
648 | + return false; | |
649 | + } | |
650 | + | |
615 | 651 | util_pay.pay_data(t,function (){ |
616 | 652 | var allmoney = th.data.allpice; |
617 | 653 | th.jumpPaymentPage(th.data.order.order_sn, allmoney); |
... | ... | @@ -984,7 +1020,15 @@ Page({ |
984 | 1020 | }) |
985 | 1021 | } |
986 | 1022 | }) |
987 | - if(!is_next) return false | |
1023 | + if(!is_next) { | |
1024 | + th.setData({show_submit:1, submit: 0,same_ok:0 }) | |
1025 | + return false | |
1026 | + } | |
1027 | + | |
1028 | + th.data.lon=lon; | |
1029 | + th.data.lat=lat; | |
1030 | + th.data.bn_gd_w=gd_w; | |
1031 | + th.data.bn_samecity_order_amount=req_data.order_amount; | |
988 | 1032 | |
989 | 1033 | var exp_price = parseFloat(shipping_price).toFixed(2); |
990 | 1034 | allpice = parseFloat(exp_price) + parseFloat(allpice); | ... | ... |
pages/cart/cart_wk/cart_wk.wxml
... | ... | @@ -135,7 +135,7 @@ |
135 | 135 | <text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price,2)}}</text> |
136 | 136 | </view> --> |
137 | 137 | <view class='zf_left'>支付合计:<text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price-(bn_use_commission?goods.use_commission:0)-formData.order_prom_amount ,2)}}</text></view> |
138 | - <view class="zf_btn {{submit?'gray':''}}" bindtap="to_pay">支付尾款</view> | |
138 | + <view class="zf_btn {{(submit || !same_ok)?'gray':''}}" bindtap="to_pay">支付尾款</view> | |
139 | 139 | </view> |
140 | 140 | |
141 | 141 | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -2358,7 +2358,7 @@ Page({ |
2358 | 2358 | |
2359 | 2359 | if (e.prom_type == 4) { |
2360 | 2360 | s.set_b_now(e); |
2361 | - var url = "/pages/cart/cart2_inte/cart2_inte?is_bnow=1&goods_id=" + e.goods_id; | |
2361 | + var url = "/packageE/pages/cart/cart2_inte/cart2_inte?is_bnow=1&goods_id=" + e.goods_id; | |
2362 | 2362 | getApp().goto(url); |
2363 | 2363 | } else { |
2364 | 2364 | //要判断积分购的普通购买有没有参加优惠活动 |
... | ... | @@ -6113,20 +6113,20 @@ Page({ |
6113 | 6113 | //---自定义海报 产品质量保证 |
6114 | 6114 | if(th.data.share_b_img && th.data.poster.show_quality==1 && type!=4){ |
6115 | 6115 | var g_path = "../../../images/share/s_gou.png"; |
6116 | - context.drawImage(g_path, 56 * unit, 640 * unit, 22 * unit, 22 * unit); | |
6116 | + context.drawImage(g_path, 56 * unit, 644 * unit, 22 * unit, 22 * unit); | |
6117 | 6117 | context.setFillStyle("red") |
6118 | 6118 | context.setFontSize(18 * unit) |
6119 | - context.fillText("正品保证", 84 * unit, 660 * unit); | |
6119 | + context.fillText("正品保证", 84 * unit, 664 * unit); | |
6120 | 6120 | |
6121 | - context.drawImage(g_path, 218 * unit, 640 * unit, 22 * unit, 22 * unit); | |
6121 | + context.drawImage(g_path, 218 * unit, 644 * unit, 22 * unit, 22 * unit); | |
6122 | 6122 | context.setFillStyle("red") |
6123 | 6123 | context.setFontSize(18 * unit) |
6124 | - context.fillText("纯实体店", 246 * unit, 660 * unit); | |
6124 | + context.fillText("纯实体店", 246 * unit, 664 * unit); | |
6125 | 6125 | |
6126 | - context.drawImage(g_path, 388 * unit, 640 * unit, 22 * unit, 22 * unit); | |
6126 | + context.drawImage(g_path, 388 * unit, 644 * unit, 22 * unit, 22 * unit); | |
6127 | 6127 | context.setFillStyle("red") |
6128 | 6128 | context.setFontSize(18 * unit) |
6129 | - context.fillText("官方验证", 420 * unit, 660 * unit); | |
6129 | + context.fillText("官方验证", 420 * unit, 664 * unit); | |
6130 | 6130 | |
6131 | 6131 | } |
6132 | 6132 | //-------大图后面就不一样了----------- |
... | ... | @@ -6136,10 +6136,11 @@ Page({ |
6136 | 6136 | break |
6137 | 6137 | } |
6138 | 6138 | //---画线--- |
6139 | - context.setLineWidth(1 * unit) | |
6140 | - context.moveTo(32 * unit, 710 * unit) | |
6141 | - context.lineTo(520 * unit, 710 * unit) | |
6142 | - context.stroke(); | |
6139 | + // context.setLineWidth(1 * unit) | |
6140 | + // context.moveTo(32 * unit, 710 * unit) | |
6141 | + // context.lineTo(520 * unit, 710 * unit) | |
6142 | + // context.stroke(); | |
6143 | + | |
6143 | 6144 | //---文字--- |
6144 | 6145 | context.setFillStyle("black") |
6145 | 6146 | context.setFontSize(22 * unit) |
... | ... | @@ -6214,10 +6215,10 @@ Page({ |
6214 | 6215 | |
6215 | 6216 | |
6216 | 6217 | //---画线--- |
6217 | - context.setLineWidth(1 * unit) | |
6218 | - context.moveTo(32 * unit, 710 * unit) | |
6219 | - context.lineTo(520 * unit, 710 * unit) | |
6220 | - context.stroke(); | |
6218 | + // context.setLineWidth(1 * unit) | |
6219 | + // context.moveTo(32 * unit, 710 * unit) | |
6220 | + // context.lineTo(520 * unit, 710 * unit) | |
6221 | + // context.stroke(); | |
6221 | 6222 | |
6222 | 6223 | //---文字--- |
6223 | 6224 | context.setFillStyle("black") |
... | ... | @@ -6259,10 +6260,10 @@ Page({ |
6259 | 6260 | break |
6260 | 6261 | } |
6261 | 6262 | //---画线--- |
6262 | - context.setLineWidth(1 * unit) | |
6263 | - context.moveTo(32 * unit, 670 * unit) | |
6264 | - context.lineTo(520 * unit, 670 * unit) | |
6265 | - context.stroke(); | |
6263 | + // context.setLineWidth(1 * unit) | |
6264 | + // context.moveTo(32 * unit, 670 * unit) | |
6265 | + // context.lineTo(520 * unit, 670 * unit) | |
6266 | + // context.stroke(); | |
6266 | 6267 | |
6267 | 6268 | //画秒杀的图片 |
6268 | 6269 | if(th.data.is_share_text){ |
... | ... | @@ -6300,10 +6301,11 @@ Page({ |
6300 | 6301 | break |
6301 | 6302 | } |
6302 | 6303 | //---画线--- |
6303 | - context.setLineWidth(1 * unit) | |
6304 | - context.moveTo(32 * unit, 690 * unit) | |
6305 | - context.lineTo(520 * unit, 690 * unit) | |
6306 | - context.stroke(); | |
6304 | + // context.setLineWidth(1 * unit) | |
6305 | + // context.moveTo(32 * unit, 690 * unit) | |
6306 | + // context.lineTo(520 * unit, 690 * unit) | |
6307 | + // context.stroke(); | |
6308 | + | |
6307 | 6309 | //---文字--- |
6308 | 6310 | context.setFillStyle("black") |
6309 | 6311 | context.setFontSize(24 * unit) |
... | ... | @@ -6348,10 +6350,10 @@ Page({ |
6348 | 6350 | break |
6349 | 6351 | } |
6350 | 6352 | //---画线--- |
6351 | - context.setLineWidth(1 * unit) | |
6352 | - context.moveTo(32 * unit, 690 * unit) | |
6353 | - context.lineTo(520 * unit, 690 * unit) | |
6354 | - context.stroke(); | |
6353 | + // context.setLineWidth(1 * unit) | |
6354 | + // context.moveTo(32 * unit, 690 * unit) | |
6355 | + // context.lineTo(520 * unit, 690 * unit) | |
6356 | + // context.stroke(); | |
6355 | 6357 | //---文字--- |
6356 | 6358 | context.setFillStyle("black") |
6357 | 6359 | context.setFontSize(24 * unit) |
... | ... | @@ -6395,10 +6397,10 @@ Page({ |
6395 | 6397 | |
6396 | 6398 | case -1: //秒杀商品的展示 |
6397 | 6399 | //---画线--- |
6398 | - context.setLineWidth(1 * unit) | |
6399 | - context.moveTo(32 * unit, 670 * unit) | |
6400 | - context.lineTo(520 * unit, 670 * unit) | |
6401 | - context.stroke(); | |
6400 | + // context.setLineWidth(1 * unit) | |
6401 | + // context.moveTo(32 * unit, 670 * unit) | |
6402 | + // context.lineTo(520 * unit, 670 * unit) | |
6403 | + // context.stroke(); | |
6402 | 6404 | |
6403 | 6405 | |
6404 | 6406 | context.setFillStyle("black") | ... | ... |
pages/test/test.js deleted
1 | -var ut = require("../../utils/util.js"); | |
2 | -var os=getApp().globalData.setting; | |
3 | - | |
4 | -var regeneratorRuntime = require('../../utils/runtime.js'); | |
5 | - | |
6 | -Page({ | |
7 | - data:{ | |
8 | - store:null, | |
9 | - imghots: os.imghost, | |
10 | - msg:"", | |
11 | - qyid:'wwc96c9375cd8d185a' | |
12 | - }, | |
13 | - | |
14 | - onLoad:function(t){ | |
15 | - | |
16 | - var that=this; | |
17 | - | |
18 | - wx.qy.login({ | |
19 | - success: function (res) { | |
20 | - //var qyid = that.data.qyid; | |
21 | - var req_data = { | |
22 | - js_code: res.code, | |
23 | - //qyid: qyid | |
24 | - }; | |
25 | - | |
26 | - | |
27 | - //调用接口获取userid | |
28 | - getApp().request.promiseGet('/api/weshop/qywechat/getjscode2session', { | |
29 | - data: req_data | |
30 | - }).then(rs => { | |
31 | - if (rs.data.code == 0) { | |
32 | - | |
33 | - | |
34 | - wx.qy.getCurExternalChat ({ | |
35 | - success: function(res) { | |
36 | - var chatId = res.chatId //返回当前外部群的群聊ID | |
37 | - | |
38 | - console.log(chatId); | |
39 | - getApp().confirmBox(chatId+"---"); | |
40 | - | |
41 | - } | |
42 | - }) | |
43 | - | |
44 | - | |
45 | - } | |
46 | - }) | |
47 | - } | |
48 | - }) | |
49 | - }, | |
50 | - | |
51 | - | |
52 | - | |
53 | -}); |
pages/test/test.json deleted
pages/test/test.wxml deleted
pages/test/test.wxss deleted
1 | -.all_page{ | |
2 | - position: fixed; | |
3 | - height: 100%; | |
4 | - width: 100%; | |
5 | - background: #fff; | |
6 | - justify-content: center;/*水平居中*/ | |
7 | -} | |
8 | -.all_page .content{ | |
9 | - font-size: 30rpx; | |
10 | - text-align: center; | |
11 | - height: 400px; | |
12 | - width: 100%; | |
13 | - position: absolute; | |
14 | - top: 50%; | |
15 | - margin-top:-200px; | |
16 | -} | |
17 | -.logo{width: 140rpx; height: 140rpx; border-radius:50% } | |
18 | -.all_page .content .title{ | |
19 | - font-size: 36rpx; margin: 20rpx 0 | |
20 | -} | |
21 | - | |
22 | -.all_page .err{ | |
23 | - color:red; | |
24 | - font-size: 36rpx; | |
25 | - margin-top: 300rpx; | |
26 | -} | |
27 | 0 | \ No newline at end of file |
pages/user/order_detail/order_detail.js
... | ... | @@ -1767,9 +1767,17 @@ Page({ |
1767 | 1767 | |
1768 | 1768 | click_contact:function () { |
1769 | 1769 | getApp().globalData.no_clear=1; |
1770 | + }, | |
1771 | + | |
1772 | + | |
1773 | + //-- 查看物流 -- | |
1774 | + go_wuliu:function (e) { | |
1775 | + getApp().go_wuliu(e); | |
1770 | 1776 | } |
1771 | 1777 | |
1772 | 1778 | |
1773 | 1779 | |
1774 | 1780 | |
1781 | + | |
1782 | + | |
1775 | 1783 | }); |
1776 | 1784 | \ No newline at end of file | ... | ... |
pages/user/order_detail/order_detail.wxml
1 | 1 | <wxs module="filters" src="../../../utils/filter.wxs"></wxs> |
2 | 2 | <view class="container"> |
3 | - <view class="user-mes" wx:if="{{order.exp_type==0}}"> | |
3 | + <view class="user-mes" wx:if="{{order.exp_type==0 || order.exp_type==2 }}"> | |
4 | 4 | <view class="user-contact"> |
5 | 5 | {{order.consignee}}{{' '}}{{order.mobile}} |
6 | 6 | </view> |
... | ... | @@ -175,7 +175,9 @@ |
175 | 175 | <view class="tips-btn" wx:if="{{order.order_status==3}}" bindtap="deleteOrderData" data-order_id="{{order.order_id}}" >删除订单</view> |
176 | 176 | |
177 | 177 | |
178 | - <navigator class="tips-btn" hidden="{{!order.shipping_btn}}" url="/pages/user/express/express?order_id={{order.order_id}}">查看物流</navigator> | |
178 | + <navigator bindtap="go_wuliu" class="tips-btn" hidden="{{!order.shipping_btn}}" | |
179 | + data-order_id="{{order.order_id}}" | |
180 | + data-url="/pages/user/express/express?order_id={{order.order_id}}">查看物流</navigator> | |
179 | 181 | |
180 | 182 | <!---has_rt部分退----> |
181 | 183 | <block wx:if="{{order.return_btn==undefined && order.is_all_return!=1 && order.has_rt!=1}}"> | ... | ... |
pages/user/order_detail/order_detail.wxss
pages/user/order_list/order_list.js
pages/user/order_list/order_list.wxml
... | ... | @@ -245,8 +245,11 @@ |
245 | 245 | <navigator class="commodity_To_evaluate flex-level View_evaluation" wx:if="{{item.is_all_return_status==3 && item.order_status<2}}" url="/pages/order/refund_order/refund_order?order_id={{item.order_id}}">重新退款</navigator> |
246 | 246 | <navigator class="commodity_To_evaluate flex-level View_evaluation" wx:if="{{item.is_all_return_status==0 || item.is_all_return_status==1}}" url="/pages/user/return_goods_info/return_goods_info?order_id={{item.order_id}}">退款详情</navigator> |
247 | 247 | </block> |
248 | - <navigator class="commodity_To_evaluate flex-level View_evaluation" hidden="{{!(item.exp_type==0&&item.pay_status==1&&item.shipping_status==1)}}" url="/pages/user/express/express?order_id={{item.order_id}}">查看物流</navigator> | |
249 | - <navigator class="commodity_To_evaluate flex-level View_evaluation" hidden="{{!(item.exp_type==0&&item.pay_status==1&&item.shipping_status==2)}}" url="/pages/user/express/express?order_id={{item.order_id}}">查看物流</navigator> | |
248 | + | |
249 | + <view bindtap="go_wuliu" class="commodity_To_evaluate flex-level View_evaluation" data-order_id="{{item.order_id}}" | |
250 | + hidden="{{!(item.exp_type==0&&item.pay_status==1&&item.shipping_status==1)}}" data-url="/pages/user/express/express?order_id={{item.order_id}}">查看物流</view> | |
251 | + <view bindtap="go_wuliu" class="commodity_To_evaluate flex-level View_evaluation" data-order_id="{{item.order_id}}" | |
252 | + hidden="{{!(item.exp_type==0&&item.pay_status==1&&item.shipping_status==2)}}" data-url="/pages/user/express/express?order_id={{item.order_id}}">查看物流</view> | |
250 | 253 | |
251 | 254 | <navigator class="commodity_To_evaluate flex-level View_evaluation" url="/packageC/pages/luckyGo/luckyGo_order/luckyGo_order?order_id={{item.order_id}}&&group_id={{item.order_goods[0].prom_id}}" wx:if="{{item.order_goods[0].prom_type==9}}">订单详情</navigator> |
252 | 255 | <navigator class="commodity_To_evaluate flex-level View_evaluation" url="{{item.ord_url}}?order_id={{item.order_id}}" wx:else>订单详情</navigator> | ... | ... |
pages/user/plus/plus.js
... | ... | @@ -66,7 +66,7 @@ Page({ |
66 | 66 | }) |
67 | 67 | |
68 | 68 | |
69 | - //二维码的带入 | |
69 | + //二维码的带入, 生成海报 和 后台plus邀请码 | |
70 | 70 | var fir_leader = options.scene; |
71 | 71 | if (fir_leader){ |
72 | 72 | |
... | ... | @@ -465,8 +465,9 @@ Page({ |
465 | 465 | // }) |
466 | 466 | } else { |
467 | 467 | t_pay.set_pay_url('/api/weshop/plus/create/plus/order'); |
468 | - t_pay.pay(req, th.success, function () { | |
469 | - getApp().my_warnning("支付失败", 0, th); | |
468 | + t_pay.pay(req, th.success, function (msg) { | |
469 | + if(!msg) msg='支付失败'; | |
470 | + getApp().my_warnning(msg, 0, th); | |
470 | 471 | th.setData({ |
471 | 472 | is_select:0, |
472 | 473 | focus:true, |
... | ... | @@ -499,8 +500,10 @@ Page({ |
499 | 500 | }) |
500 | 501 | }else{ |
501 | 502 | t_pay.set_pay_url('/api/weshop/plus/create/plus/order'); |
502 | - t_pay.pay(req, th.success, function () { | |
503 | - getApp().my_warnning("支付失败", 0, th); | |
503 | + t_pay.pay(req, th.success, function (msg) { | |
504 | + if(!msg) msg="支付失败"; | |
505 | + | |
506 | + getApp().my_warnning(msg, 0, th); | |
504 | 507 | th.setData({ |
505 | 508 | is_select:0, |
506 | 509 | focus:true, | ... | ... |