Commit e4eccdea42c9be95993feead5bb074df48ce979b

Authored by taiyuan
1 parent b0bf0971

个人信息

packageA/pages/profile/profile.js
@@ -6,6 +6,8 @@ function e(e, a, r) { @@ -6,6 +6,8 @@ function e(e, a, r) {
6 writable: !0 6 writable: !0
7 }) : e[a] = r, e; 7 }) : e[a] = r, e;
8 } 8 }
  9 +const app = getApp();
  10 +let self = null;
9 11
10 var a = getApp(), 12 var a = getApp(),
11 r = a.globalData.setting, 13 r = a.globalData.setting,
@@ -17,10 +19,10 @@ var a = getApp(), @@ -17,10 +19,10 @@ var a = getApp(),
17 19
18 var timestamp = Date.parse(new Date()); 20 var timestamp = Date.parse(new Date());
19 var date = new Date(timestamp); 21 var date = new Date(timestamp);
20 -const {  
21 - barcode,  
22 - qrcode  
23 -} = require('../../../utils/index.js'); 22 +// const {
  23 +// barcode,
  24 +// qrcode
  25 +// } = require('../../../utils/index.js');
24 26
25 Page({ 27 Page({
26 data: { 28 data: {
@@ -31,7 +33,7 @@ Page({ @@ -31,7 +33,7 @@ Page({
31 defaultAvatar: r.resourceUrl + "/static/images/user68.jpg", 33 defaultAvatar: r.resourceUrl + "/static/images/user68.jpg",
32 user: null, 34 user: null,
33 tc_hide: true, 35 tc_hide: true,
34 - stoname: "", 36 + stoname: "请选择",
35 checkDate: false, 37 checkDate: false,
36 datet: "", 38 datet: "",
37 year: date.getFullYear(), 39 year: date.getFullYear(),
@@ -54,7 +56,7 @@ Page({ @@ -54,7 +56,7 @@ Page({
54 open_ind_store: 0, //哪里打开的门店列表的控制属性 56 open_ind_store: 0, //哪里打开的门店列表的控制属性
55 ispwhid: 1, //是否隐藏密码显示 57 ispwhid: 1, //是否隐藏密码显示
56 isstcsp: 0, //是否启用密码消费 58 isstcsp: 0, //是否启用密码消费
57 - isGender: 1, //什么性别 59 + isGender: 0, //什么性别
58 iscalendar: 0, //是否是农历 60 iscalendar: 0, //是否是农历
59 consumption: "", //消费密码 61 consumption: "", //消费密码
60 identity_card: "", //身份证值 62 identity_card: "", //身份证值
@@ -68,6 +70,7 @@ Page({ @@ -68,6 +70,7 @@ Page({
68 is_lable_set: "", //是否启用我的兴趣标签 70 is_lable_set: "", //是否启用我的兴趣标签
69 check_label: [], //我选择的兴趣标签 71 check_label: [], //我选择的兴趣标签
70 fir_guide_id:null, //存储会员详情接口出来的美导ID 72 fir_guide_id:null, //存储会员详情接口出来的美导ID
  73 + isLunar: 0,
71 74
72 }, 75 },
73 //通过路径跳转到其他页面 76 //通过路径跳转到其他页面
@@ -75,22 +78,8 @@ Page({ @@ -75,22 +78,8 @@ Page({
75 var url = e.currentTarget.dataset.url; 78 var url = e.currentTarget.dataset.url;
76 getApp().goto(url); 79 getApp().goto(url);
77 }, 80 },
78 - //获取配置信息  
79 - get_config: function() {  
80 - var th = this;  
81 - getApp().getConfig2(function(ee) {  
82 - var sms_conf = ee.switch_list;  
83 - sms_conf = JSON.parse(sms_conf);  
84 - th.setData({  
85 - is_lable_set: sms_conf.user_label_set, //是不是会员标签设置  
86 - guide_title:sms_conf.guide_consultant, //系统参数 导购标题  
87 - guide_change_time:sms_conf.guide_change_time //每月能修改几次  
88 - })  
89 - if (sms_conf.user_label_set) {  
90 - th.query_checklabels();  
91 - }  
92 - })  
93 - }, 81 +
  82 +
94 //查找会员选择的兴趣标签 83 //查找会员选择的兴趣标签
95 query_checklabels: function() { 84 query_checklabels: function() {
96 var th = this; 85 var th = this;
@@ -119,20 +108,8 @@ Page({ @@ -119,20 +108,8 @@ Page({
119 } 108 }
120 }) 109 })
121 }, 110 },
122 - //是否启动密码消费  
123 - isstcsp: function() {  
124 - var th = this;  
125 - var isstcsp = th.data.isstcsp;  
126 - if (isstcsp == 0) {  
127 - th.setData({  
128 - isstcsp: 1  
129 - })  
130 - } else {  
131 - th.setData({  
132 - isstcsp: 0  
133 - })  
134 - }  
135 - }, 111 +
  112 +
136 //出生日期是否是农历 113 //出生日期是否是农历
137 iscalendar: function() { 114 iscalendar: function() {
138 115
@@ -149,29 +126,8 @@ Page({ @@ -149,29 +126,8 @@ Page({
149 }) 126 })
150 } 127 }
151 }, 128 },
152 - //性别  
153 - isGender: function(e) {  
154 - var th = this;  
155 - var sex = e.currentTarget.dataset.sex;  
156 - th.setData({  
157 - isGender: sex  
158 - })  
159 - },  
160 - //密码是否隐藏显示  
161 - ispwhid: function() {  
162 - var th = this;  
163 - var ispwhid = th.data.ispwhid;  
164 -  
165 - if (ispwhid == 0) {  
166 - th.setData({  
167 - ispwhid: 1  
168 - })  
169 - } else {  
170 - th.setData({  
171 - ispwhid: 0  
172 - })  
173 - }  
174 - }, 129 +
  130 +
175 checkDate: function() { 131 checkDate: function() {
176 var th = this; 132 var th = this;
177 if (th.data.checkDate) { 133 if (th.data.checkDate) {
@@ -184,11 +140,9 @@ Page({ @@ -184,11 +140,9 @@ Page({
184 }) 140 })
185 } 141 }
186 }, 142 },
187 - bindChange: function(e) {  
188 - this.setData({  
189 - datet: e.detail.value,  
190 - });  
191 - }, 143 +
  144 +
  145 +
192 //---点击二级之后的选择--- 146 //---点击二级之后的选择---
193 choose_for_store: function(e) { 147 choose_for_store: function(e) {
194 var index_c = e.currentTarget.dataset.ind; 148 var index_c = e.currentTarget.dataset.ind;
@@ -198,6 +152,8 @@ Page({ @@ -198,6 +152,8 @@ Page({
198 fir_pick_index: index_c 152 fir_pick_index: index_c
199 }) 153 })
200 }, 154 },
  155 +
  156 +
201 //确定def_pick为选择的门店 157 //确定def_pick为选择的门店
202 sure_pick: function(e) { 158 sure_pick: function(e) {
203 var th = this; 159 var th = this;
@@ -273,8 +229,6 @@ Page({ @@ -273,8 +229,6 @@ Page({
273 }, 229 },
274 onclickstore: function() { 230 onclickstore: function() {
275 var th = this; 231 var th = this;
276 - //检验门店的点击,看下次数是不是到了  
277 - this.check_click_ok(function(){  
278 if (th.data.store == 0) { 232 if (th.data.store == 0) {
279 th.setData({ 233 th.setData({
280 store: 1 234 store: 1
@@ -432,9 +386,12 @@ Page({ @@ -432,9 +386,12 @@ Page({
432 }); 386 });
433 } 387 }
434 } 388 }
435 - }, 200) 389 + }, 200)
  390 + //检验门店的点击,看下次数是不是到了
  391 + // this.check_click_ok(function(){
  392 +
436 393
437 - },2) 394 + // },2)
438 395
439 }, 396 },
440 397
@@ -444,6 +401,7 @@ Page({ @@ -444,6 +401,7 @@ Page({
444 sort_store: 1 401 sort_store: 1
445 }); 402 });
446 }, 403 },
  404 +
447 //---选择分类门店--- 405 //---选择分类门店---
448 choice_sort_store: function(e) { 406 choice_sort_store: function(e) {
449 var index = e.currentTarget.dataset.index; 407 var index = e.currentTarget.dataset.index;
@@ -464,6 +422,8 @@ Page({ @@ -464,6 +422,8 @@ Page({
464 choice_sort_store: 0 422 choice_sort_store: 0
465 }); 423 });
466 }, 424 },
  425 +
  426 +
467 //身份证号严格校验 427 //身份证号严格校验
468 IdentityIDCard: function(e) { 428 IdentityIDCard: function(e) {
469 var code = e.detail.value; 429 var code = e.detail.value;
@@ -518,7 +478,7 @@ Page({ @@ -518,7 +478,7 @@ Page({
518 478
519 //区域数组中不包含需验证的身份证前两位 479 //区域数组中不包含需验证的身份证前两位
520 else if (!city[code.substr(0, 2)]) { 480 else if (!city[code.substr(0, 2)]) {
521 - errorMess = "您输入的身份证地址编码有误!"; 481 + errorMess = "您输入的身份证号格式有误!";
522 isPass = false; 482 isPass = false;
523 } else { 483 } else {
524 //18位身份证需要验证最后一位校验位 484 //18位身份证需要验证最后一位校验位
@@ -549,88 +509,81 @@ Page({ @@ -549,88 +509,81 @@ Page({
549 'isPass': isPass 509 'isPass': isPass
550 } 510 }
551 if (errorMess != "") { 511 if (errorMess != "") {
552 - wx.showModal({  
553 - title: errorMess,  
554 - content: '',  
555 - showCancel: false,  
556 - confirmText: '确定',  
557 - confirmColor: '',  
558 - success: function(res) {},  
559 - fail: function(res) {},  
560 - complete: function(res) {},  
561 - }) 512 + // wx.showModal({
  513 + // title: errorMess,
  514 + // content: '',
  515 + // showCancel: false,
  516 + // confirmText: '确定',
  517 + // confirmColor: '',
  518 + // success: function(res) {},
  519 + // fail: function(res) {},
  520 + // complete: function(res) {},
  521 + // })
  522 +
  523 + getApp().my_warnning(errorMess, 0, this);
  524 + this.setData({
  525 + id: null,
  526 + });
562 } 527 }
563 return returnParam; 528 return returnParam;
564 }, 529 },
565 //------初始化加载---------- 530 //------初始化加载----------
566 onLoad: function(t) { 531 onLoad: function(t) {
567 - var user = getApp().globalData.userInfo;  
568 - if (user.card_field != '' && user.card_field != null && user.card_field != undefined && user.card_expiredate) {  
569 - var now = ut.gettimestamp();  
570 - var str = user.card_expiredate.replace(/-/g, '/');;  
571 - var end = new Date(str);  
572 - end = Date.parse(end) / 1000;  
573 - if (now < end) {  
574 - this.puls_user();  
575 - }  
576 - }  
577 - this.initial_user();  
578 - },  
579 - //-----------会员是否初始化---------------------  
580 - initial_user: function() {  
581 -  
582 - var th = this;  
583 - getApp().request.get("/api/weshop/users/grade/vip/init/get", {  
584 - data: {  
585 - storeId: r.stoid,  
586 - },  
587 - success: function(su) {  
588 - var isBool = su.data.data.isBool;  
589 - th.setData({  
590 - isBool: isBool  
591 - });  
592 -  
593 - if (!isBool) return false;  
594 - //-----会员权益获取--------------  
595 - getApp().request.get("/api/weshop/users/grade/aftervipinfo/get", {  
596 - data: {  
597 - storeId: r.stoid,  
598 - userId: getApp().globalData.user_id,  
599 - },  
600 - success: function(su) {  
601 - var gradename = su.data.data.GradeName;  
602 - th.setData({  
603 - gradename: gradename  
604 - });  
605 - }  
606 - });  
607 -  
608 - }  
609 - });  
610 - this.get_config(); 532 + // var user = getApp().globalData.userInfo;
  533 + // if (user.card_field != '' && user.card_field != null && user.card_field != undefined && user.card_expiredate) {
  534 + // var now = ut.gettimestamp();
  535 + // var str = user.card_expiredate.replace(/-/g, '/');;
  536 + // var end = new Date(str);
  537 + // end = Date.parse(end) / 1000;
  538 + // if (now < end) {
  539 + // this.puls_user();
  540 + // }
  541 + // };
  542 + // this.initial_user();
  543 + self = this;
  544 + let url1 = '/api/weshop/storeconfig/get/';
  545 + let url2 = '/api/weshop/prom/coupon/get/';
  546 + url1 += r.stoid;
  547 +
  548 + app.request.get(url1, {
  549 + success: function(res) {
  550 + console.log('x-->', res.data.code, res.data.data.reg_type, res.data.data.reg_info);
  551 + if(res.data.code == 0) {
  552 + let reg_type = res.data.data.reg_type;
  553 + let reg_info = res.data.data.reg_info;
  554 + if(reg_type) { //reg_type为1才显示积分信息
  555 + if(reg_info) {
  556 + reg_info = JSON.parse(reg_info);
  557 + //获取优惠券
  558 + url2 += reg_info.reginfo_coupon;
  559 + app.request.get(url2, {
  560 + success: function(r) {
  561 + if(r.data.code == 0) {
  562 + console.log('000res==>', r.data.data.name);
  563 + self.setData({
  564 + couponInfo: r.data.data.name,
  565 + });
  566 + };
  567 + },
  568 + });
  569 + };
  570 + };
  571 + self.setData({
  572 + reg_type,
  573 + reg_info,
  574 + user: app.globalData.userInfo,
  575 + });
  576 + };
  577 +
  578 + },
  579 + });
  580 +
  581 +
611 }, 582 },
612 583
613 584
614 - //-----Plus会员获取-----------  
615 - puls_user: function() {  
616 - var th = this;  
617 - getApp().request.get("/api/weshop/plus/vip/mem/list", {  
618 - data: {  
619 - storeId: r.stoid,  
620 - userId: getApp().globalData.user_id,  
621 - },  
622 - success: function(su) {  
623 -  
624 - if (su.data.code == 0) {  
625 - var cardname = su.data.data[0].MemCardName;  
626 - th.setData({  
627 - pulscardname: cardname  
628 - });  
629 - }  
630 - }  
631 - });  
632 - },  
633 585
  586 +
634 onShow: function() { 587 onShow: function() {
635 var e = this; 588 var e = this;
636 if (this.data.is_zy) return false; 589 if (this.data.is_zy) return false;
@@ -644,44 +597,44 @@ Page({ @@ -644,44 +597,44 @@ Page({
644 } 597 }
645 598
646 var req = t; 599 var req = t;
647 - req.get("/api/weshop/users/getAndUpdateUser/" + r.stoid + "/" + getApp().globalData.user_id, {  
648 - success: function(src) {  
649 - var a = src.data.data;  
650 -  
651 - if(!a) a={};  
652 - var time ="",birthday ="";  
653 - if(a && a.reg_time) time=util.formatTime(a.reg_time, "'Y/M/D");  
654 - if(a && a.birthday) birthday=util.formatTime(a.birthday, "'Y/M/D"); 600 + // req.get("/api/weshop/users/getAndUpdateUser/" + r.stoid + "/" + getApp().globalData.user_id, {
  601 + // success: function(src) {
  602 + // var a = src.data.data;
  603 +
  604 + // if(!a) a={};
  605 + // var time ="",birthday ="";
  606 + // if(a && a.reg_time) time=util.formatTime(a.reg_time, "'Y/M/D");
  607 + // if(a && a.birthday) birthday=util.formatTime(a.birthday, "'Y/M/D");
655 608
656 - a.reg_time = time;  
657 - a.birthday = birthday 609 + // a.reg_time = time;
  610 + // a.birthday = birthday
658 611
659 - if(a.address=='null' || !a.address){  
660 - a.address="";  
661 - } 612 + // if(a.address=='null' || !a.address){
  613 + // a.address="";
  614 + // }
662 615
663 - e.data.fir_guide_id=a.staffId;  
664 - if(choice_guide){  
665 - a.staffName=choice_guide.StaffName;  
666 - a.staffId=choice_guide.Id;  
667 - } 616 + // e.data.fir_guide_id=a.staffId;
  617 + // if(choice_guide){
  618 + // a.staffName=choice_guide.StaffName;
  619 + // a.staffId=choice_guide.Id;
  620 + // }
668 621
669 622
670 - e.setData({  
671 - phone: a.mobile,  
672 - user: a,  
673 - openid: a.openid,  
674 - sto_sele_id: a.pickup_id,  
675 - consumption: a.paypwd,  
676 - identity_card: a.idcard,  
677 - address: a.address,  
678 - isGender: a.sex,  
679 - isstcsp: a.vipnopwd,  
680 - iscalendar:a.islunar  
681 - }); 623 + // e.setData({
  624 + // // phone: a.mobile,
  625 + // user: a,
  626 + // openid: a.openid,
  627 + // sto_sele_id: a.pickup_id,
  628 + // consumption: a.paypwd,
  629 + // // identity_card: a.idcard,
  630 + // address: a.address,
  631 + // // isGender: a.sex,
  632 + // // isstcsp: a.vipnopwd,
  633 + // // iscalendar:a.islunar
  634 + // });
682 635
683 - }  
684 - }) 636 + // }
  637 + // })
685 a.getUserInfo(function(a) { 638 a.getUserInfo(function(a) {
686 var txt = util.formatTime(a.birthday, 'yyyy-M-d'), 639 var txt = util.formatTime(a.birthday, 'yyyy-M-d'),
687 arr = txt.split(' '); 640 arr = txt.split(' ');
@@ -695,7 +648,7 @@ Page({ @@ -695,7 +648,7 @@ Page({
695 if(da.data.data){ 648 if(da.data.data){
696 //设置门店 649 //设置门店
697 e.setData({ 650 e.setData({
698 - stoname: da.data.data.pickup_name 651 + // stoname: da.data.data.pickup_name
699 }); 652 });
700 } 653 }
701 654
@@ -714,34 +667,7 @@ Page({ @@ -714,34 +667,7 @@ Page({
714 }, !0); 667 }, !0);
715 }, 668 },
716 669
717 - editUserInfo: function(e) {  
718 - var r = e.currentTarget.dataset.type;  
719 - if (("password" == r || "paypwd" == r) && !this.data.user.mobile) return a.showWarning("请先绑定手机号码");  
720 - r && this.data.user && wx.navigateTo({  
721 - url: "/pages/user/userinfo_edit/userinfo_edit?type=" + r  
722 - });  
723 - },  
724 670
725 - /*--------------------修改头像---------------------*/  
726 - changeAvatar: function() {  
727 - return false;  
728 - var r = this;  
729 - wx.chooseImage({  
730 - count: 1,  
731 - sizeType: ["compressed", "original"],  
732 - sourceType: ["camera", "album"],  
733 - success: function(u) {  
734 - t.uploadFile(r.data.url + "/api/user/upload_headpic", {  
735 - filePath: u.tempFilePaths[0],  
736 - name: "head_pic",  
737 - success: function(t) {  
738 - var u = s.getFullUrl(t.data.result);  
739 - r.setData(e({}, "user.head_pic", u)), a.globalData.userInfo.head_pic = u, a.showSuccess("设置头像成功");  
740 - }  
741 - });  
742 - }  
743 - });  
744 - },  
745 671
746 672
747 //------卡片的显示和关闭-------- 673 //------卡片的显示和关闭--------
@@ -762,14 +688,8 @@ Page({ @@ -762,14 +688,8 @@ Page({
762 tc_hide: true, 688 tc_hide: true,
763 }); 689 });
764 }, 690 },
765 - //消费密码输入框失去焦点事件  
766 - lose_focus: function(e) {  
767 - var th = this;  
768 - var val = e.detail.value;  
769 - this.setData({  
770 - consumption: val  
771 - })  
772 - }, 691 +
  692 +
773 693
774 //地址 694 //地址
775 address: function(e) { 695 address: function(e) {
@@ -779,27 +699,19 @@ Page({ @@ -779,27 +699,19 @@ Page({
779 }); 699 });
780 }, 700 },
781 701
782 - //身份证验证  
783 - identity_card: function(e) {  
784 - var val = e.detail;  
785 -  
786 - this.setData({  
787 - identity_card: val.value  
788 - });  
789 -  
790 - }, 702 +
791 //用户名字 703 //用户名字
792 - user_name: function(e) {  
793 - var th = this;  
794 - var name = e.detail.value;  
795 - var vipname = 'user.vipname';  
796 - if (name != "" || name != null) {  
797 - th.setData({  
798 - [vipname]: name  
799 - });  
800 - } 704 + // user_name: function(e) {
  705 + // var th = this;
  706 + // var name = e.detail.value;
  707 + // var vipname = 'user.vipname';
  708 + // if (name != "" || name != null) {
  709 + // th.setData({
  710 + // [vipname]: name
  711 + // });
  712 + // }
801 713
802 - }, 714 + // },
803 715
804 //点击确认修改信息 716 //点击确认修改信息
805 confirm_revision: function() { 717 confirm_revision: function() {
@@ -878,13 +790,13 @@ Page({ @@ -878,13 +790,13 @@ Page({
878 // this.setData({ is_zy: 1 }); 790 // this.setData({ is_zy: 1 });
879 }, 791 },
880 //更换手机 792 //更换手机
881 - go_phone: function(e) {  
882 - var url = e.currentTarget.dataset.url;  
883 - this.setData({  
884 - is_zy: 1  
885 - });  
886 - getApp().goto(url);  
887 - }, 793 + // go_phone: function(e) {
  794 + // var url = e.currentTarget.dataset.url;
  795 + // this.setData({
  796 + // is_zy: 1
  797 + // });
  798 + // getApp().goto(url);
  799 + // },
888 800
889 //--点击分享事件--- 801 //--点击分享事件---
890 onShareAppMessage: function(t) { 802 onShareAppMessage: function(t) {
@@ -911,7 +823,267 @@ Page({ @@ -911,7 +823,267 @@ Page({
911 } 823 }
912 } 824 }
913 }); 825 });
914 - } 826 + },
  827 +
  828 + //获取输入框内容
  829 + getInput(e) {
  830 + return e.detail.value;
  831 + },
  832 +
  833 + verifyInput(e) {
  834 + let value = e.detail.value;
  835 + if (value == "" || value == null || value == undefined) {
  836 + app.my_warnning("请输入" + name, 0, this);
  837 + }
  838 + },
  839 +
  840 + //获取推荐人
  841 + getReferee(e) {
  842 + let referee = this.getInput(e);
  843 + this.data.referee = referee;
  844 + console.log(referee);
  845 + },
  846 +
  847 + //获取姓名
  848 + getName(e) {
  849 + let name = this.getInput(e);
  850 + this.data.name = name;
  851 + },
  852 +
  853 + //获取性别
  854 + getGender(e) {
  855 + let sex = e.currentTarget.dataset.sex;
  856 + this.setData({
  857 + isGender: sex,
  858 + });
  859 + },
  860 +
  861 + //获取身份证
  862 + getId(e) {
  863 + let id = this.getInput(e);
  864 + this.data.id = id;
  865 + },
  866 +
  867 + //验证身份证号码
  868 + // verifyId(e) {
  869 + // let id = this.data.id;
  870 + // if(id) {
  871 + // if (id != null && id != undefined && id != "" && !(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(id))) {
  872 + // getApp().my_warnning("身份证号码无效!", 0, this);
  873 + // }
  874 + // };
  875 + // },
  876 +
  877 + //获取地址
  878 + getAddress(e) {
  879 + let address = this.getInput(e);
  880 + this.data.address = address;
  881 + },
  882 +
  883 + //获取生日
  884 + bindChange: function(e) {
  885 + let strBirthday = e.detail.value;
  886 + let age = this.verifyBirthday(strBirthday);
  887 +
  888 + if(age <= 10) {
  889 + app.my_warnning("会员年龄不能小于10岁(含10岁)", 0, this);
  890 + } else if(age >= 70) {
  891 + app.my_warnning("会员年龄不能超过70岁(含70岁)", 0, this);
  892 + } else {
  893 + this.setData({
  894 + datet: e.detail.value,
  895 + });
  896 + };
  897 +
  898 + // console.log(this.data.datet, this.data.isCalendar);
  899 + },
  900 +
  901 + // 生日判断
  902 + verifyBirthday(strBirthday) {
  903 + var returnAge;
  904 + var strBirthdayArr = strBirthday.split("-");
  905 + var birthYear = strBirthdayArr[0];
  906 + var birthMonth = strBirthdayArr[1];
  907 + var birthDay = strBirthdayArr[2];
  908 +
  909 + d = new Date();
  910 + var nowYear = d.getFullYear();
  911 + var nowMonth = d.getMonth() + 1;
  912 + var nowDay = d.getDate();
  913 +
  914 + if(nowYear == birthYear){
  915 + returnAge = 0;//同年 则为0岁
  916 + } else {
  917 + var ageDiff = nowYear - birthYear ; //年之差
  918 + if(ageDiff > 0){
  919 + if(nowMonth == birthMonth) {
  920 + var dayDiff = nowDay - birthDay;//日之差
  921 + if(dayDiff < 0)
  922 + {
  923 + returnAge = ageDiff - 1;
  924 + }
  925 + else
  926 + {
  927 + returnAge = ageDiff ;
  928 + }
  929 + }
  930 + else
  931 + {
  932 + var monthDiff = nowMonth - birthMonth;//月之差
  933 + if(monthDiff < 0)
  934 + {
  935 + returnAge = ageDiff - 1;
  936 + }
  937 + else
  938 + {
  939 + returnAge = ageDiff ;
  940 + }
  941 + }
  942 + }
  943 + else
  944 + {
  945 + returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天
  946 + }
  947 + }
  948 + return returnAge;//返回周岁年龄
  949 + },
  950 +
  951 + //是否为农历
  952 + isLunar(e) {
  953 + let isLunar = null;
  954 + if(e.detail.value[0]) {
  955 + isLunar = 1;
  956 + } else {
  957 + isLunar = 0;
  958 + };
  959 + this.data.isLunar = isLunar;
  960 + // console.log(isLunar);
  961 + },
  962 +
  963 + // 是否同意协议
  964 + isAgree(e) {
  965 + let isAgree = null;
  966 + if(e.detail.value[0]) {
  967 + isAgree = true;
  968 + } else {
  969 + isAgree = false;
  970 + };
  971 + this.data.isAgree = isAgree;
  972 + console.log(isAgree);
  973 + },
  974 +
  975 +
  976 + //保存
  977 + save: function() {
  978 + var th = this;
  979 + let isAgree = this.data.isAgree;
  980 + // 同意协议
  981 + if(isAgree) {
  982 + var sto_sele_id = self.data.sto_sele_id;
  983 + var data = {
  984 + store_id: r.stoid,
  985 + user_id: app.globalData.user_id,
  986 + tjrname: self.data.referee, //推荐人
  987 + vipname: self.data.name, //名称
  988 + sex: self.data.isGender, //性别
  989 + birthday: self.data.datet,
  990 + islunar: self.data.isLunar,
  991 + idcard: self.data.id,
  992 + address: self.data.address,
  993 + pickup_id: sto_sele_id ,//自提门店 所属门店
  994 + };
  995 +
  996 +
  997 + console.log('data==>', data);
  998 +
  999 + app.request.put("/api/weshop/users/updateInfo", {
  1000 + data: data,
  1001 + success: function(res) {
  1002 + if (res.data.code == 0) {
  1003 + getApp().my_warnning("保存成功", 1, self);
  1004 + getApp().goto("/pages/user/index/index");
  1005 + } else {
  1006 + getApp().my_warnning(res.data.msg, 0, self);
  1007 + };
  1008 + }
  1009 + })
  1010 +
  1011 + } else {
  1012 + app.my_warnning("保存前需要您同意指定协议和政策", 0, self);
  1013 + };
  1014 + // var isstcsp = th.data.isstcsp; //是否启用消费密码
  1015 + // var phone = th.data.phone; //手机号码
  1016 + // if (phone == "" || phone == null) {
  1017 + // getApp().my_warnning("手机不能为空", 0, th);
  1018 + // return false;
  1019 + // }
  1020 + // var consumption = th.data.consumption; //消费密码
  1021 + // var isstcsp = th.data.isstcsp;
  1022 + // if (isstcsp == 1) {
  1023 +
  1024 + // if (consumption == null || consumption == "" || consumption == undefined) {
  1025 + // getApp().my_warnning("消费密码不能为空", 0, th);
  1026 + // return false;
  1027 + // }
  1028 + // if (consumption.length < 6) {
  1029 + // getApp().my_warnning("消费密码不能小于6位", 0, th);
  1030 + // return false;
  1031 + // }
  1032 + // }
  1033 + // var sex = th.data.isGender; //性别
  1034 +
  1035 + // if (sex != "1" && sex != "2") {
  1036 + // getApp().my_warnning("请选择性别", 0, th);
  1037 + // return false;
  1038 + // }
  1039 + // var vipname = th.data.user.vipname; //用户姓名
  1040 + // if (user_name == "" || user_name == null) {
  1041 + // getApp().my_warnning("请输入名字", 0, th);
  1042 + // return false;
  1043 + // }
  1044 + // var identity_card = th.data.identity_card; //身份证
  1045 +
  1046 + // if (identity_card!=null && identity_card!=undefined && identity_card != "" && !(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identity_card))) {
  1047 + // getApp().my_warnning("身份证号码错误", 0, th);
  1048 + // return false;
  1049 + // }
  1050 + // var address = th.data.address; //地址
  1051 + // var sto_sele_id = self.data.sto_sele_id;
  1052 + // var data = {
  1053 + // store_id: r.stoid,
  1054 + // user_id: app.globalData.user_id,
  1055 + // tjrname: self.data.referee, //推荐人
  1056 + // vipname: self.data.name, //名称
  1057 + // sex: self.data.isGender, //性别
  1058 + // birthday: self.data.datet,
  1059 + // islunar: self.data.isLunar,
  1060 + // idcard: self.data.id,
  1061 + // address: self.data.address,
  1062 + // pickup_id: sto_sele_id ,//自提门店 所属门店
  1063 + // };
  1064 +
  1065 + // console.log('data==>', data);
  1066 + //往上提交美导的ID
  1067 + // if(th.data.fir_guide_id!=th.data.user.staffId){
  1068 + // datas.staffId=th.data.user.staffId;
  1069 + // }
  1070 +
  1071 + // app.request.put("/api/weshop/users/updateInfo", {
  1072 + // data: data,
  1073 + // success: function(res) {
  1074 + // if (res.data.code == 0) {
  1075 + // getApp().my_warnning("保存成功", 1, self);
  1076 + // getApp().goto("/pages/user/index/index");
  1077 + // } else {
  1078 + // getApp().my_warnning("系统繁忙,请稍后再试", 0, self);
  1079 + // };
  1080 + // }
  1081 + // })
  1082 + },
  1083 +
  1084 +
  1085 +
  1086 +
915 1087
916 1088
917 }); 1089 });
918 \ No newline at end of file 1090 \ No newline at end of file
packageA/pages/profile/profile.wxml
@@ -24,22 +24,24 @@ @@ -24,22 +24,24 @@
24 24
25 <view class="user-container"> 25 <view class="user-container">
26 <view class="Bbottom"> 26 <view class="Bbottom">
27 - <view bindtap="editUserInfo1" class="user-name flex-vertical" data-type="nickname"> 27 + <view bindtap="editUserInfo1" class="user-name flex-vertical" data-type="nickname" wx:if="{{reg_info.introducer_state}}">
28 <view class="user-name-txt">推荐人:</view> 28 <view class="user-name-txt">推荐人:</view>
29 - <input bindblur="user_name" class="user-txt-right f1 pdl20 t-r" placeholder="请输入推荐人手机号码或卡号"/>  
30 - <view class="c-red pdl20 fs24">可获10积分</view> 29 + <input bindinput="getReferee" bindblur="" data-name="推荐人" class="user-txt-right f1 pdl20 t-r" placeholder="请输入推荐人手机号码或卡号"/>
  30 + <view class="c-red pdl20 fs24" wx:if="{{reg_info.introducer && (reg_info.introducer_type == 0)}}">+{{reg_info.introducer}}积分</view>
  31 + <view class="c-red pdl20 fs24" wx:elif="{{reg_info.introducer && (reg_info.introducer_type == 1)}}">+{{reg_info.introducer}}成长值</view>
31 </view> 32 </view>
32 33
33 - <view bindtap="editUserInfo1" class="user-name flex-vertical" data-type="nickname"> 34 + <view bindtap="editUserInfo1" class="user-name flex-vertical" data-type="nickname" wx:if="{{reg_info.name_state}}">
34 <view class="user-name-txt">姓名:</view> 35 <view class="user-name-txt">姓名:</view>
35 - <input bindblur="user_name" class="user-txt-right f1 pdl20 t-r" placeholder="请输入您的真实姓名"/>  
36 - <view class="c-red pdl20 fs24">可获10积分</view> 36 + <input bindinput="getName" bindblur="" data-name="姓名" class="user-txt-right f1 pdl20 t-r" placeholder="请输入您的真实姓名"/>
  37 + <view class="c-red pdl20 fs24" wx:if="{{reg_info.name && (reg_info.name_val_type == 0)}}">+{{reg_info.name}}积分</view>
  38 + <view class="c-red pdl20 fs24" wx:elif="{{reg_info.name && (reg_info.name_val_type == 1)}}">+{{reg_info.name}}成长值</view>
37 </view> 39 </view>
38 40
39 - <view bindtap="editUserInfo1" class="user-name flex-vertical" data-type="sex"> 41 + <view class="user-name flex-vertical" data-type="sex" wx:if="{{reg_info.sex_state}}">
40 <view>性别:</view> 42 <view>性别:</view>
41 <view class="flex f1 pdl20 jc_fe"> 43 <view class="flex f1 pdl20 jc_fe">
42 - <view class="flex-center {{isGender==1?'Gendercheck':'Gender'}}" data-sex="1" bindtap="isGender"> 44 + <view class="flex-center {{isGender==1?'Gendercheck':'Gender'}}" data-sex="1" bindtap="getGender">
43 <block wx:if="{{isGender==1}}"> 45 <block wx:if="{{isGender==1}}">
44 <image class="GenderImage" src="{{iurl}}/miniapp/images/userinfo/userinfo/malealready.png"></image> 46 <image class="GenderImage" src="{{iurl}}/miniapp/images/userinfo/userinfo/malealready.png"></image>
45 </block> 47 </block>
@@ -48,7 +50,7 @@ @@ -48,7 +50,7 @@
48 </block> 50 </block>
49 <view class="fs24">男</view> 51 <view class="fs24">男</view>
50 </view> 52 </view>
51 - <view class="flex-center {{isGender==2?'Gendercheck':'Gender'}} mgl20" data-sex="2" bindtap="isGender"> 53 + <view class="flex-center {{isGender==2?'Gendercheck':'Gender'}} mgl20" data-sex="2" bindtap="getGender">
52 <block wx:if="{{isGender==2}}"> 54 <block wx:if="{{isGender==2}}">
53 <image class="GenderImage" src="{{iurl}}/miniapp/images/userinfo/userinfo/femalealready.png"></image> 55 <image class="GenderImage" src="{{iurl}}/miniapp/images/userinfo/userinfo/femalealready.png"></image>
54 </block> 56 </block>
@@ -58,86 +60,93 @@ @@ -58,86 +60,93 @@
58 <view class="fs26">女</view> 60 <view class="fs26">女</view>
59 </view> 61 </view>
60 </view> 62 </view>
61 - <view class="c-red pdl20 fs24">可获10积分</view> 63 + <view class="c-red pdl20 fs24" wx:if="{{reg_info.sex && (reg_info.sex_state_type == 0)}}">+{{reg_info.sex}}积分</view>
  64 + <view class="c-red pdl20 fs24" wx:elif="{{reg_info.sex && (reg_info.sex_state_type == 1)}}">+{{reg_info.sex}}成长值</view>
62 </view> 65 </view>
63 66
64 - <view bindtap="editUserInfo1" class="user-name flex-vertical" data-type="sex"> 67 + <view class="user-name flex-vertical" data-type="sex" wx:if="{{reg_info.birthday_state}}">
65 <view class="shrink0">出生日期:</view> 68 <view class="shrink0">出生日期:</view>
66 <view class="flex fs28 Birth pdl20 jc_fe"> 69 <view class="flex fs28 Birth pdl20 jc_fe">
67 - <view class="flex" bindtap="iscalendar">  
68 -  
69 - <block wx:if="{{iscalendar}}">  
70 - <view class="flex-center">  
71 - <icon size="20" type="success" color="rgb(212,2,31)"></icon>  
72 - </view>  
73 - </block>  
74 - <block wx:else>  
75 - <icon size="20" type="success" color="rgb(0, 0, 0, 0.4)"></icon>  
76 - </block>  
77 -  
78 -  
79 - <view class="flex-center">  
80 - <view class="Mleft">农历</view>  
81 - </view>  
82 - </view>  
83 - <view class="user-txt-right pdl20">  
84 - <!-- 填充数据的时候要判断是否已经有出生日期,有值的话就不可修改 -->  
85 - <block wx:if="{{user.birthday==''||user.birthday==null}}">  
86 - <picker bindchange='bindChange' value="{{datet}}" mode="date" start="{{year-70}}-1-1" end="{{year}}-12-31">  
87 - {{datet?datet:"请选择时间"}} 70 + <view class="user-txt-right pdl20 flex ai-center">
  71 + <checkbox-group bindchange="isLunar">
  72 + <label class="flex ai-center">
  73 + <checkbox value="{{isLunar}}"/>农历
  74 + </label>
  75 + </checkbox-group>
  76 + <picker class="pdl20" bindchange='bindChange' mode="date" start="{{year-70}}-1-1" end="{{year}}-12-31">
  77 + <view class="flex ai-center">{{datet?datet:"请选择时间"}}<view class="angle">∟</view></view>
88 </picker> 78 </picker>
89 - </block>  
90 - <block wx:else>  
91 - <view>{{datet==""? user.birthday==""?"":filters.replace_time2(user.birthday):datet}}</view>  
92 - </block> 79 +
93 80
94 </view> 81 </view>
95 </view> 82 </view>
96 - <view class="c-red pdl20 fs24 shrink0">可获10积分</view> 83 + <view class="c-red pdl20 fs24 shrink0" wx:if="{{reg_info.birthday && (reg_info.birthday_type == 0)}}">+{{reg_info.birthday}}积分</view>
  84 + <view class="c-red pdl20 fs24 shrink0" wx:elif="{{reg_info.birthday && (reg_info.birthday_type == 1)}}">+{{reg_info.birthday}}成长值</view>
97 </view> 85 </view>
98 86
99 87
100 - <view bindtap="editUserInfo1" class="user-name flex-vertical" data-type="nickname">  
101 - <view class="user-name-txt shrink0">身份证号码:</view>  
102 - <input bindblur="identity_card" class="user-txt-right pdl20 f1 t-r" value="{{user.idcard}}" placeholder="请输入身份证号码"></input>  
103 - <view class="c-red pdl20 fs24 shrink0">可获10积分</view> 88 + <view class="user-name flex-vertical" data-type="nickname" wx:if="{{reg_info.idcard_state}}">
  89 + <view class="user-name-txt shrink0">身份证:</view>
  90 + <input bindinput="getId" bindblur="IdentityIDCard" class="user-txt-right pdl20 f1 t-r" placeholder="请输入身份证号码"></input>
  91 + <view class="c-red pdl20 fs24" wx:if="{{reg_info.idcard && (reg_info.idcard_type == 0)}}">+{{reg_info.idcard}}积分</view>
  92 + <view class="c-red pdl20 fs24" wx:elif="{{reg_info.idcard && (reg_info.idcard_type == 1)}}">+{{reg_info.idcard}}成长值</view>
104 </view> 93 </view>
105 94
106 95
107 - <view class="user-name flex-vertical" data-type="mobile"> 96 + <view class="user-name flex-vertical" data-type="mobile" wx:if="{{reg_info.address_state}}">
108 <view class="user-name-txt">地址:</view> 97 <view class="user-name-txt">地址:</view>
109 - <input bindblur="address" maxlength="30" value="{{user.address}}" class="user-txt-right f1" placeholder="请输入详细地址" style="text-align:right" />  
110 - <view class="c-red pdl20 fs24">可获10积分</view> 98 + <input bindinput="getAddress" bindblur="" data-name="姓名" class="user-txt-right f1" placeholder="请输入详细地址" style="text-align:right" />
  99 + <view class="c-red pdl20 fs24" wx:if="{{reg_info.address && (reg_info.address_type == 0)}}">+{{reg_info.address}}积分</view>
  100 + <view class="c-red pdl20 fs24" wx:elif="{{reg_info.address && (reg_info.address_type == 1)}}">+{{reg_info.address}}成长值</view>
111 </view> 101 </view>
112 102
113 103
114 - <view bindtap="" class="user-name flex-vertical" data-type="mobile">  
115 - <view class="user-name-txt">手机:</view>  
116 - <input bindblur="" class="user-txt-right f1 pdl20 t-r" placeholder="请输入手机号码"/>  
117 - <view class="c-red pdl20 fs24">可获10积分</view>  
118 - </view>  
119 -  
120 - <view bindtap="editUserInfo1" class="user-name flex-vertical" data-type="nickname">  
121 - <view class="user-name-txt">验证码:</view>  
122 - <input bindblur="" class="user-txt-right f1 pdl20 t-r" placeholder="请输入"/>  
123 - <view class="mgl20 fs24 btn pd10">获取验证码</view>  
124 - </view> 104 +
125 105
126 106
127 <!-- 选择门店 --> 107 <!-- 选择门店 -->
128 - <view bindtap="onclickstore" class="user-name flex-vertical" data-type="email"> 108 + <view bindtap="onclickstore" class="user-name flex-vertical" data-type="email" wx:if="{{reg_info.pick_state}}">
129 <view class="user-name-txt">所属门店:</view> 109 <view class="user-name-txt">所属门店:</view>
130 <view class="user-txt-right f1 flex ai_c jc_fe"> 110 <view class="user-txt-right f1 flex ai_c jc_fe">
131 <view class="one-line">{{stoname}}</view> 111 <view class="one-line">{{stoname}}</view>
132 <view class="angle">∟</view> 112 <view class="angle">∟</view>
133 </view> 113 </view>
134 - <view class="c-red pdl20 fs24">可获10积分</view> 114 + <view class="c-red pdl20 fs24" wx:if="{{reg_info.pick && (reg_info.pick_type == 0)}}">+{{reg_info.pick}}积分</view>
  115 + <view class="c-red pdl20 fs24" wx:elif="{{reg_info.pick && (reg_info.pick_type == 1)}}">+{{reg_info.pick}}成长值</view>
135 </view> 116 </view>
136 117
  118 + <!-- 我的兴趣 -->
  119 + <view wx:if="{{ isBool==1 && is_lable_set==1}}" class="padding Bbottom">
  120 + <!-- 我的兴趣 -->
  121 + <view wx:if="{{is_lable_set!=null && is_lable_set==1}}" class="Bbottom">
  122 + <view class="interest fs28">
  123 + <view class="flex-vertical-between" bindtap="goto" data-url="/pages/user/labels/labels">
  124 + <view class="fs30">我的兴趣</view>
  125 + <view class="angle">∟</view>
  126 + </view>
  127 + <!-- 选中的标签 -->
  128 + <view class="lables">
  129 + <block wx:if="{{check_label.length>0}}">
  130 + <view class="lable" wx:for="{{check_label}}" wx:for-item="label">
  131 + <view class="ellipsis-1">{{label}}</view>
  132 + </view>
  133 + </block>
  134 + <!-- 添加标签按钮 -->
  135 + <view class="add_lable ib ellipsis-1" bindtap="goto" data-url="/pages/user/labels/labels">
  136 + <text class="plus">+</text>
  137 + <text>标签</text>
  138 + </view>
  139 + </view>
  140 + </view>
  141 + </view>
  142 + </view>
  143 +
137 144
138 <view bindtap="" class="user-name flex-vertical fs24"> 145 <view bindtap="" class="user-name flex-vertical fs24">
139 - <checkbox/>  
140 - <view class="user-name-txt">我已阅读同意 <text class="red">《用户使用协议》</text>与<text class="red">《隐私政策》</text></view> 146 + <checkbox-group bindchange="isAgree">
  147 + <checkbox value="true"/>
  148 + </checkbox-group>
  149 + <view class="user-name-txt">我已阅读同意 <text class="red" bindtap="goto" data-url="/packageA/pages/parseHtml/parseHtml?t=0">《用户使用协议》</text>与<text class="red" bindtap="goto" data-url="/packageA/pages/parseHtml/parseHtml?t=1">《隐私政策》</text></view>
141 </view> 150 </view>
142 151
143 </view> 152 </view>
@@ -145,8 +154,8 @@ @@ -145,8 +154,8 @@
145 154
146 <!-- 保存按钮 --> 155 <!-- 保存按钮 -->
147 <view class="confirm"> 156 <view class="confirm">
148 - <view class="fs30 confirmtext" bindtap="confirm_revision">保存</view>  
149 - <view class="star fs24 t-c pdt10 c9">保存成功即可获得一张20.00元优惠券</view> 157 + <view class="fs30 confirmtext" bindtap="save">保存</view>
  158 + <view class="star fs24 t-c pdt10 c9" wx:if="{{couponInfo}}">保存成功即可获得一张{{couponInfo}}</view>
150 </view> 159 </view>
151 160
152 <!--弹出层内容,其中的“我知道”中绑定让弹出层消失的函数:bindtap="hide"--> 161 <!--弹出层内容,其中的“我知道”中绑定让弹出层消失的函数:bindtap="hide"-->
packageA/pages/profile/profile.wxss
@@ -623,7 +623,7 @@ input { @@ -623,7 +623,7 @@ input {
623 } 623 }
624 624
625 .interest { 625 .interest {
626 - padding: 0rpx 20rpx; 626 + /* padding: 0rpx 20rpx; */
627 padding-top: 30rpx; 627 padding-top: 30rpx;
628 padding-bottom: 30rpx; 628 padding-bottom: 30rpx;
629 } 629 }