diff --git a/pages/baoyou-city/baoyou-city.vue b/pages/baoyou-city/baoyou-city.vue index 819c631..51c82e8 100644 --- a/pages/baoyou-city/baoyou-city.vue +++ b/pages/baoyou-city/baoyou-city.vue @@ -12,7 +12,18 @@ - + + + + 包邮服务城市 + 已开通包邮服务的城市列表 + @@ -46,7 +57,8 @@ navBarHeight: 88, // 默认 menuButtonInfo: null, cityList: [], - bannerTop: 0 // banner距离顶部距离 + bannerTop: 0, // banner距离顶部距离 + imageLoadError: false // 图片加载错误标志 } }, onLoad() { @@ -78,12 +90,24 @@ }, myCityImage() { const item = getApp().globalData.configData.find(i => i.keyName === 'city_banner') + console.log(item); return item ? item.keyContent : '' }, }, methods: { goBack() { uni.navigateBack() + }, + // 图片加载错误处理 + onImageError(e) { + console.error('包邮城市背景图加载失败:', e); + this.imageLoadError = true; + // 可以在这里添加上报逻辑 + }, + // 图片加载成功处理 + onImageLoad(e) { + console.log('包邮城市背景图加载成功'); + this.imageLoadError = false; } } } @@ -157,6 +181,20 @@ display: block; object-fit: cover; } +.byc-banner-fallback { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: linear-gradient(135deg, #2486f6 0%, #4a9eff 100%); + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + padding: 40rpx; + box-sizing: border-box; +} .byc-main-card { background: #fff; border-radius: 36rpx; diff --git a/pages/subcomponent/detail.vue b/pages/subcomponent/detail.vue index 9152e81..a790439 100644 --- a/pages/subcomponent/detail.vue +++ b/pages/subcomponent/detail.vue @@ -146,7 +146,7 @@ 2025-03-20 11:00~12:00 - 取件地址 + 取件地址false {{ address }} @@ -155,7 +155,7 @@ - + diff --git a/pages/subcomponent/pickup.vue b/pages/subcomponent/pickup.vue index fa9243c..ed92a93 100644 --- a/pages/subcomponent/pickup.vue +++ b/pages/subcomponent/pickup.vue @@ -130,18 +130,18 @@ - 选择时间 - - - {{ slot }} - - - + 选择时间 + + + {{ slot }} + + + 确认 @@ -167,8 +167,8 @@ export default { showTimePicker: false, currentDateTab: 0, dateTabs: [], // 动态生成 - timeSlots: ['11:00~13:00', '13:00~15:00', '15:00~17:00'], - selectedTimeSlot: 0, + timeSlots: ['09:00~11:00', '11:00~13:00', '13:00~15:00', '15:00~17:00', '17:00~19:00'], + selectedTimeSlot: -1, steps: [], // 改为空数组,由接口获取 showAllItems: false, addressId: '' @@ -237,6 +237,18 @@ export default { uni.$off('clearRecycleData') }, computed: { + availableTimeSlots() { + const tab = this.dateTabs[this.currentDateTab]; + if (!tab) return this.timeSlots.map(() => true); + const dateObj = tab.date; + const now = new Date(); + return this.timeSlots.map(slot => { + const startTime = slot.split('~')[0]; + const [h, m] = startTime.split(':'); + const slotDate = new Date(dateObj.getFullYear(), dateObj.getMonth(), dateObj.getDate(), h, m); + return slotDate > now; + }); +}, totalCount() { return this.selectedItems.reduce((sum, item) => sum + item.quantity, 0) }, @@ -299,23 +311,29 @@ export default { this.currentDateTab = index }, selectTimeSlot(index) { - this.selectedTimeSlot = index - }, - confirmTime() { - const tab = this.dateTabs[this.currentDateTab] - const dateObj = tab.date - const timeStr = this.timeSlots[this.selectedTimeSlot] // 例如 '11:00~13:00' - const startTime = timeStr.split('~')[0] // '11:00' - const yyyy = dateObj.getFullYear() - const mm = (dateObj.getMonth() + 1).toString().padStart(2, '0') - const dd = dateObj.getDate().toString().padStart(2, '0') - this.selectedTime = `${yyyy}-${mm}-${dd} ${startTime}:00` - this.closeTimePicker() - }, - resetPicker() { - this.currentDateTab = 0 - this.selectedTimeSlot = 0 - }, + if (this.availableTimeSlots[index]) { + this.selectedTimeSlot = index; + } + }, + confirmTime() { + if (this.selectedTimeSlot === -1) { + uni.showToast({ title: '请选择可用时间段', icon: 'none' }); + return; + } + const tab = this.dateTabs[this.currentDateTab]; + const dateObj = tab.date; + const timeStr = this.timeSlots[this.selectedTimeSlot]; + const startTime = timeStr.split('~')[0]; + const yyyy = dateObj.getFullYear(); + const mm = (dateObj.getMonth() + 1).toString().padStart(2, '0'); + const dd = dateObj.getDate().toString().padStart(2, '0'); + this.selectedTime = `${yyyy}-${mm}-${dd} ${startTime}:00`; + this.closeTimePicker(); + }, + resetPicker() { + this.currentDateTab = 0; + this.selectedTimeSlot = -1; + }, toggleAgreement() { this.agreed = !this.agreed }, @@ -832,4 +850,12 @@ export default { padding: 36rpx 0 24rpx 30rpx; letter-spacing: 1rpx; } + + +.time-btn.disabled { + color: #ccc; + background: #f0f0f0; + border-color: #eee; + pointer-events: none; +} \ No newline at end of file diff --git a/pages/subcomponent/promo-qrcode.vue b/pages/subcomponent/promo-qrcode.vue index 292ffff..d29e66e 100644 --- a/pages/subcomponent/promo-qrcode.vue +++ b/pages/subcomponent/promo-qrcode.vue @@ -21,7 +21,20 @@ --> - + + + + + 二维码加载失败 + 请检查网络连接后重试 + + @@ -47,6 +60,7 @@ export default { userInfo: {}, qrcodeUrl: '/static/qrcode.png', inviteCode: '888888', + qrcodeLoadError: false, // 二维码加载错误标志 } }, onLoad() { @@ -182,6 +196,19 @@ export default { }) } }) + }, + + // 二维码加载错误处理 + onQrcodeError(e) { + console.error('二维码图片加载失败:', e); + this.qrcodeLoadError = true; + // 可以在这里添加上报逻辑 + }, + + // 二维码加载成功处理 + onQrcodeLoad(e) { + console.log('二维码图片加载成功'); + this.qrcodeLoadError = false; } } } @@ -279,6 +306,40 @@ export default { border-radius: 24rpx; box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08); } + + .qrcode-fallback { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: #fff; + border-radius: 24rpx; + box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08); + display: flex; + justify-content: center; + align-items: center; + } + + .qrcode-placeholder { + display: flex; + flex-direction: column; + align-items: center; + padding: 40rpx; + + .placeholder-text { + font-size: 32rpx; + color: #666; + margin-bottom: 16rpx; + font-weight: bold; + } + + .placeholder-desc { + font-size: 28rpx; + color: #999; + text-align: center; + } + } .invite-code { margin-top: 32rpx;