243 lines
8.2 KiB
Vue
243 lines
8.2 KiB
Vue
|
|
<template>
|
|||
|
|
<div >
|
|||
|
|
<el-row :gutter="0">
|
|||
|
|
<el-form ref="form" :model="form" size="mini" :rules="rules" label-width="90px">
|
|||
|
|
<!-- <el-col :span="24">
|
|||
|
|
<el-form-item label="客户user_id" prop="userId">
|
|||
|
|
<el-input v-model="form.userId" placeholder="请输入客户user_id" />
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-col>
|
|||
|
|
<el-col :span="24">
|
|||
|
|
<el-form-item label="别名" prop="alias">
|
|||
|
|
<el-input v-model="form.alias" placeholder="请输入别名" />
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-col>
|
|||
|
|
<el-col :span="24">
|
|||
|
|
<el-form-item label="地址类型" prop="addressType">
|
|||
|
|
<el-input v-model="form.addressType" placeholder="请输入地址类型" />
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-col> -->
|
|||
|
|
<el-col :span="12">
|
|||
|
|
<el-form-item label="寄件人" prop="name">
|
|||
|
|
<el-input v-model="form.name" placeholder="请输入姓名" />
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-col>
|
|||
|
|
<el-col :span="12">
|
|||
|
|
<el-form-item label="寄件电话" prop="phone">
|
|||
|
|
<el-input v-model="form.phone" placeholder="请输入电话" />
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-col>
|
|||
|
|
<el-col :span="8">
|
|||
|
|
<el-form-item label="所属国家" prop="country">
|
|||
|
|
<CountryPicker :placeholder="$t('所属国家')" v-model="form.country" ></CountryPicker>
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-col>
|
|||
|
|
<el-col :span="16">
|
|||
|
|
<el-form-item label="省市区" prop="province">
|
|||
|
|
<div style="display: inline-flex">
|
|||
|
|
<ProvincePicker v-model="form.province" :countryCode="form.country" ></ProvincePicker>
|
|||
|
|
<CityPicker v-model="form.city" :parentCode="form.province" ></CityPicker>
|
|||
|
|
<DistrictPicker v-model="form.county" :parentCode="form.city" ></DistrictPicker>
|
|||
|
|
<!-- <TownPicker v-model="form.town" :parentCode="form.county" ></TownPicker> -->
|
|||
|
|
</div>
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-col>
|
|||
|
|
<el-col :span="24">
|
|||
|
|
<el-form-item label="地址" prop="address">
|
|||
|
|
<el-input v-model="form.address" type="textarea" placeholder="请输入地址" />
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-col>
|
|||
|
|
|
|||
|
|
<el-col :span="12">
|
|||
|
|
<el-form-item label="邮编(选填)" prop="postCode">
|
|||
|
|
<el-input v-model="form.postCode" placeholder="请输入邮编" />
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-col>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<el-col :span="12">
|
|||
|
|
<el-form-item label="邮箱(选填)" prop="email">
|
|||
|
|
<el-input v-model="form.email" placeholder="请输入email" />
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-col>
|
|||
|
|
<el-col :span="24">
|
|||
|
|
<el-form-item label="公司(选填" prop="company">
|
|||
|
|
<el-input v-model="form.company" placeholder="请输入公司" />
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-col>
|
|||
|
|
<el-col :span="24">
|
|||
|
|
<el-form-item label="智能填写" prop="parseAddress" style="position: relative">
|
|||
|
|
<el-input v-model="form.parseAddress" type="textarea" rows="5" placeholder="粘贴整段地址,自动识别姓名,公司名称(输入需包含“公司”两个字),手机号码、固话和地址,每项用逗号隔开更准确“例如XXX,XX公司,188****8888,021-88****88,上海上海市xxx区xx路1080号" >
|
|||
|
|
</el-input>
|
|||
|
|
<el-button @click="handleParseAddress" type="primary" size="mini" style="position:absolute;bottom:8px;right:8px" >智能识别</el-button>
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-col>
|
|||
|
|
|
|||
|
|
<!-- <el-col :span="24">
|
|||
|
|
<el-form-item label="是否默认" prop="blDefaultFlag">
|
|||
|
|
<el-input v-model="form.blDefaultFlag" placeholder="请输入是否默认" />
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-col> -->
|
|||
|
|
<!-- <el-col :span="24">
|
|||
|
|
<el-form-item label="排序" prop="orderNum">
|
|||
|
|
<el-input v-model="form.orderNum" placeholder="请输入排序" />
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-col> -->
|
|||
|
|
<!-- <el-col :span="24">
|
|||
|
|
<el-form-item label="备注" prop="remark">
|
|||
|
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
|||
|
|
</el-form-item>
|
|||
|
|
</el-col> -->
|
|||
|
|
</el-form>
|
|||
|
|
</el-row>
|
|||
|
|
<div style="text-align: center;margin-bottom: 10px;">
|
|||
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|||
|
|
<el-button @click="cancel">取 消</el-button>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<script>
|
|||
|
|
import { listEmisCustomerAddress, getEmisCustomerAddress, delEmisCustomerAddress, addEmisCustomerAddress, updateEmisCustomerAddress } from "@/api/emis/emisCustomerAddress";
|
|||
|
|
import { parseAddress } from "@/api/emis/emisCommon";
|
|||
|
|
|
|||
|
|
|
|||
|
|
import CountryPicker from '@/views/emis/EmisBaseTools/CountryPicker.vue';
|
|||
|
|
import ProvincePicker from '@/views/emis/EmisBaseTools/ProvincePicker.vue';
|
|||
|
|
import CityPicker from '@/views/emis/EmisBaseTools/CityPicker.vue';
|
|||
|
|
import DistrictPicker from '@/views/emis/EmisBaseTools/DistrictPicker.vue';
|
|||
|
|
export default {
|
|||
|
|
name: "emisCustomerAddressForm",
|
|||
|
|
props:{
|
|||
|
|
id:undefined
|
|||
|
|
},
|
|||
|
|
components: { CountryPicker,ProvincePicker,CityPicker,DistrictPicker },
|
|||
|
|
dicts: [
|
|||
|
|
],
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
emisCustomerAddressOptions: [],
|
|||
|
|
// 遮罩层
|
|||
|
|
loading: true,
|
|||
|
|
// 表单参数
|
|||
|
|
form: {},
|
|||
|
|
// 表单校验
|
|||
|
|
rules: {
|
|||
|
|
country: [
|
|||
|
|
{ required: true, message: "国家不能为空", trigger: "blur" }
|
|||
|
|
],
|
|||
|
|
name: [
|
|||
|
|
{ required: true, message: "姓名不能为空", trigger: "blur" }
|
|||
|
|
],
|
|||
|
|
phone: [
|
|||
|
|
{ required: true, message: "电话不能为空", trigger: "blur" }
|
|||
|
|
],
|
|||
|
|
province: [
|
|||
|
|
{ required: true, message: "省不能为空", trigger: "blur" }
|
|||
|
|
],
|
|||
|
|
address: [
|
|||
|
|
{ required: true, message: "地址不能为空", trigger: "blur" }
|
|||
|
|
],
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
watch: {
|
|||
|
|
"id": {
|
|||
|
|
handler (newValue, oldValue) {
|
|||
|
|
this.id = newValue;
|
|||
|
|
this.initData();
|
|||
|
|
},
|
|||
|
|
deep: true
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
created() {
|
|||
|
|
this.initData();
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
methods: {
|
|||
|
|
handleParseAddress(){
|
|||
|
|
this.loading = true;
|
|||
|
|
if(this.form.parseAddress){
|
|||
|
|
parseAddress(this.form.parseAddress).then(response => {
|
|||
|
|
// this.form = response.data;
|
|||
|
|
this.loading = false;
|
|||
|
|
let rst=response.data;
|
|||
|
|
this.form.name=rst.name;
|
|||
|
|
this.form.country=rst.country;
|
|||
|
|
this.form.province=rst.province;
|
|||
|
|
this.form.county=rst.county;
|
|||
|
|
this.form.phone=rst.phone;
|
|||
|
|
this.form.address=rst.address;
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
initData() {
|
|||
|
|
this.reset();
|
|||
|
|
if(this.id !=undefined) {
|
|||
|
|
this.loading = true;
|
|||
|
|
getEmisCustomerAddress(this.id).then(response => {
|
|||
|
|
this.form = response.data;
|
|||
|
|
this.loading = false;
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
// 取消按钮
|
|||
|
|
cancel() {
|
|||
|
|
this.reset();
|
|||
|
|
this.$emit("on-cancel");
|
|||
|
|
},
|
|||
|
|
// 表单重置
|
|||
|
|
reset() {
|
|||
|
|
this.form = {
|
|||
|
|
id: null,
|
|||
|
|
userId: null,
|
|||
|
|
alias: null,
|
|||
|
|
addressType: 1,
|
|||
|
|
province: null,
|
|||
|
|
city: null,
|
|||
|
|
county: null,
|
|||
|
|
town: null,
|
|||
|
|
address: null,
|
|||
|
|
postCode: null,
|
|||
|
|
name: null,
|
|||
|
|
phone: null,
|
|||
|
|
country: null,
|
|||
|
|
email: null,
|
|||
|
|
company: null,
|
|||
|
|
blDefaultFlag: null,
|
|||
|
|
orderNum: null,
|
|||
|
|
delFlag: null,
|
|||
|
|
createBy: null,
|
|||
|
|
createTime: null,
|
|||
|
|
updateBy: null,
|
|||
|
|
updateTime: null,
|
|||
|
|
remark: null,
|
|||
|
|
parseAddress:null,
|
|||
|
|
};
|
|||
|
|
this.resetForm("form");
|
|||
|
|
},
|
|||
|
|
/** 提交按钮 */
|
|||
|
|
submitForm() {
|
|||
|
|
this.$refs["form"].validate(valid => {
|
|||
|
|
if (valid) {
|
|||
|
|
if (this.form.id != null) {
|
|||
|
|
updateEmisCustomerAddress(this.form).then(response => {
|
|||
|
|
this.$modal.msgSuccess("修改成功");
|
|||
|
|
this.$emit("on-changed");
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
addEmisCustomerAddress(this.form).then(response => {
|
|||
|
|
this.$modal.msgSuccess("修改成功");
|
|||
|
|
this.$emit("on-changed");
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
</script>
|