bug修改

This commit is contained in:
cjl520cy 2026-04-29 18:17:50 +08:00
parent 54cb3b744d
commit 8347f81269
4 changed files with 93 additions and 88 deletions

View File

@ -15,7 +15,7 @@
<view class="order-item" v-for="(order, index) in orderList" :key="index">
<!-- 顶部订单编号 + 状态 -->
<view class="order-top">
<text class="order-number">服务时段{{order.number}}</text>
<text class="order-number">服务时段{{getPeriodTime(order)}}</text>
<view class="order-status-badge" :class="{
'order-status-badge2': order.state > 4 && order.state !== 7,
'order-status-badge3': order.state === 7
@ -46,7 +46,8 @@
<view class="price-row">
<text class="price-symbol">¥</text>
<text class="price-now">{{ getDisplayPrice(order) }}</text>
<text class="price-old" v-if="getOriginalPrice(order)">{{ getOriginalPrice(order) }}</text>
<text class="price-old"
v-if="getOriginalPrice(order)">{{ getOriginalPrice(order) }}</text>
</view>
</view>
</view>
@ -75,7 +76,8 @@
<text class="action-btn red-btn" v-if="order.state == 6" @click="reviewOrder(order)">
评价
</text>
<text class="action-btn gray-btn" v-if="order.state == 5 || order.state == 6 || order.state == 7"
<text class="action-btn gray-btn"
v-if="order.state == 5 || order.state == 6 || order.state == 7"
@click="orderAgain(order)">
再次购买
</text>
@ -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 */
/* 平台适配 */

View File

@ -32,29 +32,43 @@
</text>
</view>
<!-- 预约手艺人信息 -->
<view class="syr-card">
<view class="syr-card-header">
预约手艺人信息
</view>
<view class="syr-card-footer flex-row-center-between">
<view class="syr-card-footer-left flex-row-center">
<image class="syr-card-footer-left-img" :src="user_syr.head_photo"></image>
<view class="syr-card-footer-left-text">{{ `${user_syr.name} ${user_syr.account}` }}</view>
<!-- 到家订单 客户以及手艺人信息 -->
<view class="service-card">
<view class="location-info">
<image src="/static/images/gohome_location.png" class="location-icon"></image>
<view class="address-info">
<view class="name-phone">
<text class="name">{{userInfo.name}}</text>
<text class="phone">{{userInfo.account}}</text>
</view>
<text class="address">{{userInfo.dependency}}{{userInfo.address}}</text>
</view>
<image class="syr-card-footer-right" @click="contactService(user_syr.account)"
src="/static/images/icons/phone.png"></image>
</view>
<image src="/static/images/boder_icon.png" mode="aspectFill" class="divider"></image>
<view class="staff-info">
<image :src="user_syr.head_photo" mode="aspectFill" class="staff-avatar"></image>
<view class="staff-detail">
<text class="staff-name">{{user_syr.name}}</text>
<view class="rating">
<!-- <image
v-for="(star, index) in 5"
:key="index"
src="/static/images/star.png"
class="star-icon"
></image> -->
</view>
</view>
<!-- <image src="/static/images/order_phone.png" class="phone-btn" @click="contactService(user_syr.account)"></image> -->
</view>
</view>
<!-- 预约信息 -->
<view class="booking-card">
<view class="card-header" v-if="orderInfo.order_kind == 1">
<text class="card-title">预约信息</text>
<view>
<text class="update-time">{{`服务时间 ${orderInfo.reservation_time}`}}</text>
<text class="update-time">{{orderInfo.reservation_time}}</text>
<!-- <text class="update-change">更改时间</text> -->
</view>
</view>
@ -69,7 +83,7 @@
<text class="service-count">×1</text>
</view>
<view class="service-real">
<text class="real-lable">付金额</text>
<text class="real-lable">际支付金额</text>
<text class="real-price">{{orderInfo.pay_money}}</text>
</view>
</view>
@ -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;
@ -647,49 +647,6 @@
}
}
/* 预约手艺人信息卡片 */
.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 {

View File

@ -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(); //
}

View File

@ -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()
@ -275,6 +275,10 @@ const uploadToOss = (file, ossConfig, name, uploadType) => {
// #endif
}
uni.showLoading({
title: '上传中'
})
uni.uploadFile({
url: ossConfig.host,
filePath: path, // 手机端文件路径
@ -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