- + 质检有问题不可回收 @@ -26,15 +26,21 @@ 质检说明 - {{testingTime}} + {{item.testingTime}} - - {{(idx+1).toString().padStart(2, '0')}} / {{problemList.length.toString().padStart(2, '0')}} - {{item.title}} + + {{(idx+1).toString().padStart(2, '0')}} / {{problemDescArr.length.toString().padStart(2, '0')}} + {{desc || '质量问题'}} 质量问题实拍 - + + + + + 为保护用户隐私,衣物照片仅本人可见,您无权限查看 + + @@ -44,7 +50,7 @@ 开始查验质检 - {{testingTime}} + {{item.testingTime}} 感谢您参与旧衣回收活动,支持环保事业。\n我们已收到您的旧衣,正在进行逐件查验。 @@ -53,7 +59,7 @@ - + 质检合格 @@ -67,14 +73,20 @@ 质检说明 - {{testingTime}} + {{item.testingTime}} - 01 / {{qualifiedImages.length.toString().padStart(2, '0')}} + 01 / {{imagesArr.length.toString().padStart(2, '0')}} 质检图片 - + + + + + 为保护用户隐私,衣物照片仅本人可见,您无权限查看 + + @@ -84,7 +96,7 @@ 开始查验质检 - {{testingTime}} + {{item.testingTime}} 感谢您参与旧衣回收活动,支持环保事业。\n我们已收到您的旧衣,正在进行逐件查验。 @@ -101,44 +113,14 @@ export default { data() { return { - status: 'problem', // 'problem' or 'qualified' - testingStatus: '', - testingTime: '', - testingImages: [], + status: 'problem', // 'problem' or 'qualified' or 'unrecyclable' statusBarHeight: 0, navBarHeight: 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) { @@ -147,51 +129,28 @@ export default { this.statusBarHeight = sysInfo.statusBarHeight this.navBarHeight = 44 this.navBarTotalHeight = this.statusBarHeight + this.navBarHeight - // 可通过 options.status = 'problem'/'qualified' 控制状态 if (options && 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 { - // 如果没有具体说明,创建默认的问题项 - this.problemList = [ - { - title: '质量问题', - images: this.testingImages - } - ] + this.problemDescArr = [] } - } else if (this.status === 'qualified') { - this.qualifiedImages = this.testingImages } }, methods: { @@ -404,4 +363,30 @@ export default { margin-top: 8rpx; 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; +} \ No newline at end of file diff --git a/pages/subcomponent/inspection-report.vue b/pages/subcomponent/inspection-report.vue index 1023afa..6ded66c 100644 --- a/pages/subcomponent/inspection-report.vue +++ b/pages/subcomponent/inspection-report.vue @@ -38,7 +38,7 @@ 质检合格 - + @@ -69,7 +69,7 @@ 质量问题 - + @@ -100,7 +100,7 @@ 不可回收 - + @@ -217,11 +217,9 @@ export default { }, parseOrderData(orderData) { - // 重置数据 this.goodsList = [] this.problemList = [] this.unrecyclableList = [] - // 直接遍历 orderCheckList if (orderData.orderCheckList && orderData.orderCheckList.length > 0) { orderData.orderCheckList.forEach(item => { // 合格 @@ -234,47 +232,51 @@ export default { count: item.qualifiedNum, total: (item.price || 0) * item.qualifiedNum, 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: '' }) } - // 质量问题 - 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.showProblem = this.problemList.length > 0 this.showUnrecyclable = this.unrecyclableList.length > 0 @@ -288,25 +290,13 @@ export default { 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))}` + }) } } }