Commit ef4f9e56 authored by Damon's avatar Damon

refactor: 完工-核销配件顺序调整

parent d8ac4e2d
......@@ -945,23 +945,30 @@ export default {
},
// 提交配件信息
submitParts() {
if (this.form.orderSpareParts) {
const orderSpareParts = JSON.parse(this.form.orderSpareParts)
const lists = orderSpareParts.filter((v) => v.quantity > 0)
const params = {
workOrderId: this.orderId,
applyType: '10',
parts: lists ? JSON.stringify(lists) : '',
}
this.$u.api.createParts(params).then((res) => {
if (res.code !== 200) {
this.$refs.uToast.show({
title: res.data,
type: 'error',
})
return new Promise((resolve, reject) => {
if (this.form.orderSpareParts) {
const orderSpareParts = JSON.parse(this.form.orderSpareParts)
const lists = orderSpareParts.filter((v) => v.quantity > 0)
const params = {
workOrderId: this.orderId,
applyType: '10',
parts: lists ? JSON.stringify(lists) : '',
}
})
}
this.$u.api.createParts(params).then((res) => {
if (res.code !== 200) {
this.$refs.uToast.show({
title: res.data,
type: 'error',
})
resolve(false)
}
resolve(true)
})
} else {
resolve(true)
}
})
},
// 提交订单
orderFinish() {
......@@ -972,10 +979,13 @@ export default {
mobile: this.vuex_user.mobile,
orderId: Number(this.orderId),
})
this.$u.api.saveCompleteData(param, this.orderId).then((res) => {
this.$u.api.saveCompleteData(param, this.orderId).then(async (res) => {
if (res.code == 200) {
//完工项信息保存成功再次完工工单
if (!this.exception) this.submitParts()
if (!this.exception) { // 核销配件
const submitPart = await this.submitParts()
if (!submitPart) return
}
if (this.inGuaranteePeriod === 'Y') {
this.$u.api.inOrderFinish(this.orderId).then((res) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment