Compare commits

..

No commits in common. "2197c2a78efadc630e6161680fa549d62a411854" and "75221763a6344f76fd2c2fac305029d5f0d12932" have entirely different histories.

2 changed files with 43 additions and 129 deletions

View File

@ -419,12 +419,6 @@ 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
@ -463,35 +457,6 @@ 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,16 +123,13 @@
</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>
@ -154,53 +151,42 @@
<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="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>-->
<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>
</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>
@ -213,19 +199,18 @@ 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,
@ -236,12 +221,12 @@ export default {
loading: false,
formData: {},
clickCellMap: {},
editProp: ['wares.price'],
editProp: [],
}
},
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
@ -251,7 +236,7 @@ export default {
}
this.dialogVisible = true
},
async getTwItem() {
async getTwItem(){
try {
this.loading = true
const res = await listTwItem(this.queryParams)
@ -262,35 +247,29 @@ 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 => {
@ -313,7 +292,7 @@ export default {
this.dialogVisible = false
this.$modal.msgSuccess("审核成功")
this.$emit('success')
} catch {
}catch {
}
@ -363,7 +342,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")
}
@ -374,35 +353,6 @@ 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>
@ -411,7 +361,6 @@ export default {
.box-card {
margin-bottom: 10px;
}
.item {
.item__input {
display: none;