改配件申请

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

View File

@ -1,39 +1,48 @@
<template>
<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">
<!-- 卡片头 -->
<div slot="header" class="clearfix">
<i class="el-icon-plus"/>
<span>工单信息</span>
<span>客户信息</span>
</div>
<!-- 卡片内容 -->
<div>
<el-descriptions class="margin-top" :column="4" :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 class="margin-top" :column="2" :size="'medium'" border style="margin-bottom: 1rem">
<el-descriptions-item>
<template slot="label">
车牌号
@ -48,73 +57,20 @@
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
手机号
姓名
</template>
{{ info.userMobile }}
{{ this.formData.userName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
创建时间
电话
</template>
{{ parseTime(info.createTime, '{y}-{m}-{d}') }}
</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 }}
{{ this.formData.userMobile }}
</el-descriptions-item>
</el-descriptions>
</div>
</el-card>
<el-card class="box-card">
<!-- 卡片头 -->
<div slot="header" class="clearfix">
@ -122,87 +78,60 @@
<span>配件信息</span>
</div>
<!-- 卡片内容 -->
<div>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
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"
<div v-show="type">
<el-table v-loading="loading" :data="items" :stripe="true" :show-overflow-tooltip="true" @selection-change="selectRows"
@cell-mouse-enter="handleCellEnter"
@cell-mouse-leave="handleCellLeave"
@cell-click="handleCellClick"
>
<el-table-column label="序号" 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 type="selection" align="center" width="80"/>
<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 v-if="userRole === 'service_advisor' && type" label="销售价格" align="center" prop="wares.price" width="180">
<div v-if="formData.status === '01'" class="item" slot-scope="scope">
<el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.wares.price"/>
<span class="item__txt">{{ scope.row.wares.price }}</span>
</div>
<div v-else slot-scope="scope">
<span>{{ scope.row.wares.price }}</span>
</div>
<!-- <el-table-column label="销售价格" align="center" prop="wares.price" width="180">-->
<!-- <div class="item" slot-scope="scope">-->
<!-- <el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.wares.price"/>-->
<!-- <span class="item__txt">{{ scope.row.wares.price }}</span>-->
<!-- </div>-->
<!-- </el-table-column>-->
<el-table-column label="状态" align="center" width="180">
<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 v-if="userRole === 'service_advisor' && type" label="折扣" align="center"
prop="itemDiscount" width="180">
<!-- <div v-if="formData.status === '01'" class="item" slot-scope="scope">-->
<!--&lt;!&ndash; <el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.itemDiscount"/>&ndash;&gt;-->
<!-- <DiscountInput @input-blur="save(scope.row)" class="item__input" v-model="scope.row.itemDiscount" />-->
<!-- <span class="item__txt">{{ scope.row.itemDiscount === 1 ? "无折扣" : scope.row.itemDiscount }}</span>-->
<!-- </div>-->
<div slot-scope="scope">
<span>{{ scope.row.itemDiscount === 1 ? "无折扣" : scope.row.itemDiscount }}</span>
</div>
<el-table-column label="审核人" prop="handleName" align="center"/>
</el-table>
</div>
<div v-show="!type">
<el-table v-loading="loading" :data="items" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="名称" align="center" prop="waresName" :show-overflow-tooltip="true"/>
<el-table-column label="数量" align="center" prop="waresCount" width="180"/>
<el-table-column label="状态" align="center" width="180">
<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 label="状态" align="center" prop="waresStatus" width="180">
<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-column label="审核人" prop="handleName" align="center"/>
</el-table>
</div>
</el-card>
<div slot="footer" class="dialog-footer"
v-if="info.status === '01' && (userRole === 'service_advisor' || userRole === 'general_inspection')">
<el-button type="primary" @click="handleAudit(true)"> </el-button>
<el-button @click="handleAudit(false)"> </el-button>
<el-button type="primary" @click="handleAudit(true)">{{this.selectRow.length > 0 ? "通过" : "通过全部"}}</el-button>
<el-button @click="handleAudit(false)">{{this.selectRow.length > 0 ? "驳回" : "驳回全部"}}</el-button>
</div>
</el-dialog>
</div>
@ -214,6 +143,7 @@ import {auditTicketWares} from "@/api/repair/tickets/TicketWares";
import {listTwItem, updateIsShow} from "@/api/repair/tickets/TWItem";
import DiscountInput from "@/views/repair/tickets/Components/DiscountInput.vue";
import item from "@/layout/components/Sidebar/Item.vue";
import {DICT_TYPE} from "@/utils/dict";
export default {
name: "TicketWaresShow",
@ -237,19 +167,28 @@ export default {
formData: {},
clickCellMap: {},
editProp: ['wares.price'],
dialogLoading: null,
selectRow:[]
}
},
methods: {
async open(row) {
if (row) {
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()
try {
this.dialogVisible = true
this.dialogLoading = this.$loading({
target: this.$refs.dialogRef.$el
})
if (row) {
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() {
try {
@ -273,42 +212,52 @@ export default {
this.resetForm('queryForm')
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) {
try {
const isNull = this.validateNull();
if (!isNull) return;
const names = this.validateZero()
if (names){
await this.$modal.confirm("确认配件:" + names + "的销售价格为0吗")
}
this.formData['status'] = flag ? "02" : '05'
// const isNull = this.validateNull();
// if (!isNull) return;
// const names = this.validateZero()
// if (names) {
// await this.$modal.confirm("" + names + "0")
// }
this.formData['status'] = flag ? "02" : '03'
//
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
}
})]
if (this.selectRow && this.selectRow.length > 0){
this.formData.wares = [...this.selectRow.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
}
})]
}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)
this.dialogVisible = false
this.$modal.msgSuccess("审核成功")
@ -374,34 +323,41 @@ export default {
})
this.clickCellMap[id] = []
},
validateNull(){
validateNull() {
const flag = this.items.map(item => {
const price = item.wares.price
if (price === null || price === ""){
if (price === null || price === "") {
this.$modal.msgError("配件:" + item.waresName + "销售价格为空")
return false
}else {
} else {
return true
}
})
let count = 0
flag.forEach(item => {
if (!item){
if (!item) {
count++
}
})
return count === 0
},
validateZero(){
validateZero() {
const flag = this.items.map(item => {
const price = parseFloat(item.wares.price)
if (price === 0){
if (price === 0) {
return item.waresName
}else {
} else {
return ""
}
})
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,
waresName: item.name,
waresCount: item.count,
waresStatus: "02",
waresStatus: "0",
remark: item.remark,
isShow: '1'
}