diff --git a/pages/manager/inspect-result.vue b/pages/manager/inspect-result.vue index 14b0927..f07c7c9 100644 --- a/pages/manager/inspect-result.vue +++ b/pages/manager/inspect-result.vue @@ -26,6 +26,7 @@ 总金额 + @@ -147,6 +148,16 @@ 自定义理由 + + 质检级别 + + + {{ level }} + + + 选择理由 @@ -182,6 +193,7 @@ export default { reasonChecked: [], customReason: '', // 自定义理由输入 currentReasonItem: null, + currentQualityLevel: '', // 当前选择的质检级别 isPopupOpen: false, // 控制弹窗状态 scrollTop: 0 // 记录滚动位置 } @@ -251,6 +263,7 @@ export default { pinId: item.pinId || '', styleId: item.styleId || '', uniqueKey: uniqueKey, + qualityLevel: item.qualityLevel || '', // 质检级别 originalItem: item, // 保存原始数据引用 items: item.commonOrderList ? [...item.commonOrderList] : [{ testingInstructions: '', @@ -409,6 +422,8 @@ export default { } else { this.reasonImages = [] } + // 初始化质检级别 + this.currentQualityLevel = popupItem.qualityLevel || '' // 不在这里设置reasonChecked this.selectReasonForUnqualified(popupItem, type) this.lockScroll() @@ -423,6 +438,8 @@ export default { } else { this.reasonImages = [] } + // 初始化质检级别 + this.currentQualityLevel = commonItem.qualityLevel || '' // 使用从上一个页面传过来的categoryId this.selectReasonForUnqualified(commonItem, 0, parentItem.classId) this.lockScroll() @@ -588,6 +605,7 @@ export default { // 直接更新当前项 this.currentReasonItem.testingInstructions = allReasons.join(',') this.currentReasonItem.testingImages = this.reasonImages.join(',') + this.currentReasonItem.qualityLevel = this.currentQualityLevel } this.closeReasonPopup() }, @@ -669,6 +687,11 @@ export default { } }, + selectQualityLevel(level) { + // 设置当前选择的质检级别 + this.currentQualityLevel = level + }, + syncPriceToInspectData() { // 同步合格产品金额 - 按品牌款式唯一标识 this.qualifiedList.forEach(qualifiedItem => { @@ -687,6 +710,9 @@ export default { if (inspectItem) { inspectItem.price = parseFloat(qualifiedItem.total) || 0 + // 同步质检级别 - 从items中获取第一个有级别的项目 + const itemWithLevel = qualifiedItem.items && qualifiedItem.items.find(item => item.qualityLevel) + inspectItem.qualityLevel = itemWithLevel ? itemWithLevel.qualityLevel : (qualifiedItem.qualityLevel || '') // 同步理由信息 if (qualifiedItem.items && qualifiedItem.items.length > 0) { inspectItem.commonOrderList = qualifiedItem.items @@ -694,19 +720,33 @@ export default { } }) - // 同步不合格产品金额 + // 同步不合格产品金额和质检级别 this.unqualifiedGroups.forEach(group => { const inspectItem = this.inspectData.list.find(item => item.id === 'quality_issue') if (inspectItem) { inspectItem.price = parseFloat(group.total) || 0 + // 同步质检级别 + if (inspectItem.commonOrderList && inspectItem.commonOrderList.length > 0) { + const itemWithLevel = inspectItem.commonOrderList.find(item => item.qualityLevel) + if (itemWithLevel) { + inspectItem.qualityLevel = itemWithLevel.qualityLevel + } + } } }) - // 同步不可回收产品金额 + // 同步不可回收产品金额和质检级别 this.unrecyclableList.forEach(unrecyclableItem => { const inspectItem = this.inspectData.list.find(item => item.id === 'unrecyclable') if (inspectItem) { inspectItem.price = parseFloat(unrecyclableItem.total) || 0 + // 同步质检级别 + if (inspectItem.commonOrderList && inspectItem.commonOrderList.length > 0) { + const itemWithLevel = inspectItem.commonOrderList.find(item => item.qualityLevel) + if (itemWithLevel) { + inspectItem.qualityLevel = itemWithLevel.qualityLevel + } + } } }) } @@ -882,6 +922,8 @@ export default { } } + + .row-reason { display: flex; align-items: center; @@ -1057,6 +1099,41 @@ export default { font-weight: 500; } + .level-options { + display: flex; + gap: 12px; + margin-bottom: 16px; + + .level-option { + width: 40px; + height: 40px; + border-radius: 8px; + border: 2px solid #ddd; + display: flex; + align-items: center; + justify-content: center; + background: #fff; + cursor: pointer; + transition: all 0.2s; + + &.selected { + border-color: #ffb400; + background: #ffb400; + + .level-text { + color: #fff; + font-weight: bold; + } + } + + .level-text { + font-size: 16px; + color: #666; + font-weight: 500; + } + } + } + .custom-reason-input { width: 100%; min-height: 80px; diff --git a/pages/manager/inspect.vue b/pages/manager/inspect.vue index 439b262..4eaa112 100644 --- a/pages/manager/inspect.vue +++ b/pages/manager/inspect.vue @@ -23,7 +23,11 @@ - + + + + 品牌 + {{ item.name }} @@ -573,13 +577,30 @@ export default { } } - // 品牌商品且加一时,总是打开品牌选择 - if (item.isPin === 'Y' && delta > 0) { + // 品牌商品且数量为0且加一时,打开品牌选择 + if (item.isPin === 'Y' && (this.getItemTotalQuantity(item) === 0) && delta > 0) { this.pendingBrandIndex = index this.$refs.brandSelector.open(item.id) return } + // 品牌商品且已有数量时,继续增加到现有品牌款式 + if (item.isPin === 'Y' && this.getItemTotalQuantity(item) > 0 && delta > 0) { + // 如果只有一个品牌款式,直接增加 + if (item.brandStyleQuantities && Object.keys(item.brandStyleQuantities).length === 1) { + const uniqueKey = Object.keys(item.brandStyleQuantities)[0] + const currentQty = item.brandStyleQuantities[uniqueKey] || 0 + this.$set(item.brandStyleQuantities, uniqueKey, currentQty + delta) + this.updateInspectResultFromBrandStyle(item) + return + } else { + // 有多个品牌款式,打开品牌选择 + this.pendingBrandIndex = index + this.$refs.brandSelector.open(item.id) + return + } + } + // 无品牌商品,直接加减数量 if (item.isPin !== 'Y') { let newQuantity = (item.quantity || 0) + delta @@ -1258,15 +1279,34 @@ export default { align-items: center; margin-bottom: 24rpx; - .goods-img { + .goods-img-container { + position: relative; width: 112rpx; height: 112rpx; - border-radius: 32rpx; margin-right: 24rpx; + flex-shrink: 0; + } + + .goods-img { + width: 100%; + height: 100%; + border-radius: 32rpx; background: #f8f8f8; object-fit: contain; } + .brand-tag { + position: absolute; + top: 0rpx; + left: 0rpx; + background: rgba(0, 0, 0, 0.8); + color: #fff; + font-size: 20rpx; + padding: 4rpx 8rpx; + border-radius: 8rpx; + z-index: 2; + } + .goods-info { flex: 1; display: flex; diff --git a/pages/manager/order.vue b/pages/manager/order.vue index 359fbd1..8305f8c 100644 --- a/pages/manager/order.vue +++ b/pages/manager/order.vue @@ -366,6 +366,11 @@ label: '已驳回', class: 'red' } + } else if (state === 5) { + return { + label: '已退款', + class: 'gray' + } } else if (state === 3) { return { label: '已取消', diff --git a/pages/subcomponent/detail.vue b/pages/subcomponent/detail.vue index 86e7dce..d06ad47 100644 --- a/pages/subcomponent/detail.vue +++ b/pages/subcomponent/detail.vue @@ -135,11 +135,10 @@ 质检结果 - 质检数量9 件 - 质检合格7 件 - 质量问题2 件 - 不可回收0 件 - 订单重量2.85 kg + 质检数量{{ totalInspectCount }} 件 + 质检合格{{ orderDetail.qualifiedNum || 0 }} 件 + 质量问题{{ orderDetail.noQualifiedNum || 0 }} 件 + 不可回收{{ orderDetail.unrecyclable || 0 }} 件 点此查看质检报告详情 @@ -225,6 +224,11 @@ export default { }, showEstimate() { return this.status < 2 + }, + totalInspectCount() { + // 计算质检总数量 + if (!this.orderDetail) return 0 + return (this.orderDetail.qualifiedNum || 0) + (this.orderDetail.noQualifiedNum || 0) + (this.orderDetail.unrecyclable || 0) } }, methods: { @@ -425,7 +429,7 @@ export default { }, setOrderStatus(status, state, data) { // 0:在线预约 1:快递上门 2:透明质检 3:现金打款 - // state:0待取件 1已取件 2已完成 3已取消 + // state:0待取件 1已取件 2已完成 3已取消 4已驳回 5已退款 if (state == 3) { this.currentStep = 0 this.currentStatus = { @@ -436,6 +440,26 @@ export default { this.showEditButton = false return } + if (state == 4) { + this.currentStep = 0 + this.currentStatus = { + text: '已驳回', + time: '', + icon: '/static/【待取件】快递员正在赶来.png' + } + this.showEditButton = false + return + } + if (state == 5) { + this.currentStep = 0 + this.currentStatus = { + text: '已退款', + time: '', + icon: '/static/【待取件】快递员正在赶来.png' + } + this.showEditButton = false + return + } if (status == 0) { this.currentStep = 1 this.currentStatus = { diff --git a/pages/subcomponent/inspection-detail.vue b/pages/subcomponent/inspection-detail.vue index 9f62716..084ec1c 100644 --- a/pages/subcomponent/inspection-detail.vue +++ b/pages/subcomponent/inspection-detail.vue @@ -11,105 +11,162 @@ - - - - - 质检有问题不可回收 - - - 感谢您参与旧衣回收活动,支持环保事业。\n我们已收到您的旧衣,并完成质检。经平台专业质检员严格查验,发现商品存在质量问题。 + + + + + + 质检合格 - - - - - - 质检说明 - {{ item.testingTime }} - - - {{ (idx + 1).toString().padStart(2, '0') }} / - {{ problemDescArr.length.toString().padStart(2, '0') }} - {{ desc || '质量问题' }} - - 质量问题实拍 - - - - - - 为保护用户隐私,衣物照片仅本人可见,您无权限查看 - - + + {{ item.qualityLevel }} + + + + + {{ item.name }} + {{ item.desc }} + 款式:{{ item.styleName }} + + ¥{{ (item.price / item.count).toFixed(2) }}/件 + x{{ item.count }} - - - - - 开始查验质检 - {{ item.testingTime }} - - - 感谢您参与旧衣回收活动,支持环保事业。\n我们已收到您的旧衣,正在进行逐件查验。 + + + + + + 质检说明 + {{ item.testingTime }} + + + 质检图片 + + + + + + + 为保护用户隐私,衣物照片仅本人可见,您无权限查看 + + + + 暂无质检图片 + - - - - 质检合格 - - - 感谢您参与旧衣回收活动,支持环保事业。\n经平台专业质检员严格查验,商品合格。 + + + + + + 不可回收 - - - - - - 质检说明 - {{ item.testingTime }} + + {{ item.qualityLevel }} + + + + + {{ item.name }} + {{ item.desc }} + 款式:{{ item.styleName }} + + ¥{{ (item.price / item.count).toFixed(2) }}/件 + x{{ item.count }} + - - 01 / {{ imagesArr.length.toString().padStart(2, '0') }} - 质检图片 - - - - - - - 为保护用户隐私,衣物照片仅本人可见,您无权限查看 + + + + + + + + 质检说明 + {{ item.testingTime }} + + + {{ item.problemDesc || '不可回收' }} + + 质检实拍 + + + + + + 为保护用户隐私,衣物照片仅本人可见,您无权限查看 + + 暂无质检图片 - - - - - 开始查验质检 - {{ item.testingTime }} + + + + + + + + 质量问题 + + + {{ item.qualityLevel }} + + + + + {{ item.name }} + {{ item.desc }} + 款式:{{ item.styleName }} + + ¥{{ (item.price / item.count).toFixed(2) }}/件 + x{{ item.count }} + - - 感谢您参与旧衣回收活动,支持环保事业。\n我们已收到您的旧衣,正在进行逐件查验。 + + + + + + + + 质检说明 + {{ item.testingTime }} + + + {{ item.problemDesc || '质量问题' }} + + 质量问题实拍 + + + + + + 为保护用户隐私,衣物照片仅本人可见,您无权限查看 + + + + 暂无质检图片 + - + @@ -117,58 +174,143 @@ export default { data() { return { - status: 'problem', // 'problem' or 'qualified' or 'unrecyclable' statusBarHeight: 0, navBarHeight: 44, navBarTotalHeight: 44, - item: null, - problemDescArr: [], - imagesArr: [], + orderId: '', + qualifiedList: [], + problemList: [], + unrecyclableList: [], isSelf: true, } }, + computed: { + bkhs_image() {//不可回收图片 + const item = getApp().globalData.configData.find(i => i.keyName === 'bkhs_image') + return item ? item.keyContent : '' + }, + zlwt_image() {//质量问题图片 + const item = getApp().globalData.configData.find(i => i.keyName === 'zlwt_image') + return item ? item.keyContent : '' + }, + }, onLoad(options) { // 适配顶部安全区 const sysInfo = uni.getSystemInfoSync() this.statusBarHeight = sysInfo.statusBarHeight this.navBarHeight = 44 this.navBarTotalHeight = this.statusBarHeight + this.navBarHeight - if (options && options.status) { - this.status = options.status + + // 获取订单ID + if (options && options.orderId) { + this.orderId = options.orderId + this.fetchOrderDetail() } - 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 (options.isSelf) { - console.log(options.isSelf, 'options.isSelf管理员') - this.isSelf = true - } - // 处理图片数组 - 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 (this.item.problemDesc) { - this.problemDescArr = String(this.item.problemDesc).split(',').filter(i => i) - } else { - this.problemDescArr = [] - } + + // 判断是否为本人或管理员 + if (options.isSelf) { + this.isSelf = true } }, methods: { + async fetchOrderDetail() { + this.$api && this.$api('getOrderDetail', { + orderId: this.orderId + }, res => { + if (res && res.code === 200 && res.result) { + this.parseOrderData(res.result) + } + }) + }, + + parseOrderData(orderData) { + this.qualifiedList = [] + this.problemList = [] + this.unrecyclableList = [] + + if (orderData.orderCheckList && orderData.orderCheckList.length > 0) { + orderData.orderCheckList.forEach(item => { + // 合格商品 + if (Number(item.qualifiedNum) > 0) { + const imagesArr = item.commonOrderList && item.commonOrderList[0] && item.commonOrderList[0].testingImages + ? item.commonOrderList[0].testingImages.split(',').filter(img => img.trim() !== '') + : [] + + this.qualifiedList.push({ + img: item.image || '/static/default-goods.png', + name: item.title || '未知品类', + desc: item.pinName ? `${item.pinName}` : '', + styleName: item.styleName || '', + price: item.price || 0, + count: item.qualifiedNum, + qualityLevel: item.qualityLevel || '', + testingTime: item.commonOrderList && item.commonOrderList[0] && item.commonOrderList[0].testingTime || '', + imagesArr: imagesArr + }) + } + + // 质量问题和不可回收 + if (Array.isArray(item.commonOrderList)) { + item.commonOrderList.forEach(sub => { + const imagesArr = sub.testingImages ? sub.testingImages.split(',').filter(img => img.trim() !== '') : [] + + // 质量问题 + if (sub.testingStatus == 1) { + this.problemList.push({ + img: item.image, + name: item.title || '未知品类', + desc: item.pinName ? `${item.pinName}` : '', + styleName: item.styleName || '', + price: (item.price || 0) / (item.noQualifiedNum || 1), + count: sub.num || 1, + qualityLevel: sub.qualityLevel || '', + testingTime: sub.testingTime || '', + problemDesc: sub.testingInstructions || '', + imagesArr: imagesArr + }) + } + + // 不可回收 + if (sub.testingStatus == 2) { + this.unrecyclableList.push({ + img: item.image, + name: item.title || '未知品类', + desc: item.pinName ? `${item.pinName}` : '', + styleName: item.styleName || '', + price: (item.price || 0) / (item.unrecyclable || 1), + count: sub.num || 1, + qualityLevel: sub.qualityLevel || '', + testingTime: sub.testingTime || '', + problemDesc: sub.testingInstructions || '', + imagesArr: imagesArr + }) + } + }) + } + }) + } + }, + navigateBack() { uni.navigateBack() }, + previewImage(img, i) { + // 获取当前点击图片所在的列表 + let allImages = [] + this.qualifiedList.forEach(item => { + if (item.imagesArr) allImages = allImages.concat(item.imagesArr) + }) + this.problemList.forEach(item => { + if (item.imagesArr) allImages = allImages.concat(item.imagesArr) + }) + this.unrecyclableList.forEach(item => { + if (item.imagesArr) allImages = allImages.concat(item.imagesArr) + }) + uni.previewImage({ current: img, - urls: this.imagesArr + urls: allImages.length > 0 ? allImages : [img] }) } } @@ -221,15 +363,94 @@ export default { } .main-content { - padding: 32rpx 0 0 0; + padding: 32rpx 24rpx 0 24rpx; width: 100%; max-width: 750rpx; margin: 0 auto; box-sizing: border-box; + height: calc(100vh - var(--nav-bar-height)); +} + +.section { + margin-bottom: 40rpx; +} + +.section-title { display: flex; - flex-direction: column; align-items: center; - overflow: hidden; + margin-bottom: 24rpx; + padding: 0 16rpx; +} + +.title-text { + font-size: 32rpx; + font-weight: bold; + color: #222; +} + +.goods-info { + display: flex; + align-items: center; + margin-bottom: 16rpx; +} + +.goods-img { + width: 80rpx; + height: 80rpx; + border-radius: 16rpx; + margin-right: 20rpx; + background: #f5f5f5; +} + +.goods-detail { + flex: 1; + display: flex; + flex-direction: column; +} + +.goods-name { + font-size: 28rpx; + font-weight: bold; + color: #222; + margin-bottom: 4rpx; +} + +.goods-desc { + font-size: 24rpx; + color: #999; + margin-bottom: 4rpx; +} + +.goods-style { + font-size: 24rpx; + color: #666; + margin-bottom: 4rpx; +} + +.goods-price-row { + display: flex; + align-items: baseline; + justify-content: space-between; +} + +.goods-price { + font-size: 24rpx; + color: #ff6600; + font-weight: bold; +} + +.goods-count { + font-size: 24rpx; + color: #666; +} + +.no-images { + color: #999; + font-size: 24rpx; + text-align: center; + padding: 20rpx; + background: #f8f8f8; + border-radius: 12rpx; } .safe-area-inset-bottom { @@ -244,11 +465,29 @@ export default { box-shadow: 0 4rpx 24rpx rgba(60, 167, 250, 0.08); background: #fff; max-width: 700rpx; - width: 100%; + width: calc(100% - 30rpx); box-sizing: border-box; position: relative; } +.quality-level-badge { + position: absolute; + top: 16rpx; + right: 16rpx; + width: 48rpx; + height: 48rpx; + border-radius: 50%; + background: #ffb400; + color: #fff; + font-size: 24rpx; + font-weight: bold; + display: flex; + align-items: center; + justify-content: center; + z-index: 10; + box-shadow: 0 2rpx 8rpx rgba(255, 180, 0, 0.3); +} + .card-problem { background: linear-gradient(180deg, #fff7e6 0%, #fff 40%); } diff --git a/pages/subcomponent/inspection-report.vue b/pages/subcomponent/inspection-report.vue index d73aa40..5162839 100644 --- a/pages/subcomponent/inspection-report.vue +++ b/pages/subcomponent/inspection-report.vue @@ -311,10 +311,8 @@ export default { uni.navigateBack() }, goToInspectionDetail(status, item) { - if (!item) return; - const userId = this.reportData && this.reportData.userId; - const data = { ...item, userId }; - let url = `/pages/subcomponent/inspection-detail?status=${status}&data=${encodeURIComponent(JSON.stringify(data))}` + if (!this.orderId) return; + let url = `/pages/subcomponent/inspection-detail?orderId=${this.orderId}` if (this.isSelf) { console.log(this.isSelf, 'this.isSelf'); diff --git a/pages/subcomponent/order.vue b/pages/subcomponent/order.vue index 2ee9d40..3f8d861 100644 --- a/pages/subcomponent/order.vue +++ b/pages/subcomponent/order.vue @@ -191,6 +191,8 @@ export default { getOrderStatusText(order) { const { status, state } = order if (state == 3) return '已取消' + if (state == 4) return '已驳回' + if (state == 5) return '已退款' if (status == 0) return '【在线预约】' if (status == 1 && state == 0) return '【待取件】快递员正在赶来' if (status == 1 && state == 1) return '【已取件】快递员正在送至质检' @@ -524,4 +526,4 @@ export default { color: #bbb; font-size: 24rpx; } - \ No newline at end of file + \ No newline at end of file diff --git a/pages/wxUserInfo.vue b/pages/wxUserInfo.vue index 683f431..f7cd0f8 100644 --- a/pages/wxUserInfo.vue +++ b/pages/wxUserInfo.vue @@ -1,36 +1,37 @@ - - - {{logoName}} - - - 申请获取你的头像、昵称 + + + + {{logoName}} + + + 申请获取你的头像、昵称 + - - - - 头像 + + + 头像 + + + + + 点击选择头像 + - - - - + + + + 昵称 + + - - - - 昵称 - - - - - + + 确认 @@ -108,50 +109,173 @@ export default { \ No newline at end of file