改配件申请

This commit is contained in:
xiaofajia 2024-11-12 09:47:38 +08:00
parent 34e37194a6
commit b8636a1728
3 changed files with 201 additions and 223 deletions

View File

@ -5,12 +5,21 @@
<el-form-item label="关键字" prop="query"> <el-form-item label="关键字" prop="query">
<el-input style="width: 20rem" type="text" placeholder="工单号、车牌号、联系电话" v-model="queryParams.query"/> <el-input style="width: 20rem" type="text" placeholder="工单号、车牌号、联系电话" v-model="queryParams.query"/>
</el-form-item> </el-form-item>
<!-- <el-form-item label="状态" prop="status">--> <el-form-item label="车牌号" prop="licenseNumber">
<!-- <el-select v-model="queryParams.status">--> <el-input style="width: 20rem" type="text" placeholder="车牌号" v-model="queryParams.licenseNumber" />
<!-- <el-option v-for="item in this.getDictDatas(DICT_TYPE.TICKET_WARES_STATUS)" :key="item.value"--> </el-form-item>
<!-- :label="item.label" :value="item.value"/>--> <el-form-item label="手机号" prop="userMobile">
<!-- </el-select>--> <el-input style="width: 20rem" type="text" placeholder="手机号" v-model="queryParams.userMobile" />
<!-- </el-form-item>--> </el-form-item>
<el-form-item label="申请人" prop="repairName">
<el-input style="width: 20rem" type="text" placeholder="申请人" v-model="queryParams.repairName" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status">
<el-option v-for="item in this.getDictDatas(DICT_TYPE.TICKET_WARES_STATUS)" :key="item.value"
:label="item.label" :value="item.value"/>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
@ -20,26 +29,36 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<right-toolbar :showSearch.sync="showSearch"></right-toolbar> <right-toolbar :showSearch.sync="showSearch"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="序号" align="center" width="80"> <el-table-column label="序号" align="center" width="80">
<template scope="scope"> <template scope="scope">
<span>{{ scope.$index + 1 }}</span> <span>{{ scope.$index + 1 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单据号" align="center" prop="no"/> <el-table-column label="单据号" align="center" prop="no" width="200"/>
<el-table-column label="客户车牌" align="center" prop="licenseNumber" /> <el-table-column label="客户信息" align="center">
<el-table-column label="服务顾问" align="center" prop="adviserName"/> <el-table-column label="姓名" align="center" prop="userName" width="180"/>
<el-table-column label="申请人" align="center" prop="repairName"/> <el-table-column label="联系电话" align="center" prop="userMobile" width="180"/>
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="车牌号" align="center" prop="licenseNumber" width="180"/>
</el-table-column>
<el-table-column label="申请人" align="center" prop="repairName" width="180"/>
<el-table-column label="岗位" align="center" prop="repairWork" width="180">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.REPAIR_WORK_TYPE" :value="scope.row.repairWork" />
</template>
</el-table-column>
<el-table-column label="服务顾问" align="center" prop="adviserName" width="180"/>
<el-table-column label="状态" align="center" prop="status" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :type="DICT_TYPE.TICKET_WARES_STATUS" v-model="scope.row.status"/> <dict-tag :type="DICT_TYPE.TICKET_WARES_STATUS" v-model="scope.row.status"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark"/> <el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip width="200"/>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center" fixed="right" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-if="scope.row.status !== '01' || userRole !== 'service_advisor'" type="text" size="mini" <el-button type="text" size="mini"
icon="el-icon-view" @click="handleShow(scope.row)"> icon="el-icon-view" @click="handleShow(scope.row, false)">
查看 查看
</el-button> </el-button>
<el-button <el-button
@ -61,7 +80,7 @@
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<TicketWaresShow ref="ticketWaresShow" :user-role="userRole" @success="getList" :type="type"/> <TicketWaresShow ref="ticketWaresShow" :user-role="userRole" @success="getList" :type="newType"/>
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body> <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body>
<el-table el-table v-loading="dialogLoading" :data="items" :stripe="true" :show-overflow-tooltip="true" <el-table el-table v-loading="dialogLoading" :data="items" :stripe="true" :show-overflow-tooltip="true"
@ -101,8 +120,9 @@ export default {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
query: null, query: null,
type: this.type ? "01" : "02", licenseNumber: null,
status: "01" userMobile: null,
repairName: null
}, },
showSearch: true, showSearch: true,
loading: false, loading: false,
@ -113,7 +133,8 @@ export default {
items: [], items: [],
selections: [], selections: [],
formData: {}, formData: {},
dialogTitle: "" dialogTitle: "",
newType: false
} }
}, },
mounted() { mounted() {
@ -140,11 +161,12 @@ export default {
this.resetForm('queryForm') this.resetForm('queryForm')
this.handleQuery() this.handleQuery()
}, },
handleShow(row) { handleShow(row, type) {
this.newType = type
this.$refs.ticketWaresShow.open(row) this.$refs.ticketWaresShow.open(row)
}, },
handleAudit(row) { handleAudit(row) {
this.handleShow(row) this.handleShow(row, true)
}, },
async handleGet(row) { async handleGet(row) {
this.formData = { this.formData = {

View File

@ -1,39 +1,48 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-dialog title="申请单查看" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body> <el-dialog title="配件申请单" :visible.sync="dialogVisible" ref="dialogRef" width="80%" v-dialogDrag append-to-body>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>申请人</span>
</div>
<div>
<el-descriptions class="margin-top" :column="5" border>
<el-descriptions-item>
<template slot="label">
岗位
</template>
{{ getWorkTypeByWork(this.formData.repairWork) }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
姓名
</template>
{{ this.formData.repairName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
服务顾问
</template>
{{ this.formData.adviserName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
时间
</template>
{{ parseTime(this.formData.createTime, "{y}-{m}-{d}") }}
</el-descriptions-item>
</el-descriptions>
</div>
</el-card>
<el-card class="box-card"> <el-card class="box-card">
<!-- 卡片头 --> <!-- 卡片头 -->
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<i class="el-icon-plus"/> <span>客户信息</span>
<span>工单信息</span>
</div> </div>
<!-- 卡片内容 --> <!-- 卡片内容 -->
<div> <div>
<el-descriptions class="margin-top" :column="4" :size="'medium'" border style="margin-bottom: 1rem"> <el-descriptions class="margin-top" :column="2" :size="'medium'" border style="margin-bottom: 1rem">
<el-descriptions-item>
<template slot="label">
订单编号
</template>
{{ info.ticketNo }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
维修类别
</template>
<dict-tag :type="DICT_TYPE.REPAIR_TYPE" v-model="info.repairType"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
状态
</template>
<dict-tag :type="DICT_TYPE.REPAIR_TICKETS_WORK_STATUS" v-model="info.ticketsWorkStatus"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
客户名称
</template>
{{ info.userName }}
</el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"> <template slot="label">
车牌号 车牌号
@ -48,73 +57,20 @@
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"> <template slot="label">
手机号 姓名
</template> </template>
{{ info.userMobile }} {{ this.formData.userName }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"> <template slot="label">
创建时间 电话
</template> </template>
{{ parseTime(info.createTime, '{y}-{m}-{d}') }} {{ this.formData.userMobile }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
预计完工
</template>
{{ parseTime(info.outTime, '{y}-{m}-{d}') }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
合计金额
</template>
{{ info.totalPrice }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
参考成本
</template>
{{ info.cost }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
参考毛利
</template>
{{ info.profit }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
领料状态
</template>
<dict-tag :type="DICT_TYPE.REPAIR_PART_STATUS" v-model="info.partStatus"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
服务顾问
</template>
{{ info.adviserName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
所属门店
</template>
{{ info.corpId }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
工单状态
</template>
<dict-tag :type="DICT_TYPE.REPAIR_TICKETS_STATUS" v-model="info.ticketsStatus"/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
备注
</template>
{{ info.remark }}
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
</div> </div>
</el-card> </el-card>
<el-card class="box-card"> <el-card class="box-card">
<!-- 卡片头 --> <!-- 卡片头 -->
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
@ -122,87 +78,60 @@
<span>配件信息</span> <span>配件信息</span>
</div> </div>
<!-- 卡片内容 --> <!-- 卡片内容 -->
<div> <div v-show="type">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" <el-table v-loading="loading" :data="items" :stripe="true" :show-overflow-tooltip="true" @selection-change="selectRows"
label-width="90px">
<el-form-item label="关键字" prop="query">
<el-input style="width: 20rem" type="text" placeholder="工单号、车牌号、联系电话"
v-model="queryParams.query"/>
</el-form-item>
<el-form-item label="状态" prop="waresStatus">
<el-select v-model="queryParams.waresStatus">
<el-option v-for="item in this.getDictDatas(DICT_TYPE.TW_ITEM_STATUS)" :key="item.value"
:label="item.label" :value="item.value"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作 -->
<el-row :gutter="10" class="mb8">
<right-toolbar :showSearch.sync="showSearch"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="items" :stripe="true" :show-overflow-tooltip="true"
@cell-mouse-enter="handleCellEnter" @cell-mouse-enter="handleCellEnter"
@cell-mouse-leave="handleCellLeave" @cell-mouse-leave="handleCellLeave"
@cell-click="handleCellClick" @cell-click="handleCellClick"
> >
<el-table-column label="序号" align="center" width="80"> <el-table-column type="selection" align="center" width="80"/>
<template scope="scope">
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<!-- <el-table-column align="center" label="客户可见" prop="isShow" v-if="userRole === 'service_advisor' && type" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <el-switch-->
<!-- v-model="scope.row.isShow"-->
<!-- active-text="是"-->
<!-- inactive-text="否"-->
<!-- active-value="1"-->
<!-- inactive-value="0"-->
<!-- @change="changeIsShow(scope.row)"-->
<!-- >-->
<!-- </el-switch>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="名称" align="center" prop="waresName" :show-overflow-tooltip="true"/> <el-table-column label="名称" align="center" prop="waresName" :show-overflow-tooltip="true"/>
<el-table-column label="规格" align="center" prop="wares.model" width="180"/>
<el-table-column label="数量" align="center" prop="waresCount" width="180"/> <el-table-column label="数量" align="center" prop="waresCount" width="180"/>
<el-table-column v-if="userRole === 'service_advisor' && type" label="销售价格" align="center" prop="wares.price" width="180"> <!-- <el-table-column label="销售价格" align="center" prop="wares.price" width="180">-->
<div v-if="formData.status === '01'" class="item" slot-scope="scope"> <!-- <div class="item" slot-scope="scope">-->
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.wares.price"/> <!-- <el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.wares.price"/>-->
<span class="item__txt">{{ scope.row.wares.price }}</span> <!-- <span class="item__txt">{{ scope.row.wares.price }}</span>-->
</div> <!-- </div>-->
<div v-else slot-scope="scope"> <!-- </el-table-column>-->
<span>{{ scope.row.wares.price }}</span> <el-table-column label="状态" align="center" width="180">
</div> <el-table-column label="×" prop="wareStatus" align="center">
<template slot-scope="scope" v-if="scope.row.wareStatus === '0'">
<span style="color: #ffd51c">°</span>
</template>
</el-table-column>
<el-table-column label="√" prop="wareStatus" align="center">
<template slot-scope="scope" v-if="scope.row.wareStatus === '1'">
<span style="color: #3aff70">°</span>
</template>
</el-table-column>
</el-table-column> </el-table-column>
<el-table-column v-if="userRole === 'service_advisor' && type" label="折扣" align="center" <el-table-column label="审核人" prop="handleName" align="center"/>
prop="itemDiscount" width="180"> </el-table>
<!-- <div v-if="formData.status === '01'" class="item" slot-scope="scope">--> </div>
<!--&lt;!&ndash; <el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.itemDiscount"/>&ndash;&gt;--> <div v-show="!type">
<!-- <DiscountInput @input-blur="save(scope.row)" class="item__input" v-model="scope.row.itemDiscount" />--> <el-table v-loading="loading" :data="items" :stripe="true" :show-overflow-tooltip="true">
<!-- <span class="item__txt">{{ scope.row.itemDiscount === 1 ? "无折扣" : scope.row.itemDiscount }}</span>--> <el-table-column label="名称" align="center" prop="waresName" :show-overflow-tooltip="true"/>
<!-- </div>--> <el-table-column label="数量" align="center" prop="waresCount" width="180"/>
<div slot-scope="scope"> <el-table-column label="状态" align="center" width="180">
<span>{{ scope.row.itemDiscount === 1 ? "无折扣" : scope.row.itemDiscount }}</span> <el-table-column label="×" prop="wareStatus" align="center">
</div> <template slot-scope="scope" v-if="scope.row.wareStatus === '0'">
<span style="color: #ffd51c">°</span>
</template>
</el-table-column>
<el-table-column label="√" prop="wareStatus" align="center">
<template slot-scope="scope" v-if="scope.row.wareStatus === '1'">
<span style="color: #3aff70">°</span>
</template>
</el-table-column>
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center" prop="waresStatus" width="180"> <el-table-column label="审核人" prop="handleName" align="center"/>
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.TW_ITEM_STATUS" :value="scope.row.waresStatus"/>
</template>
</el-table-column>
<el-table-column align="center" label="备注" prop="remark" width="180" :show-overflow-tooltip="true"/>
</el-table> </el-table>
</div> </div>
</el-card> </el-card>
<div slot="footer" class="dialog-footer" <div slot="footer" class="dialog-footer"
v-if="info.status === '01' && (userRole === 'service_advisor' || userRole === 'general_inspection')"> v-if="info.status === '01' && (userRole === 'service_advisor' || userRole === 'general_inspection')">
<el-button type="primary" @click="handleAudit(true)"> </el-button> <el-button type="primary" @click="handleAudit(true)">{{this.selectRow.length > 0 ? "通过" : "通过全部"}}</el-button>
<el-button @click="handleAudit(false)"> </el-button> <el-button @click="handleAudit(false)">{{this.selectRow.length > 0 ? "驳回" : "驳回全部"}}</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
@ -214,6 +143,7 @@ import {auditTicketWares} from "@/api/repair/tickets/TicketWares";
import {listTwItem, updateIsShow} from "@/api/repair/tickets/TWItem"; import {listTwItem, updateIsShow} from "@/api/repair/tickets/TWItem";
import DiscountInput from "@/views/repair/tickets/Components/DiscountInput.vue"; import DiscountInput from "@/views/repair/tickets/Components/DiscountInput.vue";
import item from "@/layout/components/Sidebar/Item.vue"; import item from "@/layout/components/Sidebar/Item.vue";
import {DICT_TYPE} from "@/utils/dict";
export default { export default {
name: "TicketWaresShow", name: "TicketWaresShow",
@ -237,19 +167,28 @@ export default {
formData: {}, formData: {},
clickCellMap: {}, clickCellMap: {},
editProp: ['wares.price'], editProp: ['wares.price'],
dialogLoading: null,
selectRow:[]
} }
}, },
methods: { methods: {
async open(row) { async open(row) {
if (row) { try {
this.formData = row this.dialogVisible = true
const res = await getTicketsById(row.ticketId) this.dialogLoading = this.$loading({
this.info = res.data target: this.$refs.dialogRef.$el
this.info.status = row.status })
this.queryParams.twId = row.id if (row) {
await this.getTwItem() this.formData = row
const res = await getTicketsById(row.ticketId)
this.info = res.data
this.info.status = row.status
this.queryParams.twId = row.id
await this.getTwItem()
}
} finally {
this.dialogLoading.close()
} }
this.dialogVisible = true
}, },
async getTwItem() { async getTwItem() {
try { try {
@ -273,42 +212,52 @@ export default {
this.resetForm('queryForm') this.resetForm('queryForm')
this.handleQuery() this.handleQuery()
}, },
async changeIsShow(row) {
try {
this.loading = true
await updateIsShow({id: row.id, isShow: row.isShow})
await this.getTwItem()
} finally {
this.loading = false
}
},
// //
async handleAudit(flag) { async handleAudit(flag) {
try { try {
const isNull = this.validateNull(); // const isNull = this.validateNull();
if (!isNull) return; // if (!isNull) return;
const names = this.validateZero() // const names = this.validateZero()
if (names){ // if (names) {
await this.$modal.confirm("确认配件:" + names + "的销售价格为0吗") // await this.$modal.confirm("" + names + "0")
} // }
this.formData['status'] = flag ? "02" : '05' this.formData['status'] = flag ? "02" : '03'
// //
this.formData.wares = [...this.items.map(item => { if (this.selectRow && this.selectRow.length > 0){
return { this.formData.wares = [...this.selectRow.map(item => {
itemName: item.waresName, return {
itemCount: item.waresCount, itemName: item.waresName,
itemUnit: item.wares.unit, itemCount: item.waresCount,
itemPrice: item.wares.price, itemUnit: item.wares.unit,
repairIds: this.formData.repairId, itemPrice: item.wares.price,
repairNames: this.formData.repairName, repairIds: this.formData.repairId,
saleId: this.formData.adviserId, repairNames: this.formData.repairName,
saleName: this.formData.adviserName, saleId: this.formData.adviserId,
itemDiscount: item.itemDiscount, saleName: this.formData.adviserName,
itemMoney: item.wares.price * item.waresCount * (item.itemDiscount / 10), itemDiscount: item.itemDiscount,
partId: item.waresId, itemMoney: item.wares.price * item.waresCount * (item.itemDiscount / 10),
remark: item.remark partId: item.waresId,
} remark: item.remark
})] }
})]
}else {
this.formData.wares = [...this.items.map(item => {
return {
itemName: item.waresName,
itemCount: item.waresCount,
itemUnit: item.wares.unit,
itemPrice: item.wares.price,
repairIds: this.formData.repairId,
repairNames: this.formData.repairName,
saleId: this.formData.adviserId,
saleName: this.formData.adviserName,
itemDiscount: item.itemDiscount,
itemMoney: item.wares.price * item.waresCount * (item.itemDiscount / 10),
partId: item.waresId,
remark: item.remark
}
})]
}
await auditTicketWares(this.formData) await auditTicketWares(this.formData)
this.dialogVisible = false this.dialogVisible = false
this.$modal.msgSuccess("审核成功") this.$modal.msgSuccess("审核成功")
@ -374,34 +323,41 @@ export default {
}) })
this.clickCellMap[id] = [] this.clickCellMap[id] = []
}, },
validateNull(){ validateNull() {
const flag = this.items.map(item => { const flag = this.items.map(item => {
const price = item.wares.price const price = item.wares.price
if (price === null || price === ""){ if (price === null || price === "") {
this.$modal.msgError("配件:" + item.waresName + "销售价格为空") this.$modal.msgError("配件:" + item.waresName + "销售价格为空")
return false return false
}else { } else {
return true return true
} }
}) })
let count = 0 let count = 0
flag.forEach(item => { flag.forEach(item => {
if (!item){ if (!item) {
count++ count++
} }
}) })
return count === 0 return count === 0
}, },
validateZero(){ validateZero() {
const flag = this.items.map(item => { const flag = this.items.map(item => {
const price = parseFloat(item.wares.price) const price = parseFloat(item.wares.price)
if (price === 0){ if (price === 0) {
return item.waresName return item.waresName
}else { } else {
return "" return ""
} }
}) })
return flag.filter(item => item !== "").join(",") return flag.filter(item => item !== "").join(",")
},
getWorkTypeByWork(work) {
const data = this.getDictDatas(DICT_TYPE.REPAIR_WORK_TYPE)
return data.filter(item => item.value === work)[0]?.label
},
selectRows(val){
this.selectRow = val
} }
} }
} }

View File

@ -363,7 +363,7 @@ export default {
waresId: item.id, waresId: item.id,
waresName: item.name, waresName: item.name,
waresCount: item.count, waresCount: item.count,
waresStatus: "02", waresStatus: "0",
remark: item.remark, remark: item.remark,
isShow: '1' isShow: '1'
} }