新增服务顾问修改配件售价

This commit is contained in:
xiaofajia 2024-10-30 20:37:33 +08:00
parent 4d35b8d560
commit 01901d3efc
2 changed files with 129 additions and 43 deletions

View File

@ -419,6 +419,12 @@ export default {
// //
async handleSubmit() { async handleSubmit() {
try { try {
const isNull = this.validateNull();
if (!isNull) return;
const names = this.validateZero()
if (names){
await this.$modal.confirm("确认配件:" + names + "的采购价格为0吗")
}
await this.createInit() await this.createInit()
await createRepairSo(this.formData) await createRepairSo(this.formData)
this.inStockDialog = false this.inStockDialog = false
@ -457,6 +463,35 @@ export default {
} }
})] })]
}, },
validateNull(){
const flag = this.partList.map(item => {
const price = item.newPrice
if (price === null || price === ""){
this.$modal.msgError("配件:" + item.name + "采购价格为空")
return false
}else {
return true
}
})
let count = 0
flag.forEach(item => {
if (!item){
count++
}
})
return count === 0
},
validateZero(){
const flag = this.partList.map(item => {
const price = parseFloat(item.newPrice)
if (price === 0){
return item.name
}else {
return ""
}
})
return flag.filter(item => item !== "").join(",")
}
} }
} }
</script> </script>

View File

