Commit 4d43dc8561710492130efa8d16df9b43db0bddfc

Authored by 后端开发-许程
1 parent 240a354d

会员资料保存更新

pages/user/userinfo/userinfo.js
@@ -57,6 +57,7 @@ Page({ @@ -57,6 +57,7 @@ Page({
57 pulscardname:"",//puls会员的卡 57 pulscardname:"",//puls会员的卡
58 gradename:"",//会员权益的卡 58 gradename:"",//会员权益的卡
59 isBool:"", 59 isBool:"",
  60 + sto_sele_id:"",//所属门店id
60 }, 61 },
61 //是否启动密码消费 62 //是否启动密码消费
62 isstcsp:function(){ 63 isstcsp:function(){
@@ -519,7 +520,7 @@ Page({ @@ -519,7 +520,7 @@ Page({
519 console.log("会员是否初始化", isBool); 520 console.log("会员是否初始化", isBool);
520 th.setData({isBool:isBool}); 521 th.setData({isBool:isBool});
521 } 522 }
522 - }); 523 + });
523 }, 524 },
524 //-----会员等级卡获取--------------- 525 //-----会员等级卡获取---------------
525 equity_user:function(){ 526 equity_user:function(){
@@ -559,6 +560,25 @@ Page({ @@ -559,6 +560,25 @@ Page({
559 this.wait_for_store_config(); 560 this.wait_for_store_config();
560 var e = this; 561 var e = this;
561 var req = t; 562 var req = t;
  563 + req.get("/api/weshop/users/getAndUpdateUser/" + r.stoid + "/" + getApp().globalData.user_id, {
  564 + success: function (src) {
  565 + var a=src.data.data;
  566 + console.log(a,"剩什么llllll",a.data);
  567 + var time = util.formatTime(a.reg_time,"'Y/M/D");
  568 + var birthday = util.formatTime(a.birthday, "'Y/M/D");
  569 + a.reg_time = time;
  570 + a.birthday = birthday
  571 + e.setData({
  572 + phone: a.mobile,
  573 + user: a,
  574 + openid: a.openid,
  575 + sto_sele_id: a.pickup_id,
  576 + consumption: a.paypwd,
  577 + identity_card:a.idcard,
  578 +
  579 + });
  580 + }
  581 + })
562 a.getUserInfo(function(a) { 582 a.getUserInfo(function(a) {
563 var txt = util.formatTime(a.birthday, 'yyyy-M-d'), 583 var txt = util.formatTime(a.birthday, 'yyyy-M-d'),
564 arr = txt.split(' '); 584 arr = txt.split(' ');
@@ -581,17 +601,11 @@ Page({ @@ -581,17 +601,11 @@ Page({
581 // phone+=a.mobile.substr(0, 3)+"****"; 601 // phone+=a.mobile.substr(0, 3)+"****";
582 // phone += a.mobile.substr(7, 12); 602 // phone += a.mobile.substr(7, 12);
583 603
  604 +
584 605
585 - e.setData({  
586 - phone: a.mobile,  
587 - user: a,  
588 - openid: a.openid,  
589 - consumption: a.paypwd,  
590 - });  
591 -  
592 - e.setData({  
593 - isGender:e.data.user.sex  
594 - }) 606 + // e.setData({
  607 + // isGender:e.data.user.sex
  608 + // })
595 }, !0); 609 }, !0);
596 }, 610 },
597 611
@@ -644,6 +658,7 @@ Page({ @@ -644,6 +658,7 @@ Page({
644 if (val.length > 6 || val!=""){ 658 if (val.length > 6 || val!=""){
645 659
646 this.setData({ consumption: val }); 660 this.setData({ consumption: val });
  661 + console.log("是什么东西", val);
647 } 662 }
648 663
649 664
@@ -677,6 +692,7 @@ Page({ @@ -677,6 +692,7 @@ Page({
677 //点击确认修改信息 692 //点击确认修改信息
678 confirm_revision:function(){ 693 confirm_revision:function(){
679 var th=this; 694 var th=this;
  695 + var isstcsp=th.data.isstcsp;//是否启用消费密码
680 var phone=th.data.phone;//手机号码 696 var phone=th.data.phone;//手机号码
681 if (phone == "" || phone==null){ 697 if (phone == "" || phone==null){
682 getApp().my_warnning("手机不能为空", 0, th); 698 getApp().my_warnning("手机不能为空", 0, th);
@@ -686,26 +702,29 @@ Page({ @@ -686,26 +702,29 @@ Page({
686 var consumption = th.data.consumption;//消费密码 702 var consumption = th.data.consumption;//消费密码
687 var isstcsp = th.data.isstcsp; 703 var isstcsp = th.data.isstcsp;
688 if(isstcsp==1){ 704 if(isstcsp==1){
689 - if (consumption.length < 6 && consumption==""){ 705 +
  706 + if (consumption.length < 6|| consumption==""){
  707 +
690 getApp().my_warnning("消费密码不能为空及小于6位数", 0, th); 708 getApp().my_warnning("消费密码不能为空及小于6位数", 0, th);
691 return false; 709 return false;
692 } 710 }
693 } 711 }
694 var sex = th.data.isGender;//性别 712 var sex = th.data.isGender;//性别
695 - console.log(sex,"性别"); 713 +
696 if (sex!="1"&&sex!="2" ) { 714 if (sex!="1"&&sex!="2" ) {
697 getApp().my_warnning("请选择性别", 0, th); 715 getApp().my_warnning("请选择性别", 0, th);
698 return false; 716 return false;
699 } 717 }
700 var user_name = th.data.user.vipname;//用户姓名 718 var user_name = th.data.user.vipname;//用户姓名
701 - if (user_name == ""&& user_name!= null) { 719 + console.log("名字77777",user_name);
  720 + if (user_name==""|| user_name== null) {
702 getApp().my_warnning("请输入名字", 0, th); 721 getApp().my_warnning("请输入名字", 0, th);
703 return false; 722 return false;
704 } 723 }
705 var identity_card = th.data.identity_card;//身份证 724 var identity_card = th.data.identity_card;//身份证
706 console.log("身份证",identity_card); 725 console.log("身份证",identity_card);
707 726
708 - if (identity_card == "" && identity_card != null ) { 727 + if (identity_card == "" || identity_card == null ) {
709 getApp().my_warnning("请输入身份证", 0, th); 728 getApp().my_warnning("请输入身份证", 0, th);
710 return false; 729 return false;
711 } else if (!(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identity_card))){ 730 } else if (!(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identity_card))){
@@ -714,29 +733,30 @@ Page({ @@ -714,29 +733,30 @@ Page({
714 } 733 }
715 var address = th.data.address;//地址 734 var address = th.data.address;//地址
716 console.log("地址1010101", address) 735 console.log("地址1010101", address)
717 - if (address == "" && address != null) { 736 + if (address == "" || address == null) {
718 getApp().my_warnning("请输入地址", 0, th); 737 getApp().my_warnning("请输入地址", 0, th);
719 return false; 738 return false;
720 } 739 }
721 //保存所属门店的id 740 //保存所属门店的id
722 var sto_sele_id=th.data.sto_sele_id; 741 var sto_sele_id=th.data.sto_sele_id;
723 console.log("请输入所属门店的id", sto_sele_id); 742 console.log("请输入所属门店的id", sto_sele_id);
724 - if (sto_sele_id == null && sto_sele_id==""){ 743 + if (sto_sele_id == null || sto_sele_id==""){
725 getApp().my_warnning("请输入所属门店", 0, th); 744 getApp().my_warnning("请输入所属门店", 0, th);
  745 + return false;
726 } 746 }
727 console.log("要保存的数据", sex, consumption, identity_card, address, user_name); 747 console.log("要保存的数据", sex, consumption, identity_card, address, user_name);
728 var datas = { 748 var datas = {
729 mobile: phone,//手机号码 749 mobile: phone,//手机号码
730 store_id: r.stoid, 750 store_id: r.stoid,
731 user_id: getApp().globalData.user_id, 751 user_id: getApp().globalData.user_id,
732 - openid: th.data.openid, 752 + vipnopwd: isstcsp,
733 paypwd: consumption,//消费密码 753 paypwd: consumption,//消费密码
734 sex: sex,//性别 754 sex: sex,//性别
735 nickname:user_name,//昵称 755 nickname:user_name,//昵称
736 idcard:identity_card,//身份证 756 idcard:identity_card,//身份证
737 address:address, 757 address:address,
738 } 758 }
739 - getApp().request.put("/api/weshop/users/update", { 759 + getApp().request.post("/api/weshop/users/updateUserInfo", {
740 data: datas, 760 data: datas,
741 success: function (res) { 761 success: function (res) {
742 762
pages/user/userinfo/userinfo.wxml
@@ -138,7 +138,7 @@ @@ -138,7 +138,7 @@
138 </picker> 138 </picker>
139 </block> 139 </block>
140 <block wx:else> 140 <block wx:else>
141 - <view>{{datet==""?user.birthday:datet}}</view> 141 + <view>{{datet==""?filters.replace_time2(user.birthday):datet}}</view>
142 </block> 142 </block>
143 143
144 </view> 144 </view>
@@ -197,7 +197,7 @@ @@ -197,7 +197,7 @@
197 </navigator> 197 </navigator>
198 <view bindtap="editUserInfo1" class="user-name flex-vertical-between" data-type="email"> 198 <view bindtap="editUserInfo1" class="user-name flex-vertical-between" data-type="email">
199 <view class="user-name-txt">绑定的时间</view> 199 <view class="user-name-txt">绑定的时间</view>
200 - <view class="user-txt-right one-line">{{user.reg_time}}</view> 200 + <view class="user-txt-right one-line">{{filters.replace_time2(user.reg_time)}}</view>
201 </view> 201 </view>
202 </view> 202 </view>
203 </view> 203 </view>
pages/user/userinfo/userinfo.wxss
1 .container{ 1 .container{
2 padding-bottom:165rpx; 2 padding-bottom:165rpx;
  3 + transform: translate()
3 } 4 }
4 .user-container { 5 .user-container {
5 font-size: 30rpx; 6 font-size: 30rpx;