fix:修复二次添加地址

merge-requests/86/merge
张征 3 years ago
parent 137945dbe6
commit 1a0aa89c65

@ -212,13 +212,7 @@ export default {
onCanceloperation() { onCanceloperation() {
let vm = this; let vm = this;
vm.isOperation = false; vm.isOperation = false;
vm.$set(vm.selectData.area, "value", ""); vm.clearForm();
vm.$set(vm.selectData.city, "value", "");
vm.$set(vm.selectData.province, "value", "");
vm.$set(vm, "detailAddress", "");
vm.$set(vm, "defaultAddress", "");
vm.$set(vm, "addressUser", "");
vm.$set(vm, "addressPhone", "");
vm.$emit("onSaveSuccess"); vm.$emit("onSaveSuccess");
}, },
onEdit() { onEdit() {
@ -274,8 +268,8 @@ export default {
}, },
async onAddAddress() { async onAddAddress() {
let vm = this; let vm = this;
let curItem = vm.addressList[vm.editIndex] let curItem = vm.addressList[vm.editIndex];
console.log(`vm.addressPhone != curItem.phone`,vm.addressPhone , curItem); console.log(`vm.addressPhone != curItem.phone`, vm.addressPhone, curItem);
if (!vm.selectData?.area?.code) { if (!vm.selectData?.area?.code) {
vm.$message.error("请选择所在区域~"); vm.$message.error("请选择所在区域~");
return; return;
@ -313,13 +307,7 @@ export default {
} }
if (!res.error) { if (!res.error) {
vm.$message.success("添加成功!"); vm.$message.success("添加成功!");
vm.$set(vm.selectData.area, "value", ""); vm.clearForm();
vm.$set(vm.selectData.city, "value", "");
vm.$set(vm.selectData.province, "value", "");
vm.$set(vm, "detailAddress", "");
vm.$set(vm, "defaultAddress", "");
vm.$set(vm, "addressUser", "");
vm.$set(vm, "addressPhone", "");
vm.$emit("onSaveSuccess"); vm.$emit("onSaveSuccess");
vm.isEdit = false; vm.isEdit = false;
vm.getAddressData(); vm.getAddressData();
@ -332,6 +320,19 @@ export default {
vm.$emit("emitAddress", item); vm.$emit("emitAddress", item);
vm.dialogVisible = false; vm.dialogVisible = false;
}, },
clearForm() {
let vm = this;
vm.$set(vm.selectData.area, "value", "");
vm.$set(vm.selectData.city, "value", "");
vm.$set(vm.selectData.province, "value", "");
vm.$set(vm.selectData.area, "code", "");
vm.$set(vm.selectData.city, "code", "");
vm.$set(vm.selectData.province, "code", "");
vm.$set(vm, "detailAddress", "");
vm.$set(vm, "defaultAddress", "");
vm.$set(vm, "addressUser", "");
vm.$set(vm, "addressPhone", "");
},
}, },
}; };
</script> </script>

Loading…
Cancel
Save