diff --git a/pages/user/userinfo/userinfo.js b/pages/user/userinfo/userinfo.js index ab79481..1fe2acd 100644 --- a/pages/user/userinfo/userinfo.js +++ b/pages/user/userinfo/userinfo.js @@ -57,6 +57,7 @@ Page({ pulscardname:"",//puls会员的卡 gradename:"",//会员权益的卡 isBool:"", + sto_sele_id:"",//所属门店id }, //是否启动密码消费 isstcsp:function(){ @@ -519,7 +520,7 @@ Page({ console.log("会员是否初始化", isBool); th.setData({isBool:isBool}); } - }); + }); }, //-----会员等级卡获取--------------- equity_user:function(){ @@ -559,6 +560,25 @@ Page({ this.wait_for_store_config(); var e = this; var req = t; + req.get("/api/weshop/users/getAndUpdateUser/" + r.stoid + "/" + getApp().globalData.user_id, { + success: function (src) { + var a=src.data.data; + console.log(a,"剩什么llllll",a.data); + var time = util.formatTime(a.reg_time,"'Y/M/D"); + var birthday = util.formatTime(a.birthday, "'Y/M/D"); + a.reg_time = time; + a.birthday = birthday + e.setData({ + phone: a.mobile, + user: a, + openid: a.openid, + sto_sele_id: a.pickup_id, + consumption: a.paypwd, + identity_card:a.idcard, + + }); + } + }) a.getUserInfo(function(a) { var txt = util.formatTime(a.birthday, 'yyyy-M-d'), arr = txt.split(' '); @@ -581,17 +601,11 @@ Page({ // phone+=a.mobile.substr(0, 3)+"****"; // phone += a.mobile.substr(7, 12); + - e.setData({ - phone: a.mobile, - user: a, - openid: a.openid, - consumption: a.paypwd, - }); - - e.setData({ - isGender:e.data.user.sex - }) + // e.setData({ + // isGender:e.data.user.sex + // }) }, !0); }, @@ -644,6 +658,7 @@ Page({ if (val.length > 6 || val!=""){ this.setData({ consumption: val }); + console.log("是什么东西", val); } @@ -677,6 +692,7 @@ Page({ //点击确认修改信息 confirm_revision:function(){ var th=this; + var isstcsp=th.data.isstcsp;//是否启用消费密码 var phone=th.data.phone;//手机号码 if (phone == "" || phone==null){ getApp().my_warnning("手机不能为空", 0, th); @@ -686,26 +702,29 @@ Page({ var consumption = th.data.consumption;//消费密码 var isstcsp = th.data.isstcsp; if(isstcsp==1){ - if (consumption.length < 6 && consumption==""){ + + if (consumption.length < 6|| consumption==""){ + getApp().my_warnning("消费密码不能为空及小于6位数", 0, th); return false; } } var sex = th.data.isGender;//性别 - console.log(sex,"性别"); + if (sex!="1"&&sex!="2" ) { getApp().my_warnning("请选择性别", 0, th); return false; } var user_name = th.data.user.vipname;//用户姓名 - if (user_name == ""&& user_name!= null) { + console.log("名字77777",user_name); + if (user_name==""|| user_name== null) { getApp().my_warnning("请输入名字", 0, th); return false; } var identity_card = th.data.identity_card;//身份证 console.log("身份证",identity_card); - if (identity_card == "" && identity_card != null ) { + if (identity_card == "" || identity_card == null ) { getApp().my_warnning("请输入身份证", 0, th); return false; } else if (!(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identity_card))){ @@ -714,29 +733,30 @@ Page({ } var address = th.data.address;//地址 console.log("地址1010101", address) - if (address == "" && address != null) { + if (address == "" || address == null) { getApp().my_warnning("请输入地址", 0, th); return false; } //保存所属门店的id var sto_sele_id=th.data.sto_sele_id; console.log("请输入所属门店的id", sto_sele_id); - if (sto_sele_id == null && sto_sele_id==""){ + if (sto_sele_id == null || sto_sele_id==""){ getApp().my_warnning("请输入所属门店", 0, th); + return false; } console.log("要保存的数据", sex, consumption, identity_card, address, user_name); var datas = { mobile: phone,//手机号码 store_id: r.stoid, user_id: getApp().globalData.user_id, - openid: th.data.openid, + vipnopwd: isstcsp, paypwd: consumption,//消费密码 sex: sex,//性别 nickname:user_name,//昵称 idcard:identity_card,//身份证 address:address, } - getApp().request.put("/api/weshop/users/update", { + getApp().request.post("/api/weshop/users/updateUserInfo", { data: datas, success: function (res) { diff --git a/pages/user/userinfo/userinfo.wxml b/pages/user/userinfo/userinfo.wxml index f4e72c7..72f5395 100644 --- a/pages/user/userinfo/userinfo.wxml +++ b/pages/user/userinfo/userinfo.wxml @@ -138,7 +138,7 @@ - {{datet==""?user.birthday:datet}} + {{datet==""?filters.replace_time2(user.birthday):datet}} @@ -197,7 +197,7 @@ 绑定的时间 - {{user.reg_time}} + {{filters.replace_time2(user.reg_time)}} diff --git a/pages/user/userinfo/userinfo.wxss b/pages/user/userinfo/userinfo.wxss index 9826737..86fcdd9 100644 --- a/pages/user/userinfo/userinfo.wxss +++ b/pages/user/userinfo/userinfo.wxss @@ -1,5 +1,6 @@ .container{ padding-bottom:165rpx; + transform: translate() } .user-container { font-size: 30rpx;