-
+
@@ -10,7 +10,7 @@
新增客户信息
+ :disabled="!selectUser.id">
完善更多客户信息
@@ -18,69 +18,60 @@
用户选择
-
+
车辆选择
-
+
请先选择客户
手机
-
+
车架号
-
+
品牌车系
-
+
保险到期
-
+
年检到期
-
+
进厂时间
-
+
预计完工
-
+
@@ -141,10 +132,7 @@
最近保养日期
-
+
@@ -158,15 +146,14 @@
预约订单选择
-
+
服务顾问
-
+
@@ -174,55 +161,70 @@
+
+
+ 业务渠道/来源
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -240,62 +242,63 @@
+ :label="item.label" :value="item.value" />
+ :value="item.value" />
A单
B单
+
+ 选择A单
+ 已绑定A单:{{ formData.parentTicketNo
+ }}
+ 清除
+
维修工时项目
+ :coupon-list="couponList" @changeCoupon="changeCoupon" />
更换配件清单
+ :coupon-list="couponList" @changeCoupon="changeCoupon" ref="partTable" />
其他
+ :coupon-list="couponList" @changeCoupon="changeCoupon" ref="otherTable" />
-
-
-
-
-
-
+ style="margin-bottom: 1rem">
+
+
+
+
+
+
时间
-
+
备注
-
+
-
+
{{ formData.count }}
{{ formData.projectPrice }}
{{ formData.partPrice }}
@@ -305,8 +308,8 @@
完成
-
-
+
+
@@ -316,22 +319,25 @@
备注
-
+
完成
-
+
-
-
-
+
+
+
+
+
+
@@ -340,22 +346,23 @@ import UserChoose from "@/views/repair/Components/UserChoose.vue";
import StaffChoose from "@/views/repair/Components/StaffChoose.vue";
import TicketItem from "@/views/repair/tickets/Components/TicketItem.vue";
import CarChoose from "@/views/repair/Components/CarChoose.vue";
-import {createUniqueCodeByHead} from "@/utils/createUniqueCode";
-import {createTickets, getTicketsById} from "@/api/repair/tickets/Tickets";
+import { createUniqueCodeByHead } from "@/utils/createUniqueCode";
+import { createTickets, getTicketsById } from "@/api/repair/tickets/Tickets";
import RepairAdvice from "@/views/repair/tickets/form/RepairAdvice.vue";
import QualityExplain from "@/views/repair/tickets/form/QualityExplain.vue";
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";
+import { getByNameAndMobile } from "@/api/base/customer";
+import { getByLicenseNumber } from "@/api/base/carmain";
+import ParentTicketDialog from "@/views/repair/tickets/Components/ParentTicketDialog.vue";
export default {
name: "UserInfo",
components: {
UserAndCarForm,
- TicketChoose, QualityExplain, RepairAdvice, CarChoose, TicketItem, StaffChoose, UserChoose
+ ParentTicketDialog, TicketChoose, QualityExplain, RepairAdvice, CarChoose, TicketItem, StaffChoose, UserChoose
},
props: {
createTicketType: {
@@ -444,7 +451,14 @@ export default {
handleName: null,
handleMobile: null,
maintenanceDate: null,
- maintenanceMileage: null
+ maintenanceMileage: null,
+ parentTicketId: null, // 绑定的A单ID
+ parentTicketNo: null, // 绑定的A单编号
+ channelId: null, // 渠道ID
+ busiFrom: null, // 渠道名称
+ sourceId: null, // 来源ID
+ cusFrom: null, // 来源名称
+ busiCascader: [] // 业务渠道/来源级联选择值
},
selectUser: {},
selectCar: {},
@@ -457,8 +471,17 @@ export default {
finaCouponList: [],
userInData: null,
carInData: null,
+ ticketChooseDialogVisible: false, // A单选择对话框显示状态
+ busiAndCusList: [], // 业务渠道和来源列表
+ channelList: [], // 渠道列表
+ sourceList: [], // 来源列表
+ busiCascaderOptions: [] // 业务渠道/来源级联选择器选项
}
},
+ mounted() {
+ // 组件挂载时获取业务渠道和来源数据
+ this.queryBusiAndCus()
+ },
methods: {
async getCouponList(id) {
const res = await CustomerMainApi.getCustomerMain(id);
@@ -530,10 +553,10 @@ export default {
this.createItemInit()
try {
const count = this.handleValidate()
- if (count > 0){
+ if (count > 0) {
return
}
- if (this.formData.image){
+ if (this.formData.image) {
const data = this.formData.image.split(",")
this.formData.image = data.map(item => {
return item.replace(process.env.VUE_APP_FILE_API, "")
@@ -648,13 +671,13 @@ export default {
this.formData.itemList = [...this.formData.itemList, ...this.formatItem("other", this.otherList)]
},
// 非空验证
- handleValidate(){
+ handleValidate() {
let count = 0
this.formData.itemList.forEach(item => {
if (count !== 0) return count
- if (!item.repairIds || !item.saleId){
+ if (!item.repairIds || !item.saleId) {
let message = ""
- switch (item.itemType){
+ switch (item.itemType) {
case "01":
message += "项目:"
break
@@ -720,11 +743,11 @@ export default {
cusName: data.userName,
id: data.userId,
phoneNumber: data.userMobile,
- quality: {qualityMileage: data.qualityMileage, qualityDay: data.qualityDay}
+ quality: { qualityMileage: data.qualityMileage, qualityDay: data.qualityDay }
}
const itemList = this.formData.itemList
- this.selectUser = {id: data.userId}
- this.selectCar = {id: data.carId}
+ this.selectUser = { id: data.userId }
+ this.selectCar = { id: data.carId }
this.projectList = [itemList.find(item => item.itemType === '01')]
this.partList = [itemList.find(item => item.itemType === '02')]
this.otherList = [itemList.find(item => item.itemType === '03')]
@@ -801,12 +824,121 @@ export default {
// handleSelectionChange(val){
//
// }
- updateBooking(){
+ updateBooking() {
const data = this.bookingList.filter(item => item.id === this.formData.bookingId)
- if (data && data.length > 0){
+ if (data && data.length > 0) {
this.formData.repairType = data[0].repairType
}
},
+ // 打开A单选择对话框
+ openTicketChooseDialog() {
+ this.ticketChooseDialogVisible = true
+ },
+ // 处理A单选择
+ handleParentTicketSelected(ticket) {
+ if (ticket) {
+ this.formData.parentTicketId = ticket.id
+ this.formData.parentTicketNo = ticket.ticketNo
+ this.ticketChooseDialogVisible = false
+ this.$modal.msgSuccess(`已绑定A单:${ticket.ticketNo}`)
+ }
+ },
+ // 清除绑定的A单
+ clearParentTicket() {
+ this.formData.parentTicketId = null
+ this.formData.parentTicketNo = null
+ this.$modal.msgSuccess('已清除绑定的A单')
+ },
+ /**
+ * 获取业务来源和渠道
+ */
+ queryBusiAndCus() {
+ request({
+ url: `/business/list`,
+ method: 'GET',
+ params: {
+ systemCode: 'repair'
+ }
+ }).then(res => {
+ this.busiAndCusList = res.data
+ console.log('busiAndCusList', this.busiAndCusList);
+ // 处理渠道和来源数据
+ this.processBusiAndCusData()
+ })
+ },
+ /**
+ * 处理业务渠道和来源数据
+ */
+ processBusiAndCusData() {
+ // 渠道列表:pid为0的是渠道
+ this.channelList = this.busiAndCusList.filter(item => item.pid === 0)
+ // 来源列表:pid不为0的是来源
+ this.sourceList = this.busiAndCusList.filter(item => item.pid !== 0)
+
+ // 生成级联选择器选项
+ this.generateCascaderOptions()
+ },
+ /**
+ * 生成级联选择器选项
+ */
+ generateCascaderOptions() {
+ // 先获取所有渠道
+ const channels = this.busiAndCusList.filter(item => item.pid === 0)
+
+ // 构建级联选择器选项
+ this.busiCascaderOptions = channels.map(channel => {
+ // 获取该渠道下的所有来源
+ const sources = this.busiAndCusList.filter(item => item.pid === channel.id)
+
+ return {
+ value: channel.id,
+ label: channel.name,
+ children: sources.map(source => ({
+ value: source.id,
+ label: source.name
+ }))
+ }
+ })
+ },
+ /**
+ * 业务渠道/来源级联选择变化
+ */
+ handleBusiCascaderChange(value) {
+ if (value && value.length > 0) {
+ if (value.length === 1) {
+ // 只选择了渠道
+ const channelId = value[0]
+ const selectedChannel = this.channelList.find(item => item.id === channelId)
+ if (selectedChannel) {
+ this.formData.channelId = selectedChannel.id
+ this.formData.busiFrom = selectedChannel.name
+ // 清空来源选择
+ this.formData.sourceId = null
+ this.formData.cusFrom = null
+ }
+ } else if (value.length === 2) {
+ // 选择了渠道和来源
+ const channelId = value[0]
+ const sourceId = value[1]
+
+ const selectedChannel = this.channelList.find(item => item.id === channelId)
+ const selectedSource = this.sourceList.find(item => item.id === sourceId)
+
+ if (selectedChannel && selectedSource) {
+ this.formData.channelId = selectedChannel.id
+ this.formData.busiFrom = selectedChannel.name
+ this.formData.sourceId = selectedSource.id
+ this.formData.cusFrom = selectedSource.name
+ }
+ }
+ } else {
+ // 清空选择
+ this.formData.channelId = null
+ this.formData.busiFrom = null
+ this.formData.sourceId = null
+ this.formData.cusFrom = null
+ }
+ },
}
}