Browse Source

'完善查看回收质检页面逻辑'

master
Lj 3 weeks ago
parent
commit
0e5eee4f7e
1 changed files with 48 additions and 45 deletions
  1. +48
    -45
      pages/subcomponent/inspection-report.vue

+ 48
- 45
pages/subcomponent/inspection-report.vue View File

@ -221,61 +221,64 @@ export default {
this.goodsList = []
this.problemList = []
this.unrecyclableList = []
// commonOrderList
// orderCheckList
if (orderData.orderCheckList && orderData.orderCheckList.length > 0) {
orderData.orderCheckList.forEach(mainOrder => {
//
if (mainOrder.commonOrderList && mainOrder.commonOrderList.length > 0) {
mainOrder.commonOrderList.forEach(subOrder => {
this.categorizeOrderItem(subOrder, mainOrder)
orderData.orderCheckList.forEach(item => {
//
if (Number(item.qualifiedNum) > 0) {
this.goodsList.push({
img: item.image || '/static/default-goods.png',
name: item.title || '未知品类',
desc: item.pinName ? `${item.pinName}` : '',
price: item.price || 0,
count: item.qualifiedNum,
total: (item.price || 0) * item.qualifiedNum,
detail: true,
testingInstructions: item.testingInstructions || '',
testingImages: item.testingImages || '',
testingTime: item.testingTime || '',
problemDesc: ''
})
}
//
if (Number(item.noQualifiedNum) > 0) {
this.problemList.push({
img: item.image || '/static/default-goods.png',
name: item.title || '未知品类',
desc: item.pinName ? `${item.pinName}` : '',
price: item.price || 0,
count: item.noQualifiedNum,
total: 0,
detail: true,
testingInstructions: item.testingInstructions || '',
testingImages: item.testingImages || '',
testingTime: item.testingTime || '',
problemDesc: item.testingInstructions || ''
})
}
//
if (Number(item.unrecyclable) > 0) {
this.unrecyclableList.push({
img: item.image || '/static/default-goods.png',
name: item.title || '未知品类',
desc: item.pinName ? `${item.pinName}` : '',
price: item.price || 0,
count: item.unrecyclable,
total: 0,
detail: true,
testingInstructions: item.testingInstructions || '',
testingImages: item.testingImages || '',
testingTime: item.testingTime || '',
problemDesc: item.testingInstructions || ''
})
} else {
//
this.categorizeOrderItem(mainOrder)
}
})
}
//
this.showQualified = this.goodsList.length > 0
this.showProblem = this.problemList.length > 0
this.showUnrecyclable = this.unrecyclableList.length > 0
},
categorizeOrderItem(orderItem, parentOrder = null) {
const status = Number(orderItem.testingStatus)
const parentData = parentOrder || orderItem
// testingStatus 0-1-
if (status === 0) {
//
this.goodsList.push(this.mapOrderToGoods(orderItem, parentData))
} else if (status === 1) {
//
this.problemList.push(this.mapOrderToGoods(orderItem, parentData, true))
}
else{
this.unrecyclableList.push(this.mapOrderToGoods(orderItem, parentData, true))
}
// testingStatus = 2 ()
},
mapOrderToGoods(orderItem, parentData, isProblem = false) {
return {
img: parentData.image || '/static/default-goods.png',
name: parentData.title || '未知品类',
desc: parentData.pinName ? `${parentData.pinName}` :'',
price: parentData.price/ orderItem.num || 0,
count: orderItem.num || 1,
total: parentData.price,
detail: true,
testingInstructions: orderItem.testingInstructions || '',
testingImages: orderItem.testingImages || '',
testingTime: orderItem.testingTime || '',
problemDesc: isProblem ? (orderItem.testingInstructions || '') : ''
}
},
async onRefresh() {
//


Loading…
Cancel
Save