维修工单-客户、车辆信息新增、修改

This commit is contained in:
xiaofajia 2024-10-08 18:28:36 +08:00
parent 54ae167c2b
commit 983776c28d
9 changed files with 215 additions and 169 deletions

View File

@ -87,4 +87,13 @@ export function exportCarMainExcel(params) {
})
}
// 根据车牌查单条记录
export function getByLicenseNumber(data){
return request({
url: "/base/carMain/getByLicenseNumber",
method: 'post',
data
})
}

View File

@ -67,3 +67,12 @@ export function exportCustomerMainExcel(params) {
responseType: 'blob'
})
}
// 根据姓名和电话查询单条记录
export function getByNameAndMobile(data){
return request({
url: "/base/custom/getByNameAndMobile",
method: 'post',
data
})
}

View File

@ -69,9 +69,9 @@ export function getLabels(){
}
// 获取当前登录用户部门下的员工信息
export function getStaffList(){
export function getStaffList(query){
return request({
url: '/company/staff/list',
url: '/company/staff/list' + (query ? '?query=' + query : ''),
method: 'get'
})
}

View File

@ -45,3 +45,12 @@ export function setTicketsPaid(data){
data
})
}
// 新增客户、车辆信息
export function updateCustomerAndCar(data){
return request({
url: preUrl + "/updateUserAndCar",
method: "post",
data
})
}

View File

