Commit 35fe62460fc647d736cc5851af0f1a376341b82b
Merge branch 'dev_20191114' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev_20191114
Showing
3 changed files
with
42 additions
and
21 deletions
pages/user/userinfo/userinfo.js
| ... | ... | @@ -57,6 +57,7 @@ Page({ | 
| 57 | 57 | pulscardname:"",//puls会员的卡 | 
| 58 | 58 | gradename:"",//会员权益的卡 | 
| 59 | 59 | isBool:"", | 
| 60 | + sto_sele_id:"",//所属门店id | |
| 60 | 61 | }, | 
| 61 | 62 | //是否启动密码消费 | 
| 62 | 63 | isstcsp:function(){ | 
| ... | ... | @@ -519,7 +520,7 @@ Page({ | 
| 519 | 520 | console.log("会员是否初始化", isBool); | 
| 520 | 521 | th.setData({isBool:isBool}); | 
| 521 | 522 | } | 
| 522 | - }); | |
| 523 | + }); | |
| 523 | 524 | }, | 
| 524 | 525 | //-----会员等级卡获取--------------- | 
| 525 | 526 | equity_user:function(){ | 
| ... | ... | @@ -559,6 +560,25 @@ Page({ | 
| 559 | 560 | this.wait_for_store_config(); | 
| 560 | 561 | var e = this; | 
| 561 | 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 | 582 | a.getUserInfo(function(a) { | 
| 563 | 583 | var txt = util.formatTime(a.birthday, 'yyyy-M-d'), | 
| 564 | 584 | arr = txt.split(' '); | 
| ... | ... | @@ -581,17 +601,11 @@ Page({ | 
| 581 | 601 | // phone+=a.mobile.substr(0, 3)+"****"; | 
| 582 | 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 | 609 | }, !0); | 
| 596 | 610 | }, | 
| 597 | 611 | |
| ... | ... | @@ -644,6 +658,7 @@ Page({ | 
| 644 | 658 | if (val.length > 6 || val!=""){ | 
| 645 | 659 | |
| 646 | 660 | this.setData({ consumption: val }); | 
| 661 | + console.log("是什么东西", val); | |
| 647 | 662 | } | 
| 648 | 663 | |
| 649 | 664 | |
| ... | ... | @@ -677,6 +692,7 @@ Page({ | 
| 677 | 692 | //点击确认修改信息 | 
| 678 | 693 | confirm_revision:function(){ | 
| 679 | 694 | var th=this; | 
| 695 | + var isstcsp=th.data.isstcsp;//是否启用消费密码 | |
| 680 | 696 | var phone=th.data.phone;//手机号码 | 
| 681 | 697 | if (phone == "" || phone==null){ | 
| 682 | 698 | getApp().my_warnning("手机不能为空", 0, th); | 
| ... | ... | @@ -686,26 +702,29 @@ Page({ | 
| 686 | 702 | var consumption = th.data.consumption;//消费密码 | 
| 687 | 703 | var isstcsp = th.data.isstcsp; | 
| 688 | 704 | if(isstcsp==1){ | 
| 689 | - if (consumption.length < 6 && consumption==""){ | |
| 705 | + | |
| 706 | + if (consumption.length < 6|| consumption==""){ | |
| 707 | + | |
| 690 | 708 | getApp().my_warnning("消费密码不能为空及小于6位数", 0, th); | 
| 691 | 709 | return false; | 
| 692 | 710 | } | 
| 693 | 711 | } | 
| 694 | 712 | var sex = th.data.isGender;//性别 | 
| 695 | - console.log(sex,"性别"); | |
| 713 | + | |
| 696 | 714 | if (sex!="1"&&sex!="2" ) { | 
| 697 | 715 | getApp().my_warnning("请选择性别", 0, th); | 
| 698 | 716 | return false; | 
| 699 | 717 | } | 
| 700 | 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 | 721 | getApp().my_warnning("请输入名字", 0, th); | 
| 703 | 722 | return false; | 
| 704 | 723 | } | 
| 705 | 724 | var identity_card = th.data.identity_card;//身份证 | 
| 706 | 725 | console.log("身份证",identity_card); | 
| 707 | 726 | |
| 708 | - if (identity_card == "" && identity_card != null ) { | |
| 727 | + if (identity_card == "" || identity_card == null ) { | |
| 709 | 728 | getApp().my_warnning("请输入身份证", 0, th); | 
| 710 | 729 | return false; | 
| 711 | 730 | } else if (!(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identity_card))){ | 
| ... | ... | @@ -714,29 +733,30 @@ Page({ | 
| 714 | 733 | } | 
| 715 | 734 | var address = th.data.address;//地址 | 
| 716 | 735 | console.log("地址1010101", address) | 
| 717 | - if (address == "" && address != null) { | |
| 736 | + if (address == "" || address == null) { | |
| 718 | 737 | getApp().my_warnning("请输入地址", 0, th); | 
| 719 | 738 | return false; | 
| 720 | 739 | } | 
| 721 | 740 | //保存所属门店的id | 
| 722 | 741 | var sto_sele_id=th.data.sto_sele_id; | 
| 723 | 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 | 744 | getApp().my_warnning("请输入所属门店", 0, th); | 
| 745 | + return false; | |
| 726 | 746 | } | 
| 727 | 747 | console.log("要保存的数据", sex, consumption, identity_card, address, user_name); | 
| 728 | 748 | var datas = { | 
| 729 | 749 | mobile: phone,//手机号码 | 
| 730 | 750 | store_id: r.stoid, | 
| 731 | 751 | user_id: getApp().globalData.user_id, | 
| 732 | - openid: th.data.openid, | |
| 752 | + vipnopwd: isstcsp, | |
| 733 | 753 | paypwd: consumption,//消费密码 | 
| 734 | 754 | sex: sex,//性别 | 
| 735 | 755 | nickname:user_name,//昵称 | 
| 736 | 756 | idcard:identity_card,//身份证 | 
| 737 | 757 | address:address, | 
| 738 | 758 | } | 
| 739 | - getApp().request.put("/api/weshop/users/update", { | |
| 759 | + getApp().request.post("/api/weshop/users/updateUserInfo", { | |
| 740 | 760 | data: datas, | 
| 741 | 761 | success: function (res) { | 
| 742 | 762 | ... | ... | 
pages/user/userinfo/userinfo.wxml
| ... | ... | @@ -138,7 +138,7 @@ | 
| 138 | 138 | </picker> | 
| 139 | 139 | </block> | 
| 140 | 140 | <block wx:else> | 
| 141 | - <view>{{datet==""?user.birthday:datet}}</view> | |
| 141 | + <view>{{datet==""?filters.replace_time2(user.birthday):datet}}</view> | |
| 142 | 142 | </block> | 
| 143 | 143 | |
| 144 | 144 | </view> | 
| ... | ... | @@ -197,7 +197,7 @@ | 
| 197 | 197 | </navigator> | 
| 198 | 198 | <view bindtap="editUserInfo1" class="user-name flex-vertical-between" data-type="email"> | 
| 199 | 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 | 201 | </view> | 
| 202 | 202 | </view> | 
| 203 | 203 | </view> | ... | ... | 
