diff --git a/pages/baoyou-city/baoyou-city.vue b/pages/baoyou-city/baoyou-city.vue index a8976fb..819c631 100644 --- a/pages/baoyou-city/baoyou-city.vue +++ b/pages/baoyou-city/baoyou-city.vue @@ -12,7 +12,7 @@ - + @@ -76,6 +76,10 @@ const item = getApp().globalData.configData.find(i => i.keyName === 'city_desc') return item ? item.keyContent : '' }, + myCityImage() { + const item = getApp().globalData.configData.find(i => i.keyName === 'city_banner') + return item ? item.keyContent : '' + }, }, methods: { goBack() { diff --git a/pages/index/index.vue b/pages/index/index.vue index 72a2ebc..6b75338 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -115,7 +115,10 @@ // }, 1500); }, handleCancel() { - uni.navigateBack(); + // 关闭当前页面回到首页 + uni.reLaunch({ + url: '/pages/component/home' + }); }, handleAgreementChange(e) { diff --git a/pages/manager/inspect-result.vue b/pages/manager/inspect-result.vue index a7e9aa6..ae04dc2 100644 --- a/pages/manager/inspect-result.vue +++ b/pages/manager/inspect-result.vue @@ -335,7 +335,10 @@ export default { this.$api('submitQualityInfo', this.inspectData , res => { if (res && res.code === 200) { uni.showToast({ title: '质检完成', icon: 'success' }) - uni.navigateBack() + // 关闭其余页面回到首页 + uni.reLaunch({ + url: '/pages/component/home' + }) } }) diff --git a/pages/manager/order-detail.vue b/pages/manager/order-detail.vue index 1dc9a55..26f37b4 100644 --- a/pages/manager/order-detail.vue +++ b/pages/manager/order-detail.vue @@ -320,6 +320,12 @@ export default { } }) }, + goToInspection() { + if (!this.order.id) return; + uni.navigateTo({ + url: `/pages/subcomponent/inspection-report?orderId=${this.order.orderId}` + }) + }, } } diff --git a/pages/manager/order.vue b/pages/manager/order.vue index 1bbd033..05d2d4e 100644 --- a/pages/manager/order.vue +++ b/pages/manager/order.vue @@ -119,6 +119,28 @@ + + + + + 加载中... + + + + + + 加载更多... + + + + + 已加载全部订单 + + + + + 暂无订单数据 + @@ -147,10 +169,12 @@ export default { searchText: '', historyOrderMode: false, pageNo: 1, - pageSize: 3, + pageSize: 10, hasMore: true, isLoading: false, - userId: '' + loadingMore: false, + userId: '', + reachBottomTimer: null } }, onLoad(options) { @@ -181,23 +205,7 @@ export default { (order.phone && order.phone.toLowerCase().includes(text)) ); } - const tabValue = this.tabs[this.currentTab].value; - // console.log('当前tab:', tabValue, 'orderList:', this.orderList); - if (tabValue === -1) return this.orderList; - if (tabValue === 0) { - // 已预约:status == 1 - // console.log(this.orderList.filter(order => order.status == 1),'this.orderList') - return this.orderList.filter(order => order.status == 1); - } else if (tabValue === 1) { - // 待质检:state == 1 - return this.orderList.filter(order => order.status == 2); - } else if (tabValue === 2) { - // 已结款:status == 3 - return this.orderList.filter(order => order.status == 3); - } else if (tabValue === 3) { - // 已驳回:status == 1 && state == 3 - return this.orderList.filter(order => order.status == 4); - } + // 现在通过接口参数获取对应Tab的数据,不需要客户端过滤 return this.orderList; } }, @@ -211,6 +219,7 @@ export default { this.hasMore = true this.orderList = [] this.isLoading = false + this.loadingMore = false this.fetchOrderList() }, onSearchIconClick() { @@ -241,11 +250,38 @@ export default { if (this.isLoading) return if (isLoadMore && !this.hasMore) return console.log(isLoadMore,'isLoadMore') - this.isLoading = true + + if (isLoadMore) { + this.loadingMore = true + } else { + this.isLoading = true + } + + // 根据当前Tab获取对应的status参数 + const tabValue = this.tabs[this.currentTab].value + let statusParam = 0 // 默认值 + + if (tabValue === -1) { + // 全部:status = 0 + statusParam = 0 + } else if (tabValue === 0) { + // 已预约:status = 0 + statusParam = 1 + } else if (tabValue === 1) { + // 待质检:status = 1 + statusParam = 2 + } else if (tabValue === 2) { + // 已结款:status = 2 + statusParam = 3 + } else if (tabValue === 3) { + // 已驳回:status = 3 + statusParam = 4 + } + const params = { pageNo: isLoadMore ? this.pageNo + 1 : 1, pageSize: this.pageSize, - status: 0 + status: statusParam } console.log(params,'params') if (this.userId) { @@ -254,7 +290,16 @@ 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') - const newOrders = res.result.records.map(order => { + // 过滤掉 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 statusInfo = this.getOrderStatusInfo(order.status, order.state) return { id: order.id, @@ -289,6 +334,16 @@ export default { this.hasMore = false } this.isLoading = false + this.loadingMore = false + }, err => { + console.error('获取订单列表失败:', err) + this.isLoading = false + this.loadingMore = false + this.hasMore = false + uni.showToast({ + title: '加载失败,请重试', + icon: 'none' + }) }) }, getOrderStatusInfo(status, state) { @@ -334,7 +389,7 @@ export default { return actions }, onLoadMore() { - if (this.hasMore && !this.isLoading) { + if (this.hasMore && !this.isLoading && !this.loadingMore) { this.fetchOrderList(true) } }, @@ -366,11 +421,18 @@ export default { this.hasMore = true; this.orderList = []; this.isLoading = false; + this.loadingMore = false; this.fetchOrderList(); uni.stopPullDownRefresh(); }, onReachBottom() { - this.onLoadMore() + // 防抖处理,避免频繁触发 + if (this.reachBottomTimer) { + clearTimeout(this.reachBottomTimer) + } + this.reachBottomTimer = setTimeout(() => { + this.onLoadMore() + }, 100) } } @@ -613,4 +675,43 @@ export default { } } } + +/* 加载状态样式 */ +.loading-container, .load-more-container, .no-more-container, .empty-container { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 40rpx 0; + color: #999; +} + +.loading-icon { + animation: spin 1s linear infinite; + margin-bottom: 16rpx; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} + +.loading-text, .load-more-text { + font-size: 28rpx; + color: #999; +} + +.no-more-text { + font-size: 26rpx; + color: #ccc; +} + +.empty-container { + padding: 120rpx 0; +} + +.empty-text { + font-size: 30rpx; + color: #ccc; +} \ No newline at end of file diff --git a/pages/subcomponent/about.vue b/pages/subcomponent/about.vue index 3342bbc..d11d14c 100644 --- a/pages/subcomponent/about.vue +++ b/pages/subcomponent/about.vue @@ -1,14 +1,17 @@ diff --git a/pages/subcomponent/wallet.vue b/pages/subcomponent/wallet.vue index b740a5c..26174fb 100644 --- a/pages/subcomponent/wallet.vue +++ b/pages/subcomponent/wallet.vue @@ -10,10 +10,15 @@ @@ -118,15 +123,11 @@ export default { loadingMore: false, noMore: false, refreshing: false, - isInitialized: false + isInitialized: false, + bannerList: [] } }, computed: { - image() { - // console.log(getApp().globalData.bannerList,'getApp().globalData.bannerList') - const item = getApp().globalData.bannerList.find(i => i.title === '我的-轮播图') - return item ? item.image : '' - }, }, onLoad() { this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight @@ -138,12 +139,26 @@ export default { onReachBottom(){ this.loadMore() }, + onUnload() { + uni.$off('bannerListUpdated') + }, methods: { async initData() { + this.getBannerList() await this.getUserInfo() await this.loadRecords() }, + getBannerList() { + // 从全局数据获取轮播图 + this.bannerList = getApp().globalData.bannerList || [] + + // 监听轮播图数据更新 + uni.$on('bannerListUpdated', () => { + this.bannerList = getApp().globalData.bannerList || [] + }) + }, + async getUserInfo() { try { const res = await api('getUserByToken') @@ -382,12 +397,7 @@ export default { margin-top: 0; } -.banner-bg { - position: absolute; - width: 100%; - height: 100%; - // opacity: 0.8; -} + .banner-content { position: relative;