Commit 44dad9ca110f17b6583296e0aceb35815ab74263

Authored by yvan.ni
1 parent b4641e4f

1. 分享朋友圈

2.  同城配送
packageA/pages/goodsInfo/goodsInfo.js
@@ -2932,14 +2932,38 @@ Page({ @@ -2932,14 +2932,38 @@ Page({
2932 2932
2933 onShareTimeline() { 2933 onShareTimeline() {
2934 getApp().globalData.no_clear=1 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,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 //-- 点击tab -- 287 //-- 点击tab --
packageA/pages/liveStream/liveStream.js
@@ -365,23 +365,18 @@ Page({ @@ -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,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 imageResize(imgWidth, imgHeight) { 646 imageResize(imgWidth, imgHeight) {
packageB/pages/zuhegou/index/index.js
@@ -468,18 +468,19 @@ Page({ @@ -468,18 +468,19 @@ Page({
468 onShareTimeline() { 468 onShareTimeline() {
469 getApp().globalData.no_clear=1; 469 getApp().globalData.no_clear=1;
470 var title = this.data.act.name; 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 var ob = { 475 var ob = {
476 title: title, 476 title: title,
477 - path: url, 477 + query: 'first_leader='+user_id+"&id=" + this.data.act.id
478 }; 478 };
479 if (this.data.act.img_url) 479 if (this.data.act.img_url)
480 ob.imageUrl = this.data.iurl + this.data.act.img_url; 480 ob.imageUrl = this.data.iurl + this.data.act.img_url;
481 return ob; 481 return ob;
482 }, 482 },
  483 +
483 /** 484 /**
484 * 点击规则详情,弹出规则 485 * 点击规则详情,弹出规则
485 */ 486 */
packageB/pages/zuhegou/preindex/index.js
@@ -470,18 +470,19 @@ Page({ @@ -470,18 +470,19 @@ Page({
470 onShareTimeline() { 470 onShareTimeline() {
471 getApp().globalData.no_clear=1; 471 getApp().globalData.no_clear=1;
472 var title = this.data.act.name; 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 var ob = { 477 var ob = {
478 title: title, 478 title: title,
479 - path: url, 479 + query: 'first_leader='+user_id+"&id=" + this.data.act.id
480 }; 480 };
481 if (this.data.act.img_url) 481 if (this.data.act.img_url)
482 ob.imageUrl = this.data.iurl + this.data.act.img_url; 482 ob.imageUrl = this.data.iurl + this.data.act.img_url;
483 return ob; 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,7 +1619,11 @@ Page({
1619 break; 1619 break;
1620 case 1: 1620 case 1:
1621 //order_m = o_condition - ord_prom['expression'];//满额优惠金额 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 break; 1627 break;
1624 } 1628 }
1625 } 1629 }
@@ -1976,8 +1980,13 @@ Page({ @@ -1976,8 +1980,13 @@ Page({
1976 order_prom_amount = (o_condition - order_m).toFixed(2); 1980 order_prom_amount = (o_condition - order_m).toFixed(2);
1977 break; 1981 break;
1978 case 1: 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 break; 1990 break;
1982 } 1991 }
1983 } 1992 }
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
@@ -242,6 +242,20 @@ Page({ @@ -242,6 +242,20 @@ Page({
242 var gd = t.data.data; 242 var gd = t.data.data;
243 if (!gd) return false; 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 t.data.data.original_img = oo.imghost + t.data.data.original_img; 259 t.data.data.original_img = oo.imghost + t.data.data.original_img;
246 t.data.data['buynum'] = gg.goods_num; 260 t.data.data['buynum'] = gg.goods_num;
247 // console.log(t.data.data); 261 // console.log(t.data.data);
@@ -406,12 +420,14 @@ Page({ @@ -406,12 +420,14 @@ Page({
406 th.data.json_d = json_d; 420 th.data.json_d = json_d;
407 th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 421 th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
408 var is_default_logistics = json_d.is_default_logistics; 422 var is_default_logistics = json_d.is_default_logistics;
  423 + var is_same_city = json_d.is_same_city;
409 424
410 th.setData({ 425 th.setData({
411 is_close_quan: json_d.is_close_quan, 426 is_close_quan: json_d.is_close_quan,
412 sales_rules: ee.sales_rules, 427 sales_rules: ee.sales_rules,
413 rank_switch: json_d.rank_switch, 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 var rank_switch = json_d.rank_switch; 433 var rank_switch = json_d.rank_switch;
@@ -499,9 +515,7 @@ Page({ @@ -499,9 +515,7 @@ Page({
499 console.log('calculatePrice2'); 515 console.log('calculatePrice2');
500 var th = this, 516 var th = this,
501 good = this.data.bn_goods; 517 good = this.data.bn_goods;
502 -  
503 - th.setData({is_show_sub:0});  
504 - 518 +
505 //-----------计算商品总价-------------- 519 //-----------计算商品总价--------------
506 var allpice = th.data.param.goods_price; 520 var allpice = th.data.param.goods_price;
507 allpice = parseFloat(allpice).toFixed(2); 521 allpice = parseFloat(allpice).toFixed(2);
@@ -510,6 +524,8 @@ Page({ @@ -510,6 +524,8 @@ Page({
510 [txt]: allpice, 524 [txt]: allpice,
511 }); 525 });
512 526
  527 + this.setData({sub:1});
  528 +
513 wx.showLoading({ 529 wx.showLoading({
514 title: "处理中.", 530 title: "处理中.",
515 mask:true 531 mask:true
@@ -544,8 +560,9 @@ Page({ @@ -544,8 +560,9 @@ Page({
544 let item = gd_arr_list[i]; 560 let item = gd_arr_list[i];
545 561
546 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { 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 if (item['exp_sum_type'] == 2) { 564 if (item['exp_sum_type'] == 2) {
  565 + if (goods_weight < 0) goods_weight = 0;
549 goods_weight += item['weight'] * item['buynum']; 566 goods_weight += item['weight'] * item['buynum'];
550 cut_good_weight += item['weight'] * item['buynum']; 567 cut_good_weight += item['weight'] * item['buynum'];
551 } 568 }
@@ -611,7 +628,7 @@ Page({ @@ -611,7 +628,7 @@ Page({
611 wx.showToast({ 628 wx.showToast({
612 title: "计算物流错误", icon: 'none',duration: 2000 629 title: "计算物流错误", icon: 'none',duration: 2000
613 }) 630 })
614 - th.setData({ show_submit:0 }); 631 + th.setData({ show_submit:0,sub:0 });
615 wx.hideLoading(); 632 wx.hideLoading();
616 } 633 }
617 634
@@ -622,12 +639,62 @@ Page({ @@ -622,12 +639,62 @@ Page({
622 [wl_txt]: shipping_price, 639 [wl_txt]: shipping_price,
623 }) 640 })
624 641
625 - } else { 642 + } else if(th.data.bn_exp_type==1) {
626 var wl_txt = "formData.shipping_price"; 643 var wl_txt = "formData.shipping_price";
627 th.setData({ 644 th.setData({
628 [wl_txt]: 0, 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 // 幸运购 01 699 // 幸运购 01
633 // var total_m = parseFloat(allpice) + parseFloat( th.data.formData.shipping_price); 700 // var total_m = parseFloat(allpice) + parseFloat( th.data.formData.shipping_price);
@@ -648,7 +715,7 @@ Page({ @@ -648,7 +715,7 @@ Page({
648 th.setData({ 715 th.setData({
649 [txt]: total_m, 716 [txt]: total_m,
650 [txt2]: 0, 717 [txt2]: 0,
651 - is_show_sub:1 718 + is_show_sub:1,sub:0
652 }) 719 })
653 } else { 720 } else {
654 order_m = parseFloat(order_m) - parseFloat(th.data.yuer); 721 order_m = parseFloat(order_m) - parseFloat(th.data.yuer);
@@ -656,14 +723,14 @@ Page({ @@ -656,14 +723,14 @@ Page({
656 th.setData({ 723 th.setData({
657 [txt]: th.data.yuer, 724 [txt]: th.data.yuer,
658 [txt2]: order_m, 725 [txt2]: order_m,
659 - is_show_sub:1 726 + is_show_sub:1,sub:0
660 }) 727 })
661 } 728 }
662 } else { 729 } else {
663 th.setData({ 730 th.setData({
664 [txt]: 0, 731 [txt]: 0,
665 [txt2]: order_m, 732 [txt2]: order_m,
666 - is_show_sub:1 733 + is_show_sub:1,sub:0
667 }) 734 })
668 } 735 }
669 wx.hideLoading(); 736 wx.hideLoading();
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml
@@ -10,6 +10,11 @@ @@ -10,6 +10,11 @@
10 10
11 <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" 11 <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}"
12 data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> 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 </view> 19 </view>
15 </view> 20 </view>
@@ -160,7 +165,7 @@ @@ -160,7 +165,7 @@
160 <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> 165 <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view>
161 <!-- <view class="co-red big"></view> --> 166 <!-- <view class="co-red big"></view> -->
162 </view> 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 </view> 169 </view>
165 </form> 170 </form>
166 171
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
@@ -528,8 +528,9 @@ Page({ @@ -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,14 +2451,15 @@ Page({
2450 if (pagePath.indexOf('/') != 0) { 2451 if (pagePath.indexOf('/') != 0) {
2451 pagePath = '/' + pagePath; 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 return { 2463 return {
2462 title: "邀您一起参加幸运购", 2464 title: "邀您一起参加幸运购",
2463 path: pagePath, 2465 path: pagePath,
@@ -6197,12 +6199,19 @@ Page({ @@ -6197,12 +6199,19 @@ Page({
6197 6199
6198 onShareTimeline() { 6200 onShareTimeline() {
6199 getApp().globalData.no_clear=1; 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 return { 6211 return {
6204 title: this.data.data.goods_name + '-' + store_name, 6212 title: this.data.data.goods_name + '-' + store_name,
6205 imageUrl: this.data.gallery[0].image_url, 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,12 +205,14 @@ Page({
205 th.data.json_d = json_d; 205 th.data.json_d = json_d;
206 th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 206 th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
207 var is_default_logistics = json_d.is_default_logistics; 207 var is_default_logistics = json_d.is_default_logistics;
  208 + var is_same_city = json_d.is_same_city;
208 209
209 th.setData({ 210 th.setData({
210 is_close_quan: json_d.is_close_quan, 211 is_close_quan: json_d.is_close_quan,
211 sales_rules: ee.sales_rules, 212 sales_rules: ee.sales_rules,
212 rank_switch: json_d.rank_switch, 213 rank_switch: json_d.rank_switch,
213 is_default_logistics: is_default_logistics, 214 is_default_logistics: is_default_logistics,
  215 + is_same_city: is_same_city,
214 sys_switch: json_d, 216 sys_switch: json_d,
215 }); 217 });
216 218
@@ -500,6 +502,21 @@ Page({ @@ -500,6 +502,21 @@ Page({
500 order.show_img = oo.imghost + goods.original_img; 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 var g_url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + order_goods.goods_id + "&pre_id=" + pre_arr.id; 521 var g_url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + order_goods.goods_id + "&pre_id=" + pre_arr.id;
505 if (act.is_end || th.data.act.end_time < ut.gettimestamp()) { 522 if (act.is_end || th.data.act.end_time < ut.gettimestamp()) {
@@ -590,6 +607,11 @@ Page({ @@ -590,6 +607,11 @@ Page({
590 break; //物流 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 if (th.data.wait_fh) { 616 if (th.data.wait_fh) {
595 var send_time = th.data.act.delivery_date; 617 var send_time = th.data.act.delivery_date;
@@ -629,12 +651,16 @@ Page({ @@ -629,12 +651,16 @@ Page({
629 async calculatePrice2() { 651 async calculatePrice2() {
630 var th = this; 652 var th = this;
631 if (!this.data.pre_arr) return false; 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 if (this.data.exp_type == 0) { 657 if (this.data.exp_type == 0) {
636 this.calculate_wuliu(); 658 this.calculate_wuliu();
637 - } else { 659 + }else if (this.data.exp_type == 2) {
  660 + this.calculate_same_city();
  661 + }
  662 +
  663 + else {
638 var allpice = this.data.pre_arr.presell_price * this.data.order_goods.goods_num; 664 var allpice = this.data.pre_arr.presell_price * this.data.order_goods.goods_num;
639 allpice = allpice.toFixed(2); 665 allpice = allpice.toFixed(2);
640 //--看一下有没有订单优惠-- 666 //--看一下有没有订单优惠--
@@ -698,8 +724,14 @@ Page({ @@ -698,8 +724,14 @@ Page({
698 order_prom_amount = (all_1 - o_condition1).toFixed(2); 724 order_prom_amount = (all_1 - o_condition1).toFixed(2);
699 break; 725 break;
700 case 1: 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 break; 735 break;
704 } 736 }
705 } 737 }
@@ -1824,8 +1856,9 @@ Page({ @@ -1824,8 +1856,9 @@ Page({
1824 let item = gd_arr_list[i]; 1856 let item = gd_arr_list[i];
1825 1857
1826 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { 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 if (item['exp_sum_type'] == 2) { 1860 if (item['exp_sum_type'] == 2) {
  1861 + if (goods_weight < 0) goods_weight = 0;
1829 goods_weight += item['weight'] * item['buynum']; 1862 goods_weight += item['weight'] * item['buynum'];
1830 cut_good_weight += item['weight'] * item['buynum']; 1863 cut_good_weight += item['weight'] * item['buynum'];
1831 } 1864 }
@@ -1908,6 +1941,118 @@ Page({ @@ -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 wuliu_next(allpice, quan_price, exp_price) { 2057 wuliu_next(allpice, quan_price, exp_price) {
1913 var th = this; 2058 var th = this;
packageC/pages/presell/cart/cart.wxml
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <wxs src="filter.wxs" module="util"></wxs> 2 <wxs src="filter.wxs" module="util"></wxs>
3 <wxs module="filters" src="../../../../utils/filter.wxs"></wxs> 3 <wxs module="filters" src="../../../../utils/filter.wxs"></wxs>
4 4
5 -<form bindsubmit="submitForm" wx:if="{{show_submit}}"> 5 +<form bindsubmit="submitForm">
6 <view class="container"> 6 <view class="container">
7 <!-- 支付进度 --> 7 <!-- 支付进度 -->
8 <view class="information bdr14 mgt20"> 8 <view class="information bdr14 mgt20">
@@ -120,6 +120,12 @@ @@ -120,6 +120,12 @@
120 class="tab {{exp_type== 0 ? 'active':''}}" 120 class="tab {{exp_type== 0 ? 'active':''}}"
121 data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}">快递邮寄 121 data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}">快递邮寄
122 </view> 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 </view> 129 </view>
124 <!----要进行判断地址是否显示----> 130 <!----要进行判断地址是否显示---->
125 <view bindtap="enterAddressPage" class="user-mes mgt20" 131 <view bindtap="enterAddressPage" class="user-mes mgt20"
@@ -359,7 +365,7 @@ @@ -359,7 +365,7 @@
359 请于{{days}}天{{hours}}小时{{minutes}}分{{seconds}}秒内付款完成,超时订单将自动取消 365 请于{{days}}天{{hours}}小时{{minutes}}分{{seconds}}秒内付款完成,超时订单将自动取消
360 </view> 366 </view>
361 367
362 - <view class="btn-wrap"> 368 + <view class="btn-wrap" hidden="{{disabled_btn}}">
363 <view class="pay-amount"> 369 <view class="pay-amount">
364 <view class="payable">应付金额: 370 <view class="payable">应付金额:
365 <text class="co-red"> <text class="fs24">¥</text>{{filters.toFix(order_m,2)}}</text> 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,9 +153,7 @@ Page({
153 //----------子页返回父页触发---------- 153 //----------子页返回父页触发----------
154 onShow: function () { 154 onShow: function () {
155 var th = this; 155 var th = this;
156 - th.setData({ show_submit: 0 }); //让提交先掩藏  
157 th.data.g_cart_q_time = null; 156 th.data.g_cart_q_time = null;
158 -  
159 if (th.data.isclose == 0) { 157 if (th.data.isclose == 0) {
160 wx.navigateTo({ 158 wx.navigateTo({
161 url: "/pages/index/index/index" 159 url: "/pages/index/index/index"
@@ -217,12 +215,14 @@ Page({ @@ -217,12 +215,14 @@ Page({
217 th.data.json_d = json_d; 215 th.data.json_d = json_d;
218 th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 216 th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
219 var is_default_logistics = json_d.is_default_logistics; 217 var is_default_logistics = json_d.is_default_logistics;
  218 + var is_same_city = json_d.is_same_city;
220 219
221 th.setData({ 220 th.setData({
222 is_close_quan: json_d.is_close_quan, 221 is_close_quan: json_d.is_close_quan,
223 sales_rules: ee.sales_rules, 222 sales_rules: ee.sales_rules,
224 rank_switch: json_d.rank_switch, 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 var rank_switch = json_d.rank_switch; 228 var rank_switch = json_d.rank_switch;
@@ -384,6 +384,21 @@ Page({ @@ -384,6 +384,21 @@ Page({
384 var gd = t.data.data; 384 var gd = t.data.data;
385 if (!gd) return false; 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 t.data.data.original_img = oo.imghost + t.data.data.original_img; 402 t.data.data.original_img = oo.imghost + t.data.data.original_img;
388 t.data.data['buynum'] = th.data.gg.goods_num; 403 t.data.data['buynum'] = th.data.gg.goods_num;
389 var distr_t = 0, et = 0 404 var distr_t = 0, et = 0
@@ -581,6 +596,8 @@ Page({ @@ -581,6 +596,8 @@ Page({
581 return false; 596 return false;
582 } 597 }
583 598
  599 + th.setData({dis_btn:1})
  600 +
584 wx.showLoading({ 601 wx.showLoading({
585 title: "处理中.",mask:true 602 title: "处理中.",mask:true
586 }) 603 })
@@ -699,8 +716,9 @@ Page({ @@ -699,8 +716,9 @@ Page({
699 let item = gd_arr_list[i]; 716 let item = gd_arr_list[i];
700 717
701 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { 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 if (item['exp_sum_type'] == 2) { 720 if (item['exp_sum_type'] == 2) {
  721 + if (goods_weight < 0) goods_weight = 0;
704 cut_good_weight += item['weight'] * item['buynum']; 722 cut_good_weight += item['weight'] * item['buynum'];
705 goods_weight += item['weight'] * item['buynum']; 723 goods_weight += item['weight'] * item['buynum'];
706 724
@@ -785,7 +803,7 @@ Page({ @@ -785,7 +803,7 @@ Page({
785 var wl_txt = "formData.shipping_price"; 803 var wl_txt = "formData.shipping_price";
786 th.setData({[wl_txt]: shipping_price,}) 804 th.setData({[wl_txt]: shipping_price,})
787 805
788 - } else { 806 + } else if(th.data.bn_exp_type==1) {
789 var wl_txt = "formData.shipping_price"; 807 var wl_txt = "formData.shipping_price";
790 th.setData({ [wl_txt]: 0, }) 808 th.setData({ [wl_txt]: 0, })
791 } 809 }
@@ -807,6 +825,55 @@ Page({ @@ -807,6 +825,55 @@ Page({
807 } 825 }
808 //--看一下有没有订单优惠-- 826 //--看一下有没有订单优惠--
809 var o_condition = parseFloat(order_m); 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 if (o_condition > 0 && th.data.act.is_useorderyh) { 877 if (o_condition > 0 && th.data.act.is_useorderyh) {
811 th.check_is_order_prom(o_condition, function () { 878 th.check_is_order_prom(o_condition, function () {
812 var order_prom_amount = 0; 879 var order_prom_amount = 0;
@@ -821,8 +888,14 @@ Page({ @@ -821,8 +888,14 @@ Page({
821 order_prom_amount = (o_condition - order_m).toFixed(2); 888 order_prom_amount = (o_condition - order_m).toFixed(2);
822 break; 889 break;
823 case 1: 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 break; 899 break;
827 } 900 }
828 } 901 }
@@ -851,14 +924,14 @@ Page({ @@ -851,14 +924,14 @@ Page({
851 if (th.data.bn_use_money == 1) { 924 if (th.data.bn_use_money == 1) {
852 if (amoney > order_m) { 925 if (amoney > order_m) {
853 order_m = parseFloat(order_m).toFixed(2); 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 } else { 928 } else {
856 order_m = parseFloat(order_m) - parseFloat(amoney); 929 order_m = parseFloat(order_m) - parseFloat(amoney);
857 order_m = order_m.toFixed(2); 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 } else { 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 if (good.s_intValue) { 937 if (good.s_intValue) {
@@ -906,14 +979,14 @@ Page({ @@ -906,14 +979,14 @@ Page({
906 if (th.data.bn_use_money == 1) { 979 if (th.data.bn_use_money == 1) {
907 if (amoney > order_m) { 980 if (amoney > order_m) {
908 order_m = parseFloat(order_m).toFixed(2); 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 } else { 983 } else {
911 order_m = parseFloat(order_m) - parseFloat(amoney); 984 order_m = parseFloat(order_m) - parseFloat(amoney);
912 order_m = order_m.toFixed(2); 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 } else { 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 if (good.s_intValue) { 992 if (good.s_intValue) {
packageC/pages/presell/cart/cart2.wxml
@@ -13,6 +13,10 @@ @@ -13,6 +13,10 @@
13 13
14 <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" 14 <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}"
15 data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> 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 </view> 21 </view>
18 </view> 22 </view>
@@ -239,7 +243,7 @@ @@ -239,7 +243,7 @@
239 <view class="pay-amount"> 243 <view class="pay-amount">
240 <view class="payable">应付金额:<text class="co-red"><text class="fs24">¥</text>{{formData.order_amount}}</text></view> 244 <view class="payable">应付金额:<text class="co-red"><text class="fs24">¥</text>{{formData.order_amount}}</text></view>
241 </view> 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 </view> 247 </view>
244 </form> 248 </form>
245 249
packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -431,7 +431,7 @@ Page({ @@ -431,7 +431,7 @@ Page({
431 431
432 //更新点击量 432 //更新点击量
433 getApp().request.put("/api/weshop/goods/updateClick", { 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,17 +3832,33 @@ Page({
3832 getApp().pre_img(this.data.shareImgPath); 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 clickCollapse() { 3863 clickCollapse() {
3848 this.setData({ flag: !this.data.flag, }) 3864 this.setData({ flag: !this.data.flag, })
packageC/pages/presell/pregoodsInfo/goodsInfo.js
@@ -425,7 +425,7 @@ Page({ @@ -425,7 +425,7 @@ Page({
425 }); 425 });
426 //更新点击量 426 //更新点击量
427 getApp().request.put("/api/weshop/goods/updateClick", { 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,17 +3801,35 @@ Page({
3801 getApp().pre_img(this.data.shareImgPath); 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 clickCollapse() { 3834 clickCollapse() {
3817 this.setData({ flag: !this.data.flag, }) 3835 this.setData({ flag: !this.data.flag, })
pages/activity/pind_list/pind_list.js
@@ -249,15 +249,20 @@ Page({ @@ -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 go_url(e){ 266 go_url(e){
262 let url=e.currentTarget.dataset.url; 267 let url=e.currentTarget.dataset.url;
263 if(url){ 268 if(url){
pages/activity/seckill_list/seckill_list.js
@@ -267,15 +267,20 @@ Page({ @@ -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 imageLoad: function (e) { 285 imageLoad: function (e) {
281 var imgwidth = e.detail.width; 286 var imgwidth = e.detail.width;
pages/cart/cart2/cart2.js
@@ -180,7 +180,6 @@ Page({ @@ -180,7 +180,6 @@ Page({
180 //----------子页返回父页触发---------- 180 //----------子页返回父页触发----------
181 onShow: function () { 181 onShow: function () {
182 var th = this; 182 var th = this;
183 - th.setData({ show_submit: 0 }); //让提交先掩藏  
184 th.data.g_cart_q_time = null; 183 th.data.g_cart_q_time = null;
185 184
186 if (th.data.isclose == 0) { 185 if (th.data.isclose == 0) {
@@ -243,12 +242,14 @@ Page({ @@ -243,12 +242,14 @@ Page({
243 th.data.json_d = json_d; 242 th.data.json_d = json_d;
244 th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 243 th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
245 var is_default_logistics = json_d.is_default_logistics; 244 var is_default_logistics = json_d.is_default_logistics;
  245 + var is_same_city = json_d.is_same_city;
246 246
247 th.setData({ 247 th.setData({
248 is_close_quan: json_d.is_close_quan, 248 is_close_quan: json_d.is_close_quan,
249 sales_rules: ee.sales_rules, 249 sales_rules: ee.sales_rules,
250 rank_switch: json_d.rank_switch, 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 var rank_switch = json_d.rank_switch; 255 var rank_switch = json_d.rank_switch;
@@ -369,23 +370,20 @@ Page({ @@ -369,23 +370,20 @@ Page({
369 th.setData({ user_addr: addr }); 370 th.setData({ user_addr: addr });
370 //--------------------------立即购买------------------ 371 //--------------------------立即购买------------------
371 if (ta.is_bnow == 1) { 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 th.get_buy_goods(ta.goods_id); 377 th.get_buy_goods(ta.goods_id);
378 - }); 378 + //});
379 } else { 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 th.get_cart(); 385 th.get_cart();
388 - }) 386 + //})
389 } 387 }
390 }); 388 });
391 389
@@ -421,6 +419,23 @@ Page({ @@ -421,6 +419,23 @@ Page({
421 //按门店分类的数组 419 //按门店分类的数组
422 var arr = new Array(); 420 var arr = new Array();
423 var carr = su.data.data.pageData; 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 th.data.cartlist_y = carr; //存储原始购物车列表 439 th.data.cartlist_y = carr; //存储原始购物车列表
425 th.data.in_zhact_gdmap = {}; 440 th.data.in_zhact_gdmap = {};
426 441
@@ -702,13 +717,13 @@ Page({ @@ -702,13 +717,13 @@ Page({
702 user_money: 0, 717 user_money: 0,
703 total_amount: 0, 718 total_amount: 0,
704 order_amount: 0, 719 order_amount: 0,
705 - user_note: "" 720 + user_note: "",
  721 + sto:sto
706 }; 722 };
707 723
708 //-- 把等级卡会优惠多少钱装进去 -- 724 //-- 把等级卡会优惠多少钱装进去 --
709 if (car_item.cut_price1) ie.card_cut_price += car_item.cut_price1; 725 if (car_item.cut_price1) ie.card_cut_price += car_item.cut_price1;
710 arr.push(ie); 726 arr.push(ie);
711 -  
712 } 727 }
713 } 728 }
714 //-- 如果是回退回来的情况 -- 729 //-- 如果是回退回来的情况 --
@@ -721,7 +736,7 @@ Page({ @@ -721,7 +736,7 @@ Page({
721 ie.wind = parseInt(th.data.cartlist[kj].wind); 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 break; 741 break;
727 } 742 }
@@ -788,11 +803,23 @@ Page({ @@ -788,11 +803,23 @@ Page({
788 ladder_calc.fir_set_arr(u_item, th); 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 th.data.old_cartlist = JSON.parse(JSON.stringify(arr)); 818 th.data.old_cartlist = JSON.parse(JSON.stringify(arr));
793 th.setData({ 819 th.setData({
794 cartlist: arr, 820 cartlist: arr,
795 }); 821 });
  822 +
796 //--- 获取一下看有没有优惠券 ---- 823 //--- 获取一下看有没有优惠券 ----
797 setTimeout(function () { 824 setTimeout(function () {
798 var frozenQuan = null; 825 var frozenQuan = null;
@@ -823,6 +850,21 @@ Page({ @@ -823,6 +850,21 @@ Page({
823 var gd = t.data.data; 850 var gd = t.data.data;
824 if (!gd) return false; 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 t.data.data.original_img = oo.imghost + t.data.data.original_img; 868 t.data.data.original_img = oo.imghost + t.data.data.original_img;
827 t.data.data['buynum'] = gg.goods_num; 869 t.data.data['buynum'] = gg.goods_num;
828 var distr_t = 0, et = 0 870 var distr_t = 0, et = 0
@@ -1516,6 +1558,9 @@ Page({ @@ -1516,6 +1558,9 @@ Page({
1516 1558
1517 await th.get_cart_quan(c_arr); 1559 await th.get_cart_quan(c_arr);
1518 1560
  1561 +
  1562 + //-- 经纬度不循环调用接口 --
  1563 + var lon=0; var lat=0;
1519 //---循环购物车--- 1564 //---循环购物车---
1520 for (var i in c_arr) { 1565 for (var i in c_arr) {
1521 //因为搭配购买也是再这里计算,搭配购的is_b_now==1 1566 //因为搭配购买也是再这里计算,搭配购的is_b_now==1
@@ -1526,13 +1571,14 @@ Page({ @@ -1526,13 +1571,14 @@ Page({
1526 if (th.data.cartlist[i].check_quan_price_list) c_arr[i].check_quan_price_list = th.data.cartlist[i].check_quan_price_list; //优惠券优惠什么商品价格 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 if (th.data.cartlist[i].check_quan_ware_list) c_arr[i].check_quan_ware_list = th.data.cartlist[i].check_quan_ware_list; //优惠券优惠什么商品 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 } else { 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 //c_arr[i].=th.data. //立即购买的使用余额 1576 //c_arr[i].=th.data. //立即购买的使用余额
1532 if (th.data.cartlist) c_arr[i].check_quan_price_list = th.data.cartlist[i].check_quan_price_list; //优惠券优惠什么商品价格 1577 if (th.data.cartlist) c_arr[i].check_quan_price_list = th.data.cartlist[i].check_quan_price_list; //优惠券优惠什么商品价格
1533 if (th.data.cartlist) c_arr[i].check_quan_ware_list = th.data.cartlist[i].check_quan_ware_list; //优惠券优惠什么商品 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 var cart_item = c_arr[i]; //就是每一单的意思 1582 var cart_item = c_arr[i]; //就是每一单的意思
1537 var pickid = cart_item.pickup_id; 1583 var pickid = cart_item.pickup_id;
1538 var o_price = 0; 1584 var o_price = 0;
@@ -1766,8 +1812,9 @@ Page({ @@ -1766,8 +1812,9 @@ Page({
1766 } 1812 }
1767 1813
1768 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item[j].goods_id) == -1)) { 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 if (item[j]['exp_sum_type'] == 2) { 1816 if (item[j]['exp_sum_type'] == 2) {
  1817 + if (goods_weight < 0) goods_weight = 0;
1771 cut_good_weight += item[j]['weight'] * item[j]['goods_num']; 1818 cut_good_weight += item[j]['weight'] * item[j]['goods_num'];
1772 goods_weight += item[j]['weight'] * item[j]['goods_num']; 1819 goods_weight += item[j]['weight'] * item[j]['goods_num'];
1773 } 1820 }
@@ -1847,7 +1894,7 @@ Page({ @@ -1847,7 +1894,7 @@ Page({
1847 if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) { 1894 if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) {
1848 if (cart_item.shipping_price == 0) th.data.is_by[pickid] = 1; //已经全场包邮,就不要选择券了 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 cart_item.shipping_price = 0; 1898 cart_item.shipping_price = 0;
1852 } 1899 }
1853 1900
@@ -1873,6 +1920,54 @@ Page({ @@ -1873,6 +1920,54 @@ Page({
1873 o_condition=o_condition-whsle_goods_price; 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 var order_m = 0; 1971 var order_m = 0;
1877 //---判断是不是有订单优惠--- 1972 //---判断是不是有订单优惠---
1878 await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { 1973 await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
@@ -2020,7 +2115,7 @@ Page({ @@ -2020,7 +2115,7 @@ Page({
2020 } 2115 }
2021 //-- 包邮券 -- 2116 //-- 包邮券 --
2022 var by_quan = th.data.get_by_quan_list_cart[pkid]; 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 for (var iter2 in by_quan) { 2119 for (var iter2 in by_quan) {
2025 //判断是不是其他订单有选用 2120 //判断是不是其他订单有选用
2026 var is_other_is_use = th.check_other_use_by(by_quan[iter2], pkid); 2121 var is_other_is_use = th.check_other_use_by(by_quan[iter2], pkid);
@@ -2050,6 +2145,7 @@ Page({ @@ -2050,6 +2145,7 @@ Page({
2050 title: "处理中.", 2145 title: "处理中.",
2051 mask:true 2146 mask:true
2052 }) 2147 })
  2148 +
2053 //-----------计算商品总价-------------- 2149 //-----------计算商品总价--------------
2054 var allpice = good.shop_price * good.buynum; 2150 var allpice = good.shop_price * good.buynum;
2055 var cut_price = 0; 2151 var cut_price = 0;
@@ -2205,8 +2301,8 @@ Page({ @@ -2205,8 +2301,8 @@ Page({
2205 2301
2206 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { 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 if (item['exp_sum_type'] == 2) { 2304 if (item['exp_sum_type'] == 2) {
  2305 + if (goods_weight < 0) goods_weight = 0;
2210 goods_weight += item['weight'] * item['buynum']; 2306 goods_weight += item['weight'] * item['buynum'];
2211 cut_good_weight += item['weight'] * item['buynum']; 2307 cut_good_weight += item['weight'] * item['buynum'];
2212 } 2308 }
@@ -2293,7 +2389,7 @@ Page({ @@ -2293,7 +2389,7 @@ Page({
2293 var wl_txt = "formData.shipping_price"; 2389 var wl_txt = "formData.shipping_price";
2294 th.setData({[wl_txt]: shipping_price,}) 2390 th.setData({[wl_txt]: shipping_price,})
2295 2391
2296 - } else { 2392 + } else if(th.data.bn_exp_type == 1 ) {
2297 var wl_txt = "formData.shipping_price"; 2393 var wl_txt = "formData.shipping_price";
2298 th.setData({ [wl_txt]: 0, }) 2394 th.setData({ [wl_txt]: 0, })
2299 } 2395 }
@@ -2317,6 +2413,59 @@ Page({ @@ -2317,6 +2413,59 @@ Page({
2317 var o_condition = parseFloat(order_m); 2413 var o_condition = parseFloat(order_m);
2318 if(th.data.bn_goods.whsle_id>0){ 2414 if(th.data.bn_goods.whsle_id>0){
2319 o_condition=0; 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 if (o_condition > 0) { 2471 if (o_condition > 0) {
@@ -3326,7 +3475,7 @@ Page({ @@ -3326,7 +3475,7 @@ Page({
3326 } else { 3475 } else {
3327 for (var i = 0; i < th.data.cartlist.length; i++) { 3476 for (var i = 0; i < th.data.cartlist.length; i++) {
3328 var item = th.data.cartlist[i]; 3477 var item = th.data.cartlist[i];
3329 - if (item.exp_type == 0) { 3478 + if (item.exp_type == 0 || item.exp_type==2 ) {
3330 iszt = 0; 3479 iszt = 0;
3331 break; 3480 break;
3332 } 3481 }
pages/cart/cart2/cart2.wxml
@@ -13,6 +13,11 @@ @@ -13,6 +13,11 @@
13 13
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> 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 </view> 21 </view>
17 </view> 22 </view>
18 </block> 23 </block>
@@ -24,13 +29,18 @@ @@ -24,13 +29,18 @@
24 29
25 <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> 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 </view> 37 </view>
28 </view> 38 </view>
29 </block> 39 </block>
30 </block> 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 <block wx:if="{{user_addr!=null}}"> 45 <block wx:if="{{user_addr!=null}}">
36 46
@@ -135,7 +145,7 @@ @@ -135,7 +145,7 @@
135 145
136 <block wx:if="{{item.exp_type==1}}"> 146 <block wx:if="{{item.exp_type==1}}">
137 <!-- <view class="circle white xc-hookt fs20 red-b sn"><text>Γ</text></view> --> 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 </block> 149 </block>
140 <block wx:else> 150 <block wx:else>
141 <view class="circle xc-hookts on"></view> 151 <view class="circle xc-hookts on"></view>
@@ -154,6 +164,19 @@ @@ -154,6 +164,19 @@
154 164
155 <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> 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 </view> 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 </view> 180 </view>
158 181
159 182
@@ -215,7 +238,7 @@ @@ -215,7 +238,7 @@
215 </view> 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 <view class="work-frame flex-space-between"> 242 <view class="work-frame flex-space-between">
220 <view class="work">优惠券<text class="quan_num_show fs20">{{item.can_num}}张可用</text></view> 243 <view class="work">优惠券<text class="quan_num_show fs20">{{item.can_num}}张可用</text></view>
221 <view class="xc-right-frame"> 244 <view class="xc-right-frame">
@@ -415,10 +438,12 @@ @@ -415,10 +438,12 @@
415 <icon color="#f23030" size="16" type="info"></icon>{{order.store_prom}} 438 <icon color="#f23030" size="16" type="info"></icon>{{order.store_prom}}
416 </view> 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 <view class="work-frame flex-space-between"> 444 <view class="work-frame flex-space-between">
420 <view class="work"> 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 </view> 447 </view>
423 <view class="xc-right-frame"> 448 <view class="xc-right-frame">
424 <text wx:if="{{using_quan[bn_pick].is_nouse}}">不使用</text> 449 <text wx:if="{{using_quan[bn_pick].is_nouse}}">不使用</text>
pages/cart/cart2_inte/cart2_inte.js
@@ -95,7 +95,9 @@ Page({ @@ -95,7 +95,9 @@ Page({
95 th.data.json_d = json_d; 95 th.data.json_d = json_d;
96 th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 96 th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
97 var is_default_logistics = json_d.is_default_logistics; 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 var rank_switch = json_d.rank_switch; 102 var rank_switch = json_d.rank_switch;
101 var max_price = -1; 103 var max_price = -1;
@@ -290,6 +292,22 @@ Page({ @@ -290,6 +292,22 @@ Page({
290 var gd = t.data.data; 292 var gd = t.data.data;
291 if (!gd) return false; 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 t.data.data.original_img = oo.imghost + t.data.data.original_img; 311 t.data.data.original_img = oo.imghost + t.data.data.original_img;
294 t.data.data['buynum'] = gg.goods_num; 312 t.data.data['buynum'] = gg.goods_num;
295 var distr_t = 0, et = 0 313 var distr_t = 0, et = 0
@@ -409,6 +427,8 @@ Page({ @@ -409,6 +427,8 @@ Page({
409 //---------计算立即购买---------- 427 //---------计算立即购买----------
410 calculatePrice2:async function () { 428 calculatePrice2:async function () {
411 var th = this, good = this.data.bn_goods; 429 var th = this, good = this.data.bn_goods;
  430 +
  431 + this.setData({show_submit:0})
412 wx.showLoading({ title: "处理中.", mask:true }) 432 wx.showLoading({ title: "处理中.", mask:true })
413 //-----------计算商品总价-------------- 433 //-----------计算商品总价--------------
414 var allpice = good.shop_price * good.buynum; 434 var allpice = good.shop_price * good.buynum;
@@ -519,6 +539,7 @@ Page({ @@ -519,6 +539,7 @@ Page({
519 shipping_price=res.data.data; is_ok=1; 539 shipping_price=res.data.data; is_ok=1;
520 } 540 }
521 }) 541 })
  542 +
522 if(!is_ok){ 543 if(!is_ok){
523 wx.showToast({ 544 wx.showToast({
524 title: "计算物流错误", icon: 'none',duration: 2000 545 title: "计算物流错误", icon: 'none',duration: 2000
@@ -537,7 +558,7 @@ Page({ @@ -537,7 +558,7 @@ Page({
537 var wl_txt = "formData.shipping_price"; 558 var wl_txt = "formData.shipping_price";
538 th.setData({ [wl_txt]: shipping_price, }) 559 th.setData({ [wl_txt]: shipping_price, })
539 560
540 - } else { 561 + } else if(th.data.bn_exp_type == 1 ) {
541 var wl_txt = "formData.shipping_price"; 562 var wl_txt = "formData.shipping_price";
542 th.setData({ [wl_txt]: 0, }) 563 th.setData({ [wl_txt]: 0, })
543 } 564 }
@@ -552,6 +573,55 @@ Page({ @@ -552,6 +573,55 @@ Page({
552 order_m = 0; coupon_price = parseFloat(order_m).toFixed(2); 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 //--看一下有没有订单优惠--0 625 //--看一下有没有订单优惠--0
556 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price); 626 total_m = parseFloat(total_m) + parseFloat(th.data.formData.shipping_price);
557 order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price); 627 order_m = parseFloat(order_m) + parseFloat(th.data.formData.shipping_price);
pages/cart/cart2_inte/cart2_inte.wxml
@@ -12,6 +12,11 @@ @@ -12,6 +12,11 @@
12 12
13 <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" 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> 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 </view> 21 </view>
17 </view> 22 </view>
pages/cart/cart2_pt/cart2_pt.js
@@ -148,14 +148,16 @@ Page({ @@ -148,14 +148,16 @@ Page({
148 th.get_buy_goods(); 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 data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 }, 153 data: { user_id: to.globalData.user_id, store_id: oo.stoid, status: 0 },
153 success: function (su) { 154 success: function (su) {
154 if (su.data.code == 0) { 155 if (su.data.code == 0) {
155 var yuer = parseFloat(th.data.userinfo.user_money - 156 var yuer = parseFloat(th.data.userinfo.user_money -
156 (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2); 157 (th.data.userinfo.frozen_money > 0 ? th.data.userinfo.frozen_money : 0) - su.data.data.summoney).toFixed(2);
157 if (yuer < 0) yuer = 0; 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,6 +175,22 @@ Page({
173 var gd = t.data.data; 175 var gd = t.data.data;
174 if (!gd) return false; 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 t.data.data.original_img = oo.imghost + t.data.data.original_img; 194 t.data.data.original_img = oo.imghost + t.data.data.original_img;
177 t.data.data['buynum'] = gg.goods_num; 195 t.data.data['buynum'] = gg.goods_num;
178 console.log(t.data.data); 196 console.log(t.data.data);
@@ -315,8 +333,10 @@ Page({ @@ -315,8 +333,10 @@ Page({
315 th.data.json_d = json_d; 333 th.data.json_d = json_d;
316 th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 334 th.data.ispt_goods = json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
317 var is_default_logistics = json_d.is_default_logistics; 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 var rank_switch = json_d.rank_switch; 341 var rank_switch = json_d.rank_switch;
322 var max_price = -1; 342 var max_price = -1;
@@ -398,7 +418,6 @@ Page({ @@ -398,7 +418,6 @@ Page({
398 calculatePrice2:async function () { 418 calculatePrice2:async function () {
399 419
400 this.setData({submit:1}); 420 this.setData({submit:1});
401 -  
402 wx.showLoading({ 421 wx.showLoading({
403 title: "处理中.", 422 title: "处理中.",
404 mask:true 423 mask:true
@@ -441,7 +460,7 @@ Page({ @@ -441,7 +460,7 @@ Page({
441 460
442 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { 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 if (goods_weight < 0) goods_weight = 0; 464 if (goods_weight < 0) goods_weight = 0;
446 cut_good_weight += item['weight'] * item['buynum']; 465 cut_good_weight += item['weight'] * item['buynum'];
447 goods_weight += item['weight'] * item['buynum']; 466 goods_weight += item['weight'] * item['buynum'];
@@ -520,10 +539,54 @@ Page({ @@ -520,10 +539,54 @@ Page({
520 var wl_txt = "formData.shipping_price"; 539 var wl_txt = "formData.shipping_price";
521 th.setData({ [wl_txt]: shipping_price, }) 540 th.setData({ [wl_txt]: shipping_price, })
522 541
523 - } else { 542 + } else if(th.data.bn_exp_type == 1 ) {
524 var wl_txt = "formData.shipping_price"; 543 var wl_txt = "formData.shipping_price";
525 th.setData({ [wl_txt]: 0, }) 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 var total_m = parseFloat(allpice) + parseFloat(th.data.formData.shipping_price); 591 var total_m = parseFloat(allpice) + parseFloat(th.data.formData.shipping_price);
529 total_m = parseFloat(total_m).toFixed(2); 592 total_m = parseFloat(total_m).toFixed(2);
pages/cart/cart2_pt/cart2_pt.wxml
@@ -10,6 +10,11 @@ @@ -10,6 +10,11 @@
10 10
11 <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}" 11 <view hidden="{{bn_t_exp_t==1}}" bindtap='setexptype' data-t='0' class="tab {{bn_exp_type== 0 ? 'active':''}}"
12 data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> 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 </view> 19 </view>
15 </view> 20 </view>
pages/cart/cart_wk/cart_wk.js
@@ -41,6 +41,7 @@ Page({ @@ -41,6 +41,7 @@ Page({
41 41
42 teamgroup: null, 42 teamgroup: null,
43 submit:1, //默认按钮是灰色 43 submit:1, //默认按钮是灰色
  44 + show_submit:0, //不线上
44 }, 45 },
45 46
46 /** 47 /**
@@ -62,7 +63,8 @@ Page({ @@ -62,7 +63,8 @@ Page({
62 var json_d = JSON.parse(e.switch_list); 63 var json_d = JSON.parse(e.switch_list);
63 th.data.json_d = json_d; 64 th.data.json_d = json_d;
64 var is_default_logistics = json_d.is_default_logistics; 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 th.get_wuliu(th.get_info(th.show_page)); 69 th.get_wuliu(th.get_info(th.show_page));
68 }, 1) 70 }, 1)
@@ -91,6 +93,11 @@ Page({ @@ -91,6 +93,11 @@ Page({
91 if (th.data.exp_type == 0 && th.data.goods) { 93 if (th.data.exp_type == 0 && th.data.goods) {
92 th.calculate_wuliu(); 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,7 +272,23 @@ Page({
265 else 272 else
266 distr_type = pickup.distr_type; 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 case 0: 292 case 0:
270 exp_type = 1; 293 exp_type = 1;
271 //-- 系统后台有设置要默认的 -- 294 //-- 系统后台有设置要默认的 --
@@ -297,7 +320,7 @@ Page({ @@ -297,7 +320,7 @@ Page({
297 } else { 320 } else {
298 var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; 321 var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money;
299 allpice = allpice.toFixed(2); 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,22 +349,19 @@ Page({
326 this.setData({ 349 this.setData({
327 exp_type: type 350 exp_type: type
328 }); 351 });
329 -  
330 -  
331 -  
332 //--计算物流的值-- 352 //--计算物流的值--
333 if (type == 0) { 353 if (type == 0) {
334 -  
335 - th.setData({submit:0})  
336 th.calculate_wuliu(); 354 th.calculate_wuliu();
337 - } else { 355 + } else if(type==1){
338 var allpice = parseFloat(th.data.order.order_amount) 356 var allpice = parseFloat(th.data.order.order_amount)
339 + parseFloat(th.data.order.user_money) 357 + parseFloat(th.data.order.user_money)
340 + parseFloat(th.data.order.tail_money); 358 + parseFloat(th.data.order.tail_money);
341 allpice = allpice.toFixed(2); 359 allpice = allpice.toFixed(2);
342 this.setData({ 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,6 +420,12 @@ Page({
400 dd.shipping_price = parseFloat(th.data.exp_price); 420 dd.shipping_price = parseFloat(th.data.exp_price);
401 dd.addressid = th.data.user_addr.address_id; 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 if(getApp().globalData.scene){ 429 if(getApp().globalData.scene){
404 dd.scene=getApp().globalData.scene; 430 dd.scene=getApp().globalData.scene;
405 } 431 }
@@ -589,7 +615,7 @@ Page({ @@ -589,7 +615,7 @@ Page({
589 } 615 }
590 }) 616 })
591 if(!is_ok){ 617 if(!is_ok){
592 - th.setData({ submit:0 }); 618 + th.setData({ submit:0,show_submit:1 });
593 wx.hideLoading(); 619 wx.hideLoading();
594 return false; 620 return false;
595 } 621 }
@@ -599,16 +625,89 @@ Page({ @@ -599,16 +625,89 @@ Page({
599 allpice = allpice.toFixed(2); 625 allpice = allpice.toFixed(2);
600 626
601 exp_price = parseFloat(exp_price); 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 } else { 629 } else {
604 var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money; 630 var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money;
605 allpice = allpice.toFixed(2); 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 checkAddressList: function () { 713 checkAddressList: function () {
pages/cart/cart_wk/cart_wk.wxml
1 <wxs module="filters" src="../../../utils/filter.wxs"></wxs> 1 <wxs module="filters" src="../../../utils/filter.wxs"></wxs>
2 2
3 <!-- 先选择配送方式,2021.7修改 --> 3 <!-- 先选择配送方式,2021.7修改 -->
  4 + <block wx:if="{{show_submit}}">
4 <view class="tab-container" wx:if="{{kt_type!=3 || is_normal==1}}"> 5 <view class="tab-container" wx:if="{{kt_type!=3 || is_normal==1}}">
5 <view class="tab-wrapper"> 6 <view class="tab-wrapper">
6 <view hidden="{{distr_type==2}}" bindtap='set_wuliu' data-type='1' class="tab {{exp_type == 1? 'active':''}}" 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,15 @@
8 9
9 <view hidden="{{distr_type==1}}" bindtap='set_wuliu' data-type='0' class="tab {{exp_type== 0 ? 'active':''}}" 10 <view hidden="{{distr_type==1}}" bindtap='set_wuliu' data-type='0' class="tab {{exp_type== 0 ? 'active':''}}"
10 data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >快递邮寄</view> 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 </view> 18 </view>
13 </view> 19 </view>
  20 + </block>
14 21
15 22
16 <!----要进行判断地址是否显示----> 23 <!----要进行判断地址是否显示---->
@@ -171,3 +178,5 @@ @@ -171,3 +178,5 @@
171 178
172 </view > 179 </view >
173 </view> 180 </view>
  181 +<view style="height: 50rpx"></view>
  182 +
pages/giftpack/buygiftpack/giftpackbuy.js
@@ -335,21 +335,20 @@ Page({ @@ -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,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 GetFree: function (e) { 564 GetFree: function (e) {
pages/giftpack/mygiftpack/mygiftpack.js
@@ -177,20 +177,14 @@ Page({ @@ -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 \ No newline at end of file 191 \ No newline at end of file
pages/goods/categoryList/categoryList.js
@@ -1092,15 +1092,20 @@ Page({ @@ -1092,15 +1092,20 @@ Page({
1092 if(url[0]!='/') url='/'+url; 1092 if(url[0]!='/') url='/'+url;
1093 getApp().goto(url); 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 \ No newline at end of file 1112 \ No newline at end of file
pages/goods/goodsInfo/goodsInfo.js
@@ -548,8 +548,9 @@ Page({ @@ -548,8 +548,9 @@ Page({
548 }); 548 });
549 549
550 //更新点击量 550 //更新点击量
  551 + //noinspection JSUnresolvedFunction
551 getApp().request.put("/api/weshop/goods/updateClick", { 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,16 +6674,33 @@ Page({
6673 6674
6674 onShareTimeline() { 6675 onShareTimeline() {
6675 getApp().globalData.no_clear=1; 6676 getApp().globalData.no_clear=1;
  6677 + var th=this;
6676 var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; 6678 var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
6677 if (!store_name) 6679 if (!store_name)
6678 store_name = getApp().globalData.setting.appName; 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 return { 6695 return {
6680 title: this.data.data.goods_name + '-' + store_name, 6696 title: this.data.data.goods_name + '-' + store_name,
6681 imageUrl: this.data.gallery[0].image_url, 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 clickCollapse() { 6704 clickCollapse() {
6687 this.setData({ 6705 this.setData({
6688 flag: !this.data.flag, 6706 flag: !this.data.flag,
pages/user/assistance/assistance.js
@@ -240,14 +240,19 @@ Page({ @@ -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 })