Browse Source

'质检报告逻辑修改'

master
Lj 3 weeks ago
parent
commit
5b408025c6
2 changed files with 119 additions and 144 deletions
  1. +71
    -86
      pages/subcomponent/inspection-detail.vue
  2. +48
    -58
      pages/subcomponent/inspection-report.vue

+ 71
- 86
pages/subcomponent/inspection-detail.vue View File

@ -12,7 +12,7 @@
</view> </view>
</view> </view>
<view class="main-content safe-area-inset-bottom" :style="{marginTop: navBarTotalHeight + 'px'}"> <view class="main-content safe-area-inset-bottom" :style="{marginTop: navBarTotalHeight + 'px'}">
<view v-if="status === 'problem'" class="card card-problem">
<view v-if="(status === 'problem' || status === 'unrecyclable') && item" class="card card-problem">
<view class="card-header"> <view class="card-header">
<view class="dot dot-orange"></view> <view class="dot dot-orange"></view>
<text class="card-title card-title-orange">质检有问题不可回收</text> <text class="card-title card-title-orange">质检有问题不可回收</text>
@ -26,15 +26,21 @@
<view class="timeline-content"> <view class="timeline-content">
<view class="timeline-title-row"> <view class="timeline-title-row">
<text class="timeline-title">质检说明</text> <text class="timeline-title">质检说明</text>
<text class="timeline-time">{{testingTime}}</text>
<text class="timeline-time">{{item.testingTime}}</text>
</view> </view>
<view v-for="(item, idx) in problemList" :key="idx" class="problem-block">
<view class="problem-index">{{(idx+1).toString().padStart(2, '0')}} / {{problemList.length.toString().padStart(2, '0')}}</view>
<view class="problem-title">{{item.title}}</view>
<view v-for="(desc, idx) in problemDescArr.length ? problemDescArr : [item.problemDesc]" :key="idx" class="problem-block">
<view class="problem-index">{{(idx+1).toString().padStart(2, '0')}} / {{problemDescArr.length.toString().padStart(2, '0')}}</view>
<view class="problem-title">{{desc || '质量问题'}}</view>
<view class="problem-divider"></view> <view class="problem-divider"></view>
<view class="problem-label">质量问题实拍</view> <view class="problem-label">质量问题实拍</view>
<view class="problem-images"> <view class="problem-images">
<image v-for="(img, i) in item.images" :key="i" :src="img" class="problem-img" mode="aspectFill" />
<view v-for="(img, i) in imagesArr" :key="i" class="img-lock-wrap">
<image :src="img" class="problem-img" mode="aspectFill" />
<view v-if="!isSelf" class="img-lock-mask">
<image src="/static/lock.png" class="lock-icon" />
<view class="lock-tip">为保护用户隐私衣物照片仅本人可见您无权限查看</view>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
@ -44,7 +50,7 @@
<view class="timeline-content"> <view class="timeline-content">
<view class="timeline-title-row"> <view class="timeline-title-row">
<text class="timeline-title">开始查验质检</text> <text class="timeline-title">开始查验质检</text>
<text class="timeline-time">{{testingTime}}</text>
<text class="timeline-time">{{item.testingTime}}</text>
</view> </view>
<view class="timeline-desc"> <view class="timeline-desc">
感谢您参与旧衣回收活动支持环保事业\n我们已收到您的旧衣正在进行逐件查验 感谢您参与旧衣回收活动支持环保事业\n我们已收到您的旧衣正在进行逐件查验
@ -53,7 +59,7 @@
</view> </view>
</view> </view>
</view> </view>
<view v-else-if="status === 'qualified'" class="card card-qualified">
<view v-else-if="status === 'qualified' && item" class="card card-qualified">
<view class="card-header"> <view class="card-header">
<view class="dot dot-green"></view> <view class="dot dot-green"></view>
<text class="card-title card-title-green">质检合格</text> <text class="card-title card-title-green">质检合格</text>
@ -67,14 +73,20 @@
<view class="timeline-content"> <view class="timeline-content">
<view class="timeline-title-row"> <view class="timeline-title-row">
<text class="timeline-title">质检说明</text> <text class="timeline-title">质检说明</text>
<text class="timeline-time">{{testingTime}}</text>
<text class="timeline-time">{{item.testingTime}}</text>
</view> </view>
<view class="problem-block"> <view class="problem-block">
<view class="problem-index">01 / {{qualifiedImages.length.toString().padStart(2, '0')}}</view>
<view class="problem-index">01 / {{imagesArr.length.toString().padStart(2, '0')}}</view>
<view class="problem-title">质检图片</view> <view class="problem-title">质检图片</view>
<view class="problem-divider"></view> <view class="problem-divider"></view>
<view class="problem-images"> <view class="problem-images">
<image v-for="(img, i) in qualifiedImages" :key="i" :src="img" class="problem-img" mode="aspectFill" />
<view v-for="(img, i) in imagesArr" :key="i" class="img-lock-wrap">
<image :src="img" class="problem-img" mode="aspectFill" />
<view v-if="!isSelf" class="img-lock-mask">
<image src="/static/lock.png" class="lock-icon" />
<view class="lock-tip">为保护用户隐私衣物照片仅本人可见您无权限查看</view>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
@ -84,7 +96,7 @@
<view class="timeline-content"> <view class="timeline-content">
<view class="timeline-title-row"> <view class="timeline-title-row">
<text class="timeline-title">开始查验质检</text> <text class="timeline-title">开始查验质检</text>
<text class="timeline-time">{{testingTime}}</text>
<text class="timeline-time">{{item.testingTime}}</text>
</view> </view>
<view class="timeline-desc"> <view class="timeline-desc">
感谢您参与旧衣回收活动支持环保事业\n我们已收到您的旧衣正在进行逐件查验 感谢您参与旧衣回收活动支持环保事业\n我们已收到您的旧衣正在进行逐件查验
@ -101,44 +113,14 @@
export default { export default {
data() { data() {
return { return {
status: 'problem', // 'problem' or 'qualified'
testingStatus: '',
testingTime: '',
testingImages: [],
status: 'problem', // 'problem' or 'qualified' or 'unrecyclable'
statusBarHeight: 0, statusBarHeight: 0,
navBarHeight: 44, navBarHeight: 44,
navBarTotalHeight: 44, navBarTotalHeight: 44,
//
problemList: [
{
title: '大面积破损',
images: [
'https://oss.budingxiaoshuo.com/upload/组46584_1747804049771.png',
'https://oss.budingxiaoshuo.com/upload/组46584_1747804049771.png'
]
},
{
title: '大面积破损',
images: [
'https://oss.budingxiaoshuo.com/upload/组46584_1747804049771.png',
'https://oss.budingxiaoshuo.com/upload/组46584_1747804049771.png',
'https://oss.budingxiaoshuo.com/upload/组46584_1747804049771.png'
]
},
{
title: '大面积破损',
images: [
'https://oss.budingxiaoshuo.com/upload/组46584_1747804049771.png',
'https://oss.budingxiaoshuo.com/upload/组46584_1747804049771.png',
'https://oss.budingxiaoshuo.com/upload/组46584_1747804049771.png',
'https://oss.budingxiaoshuo.com/upload/组46584_1747804049771.png'
]
}
],
//
qualifiedImages: [
'https://oss.budingxiaoshuo.com/upload/组46584_1747804049771.png'
]
item: null,
problemDescArr: [],
imagesArr: [],
isSelf: true,
} }
}, },
onLoad(options) { onLoad(options) {
@ -147,51 +129,28 @@ export default {
this.statusBarHeight = sysInfo.statusBarHeight this.statusBarHeight = sysInfo.statusBarHeight
this.navBarHeight = 44 this.navBarHeight = 44
this.navBarTotalHeight = this.statusBarHeight + this.navBarHeight this.navBarTotalHeight = this.statusBarHeight + this.navBarHeight
// options.status = 'problem'/'qualified'
if (options && options.status) { if (options && options.status) {
this.status = options.status this.status = options.status
} }
if (options.testingStatus) {
this.testingStatus = options.testingStatus
}
// testingInstructions
let testingInstructionsArray = []
if (options.testingInstructions) {
const instructionsStr = decodeURIComponent(options.testingInstructions)
if (instructionsStr && instructionsStr.trim()) {
//
testingInstructionsArray = instructionsStr.split(',').filter(item => item.trim() !== '')
if (options.data) {
this.item = JSON.parse(decodeURIComponent(options.data))
// id
const myUserId = uni.getStorageSync('userInfo')?.id
const orderUserId = this.item.userId
this.isSelf = myUserId && orderUserId && String(myUserId) === String(orderUserId)
//
if (this.item.testingImages) {
console.log(this.item.testingImages, 'this.item.testingImages')
this.imagesArr = String(this.item.testingImages).split(',').filter(i => i)
} else {
this.imagesArr = []
} }
}
if (options.testingTime) {
this.testingTime = decodeURIComponent(options.testingTime)
}
if (options.testingImages) {
//
this.testingImages = decodeURIComponent(options.testingImages).split(',').filter(item => item.trim() !== '')
}
// status problemList/qualifiedImages
if (this.status === 'problem') {
// testingInstructions
if (testingInstructionsArray.length > 0) {
this.problemList = testingInstructionsArray.map((instruction, index) => ({
title: instruction || '质量问题',
images: this.testingImages //
}))
//
if (this.item.problemDesc) {
this.problemDescArr = String(this.item.problemDesc).split(',').filter(i => i)
} else { } else {
//
this.problemList = [
{
title: '质量问题',
images: this.testingImages
}
]
this.problemDescArr = []
} }
} else if (this.status === 'qualified') {
this.qualifiedImages = this.testingImages
} }
}, },
methods: { methods: {
@ -404,4 +363,30 @@ export default {
margin-top: 8rpx; margin-top: 8rpx;
line-height: 1.7; line-height: 1.7;
} }
.img-lock-wrap {
position: relative;
display: inline-block;
}
.img-lock-mask {
position: absolute;
left: 0; top: 0; right: 0; bottom: 0;
background: rgba(0,0,0,0.45);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border-radius: 12rpx;
z-index: 2;
}
.lock-icon {
width: 48rpx;
height: 48rpx;
margin-bottom: 8rpx;
}
.lock-tip {
color: #fff;
font-size: 20rpx;
text-align: center;
padding: 0 8rpx;
}
</style> </style>

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

@ -38,7 +38,7 @@
<view v-if="showQualified && goodsList.length" class="inspection-card"> <view v-if="showQualified && goodsList.length" class="inspection-card">
<view class="report-title">质检合格</view> <view class="report-title">质检合格</view>
<view class="goods-list"> <view class="goods-list">
<view class="goods-item" v-for="(item, i) in displayedGoodsList" :key="i" @tap="goToInspectionDetail('qualified')">
<view class="goods-item" v-for="(item, i) in displayedGoodsList" :key="i" @tap="goToInspectionDetail('qualified', item)">
<image class="goods-img" :src="item.img" mode="aspectFit" /> <image class="goods-img" :src="item.img" mode="aspectFit" />
<view class="goods-info"> <view class="goods-info">
<view class="goods-row"> <view class="goods-row">
@ -69,7 +69,7 @@
<view v-if="showProblem && problemList.length" class="inspection-card problem-card"> <view v-if="showProblem && problemList.length" class="inspection-card problem-card">
<view class="report-title">质量问题</view> <view class="report-title">质量问题</view>
<view class="goods-list"> <view class="goods-list">
<view class="goods-item" v-for="(item, i) in displayedProblemList" :key="i" @tap="goToInspectionDetail('problem')">
<view class="goods-item" v-for="(item, i) in displayedProblemList" :key="i" @tap="goToInspectionDetail('problem', item)">
<image class="goods-img" :src="item.img" mode="aspectFit" /> <image class="goods-img" :src="item.img" mode="aspectFit" />
<view class="goods-info"> <view class="goods-info">
<view class="goods-row"> <view class="goods-row">
@ -100,7 +100,7 @@
<view v-if="showUnrecyclable && unrecyclableList.length" class="inspection-card problem-card"> <view v-if="showUnrecyclable && unrecyclableList.length" class="inspection-card problem-card">
<view class="report-title">不可回收</view> <view class="report-title">不可回收</view>
<view class="goods-list"> <view class="goods-list">
<view class="goods-item" v-for="(item, i) in displayedUnrecyclableList" :key="i" @tap="goToInspectionDetail('problem')">
<view class="goods-item" v-for="(item, i) in displayedUnrecyclableList" :key="i" @tap="goToInspectionDetail('unrecyclable', item)">
<image class="goods-img" :src="item.img" mode="aspectFit" /> <image class="goods-img" :src="item.img" mode="aspectFit" />
<view class="goods-info"> <view class="goods-info">
<view class="goods-row"> <view class="goods-row">
@ -217,11 +217,9 @@ export default {
}, },
parseOrderData(orderData) { parseOrderData(orderData) {
//
this.goodsList = [] this.goodsList = []
this.problemList = [] this.problemList = []
this.unrecyclableList = [] this.unrecyclableList = []
// orderCheckList
if (orderData.orderCheckList && orderData.orderCheckList.length > 0) { if (orderData.orderCheckList && orderData.orderCheckList.length > 0) {
orderData.orderCheckList.forEach(item => { orderData.orderCheckList.forEach(item => {
// //
@ -234,47 +232,51 @@ export default {
count: item.qualifiedNum, count: item.qualifiedNum,
total: (item.price || 0) * item.qualifiedNum, total: (item.price || 0) * item.qualifiedNum,
detail: true, detail: true,
testingInstructions: item.testingInstructions || '',
testingImages: item.testingImages || '',
testingTime: item.testingTime || '',
testingInstructions: '',
testingImages: (item.commonOrderList && item.commonOrderList[0] && item.commonOrderList[0].testingImages) || '',
testingTime: (item.commonOrderList && item.commonOrderList[0] && item.commonOrderList[0].testingTime) || '',
problemDesc: '' 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 || ''
//
if (Array.isArray(item.commonOrderList)) {
item.commonOrderList.forEach(sub => {
//
if (sub.testingStatus == 1) {
this.problemList.push({
img: item.image || '/static/default-goods.png',
name: item.title || '未知品类',
desc: item.pinName ? `${item.pinName}` : '',
price: item.price || 0,
count: sub.num || 1,
total: 0,
detail: true,
testingInstructions: sub.testingInstructions || '',
testingImages: sub.testingImages || '',
testingTime: sub.testingTime || '',
problemDesc: sub.testingInstructions || ''
})
}
//
if (sub.testingStatus == 2) {
this.unrecyclableList.push({
img: item.image || '/static/default-goods.png',
name: item.title || '未知品类',
desc: item.pinName ? `${item.pinName}` : '',
price: item.price || 0,
count: sub.num || 1,
total: 0,
detail: true,
testingInstructions: sub.testingInstructions || '',
testingImages: sub.testingImages || '',
testingTime: sub.testingTime || '',
problemDesc: sub.testingInstructions || ''
})
}
}) })
} }
}) })
} }
//
this.showQualified = this.goodsList.length > 0 this.showQualified = this.goodsList.length > 0
this.showProblem = this.problemList.length > 0 this.showProblem = this.problemList.length > 0
this.showUnrecyclable = this.unrecyclableList.length > 0 this.showUnrecyclable = this.unrecyclableList.length > 0
@ -288,25 +290,13 @@ export default {
navigateBack() { navigateBack() {
uni.navigateBack() uni.navigateBack()
}, },
goToInspectionDetail(status) {
//
let itemData = null
if (status === 'qualified' && this.goodsList.length > 0) {
itemData = this.goodsList[0]
} else if (status === 'problem' && this.problemList.length > 0) {
itemData = this.problemList[0]
}else if (status === 'unrecyclable' && this.unrecyclableList.length > 0) {
itemData = this.unrecyclableList[0]
}
if (itemData) {
uni.navigateTo({
url: `/pages/subcomponent/inspection-detail?status=${status}` +
`&testingInstructions=${encodeURIComponent(itemData.testingInstructions || '')}` +
`&testingTime=${encodeURIComponent(itemData.testingTime || '')}` +
`&testingImages=${encodeURIComponent(itemData.testingImages || '')}`
})
}
goToInspectionDetail(status, item) {
if (!item) return;
const userId = this.reportData && this.reportData.userId;
const data = { ...item, userId };
uni.navigateTo({
url: `/pages/subcomponent/inspection-detail?status=${status}&data=${encodeURIComponent(JSON.stringify(data))}`
})
} }
} }
} }


Loading…
Cancel
Save