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

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() {
try {
const isNull = this.validateNull();
if (!isNull) return;
const names = this.validateZero()
if (names){
await this.$modal.confirm("确认配件:" + names + "的采购价格为0吗")
}
await this.createInit()
await createRepairSo(this.formData)
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>

View File

@ -123,13 +123,16 @@
</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-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 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-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>
@ -151,42 +154,53 @@
<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 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="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="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>-->
<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>
<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>
<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" />
<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 align="center" label="备注" prop="remark" width="180" :show-overflow-tooltip="true"/>
</el-table>
</div>
</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 @click="handleAudit(false)"> </el-button>
</div>
@ -199,18 +213,19 @@ import {getTicketsById} from "@/api/repair/tickets/Tickets";
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";
export default {
name: "TicketWaresShow",
components: {DiscountInput},
props:{
props: {
userRole: String,
type: Boolean
},
data(){
return{
info:{},
items:[],
data() {
return {
info: {},
items: [],
dialogVisible: false,
queryParams: {
twId: null,
@ -221,12 +236,12 @@ export default {
loading: false,
formData: {},
clickCellMap: {},
editProp: [],
editProp: ['wares.price'],
}
},
methods:{
async open(row){
if (row){
methods: {
async open(row) {
if (row) {
this.formData = row
const res = await getTicketsById(row.ticketId)
this.info = res.data
@ -236,7 +251,7 @@ export default {
}
this.dialogVisible = true
},
async getTwItem(){
async getTwItem() {
try {
this.loading = true
const res = await listTwItem(this.queryParams)
@ -247,29 +262,35 @@ export default {
itemDiscount: 1,
}
})]
}finally {
} finally {
this.loading = false
}
},
handleQuery(){
handleQuery() {
this.getTwItem()
},
resetQuery(){
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
async changeIsShow(row){
async changeIsShow(row) {
try {
this.loading = true
await updateIsShow({id: row.id, isShow: row.isShow})
await this.getTwItem()
}finally {
} finally {
this.loading = false
}
},
//
async handleAudit(flag){
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'
//
this.formData.wares = [...this.items.map(item => {
@ -292,7 +313,7 @@ export default {
this.dialogVisible = false
this.$modal.msgSuccess("审核成功")
this.$emit('success')
}catch {
} catch {
}
@ -342,7 +363,7 @@ export default {
},
/** 保存数据 */
save(row) {
if (row.itemDiscount <= 0 || row.itemDiscount > 10){
if (row.itemDiscount <= 0 || row.itemDiscount > 10) {
row.itemDiscount = 10
this.$modal.msgError("折扣只能是1-10")
}
@ -353,6 +374,35 @@ export default {
})
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>
@ -361,6 +411,7 @@ export default {
.box-card {
margin-bottom: 10px;
}
.item {
.item__input {
display: none;