diff --git a/api/http.js b/api/http.js index d7b9897..3814dd9 100644 --- a/api/http.js +++ b/api/http.js @@ -4,7 +4,7 @@ import config from '../config.js' // 新增,导入全局配置 function http(uri, data, callback, method = 'GET', showLoading, title) { if (showLoading) { uni.showLoading({ - title: title || '加载中...' + title: typeof title === 'string' ? title : '加载中...' }) } @@ -49,7 +49,6 @@ function http(uri, data, callback, method = 'GET', showLoading, title) { }, fail: () => { reject('api fail') - uni.showLoading({}) setTimeout(() => { uni.hideLoading() uni.showToast({ icon: 'none', title: '网络异常' }) diff --git a/api/model/index.js b/api/model/index.js index 402da4a..4de7275 100644 --- a/api/model/index.js +++ b/api/model/index.js @@ -243,6 +243,13 @@ const api = { method: 'POST', auth: true, }, + adminOrderBrowseRecord: { + url: '/recycle-admin/applet/info_team_order/adminOrderBrowseRecord', + method: 'GET', + auth: true, + }, + + } export default api \ No newline at end of file diff --git a/config.js b/config.js index dde5b6a..3d994aa 100644 --- a/config.js +++ b/config.js @@ -1,5 +1,5 @@ // config.js -const type = 'local' +const type = 'dev' const config = { local: { diff --git a/libs/request/index.js b/libs/request/index.js index 1f5f471..41bc472 100644 --- a/libs/request/index.js +++ b/libs/request/index.js @@ -84,7 +84,7 @@ class Request { if(this.config.showLoading && !this.config.timer) { this.config.timer = setTimeout(() => { uni.showLoading({ - title: this.config.loadingText, + title: typeof this.config.loadingText === 'string' ? this.config.loadingText : '加载中...', mask: this.config.loadingMask }) this.config.timer = null; diff --git a/pages.json b/pages.json index b0a608a..6e24394 100644 --- a/pages.json +++ b/pages.json @@ -380,5 +380,15 @@ "custom": { "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" } + }, + "preloadRule": { + "pages/manager/inspect": { + "network": "all", + "packages": ["pages/subcomponent"] + }, + "pages/manager/inspect-result": { + "network": "all", + "packages": ["pages/subcomponent"] + } } } diff --git a/pages/component/my.vue b/pages/component/my.vue index 3eea649..757141d 100644 --- a/pages/component/my.vue +++ b/pages/component/my.vue @@ -55,13 +55,13 @@ - + - + @@ -373,7 +373,7 @@ export default { return item ? item.keyContent : '' }, userTypeText() { - return this.userInfo.isTuiTypeTitle || '用户' + return this.userInfo.isTuiTypeTitle || '推广官' }, userTypeBadgeClass() { // 根据用户类型返回不同的样式类 diff --git a/pages/component/recycle.vue b/pages/component/recycle.vue index 07cd2e1..be80e3f 100644 --- a/pages/component/recycle.vue +++ b/pages/component/recycle.vue @@ -119,12 +119,14 @@ - + + - 其他上衣(需咨询顾问)(暂不回收) - 需连线回收顾问筛选 + + {{ categories[currentCategory]?.otherTitle }} + {{ categories[currentCategory]?.otherSubTitle }} - ¥ — /件 + ¥ — /{{ categories[currentCategory]?.unit || '件' }} @@ -288,12 +290,12 @@ 回收规则 - - + + 请滚动到底部阅读完整内容 - + @@ -581,13 +583,18 @@ export default { }, // 动态生成品牌字母索引,只显示有品牌的字母 brandIndexList() { - const set = new Set() + const letters = new Set() + let hasSharp = false this.brandList.forEach(b => { - if (b.letter && /^[A-Z]$/.test(b.letter)) set.add(b.letter) + if (b.letter && /^[A-Z]$/.test(b.letter)) { + letters.add(b.letter) + } else { + letters.add('#') + hasSharp = true + } }) - const arr = Array.from(set).sort() - // 如果没有A-Z分组,兜底显示#分组 - if (arr.length === 0 && this.brandList.length > 0) return ['#'] + const arr = Array.from(letters).filter(l => l !== '#').sort() + if (hasSharp) arr.push('#') return arr }, }, @@ -990,9 +997,17 @@ export default { }, openRulePopup() { this.showRulePopup = true + // 弹窗显示后主动判断内容是否需要滚动 + this.$nextTick(() => { + const query = uni.createSelectorQuery().in(this) + query.select('.rule-popup-content').boundingClientRect(rect => { + if (rect && rect.height && rect.scrollHeight && rect.scrollHeight <= rect.height + 10) { + this.hasScrolledToBottom = true + } + }).exec() + }) }, closeRulePopup() { - // 如果还没有滚动到底部,显示提示 if (!this.hasScrolledToBottom) { uni.showToast({ title: '请阅读完整回收规则', @@ -1000,19 +1015,15 @@ export default { }) return } - this.showRulePopup = false; this.hasScrolledToBottom = false; // 重置滚动状态 - // 如果是在等待品牌选择的状态下关闭规则弹窗,则接着打开品牌选择 if (this.isWaitingForBrandSelection) { this.isWaitingForBrandSelection = false; // 清除等待状态 const categoryId = this.categories[this.currentCategory]?.id; const item = this.allProducts[categoryId]?.[this.pendingBrandIndex]; - // 记录该商品的规则已被查看 this.viewedRuleItems.add(item.id); - this.getGoodsBrandList(item.id); this.showBrandPopup = true; // 打开品牌索引弹窗 } else if (this.pendingBrandIndex !== null) { @@ -1041,11 +1052,14 @@ export default { // 监听规则内容滚动 onRuleContentScroll(e) { - const { scrollTop, scrollHeight, deltaY } = e.detail - const containerHeight = 500 // 大概的容器高度,单位rpx转换后的px - - // 判断是否滚动到底部(留一些余量) - if (scrollTop + containerHeight >= scrollHeight - 20) { + const { scrollTop, scrollHeight, clientHeight, height } = e.detail + const h = clientHeight || height + // 内容高度不够,无需滚动,直接允许 + if (scrollHeight <= h + 10) { + this.hasScrolledToBottom = true + return + } + if (scrollTop + h >= scrollHeight - 20) { this.hasScrolledToBottom = true } }, @@ -1111,7 +1125,6 @@ export default { if (searchName.trim()) { params.name = searchName.trim() } - this.$api('getGoodsBrandList', params, res => { // console.log(res,'res') if (res && res.success && res.result && res.result.records) { @@ -1126,14 +1139,10 @@ export default { isPin: item.isPin } }) - // 缓存到对应商品的品牌列表中 this.$set(this.brandCache, productId, brandList) - // 同时更新当前显示的brandList(用于弹窗显示) - this.brandList = brandList - - // console.log(this.brandList,'this.brandList') + this.brandList = [...brandList] } }) }, @@ -1259,6 +1268,22 @@ export default { getApp().globalData.shouldClearRecycle = false } }, + onRuleContentReady() { + this.$nextTick(() => { + const query = uni.createSelectorQuery().in(this) + query.select('.rule-popup-content').boundingClientRect(rect => { + query.select('.rule-popup-content').scrollOffset(scroll => { + // 只有内容高度小于等于可视高度时才点亮 + if (scroll.scrollHeight <= rect.height + 1) { + this.hasScrolledToBottom = true + } + }) + }).exec() + }) + }, + onRuleScrollToLower() { + this.hasScrolledToBottom = true + }, }, created() { this.currentCategory = 0 @@ -1583,8 +1608,8 @@ export default { border-bottom: 1rpx solid #f5f5f5; .goods-item-img { - width: 120rpx; - height: 120rpx; + width: 180rpx; + height: 180rpx; border-radius: 24rpx; background: #f8f8f8; margin-right: 28rpx; diff --git a/pages/manager/inspect-result.vue b/pages/manager/inspect-result.vue index 7ffe26b..ec83de7 100644 --- a/pages/manager/inspect-result.vue +++ b/pages/manager/inspect-result.vue @@ -82,8 +82,8 @@ {{ hasSelectedReason(commonItem) ? '已选择' : '请选择理由' }} - - + + @@ -330,7 +330,7 @@ export default { type = 1 // 质量问题 } else if (item.testingStatus === 2) { type = 2 // 不可回收 - } + } this.currentReasonItem = popupItem // 判断类型,动态设置标题 diff --git a/pages/manager/inspect.vue b/pages/manager/inspect.vue index c5a60a9..0af016d 100644 --- a/pages/manager/inspect.vue +++ b/pages/manager/inspect.vue @@ -71,7 +71,7 @@ - {{letter}} + {{letter}} {{brand.name}} @@ -125,7 +125,7 @@ export default { showBrandConfirm: false, searchTimer: null, - brandIndexList: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'], + // brandIndexList 改为 computed } }, computed: { @@ -155,7 +155,27 @@ export default { const result = [...categoriesWithCount, ...extra] console.log('categories计算 - 最终结果:', result.map(c => ({ id: c.id, title: c.title, badge: c.badge }))) return result - } + }, + // brandIndexList 改为 computed + brandIndexList() { + // 动态生成品牌索引,包含所有有品牌的首字母和 # + const letters = new Set() + let hasSharp = false + this.brandList.forEach(b => { + if (b.letter && /^[A-Z]$/.test(b.letter)) { + letters.add(b.letter) + } else { + letters.add('#') + hasSharp = true + } + }) + const arr = Array.from(letters).filter(l => l !== '#').sort() + if (hasSharp) arr.push('#') + console.log('brandIndexList for render:', arr) + // 如果brandList里有letter为#的品牌但arr没有#,强制返回['#'] + if (this.brandList.some(b => b.letter === '#') && !arr.includes('#')) return ['#'] + return arr + }, }, methods: { initInspectResult() { @@ -404,7 +424,7 @@ export default { if (key === 'qualified') { const currentCategoryId = this.categories[this.currentCategory]?.id // 处理不可回收和质量问题 - if (item.id === 'unrecyclable-1' || item.id === 'quality-issue-1') { + if (item.id === 'unrecyclable-1' || item.id === 'unrecyclable') { const newQualified = Math.max(0, (item.qualified || 0) + delta) this.$set(item, 'qualified', newQualified) this.updateInspectResult(item, 'qualified', delta, currentCategoryId) @@ -659,10 +679,10 @@ export default { if (searchName.trim()) { params.name = searchName.trim() } - this.$api('getGoodsBrandList', params, res => { if (res && res.success && res.result && res.result.records) { - this.brandList = res.result.records.map(item => { + // 保证响应式 + const newList = res.result.records.map(item => { // 获取品牌名称的拼音首字母 const firstChar = this.getPinyinFirstLetter(item.name) return { @@ -672,6 +692,14 @@ export default { letter: firstChar } }) + // 打印所有品牌的name和letter + newList.forEach(b => console.log('品牌:', b.name, 'letter:', b.letter)) + this.brandList = [...newList] + // 打印brandList和brandIndexList + this.$nextTick(() => { + console.log('brandList:', this.brandList) + console.log('brandIndexList:', this.brandIndexList) + }) } }) }, @@ -680,12 +708,10 @@ export default { getPinyinFirstLetter(str) { if (!str) return '#' const firstChar = str.charAt(0) - - let index = this.brandIndexList.indexOf(firstChar.toUpperCase()) - if (index != -1) { - return this.brandIndexList[index] + // 只认A-Z,否则归为# + if (/^[A-Za-z]$/.test(firstChar)) { + return firstChar.toUpperCase() } - return '#' }, diff --git a/pages/manager/order.vue b/pages/manager/order.vue index b07fe82..4b221b1 100644 --- a/pages/manager/order.vue +++ b/pages/manager/order.vue @@ -160,11 +160,13 @@ export default { navBarHeight: 44, navBarRealHeight: 44, tabs: [ - { 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 } + { label: '全部', value: '' , count: 0 }, + { label: '待审核', value: 0, count: 0 }, + { label: '已预约', value: 1, count: 0 }, + { label: '待质检', value: 2, count: 0 }, + { label: '已结款', value: 3, count: 0 }, + { label: '已驳回', value: 4, count: 0 }, + { label: '已取消', value: 5, count: 0 }, ], currentTab: 0, orderList: [], @@ -199,6 +201,9 @@ export default { this.fetchOrderList() this.fetchOrderStatusStatistics() }, + onShow() { + this.fetchOrderStatusStatistics() + }, computed: { filteredOrders() { if (this.searchText) { @@ -240,6 +245,11 @@ export default { this.searchMode = false; }, goToOrderDetail(order) { + // 新增:记录浏览记录 + this.$api && this.$api('adminOrderBrowseRecord', { orderIds: order.id }, res => { + // 可选:处理返回结果或错误,但不影响后续跳转 + + }) uni.navigateTo({ url: '/pages/manager/order-detail?id=' + order.id }) @@ -263,24 +273,7 @@ export default { // 根据当前Tab获取对应的status参数 const tabValue = this.tabs[this.currentTab].value - let statusParam = 0 // 默认值 - - if (tabValue === -1) { - // 全部:status = 0 - statusParam = 0 - } else if (tabValue === 0) { - // 已预约:status = 1 - statusParam = 1 - } else if (tabValue === 1) { - // 待质检:status = 2 - statusParam = 2 - } else if (tabValue === 2) { - // 已结款:status = 3 - statusParam = 3 - } else if (tabValue === 3) { - // 已驳回:status = 4 - statusParam = 4 - } + let statusParam = tabValue // 直接用tabValue作为status参数 const params = { pageNo: isLoadMore ? this.pageNo + 1 : 1, @@ -345,14 +338,18 @@ export default { // if (state === 3) { // return { label: '已取消', class: 'gray' } // } - if ((status === 1||status === 0) && state != 3 && state != 4) { + if ((status === 1&&state === 0) && state != 3 && state != 4) { return { label: '已预约', class: 'green' } - } else if (state === 1) { + } else if (state === 1 && status === 2) { return { label: '待质检', class: 'orange' } - } else if (status === 3) { + } else if (status === 3&& state === 2) { return { label: '已结款', class: 'blue' } } else if (state === 4) { return { label: '已驳回', class: 'red' } + }else if (state === 3) { + return { label: '已取消', class: 'Turquoise2' } + }else if (state === 0 && status === 0) { + return { label: '待审核', class: 'blue' } } return { label: '未知状态', class: 'gray' } }, @@ -415,11 +412,13 @@ export default { 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); + this.tabs[1].count = stat.pendingAudit || 0; // 待审核 + this.tabs[2].count = stat.appointed || 0; // 已预约 + this.tabs[3].count = stat.waitingInspection || 0; // 待质检 + this.tabs[4].count = stat.completed || 0; // 已结款 + this.tabs[5].count = stat.rejected || 0; // 已驳回 + this.tabs[6].count = stat.cancelled || 0; // 已取消 + this.tabs[0].count = (stat.pendingAudit || 0) + (stat.appointed || 0) + (stat.waitingInspection || 0) + (stat.completed || 0) + (stat.rejected || 0) + (stat.cancelled || 0); } }); }, @@ -604,6 +603,7 @@ export default { &.orange { background: #fff7e6; color: #ffb400; } &.blue { background: #e6f0ff; color: #409eff; } &.gray { background: #f5f5f5; color: #999; } + &.Turquoise2 { background: #e0f7fa; color: #009fa8; } /* 新增已取消 */ } } .order-info-wrapper { @@ -620,6 +620,7 @@ export default { &.orange { background: #fff7e6; color: #ffb400; } &.blue { background: #e6f0ff; color: #409eff; } &.gray { background: #f5f5f5; color: #999; } + &.Turquoise2 { background: #e0f7fa; color: #009fa8; } /* 新增已取消 */ } } .order-info { diff --git a/pages/subcomponent/promotion.vue b/pages/subcomponent/promotion.vue index 479835d..301fe62 100644 --- a/pages/subcomponent/promotion.vue +++ b/pages/subcomponent/promotion.vue @@ -93,9 +93,10 @@ - - - + + + + @@ -200,7 +201,7 @@ export default { return item ? item.keyContent : '' }, userTypeText() { - return this.userInfo.isTuiTypeTitle || '用户' + return this.userInfo.isTuiTypeTitle || '推广官' }, userTypeBadgeClass() { switch (this.userInfo.isTuiTypeTitle) { diff --git a/uni_modules/uni-data-checkbox/components/uni-data-checkbox/clientdb.js b/uni_modules/uni-data-checkbox/components/uni-data-checkbox/clientdb.js index 9a44a9e..459c2b9 100644 --- a/uni_modules/uni-data-checkbox/components/uni-data-checkbox/clientdb.js +++ b/uni_modules/uni-data-checkbox/components/uni-data-checkbox/clientdb.js @@ -268,6 +268,7 @@ export default { } uni.showLoading({ + title: '加载中...', mask: true }) diff --git a/uni_modules/vk-uview-ui/libs/request/index.js b/uni_modules/vk-uview-ui/libs/request/index.js index 1f5f471..41bc472 100644 --- a/uni_modules/vk-uview-ui/libs/request/index.js +++ b/uni_modules/vk-uview-ui/libs/request/index.js @@ -84,7 +84,7 @@ class Request { if(this.config.showLoading && !this.config.timer) { this.config.timer = setTimeout(() => { uni.showLoading({ - title: this.config.loadingText, + title: typeof this.config.loadingText === 'string' ? this.config.loadingText : '加载中...', mask: this.config.loadingMask }) this.config.timer = null;