Compare commits

..

No commits in common. "e8a5ca28648920bf74fb62b32a7c0076884d7a87" and "d79160ac533dffa25e2d96cd01559a11370eeca7" have entirely different histories.

2 changed files with 234 additions and 302 deletions

View File

@ -25,26 +25,16 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="角色" prop="roleCode">
<!-- <el-form-item label="角色" prop="roleCode">--> <el-select v-model="queryParams.roleCode" placeholder="请选择角色">
<!-- <el-select v-model="queryParams.roleCode" placeholder="请选择角色">--> <el-option
<!-- <el-option--> v-for="dict in dict.type.jcz_role"
<!-- v-for="dict in dict.type.jcz_role"--> :key="dict.value"
<!-- :key="dict.value"--> :label="dict.label"
<!-- :label="dict.label"--> :value="dict.value"
<!-- :value="dict.value"--> ></el-option>
<!-- ></el-option>--> </el-select>
<!-- </el-select>--> </el-form-item>
<!-- </el-form-item>-->
<!--简单比较不做角色绑定-->
<el-table-column label="角色" align="center">
<template slot-scope="scope">
<span>{{ getOrderCount(scope.row.userId) > 1 ? '疑似代办' : '普通用户' }}</span>
</template>
</el-table-column>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -68,13 +58,7 @@
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="客户名称" align="center" prop="customerName" /> <el-table-column label="客户名称" align="center" prop="customerName" />
<el-table-column label="客户手机号" align="center" prop="customerPhone" /> <el-table-column label="客户手机号" align="center" prop="customerPhone" />
<el-table-column label="标签" align="center"> <el-table-column label="角色" align="center" prop="roleName" />
<template slot-scope="scope">
<el-tag v-if="scope.row.orderCount > 3" type="danger">疑似代办</el-tag>
<el-tag v-else type="success">正常</el-tag>
</template>
</el-table-column>
<el-table-column label="本年度订单数量" align="center" prop="orderCount"/>
<el-table-column label="性别" align="center" prop="sex"> <el-table-column label="性别" align="center" prop="sex">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex"/> <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex"/>
@ -83,11 +67,11 @@
<el-table-column label="年龄" align="center" prop="userAge" /> <el-table-column label="年龄" align="center" prop="userAge" />
<el-table-column label="车辆号码----------保险到期时间-------年检到期时间 " width="355" align="center" prop="userCarList" > <el-table-column label="车辆号码----------保险到期时间-------年检到期时间 " width="355" align="center" prop="userCarList" >
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <div style="display: flex">--> <!-- <div style="display: flex">-->
<!-- <div>{{scope.row.userCarList.carNo}}</div>--> <!-- <div>{{scope.row.userCarList.carNo}}</div>-->
<!-- <div>{{scope.row.userCarList.insuranceExpiryDate}}</div>--> <!-- <div>{{scope.row.userCarList.insuranceExpiryDate}}</div>-->
<!-- <div>{{scope.row.userCarList.nextInspectionDate}}</div>--> <!-- <div>{{scope.row.userCarList.nextInspectionDate}}</div>-->
<!-- </div>--> <!-- </div>-->
<el-table v-loading="loading" :show-header="tou" :data="scope.row.userCarList" > <el-table v-loading="loading" :show-header="tou" :data="scope.row.userCarList" >
@ -178,7 +162,7 @@
<!-- 新增上传车辆信息--> <!-- 新增上传车辆信息-->
<div v-for="(item,index) in form.userCarList" :key="index" style="width: 100%; "> <div v-for="(item,index) in form.userCarList" :key="index" style="width: 100%; ">
<el-collapse v-model="activeName" accordion> <el-collapse v-model="activeName" accordion>
<el-collapse-item title="车辆信息" accordion> <el-collapse-item title="车辆信息" accordion>
@ -257,26 +241,26 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="保险日期" prop="insuranceDate"> <el-form-item label="保险日期" prop="insuranceDate">
<el-date-picker <el-date-picker
v-model="item.insuranceDate" v-model="item.insuranceDate"
type="date" type="date"
placeholder="保险日期"> placeholder="保险日期">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" > <el-col :span="12" >
<el-form-item label="保险到期日期" prop="insuranceExpiryDate"> <el-form-item label="保险到期日期" prop="insuranceExpiryDate">
<el-date-picker <el-date-picker
v-model="item.insuranceExpiryDate" v-model="item.insuranceExpiryDate"
type="date" type="date"
placeholder="保险到期日期"> placeholder="保险到期日期">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -305,7 +289,7 @@
</div> </div>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
@ -315,260 +299,218 @@
</template> </template>
<script> <script>
import { import { listCustomerInfo, getCustomerInfo, delCustomerInfo, addCustomerInfo, updateCustomerInfo } from "./api/customer";
listCustomerInfo, import request from "@/utils/request";
getCustomerInfo, import DictTag from '@/components/DictTagOld/index.vue'
delCustomerInfo,
addCustomerInfo,
updateCustomerInfo,
getUserOrderCounts
} from './api/customer';
import request from "@/utils/request";
import DictTag from '@/components/DictTagOld/index.vue'
export default { export default {
name: "CustomerInfo", name: "CustomerInfo",
components:{DictTag}, components:{DictTag},
dicts: ['sys_user_sex','jcz_role'], dicts: ['sys_user_sex','jcz_role'],
data() { data() {
return { return {
tou:false, tou:false,
// //
loading: true, loading: true,
// //
ids: [], ids: [],
// //
single: true, single: true,
// //
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
customerInfoList: [], customerInfoList: [],
// // userCarList:[],
userOrderCounts: [], //
// userCarList:[], title: "",
// //
title: "", open: false,
// //
open: false, queryParams: {
// pageNo: 1,
queryParams: { pageSize: 10,
pageNo: 1, customerName: null,
pageSize: 10, customerPhone: null,
customerName: null, carNum:null,
customerPhone: null, },
carNum:null, //
}, form: {
// userCarList:[{
form: { carModel:'',
userCarList:[{ carNo:'',
carModel:'', maintenanceDate:'',
carNo:'', maintenanceMileage:'',
maintenanceDate:'', inspectionDate:'',
maintenanceMileage:'', insuranceDate:'',
inspectionDate:'', nextMaintenanceDate:'',
insuranceDate:'', nextMaintenanceMileage:'',
nextMaintenanceDate:'', nextInspectionDate:'',
nextMaintenanceMileage:'', insuranceExpiryDate:'',
nextInspectionDate:'', }]
insuranceExpiryDate:'', },
}] carModel:'',
}, carNo:'',
carModel:'', maintenanceDate:'',
carNo:'', maintenanceMileage:'',
maintenanceDate:'', inspectionDate:'',
maintenanceMileage:'', insuranceDate:'',
inspectionDate:'', nextMaintenanceDate:'',
insuranceDate:'', nextMaintenanceMileage:'',
nextMaintenanceDate:'', nextInspectionDate:'',
nextMaintenanceMileage:'', insuranceExpiryDate:'',
nextInspectionDate:'', //
insuranceExpiryDate:'', rules: {
// }
rules: {
}
};
},
created() {
this.dict = {type:{}}
for (let i = 0; i < this.$options.dicts.length; i++) {
request({
url: '/rescue/dict/data/type/'+this.$options.dicts[i],
method: 'get'
}).then(res=>{
this.$set(this.dict.type,this.$options.dicts[i],res.data)
})
}
this.getList();
// this.queryUserOrderCounts();
},
methods: {
addCommodity(){
let data = {
carModel:this.carModel,
carNo:this.carNo,
maintenanceDate:this.maintenanceDate,
maintenanceMileage:this.maintenanceMileage,
inspectionDate:this.inspectionDate,
insuranceDate:this.insuranceDate,
nextMaintenanceDate:this.nextMaintenanceDate,
nextMaintenanceMileage:this.nextMaintenanceMileage,
nextInspectionDate:this.nextInspectionDate,
insuranceExpiryDate:this.insuranceExpiryDate,
}
this.form.userCarList.push(data)
},
deletecomm(index){
this.form.userCarList.splice(index, 1);
},
/** 查询客户信息列表 */
getList() {
this.loading = true;
//
listCustomerInfo(this.queryParams).then(response => {
this.customerInfoList = response.data.records;
this.total = response.data.total;
this.loading = false;
//
// return getUserOrderCounts().then(userOrderCounts => {
// console.log(":", userOrderCounts.data);
// this.userOrderCounts = userOrderCounts.data;
// }).catch(error => {
// console.error(":", error);
// });
// }).then(userOrderCounts => {
// this.userOrderCounts = userOrderCounts.data;
});
},
// getRoleLabel(userId) {
// const orderCount = this.getOrderCount(userId);
// return orderCount > 1 ? '' : '';
// },
queryUserOrderCounts() {
getUserOrderCounts().then(userOrderCounts => {
console.log("成功获取用户订单数量:", userOrderCounts);
//
this.userOrderCounts = userOrderCounts.data;
this.getList();
}).catch(error => {
console.error("获取用户订单数量失败:", error);
});
},
getOrderCount(userId) {
const userOrder = this.userOrderCounts.find(order => order.userId === userId);
console.log("用户订单数量:", this.userOrderCounts,userOrder);
// 0
return userOrder ? userOrder.orderCount : 0;
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
partnerId: null,
customerName: null,
customerPhone: null,
userId: null,
sex: null,
userAge: null,
deptId: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: null,
userCarList:[{
carModel:'',
carNo:'',
maintenanceDate:'',
maintenanceMileage:'',
inspectionDate:'',
insuranceDate:'',
nextMaintenanceDate:'',
nextMaintenanceMileage:'',
nextInspectionDate:'',
insuranceExpiryDate:'',
}]
}; };
this.resetForm("form");
}, },
/** 搜索按钮操作 */ created() {
handleQuery() { this.dict = {type:{}}
this.queryParams.pageNo = 1; for (let i = 0; i < this.$options.dicts.length; i++) {
request({
url: '/rescue/dict/data/type/'+this.$options.dicts[i],
method: 'get'
}).then(res=>{
this.$set(this.dict.type,this.$options.dicts[i],res.data)
})
}
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ methods: {
resetQuery() { addCommodity(){
this.resetForm("queryForm"); let data = {
this.handleQuery(); carModel:this.carModel,
}, carNo:this.carNo,
// maintenanceDate:this.maintenanceDate,
handleSelectionChange(selection) { maintenanceMileage:this.maintenanceMileage,
this.ids = selection.map(item => item.id) inspectionDate:this.inspectionDate,
this.single = selection.length!==1 insuranceDate:this.insuranceDate,
this.multiple = !selection.length nextMaintenanceDate:this.nextMaintenanceDate,
}, nextMaintenanceMileage:this.nextMaintenanceMileage,
/** 新增按钮操作 */ nextInspectionDate:this.nextInspectionDate,
handleAdd() { insuranceExpiryDate:this.insuranceExpiryDate,
this.reset();
this.open = true;
this.title = "添加客户信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
const id = row.id || this.ids
this.form = row;
this.open = true;
this.title = "修改客户信息";
// this.reset();
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateCustomerInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCustomerInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
} }
}); this.form.userCarList.push(data)
}, },
/** 删除按钮操作 */ deletecomm(index){
handleDelete(row) { this.form.userCarList.splice(index, 1);
const ids = row.id || this.ids; },
this.$modal.confirm('是否确认删除客户信息编号为"' + ids + '"的数据项?').then(function() { /** 查询客户信息列表 */
return delCustomerInfo(ids); getList() {
}).then(() => { this.loading = true;
listCustomerInfo(this.queryParams).then(response => {
this.customerInfoList = response.data.records;
// this.userCarList = response.rows.userCarList
this.total = response.data.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
partnerId: null,
customerName: null,
customerPhone: null,
userId: null,
sex: null,
userAge: null,
deptId: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: null,
userCarList:[{
carModel:'',
carNo:'',
maintenanceDate:'',
maintenanceMileage:'',
inspectionDate:'',
insuranceDate:'',
nextMaintenanceDate:'',
nextMaintenanceMileage:'',
nextInspectionDate:'',
insuranceExpiryDate:'',
}]
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); },
}).catch(() => {}); /** 重置按钮操作 */
}, resetQuery() {
/** 导出按钮操作 */ this.resetForm("queryForm");
handleExport() { this.handleQuery();
this.download('customerInfo/customerInfo/export', { },
...this.queryParams //
}, `customerInfo_${new Date().getTime()}.xlsx`) handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加客户信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
const id = row.id || this.ids
this.form = row;
this.open = true;
this.title = "修改客户信息";
// this.reset();
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateCustomerInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCustomerInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除客户信息编号为"' + ids + '"的数据项?').then(function() {
return delCustomerInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('customerInfo/customerInfo/export', {
...this.queryParams
}, `customerInfo_${new Date().getTime()}.xlsx`)
}
} }
} };
};
</script> </script>

View File

@ -9,14 +9,6 @@ export function listCustomerInfo(query) {
}) })
} }
// 查询客户订单数量列表
export function getUserOrderCounts() {
return request({
url: '/customerInfo/customerInfo/userOrderCounts',
method: 'get'
});
}
// 查询客户信息详细 // 查询客户信息详细
export function getCustomerInfo(id) { export function getCustomerInfo(id) {
return request({ return request({
@ -60,5 +52,3 @@ export function partnerGetWtList(query) {
params: query params: query
}) })
} }