Authored by 张文文

修改地址标签不能点击问题 review by lea.guo

@@ -5,8 +5,8 @@ @@ -5,8 +5,8 @@
5 <CInput 5 <CInput
6 label="收货人" 6 label="收货人"
7 place-holder="请写姓名" 7 place-holder="请写姓名"
8 - v-model="model.consignee"  
9 - :textValue="model.consignee" 8 + v-model="consignee"
  9 + :textValue="consignee"
10 type="text" 10 type="text"
11 ></CInput> 11 ></CInput>
12 </FormItem> 12 </FormItem>
@@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
14 <CInput 14 <CInput
15 label="手机号" 15 label="手机号"
16 place-holder="请填写手机号" 16 place-holder="请填写手机号"
17 - v-model="model.mobile"  
18 - :textValue="model.mobile" 17 + v-model="mobile"
  18 + :textValue="mobile"
19 ></CInput> 19 ></CInput>
20 </FormItem> 20 </FormItem>
21 21
@@ -24,8 +24,8 @@ @@ -24,8 +24,8 @@
24 <div class="wrapper-area"> 24 <div class="wrapper-area">
25 <label class="input-label">所在区域</label> 25 <label class="input-label">所在区域</label>
26 <div class="wrapper-arrow" @click="chooseArea"> 26 <div class="wrapper-arrow" @click="chooseArea">
27 - <template v-if="model.area">  
28 - <label class="text-label">{{ model.area }}</label> 27 + <template v-if="area">
  28 + <label class="text-label">{{ area }}</label>
29 </template> 29 </template>
30 <template v-else> 30 <template v-else>
31 <label class="choose-area">请选择</label> 31 <label class="choose-area">请选择</label>
@@ -40,8 +40,8 @@ @@ -40,8 +40,8 @@
40 <CInput 40 <CInput
41 label="详细地址" 41 label="详细地址"
42 place-holder="请输入详细地址" 42 place-holder="请输入详细地址"
43 - v-model="model.address"  
44 - :textValue="model.address" 43 + v-model="address"
  44 + :textValue="address"
45 ></CInput> 45 ></CInput>
46 </FormItem> 46 </FormItem>
47 <!-- 订单修改地址隐藏 --> 47 <!-- 订单修改地址隐藏 -->
@@ -53,8 +53,8 @@ @@ -53,8 +53,8 @@
53 <Radio 53 <Radio
54 class="tag-radio" 54 class="tag-radio"
55 :label="{ text: `${tag.name}`, value: `${tag.code}` }" 55 :label="{ text: `${tag.name}`, value: `${tag.code}` }"
56 - v-model="model.tag_code"  
57 - checked="tag.code === model.tag_code" 56 + v-model="tag_code"
  57 + :checked="tag.code === tag_code"
58 ></Radio> 58 ></Radio>
59 </div> 59 </div>
60 </RadioGroup> 60 </RadioGroup>
@@ -66,8 +66,8 @@ @@ -66,8 +66,8 @@
66 class="radio" 66 class="radio"
67 :label="{ text: '设为默认地址', value: true }" 67 :label="{ text: '设为默认地址', value: true }"
68 style="flex: 0 1 100%;" 68 style="flex: 0 1 100%;"
69 - checked="model.is_default"  
70 - v-model="model.is_default" 69 + checked="is_default"
  70 + v-model="is_default"
