2024-08-03 16:16:28 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<!-- 对话框(添加 / 修改) -->
|
|
|
|
|
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="60%" v-dialogDrag append-to-body>
|
|
|
|
|
<el-card class="box-card">
|
|
|
|
|
<div slot="header" class="clearfix">
|
|
|
|
|
<span>客户基本信息</span>
|
|
|
|
|
</div>
|
|
|
|
|
<el-descriptions class="margin-top" :column="3" border>
|
|
|
|
|
<el-descriptions-item>
|
|
|
|
|
<template slot="label">
|
|
|
|
|
客户名称
|
|
|
|
|
</template>
|
|
|
|
|
{{formData.cusName}}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item>
|
|
|
|
|
<template slot="label">
|
|
|
|
|
性别
|
|
|
|
|
</template>
|
|
|
|
|
<dict-tag :type="DICT_TYPE.DICT_SYS_USER_SEX" :value="formData.sex" />
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item>
|
|
|
|
|
<template slot="label">
|
|
|
|
|
联系方式
|
|
|
|
|
</template>
|
|
|
|
|
{{formData.phoneNumber}}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item>
|
|
|
|
|
<template slot="label">
|
|
|
|
|
生日
|
|
|
|
|
</template>
|
|
|
|
|
{{ parseTime(formData.birthday,'{y}-{m}-{d}') }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item>
|
|
|
|
|
<template slot="label">
|
|
|
|
|
客户来源
|
|
|
|
|
</template>
|
|
|
|
|
<dict-tag :type="DICT_TYPE.DICT_CUS_DATA_FROM" :value="formData.dataFrom" />
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item>
|
|
|
|
|
<template slot="label">
|
|
|
|
|
最近办理业务
|
|
|
|
|
</template>
|
|
|
|
|
<dict-tag :type="DICT_TYPE.DICT_CUS_BUSI_TYPE" :value="formData.nearDoContent" />
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item>
|
|
|
|
|
<template slot="label">
|
|
|
|
|
联系地址
|
|
|
|
|
</template>
|
|
|
|
|
{{formData.address}}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
</el-descriptions>
|
|
|
|
|
</el-card>
|
|
|
|
|
<el-card class="box-card">
|
|
|
|
|
<div slot="header" class="clearfix">
|
|
|
|
|
<span>车辆信息</span>
|
|
|
|
|
<el-button @click="openChooseCar" style="float: right; padding: 3px 0" type="text">选择车辆</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
<el-row>
|
2024-08-03 21:51:33 +08:00
|
|
|
|
<el-empty v-if="formData.carList.length == 0" description="暂无车辆信息" :image-size="100"></el-empty>
|
|
|
|
|
<el-col v-for="item in formData.carList" :span="8">
|
|
|
|
|
<el-card shadow="hover">
|
|
|
|
|
<el-descriptions>
|
|
|
|
|
<template slot="title">
|
|
|
|
|
{{item.carBrand}}({{item.carModel}})
|
2024-08-04 10:43:41 +08:00
|
|
|
|
<el-button @click="deleteCar(item)" style="text-align: right" size="mini" type="danger" icon="el-icon-delete" circle></el-button>
|
2024-08-03 21:51:33 +08:00
|
|
|
|
</template>
|
|
|
|
|
<el-descriptions-item label="车主"> <el-checkbox true-label="1" false-label="0" v-model="item.isOwner" /></el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="车牌号">{{item.licenseNumber}}</el-descriptions-item>
|
|
|
|
|
</el-descriptions>
|
|
|
|
|
|
2024-08-03 16:16:28 +08:00
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
2024-08-03 21:51:33 +08:00
|
|
|
|
|
2024-08-03 16:16:28 +08:00
|
|
|
|
</el-row>
|
|
|
|
|
</el-card>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
|
|
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
2024-08-03 21:51:33 +08:00
|
|
|
|
<ChooseCarDraw @success="chooseCar" ref="chooseCarForm"/>
|
2024-08-03 16:16:28 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import * as CustomerMainApi from '@/api/base/customer';
|
|
|
|
|
import ChooseCarDraw from '@/views/base/customer/ChooseCarDraw.vue';
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "CustomerMainForm",
|
|
|
|
|
components: {
|
|
|
|
|
ChooseCarDraw
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
// 弹出层标题
|
|
|
|
|
dialogTitle: "",
|
|
|
|
|
// 是否显示弹出层
|
|
|
|
|
dialogVisible: false,
|
|
|
|
|
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
|
|
|
formLoading: false,
|
|
|
|
|
//回参
|
2024-08-03 21:51:33 +08:00
|
|
|
|
formData:{
|
|
|
|
|
carList:[],
|
|
|
|
|
},
|
2024-08-03 16:16:28 +08:00
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
|
|
/** 打开弹窗 */
|
|
|
|
|
async open(row) {
|
|
|
|
|
this.dialogVisible = true;
|
|
|
|
|
this.formLoading = true;
|
2024-08-03 21:51:33 +08:00
|
|
|
|
this.reset()
|
2024-08-03 16:16:28 +08:00
|
|
|
|
try{
|
|
|
|
|
const res = await CustomerMainApi.getCustomerMain(row.id);
|
|
|
|
|
this.formData = res.data
|
|
|
|
|
this.dialogTitle = "绑定车辆";
|
|
|
|
|
}finally {
|
|
|
|
|
this.formLoading = false;
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-08-04 10:43:41 +08:00
|
|
|
|
/**删除卡片*/
|
|
|
|
|
deleteCar(row){
|
|
|
|
|
this.formData.carList.forEach((item,index) => {
|
|
|
|
|
if (item.id == row.id){
|
|
|
|
|
this.formData.carList.splice(index,1)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
2024-08-03 21:51:33 +08:00
|
|
|
|
/**重置*/
|
|
|
|
|
reset(){
|
|
|
|
|
this.formData={
|
|
|
|
|
carList:[],
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-08-03 16:16:28 +08:00
|
|
|
|
|
|
|
|
|
openChooseCar(){
|
2024-08-03 21:51:33 +08:00
|
|
|
|
this.$refs["chooseCarForm"].open(this.formData.carList);
|
2024-08-03 16:16:28 +08:00
|
|
|
|
},
|
|
|
|
|
|
2024-08-03 21:51:33 +08:00
|
|
|
|
/**
|
|
|
|
|
* 选择车辆
|
|
|
|
|
*/
|
|
|
|
|
chooseCar(chooseCars){
|
|
|
|
|
this.formData.carList = chooseCars
|
|
|
|
|
},
|
2024-08-03 16:16:28 +08:00
|
|
|
|
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
async submitForm() {
|
2024-08-03 21:51:33 +08:00
|
|
|
|
this.formLoading = true
|
|
|
|
|
try{
|
|
|
|
|
const data = this.formData;
|
|
|
|
|
await CustomerMainApi.bindCustomerCar(data);
|
|
|
|
|
this.$modal.msgSuccess("绑定成功");
|
|
|
|
|
this.dialogVisible = false;
|
|
|
|
|
this.$emit('success');
|
|
|
|
|
}finally {
|
|
|
|
|
this.formLoading = false
|
|
|
|
|
}
|
2024-08-03 16:16:28 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|