diff --git a/111.json b/111.json new file mode 100644 index 0000000..7ae2213 --- /dev/null +++ b/111.json @@ -0,0 +1,357 @@ +{ + "success": true, + "message": "订单列表", + "code": 200, + "result": { + "records": [ + { + "id": "1938571653868953601", + "createBy": null, + "createTime": "2025-06-27 20:14:35", + "updateBy": null, + "updateTime": "2025-06-30 16:09:45", + "state": 0, + "status": 1, + "userId": "1937353794657214465", + "image": null, + "shopClass": null, + "title": ",", + "name": "1", + "phone": "19330214982", + "price": null, + "address": "北京市 市辖区 东城区", + "addressDetail": "123", + "oneMoney": null, + "twoMoney": null, + "pid": "0", + "hasChild": "1", + "goTime": "2025-06-27 11:00:00", + "wliu": null, + "onePrice": null, + "unit": null, + "num": 4, + "details": null, + "ordeNo": null, + "wliuNo": null, + "shopId": null, + "addressId": "1937379022158454786", + "testingStatus": null, + "testingInstructions": null, + "testingTime": null, + "testingImages": null, + "isBy": "N", + "isUserId": null, + "pinId": null, + "qualifiedNum": null, + "noQualifiedNum": null, + "unrecyclable": null, + "estimatedPrice": "34.00-70", + "type": 0, + "commonOrderList": [ + { + "id": "1938571654040920065", + "createBy": null, + "createTime": "2025-06-27 20:14:34", + "updateBy": null, + "updateTime": null, + "state": null, + "status": null, + "userId": null, + "image": "https://oss.ddmhs.top/upload/微信图片_20250327142201_compressed_1750725386304.jpg", + "shopClass": "1926937920342679554", + "title": "成人羽绒服", + "name": null, + "phone": null, + "price": null, + "address": null, + "addressDetail": null, + "oneMoney": null, + "twoMoney": null, + "pid": "1938571653868953601", + "hasChild": "1", + "goTime": null, + "wliu": null, + "onePrice": 10, + "unit": null, + "num": 2, + "details": "品相无要求,允许脏破烂", + "ordeNo": null, + "wliuNo": null, + "shopId": "1934553607584104450", + "addressId": null, + "testingStatus": null, + "testingInstructions": null, + "testingTime": null, + "testingImages": null, + "isBy": "N", + "isUserId": null, + "pinId": "1934782097801625602", + "qualifiedNum": null, + "noQualifiedNum": null, + "unrecyclable": null, + "estimatedPrice": "20.00-40", + "type": 0, + "commonOrderList": null, + "orderCheckList": null, + "pinName": null, + "testingInstructionsText": null + }, + { + "id": "1938571655089496065", + "createBy": null, + "createTime": "2025-06-27 20:14:34", + "updateBy": null, + "updateTime": null, + "state": null, + "status": null, + "userId": null, + "image": "https://oss.ddmhs.top/upload/微信图片_20250327142201_compressed_1750725386304.jpg", + "shopClass": "1926937920342679554", + "title": "成人羽绒服", + "name": null, + "phone": null, + "price": null, + "address": null, + "addressDetail": null, + "oneMoney": null, + "twoMoney": null, + "pid": "1938571653868953601", + "hasChild": "1", + "goTime": null, + "wliu": null, + "onePrice": 10, + "unit": null, + "num": 1, + "details": "品相无要求,允许脏破烂", + "ordeNo": null, + "wliuNo": null, + "shopId": "1934553607584104450", + "addressId": null, + "testingStatus": null, + "testingInstructions": null, + "testingTime": null, + "testingImages": null, + "isBy": "N", + "isUserId": null, + "pinId": "1934787027673300993", + "qualifiedNum": null, + "noQualifiedNum": null, + "unrecyclable": null, + "estimatedPrice": "10.00-20", + "type": 0, + "commonOrderList": null, + "orderCheckList": null, + "pinName": null, + "testingInstructionsText": null + }, + { + "id": "1938571655802527746", + "createBy": null, + "createTime": "2025-06-27 20:14:34", + "updateBy": null, + "updateTime": null, + "state": null, + "status": null, + "userId": null, + "image": "https://oss.ddmhs.top/upload/9559824354_2091552637_compressed_1750069406515.jpg", + "shopClass": "1926937920342679554", + "title": "成人羽绒裤", + "name": null, + "phone": null, + "price": null, + "address": null, + "addressDetail": null, + "oneMoney": null, + "twoMoney": null, + "pid": "1938571653868953601", + "hasChild": "1", + "goTime": null, + "wliu": null, + "onePrice": 4, + "unit": null, + "num": 1, + "details": "品相无要求,允许脏破烂", + "ordeNo": null, + "wliuNo": null, + "shopId": "1934554028000165889", + "addressId": null, + "testingStatus": null, + "testingInstructions": null, + "testingTime": null, + "testingImages": null, + "isBy": "N", + "isUserId": null, + "pinId": "1934782097801625602", + "qualifiedNum": null, + "noQualifiedNum": null, + "unrecyclable": null, + "estimatedPrice": "4.00-10", + "type": 0, + "commonOrderList": null, + "orderCheckList": null, + "pinName": null, + "testingInstructionsText": null + } + ], + "orderCheckList": null, + "pinName": null, + "testingInstructionsText": null + }, + { + "id": "1931291436998561793", + "createBy": null, + "createTime": "2025-06-07 18:05:35", + "updateBy": "testadmin", + "updateTime": "2025-06-11 17:09:07", + "state": 0, + "status": 1, + "userId": "1926466450139209729", + "image": "", + "shopClass": null, + "title": "组合订单", + "name": "test", + "phone": "13973220018", + "price": 0.04, + "address": "上海市 市辖区 浦东新区", + "addressDetail": "浦东足球场", + "oneMoney": 0, + "twoMoney": 0, + "pid": "0", + "hasChild": "1", + "goTime": "", + "wliu": "", + "onePrice": null, + "unit": "", + "num": 4, + "details": "", + "ordeNo": "", + "wliuNo": "", + "shopId": "", + "addressId": "", + "testingStatus": null, + "testingInstructions": "", + "testingTime": null, + "testingImages": "", + "isBy": "N", + "isUserId": "", + "pinId": null, + "qualifiedNum": null, + "noQualifiedNum": null, + "unrecyclable": null, + "estimatedPrice": null, + "type": 0, + "commonOrderList": [ + { + "id": "1931291437237637121", + "createBy": null, + "createTime": "2025-06-07 18:05:35", + "updateBy": null, + "updateTime": null, + "state": null, + "status": null, + "userId": null, + "image": "https://oss.budingxiaoshuo.com/upload/1748937726110_1748937743252.jpg", + "shopClass": null, + "title": "长款羽绒服", + "name": null, + "phone": null, + "price": 0.02, + "address": null, + "addressDetail": null, + "oneMoney": null, + "twoMoney": null, + "pid": "1931291436998561793", + "hasChild": "0", + "goTime": null, + "wliu": null, + "onePrice": null, + "unit": null, + "num": 2, + "details": null, + "ordeNo": null, + "wliuNo": null, + "shopId": "1929811145330352130", + "addressId": null, + "testingStatus": null, + "testingInstructions": null, + "testingTime": null, + "testingImages": null, + "isBy": "N", + "isUserId": null, + "pinId": null, + "qualifiedNum": null, + "noQualifiedNum": null, + "unrecyclable": null, + "estimatedPrice": null, + "type": 0, + "commonOrderList": null, + "orderCheckList": null, + "pinName": null, + "testingInstructionsText": null + }, + { + "id": "1931291437770313729", + "createBy": null, + "createTime": "2025-06-07 18:05:35", + "updateBy": null, + "updateTime": null, + "state": null, + "status": null, + "userId": null, + "image": "https://oss.budingxiaoshuo.com/upload/u40321610211486391468fm253fmtautoapp120fJPEG_1748938036727.webp", + "shopClass": null, + "title": "羽绒棉服", + "name": null, + "phone": null, + "price": 0.02, + "address": null, + "addressDetail": null, + "oneMoney": null, + "twoMoney": null, + "pid": "1931291436998561793", + "hasChild": "0", + "goTime": null, + "wliu": null, + "onePrice": null, + "unit": null, + "num": 2, + "details": null, + "ordeNo": null, + "wliuNo": null, + "shopId": "1929812185941368834", + "addressId": null, + "testingStatus": null, + "testingInstructions": null, + "testingTime": null, + "testingImages": null, + "isBy": "N", + "isUserId": null, + "pinId": null, + "qualifiedNum": null, + "noQualifiedNum": null, + "unrecyclable": null, + "estimatedPrice": null, + "type": 0, + "commonOrderList": null, + "orderCheckList": null, + "pinName": null, + "testingInstructionsText": null + } + ], + "orderCheckList": null, + "pinName": null, + "testingInstructionsText": null + } + ], + "total": 2, + "size": 20, + "current": 1, + "orders": [], + "optimizeCountSql": true, + "searchCount": true, + "countId": null, + "maxLimit": null, + "pages": 1 + }, + "timestamp": 1751460139197 + } \ No newline at end of file diff --git a/api/model/index.js b/api/model/index.js index 38e8701..2a8cd9e 100644 --- a/api/model/index.js +++ b/api/model/index.js @@ -232,6 +232,12 @@ const api = { method: 'GET', auth: true, }, + + orderStatusStatistics: { + url: '/recycle-admin/applet/info_team_order/orderStatusStatistics', + method: 'POST', + auth: true, + }, } export default api \ No newline at end of file diff --git a/config.js b/config.js index 2658c24..b78c2f0 100644 --- a/config.js +++ b/config.js @@ -1,5 +1,5 @@ // config.js -const type = 'dev' +const type = 'prod' const config = { local: { diff --git a/main.js b/main.js index 3a6098a..d039039 100644 --- a/main.js +++ b/main.js @@ -24,6 +24,32 @@ export function createApp() { setupGlobalProperties(app); app.config.globalProperties.$api = api; app.use(uView); + + // 全局混入分享 + app.mixin({ + onShareAppMessage() { + const userInfo = uni.getStorageSync('userInfo') || {}; + console.log('分享到朋友圈的 shareId:', userInfo); // 打印 shareId + const logoName = uni.getStorageSync('logoName') || '' + console.log('logoName',logoName) + const logoImage = uni.getStorageSync('logoImage') || '' + return { + title: '欢迎体验'+(logoName), + path: '/pages/index/index?shareId=' + (userInfo.shareId || ''), + imageUrl: logoImage + } + }, + onShareTimeline() { + const userInfo = uni.getStorageSync('userInfo') || {}; + console.log('分享到朋友圈的 shareId:', userInfo.shareId); // 打印 shareId + return { + title: '欢迎体验'+(logoName), + query: 'shareId=' + (userInfo.shareId || ''), + imageUrl: logoImage + } + } + }); + return { app } diff --git a/pages/index/index.vue b/pages/index/index.vue index cdcd2e0..1c2cf8b 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -67,10 +67,12 @@ computed: { logoImage() { const item = this.configData.find(i => i.keyName === 'logo_image') + uni.setStorageSync('logoImage', item ? item.keyContent : '') return item ? item.keyContent : '' }, logoName() { const item = this.configData.find(i => i.keyName === 'logo_name') + uni.setStorageSync('logoName', item ? item.keyContent : '') return item ? item.keyContent : '' } }, @@ -186,12 +188,12 @@ getApp().globalData.login_status = true; if (res.result.userInfo) { const userInfo = res.result.userInfo; - console.log(userInfo, 'userInfo') if (!userInfo.headImage || !userInfo.nickName) { uni.navigateTo({ url: '/pages/wxUserInfo' }); } else { + uni.setStorageSync('userInfo', userInfo) uni.reLaunch({ url: '/pages/component/home' }); diff --git a/pages/manager/inspect-result.vue b/pages/manager/inspect-result.vue index 8aceaf7..b80e2dc 100644 --- a/pages/manager/inspect-result.vue +++ b/pages/manager/inspect-result.vue @@ -49,9 +49,9 @@ - - 质量问题 + 质量问题{{ index + 1 }} {{ hasSelectedReason(item) ? '已选择' : '请选择理由' }} @@ -65,7 +65,7 @@ 不可回收产品 - + 不可回收 @@ -74,13 +74,17 @@ x{{ item.count }} ¥{{ item.total }} - - 不可回收 - - - {{ hasSelectedReason(item) ? '已选择' : '请选择理由' }} - - + + + + 不可回收{{ index +1 }} + + + {{ hasSelectedReason(commonItem) ? '已选择' : '请选择理由' }} + + + @@ -297,15 +301,16 @@ export default { return } } - // 推荐方案一 - // console.log('this.inspectData["list"]', this.inspectData["list"]) - // 推荐方案一 - // this.inspectData["list"].forEach(item => { - // console.log('item1', item) - // // delete item['categoryId'] - // }) - // 其余逻辑不变 - const inspectDatas = {...this.inspectData,list:JSON.stringify(this.inspectData["list"], null, 2)} + // 在提交前将质量问题和不可回收中的id值置为空 + const processedList = this.inspectData["list"].map(item => { + if (item.id === 'quality_issue' || item.id === 'unrecyclable') { + // 对于质量问题和不可回收,将id置为空 + return { ...item, id: '' } + } + return item + }) + + const inspectDatas = {...this.inspectData, list: JSON.stringify(processedList, null, 2)} console.log('最终的质检数据:', inspectDatas); this.$api('submitQualityInfo', inspectDatas , res => { if (res && res.code === 200) { @@ -316,19 +321,17 @@ export default { uni.showToast({ title: '完成质检', icon: 'success' }) }, selectReason(item) { - // 始终用inspectData.list中的最新对象 + // 直接使用传入的item,因为它已经是commonOrderList中的具体项 let popupItem = item + let type = 0 // 默认类型 + + // 根据testingStatus确定类型 if (item.testingStatus === 1) { - const qualityItem = this.inspectData["list"].find(i => i.id === 'quality_issue') - if (qualityItem && qualityItem.commonOrderList) { - popupItem = qualityItem.commonOrderList.find(i => i.id === item.id) || item - } + type = 1 // 质量问题 } else if (item.testingStatus === 2) { - const unrecyclableItem = this.inspectData["list"].find(i => i.id === 'unrecyclable') - if (unrecyclableItem && unrecyclableItem.commonOrderList) { - popupItem = unrecyclableItem.commonOrderList.find(i => i.id === item.id) || item - } + type = 2 // 不可回收 } + this.currentReasonItem = popupItem // 判断类型,动态设置标题 if (popupItem.testingStatus === 1) { @@ -338,38 +341,55 @@ export default { } else { this.currentReasonTitle = this.getGoodsName(popupItem.shopId || popupItem.id) } - this.reasonImages = popupItem.images || [] + // 只使用testingImages字段 + if (popupItem.testingImages && popupItem.testingImages.trim() !== '') { + this.reasonImages = popupItem.testingImages.split(',').filter(img => img.trim() !== '') + } else { + this.reasonImages = [] + } // 不在这里设置reasonChecked - this.selectReasonForUnqualified(popupItem, 0) + this.selectReasonForUnqualified(popupItem, type) this.lockScroll() this.$refs.reasonPopup.open() }, selectReasonForQualified(item) { this.currentReasonItem = item this.currentReasonTitle = this.getGoodsName(item.shopId || item.id) - this.reasonImages = item.images || [] + // 只使用testingImages字段 + if (item.testingImages && item.testingImages.trim() !== '') { + this.reasonImages = item.testingImages.split(',').filter(img => img.trim() !== '') + } else { + this.reasonImages = [] + } // 不在这里设置reasonChecked this.selectReasonForUnqualified(item, 1) this.lockScroll() this.$refs.reasonPopup.open() }, - selectReasonForUnrecyclable(item) { - this.currentReasonItem = item - this.currentReasonTitle = '不可回收' - this.reasonImages = item.images || [] - // 不在这里设置reasonChecked - this.selectReasonForUnqualified(item, 2) - this.lockScroll() - this.$refs.reasonPopup.open() - }, + selectReasonForUnqualified(item, type) { + // 根据类型确定classId + let classId = '' + if (type === 1) { + // 质量问题 + classId = 'quality_issue' + } else if (type === 2) { + // 不可回收 + classId = 'unrecyclable' + } else { + // 普通商品,使用shopClass + classId = item.shopClass || '' + } + + console.log('[selectReasonForUnqualified] classId:', classId, 'type:', type) + this.$api('getcheckoutReasons', { - classId: item.shopClass, + classId: classId, type: type }, res => { if (res.code == 200) { this.reasonOptions = res.result; - if (item.testingInstructions) { + if (item.testingInstructions && item.testingInstructions.trim() !== '') { this.reasonChecked = item.testingInstructions.split(',').map(s => s.trim()).filter(Boolean) } else { this.reasonChecked = [] @@ -379,7 +399,19 @@ export default { console.log('[selectReasonForUnqualified] reasonOptions:', this.reasonOptions) console.log('[selectReasonForUnqualified] reasonChecked:', this.reasonChecked) }) + } else { + console.error('[selectReasonForUnqualified] API返回错误:', res) + uni.showToast({ + title: '获取理由列表失败', + icon: 'none' + }) } + }, err => { + console.error('[selectReasonForUnqualified] API调用失败:', err) + uni.showToast({ + title: '获取理由列表失败', + icon: 'none' + }) }) }, closeReasonPopup() { @@ -469,88 +501,14 @@ export default { saveReason() { if (this.currentReasonItem) { console.log('this.currentReasonItem', this.currentReasonItem) - this.currentReasonItem.images = [...this.reasonImages] + // 直接更新当前项 this.currentReasonItem.testingInstructions = this.reasonChecked.join(',') - this.updateInspectData() + this.currentReasonItem.testingImages = this.reasonImages.join(',') } this.closeReasonPopup() }, - updateInspectData() { - if (!this.inspectData || !this.currentReasonItem) return - // 获取选中的理由ID(假设理由选项的索引就是ID) - const selectedReasonIds = [] - this.reasonChecked.forEach((checked, index) => { - if (checked) { - selectedReasonIds.push(this.reasonOptions[index].reason.toString()) - } - }) - // 将理由ID用逗号分割保存 - const testingInstructions = selectedReasonIds.join(',') - // 将图片URL用逗号分割保存 - const testingImages = this.reasonImages.join(',') - // 根据当前选择的商品类型,找到对应的inspectData项进行更新 - if (this.isQualifiedItem(this.currentReasonItem)) { - this.updateQualifiedItemInspectData(testingInstructions, testingImages) - } else if (this.isUnqualifiedItem(this.currentReasonItem)) { - this.updateUnqualifiedItemInspectData(testingInstructions, testingImages) - } else if (this.isUnrecyclableItem(this.currentReasonItem)) { - this.updateUnrecyclableItemInspectData(testingInstructions, testingImages) - } - console.log('[updateInspectData] after update', JSON.stringify(this.inspectData, null, 2)) - }, - isQualifiedItem(item) { - return this.qualifiedList.some(qualified => qualified.shopId === item.shopId) - }, - isUnqualifiedItem(item) { - return this.unqualifiedGroups.some(group => - group.items.some(unqualified => unqualified.id === item.id) - ) - }, - isUnrecyclableItem(item) { - return this.unrecyclableList.some(unrecyclable => unrecyclable.id === item.id) - }, - updateQualifiedItemInspectData(testingInstructions, testingImages) { - const inspectItem = this.inspectData["list"].find(item => item.id == this.currentReasonItem.id) - if (inspectItem && inspectItem.commonOrderList) { - // 为合格的商品更新所有状态为0的项 - inspectItem.commonOrderList.forEach(commonItem => { - if (commonItem.testingStatus === 0) { - commonItem.testingInstructions = testingInstructions - commonItem.testingImages = testingImages - } - }) - } - }, - updateUnqualifiedItemInspectData(testingInstructions, testingImages) { - // 对于不合格商品,需要根据具体的commonOrderList项ID来更新 - this.unqualifiedGroups.forEach(group => { - const targetItem = group.items.find(item => item.id === this.currentReasonItem.id) - if (targetItem) { - // 找到对应的inspectData项 - const inspectItem = this.inspectData["list"].find(item => item.id == group.id) - if (inspectItem && inspectItem.commonOrderList) { - // 根据不合格项的ID找到对应的commonOrderList项 - const commonItem = inspectItem.commonOrderList.find(common => common.id === targetItem.id) - if (commonItem) { - commonItem.testingInstructions = testingInstructions - commonItem.testingImages = testingImages - } - } - } - }) - }, - updateUnrecyclableItemInspectData(testingInstructions, testingImages) { - const inspectItem = this.inspectData["list"].find(item => item.id == this.currentReasonItem.id) - if (inspectItem && inspectItem.commonOrderList) { - // 为不可回收的商品更新所有状态为2的项 - inspectItem.commonOrderList.forEach(commonItem => { - if (commonItem.testingStatus === 2) { - commonItem.testingInstructions = testingInstructions - commonItem.testingImages = testingImages - } - }) - } - }, + + lockScroll() { // 禁用页面滚动 this.isPopupOpen = true @@ -579,7 +537,8 @@ export default { hasSelectedReason(item) { // console.log('item', item) // 检查该商品是否已选择理由或上传图片 - return (item.images && item.images.length > 0) + return (item.testingInstructions && item.testingInstructions.trim() !== '') || + (item.testingImages && item.testingImages.trim() !== '') } } } diff --git a/pages/manager/inspect.vue b/pages/manager/inspect.vue index fc9f034..c44d5db 100644 --- a/pages/manager/inspect.vue +++ b/pages/manager/inspect.vue @@ -403,16 +403,15 @@ export default { changeNum(item, key, delta) { if (key === 'qualified') { const currentCategoryId = this.categories[this.currentCategory]?.id - // 如果是增加数量 - if (delta > 0) { - if (item.id === 'unrecyclable-1' || item.id === 'quality-issue-1') { - const newQualified = Math.max(0, (item.qualified || 0) + delta) - this.$set(item, 'qualified', newQualified) - this.updateInspectResult(item, 'qualified', delta, currentCategoryId) - this.$forceUpdate() - return - } + // 处理不可回收和质量问题 + if (item.id === 'unrecyclable-1' || item.id === 'quality-issue-1') { + const newQualified = Math.max(0, (item.qualified || 0) + delta) + this.$set(item, 'qualified', newQualified) + this.updateInspectResult(item, 'qualified', delta, currentCategoryId) + this.$forceUpdate() + return } + // 处理普通商品 const newQualified = Math.max(0, (item.qualified || 0) + delta) this.$set(item, 'qualified', newQualified) this.updateInspectResult(item, 'qualified', delta, currentCategoryId) @@ -462,25 +461,29 @@ export default { price: 0, qualifiedNum: 0, noQualifiedNum: 0, - unrecyclable: 0, + unrecyclable: 0, // 初始值为0 shopId: '', pinId: '', categoryId: '', - commonOrderList: [ - { - testingInstructions: '', - testingImages: '', - testingStatus: 2 - } - ] + commonOrderList: [] // 初始为空数组 } this.inspectResult.list.push(inspectItem) } if (!inspectItem) return if (type === 'qualified' && delta > 0) { inspectItem.unrecyclable++ + // 增加一个commonOrderList对象 + inspectItem.commonOrderList.push({ + testingInstructions: '', + testingImages: '', + testingStatus: 2 + }) } else if (type === 'qualified' && delta < 0) { inspectItem.unrecyclable = Math.max(0, inspectItem.unrecyclable - 1) + // 减少一个commonOrderList对象 + if (inspectItem.commonOrderList.length > 0) { + inspectItem.commonOrderList.pop() + } // 新增:如果减到0,移除该对象 if (inspectItem.unrecyclable === 0) { const idx = this.inspectResult.list.findIndex(listItem => listItem === inspectItem) @@ -500,26 +503,30 @@ export default { id: 'quality_issue', price: 0, qualifiedNum: 0, - noQualifiedNum: 0, + noQualifiedNum: 0, // 初始值为0 unrecyclable: 0, shopId: '', pinId: '', categoryId: '', - commonOrderList: [ - { - testingInstructions: '', - testingImages: '', - testingStatus: 1 - } - ] + commonOrderList: [] // 初始为空数组 } this.inspectResult.list.push(inspectItem) } if (!inspectItem) return if (type === 'qualified' && delta > 0) { inspectItem.noQualifiedNum++ + // 增加一个commonOrderList对象 + inspectItem.commonOrderList.push({ + testingInstructions: '', + testingImages: '', + testingStatus: 1 + }) } else if (type === 'qualified' && delta < 0) { inspectItem.noQualifiedNum = Math.max(0, inspectItem.noQualifiedNum - 1) + // 减少一个commonOrderList对象 + if (inspectItem.commonOrderList.length > 0) { + inspectItem.commonOrderList.pop() + } // 新增:如果减到0,移除该对象 if (inspectItem.noQualifiedNum === 0) { const idx = this.inspectResult.list.findIndex(listItem => listItem === inspectItem) diff --git a/pages/manager/order.vue b/pages/manager/order.vue index acb0859..b07fe82 100644 --- a/pages/manager/order.vue +++ b/pages/manager/order.vue @@ -36,7 +36,10 @@ :class="['tab-item', {active: currentTab === idx}]" @tap="onTabChange(idx)" > - {{ tab.label }} + + {{ tab.label }} + {{ tab.count }} + @@ -157,11 +160,11 @@ export default { navBarHeight: 44, navBarRealHeight: 44, tabs: [ - { label: '全部', value: -1 }, - { label: '已预约', value: 0 }, - { label: '待质检', value: 1 }, - { label: '已结款', value: 2 }, - { label: '已驳回', value: 3 } + { label: '全部', value: -1, count: 0 }, + { label: '已预约', value: 0, count: 0 }, + { label: '待质检', value: 1, count: 0 }, + { label: '已结款', value: 2, count: 0 }, + { label: '已驳回', value: 3, count: 0 } ], currentTab: 0, orderList: [], @@ -194,6 +197,7 @@ export default { this.userId = options.userId; } this.fetchOrderList() + this.fetchOrderStatusStatistics() }, computed: { filteredOrders() { @@ -265,16 +269,16 @@ export default { // 全部:status = 0 statusParam = 0 } else if (tabValue === 0) { - // 已预约:status = 0 + // 已预约:status = 1 statusParam = 1 } else if (tabValue === 1) { - // 待质检:status = 1 + // 待质检:status = 2 statusParam = 2 } else if (tabValue === 2) { - // 已结款:status = 2 + // 已结款:status = 3 statusParam = 3 } else if (tabValue === 3) { - // 已驳回:status = 3 + // 已驳回:status = 4 statusParam = 4 } @@ -290,16 +294,7 @@ export default { this.$api && this.$api('getOrderList', params, res => { if (res && res.code === 200 && res.result && res.result.records) { console.log(res.result,'res.result.records') - // 过滤掉 state为3 或者 status=3但是state为1 的订单 - const filteredRecords = res.result.records.filter(order => { - // 过滤掉 state为3 的订单 - if (order.state === 3) return false - // 过滤掉 status=3但是state为1 的订单 - // if (order.status === 3 && order.state === 1) return false - return true - }) - - const newOrders = filteredRecords.map(order => { + const newOrders = res.result.records.map(order => { const statusInfo = this.getOrderStatusInfo(order.status, order.state) return { id: order.id, @@ -415,6 +410,19 @@ export default { } }) }, + fetchOrderStatusStatistics() { + const token = uni.getStorageSync('token') || ''; + this.$api && this.$api('orderStatusStatistics', { token }, res => { + if (res.code === 200 && res.result) { + const stat = res.result; + this.tabs[1].count = stat.appointed || 0; + this.tabs[2].count = stat.waitingInspection || 0; + this.tabs[3].count = stat.completed || 0; + this.tabs[4].count = stat.rejected || 0; + this.tabs[0].count = (stat.appointed || 0) + (stat.waitingInspection || 0) + (stat.completed || 0) + (stat.rejected || 0); + } + }); + }, }, onPullDownRefresh() { this.pageNo = 1; @@ -714,4 +722,29 @@ export default { font-size: 30rpx; color: #ccc; } - \ No newline at end of file + +.tab-label-wrap { + position: relative; + display: inline-block; +} +.tab-badge { + position: absolute; + top: 5px; + right: -14px; + display: flex; + align-items: center; + justify-content: center; + background: #ff4d4f; + color: #fff; + font-size: 12px; + border-radius: 50%; + min-width: 18px; + height: 18px; + padding: 0 5px; + font-weight: bold; + box-sizing: border-box; + z-index: 1; +} + + + diff --git a/pages/manager/user.vue b/pages/manager/user.vue index 4770bf8..8ecdf7e 100644 --- a/pages/manager/user.vue +++ b/pages/manager/user.vue @@ -41,7 +41,7 @@