@ -123,13 +123,16 @@
</div> </div>
<!-- 卡片内容 --> <!-- 卡片内容 -->
<div> <div>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="90px">
<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="waresStatus"> <el-form-item label="状态" prop="waresStatus">
<el-select v-model="queryParams.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-option v-for="item in this.getDictDatas(DICT_TYPE.TW_ITEM_STATUS)" :key="item.value"
:label="item.label" :value="item.value"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -151,42 +154,53 @@
<span>{{ scope.$index + 1 }}</span> <span>{{ scope.$index + 1 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column align="center" label="客户可见" prop="isShow" v-if="userRole === 'service_advisor' && type" width="180">--> <!-- <el-table-column align="center" label="客户可见" prop="isShow" v-if="userRole === 'service_advisor' && type" width="180">-->
<!-- <template slot-scope="scope">--> <!-- <template slot-scope="scope">-->
<!-- <el-switch--> <!-- <el-switch-->
<!-- v-model="scope.row.isShow"--> <!-- v-model="scope.row.isShow"-->
<!-- active-text="是"--> <!-- active-text="是"-->
<!-- inactive-text="否"--> <!-- inactive-text="否"-->
<!-- active-value="1"--> <!-- active-value="1"-->
<!-- inactive-value="0"--> <!-- inactive-value="0"-->
<!-- @change="changeIsShow(scope.row)"--> <!-- @change="changeIsShow(scope.row)"-->
<!-- >--> <!-- >-->
<!-- </el-switch>--> <!-- </el-switch>-->
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </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="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="itemDiscount" 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">--> <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;--> <el-input @blur="save(scope.row)" class="item__input" v-model="scope.row.wares.price"/>
<!-- <DiscountInput @input-blur="save(scope.row)" class="item__input" v-model="scope.row.itemDiscount" />--> <span class="item__txt">{{ scope.row.wares.price }}</span>
<!-- <span class="item__txt">{{ scope.row.itemDiscount === 1 ? "无折扣" : scope.row.itemDiscount }}</span>--> </div>
<!-- </div>--> <div v-else slot-scope="scope">
<span>{{ scope.row.wares.price }}</span>
</div>
</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"> <div slot-scope="scope">
<span>{{ scope.row.itemDiscount === 1 ? "无折扣" : scope.row.itemDiscount }}</span> <span>{{ scope.row.itemDiscount === 1 ? "无折扣" : scope.row.itemDiscount }}</span>
</div> </div>
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center" prop="waresStatus" width="180"> <el-table-column label="状态" align="center" prop="waresStatus" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :type="DICT_TYPE.TW_ITEM_STATUS" :value="scope.row.waresStatus" /> <dict-tag :type="DICT_TYPE.TW_ITEM_STATUS" :value="scope.row.waresStatus"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="备注" prop="remark" width="180" :show-overflow-tooltip="true"/> <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" v-if="info.status === '01' && (userRole === 'service_advisor' || userRole === 'general_inspection')"> <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 type="primary" @click="handleAudit(true)"> </el-button>
<el-button @click="handleAudit(false)"> </el-button> <el-button @click="handleAudit(false)"> </el-button>
</div> </div>
@ -199,18 +213,19 @@ import {getTicketsById} from "@/api/repair/tickets/Tickets";
import {auditTicketWares} from "@/api/repair/tickets/TicketWares"; 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";
export default { export default {
name: "TicketWaresShow", name: "TicketWaresShow",
components: {DiscountInput}, components: {DiscountInput},
props:{ props: {
userRole: String, userRole: String,
type: Boolean type: Boolean
}, },
data(){ data() {
return{ return {
info:{}, info: {},
items:[], items: [],
dialogVisible: false, dialogVisible: false,
queryParams: { queryParams: {
twId: null, twId: null,
@ -221,12 +236,12 @@ export default {
loading: false, loading: false,
formData: {}, formData: {},
clickCellMap: {}, clickCellMap: {},
editProp: [], editProp: ['wares.price'],
} }
}, },
methods:{ methods: {
async open(row){ async open(row) {
if (row){ if (row) {
this.formData = row this.formData = row
const res = await getTicketsById(row.ticketId) const res = await getTicketsById(row.ticketId)
this.info = res.data this.info = res.data
@ -236,7 +251,7 @@ export default {
} }
this.dialogVisible = true this.dialogVisible = true
}, },
async getTwItem(){ async getTwItem() {
try { try {
this.loading = true this.loading = true
const res = await listTwItem(this.queryParams) const res = await listTwItem(this.queryParams)
@ -247,29 +262,35 @@ export default {
itemDiscount: 1, itemDiscount: 1,
} }
})] })]
}finally { } finally {
this.loading = false this.loading = false
} }
}, },
handleQuery(){ handleQuery() {
this.getTwItem() this.getTwItem()
}, },
resetQuery(){ resetQuery() {
this.resetForm('queryForm') this.resetForm('queryForm')
this.handleQuery() this.handleQuery()
}, },
async changeIsShow(row){ async changeIsShow(row) {
try { try {
this.loading = true this.loading = true
await updateIsShow({id: row.id, isShow: row.isShow}) await updateIsShow({id: row.id, isShow: row.isShow})
await this.getTwItem() await this.getTwItem()
}finally { } finally {
this.loading = false this.loading = false
} }
}, },
// //
async handleAudit(flag){ async handleAudit(flag) {
try { 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' this.formData['status'] = flag ? "02" : '05'
// //
this.formData.wares = [...this.items.map(item => { this.formData.wares = [...this.items.map(item => {
@ -292,7 +313,7 @@ export default {
this.dialogVisible = false this.dialogVisible = false
this.$modal.msgSuccess("审核成功") this.$modal.msgSuccess("审核成功")
this.$emit('success') this.$emit('success')
}catch { } catch {
} }
@ -342,7 +363,7 @@ export default {
}, },
/** 保存数据 */ /** 保存数据 */
save(row) { save(row) {
if (row.itemDiscount <= 0 || row.itemDiscount > 10){ if (row.itemDiscount <= 0 || row.itemDiscount > 10) {
row.itemDiscount = 10 row.itemDiscount = 10
this.$modal.msgError("折扣只能是1-10") this.$modal.msgError("折扣只能是1-10")
} }
@ -353,6 +374,35 @@ export default {
}) })
this.clickCellMap[id] = [] this.clickCellMap[id] = []
}, },
validateNull(){
const flag = this.items.map(item => {
const price = item.wares.price
if (price === null || price === ""){
this.$modal.msgError("配件:" + item.waresName + "销售价格为空")
return false
}else {
return true
}
})
let count = 0
flag.forEach(item => {
if (!item){
count++
}
})
return count === 0
},
validateZero(){
const flag = this.items.map(item => {
const price = parseFloat(item.wares.price)
if (price === 0){
return item.waresName
}else {
return ""
}
})
return flag.filter(item => item !== "").join(",")
}
} }
} }
</script> </script>
@ -361,6 +411,7 @@ export default {
.box-card { .box-card {
margin-bottom: 10px; margin-bottom: 10px;
} }
.item { .item {
.item__input { .item__input {
display: none; display: none;