Commit cf77c4c5d8343bc764b3278ed6c452cf37a59675
1 parent
38249af1
个人资料的姓名,性别入参,兴趣标签的入参,兴趣标签的数据填充
Showing
5 changed files
with
181 additions
and
94 deletions
pages/user/labels/labels.js
| @@ -12,6 +12,9 @@ Page({ | @@ -12,6 +12,9 @@ Page({ | ||
| 12 | url: a.url, //接口网址 | 12 | url: a.url, //接口网址 |
| 13 | interest_lables: [], //兴趣标签 | 13 | interest_lables: [], //兴趣标签 |
| 14 | check_label: [], //用户选中的标签集合 | 14 | check_label: [], //用户选中的标签集合 |
| 15 | + user_label_val: "", //奖励多少 | ||
| 16 | + user_label_type: "", //奖励类型(0积分,1类型) | ||
| 17 | + is_modify: 0, //判断是第一次填写还是修改(0填写,1修改) | ||
| 15 | }, | 18 | }, |
| 16 | //点击选择兴趣标签把值放到已选中 | 19 | //点击选择兴趣标签把值放到已选中 |
| 17 | click_label: function(e) { | 20 | click_label: function(e) { |
| @@ -24,17 +27,16 @@ Page({ | @@ -24,17 +27,16 @@ Page({ | ||
| 24 | if (labels_cid) { | 27 | if (labels_cid) { |
| 25 | labels_cid = 0; | 28 | labels_cid = 0; |
| 26 | for (var i = 0; i < check_label.length; i++) { | 29 | for (var i = 0; i < check_label.length; i++) { |
| 27 | - if (index == check_label[i].id) { | 30 | + if (labels[index].id == check_label[i].id) { |
| 28 | check_label.splice(i, 1); | 31 | check_label.splice(i, 1); |
| 29 | } | 32 | } |
| 30 | } | 33 | } |
| 31 | } else { | 34 | } else { |
| 32 | var check_new = { | 35 | var check_new = { |
| 33 | - lable: labels[index].LabelName, | ||
| 34 | - id: index | 36 | + lable: labels[index] |
| 35 | }; | 37 | }; |
| 36 | labels_cid = 1; | 38 | labels_cid = 1; |
| 37 | - check_label.push(check_new); | 39 | + check_label.push(labels[index]); |
| 38 | } | 40 | } |
| 39 | th.setData({ | 41 | th.setData({ |
| 40 | [labels_check]: labels_cid, | 42 | [labels_check]: labels_cid, |
| @@ -42,6 +44,18 @@ Page({ | @@ -42,6 +44,18 @@ Page({ | ||
| 42 | }) | 44 | }) |
| 43 | 45 | ||
| 44 | }, | 46 | }, |
| 47 | + //获取配置信息 | ||
| 48 | + get_config: function() { | ||
| 49 | + var th = this; | ||
| 50 | + getApp().getConfig2(function(ee) { | ||
| 51 | + var sms_conf = ee.switch_list; | ||
| 52 | + sms_conf = JSON.parse(sms_conf); | ||
| 53 | + th.setData({ | ||
| 54 | + user_label_val: sms_conf.user_label_val, | ||
| 55 | + user_label_type: sms_conf.user_label_type | ||
| 56 | + }) | ||
| 57 | + }) | ||
| 58 | + }, | ||
| 45 | //页面跳转 | 59 | //页面跳转 |
| 46 | goto: function(e) { | 60 | goto: function(e) { |
| 47 | var th = this; | 61 | var th = this; |
| @@ -61,7 +75,7 @@ Page({ | @@ -61,7 +75,7 @@ Page({ | ||
| 61 | is_zy: 1 | 75 | is_zy: 1 |
| 62 | }) | 76 | }) |
| 63 | th.query_nolabels(); | 77 | th.query_nolabels(); |
| 64 | - th.query_checklabels(); | 78 | + th.get_config(); |
| 65 | }, | 79 | }, |
| 66 | //获取标签集合 | 80 | //获取标签集合 |
| 67 | query_nolabels: function() { | 81 | query_nolabels: function() { |
| @@ -77,8 +91,10 @@ Page({ | @@ -77,8 +91,10 @@ Page({ | ||
| 77 | th.setData({ | 91 | th.setData({ |
| 78 | interest_lables: res.data.data.pageData | 92 | interest_lables: res.data.data.pageData |
| 79 | }) | 93 | }) |
| 94 | + th.query_checklabels(); | ||
| 80 | } else { | 95 | } else { |
| 81 | - getApp().my_warnning(res.data.msg, 0, th); | 96 | + getApp().my_warnning("系统繁忙,请稍后再试", 0, th); |
| 97 | + return false; | ||
| 82 | } | 98 | } |
| 83 | }) | 99 | }) |
| 84 | }, | 100 | }, |
| @@ -86,7 +102,7 @@ Page({ | @@ -86,7 +102,7 @@ Page({ | ||
| 86 | query_checklabels: function() { | 102 | query_checklabels: function() { |
| 87 | var th = this; | 103 | var th = this; |
| 88 | var url = "/api/weshop/marketing/holiday/vip/interest/label/get"; | 104 | var url = "/api/weshop/marketing/holiday/vip/interest/label/get"; |
| 89 | - var interest_lables = th.data.interest_lables; //兴趣标签集合 | 105 | + var interest_lables = th.data.interest_lables; //兴趣标签 |
| 90 | getApp().request.promiseGet(url, { | 106 | getApp().request.promiseGet(url, { |
| 91 | data: { | 107 | data: { |
| 92 | userId: d.user_id, | 108 | userId: d.user_id, |
| @@ -94,44 +110,100 @@ Page({ | @@ -94,44 +110,100 @@ Page({ | ||
| 94 | } | 110 | } |
| 95 | }).then(res => { | 111 | }).then(res => { |
| 96 | if (res.data.code == 0) { | 112 | if (res.data.code == 0) { |
| 113 | + var data = res.data.data; | ||
| 114 | + var arr = []; | ||
| 115 | + var VipLabelId = []; //通过id标签找到已选择的标签 | ||
| 116 | + var dateList = data.VipLabelId.split(","); | ||
| 117 | + for (var i in dateList) { | ||
| 118 | + VipLabelId = VipLabelId.concat(dateList[i]); | ||
| 119 | + } | ||
| 120 | + if (VipLabelId.length > 0) { | ||
| 121 | + for (var i = 0; i < interest_lables.length; i++) { | ||
| 122 | + for (var ii = 0; ii < VipLabelId.length; ii++) { | ||
| 123 | + if (interest_lables[i].id == VipLabelId[ii]) { | ||
| 124 | + interest_lables[i].check = 1; | ||
| 125 | + arr.push(interest_lables[i]); | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + //如何有之前有选择兴趣标签的话,再进来的话就是修改 | ||
| 131 | + if (data.VipLabelId != "") { | ||
| 132 | + th.setData({ | ||
| 133 | + is_modify: 1 | ||
| 134 | + }) | ||
| 135 | + } | ||
| 97 | th.setData({ | 136 | th.setData({ |
| 98 | - check_label: res.data.data.pageData | 137 | + check_label: arr, |
| 138 | + interest_lables: interest_lables | ||
| 99 | }) | 139 | }) |
| 100 | } else { | 140 | } else { |
| 101 | - getApp().my_warnning(res.data.msg, 0, th); | 141 | + getApp().my_warnning("系统繁忙,请稍后再试", 0, th); |
| 142 | + return false; | ||
| 102 | } | 143 | } |
| 103 | }) | 144 | }) |
| 104 | }, | 145 | }, |
| 105 | //更新会员兴趣标签 | 146 | //更新会员兴趣标签 |
| 106 | update_label: function() { | 147 | update_label: function() { |
| 107 | var th = this; | 148 | var th = this; |
| 108 | - var check_label = th.data.check_label; | 149 | + var is_modify = th.data.is_modify; //是否是修改 |
| 150 | + var check_label = th.data.check_label; //用户选择 | ||
| 151 | + var remark = "领取"; | ||
| 152 | + if (is_modify) { | ||
| 153 | + user_label_type = 0; | ||
| 154 | + remark = "修改"; | ||
| 155 | + } | ||
| 109 | if (check_label.length < 1) { | 156 | if (check_label.length < 1) { |
| 110 | - getApp().my_warnning("完成兴趣标签才能领取哦~", 0, th); | 157 | + getApp().my_warnning("完成兴趣标签才能" + remark + "哦~", 0, th); |
| 111 | return false; | 158 | return false; |
| 112 | } | 159 | } |
| 113 | - var url = th.data.url + "/api/weshop/marketing/holiday/vip/interest/label/update"; | ||
| 114 | - check_label = "美,美"; | ||
| 115 | - var json = { | ||
| 116 | - "storeId": a.stoid, | ||
| 117 | - "userId": d.user_id, | ||
| 118 | - "vipLabel": check_label, | ||
| 119 | - "type":0, | ||
| 120 | - "vipLabelId":"1,1" | ||
| 121 | - }; | ||
| 122 | - var data = JSON.stringify(json); | ||
| 123 | - wx.request({ | ||
| 124 | - url: url, | ||
| 125 | - data: data, | ||
| 126 | - method: 'put', | ||
| 127 | - header: { | ||
| 128 | - 'content-type': 'application/json' | ||
| 129 | - }, // 设置请求的 header | 160 | + var user_label_val = th.data.user_label_val; //选择标签奖励多少 |
| 161 | + var user_label_type = th.data.user_label_type; //增送类型 | ||
| 162 | + var url = "/api/weshop/marketing/holiday/vip/interest/label/update"; //更新标签接口地址 | ||
| 163 | + var nav_url = "/pages/user/userinfo/userinfo"; //领取成功之后跳转页面 | ||
| 164 | + var vipLabel = ""; //选择的标签名称 | ||
| 165 | + var vipLabelId = ""; //选择的标签id | ||
| 166 | + var arr = []; | ||
| 167 | + for (var i = 0; i < check_label.length; i++) { | ||
| 168 | + if (i < check_label.length - 1) { | ||
| 169 | + vipLabelId += check_label[i].id + ","; | ||
| 170 | + vipLabel += check_label[i].LabelName + ","; | ||
| 171 | + arr.push(check_label[i].LabelName); | ||
| 172 | + } else { | ||
| 173 | + vipLabelId += check_label[i].id; | ||
| 174 | + vipLabel += check_label[i].LabelName; | ||
| 175 | + arr.push(check_label[i].LabelName); | ||
| 176 | + } | ||
| 177 | + } | ||
| 178 | + getApp().request.put(url, { | ||
| 179 | + data: { | ||
| 180 | + "storeId": a.stoid, | ||
| 181 | + "userId": d.user_id, | ||
| 182 | + "vipLabel": vipLabel, | ||
| 183 | + "vipLabelId": vipLabelId, | ||
| 184 | + "type": user_label_type, | ||
| 185 | + "remark": remark, | ||
| 186 | + "value": user_label_val, | ||
| 187 | + "fromType": "REWARD" | ||
| 188 | + }, | ||
| 130 | success: function(res) { | 189 | success: function(res) { |
| 131 | if (res.data.code == 0) { | 190 | if (res.data.code == 0) { |
| 132 | - getApp().my_warnning("领取成功", 1, th); | 191 | + if (is_modify) { |
| 192 | + getApp().my_warnning("修改成功", 1, th); | ||
| 193 | + } else { | ||
| 194 | + getApp().my_warnning("领取成功", 1, th); | ||
| 195 | + } | ||
| 196 | + setTimeout(function() { | ||
| 197 | + var pages = getCurrentPages(); | ||
| 198 | + var prevPage = pages[pages.length - 2]; //上一个页面 | ||
| 199 | + //直接调用上一个页面的setData()方法,把数据存到上一个页面中去 | ||
| 200 | + prevPage.setData({ | ||
| 201 | + check_label: arr | ||
| 202 | + }) | ||
| 203 | + th.goto(); | ||
| 204 | + }, 2000); | ||
| 133 | } else { | 205 | } else { |
| 134 | - getApp().my_warnning("领取失败", 1, th); | 206 | + getApp().my_warnning("系统繁忙,请稍后再试", 0, th); |
| 135 | } | 207 | } |
| 136 | } | 208 | } |
| 137 | }) | 209 | }) |
| @@ -141,12 +213,5 @@ Page({ | @@ -141,12 +213,5 @@ Page({ | ||
| 141 | */ | 213 | */ |
| 142 | onShow: function() { | 214 | onShow: function() { |
| 143 | 215 | ||
| 144 | - }, | ||
| 145 | - | ||
| 146 | - /** | ||
| 147 | - * 页面上拉触底事件的处理函数 | ||
| 148 | - */ | ||
| 149 | - onReachBottom: function() { | ||
| 150 | - | ||
| 151 | } | 216 | } |
| 152 | }) | 217 | }) |
| 153 | \ No newline at end of file | 218 | \ No newline at end of file |
pages/user/labels/labels.wxml
| @@ -4,9 +4,12 @@ | @@ -4,9 +4,12 @@ | ||
| 4 | <!-- 兴趣标签标题 --> | 4 | <!-- 兴趣标签标题 --> |
| 5 | <view class="flex-vertical-between labels_head"> | 5 | <view class="flex-vertical-between labels_head"> |
| 6 | <view class="fs36">兴趣标签</view> | 6 | <view class="fs36">兴趣标签</view> |
| 7 | - <view class="skip flex-center fs28" data-url="/pages/user/userinfo/userinfo" bindtap="goto"> | 7 | + <view wx:if="{{is_modify==0}}" class="skip flex-center fs28" data-url="/pages/user/userinfo/userinfo" bindtap="goto"> |
| 8 | <view>跳过</view> | 8 | <view>跳过</view> |
| 9 | </view> | 9 | </view> |
| 10 | + <view wx:if="{{is_modify==1}}" class="skip flex-center fs28" data-url="/pages/user/userinfo/userinfo" bindtap="goto"> | ||
| 11 | + <view>关闭</view> | ||
| 12 | + </view> | ||
| 10 | </view> | 13 | </view> |
| 11 | 14 | ||
| 12 | <!-- 标签内容 --> | 15 | <!-- 标签内容 --> |
| @@ -25,7 +28,7 @@ | @@ -25,7 +28,7 @@ | ||
| 25 | <view class="check_labels"> | 28 | <view class="check_labels"> |
| 26 | <view class="check_label ellipsis-1 fs28" wx:for="{{check_label}}" wx:for-item="it" wx:for-index="key"> | 29 | <view class="check_label ellipsis-1 fs28" wx:for="{{check_label}}" wx:for-item="it" wx:for-index="key"> |
| 27 | <view> | 30 | <view> |
| 28 | - {{it.lable}} | 31 | + {{it.LabelName}} |
| 29 | </view> | 32 | </view> |
| 30 | </view> | 33 | </view> |
| 31 | </view> | 34 | </view> |
| @@ -33,9 +36,25 @@ | @@ -33,9 +36,25 @@ | ||
| 33 | 36 | ||
| 34 | <view class="flex-center"> | 37 | <view class="flex-center"> |
| 35 | <!-- 领取选择标签的奖励按钮 --> | 38 | <!-- 领取选择标签的奖励按钮 --> |
| 36 | - <view class="receive flex-center fs36" bindtap="update_label"> | ||
| 37 | - <view>领取200成长值</view> | ||
| 38 | - </view> | 39 | + <block wx:if="{{is_modify==0}}"> |
| 40 | + <view class="receive flex-center fs36" bindtap="update_label" data-url="/pages/user/userinfo/userinfo"> | ||
| 41 | + <block wx:if="{{user_label_val<1 || user_label_val==''}}"> | ||
| 42 | + <view>确定选择</view> | ||
| 43 | + </block> | ||
| 44 | + <block wx:if="{{user_label_type==0 && user_label_val>0 && user_label_val!=''}}"> | ||
| 45 | + <view>领取{{user_label_val}}积分</view> | ||
| 46 | + </block> | ||
| 47 | + <block wx:if="{{user_label_type==1 && user_label_val>0 && user_label_val!=''}}"> | ||
| 48 | + <view>领取{{user_label_val}}成长值</view> | ||
| 49 | + </block> | ||
| 50 | + </view> | ||
| 51 | + </block> | ||
| 52 | + <block wx:if="{{is_modify==1}}"> | ||
| 53 | + <view class="receive flex-center fs36" bindtap="update_label" data-url="/pages/user/userinfo/userinfo"> | ||
| 54 | + <view>提交修改</view> | ||
| 55 | + </view> | ||
| 56 | + </block> | ||
| 57 | + | ||
| 39 | </view> | 58 | </view> |
| 40 | </view> | 59 | </view> |
| 41 | <!-- 引入提示组件 --> | 60 | <!-- 引入提示组件 --> |
pages/user/userinfo/userinfo.js
| @@ -12,7 +12,8 @@ var a = getApp(), | @@ -12,7 +12,8 @@ var a = getApp(), | ||
| 12 | t = a.request, | 12 | t = a.request, |
| 13 | s = require("../../../utils/common.js"), | 13 | s = require("../../../utils/common.js"), |
| 14 | util = require("../../../utils/util.js"), | 14 | util = require("../../../utils/util.js"), |
| 15 | - ut = util; | 15 | + ut = util, |
| 16 | + d = getApp().globalData; | ||
| 16 | 17 | ||
| 17 | var timestamp = Date.parse(new Date()); | 18 | var timestamp = Date.parse(new Date()); |
| 18 | var date = new Date(timestamp); | 19 | var date = new Date(timestamp); |
| @@ -60,7 +61,8 @@ Page({ | @@ -60,7 +61,8 @@ Page({ | ||
| 60 | isBool: "", | 61 | isBool: "", |
| 61 | sto_sele_id: "", //所属门店id | 62 | sto_sele_id: "", //所属门店id |
| 62 | is_zy: 0, //是否执行onshow | 63 | is_zy: 0, //是否执行onshow |
| 63 | - is_lable_set:"",//是否启用我的兴趣标签 | 64 | + is_lable_set: "", //是否启用我的兴趣标签 |
| 65 | + check_label: [], //我选择的兴趣标签 | ||
| 64 | }, | 66 | }, |
| 65 | //通过路径跳转到其他页面 | 67 | //通过路径跳转到其他页面 |
| 66 | goto: function(e) { | 68 | goto: function(e) { |
| @@ -76,6 +78,37 @@ Page({ | @@ -76,6 +78,37 @@ Page({ | ||
| 76 | th.setData({ | 78 | th.setData({ |
| 77 | is_lable_set: sms_conf.user_label_set | 79 | is_lable_set: sms_conf.user_label_set |
| 78 | }) | 80 | }) |
| 81 | + if (sms_conf.user_label_set) { | ||
| 82 | + th.query_checklabels(); | ||
| 83 | + } | ||
| 84 | + }) | ||
| 85 | + }, | ||
| 86 | + //查找会员选择的兴趣标签 | ||
| 87 | + query_checklabels: function() { | ||
| 88 | + var th = this; | ||
| 89 | + var url = "/api/weshop/marketing/holiday/vip/interest/label/get"; | ||
| 90 | + var interest_lables = th.data.interest_lables; //兴趣标签 | ||
| 91 | + getApp().request.promiseGet(url, { | ||
| 92 | + data: { | ||
| 93 | + userId: d.user_id, | ||
| 94 | + storeId: r.stoid | ||
| 95 | + } | ||
| 96 | + }).then(res => { | ||
| 97 | + if (res.data.code == 0) { | ||
| 98 | + var data = res.data.data; | ||
| 99 | + var VipLabel = th.data.check_label; //通过id标签找到已选择的标签 | ||
| 100 | + var dateList = data.VipLabel.split(","); | ||
| 101 | + for (var i in dateList) { | ||
| 102 | + if (dateList[i] != "") { | ||
| 103 | + VipLabel.push(dateList[i]); | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + th.setData({ | ||
| 107 | + check_label: VipLabel | ||
| 108 | + }) | ||
| 109 | + } else { | ||
| 110 | + getApp().my_warnning("系统繁忙,请稍后再试", 0, th); | ||
| 111 | + } | ||
| 79 | }) | 112 | }) |
| 80 | }, | 113 | }, |
| 81 | //是否启动密码消费 | 114 | //是否启动密码消费 |
| @@ -110,7 +143,6 @@ Page({ | @@ -110,7 +143,6 @@ Page({ | ||
| 110 | isGender: function(e) { | 143 | isGender: function(e) { |
| 111 | var th = this; | 144 | var th = this; |
| 112 | var sex = e.currentTarget.dataset.sex; | 145 | var sex = e.currentTarget.dataset.sex; |
| 113 | - console.log("点击选择性别", sex); | ||
| 114 | th.setData({ | 146 | th.setData({ |
| 115 | isGender: sex | 147 | isGender: sex |
| 116 | }) | 148 | }) |
| @@ -175,8 +207,6 @@ Page({ | @@ -175,8 +207,6 @@ Page({ | ||
| 175 | var index = th.data.sec_pick_index; | 207 | var index = th.data.sec_pick_index; |
| 176 | item = th.data.sec_sto.s_arr[index]; | 208 | item = th.data.sec_sto.s_arr[index]; |
| 177 | } | 209 | } |
| 178 | - | ||
| 179 | - console.log("选择门店刷新", "def_pick_store", item); | ||
| 180 | th.setData({ | 210 | th.setData({ |
| 181 | def_pick_store: item, | 211 | def_pick_store: item, |
| 182 | stoname: item.pickup_name, | 212 | stoname: item.pickup_name, |
| @@ -393,7 +423,6 @@ Page({ | @@ -393,7 +423,6 @@ Page({ | ||
| 393 | } | 423 | } |
| 394 | } | 424 | } |
| 395 | }, 200) | 425 | }, 200) |
| 396 | - console.log(th.data.all_sto + 'eeee'); | ||
| 397 | }, | 426 | }, |
| 398 | //选择更多门店 | 427 | //选择更多门店 |
| 399 | more_store: function() { | 428 | more_store: function() { |
| @@ -469,7 +498,6 @@ Page({ | @@ -469,7 +498,6 @@ Page({ | ||
| 469 | 498 | ||
| 470 | //如果身份证不满足格式正则表达式 | 499 | //如果身份证不满足格式正则表达式 |
| 471 | if (!code || !idCardReg.test(code)) { | 500 | if (!code || !idCardReg.test(code)) { |
| 472 | - console.log("您输入的身份证号格式有误!"); | ||
| 473 | errorMess = "您输入的身份证号格式有误!"; | 501 | errorMess = "您输入的身份证号格式有误!"; |
| 474 | isPass = false; | 502 | isPass = false; |
| 475 | } | 503 | } |
| @@ -533,7 +561,6 @@ Page({ | @@ -533,7 +561,6 @@ Page({ | ||
| 533 | } | 561 | } |
| 534 | } | 562 | } |
| 535 | this.initial_user(); | 563 | this.initial_user(); |
| 536 | - this.get_config(); | ||
| 537 | }, | 564 | }, |
| 538 | //-----------会员是否初始化--------------------- | 565 | //-----------会员是否初始化--------------------- |
| 539 | initial_user: function() { | 566 | initial_user: function() { |
| @@ -545,7 +572,6 @@ Page({ | @@ -545,7 +572,6 @@ Page({ | ||
| 545 | }, | 572 | }, |
| 546 | success: function(su) { | 573 | success: function(su) { |
| 547 | var isBool = su.data.data.isBool; | 574 | var isBool = su.data.data.isBool; |
| 548 | - console.log("会员是否初始化", isBool); | ||
| 549 | th.setData({ | 575 | th.setData({ |
| 550 | isBool: isBool | 576 | isBool: isBool |
| 551 | }); | 577 | }); |
| @@ -567,6 +593,7 @@ Page({ | @@ -567,6 +593,7 @@ Page({ | ||
| 567 | 593 | ||
| 568 | } | 594 | } |
| 569 | }); | 595 | }); |
| 596 | + this.get_config(); | ||
| 570 | }, | 597 | }, |
| 571 | 598 | ||
| 572 | 599 | ||
| @@ -582,7 +609,6 @@ Page({ | @@ -582,7 +609,6 @@ Page({ | ||
| 582 | 609 | ||
| 583 | if (su.data.code == 0) { | 610 | if (su.data.code == 0) { |
| 584 | var cardname = su.data.data[0].MemCardName; | 611 | var cardname = su.data.data[0].MemCardName; |
| 585 | - console.log("卡的名字", cardname); | ||
| 586 | th.setData({ | 612 | th.setData({ |
| 587 | pulscardname: cardname | 613 | pulscardname: cardname |
| 588 | }); | 614 | }); |
| @@ -592,9 +618,9 @@ Page({ | @@ -592,9 +618,9 @@ Page({ | ||
| 592 | }, | 618 | }, |
| 593 | 619 | ||
| 594 | onShow: function() { | 620 | onShow: function() { |
| 621 | + var e = this; | ||
| 595 | if (this.data.is_zy) return false; | 622 | if (this.data.is_zy) return false; |
| 596 | this.wait_for_store_config(); | 623 | this.wait_for_store_config(); |
| 597 | - var e = this; | ||
| 598 | var req = t; | 624 | var req = t; |
| 599 | req.get("/api/weshop/users/getAndUpdateUser/" + r.stoid + "/" + getApp().globalData.user_id, { | 625 | req.get("/api/weshop/users/getAndUpdateUser/" + r.stoid + "/" + getApp().globalData.user_id, { |
| 600 | success: function(src) { | 626 | success: function(src) { |
| @@ -611,6 +637,7 @@ Page({ | @@ -611,6 +637,7 @@ Page({ | ||
| 611 | consumption: a.paypwd, | 637 | consumption: a.paypwd, |
| 612 | identity_card: a.idcard, | 638 | identity_card: a.idcard, |
| 613 | address: a.address, | 639 | address: a.address, |
| 640 | + isGender: a.sex | ||
| 614 | }); | 641 | }); |
| 615 | } | 642 | } |
| 616 | }) | 643 | }) |
| @@ -689,22 +716,17 @@ Page({ | @@ -689,22 +716,17 @@ Page({ | ||
| 689 | lose_focus: function(e) { | 716 | lose_focus: function(e) { |
| 690 | var th = this; | 717 | var th = this; |
| 691 | var val = e.detail.value; | 718 | var val = e.detail.value; |
| 692 | - console.log("是什么东西", val); | ||
| 693 | if (val.length > 6 || val != "") { | 719 | if (val.length > 6 || val != "") { |
| 694 | 720 | ||
| 695 | this.setData({ | 721 | this.setData({ |
| 696 | consumption: val | 722 | consumption: val |
| 697 | }); | 723 | }); |
| 698 | - console.log("是什么东西", val); | ||
| 699 | } | 724 | } |
| 700 | - | ||
| 701 | - | ||
| 702 | }, | 725 | }, |
| 703 | 726 | ||
| 704 | //地址 | 727 | //地址 |
| 705 | address: function(e) { | 728 | address: function(e) { |
| 706 | var val = e.detail; | 729 | var val = e.detail; |
| 707 | - console.log("地址55555555", val.value); | ||
| 708 | this.setData({ | 730 | this.setData({ |
| 709 | address: val.value | 731 | address: val.value |
| 710 | }); | 732 | }); |
| @@ -721,13 +743,13 @@ Page({ | @@ -721,13 +743,13 @@ Page({ | ||
| 721 | }, | 743 | }, |
| 722 | //用户名字 | 744 | //用户名字 |
| 723 | user_name: function(e) { | 745 | user_name: function(e) { |
| 746 | + var th = this; | ||
| 724 | var name = e.detail.value; | 747 | var name = e.detail.value; |
| 748 | + var vipname = 'user.vipname'; | ||
| 725 | if (name != "" || name != null) { | 749 | if (name != "" || name != null) { |
| 726 | - | ||
| 727 | - this.setData({ | ||
| 728 | - user_name: name | 750 | + th.setData({ |
| 751 | + [vipname]: name | ||
| 729 | }); | 752 | }); |
| 730 | - | ||
| 731 | } | 753 | } |
| 732 | 754 | ||
| 733 | }, | 755 | }, |
| @@ -739,11 +761,8 @@ Page({ | @@ -739,11 +761,8 @@ Page({ | ||
| 739 | var phone = th.data.phone; //手机号码 | 761 | var phone = th.data.phone; //手机号码 |
| 740 | if (phone == "" || phone == null) { | 762 | if (phone == "" || phone == null) { |
| 741 | getApp().my_warnning("手机不能为空", 0, th); | 763 | getApp().my_warnning("手机不能为空", 0, th); |
| 742 | - | ||
| 743 | return false; | 764 | return false; |
| 744 | } | 765 | } |
| 745 | - | ||
| 746 | - | ||
| 747 | var consumption = th.data.consumption; //消费密码 | 766 | var consumption = th.data.consumption; //消费密码 |
| 748 | var isstcsp = th.data.isstcsp; | 767 | var isstcsp = th.data.isstcsp; |
| 749 | if (isstcsp == 1) { | 768 | if (isstcsp == 1) { |
| @@ -764,32 +783,18 @@ Page({ | @@ -764,32 +783,18 @@ Page({ | ||
| 764 | return false; | 783 | return false; |
| 765 | } | 784 | } |
| 766 | var user_name = th.data.user.vipname; //用户姓名 | 785 | var user_name = th.data.user.vipname; //用户姓名 |
| 767 | - console.log("名字77777", user_name); | ||
| 768 | if (user_name == "" || user_name == null) { | 786 | if (user_name == "" || user_name == null) { |
| 769 | getApp().my_warnning("请输入名字", 0, th); | 787 | getApp().my_warnning("请输入名字", 0, th); |
| 770 | return false; | 788 | return false; |
| 771 | } | 789 | } |
| 772 | var identity_card = th.data.identity_card; //身份证 | 790 | var identity_card = th.data.identity_card; //身份证 |
| 773 | - console.log("身份证", identity_card); | ||
| 774 | 791 | ||
| 775 | if (identity_card != "" && !(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identity_card))) { | 792 | if (identity_card != "" && !(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identity_card))) { |
| 776 | getApp().my_warnning("身份证号码错误", 0, th); | 793 | getApp().my_warnning("身份证号码错误", 0, th); |
| 777 | return false; | 794 | return false; |
| 778 | } | 795 | } |
| 779 | var address = th.data.address; //地址 | 796 | var address = th.data.address; //地址 |
| 780 | - // console.log("地址1010101", address) | ||
| 781 | - // if (address == "" || address == null) { | ||
| 782 | - // getApp().my_warnning("请输入地址", 0, th); | ||
| 783 | - // return false; | ||
| 784 | - // } | ||
| 785 | - //保存所属门店的id | ||
| 786 | var sto_sele_id = th.data.sto_sele_id; | 797 | var sto_sele_id = th.data.sto_sele_id; |
| 787 | - // console.log("请输入所属门店的id", sto_sele_id); | ||
| 788 | - // if (sto_sele_id == null || sto_sele_id==""){ | ||
| 789 | - // getApp().my_warnning("请输入所属门店", 0, th); | ||
| 790 | - // return false; | ||
| 791 | - // } | ||
| 792 | - console.log("要保存的数据", sex, consumption, identity_card, address, user_name); | ||
| 793 | var datas = { | 798 | var datas = { |
| 794 | mobile: phone, //手机号码 | 799 | mobile: phone, //手机号码 |
| 795 | store_id: r.stoid, | 800 | store_id: r.stoid, |
| @@ -797,7 +802,7 @@ Page({ | @@ -797,7 +802,7 @@ Page({ | ||
| 797 | vipnopwd: isstcsp, | 802 | vipnopwd: isstcsp, |
| 798 | vippass: consumption, //消费密码 | 803 | vippass: consumption, //消费密码 |
| 799 | sex: sex, //性别 | 804 | sex: sex, //性别 |
| 800 | - nickname: user_name, //昵称 | 805 | + vipname: user_name, //昵称 |
| 801 | idcard: identity_card, //身份证 | 806 | idcard: identity_card, //身份证 |
| 802 | address: address, //地址 | 807 | address: address, //地址 |
| 803 | pickup_id: sto_sele_id //自提门店 所属门店 | 808 | pickup_id: sto_sele_id //自提门店 所属门店 |
| @@ -805,13 +810,11 @@ Page({ | @@ -805,13 +810,11 @@ Page({ | ||
| 805 | getApp().request.put("/api/weshop/users/updateUserInfo", { | 810 | getApp().request.put("/api/weshop/users/updateUserInfo", { |
| 806 | data: datas, | 811 | data: datas, |
| 807 | success: function(res) { | 812 | success: function(res) { |
| 808 | - | ||
| 809 | if (res.data.code == 0) { | 813 | if (res.data.code == 0) { |
| 810 | - getApp().showWarning("修改成功"); | 814 | + getApp().my_warnning("修改成功", 0, th); |
| 811 | } else { | 815 | } else { |
| 812 | - getApp().showWarning("修改失败"); | 816 | + getApp().my_warnning("系统繁忙,请稍后再试", 0, th); |
| 813 | } | 817 | } |
| 814 | - | ||
| 815 | } | 818 | } |
| 816 | }) | 819 | }) |
| 817 | }, | 820 | }, |
pages/user/userinfo/userinfo.wxml
| @@ -187,7 +187,7 @@ | @@ -187,7 +187,7 @@ | ||
| 187 | </view> | 187 | </view> |
| 188 | </view> | 188 | </view> |
| 189 | <!-- 我的兴趣 --> | 189 | <!-- 我的兴趣 --> |
| 190 | - <view wx:if="{{is_lable_set!=null || is_lable_set==1 || true}}" class="padding Bbottom"> | 190 | + <view wx:if="{{is_lable_set!=null || is_lable_set==1}}" class="padding Bbottom"> |
| 191 | <view class="interest fs28"> | 191 | <view class="interest fs28"> |
| 192 | <view class="flex-vertical-between" bindtap="goto" data-url="/pages/user/labels/labels"> | 192 | <view class="flex-vertical-between" bindtap="goto" data-url="/pages/user/labels/labels"> |
| 193 | <view class="fs30">我的兴趣</view> | 193 | <view class="fs30">我的兴趣</view> |
| @@ -195,13 +195,15 @@ | @@ -195,13 +195,15 @@ | ||
| 195 | </view> | 195 | </view> |
| 196 | <!-- 选中的标签 --> | 196 | <!-- 选中的标签 --> |
| 197 | <view class="lables"> | 197 | <view class="lables"> |
| 198 | - <view class="lable" wx:for="{{4}}"> | ||
| 199 | - <view class="ellipsis-1 lable_wh">高级蓝领</view> | ||
| 200 | - </view> | 198 | + <block wx:if="{{check_label.length>0}}"> |
| 199 | + <view class="lable" wx:for="{{check_label}}" wx:for-item="label"> | ||
| 200 | + <view class="ellipsis-1">{{label}}</view> | ||
| 201 | + </view> | ||
| 202 | + </block> | ||
| 201 | <!-- 添加标签按钮 --> | 203 | <!-- 添加标签按钮 --> |
| 202 | - <view class="add_lable ib" bindtap="goto" data-url="/pages/user/labels/labels"> | ||
| 203 | - <text class="fs36">+</text> | ||
| 204 | - <text>标签</text> | 204 | + <view class="add_lable ib ellipsis-1" bindtap="goto" data-url="/pages/user/labels/labels"> |
| 205 | + <text class="plus">+</text> | ||
| 206 | + <text>标签</text> | ||
| 205 | </view> | 207 | </view> |
| 206 | </view> | 208 | </view> |
| 207 | </view> | 209 | </view> |
pages/user/userinfo/userinfo.wxss
| @@ -645,17 +645,15 @@ input { | @@ -645,17 +645,15 @@ input { | ||
| 645 | } | 645 | } |
| 646 | 646 | ||
| 647 | .add_lable { | 647 | .add_lable { |
| 648 | - width: 88rpx; | ||
| 649 | - /* height: 46rpx; *//* line-height: 46rpx; */ | ||
| 650 | color: rgb(189, 189, 189); | 648 | color: rgb(189, 189, 189); |
| 651 | border: 2rpx solid rgb(189, 189, 189); | 649 | border: 2rpx solid rgb(189, 189, 189); |
| 652 | border-radius: 30rpx; | 650 | border-radius: 30rpx; |
| 653 | - margin-bottom: 20rpx; | ||
| 654 | padding: 0rpx 25rpx; | 651 | padding: 0rpx 25rpx; |
| 655 | } | 652 | } |
| 656 | 653 | ||
| 657 | .plus { | 654 | .plus { |
| 658 | font-weight: bold; | 655 | font-weight: bold; |
| 656 | + margin-right: 8rpx; | ||
| 659 | } | 657 | } |
| 660 | 658 | ||
| 661 | .lable_wh { | 659 | .lable_wh { |