@ -18,6 +18,11 @@ export default {
},
cusName: {
type: String,
},
inList:{
type: Object,
default: null,
required: false
}
},
watch: {
@ -35,6 +40,16 @@ export default {
// this.carSelected = null
this.getCarList()
}
},
inList(val){
if (val){
const flag = this.carList.findIndex(item => item.id === val.id)
if (flag > 0){
this.carList.splice(flag, 1)
}
this.carList.unshift(val)
this.carSelected = val.id
}
}
},
data() {

View File

@ -1,5 +1,5 @@
<template>
<el-select v-model="staffSelected" clearable filterable @blur="$emit('input-blur', $event)">
<el-select :loading="selectLoading" v-model="staffSelected" clearable filterable :filter-method="changeQuery" @blur="$emit('input-blur', $event)">
<el-option v-for="staff in staffList" :key="staff.id" :label="staff.name + ' ' + staff.tel" :value="staff.id"/>
</el-select>
</template>
@ -24,7 +24,9 @@ export default {
return {
staffList: [],
staffSelected: undefined,
hasRequest: false
hasRequest: false,
query: null,
selectLoading: false,
}
},
watch: {
@ -45,13 +47,19 @@ export default {
},
methods: {
async listStaff() {
this.selectLoading = true
try {
if (!this.isGet) return;
const res = await getStaffList()
const res = await getStaffList(this.query)
this.staffList = res.data
this.hasRequest = true
} catch {
} finally {
this.selectLoading = false
}
},
changeQuery(val){
this.query = val
this.listStaff()
}
}
}

View File

@ -13,6 +13,11 @@ export default {
props:{
value:{
type: Object,
},
inList:{
type: Object,
default: null,
required: false
}
},
data() {
@ -35,6 +40,17 @@ export default {
},
value(val){
this.userSelected = val ? val.id : null
},
inList(val){
if (val){
//
const flag = this.userList.findIndex(item => item.id === val.id)
if (flag > 0){
this.userList.splice(flag, 1)
}
this.userList.unshift(val)
this.userSelected = val.id
}
}
},
mounted() {

View File

@ -1,125 +1,15 @@
<template>
<div>
<!-- <el-descriptions class="margin-top" :column="3" :size="'mini'" border style="margin-bottom: 1rem">-->
<!-- &lt;!&ndash; <template slot="extra">&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button v-if="createTicketType" type="success" size="small">新增客户信息</el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button v-if="createTicketType" type="primary" size="small" :disabled="!selectUser.id">完善更多客户信息</el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button type="primary" size="small">选择业务</el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; </template>&ndash;&gt;-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">-->
<!-- 用户选择-->
<!-- </template>-->
<!-- <UserChoose v-model="selectUser"/>-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">-->
<!-- 车辆选择-->
<!-- </template>-->
<!-- <CarChoose v-model="selectCar" :cus-name="selectUser.cusName"/>-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">-->
<!-- 手机-->
<!-- </template>-->
<!-- <el-input disabled v-model="selectUser.phoneNumber"/>-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">-->
<!-- 车架号-->
<!-- </template>-->
<!-- <el-input disabled v-model="selectCar.vin"/>-->
<!-- </el-descriptions-item>-->
<!-- &lt;!&ndash; <el-descriptions-item>&ndash;&gt;-->
<!-- &lt;!&ndash; <template slot="label">&ndash;&gt;-->
<!-- &lt;!&ndash; 车牌&ndash;&gt;-->
<!-- &lt;!&ndash; </template>&ndash;&gt;-->
<!-- &lt;!&ndash; <el-input disabled v-model="selectCar.licenseNumber"/>&ndash;&gt;-->
<!-- &lt;!&ndash; </el-descriptions-item>&ndash;&gt;-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">-->
<!-- 品牌车系-->
<!-- </template>-->
<!-- <el-input disabled v-model="selectCar.modelStr"/>-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">-->
<!-- 保险到期-->
<!-- </template>-->
<!-- <el-date-picker disabled-->
<!-- v-model="selectCar.insuranceExpiryDate"-->
<!-- type="date">-->
<!-- </el-date-picker>-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">-->
<!-- 年检到期-->
<!-- </template>-->
<!-- <el-date-picker disabled-->
<!-- v-model="selectCar.nextInspectionDate"-->
<!-- type="date">-->
<!-- </el-date-picker>-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">-->
<!-- 进厂时间-->
<!-- </template>-->
<!-- <el-date-picker-->
<!-- v-model="formData.inTime"-->
<!-- type="date"-->
<!-- placeholder="选择日期">-->
<!-- </el-date-picker>-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">-->
<!-- 预计完工-->
<!-- </template>-->
<!-- <el-date-picker-->
<!-- v-model="formData.outTime"-->
<!-- type="date"-->
<!-- placeholder="选择日期">-->
<!-- </el-date-picker>-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">-->
<!-- 上次里程-->
<!-- </template>-->
<!-- <el-input v-model="selectCar.maintenanceMileage"/>-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">-->
<!-- 本次里程-->
<!-- </template>-->
<!-- <el-input v-model="selectCar.newMaintenanceMileage"/>-->
<!-- </el-descriptions-item>-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">-->
<!-- 预约订单选择-->
<!-- </template>-->
<!-- <el-select v-model="formData.bookingId" size="small">-->
<!-- <el-option v-for="item in bookingList" :key="item.id" :value="item.id" :label="item.bookingTime" />-->
<!-- </el-select>-->
<!-- </el-descriptions-item>-->
<!-- &lt;!&ndash; <el-descriptions-item :span="3">&ndash;&gt;-->
<!-- &lt;!&ndash; <template slot="label">&ndash;&gt;-->
<!-- &lt;!&ndash; 备注&ndash;&gt;-->
<!-- &lt;!&ndash; </template>&ndash;&gt;-->
<!-- &lt;!&ndash; <el-input v-model="formData.remark"/>&ndash;&gt;-->
<!-- &lt;!&ndash; </el-descriptions-item>&ndash;&gt;-->
<!-- <el-descriptions-item>-->
<!-- <template slot="label">-->
<!-- 服务顾问-->
<!-- </template>-->
<!-- <StaffChoose v-model="selectStaff"/>-->
<!-- </el-descriptions-item>-->
<!-- </el-descriptions>-->
<el-row :gutter="24">
<el-col :span="17" style="padding-right: 0">
<el-card class="top-left">
<el-descriptions class="margin-top" :column="3" :size="'mini'" border>
<template slot="extra">
<el-button v-if="createTicketType" type="success" size="small" @click="updateUserInfo(false)">新增客户信息</el-button>
<el-button v-if="createTicketType" type="primary" size="small" @click="updateUserInfo(true)" :disabled="!selectUser.id">
<el-button v-if="createTicketType" type="success" size="small" @click="updateUserInfo(false)">
新增客户信息
</el-button>
<el-button v-if="createTicketType" type="primary" size="small" @click="updateUserInfo(true)"
:disabled="!selectUser.id">
完善更多客户信息
</el-button>
</template>
@ -127,13 +17,13 @@
<template slot="label">
用户选择
</template>
<UserChoose v-model="selectUser"/>
<UserChoose v-model="selectUser" :in-list="userInData"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
车辆选择
</template>
<CarChoose v-model="selectCar" :cus-name="selectUser.cusName"/>
<CarChoose v-model="selectCar" :cus-name="selectUser.cusName" :in-list="carInData"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
@ -147,12 +37,6 @@
</template>
<el-input disabled v-model="selectCar.vin"/>
</el-descriptions-item>
<!-- <el-descriptions-item>-->
<!-- <template slot="label">-->
<!-- 车牌-->
<!-- </template>-->
<!-- <el-input disabled v-model="selectCar.licenseNumber"/>-->
<!-- </el-descriptions-item>-->
<el-descriptions-item>
<template slot="label">
品牌车系
@ -218,12 +102,6 @@
:label="item.bookingTime"/>
</el-select>
</el-descriptions-item>
<!-- <el-descriptions-item :span="3">-->
<!-- <template slot="label">-->
<!-- 备注-->
<!-- </template>-->
<!-- <el-input v-model="formData.remark"/>-->
<!-- </el-descriptions-item>-->
<el-descriptions-item>
<template slot="label">
服务顾问
@ -244,11 +122,6 @@
size="mini"
height="270"
style="width: 100%">
<!-- @selection-change="handleSelectionChange"-->
<!-- <el-table-column-->
<!-- type="selection"-->
<!-- width="55">-->
<!-- </el-table-column>-->
<el-table-column prop="couponName" label="卡券名称"/>
<el-table-column label="卡券类型" width="80" align="center" prop="couponType">
<template v-slot="scope">
@ -281,12 +154,6 @@
<span>{{ parseTime(scope.row.endTime) }}</span>
</template>
</el-table-column>
<!-- <el-table-column fixed="right" label="操作" width="130" align="center" class-name="small-padding fixed-width">-->
<!-- <template v-slot="scope">-->
<!-- <el-button size="mini" type="text" icon="el-icon-goods" @click="couponVerification(scope.row)">核销</el-button>-->
<!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
</el-card>
</el-col>
@ -394,7 +261,7 @@
<RepairAdvice ref="repairAdvice" v-model="formData.repairAdvice"/>
<QualityExplain ref="qualityExplain" v-model="formData.quality"/>
<UserAndCarForm ref="userAndCarInfo" @success="successCreateUserInfo"/>
<UserAndCarForm ref="userAndCarInfo" @success="successCusAndCar"/>
</div>
</template>
@ -411,12 +278,15 @@ import TicketChoose from "@/views/repair/tickets/Components/TicketChoose.vue";
import request from "@/utils/request";
import * as CustomerMainApi from "@/api/base/customer";
import UserAndCarForm from "@/views/repair/tickets/form/UserAndCarForm.vue";
import {getByNameAndMobile} from "@/api/base/customer";
import {getByLicenseNumber} from "@/api/base/carmain";
export default {
name: "UserInfo",
components: {
UserAndCarForm,
TicketChoose, QualityExplain, RepairAdvice, CarChoose, TicketItem, StaffChoose, UserChoose},
TicketChoose, QualityExplain, RepairAdvice, CarChoose, TicketItem, StaffChoose, UserChoose
},
props: {
createTicketType: {
type: Boolean,
@ -426,14 +296,16 @@ export default {
watch: {
selectUser(val) {
if (val) {
this.selectCar = {}
this.bookingList = []
this.couponList = []
if (val.userId) {
this.getBooking(val.userId)
}
if (val.id) {
this.getCouponList(val.id)
if (!val.isRes) {
this.selectCar = {}
this.bookingList = []
this.couponList = []
if (val.userId) {
this.getBooking(val.userId)
}
if (val.id) {
this.getCouponList(val.id)
}
}
} else {
this.selectCar = {}
@ -496,7 +368,9 @@ export default {
otherList: [],
bookingList: [],
couponList: [],
finaCouponList: []
finaCouponList: [],
userInData: null,
carInData: null,
}
},
methods: {
@ -747,7 +621,6 @@ export default {
item.bookingTime = this.parseTime(item.bookingTime, '{y}-{m}-{d} {h}:{m}')
})
}
// console.log(this.bookingList,723)
},
//
changeCoupon(data) {
@ -758,21 +631,39 @@ export default {
this.couponList = this.finaCouponList.filter(item => !item.isChoose)
},
//
updateUserInfo(flag){
updateUserInfo(flag) {
const data = {}
if (flag){
if (this.selectUser){
if (flag) {
if (this.selectUser) {
data.userInfo = this.selectUser
}
if (this.selectCar){
if (this.selectCar) {
data.carInfo = this.selectCar
}
}
this.$refs.userAndCarInfo.open(data)
},
//
successCreateUserInfo(){
async successCusAndCar(data) {
const cus = {
cusName: data.userInfo.cusName,
phoneNumber: data.userInfo.phoneNumber
}
const car = {
licenseNumber: data.carInfo.licenseNumber
}
//
const cusRes = await getByNameAndMobile(cus)
this.userInData = {
...cusRes.data,
isRes: true
}
//
const carRes = await getByLicenseNumber(car)
this.carInData = {
...carRes.data,
brandAndModel: car.data.carInfo.brandAndModel
}
}
// //
// handleSelectionChange(val){

View File

@ -244,6 +244,9 @@
<script>
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import CarBrandSelector from "@/layout/components/CarBrandSelector/index.vue";
import {getLevelAll} from "@/api/member/level";
import {updateCustomerAndCar} from "@/api/repair/tickets/Tickets";
import * as CarMainApi from "@/api/base/carmain";
export default {
name: "UserAndCarForm",
@ -302,7 +305,11 @@ export default {
nextMaintenanceMileage: undefined,
}
},
formRules: {},
formRules: {
'userInfo.cusName':[{required: true, message: "客户名称不能为空", trigger: 'blur'}],
'userInfo.phoneNumber': [{required: true, message: "联系方式不能为空", trigger: 'blur'}],
'carInfo.licenseNumber': [{required: true, message: "车牌号不能为空", trigger: 'blur'}]
},
formLoading: false,
//
activeNames: ['1', '2', '3', '4', '5', '6'],
@ -315,6 +322,7 @@ export default {
},
methods: {
async open(data) {
this.reset()
if (data?.userInfo?.id){
this.formData.userInfo = {
...this.formData.userInfo,
@ -324,16 +332,97 @@ export default {
if (data?.carInfo?.id){
this.formData.carInfo = {
...this.formData.carInfo,
...data.carInfo
...data.carInfo,
brandAndModel: [data.carInfo?.carBrand, data.carInfo?.carModel]
}
}
await this.listLevel()
this.dialogVisible = true
},
compute(){
async compute(){
this.buttonLoading = true
try{
const data = this.formData.carInfo;
debugger
const res = await CarMainApi.compute(data);
const result = res.data;
this.formData.carInfo.insuranceExpiryDate = result.insuranceExpiryDate
this.formData.carInfo.nextInspectionDate = result.nextInspectionDate
this.formData.carInfo.nextMaintenanceDate = result.nextMaintenanceDate
this.formData.carInfo.nextMaintenanceMileage = result.nextMaintenanceMileage
} finally {
this.buttonLoading = false
}
},
async submitForm(){
await this.$refs["formRef"].validate();
this.formLoading = true
try {
await updateCustomerAndCar(this.formData)
this.$modal.msgSuccess(this.formData?.userInfo?.id ? "修改成功" : "新增成功")
this.$emit("success", this.formData)
}finally {
this.formLoading = false
this.dialogVisible = false
}
},
reset(){
this.formData = {
userInfo: {
memberLevelId: undefined,
id: undefined,
userId: undefined,
typeCode: '01',
deptCode: undefined,
cusName: undefined,
phoneNumber: undefined,
birthday: undefined,
address: undefined,
sex: '1',
idCard: undefined,
idCardImage: undefined,
dataFrom: '08',
nearDoTime: undefined,
nearDoContent: undefined,
inviter: undefined,
inviterType: '01',
status: undefined,
itemList: [
{
systemCode: '',
serContent: '',
serTimeStart: '',
serTimeEnd: ''
}
],
},
carInfo: {
id: undefined,
engineNumber: undefined,
vin: undefined,
licenseNumber: undefined,
brandAndModel: [],
maintenanceDate: undefined,
maintenanceMileage: undefined,
inspectionDate: undefined,
insuranceDate: undefined,
checkDate: undefined,
carBrand: undefined,
carNature: undefined,
carRegisterDate: undefined,
carLicenseImg: undefined,
carCategory: undefined,
insuranceExpiryDate: undefined,
nextInspectionDate: undefined,
nextMaintenanceDate: undefined,
nextMaintenanceMileage: undefined,
}
}
this.resetForm("formRef")
},
async listLevel(){
const res = await getLevelAll()
this.levelList = res.data
}
}
}