diff --git a/pages/shop/buy-order.vue b/pages/shop/buy-order.vue index 8d6fa7d..ceeb3a2 100644 --- a/pages/shop/buy-order.vue +++ b/pages/shop/buy-order.vue @@ -15,7 +15,7 @@ - 服务时段:{{order.number}} + 服务时段:{{getPeriodTime(order)}} ¥ {{ getDisplayPrice(order) }} - {{ getOriginalPrice(order) }} + {{ getOriginalPrice(order) }} @@ -75,7 +76,8 @@ 评价 - 再次购买 @@ -171,6 +173,37 @@ this.loadOrders(); }, methods: { + getPeriodTime(order) { + const reservationTime = order.reservation_time; + const serverTime = order.server_time; + + if (!reservationTime || !serverTime) { + return order.create_time || order.createtime || order.add_time || ''; + } + + // 兼容 iOS:将 "2026-04-29 15:50:00" 转换为 "2026/04/29 15:50:00" + const formattedTime = reservationTime.replace(/-/g, '/'); + const startDate = new Date(formattedTime); + + if (isNaN(startDate.getTime())) { + return order.create_time || order.createtime || order.add_time || ''; + } + + // 格式化开始时间 + const year = startDate.getFullYear(); + const month = String(startDate.getMonth() + 1).padStart(2, '0'); + const day = String(startDate.getDate()).padStart(2, '0'); + const startHour = String(startDate.getHours()).padStart(2, '0'); + const startMinute = String(startDate.getMinutes()).padStart(2, '0'); + + // 计算结束时间 + const endDate = new Date(startDate.getTime() + serverTime * 60 * 1000); + const endHour = String(endDate.getHours()).padStart(2, '0'); + const endMinute = String(endDate.getMinutes()).padStart(2, '0'); + + // 返回格式:YYYY-MM-DD HH:mm - HH:mm + return `${year}-${month}-${day} ${startHour}:${startMinute} - ${endHour}:${endMinute}`; + }, // 切换标签 switchTab(index) { this.currentTab = index; @@ -726,6 +759,7 @@ opacity: 1; visibility: visible; } + /* #endif */ /* 平台适配 */ diff --git a/pages/shop/buyorder-detail.vue b/pages/shop/buyorder-detail.vue index 24da70a..adf82db 100644 --- a/pages/shop/buyorder-detail.vue +++ b/pages/shop/buyorder-detail.vue @@ -32,21 +32,35 @@ - - - - 预约手艺人信息 - - - - - {{ `${user_syr.name} ${user_syr.account}` }} + + + + + + + {{userInfo.name}} + {{userInfo.account}} + + {{userInfo.dependency}}{{userInfo.address}} - + + + + + + {{user_syr.name}} + + + + + - @@ -54,7 +68,7 @@ 预约信息 - {{`服务时间 ${orderInfo.reservation_time}`}} + {{orderInfo.reservation_time}} @@ -69,7 +83,7 @@ ×1 - 实付金额: + 实际支付金额: ¥{{orderInfo.pay_money}} @@ -486,20 +500,6 @@ background-color: #fff; } - /* 辅助类 */ - .flex-row-center-between { - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - } - - .flex-row-center { - display: flex; - flex-direction: row; - align-items: center; - } - .detail-page::before { content: ''; position: fixed; @@ -646,50 +646,7 @@ color: #333333; } } - - /* 预约手艺人信息卡片 */ - .syr-card { - margin: 30rpx; - background-color: #ffffff; - padding: 30rpx 20rpx; - border-radius: 16rpx; - box-shadow: 0 4rpx 16rpx 0 rgba(210, 213, 224, 0.5); - - .syr-card-header { - font-weight: 500; - font-size: 32rpx; - color: #333333; - line-height: 45rpx; - text-align: left; - font-style: normal; - margin-bottom: 40rpx; - } - - .syr-card-footer { - .syr-card-footer-left { - .syr-card-footer-left-img { - width: 70rpx; - height: 70rpx; - border-radius: 50%; - margin-right: 20rpx; - } - - .syr-card-footer-left-text { - font-weight: 400; - font-size: 28rpx; - color: #333333; - line-height: 40rpx; - text-align: left; - font-style: normal; - } - } - - .syr-card-footer-right { - width: 40rpx; - height: 40rpx; - } - } - } + /* 服务人员卡片 */ .service-card { diff --git a/pages/shop/photoAlbum/addPhoto.vue b/pages/shop/photoAlbum/addPhoto.vue index f813e08..32a005a 100644 --- a/pages/shop/photoAlbum/addPhoto.vue +++ b/pages/shop/photoAlbum/addPhoto.vue @@ -410,9 +410,9 @@ let res = null try { - uni.showLoading({ - title: '上传中' - }) + // uni.showLoading({ + // title: '上传中' + // }) console.log(this.formData, '============================='); if (this.formData.type == 1) { res = await uploadImage.handleUpload(this.userInfo.id, 3); @@ -423,11 +423,18 @@ console.log('上传单张图片', res) this.formData.url = res; } catch (err) { - console.log(err) - uni.showToast({ - title: '上传失败', - icon: 'none' - }); // 新增:上传失败提示 + if (err.errMsg && (err.errMsg.includes('cancel')||err.errMsg.includes('取消'))) { + uni.showToast({ + title: '取消上传', + icon: 'none' + }); + } else { + uni.showToast({ + title: '上传失败', + icon: 'none' + }); // 新增:上传失败提示 + } + } finally { uni.hideLoading(); // 移到这里,必执行 } diff --git a/utils/albumUploadImage.js b/utils/albumUploadImage.js index 2f17212..4d6d211 100644 --- a/utils/albumUploadImage.js +++ b/utils/albumUploadImage.js @@ -87,10 +87,10 @@ const handleUpload = async (userId, type, sourceType = ['album', 'camera'], uplo console.error('上传出错:', error) // 如果是用户取消操作,不抛出错误,返回 null - if (error.errMsg && error.errMsg.includes('cancel')) { - console.log('用户取消了操作') - return null - } + // if (error.errMsg && error.errMsg.includes('cancel')) { + // console.log('用户取消了操作') + // return null + // } throw error } finally { @@ -217,7 +217,7 @@ const getOssConfig = async (type) => { // 上传到OSS const uploadToOss = (file, ossConfig, name, uploadType) => { - console.log(ossConfig) + return new Promise((resolve, reject) => { // #ifdef H5 const formData = new FormData() @@ -274,6 +274,10 @@ const uploadToOss = (file, ossConfig, name, uploadType) => { path = file.tempFilePath // #endif } + + uni.showLoading({ + title: '上传中' + }) uni.uploadFile({ url: ossConfig.host, @@ -288,9 +292,12 @@ const uploadToOss = (file, ossConfig, name, uploadType) => { }, success(res) { resolve(`${ossConfig.host}/${ossConfig.dir}${name}`) + uni.hideLoading(); }, complete(err) { console.log('err', err) + uni.hideLoading(); + } }); // #endif