Commit edba7a72e88f62e704f4971a910fbf7c90fb18d7
Merge branch 'qa' of http://git.vipzhuang.cn/wxd/MShopWeApp
Showing
26 changed files
with
930 additions
and
298 deletions
app.js
... | ... | @@ -1453,10 +1453,94 @@ App({ |
1453 | 1453 | }) |
1454 | 1454 | } |
1455 | 1455 | return cx_arr; |
1456 | - }, | |
1456 | + }, | |
1457 | + | |
1458 | + //-- 获取判断注册成功后,是跳转等级卡,还是新人有礼 -- | |
1459 | + async go_to_page(is_reg,func){ | |
1460 | + if(!is_reg) { | |
1461 | + func(); | |
1462 | + return false; | |
1463 | + } | |
1464 | + //如果是从企业专属导购跳过来的话,就要返回专属导购处理页面 | |
1465 | + let qyzsdg = wx.getStorageSync('qyzsdg') //如果是专属导购 | |
1466 | + if (qyzsdg) { | |
1467 | + wx.reLaunch({ | |
1468 | + url: `/packageE/pages/qy/contactMe/contactMe?scene=${qyzsdg}`, | |
1469 | + }) | |
1470 | + return | |
1471 | + } | |
1457 | 1472 | |
1473 | + //新判断新人有礼 | |
1474 | + var res= await getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", { | |
1475 | + data: { | |
1476 | + storeId: os.stoid, | |
1477 | + userId: this.globalData.user_id | |
1478 | + } | |
1479 | + }); | |
1480 | + | |
1481 | + if (res.data.code == 0) { | |
1482 | + var actid = res.data.data.id; //活动id | |
1483 | + var giftBagId = res.data.data.giftBagId; //礼包id | |
1484 | + var new_nav = "/pages/giftpack/newvipgift/newvipgift?actId=" + actid + '&' + 'actType=' + 1 + '&' + 'giftBagId=' + giftBagId; | |
1485 | + wx.redirectTo({ | |
1486 | + url:new_nav | |
1487 | + }) | |
1488 | + return false; | |
1489 | + } | |
1458 | 1490 | |
1491 | + //如果已经是等级卡了就跳过 | |
1492 | + if(this.globalData.userInfo.card_field){ | |
1493 | + //没有等级卡和新人有礼的时候 | |
1494 | + if(func) func(); | |
1495 | + return false; | |
1496 | + } | |
1497 | + | |
1498 | + var dj_buy=await getApp().promiseGet("/store/storemoduleendtime/page?store_id=" + this.globalData.setting.stoid+ "&type=3", {}); | |
1499 | + var ob = { isout: 0, isbuy: 0 }; | |
1500 | + if (dj_buy.data.code == 0) { | |
1501 | + var arr = dj_buy.data.data.pageData; | |
1502 | + //----如果数组不为空---- | |
1503 | + if (arr.length > 0) { | |
1504 | + arr.forEach(function (val, ind) { | |
1505 | + if (val.is_sy == 0 || val.is_sy == 1) { | |
1506 | + ob.isbuy = 1; | |
1507 | + var now = ut.gettimestamp(); | |
1508 | + if (now > val.end_time) ob.isout = 1; | |
1509 | + return false; | |
1510 | + } | |
1511 | + }) | |
1512 | + } | |
1513 | + } | |
1514 | + | |
1515 | + //-- 获取等级卡,直接去买等级卡 -- | |
1516 | + if(ob.isbuy && !ob.isout){ | |
1517 | + //-- 获取等级卡购买的数量 -- | |
1518 | + var conf=await getApp().promiseGet("/api/weshop/storeconfig/get/" + this.globalData.setting.stoid, {}); | |
1519 | + //-- 获取等级卡的会员已经购买的数量 --- | |
1520 | + var dj=await getApp().promiseGet("/api/weshop/users/getUserCard/" + this.globalData.setting.stoid, {}); | |
1521 | + var dj_num=0; | |
1522 | + if(dj.data.code==0){ | |
1523 | + dj_num=dj.data.data?dj.data.data:0; | |
1524 | + } | |
1525 | + | |
1526 | + var sw_list= conf.data.data.switch_list; | |
1527 | + if(sw_list){ | |
1528 | + sw_list=JSON.parse(sw_list); | |
1529 | + } | |
1530 | + | |
1531 | + | |
1532 | + if (sw_list && sw_list.rank_switch==2 && conf.data.code == 0 && conf.data.data.dj_num>0 && conf.data.data.dj_num>dj_num) { | |
1533 | + var nav = "/pages/user/plus/plus"; | |
1534 | + wx.redirectTo({ | |
1535 | + url:nav | |
1536 | + }) | |
1537 | + return false; | |
1538 | + } | |
1539 | + } | |
1540 | + //没有等级卡和新人有礼的时候 | |
1541 | + if(func) func(); | |
1542 | + } | |
1459 | 1543 | |
1460 | - }); | |
1544 | +}); | |
1461 | 1545 | |
1462 | 1546 | ... | ... |
packageA/pages/details_serviceCard/details_serviceCard.js
... | ... | @@ -605,7 +605,7 @@ Page({ |
605 | 605 | let order_sn = this.data.details.order_sn; |
606 | 606 | let order_id = this.data.details.order_id; |
607 | 607 | let store_id = app.globalData.setting.stoid; |
608 | - let user_id = os.user_id; | |
608 | + let user_id = getApp().globalData.user_id; | |
609 | 609 | |
610 | 610 | let flag = true; |
611 | 611 | // 如果是普通购买或单独购买,不用判断 |
... | ... | @@ -648,7 +648,7 @@ Page({ |
648 | 648 | |
649 | 649 | |
650 | 650 | var t_now = ut.gettimestamp(); |
651 | - if (act_details.is_end == 0 && act_details.start_time < t_now && act_details.end_time > t_now) { | |
651 | + if (act_details.is_end == 1 || act_details.start_time > t_now || act_details.end_time < t_now) { | |
652 | 652 | wx.showModal({ |
653 | 653 | title: '提示', |
654 | 654 | content: '活动发生了变化,无法支付,请取消订单,重新购买!', |
... | ... | @@ -658,10 +658,23 @@ Page({ |
658 | 658 | return false; |
659 | 659 | } |
660 | 660 | |
661 | + //指定门店的控制 | |
662 | + if (act_details.pick_up_lists) { | |
663 | + var idx0=act_details.pick_up_lists.findIndex(function (e){ | |
664 | + return e.pickup_id==it.pickup_id; | |
665 | + }) | |
666 | + if(idx0<0){ | |
667 | + getApp().confirmBox(it.service_name + "秒杀活动的门店不可售"); | |
668 | + th.setData({ paying: 0 }); | |
669 | + flag = false; | |
670 | + return false; | |
671 | + } | |
672 | + } | |
673 | + | |
661 | 674 | }; |
662 | 675 | }); |
663 | 676 | |
664 | - if(act_details.buy_limit>0 && flag){ | |
677 | + if(act_details && act_details.buy_limit>0 && flag){ | |
665 | 678 | await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { |
666 | 679 | data: { |
667 | 680 | store_id: store_id, | ... | ... |
packageA/pages/goodsInfo/buy_flash_normal.wxml
... | ... | @@ -30,7 +30,7 @@ |
30 | 30 | <!-- 选择门店模块 --> |
31 | 31 | <view class="flex-space-between address ai_end xc-width "> |
32 | 32 | |
33 | - <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | |
33 | + <view class="flex" wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | |
34 | 34 | <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text> |
35 | 35 | <view class="distance fs24 xc-ash"wx:if="{{def_pick_store.distance!=null}}"> |
36 | 36 | 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} |
... | ... | @@ -50,7 +50,7 @@ |
50 | 50 | <block wx:else> |
51 | 51 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> |
52 | 52 | <block wx:else> |
53 | - <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | |
53 | + <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(该店不可售)</view> | |
54 | 54 | <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules==2 && prom_type==0}}">(库存不足)</view> |
55 | 55 | </block> |
56 | 56 | </block> |
... | ... | @@ -97,7 +97,7 @@ |
97 | 97 | |
98 | 98 | <!-- 根本就找不到门店 --> |
99 | 99 | <block wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> |
100 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">配送不匹配</view> | |
100 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">该店不可售</view> | |
101 | 101 | </block> |
102 | 102 | <block wx:else> |
103 | 103 | <!-- 根本就找不到门店 --> | ... | ... |
packageA/pages/goodsInfo/goodsInfo.js
... | ... | @@ -431,53 +431,7 @@ Page({ |
431 | 431 | // gallery = g; |
432 | 432 | // }) |
433 | 433 | |
434 | - | |
435 | - // ----> 秒杀 | |
436 | - let prom_type = this.data.options.prom_type; | |
437 | - | |
438 | - let goods_id = this.data.options.goods_id; | |
439 | - if(!goods_id) goods_id = this.data.data.goods_id; | |
440 | - | |
441 | - if(prom_type) { // 进入商品详情页地址传参有带goods_id、prom_type、prom_id参数, 即从秒杀入口进入 | |
442 | - let prom_id = this.data.options.prom_id; | |
443 | - // 检查活动是否开始 | |
444 | - this.check_prom(goods_id, prom_type, prom_id); | |
445 | - | |
446 | - } else { // 从非秒杀入口进入,地址不带prom_type、prom_id参数 | |
447 | - getApp().request.promiseGet('/api/weshop/activitylist/listGoodActInfo2', { | |
448 | - data: { | |
449 | - store_id: os.stoid, | |
450 | - goods_id: goods_id, | |
451 | - goods_type: 1, | |
452 | - user_id: oo.user_id, | |
453 | - } | |
454 | - }).then(res => { | |
455 | - if (res.data.code == 0) { | |
456 | - let result = res.data.data; | |
457 | - let resLength = result.length; | |
458 | - if(resLength == 1) { // 如果数组长度为1,则直接显示当前活动 | |
459 | - let goods_id = this.data.options.goods_id; | |
460 | - let prom_type = result[0].prom_type; | |
461 | - let prom_id = result[0].act_id; | |
462 | - this.setData({ | |
463 | - 'options.prom_type': prom_type, | |
464 | - 'options.prom_id': prom_id, | |
465 | - }); | |
466 | - // 检查活动是否开始 | |
467 | - this.check_prom(goods_id, prom_type, prom_id); | |
468 | - } else if(resLength > 1) { //如果数组长度大于1,表示当前商品参加多个活动,以列表形式显示多活动 | |
469 | - this.setData({ | |
470 | - actList: res.data.data, | |
471 | - }); | |
472 | - }; | |
473 | - | |
474 | - }else{ | |
475 | - this.setData({ | |
476 | - actList: res.data.data, | |
477 | - }); | |
478 | - } | |
479 | - }); | |
480 | - }; | |
434 | + | |
481 | 435 | // <---- 秒杀 |
482 | 436 | |
483 | 437 | //------是否收藏---------- |
... | ... | @@ -625,26 +579,20 @@ Page({ |
625 | 579 | //获取用户的默认门店 |
626 | 580 | th.check_guide(()=>{ |
627 | 581 | getApp().get_user_store(function(e) { |
628 | - console.log('get_user_store'); | |
629 | - console.log("999999999"); | |
630 | - | |
631 | - | |
632 | 582 | if(!e) { |
633 | 583 | th.data.fir_def_store={}; //赋值空对象 |
634 | 584 | return false; |
635 | 585 | } |
636 | 586 | |
637 | - console.log("000000"); | |
638 | - | |
639 | 587 | if(getApp().globalData.is_dj_pk) th.setData({has_def:1}) |
640 | 588 | |
641 | 589 | var ee=JSON.parse(JSON.stringify(e)); |
642 | - | |
643 | - | |
644 | 590 | console.log(e); |
645 | 591 | |
646 | 592 | //--定时器推迟一下-- |
647 | - setTimeout(function () { | |
593 | + var appd=getApp().globalData; | |
594 | + var w_time = setInterval(function() { | |
595 | + if (that.data.is_get_local_ok == 0) return false; | |
648 | 596 | if(!th.data.data){ |
649 | 597 | return false; |
650 | 598 | } |
... | ... | @@ -654,77 +602,74 @@ Page({ |
654 | 602 | ee.is_no_dis=1; |
655 | 603 | } |
656 | 604 | |
657 | - var appd=getApp().globalData; | |
658 | - var w_time = setInterval(function() { | |
659 | - if (that.data.is_get_local_ok == 0) return false; | |
660 | - clearInterval(w_time); | |
661 | - var distance = null; | |
662 | - var e=JSON.parse(JSON.stringify(ee)); | |
663 | - | |
664 | - //如果有开启近距离的话,同时距离优不一样了 | |
665 | - if (that.data.lat != null) { | |
666 | - //如果经纬度有变化的话 | |
667 | - if(e && appd.lat==that.data.lat && appd.lon==that.data.lon && e.distance>0 ){ | |
668 | - that.data.fir_def_store=e; | |
669 | - that.setData({ | |
670 | - def_pick_store: e, | |
671 | - sto_sele_name: e.pickup_name, | |
672 | - sto_sele_id: e.pickup_id, | |
673 | - sto_sele_distr: e.distr_type, | |
674 | - sto_sele_keyid:e.keyid, | |
675 | - }) | |
676 | - }else{ | |
677 | - //要用接口是获取距离,js的计算不准 | |
678 | - getApp().request.promiseGet("/api/weshop/pickup/list",{ | |
679 | - data:{store_id:os.stoid,pickup_id:e.pickup_id,lat:th.data.lat,lon: th.data.lon, is_pos: 1}, | |
680 | - }).then(res=>{ | |
681 | - if(ut.ajax_ok(res)){ | |
682 | - e=res.data.data.pageData[0]; | |
683 | - if (e){ | |
684 | - e.is_no_dis=ee.is_no_dis; | |
685 | - appd.pk_store=e; | |
686 | - that.data.fir_def_store=e; | |
687 | - | |
688 | - console.log('get_user_store--2'); | |
689 | - console.log(e); | |
690 | - | |
691 | - that.setData({ | |
692 | - def_pick_store: e, | |
693 | - sto_sele_name: e.pickup_name, | |
694 | - sto_sele_id: e.pickup_id, | |
695 | - sto_sele_distr: e.distr_type, | |
696 | - sto_sele_keyid:e.keyid, | |
697 | - }) | |
698 | - } | |
699 | 605 | |
606 | + clearInterval(w_time); | |
607 | + var distance = null; | |
608 | + var e=JSON.parse(JSON.stringify(ee)); | |
609 | + | |
610 | + //如果有开启近距离的话,同时距离优不一样了 | |
611 | + if (that.data.lat != null) { | |
612 | + //如果经纬度有变化的话 | |
613 | + if(e && appd.lat==that.data.lat && appd.lon==that.data.lon && e.distance>0 ){ | |
614 | + that.data.fir_def_store=e; | |
615 | + that.setData({ | |
616 | + def_pick_store: e, | |
617 | + sto_sele_name: e.pickup_name, | |
618 | + sto_sele_id: e.pickup_id, | |
619 | + sto_sele_distr: e.distr_type, | |
620 | + sto_sele_keyid:e.keyid, | |
621 | + }) | |
622 | + }else{ | |
623 | + //要用接口是获取距离,js的计算不准 | |
624 | + getApp().request.promiseGet("/api/weshop/pickup/list",{ | |
625 | + data:{store_id:os.stoid,pickup_id:e.pickup_id,lat:th.data.lat,lon: th.data.lon, is_pos: 1}, | |
626 | + }).then(res=>{ | |
627 | + if(ut.ajax_ok(res)){ | |
628 | + e=res.data.data.pageData[0]; | |
629 | + if (e){ | |
630 | + e.is_no_dis=ee.is_no_dis; | |
631 | + appd.pk_store=e; | |
632 | + that.data.fir_def_store=e; | |
633 | + | |
634 | + console.log('get_user_store--2'); | |
635 | + console.log(e); | |
636 | + | |
637 | + that.setData({ | |
638 | + def_pick_store: e, | |
639 | + sto_sele_name: e.pickup_name, | |
640 | + sto_sele_id: e.pickup_id, | |
641 | + sto_sele_distr: e.distr_type, | |
642 | + sto_sele_keyid:e.keyid, | |
643 | + }) | |
700 | 644 | } |
701 | - }) | |
702 | - } | |
703 | - | |
704 | - //e.distance = distance; | |
705 | - appd.lat=that.data.lat; | |
706 | - appd.lon=that.data.lon; | |
707 | - | |
708 | - } else { | |
709 | - if (e) { | |
710 | - | |
711 | 645 | |
712 | - console.log('get_user_store3---'); | |
713 | - console.log(e); | |
646 | + } | |
647 | + }) | |
648 | + } | |
714 | 649 | |
715 | - e.distance = null; | |
716 | - that.data.fir_def_store=e; | |
717 | - that.setData({ | |
718 | - def_pick_store: e, | |
719 | - sto_sele_name: e.pickup_name, | |
720 | - sto_sele_id: e.pickup_id, | |
721 | - sto_sele_distr: e.distr_type, | |
722 | - sto_sele_keyid:e.keyid, | |
723 | - }) | |
724 | - } | |
650 | + //e.distance = distance; | |
651 | + appd.lat=that.data.lat; | |
652 | + appd.lon=that.data.lon; | |
653 | + | |
654 | + } else { | |
655 | + if (e) { | |
656 | + | |
657 | + console.log('get_user_store3---'); | |
658 | + console.log(e); | |
659 | + | |
660 | + e.distance = null; | |
661 | + that.data.fir_def_store=e; | |
662 | + that.setData({ | |
663 | + def_pick_store: e, | |
664 | + sto_sele_name: e.pickup_name, | |
665 | + sto_sele_id: e.pickup_id, | |
666 | + sto_sele_distr: e.distr_type, | |
667 | + sto_sele_keyid:e.keyid, | |
668 | + }) | |
725 | 669 | } |
726 | - }, 500) | |
727 | - },1500) | |
670 | + } | |
671 | + }, 200) | |
672 | + | |
728 | 673 | |
729 | 674 | }); |
730 | 675 | }) |
... | ... | @@ -773,11 +718,55 @@ Page({ |
773 | 718 | // mapurl: t.data.data.listServiceVideos[0].video_url, |
774 | 719 | // mapurl_f_img: t.data.data.listServiceVideos[0].video_img, |
775 | 720 | //listServiceItem: t.data.data.listServiceItem, |
776 | - 'isshow':1 | |
777 | - | |
778 | 721 | }); |
779 | 722 | |
780 | 723 | that.getTaohe(); |
724 | + // ----> 秒杀 | |
725 | + let prom_type = th.data.options.prom_type; | |
726 | + | |
727 | + let goods_id = th.data.options.goods_id; | |
728 | + if(!goods_id) goods_id = th.data.data.goods_id; | |
729 | + | |
730 | + if(prom_type) { // 进入商品详情页地址传参有带goods_id、prom_type、prom_id参数, 即从秒杀入口进入 | |
731 | + let prom_id = th.data.options.prom_id; | |
732 | + // 检查活动是否开始 | |
733 | + th.check_prom(goods_id, prom_type, prom_id); | |
734 | + | |
735 | + } else { // 从非秒杀入口进入,地址不带prom_type、prom_id参数 | |
736 | + getApp().request.promiseGet('/api/weshop/activitylist/listGoodActInfo2', { | |
737 | + data: { | |
738 | + store_id: os.stoid, | |
739 | + goods_id: goods_id, | |
740 | + goods_type: 1, | |
741 | + user_id: oo.user_id, | |
742 | + } | |
743 | + }).then(res => { | |
744 | + if (res.data.code == 0) { | |
745 | + let result = res.data.data; | |
746 | + let resLength = result.length; | |
747 | + if(resLength == 1) { // 如果数组长度为1,则直接显示当前活动 | |
748 | + let goods_id = th.data.options.goods_id; | |
749 | + let prom_type = result[0].prom_type; | |
750 | + let prom_id = result[0].act_id; | |
751 | + th.setData({ | |
752 | + 'options.prom_type': prom_type, | |
753 | + 'options.prom_id': prom_id, | |
754 | + }); | |
755 | + // 检查活动是否开始 | |
756 | + th.check_prom(goods_id, prom_type, prom_id); | |
757 | + } else if(resLength > 1) { //如果数组长度大于1,表示当前商品参加多个活动,以列表形式显示多活动 | |
758 | + th.setData({ | |
759 | + actList: res.data.data, | |
760 | + }); | |
761 | + }; | |
762 | + | |
763 | + }else{ | |
764 | + th.setData({ | |
765 | + actList: res.data.data, | |
766 | + }); | |
767 | + } | |
768 | + }); | |
769 | + }; | |
781 | 770 | |
782 | 771 | // console.log('0xxxxx999999', t.data.data); |
783 | 772 | //-----商品详情--- |
... | ... | @@ -808,7 +797,8 @@ Page({ |
808 | 797 | }); |
809 | 798 | |
810 | 799 | th.data.enterAddressPage && (this.data.enterAddressPage = !1); |
811 | - th.get_sto(); | |
800 | + //没有互动,就调用默认的门店 | |
801 | + if(!th.data.prom_type) th.get_sto(); | |
812 | 802 | }) |
813 | 803 | |
814 | 804 | |
... | ... | @@ -1612,9 +1602,9 @@ Page({ |
1612 | 1602 | if(th.data.sele_g && th.data.sele_g.share_imgurl) { |
1613 | 1603 | img = th.data.iurl + th.data.sele_g.share_imgurl; |
1614 | 1604 | ob.imageUrl = img; |
1615 | - }; | |
1616 | - }; | |
1617 | - | |
1605 | + } | |
1606 | + } | |
1607 | + | |
1618 | 1608 | return ob; |
1619 | 1609 | |
1620 | 1610 | }, |
... | ... | @@ -1639,9 +1629,22 @@ Page({ |
1639 | 1629 | |
1640 | 1630 | //---------拿出门店分类和门店------------ |
1641 | 1631 | get_sto(e) { |
1632 | + var is_normal=e; | |
1642 | 1633 | var th = this,that=this; |
1634 | + | |
1635 | + if (e == 1) { | |
1636 | + th.setData({ | |
1637 | + is_normal: 1 | |
1638 | + }) | |
1639 | + } else { | |
1640 | + th.setData({ | |
1641 | + is_normal: 0 | |
1642 | + }) | |
1643 | + } | |
1644 | + | |
1643 | 1645 | var timer_get = setInterval(function() { |
1644 | 1646 | if (th.data.is_get_local_ok == 0) return false; |
1647 | + if (!th.data.fir_def_store) return false; | |
1645 | 1648 | var i = getApp().request; |
1646 | 1649 | if (!th.data.data) return false; |
1647 | 1650 | var dd= { |
... | ... | @@ -1691,34 +1694,76 @@ Page({ |
1691 | 1694 | //删除 |
1692 | 1695 | e.data.data.pageData.splice(k--, 1); |
1693 | 1696 | } |
1694 | - } | |
1695 | - } | |
1697 | + } | |
1696 | 1698 | |
1697 | - //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店 | |
1698 | - if(dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store)=='{}') && th.data.bconfig && th.data.bconfig.is_sort_storage){ | |
1699 | - th.setData({ | |
1700 | - def_pick_store:e.data.data.pageData[0], | |
1701 | - sto_sele_name: e.data.data.pageData[0].pickup_name, | |
1702 | - sto_sele_id: e.data.data.pageData[0].pickup_id, | |
1703 | - sto_sele_distr: e.data.data.pageData[0].distr_type, | |
1704 | - sto_sele_keyid: e.data.data.pageData[0].keyid, | |
1705 | - }); | |
1706 | - th.data.fir_def_store=e.data.data.pageData[0]; | |
1707 | 1699 | } |
1708 | 1700 | |
1709 | - //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 -- | |
1710 | - if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store)!='{}'){ | |
1711 | - for (var k = 0; k < e.data.data.pageData.length; k++) { | |
1712 | - if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { | |
1713 | - e.data.data.pageData.splice(k, 1); //删除 | |
1714 | - break; | |
1715 | - } | |
1716 | - } | |
1717 | - e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 | |
1718 | - } | |
1719 | - | |
1720 | - th.setData({all_pick_list:e.data.data.pageData}); | |
1721 | - th.deal_pickup(e); | |
1701 | + //如果有秒杀的指定门店 | |
1702 | + if(th.data.prom_type==1 && th.data.prom_act && th.data.prom_act.pick_up_lists && e.data.data.pageData.length && !is_normal){ | |
1703 | + var pick_up_lists=th.data.prom_act.pick_up_lists; | |
1704 | + for (var kq = 0; kq < e.data.data.pageData.length; kq++) { | |
1705 | + var it0=e.data.data.pageData[kq]; | |
1706 | + var idx0=pick_up_lists.findIndex(function (e){ | |
1707 | + return e.pickup_id==it0.pickup_id; | |
1708 | + }) | |
1709 | + if (idx0<0) { | |
1710 | + //删除 | |
1711 | + e.data.data.pageData.splice(kq--, 1); | |
1712 | + } | |
1713 | + } | |
1714 | + | |
1715 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store)!='{}'){ | |
1716 | + //-- 查找一下门店有没有在 -- | |
1717 | + var idx1=pick_up_lists.findIndex(function (e){ | |
1718 | + return e.pickup_id==th.data.def_pick_store.pickup_id; | |
1719 | + }) | |
1720 | + if(idx1<0){ | |
1721 | + //如果是秒杀的指定门店,就要设置秒杀的 | |
1722 | + th.data.def_pick_store.is_no_dis_act=1; | |
1723 | + that.setData({ | |
1724 | + def_pick_store: th.data.def_pick_store | |
1725 | + }) | |
1726 | + } | |
1727 | + } | |
1728 | + | |
1729 | + } | |
1730 | + | |
1731 | + //-- 如果门店过滤后,还会是数量 -- | |
1732 | + if(e.data.data.pageData.length){ | |
1733 | + //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店 | |
1734 | + if(dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store)=='{}') && th.data.bconfig && th.data.bconfig.is_sort_storage){ | |
1735 | + th.setData({ | |
1736 | + def_pick_store:e.data.data.pageData[0], | |
1737 | + sto_sele_name: e.data.data.pageData[0].pickup_name, | |
1738 | + sto_sele_id: e.data.data.pageData[0].pickup_id, | |
1739 | + sto_sele_distr: e.data.data.pageData[0].distr_type, | |
1740 | + sto_sele_keyid: e.data.data.pageData[0].keyid, | |
1741 | + }); | |
1742 | + th.data.fir_def_store=e.data.data.pageData[0]; | |
1743 | + } | |
1744 | + | |
1745 | + //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 -- | |
1746 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store)!='{}'){ | |
1747 | + for (var k = 0; k < e.data.data.pageData.length; k++) { | |
1748 | + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { | |
1749 | + e.data.data.pageData.splice(k, 1); //删除 | |
1750 | + break; | |
1751 | + } | |
1752 | + } | |
1753 | + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 | |
1754 | + } | |
1755 | + | |
1756 | + th.setData({all_pick_list:e.data.data.pageData,isshow:1}); | |
1757 | + th.deal_pickup(e); | |
1758 | + } | |
1759 | + else{ | |
1760 | + th.setData({ | |
1761 | + isshow:1 | |
1762 | + }) | |
1763 | + wx.hideLoading(); | |
1764 | + } | |
1765 | + | |
1766 | + | |
1722 | 1767 | },800) |
1723 | 1768 | |
1724 | 1769 | } |
... | ... | @@ -2666,16 +2711,16 @@ Page({ |
2666 | 2711 | return false; |
2667 | 2712 | } |
2668 | 2713 | if(!th.data.only_pk && !th.data.def_pickpu_list){ |
2669 | - getApp().confirmBox("门店库存不足", null, 25000, !1); | |
2714 | + getApp().confirmBox("暂无可售门店", null, 25000, !1); | |
2670 | 2715 | return false; |
2671 | 2716 | } |
2672 | 2717 | |
2673 | 2718 | if(th.data.only_pk && !th.data.only_pk.length){ |
2674 | - getApp().confirmBox("门店库存不足", null, 25000, !1); | |
2719 | + getApp().confirmBox("暂无可售门店", null, 25000, !1); | |
2675 | 2720 | return false; |
2676 | 2721 | } |
2677 | 2722 | if(th.data.def_pickpu_list && !th.data.def_pickpu_list.length){ |
2678 | - getApp().confirmBox("门店库存不足", null, 25000, !1); | |
2723 | + getApp().confirmBox("暂无可售门店", null, 25000, !1); | |
2679 | 2724 | return false; |
2680 | 2725 | } |
2681 | 2726 | |
... | ... | @@ -3158,7 +3203,8 @@ Page({ |
3158 | 3203 | |
3159 | 3204 | } |
3160 | 3205 | var title= th.data.data.goods_name; |
3161 | - var img=th.data.data.original_img; | |
3206 | + // var img=th.data.data.original_img; | |
3207 | + var img=th.data.iurl+th.data.data.image_url; | |
3162 | 3208 | if(th.data.prom_type==6){ |
3163 | 3209 | title=th.data.prom_act.share_title; |
3164 | 3210 | img=th.data.iurl+th.data.prom_act.share_imgurl; |
... | ... | @@ -3177,6 +3223,13 @@ Page({ |
3177 | 3223 | url+="&room_id="+getApp().globalData.room_id+"&room_user_share=1"; |
3178 | 3224 | } |
3179 | 3225 | |
3226 | + // 如果服务卡参加秒杀活动,且后台设置了分享标题和分享图片 | |
3227 | + if(th.data.prom_type == 1) { | |
3228 | + if(th.data.sele_g && th.data.sele_g.share_imgurl) { | |
3229 | + img = th.data.iurl + th.data.sele_g.share_imgurl; | |
3230 | + }; | |
3231 | + }; | |
3232 | + | |
3180 | 3233 | return { |
3181 | 3234 | title:price + "元 " +title, |
3182 | 3235 | imageUrl:img, |
... | ... | @@ -3515,7 +3568,6 @@ Page({ |
3515 | 3568 | get_normal(gid) { |
3516 | 3569 | this.setData({ |
3517 | 3570 | prom_type: 0, |
3518 | - isshow: 1, | |
3519 | 3571 | }); |
3520 | 3572 | // this.get_sku(os.stoid, this.data.data, gid); |
3521 | 3573 | this.get_sto(); |
... | ... | @@ -3550,7 +3602,7 @@ Page({ |
3550 | 3602 | |
3551 | 3603 | if (prom_type == 1 && prom_id == 0) { |
3552 | 3604 | this.setData({ |
3553 | - prom_type: 0, isshow: 1, | |
3605 | + prom_type: 0 | |
3554 | 3606 | }); |
3555 | 3607 | |
3556 | 3608 | //获取门店 |
... | ... | @@ -3619,7 +3671,6 @@ Page({ |
3619 | 3671 | prom_act: t.data.data, |
3620 | 3672 | prom_end_time: prom_end_time, |
3621 | 3673 | prom_start_time: prom_start_time, |
3622 | - isshow: 1, | |
3623 | 3674 | }); |
3624 | 3675 | |
3625 | 3676 | ee.get_sto(); |
... | ... | @@ -3893,18 +3944,18 @@ Page({ |
3893 | 3944 | |
3894 | 3945 | // 是否授权登陆 |
3895 | 3946 | var user_info = getApp().globalData.userInfo; |
3896 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | |
3897 | - wx.navigateTo({ | |
3898 | - url: '/packageE/pages/togoin/togoin', | |
3899 | - }) | |
3900 | - return false; | |
3901 | - } | |
3902 | - | |
3947 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | |
3948 | + wx.navigateTo({ | |
3949 | + url: '/packageE/pages/togoin/togoin', | |
3950 | + }) | |
3951 | + return false; | |
3952 | + } | |
3903 | 3953 | this.data.g_buy_num = new Map(); |
3904 | 3954 | var th = this; |
3905 | 3955 | this.setData({open_ind_store: 5, goodsInputNum: 1});//拼团直接给4 |
3906 | 3956 | |
3907 | - this.setData({openSpecModal_flash_normal: 1}); | |
3957 | + this.setData({openSpecModal_flash_normal: 1}); | |
3958 | + this.get_sto(1) | |
3908 | 3959 | |
3909 | 3960 | |
3910 | 3961 | // if (th.data.sku_g_pt) { |
... | ... | @@ -3922,7 +3973,7 @@ Page({ |
3922 | 3973 | }, |
3923 | 3974 | |
3924 | 3975 | closeSpecModal_flash_normal: function () { |
3925 | - this.setData({openSpecModal_flash_normal: 0}); | |
3976 | + this.setData({openSpecModal_flash_normal: 0,is_normal:0}); | |
3926 | 3977 | }, |
3927 | 3978 | |
3928 | 3979 | ... | ... |
packageA/pages/goodsInfo/goodsInfo.wxml
... | ... | @@ -172,8 +172,9 @@ |
172 | 172 | <view class="no_store" wx:if="{{only_pk && !only_pk.length}}">(未找到门店)</view> |
173 | 173 | <block wx:else> |
174 | 174 | <view class="no_store" wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(未找到门店)</view> |
175 | + <text wx:elif="{{def_pick_store.is_no_dis_act && !is_normal}}" class="no_store">(该店不可售)</text> | |
175 | 176 | <block wx:else> |
176 | - <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">(配送不匹配)</view> | |
177 | + <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">(该店不可售)</view> | |
177 | 178 | </block> |
178 | 179 | </block> |
179 | 180 | |
... | ... | @@ -665,8 +666,8 @@ |
665 | 666 | |
666 | 667 | <!-- 选择门店模块 --> |
667 | 668 | <view class="flex-space-between address ai_end xc-width" style="padding-top: 30rpx;"> |
668 | - <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | |
669 | - <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text> | |
669 | + <view class="flex" wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | |
670 | + <text class="fs30 xc-black3 shop_name" style="width:360rpx">{{def_pick_store.pickup_name}}</text> | |
670 | 671 | <view class="distance fs24 xc-ash" wx:if="{{def_pick_store.distance!=null}}"> |
671 | 672 | 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}</view> |
672 | 673 | </view> |
... | ... | @@ -685,7 +686,8 @@ |
685 | 686 | <block wx:else> |
686 | 687 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> |
687 | 688 | <block wx:else> |
688 | - <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | |
689 | + <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(该店不可售)</view> | |
690 | + <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_act}}">(该店不可售)</view> | |
689 | 691 | <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules==2 && prom_type==0}}">(库存不足)</view> |
690 | 692 | </block> |
691 | 693 | </block> |
... | ... | @@ -708,7 +710,8 @@ |
708 | 710 | |
709 | 711 | |
710 | 712 | <view class="spec-cart-btns"> |
711 | - <view wx:if="{{def_pick_store && def_pick_store.is_no_dis}}" class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">配送不匹配</view> | |
713 | + <view wx:if="{{def_pick_store && def_pick_store.is_no_dis}}" class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">该店不可售</view> | |
714 | + <view wx:elif="{{def_pick_store && def_pick_store.is_no_dis_act}}" class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">该店不可售</view> | |
712 | 715 | <block wx:else> |
713 | 716 | |
714 | 717 | <!-- 根本就找不到门店 --> |
... | ... | @@ -831,9 +834,10 @@ |
831 | 834 | <view class="flex-vertical-between butttem5"> |
832 | 835 | <view class="flex xc-ash"> |
833 | 836 | <view class="fs30 xc-black3 address_name">{{item.pickup_name}} |
834 | - <block wx:if="{{tool.is_no_dis(sele_g.storageId,item.keyid)}}"> | |
835 | - <text class="no_store">(配送不匹配)</text> | |
837 | + <block wx:if="{{tool.is_no_dis(data.storageId,item.keyid)}}"> | |
838 | + <text class="no_store">(该店不可售)</text> | |
836 | 839 | </block> |
840 | + <text wx:elif="{{item.is_no_dis_act && !is_normal}}" class="no_store">(该店不可售1)</text> | |
837 | 841 | |
838 | 842 | </view> |
839 | 843 | </view> |
... | ... | @@ -862,9 +866,10 @@ |
862 | 866 | <view class="flex-vertical-between "> |
863 | 867 | <view class="flex xc-ash"> |
864 | 868 | <view class="fs30 xc-black3 address_name">{{item.pickup_name}} |
865 | - <block wx:if="{{tool.is_no_dis(sele_g.storageId,item.keyid)}}"> | |
866 | - <text class="no_store">(配送不匹配)</text> | |
869 | + <block wx:if="{{tool.is_no_dis(data.storageId,item.keyid)}}"> | |
870 | + <text class="no_store">(该店不可售)</text> | |
867 | 871 | </block> |
872 | + <text wx:elif="{{item.is_no_dis_act && !is_normal}}" class="no_store">(该店不可售)</text> | |
868 | 873 | </view> |
869 | 874 | </view> |
870 | 875 | <view> |
... | ... | @@ -894,9 +899,10 @@ |
894 | 899 | <view class="flex-vertical-between "> |
895 | 900 | <view class="flex xc-ash"> |
896 | 901 | <view class="fs28 xc-black3 address_name">{{item.pickup_name}} |
897 | - <block wx:if="{{tool.is_no_dis(sele_g.storageId,item.keyid)}}"> | |
898 | - <text class="no_store">(配送不匹配)</text> | |
902 | + <block wx:if="{{tool.is_no_dis(data.storageId,item.keyid)}}"> | |
903 | + <text class="no_store">(该店不可售)</text> | |
899 | 904 | </block> |
905 | + <text wx:elif="{{item.is_no_dis_act && !is_normal}}" class="no_store">(该店不可售)</text> | |
900 | 906 | </view> |
901 | 907 | </view> |
902 | 908 | <view> | ... | ... |
packageA/pages/goodsInfo/goodsInfo.wxss
... | ... | @@ -2417,9 +2417,7 @@ height: 90rpx; |
2417 | 2417 | margin: auto; */ |
2418 | 2418 | |
2419 | 2419 | } |
2420 | -.shop_name{ | |
2421 | 2420 | |
2422 | -} | |
2423 | 2421 | .stores-img{ |
2424 | 2422 | width: 28rpx; |
2425 | 2423 | height: 28rpx; |
... | ... | @@ -2427,6 +2425,7 @@ margin: auto; */ |
2427 | 2425 | } |
2428 | 2426 | .shop_name{ |
2429 | 2427 | margin-right: 10rpx; |
2428 | + max-width: 375rpx; | |
2430 | 2429 | } |
2431 | 2430 | .address{ |
2432 | 2431 | /* width: 100%; |
... | ... | @@ -2543,6 +2542,7 @@ margin-left: 17rpx; |
2543 | 2542 | } |
2544 | 2543 | .address_name{ |
2545 | 2544 | margin-right: 10rpx; |
2545 | + max-width: 390rpx; | |
2546 | 2546 | |
2547 | 2547 | } |
2548 | 2548 | .address-val{ | ... | ... |
packageA/pages/profile/profile.js
... | ... | @@ -600,6 +600,10 @@ Page({ |
600 | 600 | let url3 = '/api/weshop/users/getErpvipidPickup'; |
601 | 601 | url1 += r.stoid; |
602 | 602 | |
603 | + if(t.is_reg){ | |
604 | + this.data.is_reg=1; | |
605 | + } | |
606 | + | |
603 | 607 | var uu = getApp().globalData.zc_dd; |
604 | 608 | if (uu) { |
605 | 609 | this.setData({head_pic: uu.head_pic, nickname: uu.nickname}) |
... | ... | @@ -1006,15 +1010,17 @@ Page({ |
1006 | 1010 | |
1007 | 1011 | if (this.data.is_lable_set) { |
1008 | 1012 | getApp().globalData.zc_dd = post_data; |
1013 | + var g_url="/packageE/pages/user/labels/labels?pageType=1"; | |
1014 | + if(th.data.is_reg){ | |
1015 | + g_url+="&is_reg=1"; | |
1016 | + } | |
1009 | 1017 | wx.redirectTo({ |
1010 | - url: "/packageE/pages/user/labels/labels?pageType=1" | |
1018 | + url:g_url | |
1011 | 1019 | }) |
1012 | 1020 | }else{ |
1013 | 1021 | this.zu_ce(post_data); |
1014 | 1022 | } |
1015 | 1023 | |
1016 | - | |
1017 | - | |
1018 | 1024 | }, |
1019 | 1025 | |
1020 | 1026 | |
... | ... | @@ -1040,7 +1046,11 @@ Page({ |
1040 | 1046 | getApp().globalData.login_back = 1; |
1041 | 1047 | wx.setStorageSync("userinfo", e.data.data); |
1042 | 1048 | wx.setStorageSync("isAuth", !0), app.globalData.userInfo = e.data.data, app.globalData.userInfo.head_pic = s.getFullUrl(a.globalData.userInfo.head_pic); |
1043 | - wx.navigateBack({delta: 1}) | |
1049 | + //wx.navigateBack({delta: 1}) | |
1050 | + //-- 看情况,是跳转等级卡,还是跳转到新人有礼 -- | |
1051 | + getApp().go_to_page(th.data.is_reg,function (){ | |
1052 | + wx.navigateBack({ delta: 1 }) | |
1053 | + }) | |
1044 | 1054 | |
1045 | 1055 | }, |
1046 | 1056 | failStatus: function (t) { |
... | ... | @@ -1404,9 +1414,15 @@ Page({ |
1404 | 1414 | |
1405 | 1415 | if (this.data.is_lable_set) { |
1406 | 1416 | getApp().globalData.zc_dd = post_data; |
1407 | - wx.redirectTo({ | |
1408 | - url: "/packageE/pages/user/labels/labels?pageType=1" | |
1409 | - }) | |
1417 | + | |
1418 | + var g_url="/packageE/pages/user/labels/labels?pageType=1"; | |
1419 | + if(th.data.is_reg){ | |
1420 | + g_url+="&is_reg=1"; | |
1421 | + } | |
1422 | + | |
1423 | + wx.redirectTo({ | |
1424 | + url: g_url | |
1425 | + }) | |
1410 | 1426 | }else{ |
1411 | 1427 | this.zu_ce(post_data); |
1412 | 1428 | } | ... | ... |
packageA/pages/quan_pro/quan_pro.js
... | ... | @@ -2,7 +2,7 @@ var t = require("../../../utils/util.js"), ut = t, |
2 | 2 | e = require("../../../utils/common.js"), |
3 | 3 | oo = getApp().globalData, |
4 | 4 | os = getApp().globalData.setting; |
5 | - var utils = require('../../../utils/util.js'),ut=utils; | |
5 | + | |
6 | 6 | |
7 | 7 | Page({ |
8 | 8 | data: { |
... | ... | @@ -44,23 +44,66 @@ Page({ |
44 | 44 | }, |
45 | 45 | |
46 | 46 | //---展示,显示券的信息--- |
47 | - onShow: function() { | |
47 | + onShow:async function() { | |
48 | 48 | |
49 | 49 | //检查能不能分享 |
50 | 50 | getApp().check_can_share(); |
51 | - | |
52 | 51 | var th=this; |
53 | - var user_id=getApp().globalData.user_id; | |
54 | - getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { | |
55 | - data:{store_id:os.stoid,type:1,id:th.data.id,user_id:user_id} | |
56 | - }).then(res => { | |
57 | - th.setData({is_get:1}); | |
58 | - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ | |
59 | - th.setData({q_data:res.data.data.pageData[0]}); | |
60 | - } | |
61 | - }); | |
62 | - | |
63 | 52 | th.setData({getcurday:ut.gettimestamp()}); |
53 | + | |
54 | + var rs=await getApp().request.promiseGet("/api/weshop/prom/coupon/get/"+th.data.id, {}) | |
55 | + if(!rs){ | |
56 | + th.setData({is_get:1}); | |
57 | + return false; | |
58 | + } | |
59 | + if(rs.data.code!=0){ | |
60 | + th.setData({is_get:1}); | |
61 | + return false; | |
62 | + } | |
63 | + var r_data=rs.data.data; | |
64 | + //如果只限定链接的时候,要取消分享按钮 | |
65 | + if(r_data.is_share){ | |
66 | + wx.hideShareMenu(); | |
67 | + } | |
68 | + | |
69 | + if(r_data.store_id!=os.stoid){ | |
70 | + th.setData({is_get:1}); | |
71 | + return false; | |
72 | + } | |
73 | + if(r_data.type!=1){ | |
74 | + th.setData({is_get:2}); | |
75 | + return false; | |
76 | + } | |
77 | + | |
78 | + var now=ut.gettimestamp(); | |
79 | + | |
80 | + if(r_data.send_start_time>now){ | |
81 | + th.setData({is_get:3}); | |
82 | + return false; | |
83 | + } | |
84 | + | |
85 | + if(r_data.send_end_time<now){ | |
86 | + th.setData({is_get:4}); | |
87 | + return false; | |
88 | + } | |
89 | + | |
90 | + th.setData({is_get:1}); | |
91 | + th.setData({ q_data:r_data }); | |
92 | + | |
93 | + | |
94 | + | |
95 | + | |
96 | + // var user_id=getApp().globalData.user_id; | |
97 | + // await getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { | |
98 | + // data:{store_id:os.stoid,type:1,id:th.data.id,user_id:user_id} | |
99 | + // }).then(res => { | |
100 | + // th.setData({is_get:1}); | |
101 | + // if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ | |
102 | + // th.setData({q_data:res.data.data.pageData[0]}); | |
103 | + // } | |
104 | + // }); | |
105 | + | |
106 | + | |
64 | 107 | }, |
65 | 108 | |
66 | 109 | onHide: function() { | ... | ... |
packageA/pages/quan_pro/quan_pro.wxml
... | ... | @@ -11,7 +11,10 @@ |
11 | 11 | <view> |
12 | 12 | <image style="width: 70rpx; height: 70rpx; vertical-align: middle; margin-right: 20rpx" src="{{iurl}}/miniapp/images/coupon_img/coupon_logo.png"></image> |
13 | 13 | <text wx:if="{{q_data}}">{{q_data.name}}</text> |
14 | - <text wx:elif="{{is_get}}" class="fs28">不存在此微券或数量已领取完</text> | |
14 | + <text wx:elif="{{is_get==1}}" class="fs28">不存在此微券或数量已领取完</text> | |
15 | + <text wx:elif="{{is_get==2}}" class="fs28">该优惠券不是免费发放类型</text> | |
16 | + <text wx:elif="{{is_get==3}}" class="fs28">活动未开始暂时无法领取优惠券</text> | |
17 | + <text wx:elif="{{is_get==4}}" class="fs28">优惠券已过期</text> | |
15 | 18 | </view> |
16 | 19 | <view class="fs30 flex" wx:if="{{q_data}}" style="height: 100rpx;justify-content: space-between;"> |
17 | 20 | <view class="flex ai-center"> |
... | ... | @@ -45,7 +48,10 @@ |
45 | 48 | </block> |
46 | 49 | |
47 | 50 | <view wx:elif="{{is_get}}" class="fs28" style="text-align: center;color: #999;position: absolute;bottom: 20rpx;"> |
48 | - 不存在此微券或数量已领取完 | |
51 | + <text wx:if="{{is_get==1}}">不存在此微券或数量已领取完</text> | |
52 | + <text wx:if="{{is_get==2}}">该优惠券不是免费发放类型</text> | |
53 | + <text wx:if="{{is_get==3}}">活动未开始暂时无法领取优惠券</text> | |
54 | + <text wx:if="{{is_get==4}}">优惠券已过期</text> | |
49 | 55 | </view> |
50 | 56 | |
51 | 57 | </view> | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... | ... | @@ -287,6 +287,8 @@ Page({ |
287 | 287 | is_get_guide:0, |
288 | 288 | keyword:'', //门店搜索 |
289 | 289 | sec_i:-1,//选中分类门店 下标 |
290 | + | |
291 | + adding:0 //避免重复点击 | |
290 | 292 | }, |
291 | 293 | |
292 | 294 | //------初始化加载---------- |
... | ... | @@ -896,6 +898,9 @@ Page({ |
896 | 898 | //---展示--- |
897 | 899 | onShow: async function () { |
898 | 900 | |
901 | + //添加购物车的控制要清理0 | |
902 | + this.data.adding=0; | |
903 | + | |
899 | 904 | getApp().check_can_share(this); |
900 | 905 | // console.log('onshow'); |
901 | 906 | var goods_list = null, th = this, that = this; |
... | ... | @@ -1435,7 +1440,6 @@ Page({ |
1435 | 1440 | open_ind_store: ind |
1436 | 1441 | }); |
1437 | 1442 | |
1438 | - | |
1439 | 1443 | th.add_cart_func(t); |
1440 | 1444 | }, |
1441 | 1445 | |
... | ... | @@ -4687,6 +4691,14 @@ Page({ |
4687 | 4691 | s.my_warnning("还未登录!", 0, this); |
4688 | 4692 | return; |
4689 | 4693 | } |
4694 | + | |
4695 | + if(this.data.adding) return false; | |
4696 | + this.data.adding=1; | |
4697 | + | |
4698 | + wx.showLoading({ | |
4699 | + mask:true | |
4700 | + }); | |
4701 | + | |
4690 | 4702 | var e = this, |
4691 | 4703 | th = e, |
4692 | 4704 | o = this.data.sele_g; |
... | ... | @@ -4698,6 +4710,8 @@ Page({ |
4698 | 4710 | //---判断商品是否超出限购--- |
4699 | 4711 | if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { |
4700 | 4712 | if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { |
4713 | + wx.hideLoading(); | |
4714 | + th.data.adding=0; | |
4701 | 4715 | wx.showModal({ |
4702 | 4716 | title: '提示', |
4703 | 4717 | content: '超出商品限购' |
... | ... | @@ -4718,7 +4732,11 @@ Page({ |
4718 | 4732 | sto_sele_name: "" |
4719 | 4733 | }); |
4720 | 4734 | |
4721 | - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | |
4735 | + if (th.data.sto_sele_name == ""){ | |
4736 | + wx.hideLoading(); | |
4737 | + th.data.adding=0; | |
4738 | + return s.my_warnning("请选择门店", 0, th); | |
4739 | + } | |
4722 | 4740 | |
4723 | 4741 | //--------------此时操作的数据------------ |
4724 | 4742 | var newd = { |
... | ... | @@ -4789,8 +4807,9 @@ Page({ |
4789 | 4807 | |
4790 | 4808 | th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { |
4791 | 4809 | if (CanOutQty) { |
4792 | - | |
4793 | 4810 | if (CanOutQty < e.data.goodsInputNum) { |
4811 | + wx.hideLoading(); | |
4812 | + th.data.adding=0; | |
4794 | 4813 | wx.showToast({ |
4795 | 4814 | title: '库存不足!', |
4796 | 4815 | icon: 'none', |
... | ... | @@ -4800,6 +4819,8 @@ Page({ |
4800 | 4819 | |
4801 | 4820 | th.by_next_func(newd); |
4802 | 4821 | } else { |
4822 | + wx.hideLoading(); | |
4823 | + th.data.adding=0; | |
4803 | 4824 | wx.showToast({ |
4804 | 4825 | title: '库存不足!', |
4805 | 4826 | icon: 'none', |
... | ... | @@ -4810,6 +4831,8 @@ Page({ |
4810 | 4831 | |
4811 | 4832 | } else { |
4812 | 4833 | if (o.store_count <= 0) { |
4834 | + wx.hideLoading(); | |
4835 | + th.data.adding=0; | |
4813 | 4836 | wx.showToast({ |
4814 | 4837 | title: '库存已为空!', |
4815 | 4838 | icon: 'none', |
... | ... | @@ -4819,6 +4842,8 @@ Page({ |
4819 | 4842 | } |
4820 | 4843 | |
4821 | 4844 | if (o.store_count < e.data.goodsInputNum) { |
4845 | + wx.hideLoading(); | |
4846 | + th.data.adding=0; | |
4822 | 4847 | wx.showToast({ |
4823 | 4848 | title: '库存不足!', |
4824 | 4849 | icon: 'none', |
... | ... | @@ -6870,10 +6895,11 @@ Page({ |
6870 | 6895 | if (getApp().globalData.groupchat_id) { |
6871 | 6896 | pagePath+="&groupchat_id="+getApp().globalData.groupchat_id |
6872 | 6897 | } |
6873 | - | |
6898 | + let imgPath = this.data.iurl + this.data.luckGoInfo.original_img; | |
6874 | 6899 | return { |
6875 | 6900 | title: this.data.data.goods_name + '-' + store_name, |
6876 | - imageUrl: this.data.gallery[0].image_url, | |
6901 | + // imageUrl: this.data.gallery[0].image_url, | |
6902 | + imageUrl: imgPath, | |
6877 | 6903 | query: pagePath |
6878 | 6904 | } |
6879 | 6905 | }, | ... | ... |
packageC/pages/presell/goodsInfo/goodsInfo.js
... | ... | @@ -4492,11 +4492,12 @@ Page({ |
4492 | 4492 | if (getApp().globalData.groupchat_id) { |
4493 | 4493 | url+="&groupchat_id="+getApp().globalData.groupchat_id |
4494 | 4494 | } |
4495 | - | |
4495 | + let img = this.data.data.original_img; | |
4496 | 4496 | return { |
4497 | 4497 | title: this.data.data.goods_name + '-' + store_name, |
4498 | 4498 | query: 'first_leader='+user_id+url, |
4499 | - imageUrl: this.data.gallery[0].image_url, | |
4499 | + // imageUrl: this.data.gallery[0].image_url, | |
4500 | + imageUrl: img | |
4500 | 4501 | } |
4501 | 4502 | }, |
4502 | 4503 | ... | ... |
packageE/pages/cart/cart2/cart2.js
... | ... | @@ -4876,6 +4876,9 @@ Page({ |
4876 | 4876 | var zh_map_count={}; |
4877 | 4877 | var check_map = {}; |
4878 | 4878 | let groupchat_ids=[] |
4879 | + | |
4880 | + | |
4881 | + | |
4879 | 4882 | //-------------让商品添加到商品列表-------------------- |
4880 | 4883 | for (var k = 0; k < t_item.goods.length; k++) { |
4881 | 4884 | |
... | ... | @@ -4893,7 +4896,12 @@ Page({ |
4893 | 4896 | 'store_id': oo.stoid, |
4894 | 4897 | }; |
4895 | 4898 | |
4896 | - | |
4899 | + if (g_item.is_pd_normal) { | |
4900 | + goods.is_pd_normal = 1; | |
4901 | + } | |
4902 | + if (g_item.is_integral_normal) { | |
4903 | + goods.is_integral_normal = 1; | |
4904 | + } | |
4897 | 4905 | |
4898 | 4906 | if (getApp().globalData.skinface_id) { |
4899 | 4907 | goods.skinface_id = getApp().globalData.skinface_id; |
... | ... | @@ -4942,11 +4950,15 @@ Page({ |
4942 | 4950 | } |
4943 | 4951 | break; |
4944 | 4952 | case 5: |
4945 | - goods.prom_type = 5; | |
4946 | - goods.prom_id = g_item.prom_id; | |
4947 | - if (g_item.is_collocation) { | |
4948 | - goods.is_collocation = g_item.is_collocation; | |
4953 | + //看一下有没有搭配商品 | |
4954 | + if(th.has_collocation(t_item.goods,g_item.prom_id)){ | |
4955 | + goods.prom_type = 5; | |
4956 | + goods.prom_id = g_item.prom_id; | |
4957 | + if (g_item.is_collocation) { | |
4958 | + goods.is_collocation = g_item.is_collocation; | |
4959 | + } | |
4949 | 4960 | } |
4961 | + | |
4950 | 4962 | break |
4951 | 4963 | case 7: |
4952 | 4964 | goods.prom_type = 7; |
... | ... | @@ -5367,6 +5379,14 @@ Page({ |
5367 | 5379 | }) |
5368 | 5380 | |
5369 | 5381 | }, |
5382 | + //看一下有没有选择搭配的商品 | |
5383 | + has_collocation(goods,prom_id){ | |
5384 | + var idx=goods.findIndex(function (e){ | |
5385 | + return e.prom_type==5 && e.prom_id==prom_id && e.is_collocation; | |
5386 | + }) | |
5387 | + return idx>0; | |
5388 | + }, | |
5389 | + | |
5370 | 5390 | //---确认线下门店的数量足不足--- |
5371 | 5391 | async check_store_num(goods_id, pick, goods_num, func) { |
5372 | 5392 | var lock = 0, pick_no, plist, erpwareid; | ... | ... |
packageE/pages/qy/contactMe/contactMe.js
... | ... | @@ -92,7 +92,29 @@ Page({ |
92 | 92 | this.setData({ |
93 | 93 | id: f_arr[2] |
94 | 94 | }) |
95 | - this.getopenuserid(f_arr[2]) | |
95 | + //判断是否有注册,如果没有注册必须先注册 | |
96 | + let userinfo = wx.getStorageSync('userinfo'); | |
97 | + if (!userinfo) { | |
98 | + wx.setStorageSync('qyzsdg', tt.scene) | |
99 | + wx.navigateTo({ | |
100 | + url: '/packageE/pages/togoin/togoin', | |
101 | + }) | |
102 | + }else{ | |
103 | + if (userinfo && userinfo.mobile) { | |
104 | + wx.removeStorageSync('qyzsdg') | |
105 | + this.setData({ | |
106 | + phone:userinfo.mobile | |
107 | + }) | |
108 | + this.getopenuserid(f_arr[2]) | |
109 | + }else{ | |
110 | + wx.removeStorageSync('userinfo') | |
111 | + wx.setStorageSync('qyzsdg', tt.scene) | |
112 | + wx.navigateTo({ | |
113 | + url: '/packageE/pages/togoin/togoin', | |
114 | + }) | |
115 | + } | |
116 | + } | |
117 | + | |
96 | 118 | // getApp().globalData.groupchat_id = f_arr[2]; |
97 | 119 | } |
98 | 120 | |
... | ... | @@ -145,7 +167,18 @@ Page({ |
145 | 167 | // } |
146 | 168 | // }) |
147 | 169 | }, |
148 | - | |
170 | + onShow:function(){ | |
171 | + let userinfo = wx.getStorageSync('userinfo'); | |
172 | + if (userinfo && userinfo.mobile) { | |
173 | + this.setData({ | |
174 | + phone:userinfo.mobile | |
175 | + }) | |
176 | + // wx.removeStorageSync('qyzsdg') | |
177 | + } | |
178 | + if (this.data.id) { | |
179 | + this.getopenuserid(this.data.id) | |
180 | + } | |
181 | + }, | |
149 | 182 | getopenuserid(id) { |
150 | 183 | let url = `/api/weshop/qyWeChat/qywxStaffcode/get/${id}` |
151 | 184 | getApp().request.promiseGet(url, { data: {} }).then(res => { |
... | ... | @@ -158,6 +191,10 @@ Page({ |
158 | 191 | openuserid, |
159 | 192 | skip_verify |
160 | 193 | }) |
194 | + if (this.data.phone) { | |
195 | + | |
196 | + this.befgetqy() | |
197 | + } | |
161 | 198 | // if (this.data.phone) { |
162 | 199 | // this.getqy() |
163 | 200 | // } | ... | ... |
packageE/pages/togoin/togoin.js
... | ... | @@ -20,6 +20,12 @@ Page({ |
20 | 20 | }) |
21 | 21 | } |
22 | 22 | getApp().globalData.isLoad_ad = 1; |
23 | + | |
24 | + | |
25 | + if(options.is_reg){ | |
26 | + this.data.is_reg=1; | |
27 | + } | |
28 | + | |
23 | 29 | //--判断是否有接受到邀请人的ID-- |
24 | 30 | if (options.first_leader) { |
25 | 31 | this.setData({ first_leader: options.first_leader }); |
... | ... | @@ -277,8 +283,13 @@ Page({ |
277 | 283 | if (res.data.code == 0) { |
278 | 284 | dd.mobile = res.data.data; |
279 | 285 | getApp().globalData.zc_dd = dd; |
286 | + | |
287 | + var g_url="/packageA/pages/profile/profile?is_back=1"; | |
288 | + if(th.data.is_reg){ | |
289 | + g_url+="&is_reg=1"; | |
290 | + } | |
280 | 291 | wx.redirectTo({ |
281 | - url: "/packageA/pages/profile/profile?is_back=1" | |
292 | + url:g_url | |
282 | 293 | }) |
283 | 294 | } |
284 | 295 | }) |
... | ... | @@ -306,9 +317,13 @@ Page({ |
306 | 317 | if (res.data.code == 0) { |
307 | 318 | dd.mobile = res.data.data; |
308 | 319 | getApp().globalData.zc_dd = dd; |
309 | - wx.redirectTo({ | |
310 | - url: "/packageE/pages/user/labels/labels?pageType=1" | |
311 | - }) | |
320 | + | |
321 | + var g_url="/packageE/pages/user/labels/labels?pageType=1"; | |
322 | + if(th.data.is_reg){ | |
323 | + g_url+="&is_reg=1"; | |
324 | + } | |
325 | + | |
326 | + wx.redirectTo({ url: g_url }) | |
312 | 327 | } |
313 | 328 | }) |
314 | 329 | } else { |
... | ... | @@ -357,7 +372,12 @@ Page({ |
357 | 372 | } |
358 | 373 | }) |
359 | 374 | |
360 | - wx.navigateBack({ delta: 1 }) | |
375 | + //-- 看情况,是跳转等级卡,还是跳转到新人有礼 -- | |
376 | + getApp().go_to_page(th.data.is_reg,function (){ | |
377 | + wx.navigateBack({ delta: 1 }) | |
378 | + }) | |
379 | + | |
380 | + | |
361 | 381 | |
362 | 382 | }, |
363 | 383 | failStatus: function (t) { | ... | ... |
packageE/pages/user/labels/labels.js
... | ... | @@ -111,9 +111,18 @@ Page({ |
111 | 111 | var pages = getCurrentPages(); |
112 | 112 | var prevPage = pages[pages.length - 2]; //上一个页面 |
113 | 113 | //直接调用上一个页面的setData()方法,把数据存到上一个页面中去 |
114 | - prevPage.setData({ | |
115 | - is_zy: 1 | |
116 | - }) | |
114 | + try { | |
115 | + prevPage.setData({ | |
116 | + is_zy: 1 | |
117 | + }) | |
118 | + } catch (error) { | |
119 | + | |
120 | + } | |
121 | + | |
122 | + if(options.is_reg){ | |
123 | + this.data.is_reg=1; | |
124 | + } | |
125 | + | |
117 | 126 | th.query_nolabels(); |
118 | 127 | th.get_config(); |
119 | 128 | }, |
... | ... | @@ -273,9 +282,14 @@ Page({ |
273 | 282 | // check_label: arr |
274 | 283 | // }) |
275 | 284 | // th.goto(); |
276 | - wx.reLaunch({ | |
277 | - url: '/pages/user/index/index', | |
285 | + // wx.reLaunch({ | |
286 | + // url: '/pages/user/index/index', | |
287 | + // }) | |
288 | + //-- 看情况,是跳转等级卡,还是跳转到新人有礼 -- | |
289 | + getApp().go_to_page(th.data.is_reg,function (){ | |
290 | + wx.navigateBack({ delta: 1 }) | |
278 | 291 | }) |
292 | + | |
279 | 293 | }, 2000); |
280 | 294 | } else { |
281 | 295 | getApp().my_warnning("系统繁忙,请稍后再试", 0, th); |
... | ... | @@ -286,9 +300,13 @@ Page({ |
286 | 300 | } |
287 | 301 | }) |
288 | 302 | }else{ |
289 | - wx.reLaunch({ | |
290 | - url: '/pages/user/index/index', | |
303 | + getApp().go_to_page(th.data.is_reg,function (){ | |
304 | + // wx.navigateBack({ delta: 1 }) | |
305 | + wx.reLaunch({ | |
306 | + url: '/pages/user/index/index', | |
307 | + }) | |
291 | 308 | }) |
309 | + | |
292 | 310 | } |
293 | 311 | |
294 | 312 | }, | ... | ... |
packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js
... | ... | @@ -301,6 +301,7 @@ Page({ |
301 | 301 | arr2[j].giftTitle=arr2[j].act_name |
302 | 302 | arr2[j].virtualsales=arr2[j].virtualSales |
303 | 303 | arr2[j].lbnum=arr2[j].lbNum |
304 | + | |
304 | 305 | } |
305 | 306 | if(arr2.length>0){ |
306 | 307 | var monthgiftbag =arr2[0]; |
... | ... | @@ -320,6 +321,7 @@ Page({ |
320 | 321 | isStart, |
321 | 322 | monthgiftbag: monthgiftbag, |
322 | 323 | sele_g: monthgiftbag, |
324 | + default_color:monthgiftbag.bg_color | |
323 | 325 | }) |
324 | 326 | th.init() |
325 | 327 | }else{ | ... | ... |
packageF/pages/free_delivery/free_delivery.wxss
pages/cart/cart/cart.js
... | ... | @@ -672,14 +672,25 @@ Page({ |
672 | 672 | }) |
673 | 673 | |
674 | 674 | //只有一种活动,但是又是秒杀之类是互动,就要失效。不能是普通购买 |
675 | - if (prom && prom.length == 1 && [1, 2, 4, 6, 8, 9].indexOf(prom.prom_type) > -1 && !prom.is_integral_normal && !prom.is_pd_normal) { | |
675 | + if (prom && prom.length == 1 && [1, 2, 4, 6, 8, 9].indexOf(prom[0].prom_type) > -1 && !item.is_integral_normal && !item.is_pd_normal) { | |
676 | 676 | th.disInvalid(item); |
677 | 677 | continue; |
678 | 678 | } |
679 | + | |
679 | 680 | //只有秒杀和积分购的时候,不能是普通购买 |
680 | - if (prom && prom.length == 2 && [1, 4].indexOf(prom.prom_type) > -1 && [1, 4].indexOf(prom.prom_type) > -1 && !prom.is_integral_normal && !prom.is_pd_normal) { | |
681 | - th.disInvalid(item); | |
682 | - continue; | |
681 | + if (prom && prom.length == 2 && !item.is_integral_normal && !item.is_pd_normal) { | |
682 | + var idx=prom.findIndex(function (e){ | |
683 | + return e.prom_type==1; | |
684 | + }) | |
685 | + var idx2=prom.findIndex(function (e){ | |
686 | + return e.prom_type==4; | |
687 | + }) | |
688 | + //--如果是有秒杀和积分的时候-- | |
689 | + if(idx>-1 && idx2>-1){ | |
690 | + th.disInvalid(item); | |
691 | + continue; | |
692 | + } | |
693 | + | |
683 | 694 | } |
684 | 695 | |
685 | 696 | } |
... | ... | @@ -724,6 +735,8 @@ Page({ |
724 | 735 | //商品已经下架 |
725 | 736 | continue; |
726 | 737 | } |
738 | + //把活动写入 | |
739 | + item.prom=prom; | |
727 | 740 | |
728 | 741 | //判断秒杀的限购 |
729 | 742 | if (item.goods_num + promgoodsbuynum > prom.buy_limit && prom.buy_limit > 0) { |
... | ... | @@ -984,6 +997,8 @@ Page({ |
984 | 997 | }, 0, 1); |
985 | 998 | continue; |
986 | 999 | } |
1000 | + | |
1001 | + item.prom=prom; | |
987 | 1002 | //判断秒杀的限购 |
988 | 1003 | var msNum = 0 |
989 | 1004 | await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { |
... | ... | @@ -3327,6 +3342,18 @@ Page({ |
3327 | 3342 | if (res.data.code == 0) gd = res.data.data; |
3328 | 3343 | }) |
3329 | 3344 | |
3345 | + //判断秒杀的指定门店 | |
3346 | + if(py_type==1 && i_arr[j].prom && i_arr[j].prom.pick_up_lists){ | |
3347 | + var idx0=i_arr[j].prom.pick_up_lists.findIndex(function (e){ | |
3348 | + return e.pickup_id==i_arr[j].pick_id; | |
3349 | + }) | |
3350 | + if(idx0<0){ | |
3351 | + getApp().confirmBox(i_arr[j].goods_name + "秒杀活动的门店不可售"); | |
3352 | + wx.hideLoading(); | |
3353 | + return false; | |
3354 | + } | |
3355 | + } | |
3356 | + | |
3330 | 3357 | if ([0, 3, 5, 7, 10].indexOf(py_type) > -1) { |
3331 | 3358 | //如果是指定门店,就要判断 |
3332 | 3359 | if(gd.pick_group_ids){ |
... | ... | @@ -3582,8 +3609,22 @@ Page({ |
3582 | 3609 | store_id: oo.stoid |
3583 | 3610 | } |
3584 | 3611 | }); |
3612 | + | |
3613 | + | |
3614 | + //判断秒杀的指定门店 | |
3615 | + if(i_arr[j].prom_type==1 && i_arr[j].prom && i_arr[j].prom.pick_up_lists && i_arr[j].selected){ | |
3616 | + var idx0=i_arr[j].prom.pick_up_lists.findIndex(function (e){ | |
3617 | + return e.pickup_id==i_arr[j].pick_id; | |
3618 | + }) | |
3619 | + if(idx0<0){ | |
3620 | + getApp().confirmBox(i_arr[j].service_name + "秒杀活动的门店不可售"); | |
3621 | + wx.hideLoading(); | |
3622 | + return false; | |
3623 | + } | |
3624 | + } | |
3585 | 3625 | } |
3586 | 3626 | } |
3627 | + | |
3587 | 3628 | //排除失效服务结算 |
3588 | 3629 | this.data.invalidList.map(item => { |
3589 | 3630 | if (item.selected && item.classType == 1) { |
... | ... | @@ -3596,6 +3637,8 @@ Page({ |
3596 | 3637 | }); |
3597 | 3638 | } |
3598 | 3639 | }) |
3640 | + | |
3641 | + | |
3599 | 3642 | wx.hideLoading(); |
3600 | 3643 | getApp().goto("/packageA/pages/cart2_ser/cart2_ser?is_cart=1"); |
3601 | 3644 | } | ... | ... |
pages/cart/cart_wk/cart_wk.js
pages/cart/cart_wk/cart_wk.wxml
... | ... | @@ -134,7 +134,7 @@ |
134 | 134 | <text class='zf_left_wz'>支付合计:</text> |
135 | 135 | <text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price,2)}}</text> |
136 | 136 | </view> --> |
137 | - <view class='zf_left'>支付合计:<text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price-(bn_use_commission?goods.use_commission:0)-formData.order_prom_amount ,2)}}</text></view> | |
137 | + <view class='zf_left'>支付合计:<text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price-(bn_use_commission?goods.use_commission:0)-(formData.order_prom_amount?formData.order_prom_amount:0) ,2)}}</text></view> | |
138 | 138 | <view class="zf_btn {{(submit || !same_ok)?'gray':''}}" bindtap="to_pay">支付尾款</view> |
139 | 139 | </view> |
140 | 140 | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -274,6 +274,8 @@ Page({ |
274 | 274 | showFold:true, |
275 | 275 | new_share_imgurl:'', //普通商品分享图片 |
276 | 276 | |
277 | + adding:0 //加入购物车的避免重复 | |
278 | + | |
277 | 279 | }, |
278 | 280 | |
279 | 281 | //------初始化加载---------- |
... | ... | @@ -919,6 +921,8 @@ Page({ |
919 | 921 | |
920 | 922 | //---展示--- |
921 | 923 | onShow: function () { |
924 | + //添加购物车的控制要清理0 | |
925 | + this.data.adding=0; | |
922 | 926 | |
923 | 927 | getApp().check_can_share(this); |
924 | 928 | |
... | ... | @@ -1389,6 +1393,15 @@ Page({ |
1389 | 1393 | return false; |
1390 | 1394 | } |
1391 | 1395 | |
1396 | + if(th.data.adding) return false; | |
1397 | + th.data.adding=1; | |
1398 | + | |
1399 | + wx.showLoading({ | |
1400 | + mask:true | |
1401 | + }) | |
1402 | + | |
1403 | + | |
1404 | + | |
1392 | 1405 | |
1393 | 1406 | |
1394 | 1407 | //如果是秒杀的话,要看redis够不够 |
... | ... | @@ -1403,7 +1416,8 @@ Page({ |
1403 | 1416 | |
1404 | 1417 | this.getactLen(function (num) { |
1405 | 1418 | if (num < th.data.goodsInputNum) { |
1406 | - | |
1419 | + wx.hideLoading(); | |
1420 | + th.data.adding=0; | |
1407 | 1421 | // getApp().my_warnning("活动库存不足!", 0, th); |
1408 | 1422 | wx.showToast({ |
1409 | 1423 | title: '活动库存不足!', |
... | ... | @@ -1583,10 +1597,14 @@ Page({ |
1583 | 1597 | add_cart_func: function (t) { |
1584 | 1598 | var i = getApp().request; |
1585 | 1599 | if (oo.user_id == null) { |
1600 | + wx.hideLoading(); | |
1601 | + th.data.adding=0; | |
1586 | 1602 | return s.my_warnning("还未登录!", 0, this); |
1587 | 1603 | } |
1588 | 1604 | |
1589 | 1605 | if (!getApp().globalData.userInfo) { |
1606 | + wx.hideLoading(); | |
1607 | + th.data.adding=0; | |
1590 | 1608 | return s.my_warnning("还未登录!", 0, this); |
1591 | 1609 | } |
1592 | 1610 | |
... | ... | @@ -1601,6 +1619,8 @@ Page({ |
1601 | 1619 | //---判断商品是否超出限购--- |
1602 | 1620 | if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { |
1603 | 1621 | if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { |
1622 | + wx.hideLoading(); | |
1623 | + th.data.adding=0; | |
1604 | 1624 | wx.showToast({ |
1605 | 1625 | title: '超出商品限购', |
1606 | 1626 | icon: 'none', |
... | ... | @@ -1612,6 +1632,8 @@ Page({ |
1612 | 1632 | //---判断商品是否超出活动限购--- |
1613 | 1633 | if ((th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) && !th.data.is_normal) { |
1614 | 1634 | if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { |
1635 | + wx.hideLoading(); | |
1636 | + th.data.adding=0; | |
1615 | 1637 | wx.showToast({ |
1616 | 1638 | title: '超出商品活动限购', |
1617 | 1639 | icon: 'none', |
... | ... | @@ -1621,12 +1643,20 @@ Page({ |
1621 | 1643 | } |
1622 | 1644 | } |
1623 | 1645 | |
1624 | - if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); | |
1646 | + if (th.data.goodsInputNum <= 0){ | |
1647 | + wx.hideLoading(); | |
1648 | + th.data.adding=0; | |
1649 | + return s.my_warnning("商品数量不能为0", 0, th); | |
1650 | + } | |
1625 | 1651 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) |
1626 | 1652 | th.setData({ |
1627 | 1653 | sto_sele_name: "" |
1628 | 1654 | }); |
1629 | - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | |
1655 | + if (th.data.sto_sele_name == ""){ | |
1656 | + wx.hideLoading(); | |
1657 | + th.data.adding=0; | |
1658 | + return s.my_warnning("请选择门店", 0, th); | |
1659 | + } | |
1630 | 1660 | |
1631 | 1661 | //--------------此时操作的数据------------ |
1632 | 1662 | var newd = { |
... | ... | @@ -1703,6 +1733,8 @@ Page({ |
1703 | 1733 | th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { |
1704 | 1734 | if (CanOutQty) { |
1705 | 1735 | if (CanOutQty < e.data.goodsInputNum) { |
1736 | + wx.hideLoading(); | |
1737 | + th.data.adding=0; | |
1706 | 1738 | wx.showToast({ |
1707 | 1739 | title: '库存不足!', |
1708 | 1740 | icon: 'none', |
... | ... | @@ -1712,6 +1744,8 @@ Page({ |
1712 | 1744 | |
1713 | 1745 | th.add_cart_next(e, t, a, o, newd, CanOutQty); |
1714 | 1746 | } else { |
1747 | + wx.hideLoading(); | |
1748 | + th.data.adding=0; | |
1715 | 1749 | wx.showToast({ |
1716 | 1750 | title: '库存不足!', |
1717 | 1751 | icon: 'none', |
... | ... | @@ -1723,47 +1757,52 @@ Page({ |
1723 | 1757 | |
1724 | 1758 | } else { |
1725 | 1759 | if (o.store_count <= 0) { |
1760 | + wx.hideLoading(); | |
1761 | + th.data.adding=0; | |
1726 | 1762 | wx.showToast({ |
1727 | 1763 | title: '库存已为空!', |
1728 | 1764 | icon: 'none' |
1729 | 1765 | }); |
1730 | 1766 | return false; |
1731 | - }; | |
1767 | + } | |
1732 | 1768 | if (o.store_count < e.data.goodsInputNum) { |
1769 | + wx.hideLoading(); | |
1770 | + th.data.adding=0; | |
1733 | 1771 | wx.showToast({ |
1734 | 1772 | title: '库存不足!', |
1735 | 1773 | icon: 'none', |
1736 | 1774 | }); |
1737 | 1775 | return false; |
1738 | 1776 | // return s.my_warnning("库存不足!", 0, th); |
1739 | - }; | |
1777 | + } | |
1740 | 1778 | th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 |
1741 | 1779 | }; |
1742 | - | |
1743 | 1780 | return false; |
1744 | 1781 | } |
1745 | 1782 | |
1746 | 1783 | newd.goods_price = th.data.prom_price; |
1747 | 1784 | newd.member_goods_price = th.data.prom_price, |
1748 | - newd.prom_type = th.data.prom_type; | |
1785 | + newd.prom_type = th.data.prom_type; | |
1749 | 1786 | newd.prom_id = th.data.prom_id; |
1750 | 1787 | |
1751 | 1788 | if (o.store_count <= 0) { |
1789 | + wx.hideLoading(); | |
1790 | + th.data.adding=0; | |
1752 | 1791 | wx.showToast({ |
1753 | 1792 | title: '库存已为空!', |
1754 | 1793 | icon: 'none', |
1755 | 1794 | }); |
1756 | 1795 | return false; |
1757 | - //return s.my_warnning("库存已为空!", 0, th); | |
1758 | - }; | |
1796 | + } | |
1759 | 1797 | if (o.store_count < e.data.goodsInputNum) { |
1798 | + wx.hideLoading(); | |
1799 | + th.data.adding=0; | |
1760 | 1800 | wx.showToast({ |
1761 | 1801 | title: '库存不足!', |
1762 | 1802 | icon: 'none', |
1763 | 1803 | }); |
1764 | 1804 | return false; |
1765 | - }; | |
1766 | - | |
1805 | + } | |
1767 | 1806 | th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 |
1768 | 1807 | |
1769 | 1808 | } else if (o.prom_type == 7) { |
... | ... | @@ -1776,6 +1815,8 @@ Page({ |
1776 | 1815 | newd.prom_id = th.data.sele_g.act.id; |
1777 | 1816 | newd.prom_type = 7; |
1778 | 1817 | if (o.store_count <= 0) { |
1818 | + wx.hideLoading(); | |
1819 | + th.data.adding=0; | |
1779 | 1820 | wx.showToast({ |
1780 | 1821 | title: '库存已为空!', |
1781 | 1822 | icon: 'none', |
... | ... | @@ -1783,6 +1824,8 @@ Page({ |
1783 | 1824 | return false; |
1784 | 1825 | }; |
1785 | 1826 | if (o.store_count < e.data.goodsInputNum) { |
1827 | + wx.hideLoading(); | |
1828 | + th.data.adding=0; | |
1786 | 1829 | wx.showToast({ |
1787 | 1830 | title: '库存不足!', |
1788 | 1831 | icon: 'none', |
... | ... | @@ -1801,6 +1844,8 @@ Page({ |
1801 | 1844 | if (CanOutQty) { |
1802 | 1845 | |
1803 | 1846 | if (CanOutQty < e.data.goodsInputNum) { |
1847 | + wx.hideLoading(); | |
1848 | + th.data.adding=0; | |
1804 | 1849 | wx.showToast({ |
1805 | 1850 | title: '库存不足!', |
1806 | 1851 | icon: 'none', |
... | ... | @@ -1810,6 +1855,8 @@ Page({ |
1810 | 1855 | |
1811 | 1856 | th.add_cart_next(e, t, a, o, newd, CanOutQty); |
1812 | 1857 | } else { |
1858 | + wx.hideLoading(); | |
1859 | + th.data.adding=0; | |
1813 | 1860 | wx.showToast({ |
1814 | 1861 | title: '库存不足!', |
1815 | 1862 | icon: 'none', |
... | ... | @@ -1820,6 +1867,8 @@ Page({ |
1820 | 1867 | |
1821 | 1868 | } else { |
1822 | 1869 | if (o.store_count <= 0) { |
1870 | + wx.hideLoading(); | |
1871 | + th.data.adding=0; | |
1823 | 1872 | wx.showToast({ |
1824 | 1873 | title: '库存已为空!', |
1825 | 1874 | icon: 'none', |
... | ... | @@ -1828,6 +1877,8 @@ Page({ |
1828 | 1877 | //return s.my_warnning("库存已为空!", 0, th); |
1829 | 1878 | }; |
1830 | 1879 | if (o.store_count < e.data.goodsInputNum) { |
1880 | + wx.hideLoading(); | |
1881 | + th.data.adding=0; | |
1831 | 1882 | wx.showToast({ |
1832 | 1883 | title: '库存不足!', |
1833 | 1884 | icon: 'none', |
... | ... | @@ -1854,6 +1905,8 @@ Page({ |
1854 | 1905 | if (CanOutQty) { |
1855 | 1906 | |
1856 | 1907 | if (CanOutQty < e.data.goodsInputNum) { |
1908 | + wx.hideLoading(); | |
1909 | + th.data.adding=0; | |
1857 | 1910 | wx.showToast({ |
1858 | 1911 | title: '库存不足!', |
1859 | 1912 | icon: 'none', |
... | ... | @@ -1863,6 +1916,7 @@ Page({ |
1863 | 1916 | |
1864 | 1917 | th.add_cart_next(e, t, a, o, newd, CanOutQty); |
1865 | 1918 | } else { |
1919 | + wx.hideLoading(); | |
1866 | 1920 | wx.showToast({ |
1867 | 1921 | title: '库存不足!', |
1868 | 1922 | icon: 'none', |
... | ... | @@ -1873,6 +1927,7 @@ Page({ |
1873 | 1927 | |
1874 | 1928 | } else { |
1875 | 1929 | if (o.store_count <= 0) { |
1930 | + wx.hideLoading(); | |
1876 | 1931 | wx.showToast({ |
1877 | 1932 | title: '库存已为空!', |
1878 | 1933 | icon: 'none', |
... | ... | @@ -1881,13 +1936,14 @@ Page({ |
1881 | 1936 | //return s.my_warnning("库存已为空!", 0, th); |
1882 | 1937 | }; |
1883 | 1938 | if (o.store_count < e.data.goodsInputNum) { |
1939 | + wx.hideLoading(); | |
1884 | 1940 | wx.showToast({ |
1885 | 1941 | title: '库存不足!', |
1886 | 1942 | icon: 'none', |
1887 | 1943 | }); |
1888 | 1944 | return false; |
1889 | 1945 | //return s.my_warnning("库存不足!", 0, th); |
1890 | - }; | |
1946 | + } | |
1891 | 1947 | th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 |
1892 | 1948 | } |
1893 | 1949 | } |
... | ... | @@ -1899,6 +1955,8 @@ Page({ |
1899 | 1955 | |
1900 | 1956 | //---加入购物车的最后一步--- |
1901 | 1957 | add_cart_next(e, t, a, o, newd, CanOutQty) { |
1958 | + | |
1959 | + | |
1902 | 1960 | if (getApp().globalData.groupchat_id) { |
1903 | 1961 | newd.groupchat_id = getApp().globalData.groupchat_id |
1904 | 1962 | } |
... | ... | @@ -1933,26 +1991,10 @@ Page({ |
1933 | 1991 | //if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d); |
1934 | 1992 | if ("add" == t.currentTarget.dataset.action) { |
1935 | 1993 | |
1936 | - if ([3, 5, 10].indexOf(newd.prom_type) > -1) { | |
1937 | - newd.prom_type = 0; | |
1938 | - newd.prom_id = 0; | |
1939 | - } | |
1940 | - | |
1941 | - //如果有搭配购的时候的时候 | |
1942 | - if (th.data.collocationGoods && newd.prom_type == 0) { | |
1943 | - newd.prom_type = 5; | |
1944 | - newd.prom_id = th.data.collocationGoods.id; | |
1945 | - } | |
1946 | - | |
1947 | - //如果有搭配购的时候的时候 | |
1948 | - if (th.data.zh_act && (!th.data.zh_act.zh_num || th.data.zh_act.zh_buy_num < th.data.zh_act.zh_num) && newd.prom_type == 0) { | |
1949 | - newd.prom_type = 7; | |
1950 | - newd.prom_id = th.data.zh_act.id; | |
1994 | + if( [3,5,7,10].indexOf(newd.prom_type)>-1){ | |
1995 | + newd.prom_type=0; | |
1996 | + newd.prom_id=0; | |
1951 | 1997 | } |
1952 | - // if( [3,5,10].indexOf(newd.prom_type)>-1){ | |
1953 | - // newd.prom_type=0; | |
1954 | - // newd.prom_id=0; | |
1955 | - // } | |
1956 | 1998 | // |
1957 | 1999 | // //如果有搭配购的时候的时候 |
1958 | 2000 | // if(th.data.collocationGoods && newd.prom_type==0){ |
... | ... | @@ -1973,6 +2015,8 @@ Page({ |
1973 | 2015 | user_id: oo.user_id, |
1974 | 2016 | goods_id: a, |
1975 | 2017 | pick_id: e.data.sto_sele_id, |
2018 | + prom_type: newd.prom_type, | |
2019 | + prom_id: newd.prom_id, | |
1976 | 2020 | state: 0, |
1977 | 2021 | }, |
1978 | 2022 | success: function (re) { |
... | ... | @@ -2002,6 +2046,8 @@ Page({ |
2002 | 2046 | //判断数量,要看下购物车中有没有该商品 |
2003 | 2047 | if (CanOutQty) { |
2004 | 2048 | if (item.goods_num + th.data.goodsInputNum > CanOutQty) { |
2049 | + wx.hideLoading(); | |
2050 | + th.data.adding=0; | |
2005 | 2051 | wx.showToast({ |
2006 | 2052 | title: '库存不足!', |
2007 | 2053 | icon: 'none', |
... | ... | @@ -2011,6 +2057,8 @@ Page({ |
2011 | 2057 | } |
2012 | 2058 | } else { |
2013 | 2059 | if (item.goods_num + th.data.goodsInputNum > o.store_count) { |
2060 | + wx.hideLoading(); | |
2061 | + th.data.adding=0; | |
2014 | 2062 | wx.showToast({ |
2015 | 2063 | title: '库存不足!', |
2016 | 2064 | icon: 'none', |
... | ... | @@ -2019,7 +2067,10 @@ Page({ |
2019 | 2067 | //return s.my_warnning("库存不足!", 0, th); |
2020 | 2068 | } |
2021 | 2069 | |
2022 | - if (item.goods_num + th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit && (th.data.prom_type == 1 || th.data.prom_type == 2)) { | |
2070 | + //秒杀有限购的时候,同时不是普通购买 | |
2071 | + if ( item.goods_num + th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit && th.data.prom_buy_limit>0 && !newd.is_pd_normal && (th.data.prom_type == 1 || th.data.prom_type == 2)) { | |
2072 | + wx.hideLoading(); | |
2073 | + th.data.adding=0; | |
2023 | 2074 | wx.showToast({ |
2024 | 2075 | title: '此商品已在购物车,去购物车结算!', |
2025 | 2076 | icon: 'none', |
... | ... | @@ -2035,9 +2086,14 @@ Page({ |
2035 | 2086 | goods_price: newd.goods_price, |
2036 | 2087 | member_goods_price: newd.goods_price, |
2037 | 2088 | store_id: th.data.stoid, |
2038 | - prom_id: newd.prom_id //把活动id带上去(用于购物车失效变成有效商品) | |
2089 | + prom_id: newd.prom_id, //把活动id带上去(用于购物车失效变成有效商品) | |
2090 | + prom_type: newd.prom_type | |
2039 | 2091 | }; |
2040 | 2092 | |
2093 | + if(newd.is_pd_normal){ | |
2094 | + updata.is_pd_normal=1 | |
2095 | + } | |
2096 | + | |
2041 | 2097 | //---是不是从收藏夹出来的--- |
2042 | 2098 | if (th.data.c_guide_id) { |
2043 | 2099 | updata['guide_id'] = th.data.c_guide_id; |
... | ... | @@ -2055,6 +2111,8 @@ Page({ |
2055 | 2111 | getApp().request.put("/api/weshop/cart/update", { |
2056 | 2112 | data: updata, |
2057 | 2113 | success: function (t) { |
2114 | + wx.hideLoading(); | |
2115 | + th.data.adding=0; | |
2058 | 2116 | getApp().my_warnning('加入购物车成功', 1, th, 450); |
2059 | 2117 | var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; |
2060 | 2118 | th.setData({ |
... | ... | @@ -2067,6 +2125,8 @@ Page({ |
2067 | 2125 | getApp().request.post("/api/weshop/cart/save", { |
2068 | 2126 | data: newd, |
2069 | 2127 | success: function (t) { |
2128 | + wx.hideLoading(); | |
2129 | + th.data.adding=0; | |
2070 | 2130 | getApp().my_warnning('加入购物车成功', 1, th, 450); |
2071 | 2131 | var c_num = th.data.cartGoodsNum + e.data.goodsInputNum; |
2072 | 2132 | th.setData({ |
... | ... | @@ -3223,6 +3283,7 @@ Page({ |
3223 | 3283 | //要把不匹配还原 |
3224 | 3284 | if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ |
3225 | 3285 | th.data.def_pick_store.is_no_dis=0; |
3286 | + th.data.def_pick_store.is_no_dis_nor=0; | |
3226 | 3287 | th.setData({def_pick_store:th.data.def_pick_store}) |
3227 | 3288 | } |
3228 | 3289 | |
... | ... | @@ -3569,14 +3630,25 @@ Page({ |
3569 | 3630 | |
3570 | 3631 | if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) { |
3571 | 3632 | |
3633 | + var pickup_ids=th.data.sele_g.pickup_ids; | |
3634 | + //不是单独购买的时候,要清空商品pickup_ids | |
3635 | + if(!is_normal && th.data.prom_type>0){ | |
3636 | + pickup_ids=null; | |
3637 | + } | |
3638 | + | |
3639 | + //指定门店判断, 不是普通购买的时候,秒杀的时候,秒杀有指定门店 | |
3640 | + if(!is_normal && th.data.prom_type==1 && th.data.prom_act.pick_up_lists){ | |
3641 | + pickup_ids=th.data.prom_act.pick_up_lists | |
3642 | + } | |
3643 | + | |
3572 | 3644 | //-- 如果有指定门店的时候 -- |
3573 | - if(th.data.sele_g.pickup_ids){ | |
3645 | + if(pickup_ids){ | |
3574 | 3646 | |
3575 | 3647 | var ok_arr=[]; |
3576 | 3648 | for (let i in e.data.data.pageData) { |
3577 | 3649 | let ite = e.data.data.pageData[i]; |
3578 | 3650 | //-- 查找一下门店有没有在 -- |
3579 | - var idx=th.data.sele_g.pickup_ids.findIndex(function (e){ | |
3651 | + var idx=pickup_ids.findIndex(function (e){ | |
3580 | 3652 | return e.pickup_id==ite.pickup_id; |
3581 | 3653 | }) |
3582 | 3654 | if(idx>-1){ |
... | ... | @@ -3588,22 +3660,44 @@ Page({ |
3588 | 3660 | if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ |
3589 | 3661 | |
3590 | 3662 | //-- 查找一下门店有没有在 -- |
3591 | - var idx1=th.data.sele_g.pickup_ids.findIndex(function (e){ | |
3663 | + var idx1=pickup_ids.findIndex(function (e){ | |
3592 | 3664 | return e.pickup_id==th.data.def_pick_store.pickup_id; |
3593 | 3665 | }) |
3594 | 3666 | |
3595 | 3667 | if(idx1<0){ |
3596 | - th.data.def_pick_store.is_no_dis_nor=1; | |
3597 | - that.setData({ | |
3598 | - def_pick_store: th.data.def_pick_store | |
3599 | - }) | |
3668 | + //如果是秒杀的指定门店,就要设置秒杀的 | |
3669 | + if(!is_normal && th.data.prom_type==1){ | |
3670 | + th.data.def_pick_store.is_no_dis_act=1; | |
3671 | + }else{ | |
3672 | + th.data.def_pick_store.is_no_dis_nor=1; | |
3673 | + } | |
3674 | + | |
3675 | + }else{ | |
3676 | + th.data.def_pick_store.is_no_dis_nor=0; | |
3677 | + th.data.def_pick_store.is_no_dis_act=0; | |
3600 | 3678 | } |
3679 | + | |
3680 | + that.setData({ | |
3681 | + def_pick_store: th.data.def_pick_store | |
3682 | + }) | |
3683 | + | |
3601 | 3684 | } |
3602 | 3685 | |
3603 | 3686 | |
3604 | - e.data.data.pageData=ok_arr; //数组重新赋值 | |
3687 | + e.data.data.pageData=ok_arr; //数组重新赋值 | |
3605 | 3688 | e.data.data.total=ok_arr.length; //数组的长度 |
3606 | 3689 | } |
3690 | + else{ | |
3691 | + //-- 多规格指定门店优化 -- | |
3692 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
3693 | + th.data.def_pick_store.is_no_dis_nor=0; | |
3694 | + th.data.def_pick_store.is_no_dis_act=0; | |
3695 | + that.setData({ | |
3696 | + def_pick_store: th.data.def_pick_store | |
3697 | + }) | |
3698 | + } | |
3699 | + | |
3700 | + } | |
3607 | 3701 | |
3608 | 3702 | var his_cate_num = 0; |
3609 | 3703 | for (let i in e.data.data.pageData) { |
... | ... | @@ -5087,6 +5181,13 @@ Page({ |
5087 | 5181 | //如果是拼单活动的普通购买 |
5088 | 5182 | if (ind == 1) { |
5089 | 5183 | |
5184 | + | |
5185 | + //要把不匹配还原 | |
5186 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
5187 | + th.data.def_pick_store.is_no_dis_nor=0; | |
5188 | + th.setData({def_pick_store:th.data.def_pick_store}) | |
5189 | + } | |
5190 | + | |
5090 | 5191 | if (!th.data.is_normal) { |
5091 | 5192 | th.data.g_buy_num = new Map(); |
5092 | 5193 | } |
... | ... | @@ -5207,6 +5308,12 @@ Page({ |
5207 | 5308 | th = e, |
5208 | 5309 | o = this.data.sele_g; |
5209 | 5310 | |
5311 | + if(th.data.adding) return false; | |
5312 | + th.data.adding=0; | |
5313 | + | |
5314 | + wx.showLoading({ | |
5315 | + mask:true | |
5316 | + }) | |
5210 | 5317 | |
5211 | 5318 | //----------添加到购物车时,要判断限购数量,-------- |
5212 | 5319 | e.get_buy_num(o, async function (ee) { |
... | ... | @@ -5214,6 +5321,9 @@ Page({ |
5214 | 5321 | //---判断商品是否超出限购--- |
5215 | 5322 | if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { |
5216 | 5323 | if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { |
5324 | + | |
5325 | + wx.hideLoading(); | |
5326 | + th.data.adding=0; | |
5217 | 5327 | wx.showToast({ |
5218 | 5328 | title: '超出商品限购', |
5219 | 5329 | icon: 'none', |
... | ... | @@ -5231,6 +5341,8 @@ Page({ |
5231 | 5341 | //---判断商品是否超出活动限购,拼团的普通购买不计算活动的限购--- |
5232 | 5342 | if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) { |
5233 | 5343 | if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { |
5344 | + wx.hideLoading(); | |
5345 | + th.data.adding=0; | |
5234 | 5346 | wx.showToast({ |
5235 | 5347 | title: '超出商品活动限购', |
5236 | 5348 | icon: 'none', |
... | ... | @@ -5250,6 +5362,8 @@ Page({ |
5250 | 5362 | if (th.data.is_normal != 1) { |
5251 | 5363 | |
5252 | 5364 | if (o.store_count <= 0) { |
5365 | + wx.hideLoading(); | |
5366 | + th.data.adding=0; | |
5253 | 5367 | wx.showToast({ |
5254 | 5368 | title: '库存已为空!', |
5255 | 5369 | icon: 'none', |
... | ... | @@ -5265,6 +5379,8 @@ Page({ |
5265 | 5379 | }) |
5266 | 5380 | |
5267 | 5381 | if (th.data.goodsInputNum > redis_num) { |
5382 | + wx.hideLoading(); | |
5383 | + th.data.adding=0; | |
5268 | 5384 | wx.showToast({ |
5269 | 5385 | title: '超出商品活动库存', |
5270 | 5386 | icon: 'none', |
... | ... | @@ -5278,6 +5394,8 @@ Page({ |
5278 | 5394 | } |
5279 | 5395 | } else { |
5280 | 5396 | if (o.store_count <= 0) { |
5397 | + wx.hideLoading(); | |
5398 | + th.data.adding=0; | |
5281 | 5399 | wx.showToast({ |
5282 | 5400 | title: '库存已为空!', |
5283 | 5401 | icon: 'none', |
... | ... | @@ -5288,6 +5406,8 @@ Page({ |
5288 | 5406 | } |
5289 | 5407 | |
5290 | 5408 | if (th.data.goodsInputNum <= 0) { |
5409 | + wx.hideLoading(); | |
5410 | + th.data.adding=0; | |
5291 | 5411 | wx.showToast({ |
5292 | 5412 | title: '商品数量不能为0', |
5293 | 5413 | icon: 'none', |
... | ... | @@ -5297,9 +5417,8 @@ Page({ |
5297 | 5417 | }; |
5298 | 5418 | if (th.data.goodsInputNum > o.store_count) { |
5299 | 5419 | |
5300 | - // th.setData({ | |
5301 | - // goodsInputNum: o.store_count | |
5302 | - // }) | |
5420 | + wx.hideLoading(); | |
5421 | + th.data.adding=0; | |
5303 | 5422 | wx.showToast({ |
5304 | 5423 | title: '超出商品库存', |
5305 | 5424 | icon: 'none', |
... | ... | @@ -5312,7 +5431,11 @@ Page({ |
5312 | 5431 | th.setData({ |
5313 | 5432 | sto_sele_name: "" |
5314 | 5433 | }); |
5315 | - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | |
5434 | + if (th.data.sto_sele_name == ""){ | |
5435 | + wx.hideLoading(); | |
5436 | + th.data.adding=0; | |
5437 | + return s.my_warnning("请选择门店", 0, th); | |
5438 | + } | |
5316 | 5439 | //--------------此时操作的数据------------ |
5317 | 5440 | var newd = { |
5318 | 5441 | goods_id: o.goods_id, |
... | ... | @@ -7959,6 +8082,13 @@ Page({ |
7959 | 8082 | |
7960 | 8083 | this.data.g_buy_num = new Map(); |
7961 | 8084 | var th = this; |
8085 | + | |
8086 | + //要把不匹配还原 | |
8087 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
8088 | + th.data.def_pick_store.is_no_dis_nor=0; | |
8089 | + th.setData({def_pick_store:th.data.def_pick_store}) | |
8090 | + } | |
8091 | + | |
7962 | 8092 | if (th.data.sku_g_pt) { |
7963 | 8093 | |
7964 | 8094 | //要同步指定门店 |
... | ... | @@ -8031,9 +8161,25 @@ Page({ |
8031 | 8161 | url += "&groupchat_id=" + getApp().globalData.groupchat_id |
8032 | 8162 | } |
8033 | 8163 | |
8164 | + //获取有活动的取活动图片,没有活动的取主图 | |
8165 | + var img = th.data.sele_g.original_img; | |
8166 | + if(th.data.new_share_imgurl){ | |
8167 | + img = th.data.iurl + th.data.new_share_imgurl | |
8168 | + } | |
8169 | + if (th.data.prom_type == 6 || th.data.prom_type == 1 || th.data.prom_type == 4) { | |
8170 | + // title = th.data.prom_act.share_title; | |
8171 | + // if (!title) title = th.data.prom_act.title; | |
8172 | + // if (th.data.prom_type == 4) title = th.data.prom_act.name; | |
8173 | + | |
8174 | + if (th.data.prom_act.share_imgurl) | |
8175 | + img = th.data.iurl + th.data.prom_act.share_imgurl; | |
8176 | + } | |
8177 | + let user_id = getApp().globalData.user_id | |
8178 | + console.error(img); | |
8034 | 8179 | return { |
8035 | 8180 | title: this.data.data.goods_name + '-' + store_name, |
8036 | - imageUrl: this.data.gallery[0].image_url, | |
8181 | + // imageUrl: this.data.gallery[0].image_url, | |
8182 | + imageUrl: img, | |
8037 | 8183 | query: 'first_leader=' + user_id + url |
8038 | 8184 | } |
8039 | 8185 | }, |
... | ... | @@ -8486,7 +8632,16 @@ Page({ |
8486 | 8632 | open_ind_store: 5, |
8487 | 8633 | }); //拼团直接给4 |
8488 | 8634 | |
8635 | + //要把不匹配还原 | |
8636 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
8637 | + th.data.def_pick_store.is_no_dis_nor=0; | |
8638 | + th.setData({def_pick_store:th.data.def_pick_store}) | |
8639 | + } | |
8640 | + | |
8489 | 8641 | if (th.data.sku_g_pt) { |
8642 | + //要同步指定门店 | |
8643 | + th.set_sele_g(th.data.sku_g_pt); | |
8644 | + | |
8490 | 8645 | this.get_sto(1) |
8491 | 8646 | this.setData({ |
8492 | 8647 | openSpecModal_flash_normal: 1 | ... | ... |
pages/goods/goodsInfo/goodsInfo.wxml
... | ... | @@ -712,6 +712,9 @@ |
712 | 712 | <view class="no_store" wx:elif="{{def_pick_store && def_pick_store.is_no_dis_nor && prom_type==0}}"> |
713 | 713 | (该店不可售) |
714 | 714 | </view> |
715 | + <view class="no_store" wx:elif="{{def_pick_store && def_pick_store.is_no_dis_act}}"> | |
716 | + (该店不可售) | |
717 | + </view> | |
715 | 718 | <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules>=2 && prom_type==0 && !sele_g.whsle_id}}"> |
716 | 719 | (库存不足) |
717 | 720 | </view> |
... | ... | @@ -1325,7 +1328,10 @@ |
1325 | 1328 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> |
1326 | 1329 | <block wx:else> |
1327 | 1330 | <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> |
1331 | + | |
1328 | 1332 | <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_nor}}">(该店不可售)</view> |
1333 | + <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_nor && is_normal}}">(该店不可售)</view> | |
1334 | + <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_act && !is_normal}}">(该店不可售)</view> | |
1329 | 1335 | <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && prom_type==0 &&!sele_g.whsle_id }}"> |
1330 | 1336 | (库存不足) |
1331 | 1337 | </view> |
... | ... | @@ -1385,6 +1391,12 @@ |
1385 | 1391 | <view wx:elif="{{def_pick_store && def_pick_store.is_no_dis_nor}}" class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;"> |
1386 | 1392 | 该店不可售 |
1387 | 1393 | </view> |
1394 | + <view wx:elif="{{def_pick_store && def_pick_store.is_no_dis_nor && is_normal}}" class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;"> | |
1395 | + 该店不可售 | |
1396 | + </view> | |
1397 | + <view wx:elif="{{def_pick_store && def_pick_store.is_no_dis_act && !is_normal}}" class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;"> | |
1398 | + 该店不可售 | |
1399 | + </view> | |
1388 | 1400 | <block wx:else> |
1389 | 1401 | <!-- 根本就找不到门店 --> |
1390 | 1402 | <block wx:if="{{!only_pk && !def_pickpu_list}}"> |
... | ... | @@ -1641,6 +1653,8 @@ |
1641 | 1653 | <text class="c-red22" wx:if="{{item.is_no_qyt}}">(库存不足)</text> |
1642 | 1654 | <text class="c-red22" wx:elif="{{item.is_no_dis}}">(配送不匹配)</text> |
1643 | 1655 | <text class="c-red22" wx:elif="{{item.is_no_dis_nor}}">(该店不可售)</text> |
1656 | + <text class="c-red22" wx:elif="{{item.is_no_dis_nor && is_normal}}">(该店不可售)</text> | |
1657 | + <text class="c-red22" wx:elif="{{item.is_no_dis_act && !is_normal}}">(该店不可售)</text> | |
1644 | 1658 | </view> |
1645 | 1659 | </view> |
1646 | 1660 | <view> |
... | ... | @@ -1670,6 +1684,8 @@ |
1670 | 1684 | <view class="fs30 xc-black3 address_name">{{item.pickup_name}} |
1671 | 1685 | <text class="c-red22" wx:if="{{item.is_no_dis}}">(配送不匹配)</text> |
1672 | 1686 | <text class="c-red22" wx:elif="{{item.is_no_dis_nor}}">(该店不可售)</text> |
1687 | + <text class="c-red22" wx:elif="{{item.is_no_dis_nor && is_normal}}">(该店不可售)</text> | |
1688 | + <text class="c-red22" wx:elif="{{item.is_no_dis_act && !is_normal}}">(该店不可售)</text> | |
1673 | 1689 | <text class="c-red22" wx:elif="{{item.is_no_qyt }}">(库存不足)</text> |
1674 | 1690 | </view> |
1675 | 1691 | </view> | ... | ... |
pages/goods/goodsList/goodsList.js
... | ... | @@ -43,10 +43,17 @@ Page({ |
43 | 43 | fil_price_state:0, |
44 | 44 | limit_num:0, |
45 | 45 | gr_fir:0, //分组第一次 |
46 | + share_imgurl:'', //分享图片 | |
46 | 47 | }, |
47 | 48 | |
48 | 49 | onLoad: function(t) { |
50 | + //----------商品分组自定义分享图片---------- | |
51 | + if (t.gid || t.group_id) { | |
52 | + let id = t.gid || t.group_id | |
53 | + this.get_share_imgurl(id) //获取分享图片 | |
54 | + } | |
49 | 55 | |
56 | + //---------------------end------------ | |
50 | 57 | this.data.rq_data=t; |
51 | 58 | |
52 | 59 | //接受有没有导购的参数 |
... | ... | @@ -241,6 +248,18 @@ Page({ |
241 | 248 | onShow:function () { |
242 | 249 | getApp().check_can_share(); |
243 | 250 | }, |
251 | + //获取商品分组分享图片 | |
252 | + get_share_imgurl(gid){ | |
253 | + getApp().request.promiseGet("/api/weshop/goodsGroup/get/" + oo.stoid + "/" + gid, {}).then(res => { | |
254 | + if (res.data.code == 0) { | |
255 | + let prom = res.data.data; | |
256 | + let share_imgurl =prom.share_imgurl | |
257 | + this.setData({ | |
258 | + share_imgurl | |
259 | + }) | |
260 | + } | |
261 | + }) | |
262 | + }, | |
244 | 263 | //获取优惠活动 |
245 | 264 | async getprom(prom_id){ |
246 | 265 | await getApp().request.promiseGet("/api/weshop/promgoods/get/" + oo.stoid + "/" + prom_id, {}).then(res => { |
... | ... | @@ -306,6 +325,10 @@ Page({ |
306 | 325 | }, |
307 | 326 | |
308 | 327 | changeTab: function(t) { |
328 | + | |
329 | + //清空 | |
330 | + this.data.gr_fir=0; | |
331 | + | |
309 | 332 | var ord = t.currentTarget.dataset.href; |
310 | 333 | var ad = t.currentTarget.dataset.ad; |
311 | 334 | var url = this.data.requestUrl; |
... | ... | @@ -335,7 +358,6 @@ Page({ |
335 | 358 | t += "&orderField=" + e.data.tabname; |
336 | 359 | t += "&orderType=" + e.data.adname; |
337 | 360 | } |
338 | - this.data.gr_fir=0; | |
339 | 361 | |
340 | 362 | |
341 | 363 | t +="&page=" + e.data.currentPage; |
... | ... | @@ -487,9 +509,11 @@ Page({ |
487 | 509 | } |
488 | 510 | } |
489 | 511 | console.log("11-11"+pagePath); |
512 | + let share_imgurl=this.data.iurl + this.data.share_imgurl | |
490 | 513 | return { |
491 | 514 | title: "商品列表", |
492 | 515 | path:pagePath, |
516 | + imageUrl:share_imgurl | |
493 | 517 | } |
494 | 518 | }, |
495 | 519 | //---图片失败,默认图片--- |
... | ... | @@ -547,11 +571,18 @@ Page({ |
547 | 571 | }, |
548 | 572 | |
549 | 573 | /*-- 和筛选相关的 --*/ |
550 | - bind_pk_sort(e){ com_fil.bind_pk_sort(e,this); }, | |
574 | + bind_pk_sort(e){ //清空 | |
575 | + this.data.gr_fir=0; com_fil.bind_pk_sort(e,this); | |
576 | + }, | |
551 | 577 | set_screen(url){ com_fil.set_screen(url,this); }, |
552 | - filterGoods(e){ com_fil.filterGoods(e,this); }, | |
578 | + filterGoods(e){ | |
579 | + //清空 | |
580 | + this.data.gr_fir=0;com_fil.filterGoods(e,this); | |
581 | + }, | |
553 | 582 | open_more(e){ com_fil.open_more(e,this); }, |
554 | - clear_fil(){ com_fil.clear_fil(this); } | |
583 | + clear_fil(){ //清空 | |
584 | + this.data.gr_fir=0;com_fil.clear_fil(this); | |
585 | + } | |
555 | 586 | |
556 | 587 | |
557 | 588 | }); |
558 | 589 | \ No newline at end of file | ... | ... |
pages/user/index/index.js
pages/user/order_detail/order_detail.js
... | ... | @@ -978,6 +978,19 @@ Page({ |
978 | 978 | } |
979 | 979 | //----------如果有活动,并且在进行中,就不计算线下库存--------------- |
980 | 980 | if (prom) { |
981 | + | |
982 | + //指定门店的控制 | |
983 | + if (goodsinfo.prom_type == 1 && prom.pick_up_lists) { | |
984 | + var idx0=prom.pick_up_lists.findIndex(function (e){ | |
985 | + return e.pickup_id==order.pickup_id; | |
986 | + }) | |
987 | + if(idx0<0){ | |
988 | + getApp().confirmBox(goodsinfo.goods_name + "秒杀活动的门店不可售"); | |
989 | + th.setData({ paying: 0 }); | |
990 | + return false; | |
991 | + } | |
992 | + } | |
993 | + | |
981 | 994 | var now = ut.gettimestamp(); |
982 | 995 | if (prom.is_end == 1 && prom.end_time < now) { |
983 | 996 | var content = goodsinfo.goods_name + '商品的活动已经结束,请取消订单' |
... | ... | @@ -2119,7 +2132,7 @@ Page({ |
2119 | 2132 | good_url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+gd+"&prom_id="+item.act_id |
2120 | 2133 | break; |
2121 | 2134 | default: |
2122 | - good_url="/pages/goods/goodsInfo/goodsInfo?goods_id="+gd+"&prom_id="+item.act_id+"&prom_type=1"; | |
2135 | + good_url="/pages/goods/goodsInfo/goodsInfo?goods_id="+gd+"&prom_id="+item.act_id+"&prom_type="+item.prom_type; | |
2123 | 2136 | break |
2124 | 2137 | } |
2125 | 2138 | } | ... | ... |
pages/user/order_list/order_list.js
... | ... | @@ -1292,6 +1292,20 @@ Page({ |
1292 | 1292 | } |
1293 | 1293 | //----------如果有活动,并且在进行中,就不计算线下库存--------------- |
1294 | 1294 | if (prom) { |
1295 | + | |
1296 | + //指定门店的控制 | |
1297 | + if (goodsinfo.prom_type == 1 && prom.pick_up_lists) { | |
1298 | + var idx0=prom.pick_up_lists.findIndex(function (e){ | |
1299 | + return e.pickup_id==order.pickup_id; | |
1300 | + }) | |
1301 | + if(idx0<0){ | |
1302 | + getApp().confirmBox(goodsinfo.goods_name + "秒杀活动的门店不可售"); | |
1303 | + th.setData({ paying: 0 }); | |
1304 | + return false; | |
1305 | + } | |
1306 | + } | |
1307 | + | |
1308 | + | |
1295 | 1309 | var now = ut.gettimestamp(); |
1296 | 1310 | if (prom.is_end == 1 && prom.end_time < now) { |
1297 | 1311 | var content = goodsinfo.goods_name + '商品的活动已经结束,请取消订单' |
... | ... | @@ -2849,10 +2863,24 @@ Page({ |
2849 | 2863 | return false; |
2850 | 2864 | } |
2851 | 2865 | |
2866 | + | |
2867 | + //指定门店的控制 | |
2868 | + if (act_details.pick_up_lists) { | |
2869 | + var idx0=act_details.pick_up_lists.findIndex(function (e){ | |
2870 | + return e.pickup_id==it.pickup_id; | |
2871 | + }) | |
2872 | + if(idx0<0){ | |
2873 | + getApp().confirmBox(it.service_name + "秒杀活动的门店不可售"); | |
2874 | + th.setData({ paying: 0 }); | |
2875 | + flag = false; | |
2876 | + return false; | |
2877 | + } | |
2878 | + } | |
2879 | + | |
2852 | 2880 | } |
2853 | 2881 | }); |
2854 | 2882 | |
2855 | - if(act_details.buy_limit>0 && flag){ | |
2883 | + if(act_details && act_details.buy_limit>0 && flag){ | |
2856 | 2884 | await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { |
2857 | 2885 | data: { |
2858 | 2886 | store_id: store_id, | ... | ... |