71 ></Radio> 71 ></Radio>
72 </div> 72 </div>
73 </div> 73 </div>
@@ -117,20 +117,19 @@ export default { @@ -117,20 +117,19 @@ export default {
117 isMobileNumEdit: false, 117 isMobileNumEdit: false,
118 title: '', 118 title: '',
119 orderCode: '', 119 orderCode: '',
120 - model: {  
121 - consignee: '',  
122 - address_id: '',  
123 - mobile: '',  
124 - area_code: '',  
125 - area: '',  
126 - address: '',  
127 - tag_code: '',  
128 - is_default: false  
129 - } 120 +
  121 + consignee: '',
  122 + address_id: '',
  123 + mobile: '',
  124 + area_code: '',
  125 + area: '',
  126 + address: '',
  127 + tag_code: '',
  128 + is_default: false
130 }; 129 };
131 }, 130 },
132 watch: { 131 watch: {
133 - 'model.mobile': function(val) { 132 + mobile: function(val) {
134 if (val === this.updateMobileNum) { 133 if (val === this.updateMobileNum) {
135 this.isMobileNumEdit = false; 134 this.isMobileNumEdit = false;
136 } else { 135 } else {
@@ -150,10 +149,10 @@ export default { @@ -150,10 +149,10 @@ export default {
150 }, 149 },
151 inNotEmpty() { 150 inNotEmpty() {
152 return ( 151 return (
153 - this.model.consignee &&  
154 - this.model.mobile &&  
155 - this.model.area &&  
156 - this.model.address 152 + this.consignee &&
  153 + this.mobile &&
  154 + this.area &&
  155 + this.address
157 ); 156 );
158 } 157 }
159 }, 158 },
@@ -209,8 +208,7 @@ export default { @@ -209,8 +208,7 @@ export default {
209 } 208 }
210 }, 209 },
211 validator() { 210 validator() {
212 - let info = this.model;  
213 - let username = info.consignee.replace(/(^\s+)|(\s+$)/g, ''); 211 + let username = this.consignee.replace(/(^\s+)|(\s+$)/g, '');
214 212
215 // 简单的表单校验 213 // 简单的表单校验
216 if (!username) { 214 if (!username) {
@@ -230,38 +228,38 @@ export default { @@ -230,38 +228,38 @@ export default {
230 reg = /^[0123456789]{11}$/; 228 reg = /^[0123456789]{11}$/;
231 } 229 }
232 230
233 - if (!info.mobile) { 231 + if (!this.mobile) {
234 this.showToast('手机号不能为空'); 232 this.showToast('手机号不能为空');
235 return false; 233 return false;
236 } else { 234 } else {
237 - if (!reg.test(info.mobile)) { 235 + if (!reg.test(this.mobile)) {
238 this.showToast('请输入正确11位手机号码'); 236 this.showToast('请输入正确11位手机号码');
239 return; 237 return;
240 } 238 }
241 } 239 }
242 240
243 - if (!info.area_code || !info.area) { 241 + if (!this.area_code || !this.area) {
244 this.showToast('省市区不能为空'); 242 this.showToast('省市区不能为空');
245 return false; 243 return false;
246 } 244 }
247 - if (!info.address) { 245 + if (!this.address) {
248 this.showToast('地址不能为空'); 246 this.showToast('地址不能为空');
249 return false; 247 return false;
250 } 248 }
251 249
252 return { 250 return {
253 - id: info.address_id || '', 251 + id: this.address_id || '',
254 consignee: username, 252 consignee: username,
255 - mobile: info.mobile,  
256 - area_code: info.area_code,  
257 - area: info.area,  
258 - address: info.address,  
259 - is_default: info.is_default ? 'Y' : 'N',  
260 - tag_code: info.tag_code 253 + mobile: this.mobile,
  254 + area_code: this.area_code,
  255 + area: this.area,
  256 + address: this.address,
  257 + is_default: this.is_default ? 'Y' : 'N',
  258 + tag_code: this.tag_code
261 }; 259 };
262 }, 260 },
263 async delAddress() { 261 async delAddress() {
264 - const result = await this.deleteUserAddress(this.model.address_id); 262 + const result = await this.deleteUserAddress(this.address_id);
265 if (result && result.code === 200) { 263 if (result && result.code === 200) {
266 this.$createToast({ 264 this.$createToast({
267 type: 'txt', 265 type: 'txt',
@@ -282,7 +280,7 @@ export default { @@ -282,7 +280,7 @@ export default {
282 this.isShowProvince = true; 280 this.isShowProvince = true;
283 281
284 this.$refs.addressAct.parentHandleclick({ 282 this.$refs.addressAct.parentHandleclick({
285 - areaCode: this.model.area_code 283 + areaCode: this.area_code
286 }); 284 });
287 }, 285 },
288 popHidden() { 286 popHidden() {
@@ -292,8 +290,8 @@ export default { @@ -292,8 +290,8 @@ export default {
292 modifyAddressAct(info) { 290 modifyAddressAct(info) {
293 if (info) { 291 if (info) {
294 let that = this; 292 let that = this;
295 - that.model.area_code = info.code;  
296 - that.model.area = info.area; 293 + that.area_code = info.code;
  294 + that.area = info.area;
297 } 295 }
298 }, 296 },
299 showToast(tip) { 297 showToast(tip) {
@@ -325,16 +323,17 @@ export default { @@ -325,16 +323,17 @@ export default {
325 323
326 if (addressInfo.isUpdate) { 324 if (addressInfo.isUpdate) {
327 this.updateMobileNum = addressInfo.mobile; 325 this.updateMobileNum = addressInfo.mobile;
328 - this.model.consignee = addressInfo.consignee;  
329 - this.model.address_id = addressInfo.address_id;  
330 - this.model.mobile = addressInfo.mobile;  
331 - this.model.area_code = addressInfo.area_code || addressInfo.areaCode;  
332 - this.model.area = addressInfo.area;  
333 - this.model.address = addressInfo.address;  
334 - this.model.tag_code = addressInfo.tag_code;  
335 - this.model.is_default = addressInfo.is_default === 'Y' ? true : false; 326 + this.consignee = addressInfo.consignee;
  327 + this.address_id = addressInfo.address_id;
  328 + this.mobile = addressInfo.mobile;
  329 + this.area_code = addressInfo.area_code || addressInfo.areaCode;
  330 + this.area = addressInfo.area;
  331 + this.address = addressInfo.address;
  332 + this.tag_code = addressInfo.tag_code || '';
  333 + this.is_default = addressInfo.is_default === 'Y' ? true : false;
336 } else { 334 } else {
337 - this.model = {}; 335 + // 重置data数据
  336 + Object.assign(this.$data, this.$options.data());
338 } 337 }
339 } 338 }
340 }; 339 };