Commit 44dad9ca110f17b6583296e0aceb35815ab74263
1 parent
b4641e4f
1. 分享朋友圈
2. 同城配送
Showing
32 changed files
with
1089 additions
and
269 deletions
packageA/pages/goodsInfo/goodsInfo.js
... | ... | @@ -2932,14 +2932,38 @@ Page({ |
2932 | 2932 | |
2933 | 2933 | onShareTimeline() { |
2934 | 2934 | getApp().globalData.no_clear=1 |
2935 | - var store_name=getApp().globalData.config?getApp().globalData.config.store_name:''; | |
2936 | - if(!store_name) | |
2937 | - store_name=getApp().globalData.setting.appName; | |
2938 | - | |
2939 | - return { | |
2940 | - title:this.data.data.goods_name + '-' + store_name, | |
2941 | - imageUrl:this.data.gallery[0].image_url, | |
2942 | - } | |
2935 | + | |
2936 | + var th = this; | |
2937 | + var price = th.data.data.shop_price; | |
2938 | + if (th.data.prom_act) { | |
2939 | + price = th.data.prom_act.price; | |
2940 | + | |
2941 | + } | |
2942 | + var title= th.data.data.goods_name; | |
2943 | + var img=th.data.data.original_img; | |
2944 | + if(th.data.prom_type==6){ | |
2945 | + title=th.data.prom_act.share_title; | |
2946 | + img=th.data.iurl+th.data.prom_act.share_imgurl; | |
2947 | + } | |
2948 | + | |
2949 | + var url="goods_id=" + th.data.gid; | |
2950 | + if(getApp().globalData.user_id) { | |
2951 | + url+="&first_leader="+getApp().globalData.user_id; | |
2952 | + } | |
2953 | + | |
2954 | + //-- 如果房间分享,且不是会员分享的 -- | |
2955 | + if(getApp().globalData.room_id && | |
2956 | + th.data.data.goods_id==getApp().globalData.room_goods_id && | |
2957 | + !getApp().globalData.room_user_share | |
2958 | + ){ | |
2959 | + url+="&room_id="+getApp().globalData.room_id+"&room_user_share=1"; | |
2960 | + } | |
2961 | + | |
2962 | + return { | |
2963 | + title:price + "元 " +title, | |
2964 | + imageUrl:img, | |
2965 | + query: url | |
2966 | + } | |
2943 | 2967 | }, |
2944 | 2968 | |
2945 | 2969 | ... | ... |
packageA/pages/jfbuy/jfbuy.js
... | ... | @@ -267,23 +267,21 @@ Page({ |
267 | 267 | // } |
268 | 268 | |
269 | 269 | }, |
270 | - | |
271 | - | |
272 | - onShareTimeline() { | |
273 | - getApp().globalData.no_clear=1; | |
274 | - var store_name = getApp().globalData.config ? getApp().globalData.config.store_name:''; | |
275 | - | |
276 | - var pagePath = this.route; //当前页面url | |
277 | - | |
278 | - if(!store_name) store_name = getApp().globalData.setting.appName; | |
279 | - if(pagePath.indexOf('/') != 0) { | |
280 | - pagePath = '/' + pagePath; | |
281 | - } | |
282 | - return { | |
283 | - title: store_name + '-积分购', | |
284 | - path: pagePath, | |
285 | - } | |
286 | - }, | |
270 | + | |
271 | + | |
272 | + onShareTimeline() { | |
273 | + getApp().globalData.no_clear=1; | |
274 | + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name:''; | |
275 | + | |
276 | + var user_id=getApp().globalData.user_id; | |
277 | + if(!user_id) user_id=0; | |
278 | + if(!store_name) store_name = getApp().globalData.setting.appName; | |
279 | + | |
280 | + return { | |
281 | + title: store_name + '-积分购', | |
282 | + query: 'first_leader='+user_id | |
283 | + } | |
284 | + }, | |
287 | 285 | |
288 | 286 | |
289 | 287 | //-- 点击tab -- | ... | ... |
packageA/pages/liveStream/liveStream.js
... | ... | @@ -365,23 +365,18 @@ Page({ |
365 | 365 | } |
366 | 366 | }, |
367 | 367 | |
368 | - onShareTimeline: function (res) { | |
369 | - getApp().globalData.no_clear=1; | |
370 | - if (res.from === 'button') { | |
371 | - // 来自页面内转发按钮 | |
372 | - // console.log(res.target) | |
373 | - } | |
374 | - return { | |
375 | - title: '直播列表' | |
376 | - // path: '/page/user?id=123' | |
377 | - } | |
378 | - }, | |
379 | - | |
380 | - | |
381 | - | |
382 | - | |
383 | - | |
368 | + onShareTimeline: function (res) { | |
369 | + getApp().globalData.no_clear=1; | |
370 | + var user_id=getApp().globalData.user_id; | |
371 | + if(!user_id) user_id=0; | |
372 | + | |
373 | + return { | |
374 | + title: '直播列表', | |
375 | + query: 'first_leader='+user_id | |
376 | + } | |
377 | + }, | |
384 | 378 | |
379 | + | |
385 | 380 | /** |
386 | 381 | * 请求数据 |
387 | 382 | */ | ... | ... |
packageA/pages/liveStreamDetails/liveStreamDetails.js
... | ... | @@ -630,17 +630,17 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un |
630 | 630 | } |
631 | 631 | }, |
632 | 632 | |
633 | - onShareTimeline: function (res) { | |
634 | - getApp().globalData.no_clear=1; | |
635 | - if (res.from === 'button') { | |
636 | - // 来自页面内转发按钮 | |
637 | - console.log(res.target) | |
638 | - } | |
639 | - return { | |
640 | - title: this.data.details.name | |
641 | - // path: '/page/user?id=123' | |
642 | - } | |
643 | - }, | |
633 | + onShareTimeline: function (res) { | |
634 | + getApp().globalData.no_clear=1; | |
635 | + | |
636 | + var user_id=getApp().globalData.user_id; | |
637 | + if(!user_id) user_id=0; | |
638 | + | |
639 | + return { | |
640 | + title: this.data.details.name, | |
641 | + query: 'first_leader='+user_id+"&id="+this.data.id | |
642 | + } | |
643 | + }, | |
644 | 644 | |
645 | 645 | |
646 | 646 | imageResize(imgWidth, imgHeight) { | ... | ... |
packageB/pages/zuhegou/index/index.js
... | ... | @@ -468,18 +468,19 @@ Page({ |
468 | 468 | onShareTimeline() { |
469 | 469 | getApp().globalData.no_clear=1; |
470 | 470 | var title = this.data.act.name; |
471 | - var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id; | |
472 | - if (getApp().globalData.user_id) { | |
473 | - url += "&first_leader=" + getApp().globalData.user_id; | |
474 | - } | |
471 | + | |
472 | + var user_id=getApp().globalData.user_id; | |
473 | + if(!user_id) user_id=0; | |
474 | + | |
475 | 475 | var ob = { |
476 | 476 | title: title, |
477 | - path: url, | |
477 | + query: 'first_leader='+user_id+"&id=" + this.data.act.id | |
478 | 478 | }; |
479 | 479 | if (this.data.act.img_url) |
480 | 480 | ob.imageUrl = this.data.iurl + this.data.act.img_url; |
481 | 481 | return ob; |
482 | 482 | }, |
483 | + | |
483 | 484 | /** |
484 | 485 | * 点击规则详情,弹出规则 |
485 | 486 | */ | ... | ... |
packageB/pages/zuhegou/preindex/index.js
... | ... | @@ -470,18 +470,19 @@ Page({ |
470 | 470 | onShareTimeline() { |
471 | 471 | getApp().globalData.no_clear=1; |
472 | 472 | var title = this.data.act.name; |
473 | - var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id; | |
474 | - if (getApp().globalData.user_id) { | |
475 | - url += "&first_leader=" + getApp().globalData.user_id; | |
476 | - } | |
473 | + | |
474 | + var user_id=getApp().globalData.user_id; | |
475 | + if(!user_id) user_id=0; | |
476 | + | |
477 | 477 | var ob = { |
478 | 478 | title: title, |
479 | - path: url, | |
479 | + query: 'first_leader='+user_id+"&id=" + this.data.act.id | |
480 | 480 | }; |
481 | 481 | if (this.data.act.img_url) |
482 | 482 | ob.imageUrl = this.data.iurl + this.data.act.img_url; |
483 | 483 | return ob; |
484 | 484 | }, |
485 | + | |
485 | 486 | /** |
486 | 487 | * 点击规则详情,弹出规则 |
487 | 488 | */ | ... | ... |
packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
... | ... | @@ -1619,7 +1619,11 @@ Page({ |
1619 | 1619 | break; |
1620 | 1620 | case 1: |
1621 | 1621 | //order_m = o_condition - ord_prom['expression'];//满额优惠金额 |
1622 | - order_prom_amount = ord_prom['expression']; | |
1622 | + var bs=1; | |
1623 | + if(ord_prom.is_bz){ | |
1624 | + bs=Math.floor(o_condition/ord_prom.money); | |
1625 | + } | |
1626 | + order_prom_amount = bs*ord_prom['expression']; | |
1623 | 1627 | break; |
1624 | 1628 | } |
1625 | 1629 | } |
... | ... | @@ -1976,8 +1980,13 @@ Page({ |
1976 | 1980 | order_prom_amount = (o_condition - order_m).toFixed(2); |
1977 | 1981 | break; |
1978 | 1982 | case 1: |
1979 | - order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
1980 | - order_prom_amount = ord_prom['expression']; | |
1983 | + | |
1984 | + var bs=1; | |
1985 | + if(ord_prom.is_bz){ | |
1986 | + bs=Math.floor(o_condition/ord_prom.money); | |
1987 | + } | |
1988 | + order_m = o_condition - bs*ord_prom['expression'];//满额优惠金额 | |
1989 | + order_prom_amount = bs*ord_prom['expression']; | |
1981 | 1990 | break; |
1982 | 1991 | } |
1983 | 1992 | } | ... | ... |
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
... | ... | @@ -242,6 +242,20 @@ Page({ |
242 | 242 | var gd = t.data.data; |
243 | 243 | if (!gd) return false; |
244 | 244 | |
245 | + //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- | |
246 | + if(gd.is_same_city && th.data.is_same_city && gd.whsle_id<=0){ | |
247 | + getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+gg.pick_id, {}).then(res=>{ | |
248 | + if(res.data.code==0){ | |
249 | + var pk=res.data.data; | |
250 | + if(pk && pk.is_same_city){ | |
251 | + th.setData({show_same_city:1}) | |
252 | + }} | |
253 | + | |
254 | + }) | |
255 | + | |
256 | + } | |
257 | + | |
258 | + | |
245 | 259 | t.data.data.original_img = oo.imghost + t.data.data.original_img; |
246 | 260 | t.data.data['buynum'] = gg.goods_num; |
247 | 261 | // console.log(t.data.data); |
... | ... | @@ -406,12 +420,14 @@ Page({ |
406 | 420 | th.data.json_d = json_d; |
407 | 421 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 |
408 | 422 | var is_default_logistics = json_d.is_default_logistics; |
423 | + var is_same_city = json_d.is_same_city; | |
409 | 424 | |
410 | 425 | th.setData({ |
411 | 426 | is_close_quan: json_d.is_close_quan, |
412 | 427 | sales_rules: ee.sales_rules, |
413 | 428 | rank_switch: json_d.rank_switch, |
414 | - is_default_logistics: is_default_logistics | |
429 | + is_default_logistics: is_default_logistics, | |
430 | + is_same_city: is_same_city | |
415 | 431 | }); |
416 | 432 | |
417 | 433 | var rank_switch = json_d.rank_switch; |
... | ... | @@ -499,9 +515,7 @@ Page({ |
499 | 515 | console.log('calculatePrice2'); |
500 | 516 | var th = this, |
501 | 517 | good = this.data.bn_goods; |
502 | - | |
503 | - th.setData({is_show_sub:0}); | |
504 | - | |
518 | + | |
505 | 519 | //-----------计算商品总价-------------- |
506 | 520 | var allpice = th.data.param.goods_price; |
507 | 521 | allpice = parseFloat(allpice).toFixed(2); |
... | ... | @@ -510,6 +524,8 @@ Page({ |
510 | 524 | [txt]: allpice, |
511 | 525 | }); |
512 | 526 | |
527 | + this.setData({sub:1}); | |
528 | + | |
513 | 529 | wx.showLoading({ |
514 | 530 | title: "处理中.", |
515 | 531 | mask:true |
... | ... | @@ -544,8 +560,9 @@ Page({ |
544 | 560 | let item = gd_arr_list[i]; |
545 | 561 | |
546 | 562 | if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { |
547 | - if (goods_weight < 0) goods_weight = 0; | |
563 | + | |
548 | 564 | if (item['exp_sum_type'] == 2) { |
565 | + if (goods_weight < 0) goods_weight = 0; | |
549 | 566 | goods_weight += item['weight'] * item['buynum']; |
550 | 567 | cut_good_weight += item['weight'] * item['buynum']; |
551 | 568 | } |
... | ... | @@ -611,7 +628,7 @@ Page({ |
611 | 628 | wx.showToast({ |
612 | 629 | title: "计算物流错误", icon: 'none',duration: 2000 |
613 | 630 | }) |
614 | - th.setData({ show_submit:0 }); | |
631 | + th.setData({ show_submit:0,sub:0 }); | |
615 | 632 | wx.hideLoading(); |
616 | 633 | } |
617 | 634 | |
... | ... | @@ -622,12 +639,62 @@ Page({ |
622 | 639 | [wl_txt]: shipping_price, |
623 | 640 | }) |
624 | 641 | |
625 | - } else { | |
642 | + } else if(th.data.bn_exp_type==1) { | |
626 | 643 | var wl_txt = "formData.shipping_price"; |
627 | 644 | th.setData({ |
628 | 645 | [wl_txt]: 0, |
629 | 646 | }) |
630 | 647 | } |
648 | + | |
649 | + | |
650 | + //判断是否同城配送,而且没有调用过 | |
651 | + if(th.data.bn_exp_type==2 && th.data.user_addr) { | |
652 | + | |
653 | + var lon=0;var lat=0; | |
654 | + //-- 获取距离 -- | |
655 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { | |
656 | + is_json: 1, data: {address:th.data.user_addr.more_address+th.data.user_addr.address} | |
657 | + }).then(res=>{ | |
658 | + if(res.data.code==0){ | |
659 | + var data= JSON.parse(res.data.data); | |
660 | + if(data.status==0){ | |
661 | + lon=data.result.location.lng; | |
662 | + lat=data.result.location.lat; | |
663 | + } | |
664 | + } | |
665 | + }) | |
666 | + | |
667 | + | |
668 | + var gd_w = good['weight'] * good['buynum']; | |
669 | + //-- 获取距离 -- | |
670 | + var req_data = { | |
671 | + store_id: os.stoid, | |
672 | + order_amount:th.data.param.goods_price, | |
673 | + lon: lon, lat: lat, | |
674 | + pickup_id: th.data.bn_pick, | |
675 | + goods_weight: gd_w | |
676 | + } | |
677 | + | |
678 | + var is_next=1; | |
679 | + //获取同城配送参数 | |
680 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", { | |
681 | + is_json: 1, | |
682 | + data: req_data | |
683 | + }).then(res => { | |
684 | + if (res.data.code == 0) { | |
685 | + var wl_txt = "formData.shipping_price"; | |
686 | + th.setData({ [wl_txt]: res.data.data, }) | |
687 | + }else{ | |
688 | + is_next=0; | |
689 | + wx.showToast({ | |
690 | + title: res.data.msg, icon: 'none', duration: 2000 | |
691 | + }) | |
692 | + } | |
693 | + }) | |
694 | + if(!is_next) return false | |
695 | + } | |
696 | + | |
697 | + | |
631 | 698 | //-----------------总价----------------- |
632 | 699 | // 幸运购 01 |
633 | 700 | // var total_m = parseFloat(allpice) + parseFloat( th.data.formData.shipping_price); |
... | ... | @@ -648,7 +715,7 @@ Page({ |
648 | 715 | th.setData({ |
649 | 716 | [txt]: total_m, |
650 | 717 | [txt2]: 0, |
651 | - is_show_sub:1 | |
718 | + is_show_sub:1,sub:0 | |
652 | 719 | }) |
653 | 720 | } else { |
654 | 721 | order_m = parseFloat(order_m) - parseFloat(th.data.yuer); |
... | ... | @@ -656,14 +723,14 @@ Page({ |
656 | 723 | th.setData({ |
657 | 724 | [txt]: th.data.yuer, |
658 | 725 | [txt2]: order_m, |
659 | - is_show_sub:1 | |
726 | + is_show_sub:1,sub:0 | |
660 | 727 | }) |
661 | 728 | } |
662 | 729 | } else { |
663 | 730 | th.setData({ |
664 | 731 | [txt]: 0, |
665 | 732 | [txt2]: order_m, |
666 | - is_show_sub:1 | |
733 | + is_show_sub:1,sub:0 | |
667 | 734 | }) |
668 | 735 | } |
669 | 736 | wx.hideLoading(); | ... | ... |
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml
... | ... | @@ -10,6 +10,11 @@ |
10 | 10 | |
11 | 11 | <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" |
12 | 12 | data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> |
13 | + | |
14 | + <!-- 同城配送 --> | |
15 | + <block wx:if="{{show_same_city}}"> | |
16 | + <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> | |
17 | + </block> | |
13 | 18 | |
14 | 19 | </view> |
15 | 20 | </view> |
... | ... | @@ -160,7 +165,7 @@ |
160 | 165 | <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> |
161 | 166 | <!-- <view class="co-red big"></view> --> |
162 | 167 | </view> |
163 | - <button class="tips-btn" formType="submit" id="submitOrder">提交订单</button> | |
168 | + <button disabled="{{sub}}" class="tips-btn" formType="submit" id="submitOrder">提交订单</button> | |
164 | 169 | </view> |
165 | 170 | </form> |
166 | 171 | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... | ... | @@ -528,8 +528,9 @@ Page({ |
528 | 528 | }); |
529 | 529 | |
530 | 530 | //更新点击量 |
531 | - getApp().request.put("/api/weshop/goods/updateClick", { | |
532 | - data: { store_id: os.stoid, goods_id: gid } | |
531 | + //noinspection JSUnresolvedFunction | |
532 | + getApp().request.put("/api/weshop/goods/updateClick", { | |
533 | + data: { store_id: os.stoid, goods_id: gid,user_id:getApp().globalData.user_id?getApp().globalData.user_id:0 } | |
533 | 534 | }); |
534 | 535 | |
535 | 536 | |
... | ... | @@ -2450,14 +2451,15 @@ Page({ |
2450 | 2451 | if (pagePath.indexOf('/') != 0) { |
2451 | 2452 | pagePath = '/' + pagePath; |
2452 | 2453 | } |
2453 | - // if(getApp().globalData.user_id){ | |
2454 | 2454 | |
2455 | - // if(pagePath.indexOf("?")>0){ | |
2456 | - // pagePath+="&first_leader="+getApp().globalData.user_id; | |
2457 | - // }else{ | |
2458 | - // pagePath+="?first_leader="+getApp().globalData.user_id; | |
2459 | - // } | |
2460 | - // } | |
2455 | + if(getApp().globalData.user_id){ | |
2456 | + if(pagePath.indexOf("?")>0){ | |
2457 | + pagePath+="&first_leader="+getApp().globalData.user_id; | |
2458 | + }else{ | |
2459 | + pagePath+="?first_leader="+getApp().globalData.user_id; | |
2460 | + } | |
2461 | + } | |
2462 | + | |
2461 | 2463 | return { |
2462 | 2464 | title: "邀您一起参加幸运购", |
2463 | 2465 | path: pagePath, |
... | ... | @@ -6197,12 +6199,19 @@ Page({ |
6197 | 6199 | |
6198 | 6200 | onShareTimeline() { |
6199 | 6201 | getApp().globalData.no_clear=1; |
6200 | - var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | |
6201 | - if (!store_name) | |
6202 | - store_name = getApp().globalData.setting.appName; | |
6202 | + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | |
6203 | + if (!store_name) | |
6204 | + store_name = getApp().globalData.setting.appName; | |
6205 | + | |
6206 | + var pagePath = `goods_id=${this.data.sele_g.goods_id}&prom_type=9&group_id=${this.data.group_id}`; //当前页面url | |
6207 | + if(getApp().globalData.user_id){ | |
6208 | + pagePath+="&first_leader="+getApp().globalData.user_id; | |
6209 | + } | |
6210 | + | |
6203 | 6211 | return { |
6204 | 6212 | title: this.data.data.goods_name + '-' + store_name, |
6205 | 6213 | imageUrl: this.data.gallery[0].image_url, |
6214 | + query: pagePath | |
6206 | 6215 | } |
6207 | 6216 | }, |
6208 | 6217 | ... | ... |
packageC/pages/presell/cart/cart.js
... | ... | @@ -205,12 +205,14 @@ Page({ |
205 | 205 | th.data.json_d = json_d; |
206 | 206 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 |
207 | 207 | var is_default_logistics = json_d.is_default_logistics; |
208 | + var is_same_city = json_d.is_same_city; | |
208 | 209 | |
209 | 210 | th.setData({ |
210 | 211 | is_close_quan: json_d.is_close_quan, |
211 | 212 | sales_rules: ee.sales_rules, |
212 | 213 | rank_switch: json_d.rank_switch, |
213 | 214 | is_default_logistics: is_default_logistics, |
215 | + is_same_city: is_same_city, | |
214 | 216 | sys_switch: json_d, |
215 | 217 | }); |
216 | 218 | |
... | ... | @@ -500,6 +502,21 @@ Page({ |
500 | 502 | order.show_img = oo.imghost + goods.original_img; |
501 | 503 | }); |
502 | 504 | |
505 | + //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- | |
506 | + if(goods.is_same_city && th.data.is_same_city && goods.whsle_id<=0){ | |
507 | + | |
508 | + getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+order.pickup_id, {}).then(res=>{ | |
509 | + if(res.data.code==0){ | |
510 | + var pk=res.data.data; | |
511 | + if(pk && pk.is_same_city){ | |
512 | + th.setData({show_same_city:1}) | |
513 | + } | |
514 | + } | |
515 | + | |
516 | + }) | |
517 | + | |
518 | + } | |
519 | + | |
503 | 520 | |
504 | 521 | var g_url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + order_goods.goods_id + "&pre_id=" + pre_arr.id; |
505 | 522 | if (act.is_end || th.data.act.end_time < ut.gettimestamp()) { |
... | ... | @@ -590,6 +607,11 @@ Page({ |
590 | 607 | break; //物流 |
591 | 608 | } |
592 | 609 | |
610 | + if (th.data.exp_type) { | |
611 | + exp_type=th.data.exp_type | |
612 | + } | |
613 | + | |
614 | + | |
593 | 615 | //等待发货的时候 |
594 | 616 | if (th.data.wait_fh) { |
595 | 617 | var send_time = th.data.act.delivery_date; |
... | ... | @@ -629,12 +651,16 @@ Page({ |
629 | 651 | async calculatePrice2() { |
630 | 652 | var th = this; |
631 | 653 | if (!this.data.pre_arr) return false; |
632 | - th.setData({ show_submit: 0,}) | |
654 | + th.setData({ show_submit: 0,disabled_btn:0}) | |
633 | 655 | |
634 | 656 | //--计算物流-- |
635 | 657 | if (this.data.exp_type == 0) { |
636 | 658 | this.calculate_wuliu(); |
637 | - } else { | |
659 | + }else if (this.data.exp_type == 2) { | |
660 | + this.calculate_same_city(); | |
661 | + } | |
662 | + | |
663 | + else { | |
638 | 664 | var allpice = this.data.pre_arr.presell_price * this.data.order_goods.goods_num; |
639 | 665 | allpice = allpice.toFixed(2); |
640 | 666 | //--看一下有没有订单优惠-- |
... | ... | @@ -698,8 +724,14 @@ Page({ |
698 | 724 | order_prom_amount = (all_1 - o_condition1).toFixed(2); |
699 | 725 | break; |
700 | 726 | case 1: |
701 | - o_condition1 = ord_price - ord_prom['expression'];//满额优惠金额 | |
702 | - order_prom_amount = ord_prom['expression']; | |
727 | + | |
728 | + var bs=1; | |
729 | + if(ord_prom.is_bz){ | |
730 | + bs=Math.floor(o_condition/ord_prom.money); | |
731 | + } | |
732 | + | |
733 | + o_condition1 = ord_price - bs*ord_prom['expression'];//满额优惠金额 | |
734 | + order_prom_amount = bs*ord_prom['expression']; | |
703 | 735 | break; |
704 | 736 | } |
705 | 737 | } |
... | ... | @@ -1824,8 +1856,9 @@ Page({ |
1824 | 1856 | let item = gd_arr_list[i]; |
1825 | 1857 | |
1826 | 1858 | if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { |
1827 | - if (goods_weight < 0) goods_weight = 0; | |
1859 | + | |
1828 | 1860 | if (item['exp_sum_type'] == 2) { |
1861 | + if (goods_weight < 0) goods_weight = 0; | |
1829 | 1862 | goods_weight += item['weight'] * item['buynum']; |
1830 | 1863 | cut_good_weight += item['weight'] * item['buynum']; |
1831 | 1864 | } |
... | ... | @@ -1908,6 +1941,118 @@ Page({ |
1908 | 1941 | } |
1909 | 1942 | //}); |
1910 | 1943 | }, |
1944 | + async calculate_same_city() { | |
1945 | + var th = this, | |
1946 | + good = th.data.goods, | |
1947 | + quan_price = 0, | |
1948 | + exp_price = 0; | |
1949 | + | |
1950 | + var quan_no = null; | |
1951 | + var bn_pick = th.data.pickup.pickup_id; | |
1952 | + var allpice = th.data.all_price; | |
1953 | + | |
1954 | + good.buynum=th.data.order.order_goods.goods_num; | |
1955 | + | |
1956 | + if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined) | |
1957 | + quan_no = th.data.using_quan[bn_pick].coupon_no; | |
1958 | + | |
1959 | + if (quan_no) { | |
1960 | + if (th.data.using_quan[bn_pick].isby != 1) { | |
1961 | + //---获取优惠券优惠--- | |
1962 | + await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", { | |
1963 | + data: { | |
1964 | + storeId: oo.stoid, | |
1965 | + CashRepNo: quan_no, | |
1966 | + WaresSum: th.data.ckeck_quan_price, | |
1967 | + WareIds: th.data.check_quan_ware_list | |
1968 | + } | |
1969 | + }).then(res => { | |
1970 | + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | |
1971 | + quan_price = res.data.data[0].WareCashSum; | |
1972 | + } | |
1973 | + }) | |
1974 | + | |
1975 | + if (quan_price > 0) { | |
1976 | + if (quan_price < th.data.tail_pay) th.setData({ quan_price: quan_price }) | |
1977 | + else { | |
1978 | + th.setData({ quan_price: th.data.tail_pay }) | |
1979 | + quan_price = th.data.tail_pay; | |
1980 | + } | |
1981 | + } else { | |
1982 | + th.setData({ quan_price: 0 }) | |
1983 | + } | |
1984 | + } else { | |
1985 | + th.setData({ quan_price: 0 }) | |
1986 | + } | |
1987 | + } else { | |
1988 | + th.setData({ quan_price: 0 }) | |
1989 | + } | |
1990 | + | |
1991 | + //-----------当地址不为空,且是物流时,计算物流费用---------- | |
1992 | + if (th.data.user_addr != null) { | |
1993 | + //看是不是有调用过包邮券,如果活动可以使用优化券的情况下 | |
1994 | + | |
1995 | + | |
1996 | + //--------------开始计算物流------------------ | |
1997 | + var shipping_price =0; | |
1998 | + var lon=0;var lat=0; | |
1999 | + //-- 获取距离 -- | |
2000 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { | |
2001 | + is_json: 1, data: {address:th.data.user_addr.more_address+th.data.user_addr.address} | |
2002 | + }).then(res=>{ | |
2003 | + if(res.data.code==0){ | |
2004 | + var data= JSON.parse(res.data.data); | |
2005 | + if(data.status==0){ | |
2006 | + lon=data.result.location.lng; | |
2007 | + lat=data.result.location.lat; | |
2008 | + } | |
2009 | + } | |
2010 | + }) | |
2011 | + | |
2012 | + | |
2013 | + var gd_w = good['weight'] * good['buynum']; | |
2014 | + //-- 获取距离 -- | |
2015 | + var req_data = { | |
2016 | + store_id: os.stoid, | |
2017 | + order_amount: allpice, | |
2018 | + lon: lon, lat: lat, | |
2019 | + pickup_id: bn_pick, | |
2020 | + goods_weight: gd_w | |
2021 | + } | |
2022 | + | |
2023 | + var is_next=1; | |
2024 | + //获取同城配送参数 | |
2025 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", { | |
2026 | + is_json: 1, | |
2027 | + data: req_data | |
2028 | + }).then(res => { | |
2029 | + if (res.data.code == 0) { | |
2030 | + shipping_price= res.data.data; | |
2031 | + }else{ | |
2032 | + is_next=0; | |
2033 | + wx.showToast({ | |
2034 | + title: res.data.msg, icon: 'none', duration: 2000 | |
2035 | + }) | |
2036 | + } | |
2037 | + }) | |
2038 | + if(!is_next){ | |
2039 | + th.setData({show_submit:1,disabled_btn:1}) | |
2040 | + return false | |
2041 | + } | |
2042 | + exp_price = parseFloat(shipping_price).toFixed(2); | |
2043 | + th.wuliu_next(allpice, quan_price, exp_price); | |
2044 | + } else { | |
2045 | + wx.showToast({ | |
2046 | + title: '请先选择收货地址', icon: 'none', duration: 2000 | |
2047 | + }) | |
2048 | + return false; | |
2049 | + } | |
2050 | + //}); | |
2051 | + }, | |
2052 | + | |
2053 | + | |
2054 | + | |
2055 | + | |
1911 | 2056 | //相同的东西统一在一起 |
1912 | 2057 | wuliu_next(allpice, quan_price, exp_price) { |
1913 | 2058 | var th = this; | ... | ... |
packageC/pages/presell/cart/cart.wxml
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | <wxs src="filter.wxs" module="util"></wxs> |
3 | 3 | <wxs module="filters" src="../../../../utils/filter.wxs"></wxs> |
4 | 4 | |
5 | -<form bindsubmit="submitForm" wx:if="{{show_submit}}"> | |
5 | +<form bindsubmit="submitForm"> | |
6 | 6 | <view class="container"> |
7 | 7 | <!-- 支付进度 --> |
8 | 8 | <view class="information bdr14 mgt20"> |
... | ... | @@ -120,6 +120,12 @@ |
120 | 120 | class="tab {{exp_type== 0 ? 'active':''}}" |
121 | 121 | data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}">快递邮寄 |
122 | 122 | </view> |
123 | + | |
124 | + <!-- 同城配送 --> | |
125 | + <block wx:if="{{show_same_city}}"> | |
126 | + <view bindtap='set_wuliu' data-type='2' class="tab {{exp_type== 2 ? 'active':''}}" | |
127 | + data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}">同城配送</view> | |
128 | + </block> | |
123 | 129 | </view> |
124 | 130 | <!----要进行判断地址是否显示----> |
125 | 131 | <view bindtap="enterAddressPage" class="user-mes mgt20" |
... | ... | @@ -359,7 +365,7 @@ |
359 | 365 | 请于{{days}}天{{hours}}小时{{minutes}}分{{seconds}}秒内付款完成,超时订单将自动取消 |
360 | 366 | </view> |
361 | 367 | |
362 | - <view class="btn-wrap"> | |
368 | + <view class="btn-wrap" hidden="{{disabled_btn}}"> | |
363 | 369 | <view class="pay-amount"> |
364 | 370 | <view class="payable">应付金额: |
365 | 371 | <text class="co-red"> <text class="fs24">¥</text>{{filters.toFix(order_m,2)}}</text> | ... | ... |
packageC/pages/presell/cart/cart2.js
... | ... | @@ -153,9 +153,7 @@ Page({ |
153 | 153 | //----------子页返回父页触发---------- |
154 | 154 | onShow: function () { |
155 | 155 | var th = this; |
156 | - th.setData({ show_submit: 0 }); //让提交先掩藏 | |
157 | 156 | th.data.g_cart_q_time = null; |
158 | - | |
159 | 157 | if (th.data.isclose == 0) { |
160 | 158 | wx.navigateTo({ |
161 | 159 | url: "/pages/index/index/index" |
... | ... | @@ -217,12 +215,14 @@ Page({ |
217 | 215 | th.data.json_d = json_d; |
218 | 216 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 |
219 | 217 | var is_default_logistics = json_d.is_default_logistics; |
218 | + var is_same_city = json_d.is_same_city; | |
220 | 219 | |
221 | 220 | th.setData({ |
222 | 221 | is_close_quan: json_d.is_close_quan, |
223 | 222 | sales_rules: ee.sales_rules, |
224 | 223 | rank_switch: json_d.rank_switch, |
225 | - is_default_logistics: is_default_logistics | |
224 | + is_default_logistics: is_default_logistics, | |
225 | + is_same_city: is_same_city | |
226 | 226 | }); |
227 | 227 | |
228 | 228 | var rank_switch = json_d.rank_switch; |
... | ... | @@ -384,6 +384,21 @@ Page({ |
384 | 384 | var gd = t.data.data; |
385 | 385 | if (!gd) return false; |
386 | 386 | |
387 | + //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- | |
388 | + if(gd.is_same_city && th.data.is_same_city && gd.whsle_id<=0){ | |
389 | + | |
390 | + getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+th.data.gg.pick_id, {}).then(res=>{ | |
391 | + if(res.data.code==0){ | |
392 | + var pk=res.data.data; | |
393 | + if(pk && pk.is_same_city){ | |
394 | + th.setData({show_same_city:1}) | |
395 | + } | |
396 | + } | |
397 | + | |
398 | + }) | |
399 | + | |
400 | + } | |
401 | + | |
387 | 402 | t.data.data.original_img = oo.imghost + t.data.data.original_img; |
388 | 403 | t.data.data['buynum'] = th.data.gg.goods_num; |
389 | 404 | var distr_t = 0, et = 0 |
... | ... | @@ -581,6 +596,8 @@ Page({ |
581 | 596 | return false; |
582 | 597 | } |
583 | 598 | |
599 | + th.setData({dis_btn:1}) | |
600 | + | |
584 | 601 | wx.showLoading({ |
585 | 602 | title: "处理中.",mask:true |
586 | 603 | }) |
... | ... | @@ -699,8 +716,9 @@ Page({ |
699 | 716 | let item = gd_arr_list[i]; |
700 | 717 | |
701 | 718 | if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { |
702 | - if (goods_weight < 0) goods_weight = 0; | |
719 | + | |
703 | 720 | if (item['exp_sum_type'] == 2) { |
721 | + if (goods_weight < 0) goods_weight = 0; | |
704 | 722 | cut_good_weight += item['weight'] * item['buynum']; |
705 | 723 | goods_weight += item['weight'] * item['buynum']; |
706 | 724 | |
... | ... | @@ -785,7 +803,7 @@ Page({ |
785 | 803 | var wl_txt = "formData.shipping_price"; |
786 | 804 | th.setData({[wl_txt]: shipping_price,}) |
787 | 805 | |
788 | - } else { | |
806 | + } else if(th.data.bn_exp_type==1) { | |
789 | 807 | var wl_txt = "formData.shipping_price"; |
790 | 808 | th.setData({ [wl_txt]: 0, }) |
791 | 809 | } |
... | ... | @@ -807,6 +825,55 @@ Page({ |
807 | 825 | } |
808 | 826 | //--看一下有没有订单优惠-- |
809 | 827 | var o_condition = parseFloat(order_m); |
828 | + | |
829 | + //判断是否同城配送,而且没有调用过 | |
830 | + if(th.data.bn_exp_type==2 && th.data.user_addr) { | |
831 | + | |
832 | + var lon=0;var lat=0; | |
833 | + //-- 获取距离 -- | |
834 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { | |
835 | + is_json: 1, data: {address:th.data.user_addr.more_address+th.data.user_addr.address} | |
836 | + }).then(res=>{ | |
837 | + if(res.data.code==0){ | |
838 | + var data= JSON.parse(res.data.data); | |
839 | + if(data.status==0){ | |
840 | + lon=data.result.location.lng; | |
841 | + lat=data.result.location.lat; | |
842 | + } | |
843 | + } | |
844 | + }) | |
845 | + | |
846 | + | |
847 | + var gd_w = good['weight'] * good['buynum']; | |
848 | + //-- 获取距离 -- | |
849 | + var req_data = { | |
850 | + store_id: os.stoid, | |
851 | + order_amount: order_m, | |
852 | + lon: lon, lat: lat, | |
853 | + pickup_id: bn_pick, | |
854 | + goods_weight: gd_w | |
855 | + } | |
856 | + | |
857 | + var is_next=1; | |
858 | + //获取同城配送参数 | |
859 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", { | |
860 | + is_json: 1, | |
861 | + data: req_data | |
862 | + }).then(res => { | |
863 | + if (res.data.code == 0) { | |
864 | + var wl_txt = "formData.shipping_price"; | |
865 | + th.setData({ [wl_txt]: res.data.data, }) | |
866 | + }else{ | |
867 | + is_next=0; | |
868 | + wx.showToast({ | |
869 | + title: res.data.msg, icon: 'none', duration: 2000 | |
870 | + }) | |
871 | + } | |
872 | + }) | |
873 | + if(!is_next) return false | |
874 | + } | |
875 | + | |
876 | + | |
810 | 877 | if (o_condition > 0 && th.data.act.is_useorderyh) { |
811 | 878 | th.check_is_order_prom(o_condition, function () { |
812 | 879 | var order_prom_amount = 0; |
... | ... | @@ -821,8 +888,14 @@ Page({ |
821 | 888 | order_prom_amount = (o_condition - order_m).toFixed(2); |
822 | 889 | break; |
823 | 890 | case 1: |
824 | - order_m = o_condition - ord_prom['expression'];//满额优惠金额 | |
825 | - order_prom_amount = ord_prom['expression']; | |
891 | + | |
892 | + var bs=1; | |
893 | + if(ord_prom.is_bz){ | |
894 | + bs=Math.floor(o_condition/ord_prom.money); | |
895 | + } | |
896 | + | |
897 | + order_m = o_condition - bs*ord_prom['expression'];//满额优惠金额 | |
898 | + order_prom_amount = bs*ord_prom['expression']; | |
826 | 899 | break; |
827 | 900 | } |
828 | 901 | } |
... | ... | @@ -851,14 +924,14 @@ Page({ |
851 | 924 | if (th.data.bn_use_money == 1) { |
852 | 925 | if (amoney > order_m) { |
853 | 926 | order_m = parseFloat(order_m).toFixed(2); |
854 | - th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 }) | |
927 | + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1,dis_btn:0 }) | |
855 | 928 | } else { |
856 | 929 | order_m = parseFloat(order_m) - parseFloat(amoney); |
857 | 930 | order_m = order_m.toFixed(2); |
858 | - th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) | |
931 | + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1,dis_btn:0 }) | |
859 | 932 | } |
860 | 933 | } else { |
861 | - th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) | |
934 | + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1,dis_btn:0 }) | |
862 | 935 | } |
863 | 936 | //优惠活动送积分 |
864 | 937 | if (good.s_intValue) { |
... | ... | @@ -906,14 +979,14 @@ Page({ |
906 | 979 | if (th.data.bn_use_money == 1) { |
907 | 980 | if (amoney > order_m) { |
908 | 981 | order_m = parseFloat(order_m).toFixed(2); |
909 | - th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1 }) | |
982 | + th.setData({ [txt]: order_m, [txt2]: 0, [txt3]: coupon_price, show_submit: 1,dis_btn:0 }) | |
910 | 983 | } else { |
911 | 984 | order_m = parseFloat(order_m) - parseFloat(amoney); |
912 | 985 | order_m = order_m.toFixed(2); |
913 | - th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) | |
986 | + th.setData({ [txt]: amoney, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1,dis_btn:0 }) | |
914 | 987 | } |
915 | 988 | } else { |
916 | - th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1 }) | |
989 | + th.setData({ [txt]: 0, [txt2]: order_m, [txt3]: coupon_price, show_submit: 1,dis_btn:0 }) | |
917 | 990 | } |
918 | 991 | //优惠活动送积分 |
919 | 992 | if (good.s_intValue) { | ... | ... |
packageC/pages/presell/cart/cart2.wxml
... | ... | @@ -13,6 +13,10 @@ |
13 | 13 | |
14 | 14 | <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" |
15 | 15 | data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> |
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> | |
16 | 20 | |
17 | 21 | </view> |
18 | 22 | </view> |
... | ... | @@ -239,7 +243,7 @@ |
239 | 243 | <view class="pay-amount"> |
240 | 244 | <view class="payable">应付金额:<text class="co-red"><text class="fs24">¥</text>{{formData.order_amount}}</text></view> |
241 | 245 | </view> |
242 | - <button class="tips-btn" formType="submit" id="submitOrder">提交订单</button> | |
246 | + <button disabled="{{dis_btn}}" class="tips-btn" formType="submit" id="submitOrder">提交订单</button> | |
243 | 247 | </view> |
244 | 248 | </form> |
245 | 249 | ... | ... |
packageC/pages/presell/goodsInfo/goodsInfo.js
... | ... | @@ -431,7 +431,7 @@ Page({ |
431 | 431 | |
432 | 432 | //更新点击量 |
433 | 433 | getApp().request.put("/api/weshop/goods/updateClick", { |
434 | - data: { store_id: os.stoid, goods_id: gid } | |
434 | + data: { store_id: os.stoid, goods_id: gid,user_id:getApp().globalData.user_id?getApp().globalData.user_id:0 } | |
435 | 435 | }) |
436 | 436 | }, |
437 | 437 | |
... | ... | @@ -3832,17 +3832,33 @@ Page({ |
3832 | 3832 | getApp().pre_img(this.data.shareImgPath); |
3833 | 3833 | }, |
3834 | 3834 | |
3835 | + onShareTimeline() { | |
3836 | + getApp().globalData.no_clear=1; | |
3835 | 3837 | |
3836 | - onShareTimeline() { | |
3837 | - getApp().globalData.no_clear=1; | |
3838 | - var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | |
3839 | - if (!store_name) | |
3840 | - store_name = getApp().globalData.setting.appName; | |
3841 | - return { | |
3842 | - title: this.data.data.goods_name + '-' + store_name, | |
3843 | - imageUrl: this.data.gallery[0].image_url, | |
3844 | - } | |
3845 | - }, | |
3838 | + var th=this; | |
3839 | + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | |
3840 | + if (!store_name) | |
3841 | + store_name = getApp().globalData.setting.appName; | |
3842 | + | |
3843 | + var url = "goods_id=" + th.data.gid+"&pre_id="+th.data.pre_arr.id; | |
3844 | + if (getApp().globalData.user_id) { | |
3845 | + url += "&first_leader=" + getApp().globalData.user_id; | |
3846 | + } | |
3847 | + | |
3848 | + //-- 如果房间分享,且不是会员分享的 -- | |
3849 | + if (getApp().globalData.room_id && | |
3850 | + th.data.data.goods_id == getApp().globalData.room_goods_id && | |
3851 | + !getApp().globalData.room_user_share | |
3852 | + ) { | |
3853 | + url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1"; | |
3854 | + } | |
3855 | + | |
3856 | + return { | |
3857 | + title: this.data.data.goods_name + '-' + store_name, | |
3858 | + imageUrl: this.data.gallery[0].image_url, | |
3859 | + query: url | |
3860 | + } | |
3861 | + }, | |
3846 | 3862 | |
3847 | 3863 | clickCollapse() { |
3848 | 3864 | this.setData({ flag: !this.data.flag, }) | ... | ... |
packageC/pages/presell/pregoodsInfo/goodsInfo.js
... | ... | @@ -425,7 +425,7 @@ Page({ |
425 | 425 | }); |
426 | 426 | //更新点击量 |
427 | 427 | getApp().request.put("/api/weshop/goods/updateClick", { |
428 | - data: { store_id: os.stoid, goods_id: gid } | |
428 | + data: { store_id: os.stoid, goods_id: gid,user_id:getApp().globalData.user_id?getApp().globalData.user_id:0 } | |
429 | 429 | }) |
430 | 430 | }, |
431 | 431 | |
... | ... | @@ -3801,17 +3801,35 @@ Page({ |
3801 | 3801 | getApp().pre_img(this.data.shareImgPath); |
3802 | 3802 | }, |
3803 | 3803 | |
3804 | + onShareTimeline() { | |
3805 | + getApp().globalData.no_clear=1; | |
3804 | 3806 | |
3805 | - onShareTimeline() { | |
3806 | - getApp().globalData.no_clear=1; | |
3807 | - var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | |
3808 | - if (!store_name) | |
3809 | - store_name = getApp().globalData.setting.appName; | |
3810 | - return { | |
3811 | - title: this.data.data.goods_name + '-' + store_name, | |
3812 | - imageUrl: this.data.gallery[0].image_url, | |
3813 | - } | |
3814 | - }, | |
3807 | + var th=this; | |
3808 | + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | |
3809 | + if (!store_name) | |
3810 | + store_name = getApp().globalData.setting.appName; | |
3811 | + | |
3812 | + | |
3813 | + var url = "goods_id=" + th.data.gid+"&pre_id="+th.data.pre_arr.id; | |
3814 | + if (getApp().globalData.user_id) { | |
3815 | + url += "&first_leader=" + getApp().globalData.user_id; | |
3816 | + } | |
3817 | + | |
3818 | + //-- 如果房间分享,且不是会员分享的 -- | |
3819 | + if (getApp().globalData.room_id && | |
3820 | + th.data.data.goods_id == getApp().globalData.room_goods_id && | |
3821 | + !getApp().globalData.room_user_share | |
3822 | + ) { | |
3823 | + url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1"; | |
3824 | + } | |
3825 | + | |
3826 | + | |
3827 | + return { | |
3828 | + title: this.data.data.goods_name + '-' + store_name, | |
3829 | + imageUrl: this.data.gallery[0].image_url, | |
3830 | + query: url | |
3831 | + } | |
3832 | + }, | |
3815 | 3833 | |
3816 | 3834 | clickCollapse() { |
3817 | 3835 | this.setData({ flag: !this.data.flag, }) | ... | ... |
pages/activity/pind_list/pind_list.js
... | ... | @@ -249,15 +249,20 @@ Page({ |
249 | 249 | } |
250 | 250 | }, |
251 | 251 | |
252 | - onShareTimeline() { | |
253 | - getApp().globalData.no_clear=1; | |
254 | - var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | |
255 | - if (!store_name) | |
256 | - store_name = getApp().globalData.setting.appName; | |
257 | - return { | |
258 | - title: '秒杀活动-' + store_name, | |
259 | - } | |
260 | - }, | |
252 | + onShareTimeline() { | |
253 | + getApp().globalData.no_clear=1; | |
254 | + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | |
255 | + if (!store_name) | |
256 | + store_name = getApp().globalData.setting.appName; | |
257 | + var user_id=getApp().globalData.user_id; | |
258 | + if(!user_id) user_id=0; | |
259 | + return { | |
260 | + title: '拼团活动-' + store_name, | |
261 | + query: 'first_leader='+user_id | |
262 | + | |
263 | + } | |
264 | + }, | |
265 | + | |
261 | 266 | go_url(e){ |
262 | 267 | let url=e.currentTarget.dataset.url; |
263 | 268 | if(url){ | ... | ... |
pages/activity/seckill_list/seckill_list.js
... | ... | @@ -267,15 +267,20 @@ Page({ |
267 | 267 | } |
268 | 268 | }, |
269 | 269 | |
270 | - onShareTimeline() { | |
271 | - getApp().globalData.no_clear=1; | |
272 | - var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | |
273 | - if (!store_name) | |
274 | - store_name = getApp().globalData.setting.appName; | |
275 | - return { | |
276 | - title: '秒杀活动-' + store_name, | |
277 | - } | |
278 | - }, | |
270 | + onShareTimeline() { | |
271 | + getApp().globalData.no_clear=1; | |
272 | + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | |
273 | + if (!store_name) | |
274 | + store_name = getApp().globalData.setting.appName; | |
275 | + | |
276 | + var user_id=getApp().globalData.user_id; | |
277 | + if(!user_id) user_id=0; | |
278 | + | |
279 | + return { | |
280 | + title: '秒杀活动-' + store_name, | |
281 | + query: 'first_leader='+user_id | |
282 | + } | |
283 | + }, | |
279 | 284 | |
280 | 285 | imageLoad: function (e) { |
281 | 286 | var imgwidth = e.detail.width; | ... | ... |
pages/cart/cart2/cart2.js
... | ... | @@ -180,7 +180,6 @@ Page({ |
180 | 180 | //----------子页返回父页触发---------- |
181 | 181 | onShow: function () { |
182 | 182 | var th = this; |
183 | - th.setData({ show_submit: 0 }); //让提交先掩藏 | |
184 | 183 | th.data.g_cart_q_time = null; |
185 | 184 | |
186 | 185 | if (th.data.isclose == 0) { |
... | ... | @@ -243,12 +242,14 @@ Page({ |
243 | 242 | th.data.json_d = json_d; |
244 | 243 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 |
245 | 244 | var is_default_logistics = json_d.is_default_logistics; |
245 | + var is_same_city = json_d.is_same_city; | |
246 | 246 | |
247 | 247 | th.setData({ |
248 | 248 | is_close_quan: json_d.is_close_quan, |
249 | 249 | sales_rules: ee.sales_rules, |
250 | 250 | rank_switch: json_d.rank_switch, |
251 | - is_default_logistics: is_default_logistics | |
251 | + is_default_logistics: is_default_logistics, | |
252 | + is_same_city: is_same_city, | |
252 | 253 | }); |
253 | 254 | |
254 | 255 | var rank_switch = json_d.rank_switch; |
... | ... | @@ -369,23 +370,20 @@ Page({ |
369 | 370 | th.setData({ user_addr: addr }); |
370 | 371 | //--------------------------立即购买------------------ |
371 | 372 | if (ta.is_bnow == 1) { |
372 | - console.log('is_bnow'); | |
373 | 373 | //读取门店 |
374 | - to.get_allsto(function (e) { | |
375 | - th.setData({ allsto: e }); | |
374 | + //to.get_allsto(function (e) { | |
375 | + //th.setData({ allsto: e }); | |
376 | 376 | //获取立即购买的商品信息 |
377 | 377 | th.get_buy_goods(ta.goods_id); |
378 | - }); | |
378 | + //}); | |
379 | 379 | } else { |
380 | 380 | //------------------------购物车结算---------------------- |
381 | 381 | //读取门店 |
382 | - to.get_allsto(function (e) { | |
383 | - th.setData({ allsto: e }); | |
384 | - //-------获取购物车已经选择的商品-------- | |
385 | - console.log('购物车结算'); | |
386 | - | |
382 | + //to.get_allsto(function (e) { | |
383 | + //th.setData({ allsto: e }); | |
384 | + //-------获取购物车已经选择的商品-------- | |
387 | 385 | th.get_cart(); |
388 | - }) | |
386 | + //}) | |
389 | 387 | } |
390 | 388 | }); |
391 | 389 | |
... | ... | @@ -421,6 +419,23 @@ Page({ |
421 | 419 | //按门店分类的数组 |
422 | 420 | var arr = new Array(); |
423 | 421 | var carr = su.data.data.pageData; |
422 | + | |
423 | + //-- 找出所有的门店 -- | |
424 | + var pick_id_arr=[]; var len=carr.length; | |
425 | + for(var i=0;i<len;i++){ | |
426 | + if(pick_id_arr.length==0 || pick_id_arr.indexOf(carr[i].pick_id)==-1) | |
427 | + pick_id_arr.push(carr[i].pick_id); | |
428 | + } | |
429 | + var req_d={ | |
430 | + store_id:os.stoid,ids:pick_id_arr.join(',') | |
431 | + } | |
432 | + //-- 获取门店的列表 -- | |
433 | + await getApp().request.promiseGet("/api/weshop/pickup/list", {data:req_d }).then(res=>{ | |
434 | + if(ut.ajax_ok(res)){ | |
435 | + th.data.allsto=res.data.data.pageData; | |
436 | + } | |
437 | + }) | |
438 | + | |
424 | 439 | th.data.cartlist_y = carr; //存储原始购物车列表 |
425 | 440 | th.data.in_zhact_gdmap = {}; |
426 | 441 | |
... | ... | @@ -702,13 +717,13 @@ Page({ |
702 | 717 | user_money: 0, |
703 | 718 | total_amount: 0, |
704 | 719 | order_amount: 0, |
705 | - user_note: "" | |
720 | + user_note: "", | |
721 | + sto:sto | |
706 | 722 | }; |
707 | 723 | |
708 | 724 | //-- 把等级卡会优惠多少钱装进去 -- |
709 | 725 | if (car_item.cut_price1) ie.card_cut_price += car_item.cut_price1; |
710 | 726 | arr.push(ie); |
711 | - | |
712 | 727 | } |
713 | 728 | } |
714 | 729 | //-- 如果是回退回来的情况 -- |
... | ... | @@ -721,7 +736,7 @@ Page({ |
721 | 736 | ie.wind = parseInt(th.data.cartlist[kj].wind); |
722 | 737 | |
723 | 738 | //-- 是不是全部自提清空 -- |
724 | - if (ie.exp_type == 0) th.setData({ is_all_zt: 0 }); | |
739 | + if (ie.exp_type == 0 || ie.exp_type == 2) th.setData({ is_all_zt: 0 }); | |
725 | 740 | |
726 | 741 | break; |
727 | 742 | } |
... | ... | @@ -788,11 +803,23 @@ Page({ |
788 | 803 | ladder_calc.fir_set_arr(u_item, th); |
789 | 804 | } |
790 | 805 | |
806 | + | |
807 | + | |
808 | + //----- 判断每一个商品的配送方式,和门店的配送方式 ------- | |
809 | + for(var ik=0;ik<arr.length;ik++){ | |
810 | + if(!arr[ik].sto.is_same_city) continue; | |
811 | + var fd=arr[ik].goods.filter(function (e) { | |
812 | + e.is_same_city!=1 || e.whsle_id<=0 | |
813 | + }) | |
814 | + if(!fd || fd.length==0) arr[ik].show_same_city=1; | |
815 | + } | |
816 | + | |
791 | 817 | //深拷贝 |
792 | 818 | th.data.old_cartlist = JSON.parse(JSON.stringify(arr)); |
793 | 819 | th.setData({ |
794 | 820 | cartlist: arr, |
795 | 821 | }); |
822 | + | |
796 | 823 | //--- 获取一下看有没有优惠券 ---- |
797 | 824 | setTimeout(function () { |
798 | 825 | var frozenQuan = null; |
... | ... | @@ -823,6 +850,21 @@ Page({ |
823 | 850 | var gd = t.data.data; |
824 | 851 | if (!gd) return false; |
825 | 852 | |
853 | + //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- | |
854 | + if(gd.is_same_city && th.data.is_same_city && gd.whsle_id<=0){ | |
855 | + | |
856 | + getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+gg.pick_id, {}).then(res=>{ | |
857 | + if(res.data.code==0){ | |
858 | + var pk=res.data.data; | |
859 | + if(pk && pk.is_same_city){ | |
860 | + th.setData({show_same_city:1}) | |
861 | + } | |
862 | + } | |
863 | + | |
864 | + }) | |
865 | + | |
866 | + } | |
867 | + | |
826 | 868 | t.data.data.original_img = oo.imghost + t.data.data.original_img; |
827 | 869 | t.data.data['buynum'] = gg.goods_num; |
828 | 870 | var distr_t = 0, et = 0 |
... | ... | @@ -1516,6 +1558,9 @@ Page({ |
1516 | 1558 | |
1517 | 1559 | await th.get_cart_quan(c_arr); |
1518 | 1560 | |
1561 | + | |
1562 | + //-- 经纬度不循环调用接口 -- | |
1563 | + var lon=0; var lat=0; | |
1519 | 1564 | //---循环购物车--- |
1520 | 1565 | for (var i in c_arr) { |
1521 | 1566 | //因为搭配购买也是再这里计算,搭配购的is_b_now==1 |
... | ... | @@ -1526,13 +1571,14 @@ Page({ |
1526 | 1571 | if (th.data.cartlist[i].check_quan_price_list) c_arr[i].check_quan_price_list = th.data.cartlist[i].check_quan_price_list; //优惠券优惠什么商品价格 |
1527 | 1572 | if (th.data.cartlist[i].check_quan_ware_list) c_arr[i].check_quan_ware_list = th.data.cartlist[i].check_quan_ware_list; //优惠券优惠什么商品 |
1528 | 1573 | } else { |
1529 | - c_arr[i].exp_type = th.data.bn_exp_type; //配送方式 | |
1530 | - c_arr[i].wind = th.data.index; //立即购买选择的物流 | |
1574 | + c_arr[i].exp_type = th.data.bn_exp_type; //配送方式 | |
1575 | + c_arr[i].wind = th.data.index; //立即购买选择的物流 | |
1531 | 1576 | //c_arr[i].=th.data. //立即购买的使用余额 |
1532 | 1577 | if (th.data.cartlist) c_arr[i].check_quan_price_list = th.data.cartlist[i].check_quan_price_list; //优惠券优惠什么商品价格 |
1533 | 1578 | if (th.data.cartlist) c_arr[i].check_quan_ware_list = th.data.cartlist[i].check_quan_ware_list; //优惠券优惠什么商品 |
1534 | 1579 | } |
1535 | 1580 | |
1581 | + | |
1536 | 1582 | var cart_item = c_arr[i]; //就是每一单的意思 |
1537 | 1583 | var pickid = cart_item.pickup_id; |
1538 | 1584 | var o_price = 0; |
... | ... | @@ -1766,8 +1812,9 @@ Page({ |
1766 | 1812 | } |
1767 | 1813 | |
1768 | 1814 | if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item[j].goods_id) == -1)) { |
1769 | - if (goods_weight < 0) goods_weight = 0; | |
1815 | + | |
1770 | 1816 | if (item[j]['exp_sum_type'] == 2) { |
1817 | + if (goods_weight < 0) goods_weight = 0; | |
1771 | 1818 | cut_good_weight += item[j]['weight'] * item[j]['goods_num']; |
1772 | 1819 | goods_weight += item[j]['weight'] * item[j]['goods_num']; |
1773 | 1820 | } |
... | ... | @@ -1847,7 +1894,7 @@ Page({ |
1847 | 1894 | if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) { |
1848 | 1895 | if (cart_item.shipping_price == 0) th.data.is_by[pickid] = 1; //已经全场包邮,就不要选择券了 |
1849 | 1896 | } |
1850 | - } else { | |
1897 | + } else if(cart_item.exp_type==1) { | |
1851 | 1898 | cart_item.shipping_price = 0; |
1852 | 1899 | } |
1853 | 1900 | |
... | ... | @@ -1873,6 +1920,54 @@ Page({ |
1873 | 1920 | o_condition=o_condition-whsle_goods_price; |
1874 | 1921 | } |
1875 | 1922 | |
1923 | + //-- 在选择到同城配送的时候 -- | |
1924 | + if(c_arr[i].exp_type==2 && th.data.user_addr){ | |
1925 | + | |
1926 | + var gd_w=0; | |
1927 | + for (let ib in c_arr[i].goods) { | |
1928 | + let item_bb = c_arr[i].goods[ib]; | |
1929 | + gd_w += item_bb['weight'] * item_bb['buynum']; | |
1930 | + } | |
1931 | + | |
1932 | + if(!lon) { | |
1933 | + //-- 获取距离 -- | |
1934 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { | |
1935 | + is_json: 1, data: {address: th.data.user_addr.more_address + th.data.user_addr.address} | |
1936 | + }).then(res => { | |
1937 | + if (res.data.code == 0) { | |
1938 | + var data = JSON.parse(res.data.data); | |
1939 | + if (data.status == 0) { | |
1940 | + lon = data.result.location.lng; | |
1941 | + lat = data.result.location.lat; | |
1942 | + } | |
1943 | + } | |
1944 | + }) | |
1945 | + } | |
1946 | + | |
1947 | + | |
1948 | + var req_data={ | |
1949 | + store_id:os.stoid, order_amount:o_condition, | |
1950 | + lon:lon,lat:lat, pickup_id:c_arr[i].pickup_id, goods_weight:gd_w | |
1951 | + } | |
1952 | + var is_next=1; | |
1953 | + | |
1954 | + //获取同城配送参数 | |
1955 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", {is_json:1,data:req_data}).then(res=>{ | |
1956 | + if(res.data.code==0){ | |
1957 | + cart_item.shipping_price = res.data.data; | |
1958 | + }else{ | |
1959 | + is_next=0; | |
1960 | + wx.showToast({ | |
1961 | + title: res.data.msg, | |
1962 | + icon: 'none', | |
1963 | + duration: 2000 | |
1964 | + }) | |
1965 | + } | |
1966 | + }) | |
1967 | + if(!is_next) return false | |
1968 | + } | |
1969 | + | |
1970 | + | |
1876 | 1971 | var order_m = 0; |
1877 | 1972 | //---判断是不是有订单优惠--- |
1878 | 1973 | await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { |
... | ... | @@ -2020,7 +2115,7 @@ Page({ |
2020 | 2115 | } |
2021 | 2116 | //-- 包邮券 -- |
2022 | 2117 | var by_quan = th.data.get_by_quan_list_cart[pkid]; |
2023 | - if (by_quan) { | |
2118 | + if (by_quan && c_item.exp_type==0) { | |
2024 | 2119 | for (var iter2 in by_quan) { |
2025 | 2120 | //判断是不是其他订单有选用 |
2026 | 2121 | var is_other_is_use = th.check_other_use_by(by_quan[iter2], pkid); |
... | ... | @@ -2050,6 +2145,7 @@ Page({ |
2050 | 2145 | title: "处理中.", |
2051 | 2146 | mask:true |
2052 | 2147 | }) |
2148 | + | |
2053 | 2149 | //-----------计算商品总价-------------- |
2054 | 2150 | var allpice = good.shop_price * good.buynum; |
2055 | 2151 | var cut_price = 0; |
... | ... | @@ -2205,8 +2301,8 @@ Page({ |
2205 | 2301 | |
2206 | 2302 | if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { |
2207 | 2303 | |
2208 | - if (goods_weight < 0) goods_weight = 0; | |
2209 | 2304 | if (item['exp_sum_type'] == 2) { |
2305 | + if (goods_weight < 0) goods_weight = 0; | |
2210 | 2306 | goods_weight += item['weight'] * item['buynum']; |
2211 | 2307 | cut_good_weight += item['weight'] * item['buynum']; |
2212 | 2308 | } |
... | ... | @@ -2293,7 +2389,7 @@ Page({ |
2293 | 2389 | var wl_txt = "formData.shipping_price"; |
2294 | 2390 | th.setData({[wl_txt]: shipping_price,}) |
2295 | 2391 | |
2296 | - } else { | |
2392 | + } else if(th.data.bn_exp_type == 1 ) { | |
2297 | 2393 | var wl_txt = "formData.shipping_price"; |
2298 | 2394 | th.setData({ [wl_txt]: 0, }) |
2299 | 2395 | } |
... | ... | @@ -2317,6 +2413,59 @@ Page({ |
2317 | 2413 | var o_condition = parseFloat(order_m); |
2318 | 2414 | if(th.data.bn_goods.whsle_id>0){ |
2319 | 2415 | o_condition=0; |
2416 | + }else{ | |
2417 | + | |
2418 | + //判断是否同城配送,而且没有调用过 | |
2419 | + if(th.data.bn_exp_type==2 && th.data.user_addr) { | |
2420 | + var gd_w = 0, lon = 0, lat = 0; | |
2421 | + for (let ib in gd_arr_list) { | |
2422 | + let item_b = gd_arr_list[ib]; | |
2423 | + gd_w += item_b['weight'] * item_b['buynum']; | |
2424 | + } | |
2425 | + | |
2426 | + //-- 获取距离 -- | |
2427 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { | |
2428 | + is_json: 1, data: {address:th.data.user_addr.more_address+th.data.user_addr.address} | |
2429 | + }).then(res=>{ | |
2430 | + if(res.data.code==0){ | |
2431 | + var data= JSON.parse(res.data.data); | |
2432 | + if(data.status==0){ | |
2433 | + lon=data.result.location.lng; | |
2434 | + lat=data.result.location.lat; | |
2435 | + } | |
2436 | + } | |
2437 | + }) | |
2438 | + | |
2439 | + var req_data = { | |
2440 | + store_id: os.stoid, order_amount: o_condition, | |
2441 | + lon: lon, lat: lat, pickup_id: bn_pick,goods_weight: gd_w | |
2442 | + } | |
2443 | + | |
2444 | + var is_next=1; | |
2445 | + | |
2446 | + //获取同城配送参数 | |
2447 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", { | |
2448 | + is_json: 1,data: req_data | |
2449 | + }).then(res => { | |
2450 | + if (res.data.code == 0) { | |
2451 | + | |
2452 | + | |
2453 | + var wl_txt = "formData.shipping_price"; | |
2454 | + th.setData({ [wl_txt]: res.data.data, }) | |
2455 | + | |
2456 | + }else{ | |
2457 | + is_next=0; | |
2458 | + wx.showToast({ | |
2459 | + title: res.data.msg, | |
2460 | + icon: 'none', | |
2461 | + duration: 2000 | |
2462 | + }) | |
2463 | + | |
2464 | + } | |
2465 | + }) | |
2466 | + if(!is_next) return false | |
2467 | + } | |
2468 | + | |
2320 | 2469 | } |
2321 | 2470 | |
2322 | 2471 | if (o_condition > 0) { |
... | ... | @@ -3326,7 +3475,7 @@ Page({ |
3326 | 3475 | } else { |
3327 | 3476 | for (var i = 0; i < th.data.cartlist.length; i++) { |
3328 | 3477 | var item = th.data.cartlist[i]; |
3329 | - if (item.exp_type == 0) { | |
3478 | + if (item.exp_type == 0 || item.exp_type==2 ) { | |
3330 | 3479 | iszt = 0; |
3331 | 3480 | break; |
3332 | 3481 | } | ... | ... |
pages/cart/cart2/cart2.wxml
... | ... | @@ -13,6 +13,11 @@ |
13 | 13 | |
14 | 14 | <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype2' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}">快递邮寄</view> |
15 | 15 | |
16 | + <!-- 同城配送 --> | |
17 | + <block wx:if="{{show_same_city}}"> | |
18 | + <view hidden="{{bn_t_exp_t==3}}" bindtap='setexptype2' 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 | + | |
16 | 21 | </view> |
17 | 22 | </view> |
18 | 23 | </block> |
... | ... | @@ -24,13 +29,18 @@ |
24 | 29 | |
25 | 30 | <view hidden="{{cartlist[0].distr_t==1}}" bindtap='setexptype_w2' data-ind="0" data-t='0' class="tab {{cartlist[0].exp_type== 0 ? 'active':''}}" data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}">快递邮寄</view> |
26 | 31 | |
32 | + <!-- 判断能不能显示同城配送 --> | |
33 | + <block wx:if="{{cartlist[0].show_same_city}}"> | |
34 | + <view hidden="{{cartlist[0].distr_t==3}}" bindtap='setexptype_w2' data-ind="0" data-t='2' class="tab {{cartlist[0].exp_type== 2 ? 'active':''}}" data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}">同城配送</view> | |
35 | + </block> | |
36 | + | |
27 | 37 | </view> |
28 | 38 | </view> |
29 | 39 | </block> |
30 | 40 | </block> |
31 | 41 | |
32 | 42 | <!--要进行判断地址是否显示----> |
33 | - <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{(bn_exp_type==1 && is_b_now==1) || (is_all_zt==1 && is_b_now==0)}}'> | |
43 | + <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{(bn_exp_type==1 && is_b_now==1) || (is_all_zt==1 && is_b_now==0 )}}'> | |
34 | 44 | <!---默认地址显示------> |
35 | 45 | <block wx:if="{{user_addr!=null}}"> |
36 | 46 | |
... | ... | @@ -135,7 +145,7 @@ |
135 | 145 | |
136 | 146 | <block wx:if="{{item.exp_type==1}}"> |
137 | 147 | <!-- <view class="circle white xc-hookt fs20 red-b sn"><text>Γ</text></view> --> |
138 | - <icon data-t='0' data-txt='cartlist[{{pidx}}].exp_type' color="red" size="16" type="success"></icon> | |
148 | + <icon data-t='1' data-txt='cartlist[{{pidx}}].exp_type' color="red" size="16" type="success"></icon> | |
139 | 149 | </block> |
140 | 150 | <block wx:else> |
141 | 151 | <view class="circle xc-hookts on"></view> |
... | ... | @@ -154,6 +164,19 @@ |
154 | 164 | |
155 | 165 | <view bindtap='setexptype_w2' data-t='0' data-ind="{{pidx}}" data-txt='cartlist[{{pidx}}].exp_type' data-wl_txt='cartlist[{{pidx}}].wind' class="yu_er">快递邮寄</view> |
156 | 166 | </view> |
167 | + | |
168 | + <!-- 同城配送 --> | |
169 | + <view data-t='2' data-txt='cartlist[{{pidx}}].exp_type' data-ind="{{pidx}}" bindtap="setexptype_w2" style="display:{{item.show_same_city?'none':'flex;align-items: center'}};"> | |
170 | + | |
171 | + <block wx:if="{{item.exp_type==2}}"> | |
172 | + <icon data-t='2' data-txt='cartlist[{{pidx}}].exp_type' color="red" size="16" type="success"></icon> | |
173 | + </block> | |
174 | + <block wx:else> | |
175 | + <view class="circle xc-hookts on"></view> | |
176 | + </block> | |
177 | + | |
178 | + <view bindtap='setexptype_w2' data-t='2' data-ind="{{pidx}}" data-txt='cartlist[{{pidx}}].exp_type' data-wl_txt='cartlist[{{pidx}}].wind' class="yu_er">同城配送</view> | |
179 | + </view> | |
157 | 180 | </view> |
158 | 181 | |
159 | 182 | |
... | ... | @@ -215,7 +238,7 @@ |
215 | 238 | </view> |
216 | 239 | |
217 | 240 | <!-----使用优惠券------> |
218 | - <view class="xc-coupon-frame flex-center" data-bn="0" bindtap="open_coupon_list" wx:if="{{(item.quan_list && item.quan_list.length>0) || get_by_quan_list_cart[item.pickup_id]!=null}}" data-cind="{{pidx}}" data-pickid="{{item.pickup_id}}"> | |
241 | + <view class="xc-coupon-frame flex-center" data-bn="0" bindtap="open_coupon_list" wx:if="{{(item.quan_list && item.quan_list.length>0) || get_by_quan_list_cart[item.pickup_id]!=null && item.can_num>0}}" data-cind="{{pidx}}" data-pickid="{{item.pickup_id}}"> | |
219 | 242 | <view class="work-frame flex-space-between"> |
220 | 243 | <view class="work">优惠券<text class="quan_num_show fs20">{{item.can_num}}张可用</text></view> |
221 | 244 | <view class="xc-right-frame"> |
... | ... | @@ -415,10 +438,12 @@ |
415 | 438 | <icon color="#f23030" size="16" type="info"></icon>{{order.store_prom}} |
416 | 439 | </view> |
417 | 440 | |
418 | - <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" wx:if="{{is_coupon > 0 && ((selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null)}}"> | |
441 | + <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" | |
442 | + hidden="{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list && bn_exp_type==0?get_by_quan_list.length:0)<=0}}" | |
443 | + wx:if="{{is_coupon > 0 && ((selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null)}}"> | |
419 | 444 | <view class="work-frame flex-space-between"> |
420 | 445 | <view class="work"> |
421 | - 优惠券 <text class="quan_num_show">{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list?get_by_quan_list.length:0)}}张可用</text> | |
446 | + 优惠券 <text class="quan_num_show">{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list && bn_exp_type==0?get_by_quan_list.length:0)}}张可用</text> | |
422 | 447 | </view> |
423 | 448 | <view class="xc-right-frame"> |
424 | 449 | <text wx:if="{{using_quan[bn_pick].is_nouse}}">不使用</text> | ... | ... |
pages/cart/cart2_inte/cart2_inte.js
... | ... | @@ -95,7 +95,9 @@ Page({ |
95 | 95 | th.data.json_d = json_d; |
96 | 96 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 |
97 | 97 | var is_default_logistics = json_d.is_default_logistics; |
98 | - th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics }); | |
98 | + var is_same_city = json_d.is_same_city; | |
99 | + th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, | |
100 | + rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics,is_same_city:is_same_city }); | |
99 | 101 | |
100 | 102 | var rank_switch = json_d.rank_switch; |
101 | 103 | var max_price = -1; |
... | ... | @@ -290,6 +292,22 @@ Page({ |
290 | 292 | var gd = t.data.data; |
291 | 293 | if (!gd) return false; |
292 | 294 | |
295 | + //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- | |
296 | + if(gd.is_same_city && th.data.is_same_city && gd.whsle_id<=0){ | |
297 | + | |
298 | + getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+gg.pick_id, {}).then(res=>{ | |
299 | + if(res.data.code==0){ | |
300 | + var pk=res.data.data; | |
301 | + if(pk && pk.is_same_city){ | |
302 | + th.setData({show_same_city:1}) | |
303 | + } | |
304 | + } | |
305 | + | |
306 | + }) | |
307 | + | |
308 | + } | |
309 | + | |
310 | + | |
293 | 311 | t.data.data.original_img = oo.imghost + t.data.data.original_img; |
294 | 312 | t.data.data['buynum'] = gg.goods_num; |
295 | 313 | var distr_t = 0, et = 0 |
... | ... | @@ -409,6 +427,8 @@ Page({ |
409 | 427 | //---------计算立即购买---------- |
410 | 428 | calculatePrice2:async function () { |
411 | 429 | var th = this, good = this.data.bn_goods; |
430 | + | |
431 | + this.setData({show_submit:0}) | |
412 | 432 | wx.showLoading({ title: "处理中.", mask:true }) |
413 | 433 | //-----------计算商品总价-------------- |
414 | 434 | var allpice = good.shop_price * good.buynum; |
... | ... | @@ -519,6 +539,7 @@ Page({ |
519 | 539 | shipping_price=res.data.data; is_ok=1; |
520 | 540 | } |
521 | 541 | }) |
542 | + | |
522 | 543 | if(!is_ok){ |
523 | 544 | wx.showToast({ |
524 | 545 | title: "计算物流错误", icon: 'none',duration: 2000 |
... | ... | @@ -537,7 +558,7 @@ Page({ |
537 | 558 | var wl_txt = "formData.shipping_price"; |
538 | 559 | th.setData({ [wl_txt]: shipping_price, }) |
539 | 560 | |
540 | - } else { | |
561 | + } else if(th.data.bn_exp_type == 1 ) { | |
541 | 562 | var wl_txt = "formData.shipping_price"; |
542 | 563 | th.setData({ [wl_txt]: 0, }) |
543 | 564 | } |
... | ... | @@ -552,6 +573,55 @@ Page({ |
552 | 573 | order_m = 0; coupon_price = parseFloat(order_m).toFixed(2); |
553 | 574 | } |
554 | 575 | |
576 | + //判断是否同城配送,而且没有调用过 | |
577 | + if(th.data.bn_exp_type==2 && th.data.user_addr) { | |
578 | + | |
579 | + var lon=0;var lat=0; | |
580 | + //-- 获取距离 -- | |
581 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { | |
582 | + is_json: 1, data: {address:th.data.user_addr.more_address+th.data.user_addr.address} | |
583 | + }).then(res=>{ | |
584 | + if(res.data.code==0){ | |
585 | + var data= JSON.parse(res.data.data); | |
586 | + if(data.status==0){ | |
587 | + lon=data.result.location.lng; | |
588 | + lat=data.result.location.lat; | |
589 | + } | |
590 | + } | |
591 | + }) | |
592 | + | |
593 | + | |
594 | + var gd_w = good['weight'] * good['buynum']; | |
595 | + //-- 获取距离 -- | |
596 | + var req_data = { | |
597 | + store_id: os.stoid, | |
598 | + order_amount: order_m, | |
599 | + lon: lon, lat: lat, | |
600 | + pickup_id: bn_pick, | |
601 | + goods_weight: gd_w | |
602 | + } | |
603 | + | |
604 | + var is_next=1; | |
605 | + //获取同城配送参数 | |
606 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", { | |
607 | + is_json: 1, | |
608 | + data: req_data | |
609 | + }).then(res => { | |
610 | + if (res.data.code == 0) { | |
611 | + var wl_txt = "formData.shipping_price"; | |
612 | + th.setData({ [wl_txt]: res.data.data, }) | |
613 | + }else{ | |
614 | + is_next=0; | |
615 | + wx.showToast({ | |
616 | + title: res.data.msg, icon: 'none', duration: 2000 | |
617 | + }) | |
618 | + } | |
619 | + }) | |
620 | + if(!is_next) return false | |
621 | + } | |
622 | + | |
623 | + | |
624 | + | |
555 | 625 | //--看一下有没有订单优惠--0 |
556 | 626 | total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); |
557 | 627 | order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price); | ... | ... |
pages/cart/cart2_inte/cart2_inte.wxml
... | ... | @@ -12,6 +12,11 @@ |
12 | 12 | |
13 | 13 | <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" |
14 | 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> | |
15 | 20 | |
16 | 21 | </view> |
17 | 22 | </view> | ... | ... |
pages/cart/cart2_pt/cart2_pt.js
... | ... | @@ -148,14 +148,16 @@ Page({ |
148 | 148 | th.get_buy_goods(); |
149 | 149 | |
150 | 150 | //获取提现金额 |
151 | - getApp().request.get("/api/weshop/withdrawals/summoney", { | |
151 | + //noinspection JSUnresolvedFunction | |
152 | + getApp().request.get("/api/weshop/withdrawals/summoney", { | |
152 | 153 | data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 }, |
153 | 154 | success: function (su) { |
154 | 155 | if (su.data.code == 0) { |
155 | 156 | var yuer = parseFloat(th.data.userinfo.user_money - |
156 | 157 | (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2); |
157 | 158 | if (yuer < 0) yuer = 0; |
158 | - th.setData({ txmon: su.data.data.summoney, yuer: yuer }); | |
159 | + //noinspection JSUnresolvedVariable | |
160 | + th.setData({ txmon: su.data.data.summoney, yuer: yuer }); | |
159 | 161 | } |
160 | 162 | } |
161 | 163 | }); |
... | ... | @@ -173,6 +175,22 @@ Page({ |
173 | 175 | var gd = t.data.data; |
174 | 176 | if (!gd) return false; |
175 | 177 | |
178 | + | |
179 | + //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- | |
180 | + if(gd.is_same_city && th.data.is_same_city && gd.whsle_id<=0){ | |
181 | + | |
182 | + getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+gg.pick_id, {}).then(res=>{ | |
183 | + if(res.data.code==0){ | |
184 | + var pk=res.data.data; | |
185 | + if(pk && pk.is_same_city){ | |
186 | + th.setData({show_same_city:1}) | |
187 | + } | |
188 | + } | |
189 | + | |
190 | + }) | |
191 | + | |
192 | + } | |
193 | + | |
176 | 194 | t.data.data.original_img = oo.imghost + t.data.data.original_img; |
177 | 195 | t.data.data['buynum'] = gg.goods_num; |
178 | 196 | console.log(t.data.data); |
... | ... | @@ -315,8 +333,10 @@ Page({ |
315 | 333 | th.data.json_d = json_d; |
316 | 334 | th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 |
317 | 335 | var is_default_logistics = json_d.is_default_logistics; |
336 | + var is_same_city = json_d.is_same_city; | |
318 | 337 | |
319 | - th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules, rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics }); | |
338 | + th.setData({ is_close_quan: json_d.is_close_quan, sales_rules: ee.sales_rules,is_same_city:is_same_city, | |
339 | + rank_switch: json_d.rank_switch, is_default_logistics: is_default_logistics }); | |
320 | 340 | |
321 | 341 | var rank_switch = json_d.rank_switch; |
322 | 342 | var max_price = -1; |
... | ... | @@ -398,7 +418,6 @@ Page({ |
398 | 418 | calculatePrice2:async function () { |
399 | 419 | |
400 | 420 | this.setData({submit:1}); |
401 | - | |
402 | 421 | wx.showLoading({ |
403 | 422 | title: "处理中.", |
404 | 423 | mask:true |
... | ... | @@ -441,7 +460,7 @@ Page({ |
441 | 460 | |
442 | 461 | if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { |
443 | 462 | |
444 | - if (item['exp_sum_type'] == 2) { | |
463 | + if(item['exp_sum_type'] == 2) { | |
445 | 464 | if (goods_weight < 0) goods_weight = 0; |
446 | 465 | cut_good_weight += item['weight'] * item['buynum']; |
447 | 466 | goods_weight += item['weight'] * item['buynum']; |
... | ... | @@ -520,10 +539,54 @@ Page({ |
520 | 539 | var wl_txt = "formData.shipping_price"; |
521 | 540 | th.setData({ [wl_txt]: shipping_price, }) |
522 | 541 | |
523 | - } else { | |
542 | + } else if(th.data.bn_exp_type == 1 ) { | |
524 | 543 | var wl_txt = "formData.shipping_price"; |
525 | 544 | th.setData({ [wl_txt]: 0, }) |
526 | 545 | } |
546 | + | |
547 | + //判断是否同城配送,而且没有调用过 | |
548 | + if(th.data.bn_exp_type==2 && th.data.user_addr){ | |
549 | + var lon=0;var lat=0; | |
550 | + //-- 获取距离 -- | |
551 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { | |
552 | + is_json: 1, data: {address:th.data.user_addr.more_address+th.data.user_addr.address} | |
553 | + }).then(res=>{ | |
554 | + if(res.data.code==0){ | |
555 | + var data= JSON.parse(res.data.data); | |
556 | + if(data.status==0){ | |
557 | + lon=data.result.location.lng; | |
558 | + lat=data.result.location.lat; | |
559 | + } | |
560 | + } | |
561 | + }) | |
562 | + | |
563 | + var gd_w=good['weight'] * good['buynum']; | |
564 | + //-- 获取距离 -- | |
565 | + var req_data={ | |
566 | + store_id:os.stoid, | |
567 | + order_amount:allpice, | |
568 | + lon:lon,lat:lat, | |
569 | + pickup_id:th.data.bn_pick, | |
570 | + goods_weight:gd_w | |
571 | + } | |
572 | + | |
573 | + var is_next=1; | |
574 | + //获取同城配送参数 | |
575 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", {is_json:1,data:req_data}).then(res=>{ | |
576 | + if(res.data.code==0){ | |
577 | + var wl_txt = "formData.shipping_price"; | |
578 | + th.setData({ [wl_txt]: res.data.data, }) | |
579 | + }else{ | |
580 | + is_next=0; | |
581 | + wx.showToast({ | |
582 | + title: res.data.msg, icon: 'none', duration: 2000 | |
583 | + }) | |
584 | + } | |
585 | + }) | |
586 | + if(!is_next) return false | |
587 | + } | |
588 | + | |
589 | + | |
527 | 590 | //-----------------总价----------------- |
528 | 591 | var total_m = parseFloat(allpice) + parseFloat(th.data.formData.shipping_price); |
529 | 592 | total_m = parseFloat(total_m).toFixed(2); | ... | ... |
pages/cart/cart2_pt/cart2_pt.wxml
... | ... | @@ -10,6 +10,11 @@ |
10 | 10 | |
11 | 11 | <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" |
12 | 12 | data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> |
13 | + | |
14 | + <!-- 同城配送 --> | |
15 | + <block wx:if="{{show_same_city}}"> | |
16 | + <view 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> | |
17 | + </block> | |
13 | 18 | |
14 | 19 | </view> |
15 | 20 | </view> | ... | ... |
pages/cart/cart_wk/cart_wk.js
... | ... | @@ -41,6 +41,7 @@ Page({ |
41 | 41 | |
42 | 42 | teamgroup: null, |
43 | 43 | submit:1, //默认按钮是灰色 |
44 | + show_submit:0, //不线上 | |
44 | 45 | }, |
45 | 46 | |
46 | 47 | /** |
... | ... | @@ -62,7 +63,8 @@ Page({ |
62 | 63 | var json_d = JSON.parse(e.switch_list); |
63 | 64 | th.data.json_d = json_d; |
64 | 65 | var is_default_logistics = json_d.is_default_logistics; |
65 | - th.setData({ is_default_logistics: is_default_logistics }); | |
66 | + var is_same_city = json_d.is_same_city; | |
67 | + th.setData({ is_default_logistics: is_default_logistics,is_same_city:is_same_city }); | |
66 | 68 | |
67 | 69 | th.get_wuliu(th.get_info(th.show_page)); |
68 | 70 | }, 1) |
... | ... | @@ -91,6 +93,11 @@ Page({ |
91 | 93 | if (th.data.exp_type == 0 && th.data.goods) { |
92 | 94 | th.calculate_wuliu(); |
93 | 95 | } |
96 | + | |
97 | + if (th.data.exp_type == 2 && th.data.goods) { | |
98 | + th.calculate_same_city(); | |
99 | + } | |
100 | + | |
94 | 101 | }) |
95 | 102 | |
96 | 103 | }, |
... | ... | @@ -265,7 +272,23 @@ Page({ |
265 | 272 | else |
266 | 273 | distr_type = pickup.distr_type; |
267 | 274 | |
268 | - switch (distr_type) { | |
275 | + | |
276 | + //-- 如果商品有同城配送的参数的时候,一件代发商品不能显示同城配送按钮 -- | |
277 | + if(goods.is_same_city && th.data.is_same_city && goods.whsle_id<=0){ | |
278 | + getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+order.pickup_id, {}).then(res=>{ | |
279 | + if(res.data.code==0){ | |
280 | + var pk=res.data.data; | |
281 | + if(pk && pk.is_same_city){ | |
282 | + th.setData({show_same_city:1}) | |
283 | + } | |
284 | + } | |
285 | + }) | |
286 | + } | |
287 | + | |
288 | + | |
289 | + | |
290 | + | |
291 | + switch (distr_type) { | |
269 | 292 | case 0: |
270 | 293 | exp_type = 1; |
271 | 294 | //-- 系统后台有设置要默认的 -- |
... | ... | @@ -297,7 +320,7 @@ Page({ |
297 | 320 | } else { |
298 | 321 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; |
299 | 322 | allpice = allpice.toFixed(2); |
300 | - th.setData({ exp_price: 0, allpice: allpice,submit:0 }) | |
323 | + th.setData({ exp_price: 0, allpice: allpice,submit:0,show_submit:1 }) | |
301 | 324 | } |
302 | 325 | }, |
303 | 326 | |
... | ... | @@ -326,22 +349,19 @@ Page({ |
326 | 349 | this.setData({ |
327 | 350 | exp_type: type |
328 | 351 | }); |
329 | - | |
330 | - | |
331 | - | |
332 | 352 | //--计算物流的值-- |
333 | 353 | if (type == 0) { |
334 | - | |
335 | - th.setData({submit:0}) | |
336 | 354 | th.calculate_wuliu(); |
337 | - } else { | |
355 | + } else if(type==1){ | |
338 | 356 | var allpice = parseFloat(th.data.order.order_amount) |
339 | 357 | + parseFloat(th.data.order.user_money) |
340 | 358 | + parseFloat(th.data.order.tail_money); |
341 | 359 | allpice = allpice.toFixed(2); |
342 | 360 | this.setData({ |
343 | - allpice: allpice, exp_price: 0, | |
361 | + allpice: allpice, exp_price: 0,show_submit:1,submit:0 | |
344 | 362 | }); |
363 | + }else{ | |
364 | + th.calculate_same_city(); | |
345 | 365 | } |
346 | 366 | }, |
347 | 367 | |
... | ... | @@ -400,6 +420,12 @@ Page({ |
400 | 420 | dd.shipping_price = parseFloat(th.data.exp_price); |
401 | 421 | dd.addressid = th.data.user_addr.address_id; |
402 | 422 | } |
423 | + | |
424 | + //如果是同城配送的时候 | |
425 | + if(th.data.exp_type==2){ | |
426 | + dd.shipping_price = parseFloat(th.data.exp_price); | |
427 | + } | |
428 | + | |
403 | 429 | if(getApp().globalData.scene){ |
404 | 430 | dd.scene=getApp().globalData.scene; |
405 | 431 | } |
... | ... | @@ -589,7 +615,7 @@ Page({ |
589 | 615 | } |
590 | 616 | }) |
591 | 617 | if(!is_ok){ |
592 | - th.setData({ submit:0 }); | |
618 | + th.setData({ submit:0,show_submit:1 }); | |
593 | 619 | wx.hideLoading(); |
594 | 620 | return false; |
595 | 621 | } |
... | ... | @@ -599,16 +625,89 @@ Page({ |
599 | 625 | allpice = allpice.toFixed(2); |
600 | 626 | |
601 | 627 | exp_price = parseFloat(exp_price); |
602 | - th.setData({ exp_price: exp_price, allpice: allpice,submit:0 }) | |
628 | + th.setData({ exp_price: exp_price, allpice: allpice,submit:0,show_submit:1 }) | |
603 | 629 | } else { |
604 | 630 | var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; |
605 | 631 | allpice = allpice.toFixed(2); |
606 | - th.setData({ exp_price: 0, allpice: allpice,submit:0}) | |
632 | + th.setData({ exp_price: 0, allpice: allpice,submit:0,show_submit:1}) | |
607 | 633 | } |
608 | 634 | //}); |
609 | 635 | |
610 | 636 | }, |
611 | 637 | |
638 | + //----计算物流的钱--- | |
639 | + async calculate_same_city() { | |
640 | + //让按钮变灰色 | |
641 | + this.setData({submit:1}); | |
642 | + var th = this; | |
643 | + var good = th.data.goods; | |
644 | + good.buynum=th.data.order.order_goods['goods_num']; | |
645 | + | |
646 | + //--全部金额-- | |
647 | + var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money; | |
648 | + //-----------当地址不为空,且是物流时,计算物流费用---------- | |
649 | + if (th.data.user_addr != null) { | |
650 | + | |
651 | + | |
652 | + var lon=0;var lat=0; | |
653 | + //-- 获取距离 -- | |
654 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getGeocoder", { | |
655 | + is_json: 1, data: {address:th.data.user_addr.more_address+th.data.user_addr.address} | |
656 | + }).then(res=>{ | |
657 | + if(res.data.code==0){ | |
658 | + var data= JSON.parse(res.data.data); | |
659 | + if(data.status==0){ | |
660 | + lon=data.result.location.lng; | |
661 | + lat=data.result.location.lat; | |
662 | + } | |
663 | + } | |
664 | + }) | |
665 | + | |
666 | + var gd_w = good['weight'] * good['buynum']; | |
667 | + //--------------开始计算物流------------------ | |
668 | + var shipping_price =0; | |
669 | + | |
670 | + //-- 获取距离 -- | |
671 | + var req_data={ | |
672 | + store_id:os.stoid, | |
673 | + order_amount:allpice, | |
674 | + lon:lon,lat:lat, | |
675 | + pickup_id:th.data.pickup.pickup_id, | |
676 | + goods_weight:gd_w | |
677 | + } | |
678 | + | |
679 | + var is_next=1; | |
680 | + //获取同城配送参数 | |
681 | + await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", {is_json:1,data:req_data}).then(res=>{ | |
682 | + if(res.data.code==0){ | |
683 | + shipping_price=res.data.data; | |
684 | + }else{ | |
685 | + is_next=0; | |
686 | + wx.showToast({ | |
687 | + title: res.data.msg, icon: 'none', duration: 2000 | |
688 | + }) | |
689 | + } | |
690 | + }) | |
691 | + if(!is_next) return false | |
692 | + | |
693 | + var exp_price = parseFloat(shipping_price).toFixed(2); | |
694 | + allpice = parseFloat(exp_price) + parseFloat(allpice); | |
695 | + allpice = allpice.toFixed(2); | |
696 | + | |
697 | + exp_price = parseFloat(exp_price); | |
698 | + th.setData({ exp_price: exp_price, allpice: allpice,submit:0,show_submit:1 }) | |
699 | + | |
700 | + | |
701 | + | |
702 | + } else { | |
703 | + var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; | |
704 | + allpice = allpice.toFixed(2); | |
705 | + th.setData({ exp_price: 0, allpice: allpice,submit:0,show_submit:1}) | |
706 | + } | |
707 | + | |
708 | + | |
709 | + }, | |
710 | + | |
612 | 711 | |
613 | 712 | //---------------检查是否有收货地址------------------- |
614 | 713 | checkAddressList: function () { | ... | ... |
pages/cart/cart_wk/cart_wk.wxml
1 | 1 | <wxs module="filters" src="../../../utils/filter.wxs"></wxs> |
2 | 2 | |
3 | 3 | <!-- 先选择配送方式,2021.7修改 --> |
4 | + <block wx:if="{{show_submit}}"> | |
4 | 5 | <view class="tab-container" wx:if="{{kt_type!=3 || is_normal==1}}"> |
5 | 6 | <view class="tab-wrapper"> |
6 | 7 | <view hidden="{{distr_type==2}}" bindtap='set_wuliu' data-type='1' class="tab {{exp_type == 1? 'active':''}}" |
... | ... | @@ -8,9 +9,15 @@ |
8 | 9 | |
9 | 10 | <view hidden="{{distr_type==1}}" bindtap='set_wuliu' data-type='0' class="tab {{exp_type== 0 ? 'active':''}}" |
10 | 11 | data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> |
12 | + | |
13 | + <!-- 同城配送 --> | |
14 | + <block wx:if="{{show_same_city}}"> | |
15 | + <view hidden="{{bn_t_exp_t==3}}" bindtap='set_wuliu' data-type='2' class="tab {{exp_type== 2 ? 'active':''}}" data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}">同城配送</view> | |
16 | + </block> | |
11 | 17 | |
12 | 18 | </view> |
13 | 19 | </view> |
20 | + </block> | |
14 | 21 | |
15 | 22 | |
16 | 23 | <!----要进行判断地址是否显示----> |
... | ... | @@ -171,3 +178,5 @@ |
171 | 178 | |
172 | 179 | </view > |
173 | 180 | </view> |
181 | +<view style="height: 50rpx"></view> | |
182 | + | ... | ... |
pages/giftpack/buygiftpack/giftpackbuy.js
... | ... | @@ -335,21 +335,20 @@ Page({ |
335 | 335 | } |
336 | 336 | }, |
337 | 337 | |
338 | - // 分享朋友圈 | |
339 | - onShareTimeline() { | |
340 | - getApp().globalData.no_clear=1; | |
341 | - var curPage = this; | |
342 | - var pagePath = curPage.route; //当前页面url | |
343 | - if (pagePath.indexOf('/') != 0) { | |
344 | - pagePath = '/' + pagePath; | |
345 | - } | |
346 | - pagePath += "?first_leader=" + this.data.getUserID; | |
347 | - return { | |
348 | - title: '专享礼包', | |
349 | - imageUrl: this.data.ad_data.ad_code, | |
350 | - path: pagePath, | |
351 | - } | |
352 | - }, | |
338 | + // 分享朋友圈 | |
339 | + onShareTimeline() { | |
340 | + getApp().globalData.no_clear=1; | |
341 | + | |
342 | + var user_id=getApp().globalData.user_id; | |
343 | + if(!user_id) user_id=0; | |
344 | + | |
345 | + return { | |
346 | + title: '专享礼包', | |
347 | + imageUrl: this.data.ad_data.ad_code, | |
348 | + query: 'first_leader='+user_id | |
349 | + } | |
350 | + }, | |
351 | + | |
353 | 352 | |
354 | 353 | |
355 | 354 | //--- 设置一下默认库存的数量 ---- | ... | ... |
pages/giftpack/giftpacklist/giftpacklist.js
... | ... | @@ -544,28 +544,21 @@ Page({ |
544 | 544 | } |
545 | 545 | }, |
546 | 546 | |
547 | - /** | |
548 | - * 用户分享朋友圈 | |
549 | - */ | |
550 | - onShareTimeline() { | |
551 | - getApp().globalData.no_clear=1; | |
552 | - var curPage = this; | |
553 | - var pagePath = curPage.route; //当前页面url | |
554 | - if (pagePath.indexOf('/') != 0) { | |
555 | - pagePath = '/' + pagePath; | |
556 | - } | |
557 | - pagePath += "?isBuy=1" + "&lbId=" + this.data.lbId + "&first_leader=" + this.data.getUserID; | |
558 | - // if (this.data.isBuy == 0) { | |
559 | - // pagePath += "&orderSn=" + this.data.orderSn; | |
560 | - // } else { | |
561 | - // pagePath += "&lbId=" + this.data.getGiftID; | |
562 | - // } | |
563 | - console.log('pagePath', pagePath); | |
564 | - return { | |
565 | - title: "礼包详情", | |
566 | - path: pagePath, | |
567 | - } | |
568 | - }, | |
547 | + /** | |
548 | + * 用户分享朋友圈 | |
549 | + */ | |
550 | + onShareTimeline() { | |
551 | + getApp().globalData.no_clear=1; | |
552 | + | |
553 | + var pagePath ="&isBuy=1" + "&lbId=" + this.data.lbId + "&first_leader=" + this.data.getUserID; | |
554 | + var user_id=getApp().globalData.user_id; | |
555 | + if(!user_id) user_id=0; | |
556 | + | |
557 | + return { | |
558 | + title: "礼包详情", | |
559 | + query: 'first_leader='+user_id+pagePath | |
560 | + } | |
561 | + }, | |
569 | 562 | |
570 | 563 | //免费领取 |
571 | 564 | GetFree: function (e) { | ... | ... |
pages/giftpack/mygiftpack/mygiftpack.js
... | ... | @@ -177,20 +177,14 @@ Page({ |
177 | 177 | } |
178 | 178 | }, |
179 | 179 | |
180 | - onShareTimeline() { | |
181 | - getApp().globalData.no_clear=1; | |
182 | - var curPage = this; | |
183 | - var pagePath = curPage.route; //当前页面url | |
184 | - if (pagePath.indexOf('/') != 0) { | |
185 | - pagePath = '/' + pagePath; | |
186 | - } | |
187 | - pagePath += "?first_leader=" + this.data.getUserID; | |
188 | - return { | |
189 | - title: '专享礼包', | |
190 | - imageUrl: this.data.ad_data.ad_code, | |
191 | - path: pagePath, | |
192 | - } | |
193 | - }, | |
180 | + onShareTimeline() { | |
181 | + getApp().globalData.no_clear=1; | |
182 | + return { | |
183 | + title: '专享礼包', | |
184 | + imageUrl: this.data.ad_data.ad_code, | |
185 | + query: "first_leader=" + this.data.getUserID | |
186 | + } | |
187 | + }, | |
194 | 188 | |
195 | 189 | |
196 | 190 | }); |
197 | 191 | \ No newline at end of file | ... | ... |
pages/goods/categoryList/categoryList.js
... | ... | @@ -1092,15 +1092,20 @@ Page({ |
1092 | 1092 | if(url[0]!='/') url='/'+url; |
1093 | 1093 | getApp().goto(url); |
1094 | 1094 | }, |
1095 | - | |
1096 | - onShareTimeline(){ | |
1097 | - getApp().globalData.no_clear=1; | |
1098 | - var store_name=getApp().globalData.config?getApp().globalData.config.store_name:''; | |
1099 | - if(!store_name) | |
1100 | - store_name=getApp().globalData.setting.appName; | |
1101 | - return { | |
1102 | - title:'商品分类-'+store_name, | |
1103 | - } | |
1104 | - } | |
1095 | + | |
1096 | + onShareTimeline(){ | |
1097 | + getApp().globalData.no_clear=1; | |
1098 | + var store_name=getApp().globalData.config?getApp().globalData.config.store_name:''; | |
1099 | + if(!store_name) | |
1100 | + store_name=getApp().globalData.setting.appName; | |
1101 | + | |
1102 | + var user_id=getApp().globalData.user_id; | |
1103 | + if(!user_id) user_id=0; | |
1104 | + | |
1105 | + return { | |
1106 | + title:'商品分类-'+store_name, | |
1107 | + query: "first_leader=" + user_id | |
1108 | + } | |
1109 | + } | |
1105 | 1110 | |
1106 | 1111 | }); |
1107 | 1112 | \ No newline at end of file | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -548,8 +548,9 @@ Page({ |
548 | 548 | }); |
549 | 549 | |
550 | 550 | //更新点击量 |
551 | + //noinspection JSUnresolvedFunction | |
551 | 552 | getApp().request.put("/api/weshop/goods/updateClick", { |
552 | - data: {store_id: os.stoid, goods_id: gid} | |
553 | + data: {store_id: os.stoid, goods_id: gid,user_id:getApp().globalData.user_id?getApp().globalData.user_id:0 } | |
553 | 554 | }); |
554 | 555 | |
555 | 556 | |
... | ... | @@ -6673,16 +6674,33 @@ Page({ |
6673 | 6674 | |
6674 | 6675 | onShareTimeline() { |
6675 | 6676 | getApp().globalData.no_clear=1; |
6677 | + var th=this; | |
6676 | 6678 | var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; |
6677 | 6679 | if (!store_name) |
6678 | 6680 | store_name = getApp().globalData.setting.appName; |
6681 | + | |
6682 | + var url = "&goods_id=" | |
6683 | + + th.data.sele_g.goods_id + "&prom_type=" + th.data.sele_g.prom_type + "&prom_id=" + th.data.sele_g.prom_id; | |
6684 | + if (getApp().globalData.user_id) { | |
6685 | + url += "&first_leader=" + getApp().globalData.user_id; | |
6686 | + } | |
6687 | + | |
6688 | + //-- 如果房间分享,且不是会员分享的 -- | |
6689 | + if (getApp().globalData.room_id && | |
6690 | + th.data.sele_g.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share | |
6691 | + ) { | |
6692 | + url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1"; | |
6693 | + } | |
6694 | + | |
6679 | 6695 | return { |
6680 | 6696 | title: this.data.data.goods_name + '-' + store_name, |
6681 | 6697 | imageUrl: this.data.gallery[0].image_url, |
6698 | + query: 'first_leader='+user_id+url | |
6682 | 6699 | } |
6683 | 6700 | }, |
6684 | 6701 | |
6685 | 6702 | |
6703 | + | |
6686 | 6704 | clickCollapse() { |
6687 | 6705 | this.setData({ |
6688 | 6706 | flag: !this.data.flag, | ... | ... |
pages/user/assistance/assistance.js
... | ... | @@ -240,14 +240,19 @@ Page({ |
240 | 240 | } |
241 | 241 | }, |
242 | 242 | |
243 | - onShareTimeline() { | |
244 | - getApp().globalData.no_clear=1; | |
245 | - var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | |
246 | - if (!store_name) | |
247 | - store_name = getApp().globalData.setting.appName; | |
248 | - return { | |
249 | - title: '好友助力-' + store_name, | |
250 | - } | |
251 | - }, | |
243 | + onShareTimeline() { | |
244 | + getApp().globalData.no_clear=1; | |
245 | + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | |
246 | + if (!store_name) | |
247 | + store_name = getApp().globalData.setting.appName; | |
248 | + | |
249 | + var user_id=getApp().globalData.user_id; | |
250 | + if(!user_id) user_id=0; | |
251 | + | |
252 | + return { | |
253 | + title: '好友助力-' + store_name, | |
254 | + query: 'first_leader='+user_id | |
255 | + } | |
256 | + }, | |
252 | 257 | |
253 | 258 | }) | ... | ... |