Commit 60d49647deedf74c91687946d58292f101d1c834
Merge branch 'dev' into 'test'
Dev See merge request !1040
Showing
30 changed files
with
1051 additions
and
573 deletions
packageA/pages/profile/profile.js
... | ... | @@ -23,6 +23,7 @@ var date = new Date(timestamp); |
23 | 23 | // barcode, |
24 | 24 | // qrcode |
25 | 25 | // } = require('../../../utils/index.js'); |
26 | +var regeneratorRuntime = require('../../../utils/runtime.js'); | |
26 | 27 | |
27 | 28 | Page({ |
28 | 29 | data: { |
... | ... | @@ -576,114 +577,104 @@ Page({ |
576 | 577 | |
577 | 578 | self = this; |
578 | 579 | let url1 = '/api/weshop/storeconfig/get/'; |
579 | - let url3 = '/api/weshop/users/getERPUser/'; | |
580 | + let url3 = '/api/weshop/users/getErpvipidPickup'; | |
580 | 581 | url1 += r.stoid; |
581 | - var user=app.globalData.userInfo; | |
582 | - if(!user) return false; | |
583 | - | |
584 | - //-- 赋予默认值 -- | |
585 | - if(user['idcard']) this.data.id=user['idcard']; | |
586 | - if(user['vipname']) this.data.name=user['vipname']; | |
587 | - if(user['address']) this.data.address=user['address']; | |
588 | - | |
582 | + | |
583 | + var uu=getApp().globalData.zc_dd; | |
584 | + if(uu){ | |
585 | + this.setData({head_pic:uu.head_pic,nickname:uu.nickname}) | |
586 | + } | |
587 | + | |
589 | 588 | app.request.get(url1, { |
590 | - success: function(res) { | |
591 | - console.log('x-->', res.data.code, res.data.data.reg_type, res.data.data.reg_info); | |
589 | + success:async function(res) { | |
592 | 590 | if(res.data.code == 0) { |
593 | 591 | let reg_type = res.data.data.reg_type; |
594 | 592 | let reg_info = res.data.data.reg_info; |
595 | 593 | if(reg_type) { //reg_type为1才显示积分信息 |
596 | 594 | if(reg_info) { |
597 | - reg_info = JSON.parse(reg_info); | |
595 | + reg_info = JSON.parse(reg_info); | |
596 | + var user_id=0; | |
597 | + | |
598 | + //-- 获取会员信息 - | |
599 | + await getApp().request.promiseGet("/api/weshop/users/page", {data:{ | |
600 | + store_id:r.stoid,mobile:uu.mobile | |
601 | + }}).then(res=>{ | |
602 | + if(ut.ajax_ok(res)){ | |
603 | + user_id=res.data.data.pageData[0].user_id; | |
604 | + } | |
605 | + }) | |
606 | + | |
598 | 607 | if(reg_info.reginfo_coupon){ |
599 | 608 | //判断有没有领过券 |
600 | - self.check_is_send_quan(reg_info.reginfo_coupon,user.user_id); | |
601 | - } | |
609 | + self.check_is_send_quan(reg_info.reginfo_coupon,user_id); | |
610 | + } | |
611 | + | |
612 | + if(reg_info.reginfo_lb_id){ | |
613 | + //判断有没有领过礼包 | |
614 | + self.check_is_send_libao(reg_info.reginfo_lb_id,user_id); | |
615 | + } | |
616 | + | |
602 | 617 | }; |
603 | 618 | }; |
604 | 619 | self.setData({ |
605 | 620 | reg_type, |
606 | 621 | reg_info, |
607 | - user: app.globalData.userInfo, | |
608 | 622 | }); |
609 | - }; | |
610 | - | |
623 | + } | |
611 | 624 | }, |
612 | 625 | }); |
613 | - | |
614 | - //获取默认信息 | |
615 | - url3 += r.stoid + "/" +user.user_id; | |
616 | - app.request.get(url3, { | |
617 | - success: function(res) { | |
618 | - if(res.data.code == 0) { | |
619 | - console.log('url3', res.data.data.birthday); | |
620 | - let data = res.data.data; | |
621 | - | |
622 | - if(data.birthday){ | |
623 | - data.birthday= ut.formar_no_full(data.birthday); | |
624 | - } | |
625 | - | |
626 | - if(user['sex'] && !data.sex){ | |
627 | - data.sex=user['sex']; | |
628 | - } | |
629 | - if(user['birthday'] && !data.birthday){ | |
630 | - data.birthday= ut.formar_no_full(user['birthday']); | |
631 | - } | |
632 | - | |
633 | - if(!data.pickup_name){ | |
634 | - data.pickup_name=""; | |
635 | - } | |
636 | - if(!data.pickup_id){ | |
637 | - data.pickup_id=0; | |
638 | - } | |
639 | - //-- 获取门店 -- | |
640 | - if(user['pickup_id'] && !data.pickup_id){ | |
641 | - getApp().promiseGet("/api/weshop/pickup/get/"+r.stoid+"/"+user['pickup_id']).then(res=>{ | |
642 | - if(res.data.code==0 && res.data.data){ | |
643 | - data.pickup_name=res.data.data.pickup_name; | |
644 | - data.pickup_id=res.data.data.pickup_id; | |
645 | - | |
646 | - self.setData({ | |
647 | - isGender: data.sex, | |
648 | - isLunar: data.islunar, | |
649 | - datet: data.birthday, | |
650 | - stoname: data.pickup_name, | |
651 | - sto_sele_id: data.pickup_id, | |
652 | - }); | |
653 | - } | |
654 | - else{ | |
655 | - self.setData({ | |
656 | - isGender: data.sex, | |
657 | - isLunar: data.islunar, | |
658 | - datet: data.birthday, | |
659 | - stoname: data.pickup_name, | |
660 | - sto_sele_id: data.pickup_id, | |
661 | - }); | |
662 | - } | |
663 | - if(!self.data.sto_sele_id){ | |
664 | - self.get_store_set(); | |
665 | - } | |
666 | - }) | |
667 | - }else{ | |
668 | - self.setData({ | |
669 | - isGender: data.sex, | |
670 | - isLunar: data.islunar, | |
671 | - datet: data.birthday, | |
672 | - stoname: data.pickup_name, | |
673 | - sto_sele_id: data.pickup_id, | |
674 | - }); | |
675 | - } | |
676 | - | |
677 | - if(!self.data.sto_sele_id){ | |
678 | - self.get_store_set(); | |
679 | - } | |
680 | - }; | |
681 | - } | |
682 | - }); | |
683 | - | |
684 | - if(user){ | |
685 | - self.setData({user:user}) | |
686 | - } | |
626 | + | |
627 | + | |
628 | + //-- 获取线下会员的情况 -- | |
629 | + var req_data={ | |
630 | + stoid:r.stoid, | |
631 | + mobile:getApp().globalData.zc_dd.mobile | |
632 | + }; | |
633 | + if(getApp().globalData.zc_dd.first_leade) | |
634 | + req_data.first_leader=getApp().globalData.zc_dd.first_leader | |
635 | + | |
636 | + wx.showLoading(); | |
637 | + getApp().request.promiseGet(url3, {data:req_data}).then(res=>{ | |
638 | + if(res.data.code==0){ | |
639 | + var back_data=res.data.data; back_data=JSON.parse(back_data); | |
640 | + var set_data={is_fx:0}; | |
641 | + //-- 如果有包含会员的线下的信息 -- | |
642 | + if(back_data && back_data.erpviplist){ | |
643 | + //-- data.data就是门店的数据 -- | |
644 | + if(back_data.data){ | |
645 | + back_data.erpviplist.pickup_id=back_data.data.pickup_id; | |
646 | + if(!back_data.erpviplist.pick) set_data.is_fx=1; | |
647 | + set_data.stoname=back_data.data.pickup_name; | |
648 | + set_data.sto_sele_id=back_data.data.pickup_id; | |
649 | + } | |
650 | + | |
651 | + //-- 推荐人姓名 -- | |
652 | + if(back_data.erpviplist.fromuser) { | |
653 | + set_data.tjrname=back_data.erpviplist.fromuser; | |
654 | + back_data.erpviplist.fromuser_id=back_data.erpviplist.fromuser; | |
655 | + } | |
656 | + //性别 | |
657 | + if(back_data.erpviplist.sex) set_data.isGender=back_data.erpviplist.sex; | |
658 | + //名称 | |
659 | + if(back_data.erpviplist.vipname) set_data.name=back_data.erpviplist.vipname; | |
660 | + //身份证 | |
661 | + if(back_data.erpviplist.idcard) set_data.id=back_data.erpviplist.idcard; | |
662 | + //地址 | |
663 | + if(back_data.erpviplist.address) set_data.address=back_data.erpviplist.address; | |
664 | + //生日 | |
665 | + if(back_data.erpviplist.birthday) { | |
666 | + set_data.datet=back_data.erpviplist.birthday; | |
667 | + set_data.isLunar=back_data.erpviplist.islunar; | |
668 | + } | |
669 | + set_data.user=back_data.erpviplist; | |
670 | + } | |
671 | + self.setData(set_data); | |
672 | + if(!self.data.sto_sele_id){ | |
673 | + self.get_store_set(); | |
674 | + } | |
675 | + } | |
676 | + wx.hideLoading(); | |
677 | + }) | |
687 | 678 | |
688 | 679 | var is_back=t.is_back; |
689 | 680 | if(is_back) this.data.is_back=1; |
... | ... | @@ -694,9 +685,7 @@ Page({ |
694 | 685 | |
695 | 686 | getApp().check_can_share(); |
696 | 687 | |
697 | - var e = this; | |
698 | 688 | if (this.data.is_zy) return false; |
699 | - this.wait_for_store_config(); | |
700 | 689 | |
701 | 690 | //如果有传值进行跳转的话 |
702 | 691 | var choice_guide=null; |
... | ... | @@ -705,64 +694,108 @@ Page({ |
705 | 694 | getApp().globalData.choice_guide=null; |
706 | 695 | } |
707 | 696 | |
708 | - var req = t; | |
709 | - | |
710 | - a.getUserInfo(function(a) { | |
711 | - var txt = util.formatTime(a.birthday, 'yyyy-M-d'), | |
712 | - arr = txt.split(' '); | |
713 | - a.birthday = arr[0]; | |
714 | - var txt2 = util.formatTime(a.reg_time, 'yyyy-M-d'), | |
715 | - arr2 = txt.split(' '); | |
716 | - a.reg_time = arr2[0]; | |
717 | - if (a.pickup_id != null) { | |
718 | - req.get("/api/weshop/pickup/get/" + r.stoid + "/" + a.pickup_id, { | |
719 | - success: function(da) { | |
720 | - if(da.data.data){ | |
721 | - //设置门店 | |
722 | - e.setData({ | |
723 | - // stoname: da.data.data.pickup_name | |
724 | - }); | |
725 | - } | |
726 | - | |
727 | - } | |
728 | - }) | |
729 | - } | |
730 | - | |
731 | - }, !0); | |
732 | 697 | }, |
733 | 698 | |
734 | 699 | check_is_send_quan:function(cid,uid){ |
735 | 700 | var self=this; |
736 | 701 | let url2 = '/api/weshop/prom/coupon/get/'; |
737 | - //看一下会员有没有领过注册的券 | |
738 | - getApp().promiseGet("/api/weshop/couponList/page",{ | |
739 | - data:{store_id:r.stoid,uid:uid,cid:cid} | |
740 | - }).then(res=>{ | |
741 | - var is_ling=0; | |
742 | - if(res.data.code==0 && res.data.data && res.data.data.total>0){ | |
743 | - is_ling=1; | |
744 | - } | |
745 | - | |
746 | - //没有领过券,就显示 | |
747 | - if(!is_ling){ | |
748 | - //获取优惠券 | |
749 | - url2 += cid; | |
750 | - app.request.get(url2, { | |
751 | - success: function(r) { | |
752 | - if(r.data.code == 0) { | |
753 | - console.log('000res==>', r.data.data.name); | |
754 | - self.setData({ | |
755 | - couponInfo: r.data.data.name, | |
756 | - }); | |
757 | - }; | |
758 | - }, | |
759 | - }); | |
760 | - } | |
761 | - | |
762 | - }) | |
702 | + //-- 如果没有会员信息的时候 -- | |
703 | + if(!uid){ | |
704 | + //获取优惠券 | |
705 | + url2 += cid; | |
706 | + app.request.get(url2, { | |
707 | + success: function(r) { | |
708 | + if(r.data.code == 0) { | |
709 | + self.setData({ | |
710 | + couponInfo: r.data.data.name, | |
711 | + }); | |
712 | + }; | |
713 | + }, | |
714 | + }); | |
715 | + | |
716 | + }else{ | |
717 | + //看一下会员有没有领过注册的券 | |
718 | + getApp().promiseGet("/api/weshop/couponList/page",{ | |
719 | + data:{store_id:r.stoid,uid:uid,cid:cid} | |
720 | + }).then(res=>{ | |
721 | + var is_ling=0; | |
722 | + if(res.data.code==0 && res.data.data && res.data.data.total>0){ | |
723 | + is_ling=1; | |
724 | + } | |
725 | + | |
726 | + //没有领过券,就显示 | |
727 | + if(!is_ling){ | |
728 | + //获取优惠券 | |
729 | + url2 += cid; | |
730 | + app.request.get(url2, { | |
731 | + success: function(r) { | |
732 | + if(r.data.code == 0) { | |
733 | + console.log('000res==>', r.data.data.name); | |
734 | + self.setData({ | |
735 | + couponInfo: r.data.data.name, | |
736 | + }); | |
737 | + }; | |
738 | + }, | |
739 | + }); | |
740 | + } | |
741 | + | |
742 | + }) | |
743 | + } | |
744 | + | |
745 | + | |
746 | + | |
763 | 747 | |
764 | 748 | }, |
765 | 749 | |
750 | + //-- 有没有送过礼包 -- | |
751 | + check_is_send_libao:function(lbid,uid){ | |
752 | + var self=this; | |
753 | + let url2 = '/api/weshop/marketing/giftbag/get'; | |
754 | + if(!uid){ | |
755 | + //获取礼包 | |
756 | + app.request.get(url2, { | |
757 | + data:{storeId:r.stoid,giftBagId:lbid}, | |
758 | + success: function(r) { | |
759 | + if(r.data.code == 0) { | |
760 | + console.log('000res==>', r.data.data.name); | |
761 | + self.setData({ | |
762 | + libao: r.data.data.lbTitle, | |
763 | + }); | |
764 | + } | |
765 | + } | |
766 | + }); | |
767 | + | |
768 | + }else{ | |
769 | + //看一下会员有没有领过注册的券 | |
770 | + getApp().promiseGet("/api/weshop/marketing/gift/getgiveone",{ | |
771 | + data:{store_id:r.stoid,user_id:uid,lbid:lbid,act_type:7} | |
772 | + }).then(res=>{ | |
773 | + var is_ling=0; | |
774 | + if(res.data.code==0 && res.data.data && res.data.data.total>0){ | |
775 | + is_ling=1; | |
776 | + } | |
777 | + //没有领过礼包,就显示 | |
778 | + if(!is_ling){ | |
779 | + //获取礼包 | |
780 | + app.request.get(url2, { | |
781 | + data:{storeId:r.stoid,giftBagId:lbid}, | |
782 | + success: function(r) { | |
783 | + if(r.data.code == 0) { | |
784 | + self.setData({ | |
785 | + libao: r.data.data.lbTitle, | |
786 | + }); | |
787 | + } | |
788 | + } | |
789 | + }); | |
790 | + } | |
791 | + | |
792 | + }) | |
793 | + } | |
794 | + | |
795 | + }, | |
796 | + | |
797 | + | |
798 | + | |
766 | 799 | |
767 | 800 | //------卡片的显示和关闭-------- |
768 | 801 | show_tc: function() { |
... | ... | @@ -782,8 +815,6 @@ Page({ |
782 | 815 | tc_hide: true, |
783 | 816 | }); |
784 | 817 | }, |
785 | - | |
786 | - | |
787 | 818 | |
788 | 819 | //地址 |
789 | 820 | address: function(e) { |
... | ... | @@ -854,39 +885,41 @@ Page({ |
854 | 885 | datas.staffId=th.data.user.staffId; |
855 | 886 | } |
856 | 887 | |
857 | - getApp().request.put("/api/weshop/users/updateUserInfo", { | |
858 | - data: datas, | |
859 | - success: function(res) { | |
860 | - if (res.data.code == 0) { | |
861 | - getApp().my_warnning("修改成功", 1, th); | |
862 | - | |
863 | - setTimeout(function () { | |
864 | - if(th.data.is_back){ | |
865 | - wx.navigateBack({ delta: 1}) //返回上一页 | |
866 | - }else{ | |
867 | - getApp().goto("/pages/user/index/index"); | |
868 | - } | |
869 | - },1000) | |
870 | - | |
871 | - } else { | |
872 | - getApp().my_warnning("系统繁忙,请稍后再试", 0, th); | |
873 | - } | |
874 | - } | |
875 | - }) | |
888 | + var post_data={ ...getApp().globalData.zc_dd, ...datas } | |
889 | + this.zu_ce(post_data); | |
876 | 890 | }, |
891 | + | |
892 | + | |
893 | + zu_ce:function (dd) { | |
894 | + var th=this; | |
895 | + app.request.get("/api/weshop/users/thirdLogin", { | |
896 | + data: dd, | |
897 | + success: function (e) { | |
898 | + if (e.data.code == 0) { | |
899 | + app.globalData.user_id = e.data.data.user_id; | |
900 | + } else { | |
901 | + return app.showWarning("授权登入失败!"+e.data.msg); | |
902 | + } | |
903 | + getApp().globalData.login_back=1; | |
904 | + wx.setStorageSync("userinfo",e.data.data); | |
905 | + wx.setStorageSync("isAuth", !0), app.globalData.userInfo = e.data.data, app.globalData.userInfo.head_pic = s.getFullUrl(a.globalData.userInfo.head_pic); | |
906 | + wx.navigateBack({ delta: 1}) | |
907 | + | |
908 | + }, | |
909 | + failStatus: function (t) { | |
910 | + return app.my_warnning("授权登入失败,请稍后再试!", 0, that); | |
911 | + }, | |
912 | + fail: function (t) { | |
913 | + return i.clearAuth(), i.alertLoginErrorAndGoHome(), !1; | |
914 | + } | |
915 | + }); | |
916 | + }, | |
917 | + | |
877 | 918 | //选择地址 |
878 | 919 | goto_address: function() { |
879 | 920 | // this.setData({ is_zy: 1 }); |
880 | 921 | }, |
881 | - //更换手机 | |
882 | - // go_phone: function(e) { | |
883 | - // var url = e.currentTarget.dataset.url; | |
884 | - // this.setData({ | |
885 | - // is_zy: 1 | |
886 | - // }); | |
887 | - // getApp().goto(url); | |
888 | - // }, | |
889 | - | |
922 | + | |
890 | 923 | //--点击分享事件--- |
891 | 924 | onShareAppMessage: function(t) { |
892 | 925 | getApp().globalData.no_clear=1 |
... | ... | @@ -983,9 +1016,8 @@ Page({ |
983 | 1016 | this.setData({ |
984 | 1017 | datet: e.detail.value, |
985 | 1018 | }); |
986 | - }; | |
987 | - | |
988 | - // console.log(this.data.datet, this.data.isCalendar); | |
1019 | + } | |
1020 | + | |
989 | 1021 | }, |
990 | 1022 | |
991 | 1023 | // 生日判断 |
... | ... | @@ -1074,7 +1106,6 @@ Page({ |
1074 | 1106 | |
1075 | 1107 | var data = { |
1076 | 1108 | store_id: r.stoid, |
1077 | - user_id: app.globalData.user_id, | |
1078 | 1109 | }; |
1079 | 1110 | |
1080 | 1111 | //-- 需要推荐人 -- |
... | ... | @@ -1083,11 +1114,7 @@ Page({ |
1083 | 1114 | if (tjrname == "" || tjrname == null) { |
1084 | 1115 | app.my_warnning("请输入推荐人", 0, this); |
1085 | 1116 | return false; |
1086 | - }; | |
1087 | - if(tjrname==user.mobile || tjrname==user.erpvipno ){ | |
1088 | - app.my_warnning("推荐人不能是自己", 0, this); | |
1089 | - return false; | |
1090 | - } | |
1117 | + }; | |
1091 | 1118 | data.tjrname=tjrname; |
1092 | 1119 | } |
1093 | 1120 | |
... | ... | @@ -1119,7 +1146,7 @@ Page({ |
1119 | 1146 | }; |
1120 | 1147 | |
1121 | 1148 | data.birthday=birthday; |
1122 | - data.islunar=self.data.isLunar; | |
1149 | + data.islunar=self.data.isLunar?1:0; | |
1123 | 1150 | } |
1124 | 1151 | |
1125 | 1152 | //-- 需要身份证 -- |
... | ... | @@ -1155,97 +1182,19 @@ Page({ |
1155 | 1182 | app.my_warnning("请您先阅读和勾选指定的内容", 0, this); |
1156 | 1183 | return false; |
1157 | 1184 | }; |
1158 | - | |
1159 | - | |
1160 | - console.log('data==>', data); | |
1161 | - | |
1162 | - app.request.put("/api/weshop/users/updateInfo", { | |
1163 | - data: data, | |
1164 | - success: function(res) { | |
1165 | - if (res.data.code == 0) { | |
1166 | - getApp().my_warnning("保存成功", 1, self); | |
1167 | - if(th.data.is_back){ | |
1168 | - wx.navigateBack({ delta: 1}) //返回上一页 | |
1169 | - }else{ | |
1170 | - getApp().goto("/pages/user/index/index"); | |
1171 | - } | |
1172 | - } else { | |
1173 | - getApp().my_warnning(res.data.msg, 0, self); | |
1174 | - }; | |
1175 | - } | |
1176 | - }) | |
1185 | + | |
1186 | + | |
1187 | + | |
1188 | + | |
1189 | + var post_data={ ...getApp().globalData.zc_dd, ...data }; | |
1190 | + | |
1191 | + delete post_data.sessionKey; | |
1192 | + delete post_data.encryptedData; | |
1193 | + delete post_data.iv; | |
1194 | + | |
1195 | + this.zu_ce(post_data); | |
1177 | 1196 | |
1178 | - // } else { | |
1179 | - // app.my_warnning("请您先阅读和勾选指定的内容", 0, self); | |
1180 | - // }; | |
1181 | - // var isstcsp = th.data.isstcsp; //是否启用消费密码 | |
1182 | - // var phone = th.data.phone; //手机号码 | |
1183 | - // if (phone == "" || phone == null) { | |
1184 | - // getApp().my_warnning("手机不能为空", 0, th); | |
1185 | - // return false; | |
1186 | - // } | |
1187 | - // var consumption = th.data.consumption; //消费密码 | |
1188 | - // var isstcsp = th.data.isstcsp; | |
1189 | - // if (isstcsp == 1) { | |
1190 | - | |
1191 | - // if (consumption == null || consumption == "" || consumption == undefined) { | |
1192 | - // getApp().my_warnning("消费密码不能为空", 0, th); | |
1193 | - // return false; | |
1194 | - // } | |
1195 | - // if (consumption.length < 6) { | |
1196 | - // getApp().my_warnning("消费密码不能小于6位", 0, th); | |
1197 | - // return false; | |
1198 | - // } | |
1199 | - // } | |
1200 | - // var sex = th.data.isGender; //性别 | |
1201 | - | |
1202 | - // if (sex != "1" && sex != "2") { | |
1203 | - // getApp().my_warnning("请选择性别", 0, th); | |
1204 | - // return false; | |
1205 | - // } | |
1206 | - // var vipname = th.data.user.vipname; //用户姓名 | |
1207 | - // if (user_name == "" || user_name == null) { | |
1208 | - // getApp().my_warnning("请输入名字", 0, th); | |
1209 | - // return false; | |
1210 | - // } | |
1211 | - // var identity_card = th.data.identity_card; //身份证 | |
1212 | - | |
1213 | - // if (identity_card!=null && identity_card!=undefined && identity_card != "" && !(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identity_card))) { | |
1214 | - // getApp().my_warnning("身份证号码错误", 0, th); | |
1215 | - // return false; | |
1216 | - // } | |
1217 | - // var address = th.data.address; //地址 | |
1218 | - // var sto_sele_id = self.data.sto_sele_id; | |
1219 | - // var data = { | |
1220 | - // store_id: r.stoid, | |
1221 | - // user_id: app.globalData.user_id, | |
1222 | - // tjrname: self.data.referee, //推荐人 | |
1223 | - // vipname: self.data.name, //名称 | |
1224 | - // sex: self.data.isGender, //性别 | |
1225 | - // birthday: self.data.datet, | |
1226 | - // islunar: self.data.isLunar, | |
1227 | - // idcard: self.data.id, | |
1228 | - // address: self.data.address, | |
1229 | - // pickup_id: sto_sele_id ,//自提门店 所属门店 | |
1230 | - // }; | |
1231 | - | |
1232 | - // console.log('data==>', data); | |
1233 | - //往上提交美导的ID | |
1234 | - // if(th.data.fir_guide_id!=th.data.user.staffId){ | |
1235 | - // datas.staffId=th.data.user.staffId; | |
1236 | - // } | |
1237 | - | |
1238 | - // app.request.put("/api/weshop/users/updateInfo", { | |
1239 | - // data: data, | |
1240 | - // success: function(res) { | |
1241 | - // if (res.data.code == 0) { | |
1242 | - // getApp().my_warnning("保存成功", 1, self); | |
1243 | - // getApp().goto("/pages/user/index/index"); | |
1244 | - // } else { | |
1245 | - // getApp().my_warnning("系统繁忙,请稍后再试", 0, self); | |
1246 | - // }; | |
1247 | - // } | |
1248 | - // }) | |
1197 | + | |
1249 | 1198 | }, |
1250 | 1199 | |
1251 | 1200 | ... | ... |
packageA/pages/profile/profile.wxml
... | ... | @@ -7,13 +7,13 @@ |
7 | 7 | <view class="flex-center"> |
8 | 8 | |
9 | 9 | <view class="flex-center"> |
10 | - <image class="Headportrait" src="{{user.head_pic}}"></image> | |
10 | + <image class="Headportrait" src="{{head_pic}}"></image> | |
11 | 11 | </view> |
12 | 12 | |
13 | 13 | <view class="flex-center vipmax"> |
14 | 14 | <view> |
15 | 15 | <view class="fs32"> |
16 | - <view class="ellipsis-1 Nickname">{{user.nickname}} | |
16 | + <view class="ellipsis-1 Nickname">{{nickname}} | |
17 | 17 | </view> |
18 | 18 | </view> |
19 | 19 | </view> |
... | ... | @@ -28,7 +28,9 @@ |
28 | 28 | <!-- 如果需要接骚人信息 --> |
29 | 29 | <view class="user-name flex-vertical" data-type="nickname" wx:if="{{reg_info.introducer_state}}"> |
30 | 30 | <view class="user-name-txt">推荐人:</view> |
31 | - <input bindinput="getReferee" bindblur="" value="{{user['fromuser_id']?user['fromuser_id']:''}}" data-name="推荐人" class="user-txt-right f1 pdl20 t-r" placeholder="请输入推荐人手机号码或卡号"/> | |
31 | + | |
32 | + | |
33 | + <input bindinput="getReferee" bindblur="" disabled="{{user['fromuser_id']}}" value="{{user['fromuser_id']?user['fromuser_id']:''}}" data-name="推荐人" class="user-txt-right f1 pdl20 t-r" placeholder="请输入推荐人手机号码或卡号"/> | |
32 | 34 | |
33 | 35 | <block wx:if="{{!user['fromuser_id']}}"> |
34 | 36 | <view class="c-red pdl20 fs24" wx:if="{{reg_info.introducer && (reg_info.introducer_type == 0)}}">+{{reg_info.introducer}}积分</view> |
... | ... | @@ -41,7 +43,7 @@ |
41 | 43 | <view class="user-name-txt">姓名:</view> |
42 | 44 | <input bindinput="getName" bindblur="" value="{{user['vipname']?user['vipname']:''}}" data-name="姓名" class="user-txt-right f1 pdl20 t-r" placeholder="请输入您的真实姓名"/> |
43 | 45 | <block wx:if="{{!user['vipname']}}"> |
44 | - <view class="c-red pdl20 fs24" wx:if="{{reg_info.name && (reg_info.name_val_type == 0)}}">+{{reg_info.name}}积分</view> | |
46 | + <view class="c-red pdl20 fs24" wx:if="{{reg_info.name && (reg_info.name_val_type == 0)}}">+{{reg_info.name}}积分</view> | |
45 | 47 | <view class="c-red pdl20 fs24" wx:elif="{{reg_info.name && (reg_info.name_val_type == 1)}}">+{{reg_info.name}}成长值</view> |
46 | 48 | </block> |
47 | 49 | </view> |
... | ... | @@ -68,8 +70,8 @@ |
68 | 70 | <view class="fs26">女</view> |
69 | 71 | </view> |
70 | 72 | </view> |
71 | - | |
72 | - <block wx:if="{{!user['sex']}}"> | |
73 | + | |
74 | + <block wx:if="{{!user['sex']}}"> | |
73 | 75 | <view class="c-red pdl20 fs24" wx:if="{{reg_info.sex && (reg_info.sex_state_type == 0)}}">+{{reg_info.sex}}积分</view> |
74 | 76 | <view class="c-red pdl20 fs24" wx:elif="{{reg_info.sex && (reg_info.sex_state_type == 1)}}">+{{reg_info.sex}}成长值</view> |
75 | 77 | </block> |
... | ... | @@ -127,7 +129,7 @@ |
127 | 129 | <view class="angle">∟</view> |
128 | 130 | </view> |
129 | 131 | |
130 | - <block wx:if="{{!user.pickup_id}}"> | |
132 | + <block wx:if="{{!user.pickup_id && !is_fx }}"> | |
131 | 133 | <view class="c-red pdl20 fs24" wx:if="{{reg_info.pick && (reg_info.pick_type == 0)}}">+{{reg_info.pick}}积分</view> |
132 | 134 | <view class="c-red pdl20 fs24" wx:elif="{{reg_info.pick && (reg_info.pick_type == 1)}}">+{{reg_info.pick}}成长值</view> |
133 | 135 | </block> |
... | ... | @@ -174,6 +176,7 @@ |
174 | 176 | <view class="confirm"> |
175 | 177 | <view class="fs30 confirmtext" bindtap="save">保存</view> |
176 | 178 | <view class="star fs24 t-c pdt10 c9" wx:if="{{couponInfo}}">保存成功即可获得一张{{couponInfo}}</view> |
179 | + <view class="star fs24 t-c pdt10 c9" wx:if="{{libao}}">保存成功即可获得一个{{libao}}</view> | |
177 | 180 | </view> |
178 | 181 | |
179 | 182 | <!--弹出层内容,其中的“我知道”中绑定让弹出层消失的函数:bindtap="hide"--> | ... | ... |
packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
... | ... | @@ -2238,6 +2238,11 @@ Page({ |
2238 | 2238 | goods.skinface_id=getApp().globalData.skinface_id; |
2239 | 2239 | } |
2240 | 2240 | |
2241 | + if(th.data.bn_goods.whsle_id){ | |
2242 | + item.is_whsle=1; | |
2243 | + goods.is_whsle_goods=1; | |
2244 | + } | |
2245 | + | |
2241 | 2246 | //-- 把导购的信息填入-- |
2242 | 2247 | if (gg.guide_id) { |
2243 | 2248 | goods.guide_id = gg.guide_id; | ... | ... |
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
... | ... | @@ -495,7 +495,7 @@ Page({ |
495 | 495 | }); |
496 | 496 | }, |
497 | 497 | //---------计算立即购买---------- |
498 | - calculatePrice2: function () { | |
498 | + calculatePrice2: async function () { | |
499 | 499 | console.log('calculatePrice2'); |
500 | 500 | var th = this, |
501 | 501 | good = this.data.bn_goods; |
... | ... | @@ -506,12 +506,14 @@ Page({ |
506 | 506 | th.setData({ |
507 | 507 | [txt]: allpice, |
508 | 508 | }); |
509 | - console.log(th.data.formData); | |
510 | - | |
511 | 509 | |
512 | - to.getwuliuprice(async function (rs) { | |
510 | + wx.showLoading({ | |
511 | + title: "处理中.", | |
512 | + mask:true | |
513 | + }) | |
514 | + //to.getwuliuprice(async function (rs) { | |
513 | 515 | |
514 | - var o_shipping_price = 0, | |
516 | + var o_shipping_price = 0, | |
515 | 517 | goods_weight = -1, |
516 | 518 | goods_piece = -1; |
517 | 519 | var out_of_weight = null; //超出多少重量 |
... | ... | @@ -539,8 +541,7 @@ Page({ |
539 | 541 | let item = gd_arr_list[i]; |
540 | 542 | |
541 | 543 | if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { |
542 | - | |
543 | - | |
544 | + if (goods_weight < 0) goods_weight = 0; | |
544 | 545 | if (item['exp_sum_type'] == 2) { |
545 | 546 | goods_weight += item['weight'] * item['buynum']; |
546 | 547 | cut_good_weight += item['weight'] * item['buynum']; |
... | ... | @@ -581,9 +582,36 @@ Page({ |
581 | 582 | else out_of_weight = -back_data.weight_free * 1000; |
582 | 583 | |
583 | 584 | var code = th.data.wu_arr[th.data.index].code; |
584 | - var shipping_price = | |
585 | - ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
586 | - goods_piece, th.data.user_addr, back_data,rs); | |
585 | + var shipping_price =0; | |
586 | + // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
587 | + // goods_piece, th.data.user_addr, back_data,rs); | |
588 | + | |
589 | + var w_data={ | |
590 | + store_id:os.stoid, code:code, | |
591 | + o_shipping_price:o_shipping_price, | |
592 | + goods_weight:goods_weight, | |
593 | + out_of_weight:out_of_weight,goods_piece:goods_piece, | |
594 | + user_addr_province:th.data.user_addr.province, | |
595 | + user_addr_city:th.data.user_addr.city, | |
596 | + user_addr_district:th.data.user_addr.district, | |
597 | + is_by_all:back_data && back_data.is_by_all?1:0, | |
598 | + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0, | |
599 | + } | |
600 | + | |
601 | + var is_ok=0; | |
602 | + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{ | |
603 | + if(res.data.code==0){ | |
604 | + shipping_price=res.data.data; is_ok=1; | |
605 | + } | |
606 | + }) | |
607 | + if(!is_ok){ | |
608 | + wx.showToast({ | |
609 | + title: "计算物流错误", icon: 'none',duration: 2000 | |
610 | + }) | |
611 | + th.setData({ show_submit:0 }); | |
612 | + wx.hideLoading(); | |
613 | + } | |
614 | + | |
587 | 615 | |
588 | 616 | shipping_price = parseFloat(shipping_price).toFixed(2); |
589 | 617 | var wl_txt = "formData.shipping_price"; |
... | ... | @@ -616,24 +644,27 @@ Page({ |
616 | 644 | if (parseFloat(th.data.yuer) > total_m) { |
617 | 645 | th.setData({ |
618 | 646 | [txt]: total_m, |
619 | - [txt2]: 0 | |
647 | + [txt2]: 0, | |
648 | + is_show_sub:1 | |
620 | 649 | }) |
621 | 650 | } else { |
622 | 651 | order_m = parseFloat(order_m) - parseFloat(th.data.yuer); |
623 | 652 | order_m = order_m.toFixed(2); |
624 | 653 | th.setData({ |
625 | 654 | [txt]: th.data.yuer, |
626 | - [txt2]: order_m | |
655 | + [txt2]: order_m, | |
656 | + is_show_sub:1 | |
627 | 657 | }) |
628 | 658 | } |
629 | 659 | } else { |
630 | 660 | th.setData({ |
631 | 661 | [txt]: 0, |
632 | - [txt2]: order_m | |
662 | + [txt2]: order_m, | |
663 | + is_show_sub:1 | |
633 | 664 | }) |
634 | 665 | } |
635 | - | |
636 | - }); | |
666 | + wx.hideLoading(); | |
667 | + //}); | |
637 | 668 | |
638 | 669 | }, |
639 | 670 | |
... | ... | @@ -783,6 +814,12 @@ Page({ |
783 | 814 | if(getApp().globalData.skinface_id){ |
784 | 815 | goods.skinface_id=getApp().globalData.skinface_id; |
785 | 816 | } |
817 | + | |
818 | + if(th.data.bn_goods.whsle_id){ | |
819 | + item.is_whsle=1; | |
820 | + goods.is_whsle_goods=1; | |
821 | + } | |
822 | + | |
786 | 823 | //--导购分享过来的id-- |
787 | 824 | if (gg.guide_id) { |
788 | 825 | goods.guide_id = gg.guide_id; | ... | ... |
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml
... | ... | @@ -154,7 +154,7 @@ |
154 | 154 | </view> |
155 | 155 | </view> |
156 | 156 | |
157 | - <view class="btn-wrap"> | |
157 | + <view class="btn-wrap" wx:if="{{is_show_sub}}"> | |
158 | 158 | <view class="pay-amount"> |
159 | 159 | <view class="payable">应付金额:<text class="co-red">¥{{formData.order_amount}}</text></view> |
160 | 160 | <!-- <view class="co-red big"></view> --> | ... | ... |
packageC/pages/payForAnother/payForAnother.js
... | ... | @@ -2119,6 +2119,11 @@ Page({ |
2119 | 2119 | 'prom_id': th.data.bn_goods.prom_id, //促销活动id |
2120 | 2120 | }; |
2121 | 2121 | |
2122 | + if(th.data.bn_goods.whsle_id){ | |
2123 | + item.is_whsle=1; | |
2124 | + goods.is_whsle_goods=1; | |
2125 | + } | |
2126 | + | |
2122 | 2127 | //-- 把导购的信息填入-- |
2123 | 2128 | if (gg.guide_id) { |
2124 | 2129 | goods.guide_id = gg.guide_id; | ... | ... |
packageC/pages/presell/cart/cart.js
... | ... | @@ -1716,9 +1716,9 @@ Page({ |
1716 | 1716 | |
1717 | 1717 | |
1718 | 1718 | //----计算物流的钱---- |
1719 | - calculate_wuliu() { | |
1719 | + async calculate_wuliu() { | |
1720 | 1720 | var to = getApp(), th = this; |
1721 | - to.getwuliuprice(async function (rs) { | |
1721 | + //to.getwuliuprice(async function (rs) { | |
1722 | 1722 | var o_shipping_price = 0, |
1723 | 1723 | goods_weight = -1, |
1724 | 1724 | goods_piece = -1, |
... | ... | @@ -1823,6 +1823,7 @@ Page({ |
1823 | 1823 | let item = gd_arr_list[i]; |
1824 | 1824 | |
1825 | 1825 | if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { |
1826 | + if (goods_weight < 0) goods_weight = 0; | |
1826 | 1827 | if (item['exp_sum_type'] == 2) { |
1827 | 1828 | goods_weight += item['weight'] * item['buynum']; |
1828 | 1829 | cut_good_weight += item['weight'] * item['buynum']; |
... | ... | @@ -1867,8 +1868,36 @@ Page({ |
1867 | 1868 | th.data.is_no_by[th.data.bn_pick] = 0; |
1868 | 1869 | |
1869 | 1870 | //--------------开始计算物流------------------ |
1870 | - var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
1871 | - goods_piece, th.data.user_addr, back_data, rs); | |
1871 | + var shipping_price =0; | |
1872 | + | |
1873 | + //ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
1874 | + //goods_piece, th.data.user_addr, back_data, rs); | |
1875 | + var w_data={ | |
1876 | + store_id:os.stoid, code:code, | |
1877 | + o_shipping_price:o_shipping_price, | |
1878 | + goods_weight:goods_weight, | |
1879 | + out_of_weight:out_of_weight,goods_piece:goods_piece, | |
1880 | + user_addr_province:th.data.user_addr.province, | |
1881 | + user_addr_city:th.data.user_addr.city, | |
1882 | + user_addr_district:th.data.user_addr.district, | |
1883 | + is_by_all:back_data && back_data.is_by_all?1:0, | |
1884 | + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0, | |
1885 | + } | |
1886 | + | |
1887 | + var is_ok=0; | |
1888 | + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{ | |
1889 | + if(res.data.code==0){ | |
1890 | + shipping_price=res.data.data; is_ok=1; | |
1891 | + } | |
1892 | + }) | |
1893 | + if(!is_ok){ | |
1894 | + wx.showToast({ | |
1895 | + title: "计算物流错误", icon: 'none',duration: 2000 | |
1896 | + }) | |
1897 | + th.setData({ show_submit:0 }); | |
1898 | + wx.hideLoading(); | |
1899 | + return false; | |
1900 | + } | |
1872 | 1901 | |
1873 | 1902 | exp_price = parseFloat(shipping_price).toFixed(2); |
1874 | 1903 | } |
... | ... | @@ -1876,7 +1905,7 @@ Page({ |
1876 | 1905 | } else { |
1877 | 1906 | th.wuliu_next(allpice, quan_price, exp_price); |
1878 | 1907 | } |
1879 | - }); | |
1908 | + //}); | |
1880 | 1909 | }, |
1881 | 1910 | //相同的东西统一在一起 |
1882 | 1911 | wuliu_next(allpice, quan_price, exp_price) { | ... | ... |
packageC/pages/presell/cart/cart.wxml
... | ... | @@ -346,6 +346,9 @@ |
346 | 346 | </view> |
347 | 347 | </view> |
348 | 348 | |
349 | + | |
350 | + | |
351 | + | |
349 | 352 | <!-- 要支付尾款的时候 --> |
350 | 353 | <view class="fixedToBottom shadow-1" wx:if="{{wait_wk}}"> |
351 | 354 | <view wx:if="{{no_start}}" class="date-container">尾款时间{{filters.format_time(act.pay_begindate,1)}} - |
... | ... | @@ -363,7 +366,7 @@ |
363 | 366 | </view> |
364 | 367 | </view> |
365 | 368 | <button wx:if="{{no_start || is_end || is_complete}}" class="tips-btn gray">支付尾款</button> |
366 | - <button wx:else class="tips-btn" bindtap="show_pay">支付尾款</button> | |
369 | + <button wx:else class="tips-btn" bindtap="show_pay" hidden="{{!show_submit}}">支付尾款</button> | |
367 | 370 | <!-- 预售 --> |
368 | 371 | <!-- <button class="tips-btn" formType="submit" id="submitOrder">立即支付</button> --> |
369 | 372 | </view> |
... | ... | @@ -371,14 +374,13 @@ |
371 | 374 | <!-- 当订单不是支付尾款的时候 --> |
372 | 375 | <view class="fixedToBottom shadow-1" wx:else style="background-color: #fff;display: flex; justify-content: flex-end; padding: 10rpx 0"> |
373 | 376 | <view bindtap="cancelOrder" data-id="{{order.order_id}}" class="tips-btn2" wx:if="{{wait_dj}}">取消订单</view> |
374 | - <view bindtap="jumpToCart4" class="tips-btn2" wx:if="{{wait_dj}}">立即付款</view> | |
377 | + | |
378 | + <view hidden="{{!show_submit}}" bindtap="jumpToCart4" class="tips-btn2" wx:if="{{wait_dj}}">立即付款</view> | |
375 | 379 | <block wx:if="{{!(order.has_rt || order.return_btn==2 || order.return_btn==4) && wait_sh && !wait_fh }}"> |
376 | 380 | <navigator bindtap="confirmOrder" class="tips-btn2" hidden="{{!wait_sh}}">收货确认</navigator> |
377 | 381 | </block> |
378 | 382 | |
379 | 383 | <view class="tips-btn2" wx:if="{{order.order_status==3}}" bindtap="deleteOrderData" data-order_id="{{order.order_id}}" >删除订单</view> |
380 | - | |
381 | - | |
382 | 384 | <navigator class="tips-btn2" hidden="{{!order.shipping_btn}}" url="/pages/user/express/express?order_id={{order.order_id}}">查看物流</navigator> |
383 | 385 | |
384 | 386 | |
... | ... | @@ -401,6 +403,8 @@ |
401 | 403 | </view> |
402 | 404 | |
403 | 405 | |
406 | + | |
407 | + | |
404 | 408 | </form> |
405 | 409 | |
406 | 410 | <!-- 使用券列表的弹窗 --> | ... | ... |
packageC/pages/presell/cart/cart2.js
... | ... | @@ -571,7 +571,7 @@ Page({ |
571 | 571 | |
572 | 572 | |
573 | 573 | //---------计算立即购买---------- |
574 | - calculatePrice2: function () { | |
574 | + calculatePrice2: async function () { | |
575 | 575 | var th = this, good = this.data.bn_goods; |
576 | 576 | if (!good) return false; |
577 | 577 | |
... | ... | @@ -582,7 +582,7 @@ Page({ |
582 | 582 | } |
583 | 583 | |
584 | 584 | wx.showLoading({ |
585 | - title: "处理中." | |
585 | + title: "处理中.",mask:true | |
586 | 586 | }) |
587 | 587 | //-----------计算商品总价-------------- |
588 | 588 | var allpice = good.shop_price * good.buynum; |
... | ... | @@ -609,8 +609,8 @@ Page({ |
609 | 609 | } |
610 | 610 | |
611 | 611 | |
612 | - to.getConfig2(function (ee) { | |
613 | - to.getwuliuprice(async function (rs) { | |
612 | + // to.getConfig2(function (ee) { | |
613 | + // to.getwuliuprice(async function (rs) { | |
614 | 614 | |
615 | 615 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; |
616 | 616 | var out_of_weight = null; //超出多少重量 |
... | ... | @@ -699,9 +699,11 @@ Page({ |
699 | 699 | let item = gd_arr_list[i]; |
700 | 700 | |
701 | 701 | 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; | |
702 | 703 | if (item['exp_sum_type'] == 2) { |
703 | 704 | cut_good_weight += item['weight'] * item['buynum']; |
704 | 705 | goods_weight += item['weight'] * item['buynum']; |
706 | + | |
705 | 707 | } |
706 | 708 | if (back_data.weight_free > 0) { |
707 | 709 | out_of_weight = (back_data.weight_free * 1000) - cut_good_weight; |
... | ... | @@ -743,9 +745,35 @@ Page({ |
743 | 745 | if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; |
744 | 746 | |
745 | 747 | //--------------开始计算物流------------------ |
746 | - var shipping_price = | |
747 | - ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
748 | - goods_piece, th.data.user_addr, back_data, rs); | |
748 | + var shipping_price =0; | |
749 | + // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
750 | + // goods_piece, th.data.user_addr, back_data, rs); | |
751 | + var w_data={ | |
752 | + store_id:os.stoid, code:code, | |
753 | + o_shipping_price:o_shipping_price, | |
754 | + goods_weight:goods_weight, | |
755 | + out_of_weight:out_of_weight,goods_piece:goods_piece, | |
756 | + user_addr_province:th.data.user_addr.province, | |
757 | + user_addr_city:th.data.user_addr.city, | |
758 | + user_addr_district:th.data.user_addr.district, | |
759 | + is_by_all:back_data && back_data.is_by_all?1:0, | |
760 | + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0, | |
761 | + } | |
762 | + | |
763 | + var is_ok=0; | |
764 | + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{ | |
765 | + if(res.data.code==0){ | |
766 | + shipping_price=res.data.data; is_ok=1; | |
767 | + } | |
768 | + }) | |
769 | + if(!is_ok){ | |
770 | + wx.showToast({ | |
771 | + title: "计算物流错误", icon: 'none',duration: 2000 | |
772 | + }) | |
773 | + th.setData({ show_submit:0 }); | |
774 | + wx.hideLoading(); | |
775 | + return false; | |
776 | + } | |
749 | 777 | |
750 | 778 | |
751 | 779 | if (shipping_price <= 0) { |
... | ... | @@ -914,8 +942,8 @@ Page({ |
914 | 942 | |
915 | 943 | wx.hideLoading(); |
916 | 944 | |
917 | - }); | |
918 | - }); | |
945 | + // }); | |
946 | + // }); | |
919 | 947 | }, |
920 | 948 | |
921 | 949 | //--------------------提交订单----------------------- |
... | ... | @@ -1054,6 +1082,11 @@ Page({ |
1054 | 1082 | goods.skinface_id=getApp().globalData.skinface_id; |
1055 | 1083 | } |
1056 | 1084 | |
1085 | + if(th.data.bn_goods.whsle_id){ | |
1086 | + item.is_whsle=1; | |
1087 | + goods.is_whsle_goods=1; | |
1088 | + } | |
1089 | + | |
1057 | 1090 | //-- 把导购的信息填入-- |
1058 | 1091 | if (gg.guide_id) { |
1059 | 1092 | goods.guide_id = gg.guide_id; | ... | ... |
packageC/pages/presell/cart/cart2_pre.js
... | ... | @@ -542,6 +542,11 @@ Page({ |
542 | 542 | goods.skinface_id=getApp().globalData.skinface_id; |
543 | 543 | } |
544 | 544 | |
545 | + if(th.data.bn_goods.whsle_id){ | |
546 | + item.is_whsle=1; | |
547 | + goods.is_whsle_goods=1; | |
548 | + } | |
549 | + | |
545 | 550 | //--导购分享过来的id-- |
546 | 551 | if (gg.guide_id) { |
547 | 552 | goods.guide_id = gg.guide_id; | ... | ... |
pages/cart/cart/cart.js
... | ... | @@ -612,8 +612,8 @@ Page({ |
612 | 612 | } |
613 | 613 | |
614 | 614 | } |
615 | - | |
616 | - else if(item.prom_type == 0) { | |
615 | + //判断不是代发的商品 | |
616 | + else if(item.prom_type == 0 && !item.whsle_id) { | |
617 | 617 | |
618 | 618 | //如果有优惠活动,要更新活动 |
619 | 619 | await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1"+"/"+getApp().globalData.user_id, {}).then(res => { |
... | ... | @@ -1731,7 +1731,7 @@ Page({ |
1731 | 1731 | |
1732 | 1732 | function normal_check(store_count, goodsinfo, wareIds) { |
1733 | 1733 | //--- 看一下是不是线下库存 --- |
1734 | - if (th.data.sales_rules == 2 && goodsinfo.prom_type != 7) { | |
1734 | + if (th.data.sales_rules == 2 && goodsinfo.prom_type != 7 && !goodsinfo.whsle_id) { | |
1735 | 1735 | th.check_down_line(t, pitem, item, wareIds); |
1736 | 1736 | } else { |
1737 | 1737 | if (t.goods_num > store_count) { |
... | ... | @@ -2491,7 +2491,7 @@ Page({ |
2491 | 2491 | ab = 1; |
2492 | 2492 | //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存--- |
2493 | 2493 | if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5 || |
2494 | - i_arr[j].need_downlow_num) && th.data.sales_rules == 2 && i_arr[j].is_gift != 1) { | |
2494 | + i_arr[j].need_downlow_num) && th.data.sales_rules == 2 && i_arr[j].is_gift != 1 && !i_arr[j].whsle_id) { | |
2495 | 2495 | //--获取商品的线下商品ID-- |
2496 | 2496 | var gd = null; |
2497 | 2497 | await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id, {}).then(res => { | ... | ... |
pages/cart/cart2/cart2.js
... | ... | @@ -451,8 +451,8 @@ Page({ |
451 | 451 | //如果有购买活动 |
452 | 452 | item1.promgoodsbuynum = promgoodsbuynum; |
453 | 453 | |
454 | - //要把优惠活动加入,prom_goods_map中,赠品不要运算 | |
455 | - if (item1.prom_type == 3 && item1.is_gift != 1) { | |
454 | + //要把优惠活动加入,prom_goods_map中,赠品不要运算,代发商品不算优惠 | |
455 | + if (item1.prom_type == 3 && item1.is_gift != 1 && !item1.whsle_id) { | |
456 | 456 | // th.check_is_youhui(item1.goods_id, item1.pick_id); |
457 | 457 | await th.add_prom_goods_map(item1); |
458 | 458 | } |
... | ... | @@ -882,6 +882,11 @@ Page({ |
882 | 882 | gd.prom_type = gg.prom_type ? gg.prom_type : 0; |
883 | 883 | gd.prom_id = gg.prom_id ? gg.prom_id : 0; |
884 | 884 | |
885 | + if(gd.whsle_id>0){ | |
886 | + gd.prom_type =gg.prom_type=0; | |
887 | + gd.prom_id =gg.prom_id=0; | |
888 | + } | |
889 | + | |
885 | 890 | switch (gd.prom_type) { |
886 | 891 | case 0: |
887 | 892 | case 3: |
... | ... | @@ -1187,6 +1192,8 @@ Page({ |
1187 | 1192 | var o_price = 0, q_conditin = 0; |
1188 | 1193 | //--------循环计算总价----------- |
1189 | 1194 | for (var j = 0; j < ord_goods.length; j++) { |
1195 | + | |
1196 | + if(ord_goods[j].whsle_id) continue; | |
1190 | 1197 | o_price += ord_goods[j].goods_price * ord_goods[j].goods_num; |
1191 | 1198 | } |
1192 | 1199 | |
... | ... | @@ -1232,6 +1239,7 @@ Page({ |
1232 | 1239 | item_map.gift_weight = get_data.goodsinfo.weight; |
1233 | 1240 | item_map.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type; |
1234 | 1241 | item_map.uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; |
1242 | + item_map.whsle_id = get_data.goodsinfo.whsle_id; | |
1235 | 1243 | |
1236 | 1244 | } |
1237 | 1245 | item_map.s_libao = get_data.libao; |
... | ... | @@ -1455,10 +1463,15 @@ Page({ |
1455 | 1463 | }, |
1456 | 1464 | |
1457 | 1465 | //-------------------计算订单价格------------------- |
1458 | - calculatePrice: function (t, s) { | |
1466 | + calculatePrice:async function (t, s) { | |
1459 | 1467 | var th = this; |
1460 | - to.getwuliuprice(async function (rs) { | |
1461 | - wx.showLoading({ title: "处理中." }) | |
1468 | + | |
1469 | + wx.showLoading({ | |
1470 | + title: "处理中.", | |
1471 | + mask:true | |
1472 | + }) | |
1473 | + //-- to.getwuliuprice(async function (rs) { -- | |
1474 | + | |
1462 | 1475 | //是不是区域包邮 |
1463 | 1476 | th.data.is_area_by = 0; |
1464 | 1477 | //当不是区域不包邮的时候,没有不包邮商品的时候 |
... | ... | @@ -1491,12 +1504,16 @@ Page({ |
1491 | 1504 | |
1492 | 1505 | //调用函数计算每件商品的单价 |
1493 | 1506 | await th.calc_per(c_arr); |
1507 | + | |
1494 | 1508 | //调用函数计算每件组合购商品的单价, |
1495 | 1509 | await zh_calc.calc_zh_split_price(c_arr, th); |
1510 | + | |
1496 | 1511 | //调用函数计算每件阶梯促销商品的单价, |
1497 | 1512 | await ladder_calc.calc_split_price(c_arr, th); |
1498 | 1513 | //调用函数计算,优惠券优惠什么商品价格,优惠券优惠什么商品 |
1514 | + | |
1499 | 1515 | await th.get_cart_quan(c_arr); |
1516 | + | |
1500 | 1517 | //---循环购物车--- |
1501 | 1518 | for (var i in c_arr) { |
1502 | 1519 | //因为搭配购买也是再这里计算,搭配购的is_b_now==1 |
... | ... | @@ -1555,9 +1572,15 @@ Page({ |
1555 | 1572 | }) |
1556 | 1573 | } |
1557 | 1574 | |
1575 | + | |
1576 | + var whsle_goods_price=0; | |
1558 | 1577 | //--------循环计算总价----------- |
1559 | 1578 | for (var j = 0; j < item.length; j++) { |
1560 | 1579 | |
1580 | + if(item.whsle_id>0){ | |
1581 | + whsle_goods_price+=item.goods_price*item.goods_num; | |
1582 | + } | |
1583 | + | |
1561 | 1584 | var is_no_zh = 0; |
1562 | 1585 | if (item[j].prom_type != 7 && item[j].prom_type != 10) is_no_zh = 1; |
1563 | 1586 | |
... | ... | @@ -1729,6 +1752,8 @@ Page({ |
1729 | 1752 | //--------循环计算总价----------- |
1730 | 1753 | for (var j = 0; j < item.length; j++) { |
1731 | 1754 | |
1755 | + //如果是一件代发商品,不计算运费 | |
1756 | + if(item[j].whsle_id) continue; | |
1732 | 1757 | //如果商品本身是包邮了 |
1733 | 1758 | if(item[j].is_free_shipping == 1) continue; |
1734 | 1759 | //如果是优惠活动是包邮,就不用计算包邮的费用了 |
... | ... | @@ -1738,8 +1763,8 @@ Page({ |
1738 | 1763 | continue; |
1739 | 1764 | } |
1740 | 1765 | |
1741 | - if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item[j].goods_id) == -1)) { | |
1742 | - | |
1766 | + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item[j].goods_id) == -1)) { | |
1767 | + if (goods_weight < 0) goods_weight = 0; | |
1743 | 1768 | if (item[j]['exp_sum_type'] == 2) { |
1744 | 1769 | cut_good_weight += item[j]['weight'] * item[j]['goods_num']; |
1745 | 1770 | goods_weight += item[j]['weight'] * item[j]['goods_num']; |
... | ... | @@ -1784,8 +1809,38 @@ Page({ |
1784 | 1809 | var code = ""; |
1785 | 1810 | if (th.data.wu_arr && th.data.wu_arr[cart_item.wind]) |
1786 | 1811 | code = th.data.wu_arr[cart_item.wind].code; |
1787 | - cart_item.shipping_price = | |
1788 | - ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,goods_piece, th.data.user_addr, back_data, rs); | |
1812 | + | |
1813 | + // cart_item.shipping_price = | |
1814 | + // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,goods_piece, th.data.user_addr, back_data, rs); | |
1815 | + | |
1816 | + var w_data={ | |
1817 | + store_id:os.stoid, code:code, | |
1818 | + o_shipping_price:o_shipping_price, | |
1819 | + goods_weight:goods_weight, | |
1820 | + out_of_weight:out_of_weight,goods_piece:goods_piece, | |
1821 | + user_addr_province:th.data.user_addr.province, | |
1822 | + user_addr_city:th.data.user_addr.city, | |
1823 | + user_addr_district:th.data.user_addr.district, | |
1824 | + is_by_all:back_data && back_data.is_by_all?1:0, | |
1825 | + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0, | |
1826 | + } | |
1827 | + | |
1828 | + var is_ok=1; | |
1829 | + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{ | |
1830 | + if(res.data.code==0){ | |
1831 | + cart_item.shipping_price=res.data.data; | |
1832 | + }else{ | |
1833 | + is_ok=0; | |
1834 | + } | |
1835 | + }) | |
1836 | + | |
1837 | + if(!is_ok){ | |
1838 | + wx.showToast({ | |
1839 | + title: "计算物流错误", icon: 'none',duration: 2000 | |
1840 | + }) | |
1841 | + th.setData({ show_submit:0 }); | |
1842 | + wx.hideLoading(); | |
1843 | + } | |
1789 | 1844 | |
1790 | 1845 | if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) { |
1791 | 1846 | if (cart_item.shipping_price == 0) th.data.is_by[pickid] = 1; //已经全场包邮,就不要选择券了 |
... | ... | @@ -1812,6 +1867,10 @@ Page({ |
1812 | 1867 | o_condition = o_price_no_zh - quan_price; |
1813 | 1868 | } |
1814 | 1869 | |
1870 | + if(whsle_goods_price>0){ | |
1871 | + o_condition=o_condition-whsle_goods_price; | |
1872 | + } | |
1873 | + | |
1815 | 1874 | var order_m = 0; |
1816 | 1875 | //---判断是不是有订单优惠--- |
1817 | 1876 | await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { |
... | ... | @@ -1935,7 +1994,7 @@ Page({ |
1935 | 1994 | th.set_can_num(); |
1936 | 1995 | wx.hideLoading(); |
1937 | 1996 | |
1938 | - }); | |
1997 | + //}); | |
1939 | 1998 | }, |
1940 | 1999 | |
1941 | 2000 | set_can_num: function () { |
... | ... | @@ -1969,7 +2028,7 @@ Page({ |
1969 | 2028 | |
1970 | 2029 | |
1971 | 2030 | //---------计算立即购买---------- |
1972 | - calculatePrice2: function () { | |
2031 | + calculatePrice2: async function () { | |
1973 | 2032 | var th = this, good = this.data.bn_goods; |
1974 | 2033 | |
1975 | 2034 | if (!good) return false; |
... | ... | @@ -1981,7 +2040,8 @@ Page({ |
1981 | 2040 | } |
1982 | 2041 | |
1983 | 2042 | wx.showLoading({ |
1984 | - title: "处理中." | |
2043 | + title: "处理中.", | |
2044 | + mask:true | |
1985 | 2045 | }) |
1986 | 2046 | //-----------计算商品总价-------------- |
1987 | 2047 | var allpice = good.shop_price * good.buynum; |
... | ... | @@ -2007,7 +2067,7 @@ Page({ |
2007 | 2067 | allpice = good.offline_price * good.buynum; |
2008 | 2068 | } |
2009 | 2069 | |
2010 | - to.getwuliuprice(async function (rs) { | |
2070 | + //to.getwuliuprice(async function (rs) { | |
2011 | 2071 | |
2012 | 2072 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; |
2013 | 2073 | var out_of_weight = null; //超出多少重量 |
... | ... | @@ -2019,7 +2079,8 @@ Page({ |
2019 | 2079 | quan_no = th.data.using_quan[bn_pick].coupon_no; |
2020 | 2080 | |
2021 | 2081 | if (quan_no) { |
2022 | - if (th.data.using_quan[bn_pick].isby != 1) { | |
2082 | + //如果是一件代发就不要找商品 | |
2083 | + if (th.data.using_quan[bn_pick].isby != 1 && !good.whsle_id) { | |
2023 | 2084 | //---获取优惠券优惠--- |
2024 | 2085 | await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", { |
2025 | 2086 | data: { |
... | ... | @@ -2043,7 +2104,7 @@ Page({ |
2043 | 2104 | } |
2044 | 2105 | |
2045 | 2106 | //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- |
2046 | - if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past != 1) { | |
2107 | + if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_past != 1) { | |
2047 | 2108 | //看是不是有调用过包邮券 |
2048 | 2109 | if (!th.data.isget_by_quan[th.data.bn_pick] && good.is_xz_yh != 1) { |
2049 | 2110 | var condition = allpice - cut_price - quan_price; |
... | ... | @@ -2129,8 +2190,14 @@ Page({ |
2129 | 2190 | var cut_good_weight = 0; |
2130 | 2191 | for (let i in gd_arr_list) { |
2131 | 2192 | let item = gd_arr_list[i]; |
2132 | - | |
2193 | + | |
2194 | + if(good.is_free_shipping==1) continue; | |
2195 | + //-- 代发商品不算运费 -- | |
2196 | + if(good.whsle_id) continue; | |
2197 | + | |
2133 | 2198 | if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { |
2199 | + | |
2200 | + if (goods_weight < 0) goods_weight = 0; | |
2134 | 2201 | if (item['exp_sum_type'] == 2) { |
2135 | 2202 | goods_weight += item['weight'] * item['buynum']; |
2136 | 2203 | cut_good_weight += item['weight'] * item['buynum']; |
... | ... | @@ -2177,8 +2244,37 @@ Page({ |
2177 | 2244 | th.data.is_by[th.data.bn_pick] = 0; |
2178 | 2245 | |
2179 | 2246 | //--------------开始计算物流------------------ |
2180 | - shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
2181 | - goods_piece, th.data.user_addr, back_data, rs); | |
2247 | + // shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
2248 | + // goods_piece, th.data.user_addr, back_data, rs); | |
2249 | + | |
2250 | + var w_data={ | |
2251 | + store_id:os.stoid, code:code, | |
2252 | + o_shipping_price:o_shipping_price, | |
2253 | + goods_weight:goods_weight, | |
2254 | + out_of_weight:out_of_weight,goods_piece:goods_piece, | |
2255 | + user_addr_province:th.data.user_addr.province, | |
2256 | + user_addr_city:th.data.user_addr.city, | |
2257 | + user_addr_district:th.data.user_addr.district, | |
2258 | + is_by_all:back_data && back_data.is_by_all?1:0, | |
2259 | + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0, | |
2260 | + } | |
2261 | + | |
2262 | + var is_ok=1; | |
2263 | + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{ | |
2264 | + if(res.data.code==0){ | |
2265 | + shipping_price=res.data.data; | |
2266 | + }else{ | |
2267 | + is_ok=0; | |
2268 | + } | |
2269 | + }) | |
2270 | + | |
2271 | + if(!is_ok){ | |
2272 | + wx.showToast({ | |
2273 | + title: "计算物流错误", icon: 'none',duration: 2000 | |
2274 | + }) | |
2275 | + th.setData({ show_submit:0 }); | |
2276 | + wx.hideLoading(); | |
2277 | + } | |
2182 | 2278 | |
2183 | 2279 | if (shipping_price <= 0) { |
2184 | 2280 | th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券 |
... | ... | @@ -2211,6 +2307,10 @@ Page({ |
2211 | 2307 | } |
2212 | 2308 | //--看一下有没有订单优惠-- |
2213 | 2309 | var o_condition = parseFloat(order_m); |
2310 | + if(th.data.bn_goods.whsle_id>0){ | |
2311 | + o_condition=0; | |
2312 | + } | |
2313 | + | |
2214 | 2314 | if (o_condition > 0) { |
2215 | 2315 | th.check_is_order_prom(o_condition, function () { |
2216 | 2316 | var order_prom_amount = 0; |
... | ... | @@ -2372,7 +2472,7 @@ Page({ |
2372 | 2472 | |
2373 | 2473 | wx.hideLoading(); |
2374 | 2474 | |
2375 | - }); | |
2475 | + //}); | |
2376 | 2476 | |
2377 | 2477 | }, |
2378 | 2478 | |
... | ... | @@ -2522,6 +2622,7 @@ Page({ |
2522 | 2622 | }) |
2523 | 2623 | } |
2524 | 2624 | |
2625 | + | |
2525 | 2626 | var goods = { |
2526 | 2627 | 'goods_id': gg.goods_id, |
2527 | 2628 | 'goods_name': gg.goods_name, |
... | ... | @@ -2535,6 +2636,11 @@ Page({ |
2535 | 2636 | 'prom_id': th.data.bn_goods.prom_id, //促销活动id |
2536 | 2637 | }; |
2537 | 2638 | |
2639 | + if(th.data.bn_goods.whsle_id){ | |
2640 | + item.is_whsle=1; | |
2641 | + goods.is_whsle_goods=1; | |
2642 | + } | |
2643 | + | |
2538 | 2644 | if (getApp().globalData.skinface_id) { |
2539 | 2645 | goods.skinface_id = getApp().globalData.skinface_id; |
2540 | 2646 | } |
... | ... | @@ -2564,7 +2670,7 @@ Page({ |
2564 | 2670 | if (gg.is_pd_normal) goods.is_pd_normal = 1; |
2565 | 2671 | |
2566 | 2672 | //如果不立即购买或者秒杀,如果是线下库存购买的时候 |
2567 | - if (goods.prom_type != 1 && goods.prom_type != 6 && th.data.sales_rules == 2) { | |
2673 | + if (goods.prom_type != 1 && goods.prom_type != 6 && goods.prom_type != 2 && th.data.sales_rules == 2 && !th.data.bn_goods.whsle_id) { | |
2568 | 2674 | var isok = 1; |
2569 | 2675 | await th.check_store_num(goods.goods_id, th.data.bn_pick, gg.goods_num, function (res) { |
2570 | 2676 | isok = res; |
... | ... | @@ -2681,7 +2787,7 @@ Page({ |
2681 | 2787 | } |
2682 | 2788 | |
2683 | 2789 | var order_prom_list_cart = th.data.order_prom_list_cart;; |
2684 | - console.log('xxxxxxxxxxxxxxxx', order_prom_list_cart) | |
2790 | + | |
2685 | 2791 | //--组装推送数据-- |
2686 | 2792 | for (var i = 0; i < order_prom_list_cart.length; i++) { |
2687 | 2793 | var t_item = order_prom_list_cart[i]; |
... | ... | @@ -2806,120 +2912,180 @@ Page({ |
2806 | 2912 | await th.split_set_goods_quanprice(you_item, t_item); |
2807 | 2913 | } |
2808 | 2914 | } |
2809 | - //-------------让商品添加到商品列表-------------------- | |
2810 | - for (var k = 0; k < t_item.goods.length; k++) { | |
2811 | - var g_item = t_item.goods[k]; | |
2812 | - if (g_item.goods_num <= 0) continue; | |
2813 | - var goods = { | |
2814 | - 'goods_id': g_item.goods_id, | |
2815 | - 'goods_name': g_item.goods_name, | |
2816 | - 'goods_sn': g_item.goods_sn, | |
2817 | - 'goods_num': g_item.goods_num, | |
2818 | - 'market_price': g_item.market_price, | |
2819 | - 'goods_price': g_item.goods_price, | |
2820 | - 'member_goods_price': g_item.goods_price, | |
2821 | - 'store_id': oo.stoid, | |
2822 | - }; | |
2823 | 2915 | |
2824 | - if (getApp().globalData.skinface_id) { | |
2825 | - goods.skinface_id = getApp().globalData.skinface_id; | |
2826 | - } | |
2916 | + //代发商品的集合 | |
2917 | + var df_goods = []; | |
2918 | + var df_price = 0; | |
2919 | + var df_room_ids = ""; | |
2920 | + | |
2921 | + //多个商品才运算 | |
2922 | + if( t_item.goods.length>1) { | |
2923 | + //-------------让商品添加到商品列表-------------------- | |
2924 | + for (var k = 0; k < t_item.goods.length; k++) { | |
2925 | + var g_item = t_item.goods[k]; | |
2926 | + if (g_item.goods_num <= 0) continue; | |
2927 | + var goods = { | |
2928 | + 'goods_id': g_item.goods_id, | |
2929 | + 'goods_name': g_item.goods_name, | |
2930 | + 'goods_sn': g_item.goods_sn, | |
2931 | + 'goods_num': g_item.goods_num, | |
2932 | + 'market_price': g_item.market_price, | |
2933 | + 'goods_price': g_item.goods_price, | |
2934 | + 'member_goods_price': g_item.goods_price, | |
2935 | + 'store_id': oo.stoid, | |
2936 | + }; | |
2827 | 2937 | |
2828 | - //-- 线下取价也要写入,组合购的商品不能去线下价格 -- | |
2829 | - if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type != 7) { | |
2830 | - goods.goods_price = g_item.offline_price; | |
2831 | - goods.member_goods_price = g_item.offline_price; | |
2832 | - goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); | |
2833 | - goods.pricing_type = g_item.pricing_type; | |
2834 | - } | |
2835 | - if (g_item.quan_num) { | |
2836 | - goods.quan_num = g_item.quan_num; | |
2837 | - goods.quan_no = g_item.quan_no; | |
2838 | - } | |
2839 | - //--判断活动的类型-- | |
2840 | - switch (g_item.prom_type) { | |
2841 | - case 1: | |
2842 | - case 2: | |
2843 | - case 10: | |
2844 | - goods.prom_type = g_item.prom_type; | |
2845 | - goods.prom_id = g_item.prom_id; | |
2846 | - break; | |
2847 | - case 3: | |
2848 | - goods.prom_type = 3; | |
2849 | - goods.prom_id = g_item.prom_id; | |
2850 | - if (g_item.is_gift) { | |
2851 | - goods.is_gift = g_item.is_gift; | |
2852 | - goods.gift_id = g_item.gift_id; | |
2853 | - } | |
2854 | - break; | |
2855 | - case 5: | |
2856 | - goods.prom_type = 5; | |
2857 | - goods.prom_id = g_item.prom_id; | |
2858 | - if (g_item.is_collocation) { | |
2859 | - goods.is_collocation = g_item.is_collocation; | |
2938 | + if (getApp().globalData.skinface_id) { | |
2939 | + goods.skinface_id = getApp().globalData.skinface_id; | |
2940 | + } | |
2941 | + | |
2942 | + //-- 线下取价也要写入,组合购的商品不能去线下价格 -- | |
2943 | + if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type != 7) { | |
2944 | + goods.goods_price = g_item.offline_price; | |
2945 | + goods.member_goods_price = g_item.offline_price; | |
2946 | + goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); | |
2947 | + goods.pricing_type = g_item.pricing_type; | |
2948 | + } | |
2949 | + if (g_item.quan_num) { | |
2950 | + goods.quan_num = g_item.quan_num; | |
2951 | + goods.quan_no = g_item.quan_no; | |
2952 | + } | |
2953 | + //--判断活动的类型-- | |
2954 | + switch (g_item.prom_type) { | |
2955 | + case 1: | |
2956 | + case 2: | |
2957 | + case 10: | |
2958 | + goods.prom_type = g_item.prom_type; | |
2959 | + goods.prom_id = g_item.prom_id; | |
2960 | + break; | |
2961 | + case 3: | |
2962 | + goods.prom_type = 3; | |
2963 | + goods.prom_id = g_item.prom_id; | |
2964 | + if (g_item.is_gift) { | |
2965 | + goods.is_gift = g_item.is_gift; | |
2966 | + goods.gift_id = g_item.gift_id; | |
2967 | + } | |
2968 | + break; | |
2969 | + case 5: | |
2970 | + goods.prom_type = 5; | |
2971 | + goods.prom_id = g_item.prom_id; | |
2972 | + if (g_item.is_collocation) { | |
2973 | + goods.is_collocation = g_item.is_collocation; | |
2974 | + } | |
2975 | + break | |
2976 | + case 7: | |
2977 | + goods.prom_type = 7; | |
2978 | + goods.prom_id = g_item.prom_id; | |
2979 | + break | |
2980 | + default: | |
2981 | + goods.prom_type = 0; | |
2982 | + goods.prom_id = 0; | |
2983 | + } | |
2984 | + | |
2985 | + //如果不立即购买或者秒杀,如果是线下库存购买的时候 | |
2986 | + if (goods.prom_type == 0 && th.data.sales_rules == 2) { | |
2987 | + var isok = 1; | |
2988 | + await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) { | |
2989 | + isok = res; | |
2990 | + }); | |
2991 | + if (!isok) { | |
2992 | + getApp().confirmBox(goods.goods_name + "的门店库存不足"); | |
2993 | + th.data.is_summit_ing = 0; | |
2994 | + return false; | |
2860 | 2995 | } |
2861 | - break | |
2862 | - case 7: | |
2863 | - goods.prom_type = 7; | |
2864 | - goods.prom_id = g_item.prom_id; | |
2865 | - break | |
2866 | - default: | |
2867 | - goods.prom_type = 0; | |
2868 | - goods.prom_id = 0; | |
2869 | - } | |
2996 | + } | |
2870 | 2997 | |
2871 | - //如果不立即购买或者秒杀,如果是线下库存购买的时候 | |
2872 | - if (goods.prom_type == 0 && th.data.sales_rules == 2) { | |
2873 | - var isok = 1; | |
2874 | - await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) { | |
2875 | - isok = res; | |
2876 | - }); | |
2877 | - if (!isok) { | |
2878 | - getApp().confirmBox(goods.goods_name + "的门店库存不足"); | |
2879 | - th.data.is_summit_ing = 0; | |
2880 | - return false; | |
2998 | + //把优惠的平摊结果写进去 | |
2999 | + if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account != undefined)) { | |
3000 | + if (g_item.account >= 0) goods.account = g_item.account; | |
3001 | + if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu; | |
3002 | + item.is_discount_amount = 1; | |
2881 | 3003 | } |
2882 | - } | |
2883 | 3004 | |
2884 | - //把优惠的平摊结果写进去 | |
2885 | - if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account != undefined)) { | |
2886 | - if (g_item.account >= 0) goods.account = g_item.account; | |
2887 | - if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu; | |
2888 | - item.is_discount_amount = 1; | |
2889 | - } | |
3005 | + //导购ID | |
3006 | + if (g_item.guide_id) { | |
3007 | + goods.guide_id = g_item.guide_id; | |
3008 | + goods.guide_type = g_item.guide_type; | |
3009 | + //调用接口判断是不是会员 | |
3010 | + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => { | |
3011 | + if (res.data.code == 0) { | |
3012 | + goods.guide_name = res.data.data.salesman; | |
3013 | + goods.guide_sn = res.data.data.salesman_no; | |
3014 | + } | |
3015 | + }) | |
3016 | + } | |
2890 | 3017 | |
2891 | - //导购ID | |
2892 | - if (g_item.guide_id) { | |
2893 | - goods.guide_id = g_item.guide_id; | |
2894 | - goods.guide_type = g_item.guide_type; | |
2895 | - //调用接口判断是不是会员 | |
2896 | - await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => { | |
2897 | - if (res.data.code == 0) { | |
2898 | - goods.guide_name = res.data.data.salesman; | |
2899 | - goods.guide_sn = res.data.data.salesman_no; | |
3018 | + //如果有阶梯促销 | |
3019 | + if (g_item.ladder_list_id) { | |
3020 | + goods.ladder_list_id = g_item.ladder_list_id; | |
3021 | + } | |
3022 | + | |
3023 | + //-- 如果有代发商品,就要开始拆单 -- | |
3024 | + if (g_item.whsle_id) { | |
3025 | + df_price += parseFloat(g_item.goods_num * g_item.goods_price); | |
3026 | + goods.is_whsle_goods = 1; | |
3027 | + df_goods.push(goods); | |
3028 | + df_room_ids += g_item.room_id + ","; | |
3029 | + } else { | |
3030 | + item.order_goods.push(goods); | |
3031 | + //如果房间号不为空的时候 | |
3032 | + if (g_item.room_id) { | |
3033 | + goods.room_id = g_item.room_id; | |
3034 | + room_ids += g_item.room_id + ","; | |
2900 | 3035 | } |
2901 | - }) | |
2902 | - } | |
2903 | - //如果房间号不为空的时候 | |
2904 | - if (g_item.room_id) { | |
2905 | - goods.room_id = g_item.room_id; | |
2906 | - room_ids += g_item.room_id + ","; | |
3036 | + } | |
2907 | 3037 | } |
3038 | + } | |
3039 | + | |
3040 | + //如果房间号不为空的时候 | |
3041 | + if (room_ids != "") item.room_ids = ut.sub_last(room_ids); | |
3042 | + | |
3043 | + | |
3044 | + //处理代发商品的拆分 | |
3045 | + if(df_goods.length>0){ | |
3046 | + var df_item=JSON.parse(JSON.stringify(item)); | |
3047 | + item.goods_price= parseFloat(item.goods_price-df_price).toFixed(2); | |
3048 | + item.total_amount= parseFloat(item.total_amount-df_price).toFixed(2); | |
3049 | + | |
3050 | + df_item.is_whsle=1; | |
3051 | + df_item.is_discount_amount=0; | |
3052 | + df_item.goods_price=df_price; | |
3053 | + df_item.total_amount=df_price; | |
3054 | + df_item.shipping_price=0; //没有运费 | |
3055 | + if(df_item.order_prom_list) df_item.order_prom_list={}; | |
3056 | + | |
3057 | + //看一下是用余额比较多,还是用钱比较多 | |
3058 | + if(item.order_amount>item.user_money){ | |
3059 | + if(item.order_amount>df_price){ | |
3060 | + item.order_amount=parseFloat(item.order_amount-df_price).toFixed(2); | |
3061 | + df_item.order_amount=df_price.toFixed(2); | |
3062 | + }else { | |
3063 | + var more_p=parseFloat(df_price-item.order_amount).toFixed(2); | |
3064 | + item.order_amount=0; | |
3065 | + item.user_money=parseFloat(item.user_money-more_p).toFixed(2); | |
3066 | + df_item.user_money=more_p; | |
3067 | + } | |
3068 | + }else{ | |
3069 | + if(item.user_money>df_price){ | |
3070 | + item.user_money=parseFloat(item.user_money-df_price).toFixed(2); | |
3071 | + df_item.user_money=df_price.toFixed(2); | |
3072 | + }else { | |
3073 | + var more_p=parseFloat(df_price-item.user_money).toFixed(2); | |
3074 | + item.user_money=0; | |
3075 | + item.order_amount=parseFloat(item.user_money-more_p).toFixed(2); | |
3076 | + df_item.order_amount=more_p; | |
2908 | 3077 | |
2909 | - //如果有阶梯促销 | |
2910 | - if (g_item.ladder_list_id) { | |
2911 | - goods.ladder_list_id = g_item.ladder_list_id; | |
3078 | + } | |
2912 | 3079 | } |
2913 | 3080 | |
2914 | - item.order_goods.push(goods); | |
3081 | + if (df_room_ids != "") df_item.room_ids = ut.sub_last(df_room_ids); | |
3082 | + df_item.order_goods=df_goods; | |
3083 | + pdata.push(df_item); | |
2915 | 3084 | } |
2916 | 3085 | |
2917 | - //如果房间号不为空的时候 | |
2918 | - if (room_ids != "") item.room_ids = ut.sub_last(room_ids); | |
2919 | 3086 | pdata.push(item); |
2920 | 3087 | } |
2921 | 3088 | |
2922 | - | |
2923 | 3089 | } |
2924 | 3090 | |
2925 | 3091 | if (pdata.length == 0) return; |
... | ... | @@ -2951,7 +3117,7 @@ Page({ |
2951 | 3117 | } |
2952 | 3118 | var order_amount = 0; |
2953 | 3119 | pdata.forEach(function (em, ind) { |
2954 | - order_amount += em.order_amount; | |
3120 | + order_amount += parseFloat(em.order_amount); | |
2955 | 3121 | }) |
2956 | 3122 | //要进行判断,如果是用微信支付,就要跳转到支付界面 |
2957 | 3123 | if (order_amount > 0) { |
... | ... | @@ -3757,7 +3923,7 @@ Page({ |
3757 | 3923 | for (var i in goodlist) { |
3758 | 3924 | var gd = goodlist[i]; |
3759 | 3925 | //--如果是秒杀就跳出,如果是赠品,如果是组合购限制使用优惠券-- |
3760 | - if (gd.prom_type == 1 || gd.is_gift || (gd.prom_type == 7 && gd.act.is_xz_yh) || gd.is_xz_yh == 1) { | |
3926 | + if (gd.whsle_id==1 || gd.prom_type == 1 || gd.is_gift || (gd.prom_type == 7 && gd.act.is_xz_yh) || gd.is_xz_yh == 1) { | |
3761 | 3927 | continue; |
3762 | 3928 | } |
3763 | 3929 | |
... | ... | @@ -3865,8 +4031,8 @@ Page({ |
3865 | 4031 | arr[ind].ckeck_quan_price = ckeck_quan_price - (cut_price ? cut_price : 0); |
3866 | 4032 | arr[ind].check_quan_ware_list = check_quan_ware_list; |
3867 | 4033 | arr[ind].check_quan_price_list = check_quan_price_list; |
3868 | - //是否关闭使用优惠券 | |
3869 | - if (th.data.is_close_quan != 1) { | |
4034 | + //-- 是否关闭使用优惠券,循环有找到商品 -- | |
4035 | + if (th.data.is_close_quan != 1 && check_quan_ware_list) { | |
3870 | 4036 | //--调用接口,获取优惠券的列表,3秒钟内控制接口请求-- |
3871 | 4037 | var url = "/api/weshop/couponList/getUseCouponList"; |
3872 | 4038 | await app.request.promiseGet(url, { |
... | ... | @@ -3904,6 +4070,9 @@ Page({ |
3904 | 4070 | get_buy_now_quan: function () { |
3905 | 4071 | var quanlist = null, th = this, frozenQuan = null; |
3906 | 4072 | var good = this.data.bn_goods; |
4073 | + | |
4074 | + //一件代发商品不使用优惠券 | |
4075 | + if(good.whsle_id) return false; | |
3907 | 4076 | if (good.prom_price) { |
3908 | 4077 | th.data.ckeck_quan_price = good.prom_price; //如果有优惠价,就用优惠价 |
3909 | 4078 | } else if (good.is_offline) { |
... | ... | @@ -4025,6 +4194,7 @@ Page({ |
4025 | 4194 | arr.gift_uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; |
4026 | 4195 | arr.gift_limit_num = get_data.limit_num; |
4027 | 4196 | arr.gift_storecount = get_data.gift_storecount; |
4197 | + arr.whsle_id=get_data.goodsinfo.whsle_id; | |
4028 | 4198 | } |
4029 | 4199 | arr.s_libao = get_data.libao; |
4030 | 4200 | arr.s_lb_num = get_data.lb_num; |
... | ... | @@ -4659,6 +4829,11 @@ Page({ |
4659 | 4829 | goods_color: gf_item.goodsinfo.goods_color, |
4660 | 4830 | }; |
4661 | 4831 | |
4832 | + | |
4833 | + //-- 如果是代发商品的时候 -- | |
4834 | + if(gf_item.goodsinfo.whsle_id){ | |
4835 | + newd.whsle_id=gf_item.goodsinfo.whsle_id; | |
4836 | + } | |
4662 | 4837 | await getApp().request.promisePost("/api/weshop/cart/save", { |
4663 | 4838 | data: newd |
4664 | 4839 | }).then(res => { |
... | ... | @@ -4714,6 +4889,11 @@ Page({ |
4714 | 4889 | goods_spec: gf_item.goodsinfo.goods_spec, |
4715 | 4890 | goods_color: gf_item.goodsinfo.goods_color, |
4716 | 4891 | }; |
4892 | + //-- 如果是代发商品的时候 -- | |
4893 | + if(gf_item.goodsinfo.whsle_id){ | |
4894 | + newd.whsle_id=gf_item.goodsinfo.whsle_id; | |
4895 | + } | |
4896 | + | |
4717 | 4897 | new_pk_list_goods.push(newd); |
4718 | 4898 | } |
4719 | 4899 | var set_data = this.data.send_gf[th.data.bn_pick][this.data.send_gf_index]; | ... | ... |
pages/cart/cart2_inte/cart2_inte.js
... | ... | @@ -407,9 +407,9 @@ Page({ |
407 | 407 | |
408 | 408 | |
409 | 409 | //---------计算立即购买---------- |
410 | - calculatePrice2: function () { | |
410 | + calculatePrice2:async function () { | |
411 | 411 | var th = this, good = this.data.bn_goods; |
412 | - wx.showLoading({ title: "处理中.", }) | |
412 | + wx.showLoading({ title: "处理中.", mask:true }) | |
413 | 413 | //-----------计算商品总价-------------- |
414 | 414 | var allpice = good.shop_price * good.buynum; |
415 | 415 | var all_integral = good.integral * good.buynum; |
... | ... | @@ -426,7 +426,7 @@ Page({ |
426 | 426 | th.setData({ [c_txt]: cut_price, }); |
427 | 427 | } |
428 | 428 | |
429 | - to.getwuliuprice(async function (rs) { | |
429 | + //to.getwuliuprice(async function (rs) { | |
430 | 430 | |
431 | 431 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; |
432 | 432 | var out_of_weight = null; //超出多少重量 |
... | ... | @@ -453,6 +453,7 @@ Page({ |
453 | 453 | let item = gd_arr_list[i]; |
454 | 454 | |
455 | 455 | if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1) ) { |
456 | + if (goods_weight < 0) goods_weight = 0; | |
456 | 457 | if (item['exp_sum_type'] == 2) { |
457 | 458 | goods_weight += item['weight'] * item['buynum']; |
458 | 459 | cut_good_weight += item['weight'] * item['buynum']; |
... | ... | @@ -495,8 +496,38 @@ Page({ |
495 | 496 | var code = ""; |
496 | 497 | if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code; |
497 | 498 | //--------------开始计算物流------------------ |
498 | - var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
499 | - goods_piece, th.data.user_addr, back_data, rs); | |
499 | + var shipping_price=0; | |
500 | + // var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
501 | + // goods_piece, th.data.user_addr, back_data, rs); | |
502 | + | |
503 | + var w_data={ | |
504 | + store_id:os.stoid, code:code, | |
505 | + o_shipping_price:o_shipping_price, | |
506 | + goods_weight:goods_weight, | |
507 | + out_of_weight:out_of_weight,goods_piece:goods_piece, | |
508 | + user_addr_province:th.data.user_addr.province, | |
509 | + user_addr_city:th.data.user_addr.city, | |
510 | + user_addr_district:th.data.user_addr.district, | |
511 | + is_by_all:back_data && back_data.is_by_all?1:0, | |
512 | + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0, | |
513 | + } | |
514 | + | |
515 | + var is_ok=0; | |
516 | + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{ | |
517 | + if(res.data.code==0){ | |
518 | + shipping_price=res.data.data; is_ok=1; | |
519 | + } | |
520 | + }) | |
521 | + if(!is_ok){ | |
522 | + wx.showToast({ | |
523 | + title: "计算物流错误", icon: 'none',duration: 2000 | |
524 | + }) | |
525 | + th.setData({ show_submit:0 }); | |
526 | + wx.hideLoading(); | |
527 | + return false; | |
528 | + } | |
529 | + | |
530 | + | |
500 | 531 | if (shipping_price <= 0) { |
501 | 532 | th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券 |
502 | 533 | } |
... | ... | @@ -547,7 +578,7 @@ Page({ |
547 | 578 | |
548 | 579 | wx.hideLoading(); |
549 | 580 | |
550 | - }); | |
581 | + //}); | |
551 | 582 | |
552 | 583 | }, |
553 | 584 | |
... | ... | @@ -666,6 +697,12 @@ Page({ |
666 | 697 | goods.skinface_id=getApp().globalData.skinface_id; |
667 | 698 | } |
668 | 699 | |
700 | + if(th.data.bn_goods.whsle_id){ | |
701 | + item.is_whsle=1; | |
702 | + goods.is_whsle_goods=1; | |
703 | + } | |
704 | + | |
705 | + | |
669 | 706 | //-- 把导购的信息填入-- |
670 | 707 | if (gg.guide_id) { |
671 | 708 | goods.guide_id = gg.guide_id; | ... | ... |
pages/cart/cart2_pt/cart2_pt.js
... | ... | @@ -394,7 +394,13 @@ Page({ |
394 | 394 | }); |
395 | 395 | }, |
396 | 396 | //---------计算立即购买---------- |
397 | - calculatePrice2: function () { | |
397 | + calculatePrice2:async function () { | |
398 | + | |
399 | + wx.showLoading({ | |
400 | + title: "处理中.", | |
401 | + mask:true | |
402 | + }) | |
403 | + | |
398 | 404 | var th = this, good = this.data.bn_goods; |
399 | 405 | //-----------计算商品总价-------------- |
400 | 406 | var allpice = good.shop_price * good.buynum; |
... | ... | @@ -402,9 +408,10 @@ Page({ |
402 | 408 | var txt = "formData.all_price"; |
403 | 409 | th.setData({ [txt]: allpice, }); |
404 | 410 | |
405 | - to.getwuliuprice(async function (rs) { | |
411 | + //to.getwuliuprice(async function (rs) { | |
406 | 412 | console.log('calculatePrice2222'); |
407 | - console.log(rs); | |
413 | + //console.log(rs); | |
414 | + | |
408 | 415 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; |
409 | 416 | var out_of_weight = null; //超出多少重量 |
410 | 417 | |
... | ... | @@ -430,7 +437,8 @@ Page({ |
430 | 437 | let item = gd_arr_list[i]; |
431 | 438 | |
432 | 439 | if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { |
433 | - if (item['exp_sum_type'] == 2) { | |
440 | + if (goods_weight < 0) goods_weight = 0; | |
441 | + if (item['exp_sum_type'] == 2) { | |
434 | 442 | cut_good_weight += item['weight'] * item['buynum']; |
435 | 443 | goods_weight += item['weight'] * item['buynum']; |
436 | 444 | } |
... | ... | @@ -473,8 +481,36 @@ Page({ |
473 | 481 | var code = th.data.wu_arr[th.data.index].code; |
474 | 482 | |
475 | 483 | //--------------开始计算物流------------------ |
476 | - var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
477 | - goods_piece, th.data.user_addr, back_data, rs); | |
484 | + var shipping_price=0; | |
485 | + // var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
486 | + // goods_piece, th.data.user_addr, back_data, rs); | |
487 | + | |
488 | + var w_data={ | |
489 | + store_id:os.stoid, code:code, | |
490 | + o_shipping_price:o_shipping_price, | |
491 | + goods_weight:goods_weight, | |
492 | + out_of_weight:out_of_weight,goods_piece:goods_piece, | |
493 | + user_addr_province:th.data.user_addr.province, | |
494 | + user_addr_city:th.data.user_addr.city, | |
495 | + user_addr_district:th.data.user_addr.district, | |
496 | + is_by_all:back_data && back_data.is_by_all?1:0, | |
497 | + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0, | |
498 | + } | |
499 | + | |
500 | + var is_ok=0; | |
501 | + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{ | |
502 | + if(res.data.code==0){ | |
503 | + shipping_price=res.data.data; is_ok=1; | |
504 | + } | |
505 | + }) | |
506 | + if(!is_ok){ | |
507 | + wx.showToast({ | |
508 | + title: "计算物流错误", icon: 'none',duration: 2000 | |
509 | + }) | |
510 | + th.setData({ show_submit:0 }); | |
511 | + wx.hideLoading(); | |
512 | + return false; | |
513 | + } | |
478 | 514 | |
479 | 515 | shipping_price = parseFloat(shipping_price).toFixed(2); |
480 | 516 | var wl_txt = "formData.shipping_price"; |
... | ... | @@ -507,7 +543,9 @@ Page({ |
507 | 543 | th.setData({ [txt]: 0, [txt2]: order_m }) |
508 | 544 | } |
509 | 545 | |
510 | - }); | |
546 | + wx.hideLoading(); | |
547 | + | |
548 | + //}); | |
511 | 549 | |
512 | 550 | }, |
513 | 551 | //--------------------提交订单----------------------- |
... | ... | @@ -618,6 +656,12 @@ Page({ |
618 | 656 | if(getApp().globalData.skinface_id){ |
619 | 657 | goods.skinface_id=getApp().globalData.skinface_id; |
620 | 658 | } |
659 | + | |
660 | + if(th.data.bn_goods.whsle_id){ | |
661 | + item.is_whsle=1; | |
662 | + goods.is_whsle_goods=1; | |
663 | + } | |
664 | + | |
621 | 665 | //--导购分享过来的id-- |
622 | 666 | if (gg.guide_id) { |
623 | 667 | goods.guide_id = gg.guide_id; | ... | ... |
pages/cart/cart_wk/cart_wk.js
... | ... | @@ -473,9 +473,9 @@ Page({ |
473 | 473 | }, |
474 | 474 | |
475 | 475 | //----计算物流的钱---- |
476 | - calculate_wuliu() { | |
476 | + async calculate_wuliu() { | |
477 | 477 | var to = getApp(), th = this; |
478 | - to.getwuliuprice(async function (rs) { | |
478 | + //to.getwuliuprice(async function (rs) { | |
479 | 479 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1, good = th.data.goods; |
480 | 480 | var out_of_weight = null; //超出多少重量 |
481 | 481 | |
... | ... | @@ -505,7 +505,8 @@ Page({ |
505 | 505 | let item = gd_arr_list[i]; |
506 | 506 | |
507 | 507 | if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) { |
508 | - if (item['exp_sum_type'] == 2) { | |
508 | + if (goods_weight < 0) goods_weight = 0; | |
509 | + if (item['exp_sum_type'] == 2) { | |
509 | 510 | goods_weight += item['weight'] * item['buynum']; |
510 | 511 | cut_good_weight += item['weight'] * item['buynum']; |
511 | 512 | } |
... | ... | @@ -547,8 +548,36 @@ Page({ |
547 | 548 | var code = th.data.wu_arr[th.data.index].code; |
548 | 549 | |
549 | 550 | //--------------开始计算物流------------------ |
550 | - var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
551 | - goods_piece, th.data.user_addr, back_data, rs); | |
551 | + var shipping_price =0; | |
552 | + // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight, | |
553 | + // goods_piece, th.data.user_addr, back_data, rs); | |
554 | + | |
555 | + var w_data={ | |
556 | + store_id:os.stoid, code:code, | |
557 | + o_shipping_price:o_shipping_price, | |
558 | + goods_weight:goods_weight, | |
559 | + out_of_weight:out_of_weight,goods_piece:goods_piece, | |
560 | + user_addr_province:th.data.user_addr.province, | |
561 | + user_addr_city:th.data.user_addr.city, | |
562 | + user_addr_district:th.data.user_addr.district, | |
563 | + is_by_all:back_data && back_data.is_by_all?1:0, | |
564 | + no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0, | |
565 | + } | |
566 | + | |
567 | + var is_ok=0; | |
568 | + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{ | |
569 | + if(res.data.code==0){ | |
570 | + shipping_price=res.data.data; is_ok=1; | |
571 | + } | |
572 | + }) | |
573 | + if(!is_ok){ | |
574 | + wx.showToast({ | |
575 | + title: "计算物流错误", icon: 'none',duration: 2000 | |
576 | + }) | |
577 | + th.setData({ show_submit:0 }); | |
578 | + wx.hideLoading(); | |
579 | + return false; | |
580 | + } | |
552 | 581 | |
553 | 582 | var exp_price = parseFloat(shipping_price).toFixed(2); |
554 | 583 | allpice = parseFloat(exp_price) + parseFloat(allpice); |
... | ... | @@ -561,7 +590,7 @@ Page({ |
561 | 590 | allpice = allpice.toFixed(2); |
562 | 591 | th.setData({ exp_price: 0, allpice: allpice }) |
563 | 592 | } |
564 | - }); | |
593 | + //}); | |
565 | 594 | |
566 | 595 | }, |
567 | 596 | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -352,6 +352,10 @@ Page({ |
352 | 352 | getApp().globalData.guide_id = res.data.data.id; |
353 | 353 | } |
354 | 354 | }) |
355 | + | |
356 | + if(!getApp().globalData.user_id){ | |
357 | + ut.new_user_go(os.stoid,first_leader); | |
358 | + } | |
355 | 359 | } |
356 | 360 | |
357 | 361 | //-- 如果有房间号 -- |
... | ... | @@ -557,7 +561,7 @@ Page({ |
557 | 561 | var that = this, th = this; |
558 | 562 | getApp().getConfig2(function (e) { |
559 | 563 | var sales_rules = e.sales_rules; |
560 | - if (sales_rules == 2 && [1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 ) { | |
564 | + if (sales_rules == 2 && [1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 && !th.data.sele_g.whsle_id ) { | |
561 | 565 | getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () { |
562 | 566 | var lock = 0, plist = null; |
563 | 567 | var gd = that.data.fir_goods; |
... | ... | @@ -886,7 +890,8 @@ Page({ |
886 | 890 | } |
887 | 891 | |
888 | 892 | |
889 | - if (ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6 && ee.data.prom_type != 2) { | |
893 | + //一件代发商品不去计算优惠 | |
894 | + if (!ee.data.fir_goods.whsle_id && ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6 && ee.data.prom_type != 2) { | |
890 | 895 | ee.check_is_youhui(ee.data.gid); |
891 | 896 | } |
892 | 897 | |
... | ... | @@ -1390,6 +1395,13 @@ Page({ |
1390 | 1395 | prom_type: th.data.sele_g.prom_type, |
1391 | 1396 | }; |
1392 | 1397 | |
1398 | + | |
1399 | + //-- 代发商品不参加优惠 -- | |
1400 | + if(th.data.sele_g.whsle_id && newd.prom_type==3){ | |
1401 | + newd.prom_type=0; | |
1402 | + newd.prom_id=0; | |
1403 | + } | |
1404 | + | |
1393 | 1405 | //---是不是从收藏夹出来的--- |
1394 | 1406 | if (th.data.c_guide_id) { |
1395 | 1407 | newd['guide_id'] = th.data.c_guide_id; |
... | ... | @@ -1664,7 +1676,7 @@ Page({ |
1664 | 1676 | } |
1665 | 1677 | |
1666 | 1678 | //---如果是线下门店销售的时候--- |
1667 | - if (th.data.sales_rules == 2) { | |
1679 | + if (th.data.sales_rules == 2 && !th.data.sele_g.whsle_id ) { | |
1668 | 1680 | var pick = th.get_pick_from_list(th.data.sto_sele_id) |
1669 | 1681 | //---通过接口获取门店的线下库存信息-- |
1670 | 1682 | getApp().request.get("/api/weshop/goods/getWareStorages", { |
... | ... | @@ -2336,7 +2348,7 @@ Page({ |
2336 | 2348 | check_is_prom_goods: function (callback) { |
2337 | 2349 | var th = this; |
2338 | 2350 | var usr = getApp().globalData.userInfo; |
2339 | - if (this.data.sele_g.prom_type != 0 && this.data.sele_g.prom_type != 3) { | |
2351 | + if (this.data.sele_g.prom_type != 0 && this.data.sele_g.prom_type != 3 && !this.data.sele_g.whsle_id) { | |
2340 | 2352 | callback(); |
2341 | 2353 | } else { |
2342 | 2354 | //-- 判断有没有优惠活动 -- |
... | ... | @@ -2847,10 +2859,10 @@ Page({ |
2847 | 2859 | }); |
2848 | 2860 | |
2849 | 2861 | |
2850 | - that.check_is_youhui(gid, that.data.is_normal); | |
2862 | + if(!item.whsle_id) that.check_is_youhui(gid, that.data.is_normal); | |
2851 | 2863 | |
2852 | 2864 | //默认门店要拿下门店库存 |
2853 | - if (that.data.sales_rules == 2 && that.data.def_pick_store) { | |
2865 | + if (that.data.sales_rules == 2 && that.data.def_pick_store && !that.data.sele_g.whsle_id ) { | |
2854 | 2866 | var lock = 0, plist = null; |
2855 | 2867 | //先读取门店的lock,采用链式写法,少用await |
2856 | 2868 | getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { |
... | ... | @@ -3077,7 +3089,7 @@ Page({ |
3077 | 3089 | th.setData({all_pick_list: e.data.data.pageData}); |
3078 | 3090 | |
3079 | 3091 | //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购-- |
3080 | - if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4) || is_normal == 1)) { | |
3092 | + if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && !th.data.sele_g.whsle_id && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4) || is_normal == 1)) { | |
3081 | 3093 | setTimeout(function () { |
3082 | 3094 | th.deal_pickup_dline(e); |
3083 | 3095 | }, 800) |
... | ... | @@ -3619,7 +3631,7 @@ Page({ |
3619 | 3631 | this.get_sku(o.stoid, this.data.data, gid); |
3620 | 3632 | this.check_has_flash(); |
3621 | 3633 | this.data.is_normal = 1; |
3622 | - this.check_is_youhui(gid, 1); | |
3634 | + if(!this.data.data.whsle_id) this.check_is_youhui(gid, 1); | |
3623 | 3635 | return false; |
3624 | 3636 | } |
3625 | 3637 | |
... | ... | @@ -4262,7 +4274,7 @@ Page({ |
4262 | 4274 | }); |
4263 | 4275 | }); |
4264 | 4276 | } |
4265 | - th.check_is_youhui(th.data.gid, 1); | |
4277 | + if(!th.data.sele_g.whsle_id) th.check_is_youhui(th.data.gid, 1); | |
4266 | 4278 | } else { |
4267 | 4279 | |
4268 | 4280 | if (th.data.is_normal) { |
... | ... | @@ -5981,7 +5993,7 @@ Page({ |
5981 | 5993 | var lock = 0; |
5982 | 5994 | |
5983 | 5995 | //---如果是活动的时候,同时不是普通购买--- |
5984 | - if ((th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) && !th.data.is_normal) { | |
5996 | + if (th.data.sele_g.whsle_id || (th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) && !th.data.is_normal) { | |
5985 | 5997 | func(); |
5986 | 5998 | return false; |
5987 | 5999 | } |
... | ... | @@ -6637,7 +6649,7 @@ Page({ |
6637 | 6649 | }); |
6638 | 6650 | }); |
6639 | 6651 | } |
6640 | - this.check_is_youhui(th.data.gid, 1); | |
6652 | + if(!th.data.sele_g.whsle_id) this.check_is_youhui(th.data.gid, 1); | |
6641 | 6653 | }, |
6642 | 6654 | |
6643 | 6655 | closeSpecModal_inte: function () { |
... | ... | @@ -6845,7 +6857,8 @@ Page({ |
6845 | 6857 | }); |
6846 | 6858 | this.get_sku(os.stoid, this.data.data, gid); |
6847 | 6859 | this.get_sto(); |
6848 | - this.check_is_youhui(gid, 1); | |
6860 | + if(!this.data.data.whsle_id) | |
6861 | + this.check_is_youhui(gid, 1); | |
6849 | 6862 | this.data.is_normal = 1; |
6850 | 6863 | }, |
6851 | 6864 | |
... | ... | @@ -6944,7 +6957,7 @@ Page({ |
6944 | 6957 | }); |
6945 | 6958 | }); |
6946 | 6959 | } |
6947 | - this.check_is_youhui(th.data.gid, 1); | |
6960 | + if(!this.data.data.whsle_id) this.check_is_youhui(th.data.gid, 1); | |
6948 | 6961 | }, |
6949 | 6962 | |
6950 | 6963 | closeSpecModal_flash_normal: function () { | ... | ... |
pages/goods/goodsInfo/goodsInfo.wxml
... | ... | @@ -649,7 +649,7 @@ |
649 | 649 | <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> |
650 | 650 | (配送不匹配) |
651 | 651 | </view> |
652 | - <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> | |
652 | + <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0 && !sele_g.whsle_id}}"> | |
653 | 653 | (库存不足) |
654 | 654 | </view> |
655 | 655 | </block> |
... | ... | @@ -1254,7 +1254,7 @@ |
1254 | 1254 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> |
1255 | 1255 | <block wx:else> |
1256 | 1256 | <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> |
1257 | - <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> | |
1257 | + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0 &&!sele_g.whsle_id}}"> | |
1258 | 1258 | (库存不足) |
1259 | 1259 | </view> |
1260 | 1260 | </block> |
... | ... | @@ -1326,7 +1326,7 @@ |
1326 | 1326 | </block> |
1327 | 1327 | <block wx:else> |
1328 | 1328 | <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 --> |
1329 | - <block wx:if="{{sales_rules==2 && prom_type==0}}"> | |
1329 | + <block wx:if="{{sales_rules==2 && prom_type==0 && !sele_g.whsle_id}}"> | |
1330 | 1330 | <block wx:if="{{!def_pick_store.CanOutQty}}"> |
1331 | 1331 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999"> |
1332 | 1332 | 库存不足 | ... | ... |
pages/goods/goodsList/goodsList.js
pages/index/index/index.js
pages/index/index/index.wxml
... | ... | @@ -18,7 +18,6 @@ |
18 | 18 | <view class="top-bar"> |
19 | 19 | <!-- 顶部关注公众号 --> |
20 | 20 | <view id="off_top" wx:if="{{is_gz_h5}}"><official-account></official-account></view> |
21 | - | |
22 | 21 | <!-- 控制要不要显示顶部门店选择 --> |
23 | 22 | <block wx:if="{{is_topstore}}"> |
24 | 23 | <store_select style="z-index: 999;"></store_select> |
... | ... | @@ -45,17 +44,11 @@ |
45 | 44 | </view> |
46 | 45 | </view> |
47 | 46 | </view> |
48 | - | |
49 | - | |
50 | - | |
51 | - | |
52 | - | |
53 | - | |
54 | - <!-- 如果有关注,要 --> | |
55 | - <!-- <view wx:if="{{is_gz_h5 && is_ok_h5}}" style="height: 84px"></view> --> | |
56 | - <!-- 如果有顶部门店 --> | |
57 | - <!-- <view wx:if="{{is_topstore}}" style="height: 60rpx"></view> --> | |
58 | 47 | |
48 | + <!-- 如果有关注,要顶开位置,不能注释 --> | |
49 | + <view wx:if="{{is_gz_h5 && is_ok_h5}}" style="height: 84px;;flex-shrink:0"></view> | |
50 | + <!-- 如果有顶部门店,顶开位置的,不能注释 --> | |
51 | + <view wx:if="{{is_topstore}}" style="height:60rpx;flex-shrink:0"></view> | |
59 | 52 | <!--滚动广告--> |
60 | 53 | <view class="rel title-img" wx:if="{{banner}}"> |
61 | 54 | <swiper circular="true" indicator-dots indicator-active-color="#fff" autoplay="true" class="swiper_box" duration="1000" interval="3000" vertical="" bindchange="bannerSwiperChange" style="height:{{max_sw_height}}rpx"> |
... | ... | @@ -595,3 +588,5 @@ |
595 | 588 | |
596 | 589 | |
597 | 590 | |
591 | + | |
592 | + | ... | ... |
pages/togoin/togoin.js
... | ... | @@ -187,15 +187,7 @@ Page({ |
187 | 187 | }; |
188 | 188 | //--如果有邀请人的时候-- |
189 | 189 | if(th.data.first_leader){ |
190 | - //判断一下分享人是不是分享商 | |
191 | - await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+th.data.first_leader,{}).then(res=>{ | |
192 | - if(res.data.code==0){ | |
193 | - var user= res.data.data; | |
194 | - if(user.is_distribut==1){ | |
195 | - dd.first_leader=th.data.first_leader; | |
196 | - } | |
197 | - } | |
198 | - }) | |
190 | + dd.first_leader=th.data.first_leader; | |
199 | 191 | } |
200 | 192 | //-- 导购会员ID -- |
201 | 193 | if(getApp().globalData.guide_id){ |
... | ... | @@ -209,50 +201,70 @@ Page({ |
209 | 201 | |
210 | 202 | console.log("-----会员注册的信息-------"); |
211 | 203 | console.log(dd); |
212 | - app.request.get("/api/weshop/users/thirdLogin", { | |
213 | - data: dd, | |
214 | - success: function (e) { | |
215 | - | |
216 | - if (e.data.code == 0) { | |
217 | - app.globalData.user_id = e.data.data.user_id; | |
218 | - } else { | |
219 | - return app.showWarning("授权登入失败!"+e.data.msg); | |
220 | - } | |
221 | - | |
222 | - | |
223 | - var need_go=0; | |
224 | - var t_user=e.data.data; | |
225 | - | |
226 | - | |
227 | - getApp().globalData.login_back=1; | |
228 | - wx.setStorageSync("userinfo",e.data.data); | |
229 | - wx.setStorageSync("isAuth", !0), app.globalData.userInfo = e.data.data, app.globalData.userInfo.head_pic = t.getFullUrl(a.globalData.userInfo.head_pic); | |
230 | - | |
231 | - //如果有需要完善的信息没有完善,就需要跳转 | |
232 | - if(!t_user['vipname'] && th.data.name_need_go){ need_go=1;} | |
233 | - if(!t_user['birthday'] && th.data.birth_need_go){ need_go=1;} | |
234 | - if(!t_user['idcard'] && th.data.idcard_need_go){ need_go=1;} | |
235 | - if(!t_user['address'] && th.data.address_need_go){ need_go=1;} | |
236 | - if(!t_user['pickup_id'] && th.data.pick_need_go){ need_go=1;} | |
237 | - if(!t_user['sex'] && th.data.sex_need_go){ need_go=1;} | |
238 | - if(!t_user['fromuser_id'] && th.data.introducer_need_go){ need_go=1;} | |
239 | - | |
240 | - if(need_go){ | |
241 | - getApp().goto("/packageA/pages/profile/profile"); | |
242 | - }else{ | |
243 | - wx.navigateBack({ delta: 1}) | |
244 | - } | |
245 | 204 | |
246 | - }, | |
247 | - failStatus: function (t) { | |
248 | - return app.my_warnning("授权登入失败,请稍后再试!", 0, that); | |
249 | - }, | |
250 | - fail: function (t) { | |
251 | - return i.clearAuth(), i.alertLoginErrorAndGoHome(), !1; | |
205 | + | |
206 | + var need_go=0; | |
207 | + //如果有需要完善的信息没有完善,就需要跳转 | |
208 | + if(th.data.name_need_go){ need_go=1;} | |
209 | + if(th.data.birth_need_go){ need_go=1;} | |
210 | + if(th.data.idcard_need_go){ need_go=1;} | |
211 | + if(th.data.address_need_go){ need_go=1;} | |
212 | + if(th.data.pick_need_go){ need_go=1;} | |
213 | + if(th.data.sex_need_go){ need_go=1;} | |
214 | + if(th.data.introducer_need_go){ need_go=1;} | |
215 | + | |
216 | + if(need_go){ | |
217 | + | |
218 | + var req_data={ | |
219 | + sessionKey: sessionKey, | |
220 | + encryptedData: e.encryptedData, | |
221 | + iv: e.iv, | |
222 | + store_id: getApp().globalData.setting.stoid, | |
223 | + } | |
224 | + //-- 获取一下手机 -- | |
225 | + getApp().request.promiseGet("/api/weshop/users/getmobile", {data:req_data}).then(res=>{ | |
226 | + if(res.data.code==0){ | |
227 | + dd.mobile=res.data.data; | |
228 | + getApp().globalData.zc_dd=dd; | |
229 | + wx.redirectTo({ | |
230 | + url:"/packageA/pages/profile/profile?is_back=1" | |
231 | + }) | |
232 | + } | |
233 | + }) | |
234 | + | |
235 | + | |
236 | + }else{ | |
237 | + this.zu_ce(dd); //调用注册的函数 | |
252 | 238 | } |
253 | - }); | |
239 | + | |
254 | 240 | }, |
255 | 241 | |
242 | + zu_ce:function (dd) { | |
243 | + var th=this; | |
244 | + app.request.get("/api/weshop/users/thirdLogin", { | |
245 | + data: dd, | |
246 | + success: function (e) { | |
247 | + if (e.data.code == 0) { | |
248 | + app.globalData.user_id = e.data.data.user_id; | |
249 | + } else { | |
250 | + return app.showWarning("授权登入失败!"+e.data.msg); | |
251 | + } | |
252 | + getApp().globalData.login_back=1; | |
253 | + wx.setStorageSync("userinfo",e.data.data); | |
254 | + wx.setStorageSync("isAuth", !0), app.globalData.userInfo = e.data.data, app.globalData.userInfo.head_pic = t.getFullUrl(app.globalData.userInfo.head_pic); | |
255 | + wx.navigateBack({ delta: 1}) | |
256 | + | |
257 | + }, | |
258 | + failStatus: function (t) { | |
259 | + return app.my_warnning("授权登入失败,请稍后再试!", 0, that); | |
260 | + }, | |
261 | + fail: function (t) { | |
262 | + return i.clearAuth(), i.alertLoginErrorAndGoHome(), !1; | |
263 | + } | |
264 | + }); | |
265 | + }, | |
266 | + | |
267 | + | |
256 | 268 | bind_bnerr:function(e){ |
257 | 269 | var _errImg = e.target.dataset.errorimg; |
258 | 270 | var _errObj = {}; | ... | ... |
pages/user/index/index.js
... | ... | @@ -75,7 +75,25 @@ Page({ |
75 | 75 | } |
76 | 76 | } |
77 | 77 | }) |
78 | - app.getUserFir(); | |
78 | + | |
79 | + var first_leader = options.first_leader; | |
80 | + if(first_leader){ | |
81 | + //-- user_id代过来免登录 -- | |
82 | + getApp().globalData.first_leader = first_leader; | |
83 | + //调用接口判断是不是会员 | |
84 | + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { | |
85 | + if (res.data.code == 0) { | |
86 | + getApp().globalData.guide_id = res.data.data.id; | |
87 | + } | |
88 | + }) | |
89 | + | |
90 | + if(!getApp().globalData.user_id){ | |
91 | + ut.new_user_go(os.stoid,first_leader); | |
92 | + } | |
93 | + | |
94 | + }else{ | |
95 | + app.getUserFir(); | |
96 | + } | |
79 | 97 | this.init_user_tool() |
80 | 98 | }, |
81 | 99 | |
... | ... | @@ -484,7 +502,26 @@ Page({ |
484 | 502 | /** |
485 | 503 | * 用户点击右上角分享 |
486 | 504 | */ |
487 | - onShareAppMessage: function () { getApp().globalData.no_clear = 1; }, | |
505 | + onShareAppMessage: function () { | |
506 | + getApp().globalData.no_clear = 1; | |
507 | + var url = "/pages/user/index/index"; | |
508 | + | |
509 | + if (userInfo) { | |
510 | + url += "?first_leader=" + getApp().globalData.user_id; | |
511 | + } | |
512 | + var title = "会员中心" | |
513 | + //分享 | |
514 | + if (getApp().globalData.config && getApp().globalData.config.store_name) { | |
515 | + title = getApp().globalData.config.store_name; | |
516 | + } else if (getApp().globalData.setting.appName) { | |
517 | + title = getApp().globalData.setting.appName; | |
518 | + } | |
519 | + | |
520 | + var ob = { | |
521 | + title: title,path: url, | |
522 | + }; | |
523 | + return ob; | |
524 | + }, | |
488 | 525 | |
489 | 526 | //------卡片的显示和关闭-------- |
490 | 527 | show_tc: function () { | ... | ... |
pages/user/order_detail/order_detail.js
... | ... | @@ -629,7 +629,7 @@ Page({ |
629 | 629 | } |
630 | 630 | |
631 | 631 | //--如果是线下库存的时候-- |
632 | - if(th.data.conf.sales_rules==2){ | |
632 | + if(th.data.conf.sales_rules==2 && !gg.whsle_id){ | |
633 | 633 | var ob={}; |
634 | 634 | await th.check_down_line_next(gg,good.goods_num,order.pickup_id,function(obj){ |
635 | 635 | ob=obj; |
... | ... | @@ -1197,7 +1197,7 @@ Page({ |
1197 | 1197 | } |
1198 | 1198 | |
1199 | 1199 | //如果有优惠促销的时候,要看下商品的优惠活动有没有过期 |
1200 | - if(g_item.prom_type==3 || good.prom_type==3){ | |
1200 | + if((g_item.prom_type==3 || good.prom_type==3) && good.whsle_id<=0){ | |
1201 | 1201 | var is_g_prom=0; |
1202 | 1202 | //因为有全场优惠活动,商品参加的活动还未开始 |
1203 | 1203 | var url="/api/weshop/activitylist/getGoodActInfo"; |
... | ... | @@ -1239,7 +1239,7 @@ Page({ |
1239 | 1239 | |
1240 | 1240 | |
1241 | 1241 | //判断是不是线下库存的购买, 是不是秒杀活动 |
1242 | - if(th.data.sales_rules==2 && !prom){ | |
1242 | + if(th.data.sales_rules==2 && !prom && !good.whsle_id){ | |
1243 | 1243 | |
1244 | 1244 | //-- 看一下购物车上有多少商品 -- |
1245 | 1245 | var cart_num=0; | ... | ... |
pages/user/order_detail/order_detail.wxml
... | ... | @@ -36,7 +36,7 @@ |
36 | 36 | <view class="goods-num">×{{item.goods_num}}</view> |
37 | 37 | |
38 | 38 | <!-- 不是整单退的时候 --> |
39 | - <block wx:if="{{order.is_all_return!=1 && order.discount<=0 && order.coupon_price<=0 && order.order_prom_amount<=0 && order.discount_amount<=0 && item.prom_type!=5 && !order.is_prom}}"> | |
39 | + <block wx:if="{{order.is_all_return!=1 && order.discount<=0 && order.coupon_price<=0 && order.order_prom_amount<=0 && order.discount_amount<=0 && item.prom_type!=5 && !order.is_prom && item.is_whsle_goods!=1}}"> | |
40 | 40 | <view bindtap="checkReturnGoodsStatus" class="goods-num" data-oid="{{item.order_id}}" |
41 | 41 | data-recid="{{item.goods_id}}" wx:if="{{item.return_btn==1 && !order.is_bedistri}}">申请退款</view> |
42 | 42 | <view bindtap="gotoreturn" class="return-btn" data-oid="{{item.order_id}}" | ... | ... |
pages/user/order_list/order_list.js
... | ... | @@ -881,7 +881,7 @@ Page({ |
881 | 881 | } |
882 | 882 | |
883 | 883 | //--如果是线下库存的时候-- |
884 | - if (th.data.conf.sales_rules == 2) { | |
884 | + if (th.data.conf.sales_rules == 2 && !gg.whsle_id) { | |
885 | 885 | var ob = {}; |
886 | 886 | await th.check_down_line_next(gg, good.goods_num, order.pickup_id, function (obj) { |
887 | 887 | ob = obj; |
... | ... | @@ -1439,7 +1439,7 @@ Page({ |
1439 | 1439 | } |
1440 | 1440 | |
1441 | 1441 | //如果有优惠促销的时候,要看下商品的优惠活动有没有过期 |
1442 | - if(g_item.prom_type==3 || good.prom_type==3){ | |
1442 | + if((g_item.prom_type==3 || good.prom_type==3) && good.whsle_id<=0){ | |
1443 | 1443 | var is_g_prom=0; |
1444 | 1444 | //因为有全场优惠活动,商品参加的活动还未开始 |
1445 | 1445 | var url="/api/weshop/activitylist/getGoodActInfo"; |
... | ... | @@ -1482,7 +1482,7 @@ Page({ |
1482 | 1482 | |
1483 | 1483 | |
1484 | 1484 | //判断是不是线下库存的购买, 是不是秒杀活动 |
1485 | - if(th.data.sales_rules==2 && !prom){ | |
1485 | + if(th.data.sales_rules==2 && !prom && !good.whsle_id){ | |
1486 | 1486 | |
1487 | 1487 | //-- 看一下购物车上有多少商品 -- |
1488 | 1488 | var cart_num=0; | ... | ... |
pages/user/order_list/order_list.wxml
... | ... | @@ -150,7 +150,7 @@ |
150 | 150 | </view> |
151 | 151 | <view class="flex-level-right fs26 refund"> |
152 | 152 | <!-- 不是整单退的时候 --> |
153 | - <block wx:if="{{item.is_all_return!=1 && item.discount<=0 && item.coupon_price<=0 && item.order_prom_amount<=0 && item.discount_amount<=0 && goods.prom_type!=5 && !item.is_prom}}"> | |
153 | + <block wx:if="{{item.is_all_return!=1 && item.discount<=0 && item.coupon_price<=0 && item.order_prom_amount<=0 && item.discount_amount<=0 && goods.prom_type!=5 && !item.is_prom && goods.is_whsle_goods!=1}}"> | |
154 | 154 | <view catchtap="checkReturnGoodsStatus" class="return-btn" data-oid="{{goods.order_id}}" data-recid="{{goods.goods_id}}" wx:if="{{goods.return_btn==1 && !item.is_bedistri }}">申请退款</view> |
155 | 155 | <view catchtap="gotoreturn" class="return-btn" data-oid="{{goods.order_id}}" data-recid="{{goods.goods_id}}" wx:if="{{goods.return_btn==2}}">退款中</view> |
156 | 156 | <view catchtap="checkReturnGoodsStatus" class="return-btn" data-oid="{{goods.order_id}}" data-recid="{{goods.goods_id}}" wx:if="{{goods.return_btn==3}}">重新退款</view> | ... | ... |
pages/user/userinfo/userinfo.js
... | ... | @@ -88,12 +88,17 @@ Page({ |
88 | 88 | console.log('ee',ee); |
89 | 89 | var sms_conf = ee.switch_list; |
90 | 90 | sms_conf = JSON.parse(sms_conf); |
91 | - th.setData({ | |
92 | - rank_switch:sms_conf.rank_switch, | |
93 | - is_lable_set: sms_conf.user_label_set, //是不是会员标签设置 | |
94 | - guide_title:sms_conf.guide_consultant, //系统参数 导购标题 | |
95 | - guide_change_time:sms_conf.guide_change_time, //每月能修改几次 | |
96 | - }) | |
91 | + let reg_type = ee.reg_type; | |
92 | + let reg_info = ee.reg_info; | |
93 | + var con_f={ | |
94 | + rank_switch:sms_conf.rank_switch, | |
95 | + is_lable_set: sms_conf.user_label_set, //是不是会员标签设置 | |
96 | + guide_title:sms_conf.guide_consultant, //系统参数 导购标题 | |
97 | + guide_change_time:sms_conf.guide_change_time, //每月能修改几次 | |
98 | + } | |
99 | + if(reg_type) con_f.reg_info= JSON.parse(reg_info); | |
100 | + th.setData(con_f) | |
101 | + | |
97 | 102 | if (sms_conf.usercode_vailtime!=null && parseInt(sms_conf.usercode_vailtime)>0) |
98 | 103 | { |
99 | 104 | th.setData({ getusercode_vailtime: sms_conf.usercode_vailtime }); |
... | ... | @@ -101,7 +106,7 @@ Page({ |
101 | 106 | if (sms_conf.user_label_set) { |
102 | 107 | th.query_checklabels(); |
103 | 108 | } |
104 | - }) | |
109 | + },1) | |
105 | 110 | }, |
106 | 111 | //查找会员选择的兴趣标签 |
107 | 112 | query_checklabels: function() { |
... | ... | @@ -816,15 +821,7 @@ Page({ |
816 | 821 | } |
817 | 822 | }) |
818 | 823 | } |
819 | - // var phone = ""; | |
820 | - // phone+=a.mobile.substr(0, 3)+"****"; | |
821 | - // phone += a.mobile.substr(7, 12); | |
822 | - | |
823 | - | |
824 | 824 | |
825 | - // e.setData({ | |
826 | - // isGender:e.data.user.sex | |
827 | - // }) | |
828 | 825 | }, !0); |
829 | 826 | }, |
830 | 827 | ... | ... |
pages/user/userinfo/userinfo.wxml
... | ... | @@ -113,6 +113,12 @@ |
113 | 113 | </block> |
114 | 114 | <view class="fs26">女</view> |
115 | 115 | </view> |
116 | + | |
117 | + <block wx:if="{{!user.sex}}"> | |
118 | + <text class="lb_txt" wx:if="{{reg_info.sex && (reg_info.sex_state_type == 0)}}">+{{reg_info.sex}}积分</text> | |
119 | + <text class="lb_txt" wx:if="{{reg_info.sex && (reg_info.sex_state_type == 1)}}">+{{reg_info.sex}}成长值</text> | |
120 | + </block> | |
121 | + | |
116 | 122 | </view> |
117 | 123 | |
118 | 124 | </view> |
... | ... | @@ -140,7 +146,7 @@ |
140 | 146 | <view class="Mleft">农历</view> |
141 | 147 | </view> |
142 | 148 | </view> |
143 | - <view class="user-txt-right"> | |
149 | + <view class="user-txt-right flex ai_c"> | |
144 | 150 | <!-- 填充数据的时候要判断是否已经有出生日期,有值的话就不可修改 --> |
145 | 151 | <block wx:if="{{user.birthday==''||user.birthday==null}}"> |
146 | 152 | <picker bindchange='bindChange' value="{{datet}}" mode="date" start="{{year-70}}-1-1" end="{{year}}-12-31"> |
... | ... | @@ -150,7 +156,12 @@ |
150 | 156 | <block wx:else> |
151 | 157 | <view>{{datet==""? user.birthday==""?"":filters.replace_time2(user.birthday):datet}}</view> |
152 | 158 | </block> |
153 | - | |
159 | + | |
160 | + <block wx:if="{{!user.birthday}}"> | |
161 | + <text class="lb_txt" wx:if="{{reg_info.birthday && (reg_info.birthday_type == 0)}}">+{{reg_info.birthday}}积分</text> | |
162 | + <text class="lb_txt" wx:if="{{reg_info.birthday && (reg_info.birthday_type == 1)}}">+{{reg_info.birthday}}成长值</text> | |
163 | + </block> | |
164 | + | |
154 | 165 | </view> |
155 | 166 | </view> |
156 | 167 | </view> |
... | ... | @@ -158,18 +169,25 @@ |
158 | 169 | <view class="Bbottom"> |
159 | 170 | <view bindtap="editUserInfo1" class="user-name mt flex-vertical-between" data-type="nickname"> |
160 | 171 | <view class="user-name-txt">姓名</view> |
161 | - <input bindblur="user_name" class="user-txt-right t-r" placeholder="*姓名" value='{{user.vipname}}' /> | |
172 | + <view class="flex ai_c"> | |
173 | + <input bindblur="user_name" class="user-txt-right t-r" placeholder="*姓名" value='{{user.vipname}}' /> | |
174 | + <block wx:if="{{!user.vipname}}"> | |
175 | + <text class="lb_txt" wx:if="{{reg_info.name && (reg_info.name_val_type == 0)}}">+{{reg_info.name}}积分</text> | |
176 | + <text class="lb_txt" wx:if="{{reg_info.name && (reg_info.name_val_type == 1)}}">+{{reg_info.name}}成长值</text> | |
177 | + </block> | |
178 | + </view> | |
162 | 179 | </view> |
163 | 180 | |
164 | 181 | <view bindtap="editUserInfo1" class="user-name flex-vertical-between" data-type="nickname"> |
165 | 182 | <view class="user-name-txt">身份证</view> |
183 | + <view class="flex ai_c"> | |
184 | + <input bindblur="identity_card" class="user-txt-right t-r" value="{{user.idcard}}" placeholder="*身份证" /> | |
185 | + <block wx:if="{{!user.idcard}}"> | |
186 | + <text class="lb_txt" wx:if="{{reg_info.idcard && (reg_info.idcard_type == 0)}}">+{{reg_info.idcard}}积分</text> | |
187 | + <text class="lb_txt" wx:if="{{reg_info.idcard && (reg_info.idcard_type == 1)}}">+{{reg_info.idcard}}成长值</text> | |
188 | + </block> | |
189 | + </view> | |
166 | 190 | |
167 | - <input bindblur="identity_card" class="user-txt-right t-r" value="{{user.idcard}}" placeholder="*身份证"></input> | |
168 | - | |
169 | - | |
170 | - <!-- <block wx:else> | |
171 | - <input class="user-txt-right" bindblur="IdentityIDCard" value="" type="idcard" maxlength="18" placeholder="*身份证" /> | |
172 | - </block> --> | |
173 | 191 | </view> |
174 | 192 | <view data-url="/packageB/pages/user/Change_phone/Change_phone" bindtap="go_phone" class="user-name flex-vertical-between" data-type="mobile"> |
175 | 193 | <view class="user-name-txt">更换手机</view> |
... | ... | @@ -185,8 +203,14 @@ |
185 | 203 | <view>{{user.address}}</view> |
186 | 204 | </block> |
187 | 205 | <block wx:else> --> |
188 | - <input bindblur="address" maxlength="30" value="{{user.address}}" class="user-txt-right" placeholder="*地址" style="text-align:right" /> | |
189 | - <!-- </block> --> | |
206 | + <view class="flex ai_c"> | |
207 | + <input bindblur="address" maxlength="30" value="{{user.address}}" class="user-txt-right" placeholder="*地址" style="text-align:right" /> | |
208 | + <block wx:if="{{!user.address}}"> | |
209 | + <text class="lb_txt" wx:if="{{reg_info.address && (reg_info.address_type == 0)}}">+{{reg_info.address}}积分</text> | |
210 | + <text class="lb_txt" wx:if="{{reg_info.address && (reg_info.address_type == 1)}}">+{{reg_info.address}}成长值</text> | |
211 | + </block> | |
212 | + </view> | |
213 | + | |
190 | 214 | </view> |
191 | 215 | |
192 | 216 | <!-- 选择门店 --> |
... | ... | @@ -194,7 +218,14 @@ |
194 | 218 | <view class="user-name-txt">所属门店</view> |
195 | 219 | <view class="flex-center user-txt-right"> |
196 | 220 | <view class="one-line">{{stoname}}</view> |
197 | - <view class="angle">∟</view> | |
221 | + <view class="flex ai_c"> | |
222 | + <view class="angle">∟</view> | |
223 | + <block wx:if="{{!user.pickup_id}}"> | |
224 | + <text class="lb_txt" wx:if="{{reg_info.pick && (reg_info.pick_type == 0)}}">+{{reg_info.pick}}积分</text> | |
225 | + <text class="lb_txt" wx:if="{{reg_info.pick && (reg_info.pick_type == 1)}}">+{{reg_info.pick}}成长值</text> | |
226 | + </block> | |
227 | + </view> | |
228 | + | |
198 | 229 | </view> |
199 | 230 | </view> |
200 | 231 | |
... | ... | @@ -239,7 +270,6 @@ |
239 | 270 | <navigator bindtap="goto-address" class="user-name mt flex-vertical-between" url="/pages/user/address_list/address_list"> |
240 | 271 | <view class="user-name-txt">收货地址</view> |
241 | 272 | <view class="flex-center user-txt-right"> |
242 | - <!-- <view class="flex">{{user.address_id}}</view> --> | |
243 | 273 | <view class="angle">∟</view> |
244 | 274 | </view> |
245 | 275 | </navigator> | ... | ... |
pages/user/userinfo/userinfo.wxss
utils/util.js
... | ... | @@ -677,6 +677,28 @@ module.exports = { |
677 | 677 | url: r + o |
678 | 678 | }); |
679 | 679 | }, |
680 | + | |
681 | + //分享注册,跳转到授权 | |
682 | + new_user_go:function (stoid,first_leader) { | |
683 | + getApp().request.get("/api/weshop/users/get/" + stoid + "/" + first_leader,{ | |
684 | + success: function(e) { | |
685 | + if (e.data.code == 0 && e.data.data ) { | |
686 | + // 提示框 | |
687 | + wx.showModal({ | |
688 | + title: '注册邀请', | |
689 | + content: e.data.data.vipname+'邀请你成为会员?', | |
690 | + success: function (res) { | |
691 | + if (res.confirm) { | |
692 | + getApp().goto("/pages/togoin/togoin"); | |
693 | + } | |
694 | + } | |
695 | + }) | |
696 | + } | |
697 | + } | |
698 | + }) | |
699 | + }, | |
700 | + | |
701 | + | |
680 | 702 | unserialize: unserialize, |
681 | 703 | _throttle:_throttle, |
682 | 704 | unserialize_o: unserialize_o, | ... | ... |