...
|
...
|
@@ -5,8 +5,8 @@ |
|
|
<CInput
|
|
|
label="收货人"
|
|
|
place-holder="请写姓名"
|
|
|
v-model="model.consignee"
|
|
|
:textValue="model.consignee"
|
|
|
v-model="consignee"
|
|
|
:textValue="consignee"
|
|
|
type="text"
|
|
|
></CInput>
|
|
|
</FormItem>
|
...
|
...
|
@@ -14,8 +14,8 @@ |
|
|
<CInput
|
|
|
label="手机号"
|
|
|
place-holder="请填写手机号"
|
|
|
v-model="model.mobile"
|
|
|
:textValue="model.mobile"
|
|
|
v-model="mobile"
|
|
|
:textValue="mobile"
|
|
|
></CInput>
|
|
|
</FormItem>
|
|
|
|
...
|
...
|
@@ -24,8 +24,8 @@ |
|
|
<div class="wrapper-area">
|
|
|
<label class="input-label">所在区域</label>
|
|
|
<div class="wrapper-arrow" @click="chooseArea">
|
|
|
<template v-if="model.area">
|
|
|
<label class="text-label">{{ model.area }}</label>
|
|
|
<template v-if="area">
|
|
|
<label class="text-label">{{ area }}</label>
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
<label class="choose-area">请选择</label>
|
...
|
...
|
@@ -40,8 +40,8 @@ |
|
|
<CInput
|
|
|
label="详细地址"
|
|
|
place-holder="请输入详细地址"
|
|
|
v-model="model.address"
|
|
|
:textValue="model.address"
|
|
|
v-model="address"
|
|
|
:textValue="address"
|
|
|
></CInput>
|
|
|
</FormItem>
|
|
|
<!-- 订单修改地址隐藏 -->
|
...
|
...
|
@@ -53,8 +53,8 @@ |
|
|
<Radio
|
|
|
class="tag-radio"
|
|
|
:label="{ text: `${tag.name}`, value: `${tag.code}` }"
|
|
|
v-model="model.tag_code"
|
|
|
checked="tag.code === model.tag_code"
|
|
|
v-model="tag_code"
|
|
|
:checked="tag.code === tag_code"
|
|
|
></Radio>
|
|
|
</div>
|
|
|
</RadioGroup>
|
...
|
...
|
@@ -66,8 +66,8 @@ |
|
|
class="radio"
|
|
|
:label="{ text: '设为默认地址', value: true }"
|
|
|
style="flex: 0 1 100%;"
|
|
|
checked="model.is_default"
|
|
|
v-model="model.is_default"
|
|
|
checked="is_default"
|
|
|
v-model="is_default"
|
|
|
></Radio>
|
|
|
</div>
|
|
|
</div>
|
...
|
...
|
@@ -117,20 +117,19 @@ export default { |
|
|
isMobileNumEdit: false,
|
|
|
title: '',
|
|
|
orderCode: '',
|
|
|
model: {
|
|
|
consignee: '',
|
|
|
address_id: '',
|
|
|
mobile: '',
|
|
|
area_code: '',
|
|
|
area: '',
|
|
|
address: '',
|
|
|
tag_code: '',
|
|
|
is_default: false
|
|
|
}
|
|
|
|
|
|
consignee: '',
|
|
|
address_id: '',
|
|
|
mobile: '',
|
|
|
area_code: '',
|
|
|
area: '',
|
|
|
address: '',
|
|
|
tag_code: '',
|
|
|
is_default: false
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
'model.mobile': function(val) {
|
|
|
mobile: function(val) {
|
|
|
if (val === this.updateMobileNum) {
|
|
|
this.isMobileNumEdit = false;
|
|
|
} else {
|
...
|
...
|
@@ -150,10 +149,10 @@ export default { |
|
|
},
|
|
|
inNotEmpty() {
|
|
|
return (
|
|
|
this.model.consignee &&
|
|
|
this.model.mobile &&
|
|
|
this.model.area &&
|
|
|
this.model.address
|
|
|
this.consignee &&
|
|
|
this.mobile &&
|
|
|
this.area &&
|
|
|
this.address
|
|
|
);
|
|
|
}
|
|
|
},
|
...
|
...
|
@@ -209,8 +208,7 @@ export default { |
|
|
}
|
|
|
},
|
|
|
validator() {
|
|
|
let info = this.model;
|
|
|
let username = info.consignee.replace(/(^\s+)|(\s+$)/g, '');
|
|
|
let username = this.consignee.replace(/(^\s+)|(\s+$)/g, '');
|
|
|
|
|
|
// 简单的表单校验
|
|
|
if (!username) {
|
...
|
...
|
@@ -230,38 +228,38 @@ export default { |
|
|
reg = /^[0123456789]{11}$/;
|
|
|
}
|
|
|
|
|
|
if (!info.mobile) {
|
|
|
if (!this.mobile) {
|
|
|
this.showToast('手机号不能为空');
|
|
|
return false;
|
|
|
} else {
|
|
|
if (!reg.test(info.mobile)) {
|
|
|
if (!reg.test(this.mobile)) {
|
|
|
this.showToast('请输入正确11位手机号码');
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!info.area_code || !info.area) {
|
|
|
if (!this.area_code || !this.area) {
|
|
|
this.showToast('省市区不能为空');
|
|
|
return false;
|
|
|
}
|
|
|
if (!info.address) {
|
|
|
if (!this.address) {
|
|
|
this.showToast('地址不能为空');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
id: info.address_id || '',
|
|
|
id: this.address_id || '',
|
|
|
consignee: username,
|
|
|
mobile: info.mobile,
|
|
|
area_code: info.area_code,
|
|
|
area: info.area,
|
|
|
address: info.address,
|
|
|
is_default: info.is_default ? 'Y' : 'N',
|
|
|
tag_code: info.tag_code
|
|
|
mobile: this.mobile,
|
|
|
area_code: this.area_code,
|
|
|
area: this.area,
|
|
|
address: this.address,
|
|
|
is_default: this.is_default ? 'Y' : 'N',
|
|
|
tag_code: this.tag_code
|
|
|
};
|
|
|
},
|
|
|
async delAddress() {
|
|
|
const result = await this.deleteUserAddress(this.model.address_id);
|
|
|
const result = await this.deleteUserAddress(this.address_id);
|
|
|
if (result && result.code === 200) {
|
|
|
this.$createToast({
|
|
|
type: 'txt',
|
...
|
...
|
@@ -282,7 +280,7 @@ export default { |
|
|
this.isShowProvince = true;
|
|
|
|
|
|
this.$refs.addressAct.parentHandleclick({
|
|
|
areaCode: this.model.area_code
|
|
|
areaCode: this.area_code
|
|
|
});
|
|
|
},
|
|
|
popHidden() {
|
...
|
...
|
@@ -292,8 +290,8 @@ export default { |
|
|
modifyAddressAct(info) {
|
|
|
if (info) {
|
|
|
let that = this;
|
|
|
that.model.area_code = info.code;
|
|
|
that.model.area = info.area;
|
|
|
that.area_code = info.code;
|
|
|
that.area = info.area;
|
|
|
}
|
|
|
},
|
|
|
showToast(tip) {
|
...
|
...
|
@@ -325,16 +323,17 @@ export default { |
|
|
|
|
|
if (addressInfo.isUpdate) {
|
|
|
this.updateMobileNum = addressInfo.mobile;
|
|
|
this.model.consignee = addressInfo.consignee;
|
|
|
this.model.address_id = addressInfo.address_id;
|
|
|
this.model.mobile = addressInfo.mobile;
|
|
|
this.model.area_code = addressInfo.area_code || addressInfo.areaCode;
|
|
|
this.model.area = addressInfo.area;
|
|
|
this.model.address = addressInfo.address;
|
|
|
this.model.tag_code = addressInfo.tag_code;
|
|
|
this.model.is_default = addressInfo.is_default === 'Y' ? true : false;
|
|
|
this.consignee = addressInfo.consignee;
|
|
|
this.address_id = addressInfo.address_id;
|
|
|
this.mobile = addressInfo.mobile;
|
|
|
this.area_code = addressInfo.area_code || addressInfo.areaCode;
|
|
|
this.area = addressInfo.area;
|
|
|
this.address = addressInfo.address;
|
|
|
this.tag_code = addressInfo.tag_code || '';
|
|
|
this.is_default = addressInfo.is_default === 'Y' ? true : false;
|
|
|
} else {
|
|
|
this.model = {};
|
|
|
// 重置data数据
|
|
|
Object.assign(this.$data, this.$options.data());
|
|
|
}
|
|
|
}
|
|
|
};
|
...
|
...
|
|