bug修改

This commit is contained in:
BAKEYi 2026-04-17 18:45:30 +08:00
parent 566b6f8929
commit 0c411882d9
4 changed files with 309 additions and 246 deletions

View File

@ -209,7 +209,7 @@
secondTabs() {
if (this.activeFirstId == 1 || this.activeFirstId == 2) {
return [{
title: `服务(${this.numInfo.noservernum})`,
title: `开始(${this.numInfo.noservernum})`,
id: 3
},
{

View File

@ -13,32 +13,40 @@
<scroll-view scroll-y class="order-scroll" @scrolltolower="loadMore" refresher-enabled
:refresher-triggered="isRefreshing" @refresherrefresh="onRefresh">
<view class="order-item" v-for="(order, index) in orderList" :key="index">
<!-- 订单编号和状态 -->
<view class="order-header">
<view class="order-tag">
<text
class="order-tag-text">{{order.order_kind == 1 ? '到家' : order.order_kind == 2 ? '到店' : ''}}</text>
</view>
<!-- 顶部订单编号 + 状态 -->
<view class="order-top">
<text class="order-number">订单编号{{order.number}}</text>
<text class="order-status"
:class="order.statusClass">{{order.state == 1 ? '待支付' : order.state == 2 ? '待接单' : order.state == 3 ? '待服务' : order.state == 4 ? '待完成' : order.state == 5 ? '已完成' : order.state == 6 ? '待评价' : order.state == 7 ? '已取消' : ''}}</text>
<view class="order-status-badge" :class="{
'order-status-badge2': order.state > 4 && order.state !== 7,
'order-status-badge3': order.state === 7
}">
{{ getStatusText(order.state) }}
</view>
</view>
<!-- 订单内容 -->
<view class="order-content" @click="goDetail(order)">
<image v-if="order.order_photo" :src="order.order_photo[0]" mode="aspectFill"
class="service-image"></image>
<image v-if="order.order_photo && order.order_photo.length" :src="order.order_photo[0]"
mode="aspectFill" class="service-image"></image>
<view class="service-image" v-else></view>
<view class="service-info">
<text class="service-name">{{order.server_title}}</text>
<view class="service-time" v-if="order.order_kind == 1">
<image src="/static/images/time_icon.png" class="time-icon"></image>
<text>{{order.reservation_time}}</text>
<view class="service-name">{{order.server_title}}</view>
<view class="service-time" v-if="getDisplayTime(order)">
<text class="label-text">下单时间:</text>
<text class="value-text">{{ getDisplayTime(order) }}</text>
</view>
<view class="service-address" v-if="order.order_kind == 1">
<view class="service-address" v-if="order.order_kind == 1 && getFullAddress(order)">
<image src="/static/images/position_icon.png" class="location-icon"></image>
<text>{{Object.assign({},order.reservation_address_arr).dependency}}{{Object.assign({},order.reservation_address_arr).address}}
</text>
<text class="address-text">{{ getFullAddress(order) }}</text>
</view>
<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>
</view>
</view>
</view>
@ -50,26 +58,31 @@
v-if="order.state == 5 || order.state == 6 || order.state == 7"></image>
</view>
<view class="action-right">
<text class="action-btn contact" @click="cancelService(order)"
v-if="order.state == 1">取消订单</text>
<text class="action-btn contact" @click="refoundService(order)"
v-if="order.state == 2 || order.state == 3">申请退款</text>
<text class="action-btn contact" @click="contactService(order.order_shopphone)"
v-if="order.state != 7 || order.state!=2">联系客服</text>
<text class="action-btn primary" v-if="order.state == 1"
@click="payOrder(order)">立即支付</text>
<text class="action-btn review" v-if="order.state == 6"
@click="reviewOrder(order)">评价</text>
<text class="action-btn again"
v-if="order.state == 5 || order.state == 6 || order.state == 7"
@click="orderAgain(order)">再来一单</text>
<!-- <text
class="action-btn again"
v-if="order.state == 5 && order.appeal == 1"
@click="addComplaint(order)"
>投诉</text> -->
<text class="action-btn again" v-if="order.state == 5 && order.appeal == 2"
@click="lookComplaint(order)">查看投诉</text>
<text class="action-btn gray-btn" @click="cancelService(order)" v-if="order.state == 1">
取消订单
</text>
<text class="action-btn gray-btn" @click="refoundService(order)"
v-if="order.state == 2 || order.state == 3">
申请退款
</text>
<!-- <text class="action-btn gray-btn" @click="contactService(order.order_shopphone)"
v-if="order.state != 7 && order.state != 2">
联系客服
</text> -->
<text class="action-btn red-btn" v-if="order.state == 1" @click="payOrder(order)">
立即支付
</text>
<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"
@click="orderAgain(order)">
再来一单
</text>
<text class="action-btn gray-btn" v-if="order.state == 5 && order.appeal == 2"
@click="lookComplaint(order)">
查看投诉
</text>
</view>
</view>
</view>
@ -86,14 +99,13 @@
</view>
</scroll-view>
</view>
<view class="nologin_part" v-else>
<image src="/static/images/no_login.png" class="nologin_icon" mode="aspectFit"></image>
<view class="btn-login">
<text class="login-text" @click="goLogin">前去登录</text>
</view>
</view>
</view>
</template>
@ -104,6 +116,7 @@
import {
debounce
} from '@/utils/debounce.js'
export default {
data() {
return {
@ -131,7 +144,6 @@
id: 7,
title: '已取消'
}],
// ,{id: 6,title: ''}
currentTab: 0,
isRefreshing: false,
hasMore: true,
@ -145,7 +157,6 @@
},
onLoad() {
// this.loadOrders();
},
async onShow() {
this.isLogin = uni.getStorageSync('accessToken') ? true : false;
@ -165,7 +176,6 @@
this.currentTab = index;
this.orderList = [];
this.formData.page = 1;
// TODO:
if (this.currentTab != 0) {
this.formData.state = this.currentTab;
} else {
@ -193,13 +203,13 @@
this.isRefreshing = true
this.formData.page = 1;
this.orderList = [];
this.hasMore = true;
this.loadOrders()
},
//
loadMore() {
if (!this.hasMore) return
// TODO:
this.loadOrders();
},
@ -211,6 +221,44 @@
})
},
getStatusText(state) {
const map = {
1: '待支付',
2: '待接单',
3: '待服务',
4: '服务中',
5: '已完成',
6: '待评价',
7: '已取消'
}
return map[state] || ''
},
getDisplayTime(order) {
return order.create_time || order.createtime || order.add_time || order.reservation_time || ''
},
getDisplayPrice(order) {
const price = order.pay_money || order.order_money || 0
return Number(price).toFixed(2)
},
getOriginalPrice(order) {
const orderMoney = Number(order.order_money || 0)
const payMoney = Number(order.pay_money || 0)
if (orderMoney > 0 && payMoney > 0 && orderMoney !== payMoney) {
return orderMoney.toFixed(2)
}
return ''
},
getFullAddress(order) {
const arr = order.reservation_address_arr || {}
const dependency = arr.dependency || ''
const address = arr.address || ''
return `${dependency}${address}`
},
//
deleteOrder: debounce(async function(order) {
uni.showModal({
@ -218,7 +266,6 @@
content: '确定要删除该订单吗?',
success: (res) => {
if (res.confirm) {
// TODO:
request.post('/sj/deleteorder', {
id: order.id,
sjid: this.sjid
@ -229,6 +276,7 @@
})
this.formData.page = 1;
this.orderList = [];
this.hasMore = true;
this.loadOrders();
})
}
@ -249,63 +297,14 @@
});
});
},
//
async contactService(phone) {
// TODO:
uni.navigateTo({
url: '/pages/contact/contact'
})
// const systemInfo = uni.getSystemInfoSync()
// if(systemInfo.platform === 'ios') {
// uni.makePhoneCall({
// phoneNumber: phone //
// })
// }else {
// let permission = '';
// if(systemInfo.platform === 'ios') {
// permission = 'phone'
// }else {
// permission = 'android.permission.CALL_PHONE'
// }
// this.isShowPer = true;
// const firstRequest = !plus.storage.getItem(`perm_${permission}`)
// if(firstRequest) {
// this.isShowPer = true;
// }
// // 1.
// const { granted } = await permissionUtils.checkPermission('phone', '便');
// if (granted) {
// this.isShowPer = false;
// uni.makePhoneCall({
// phoneNumber: phone //
// })
// return;
// }
// this.isShowPer = false;
// // 2.
// const confirm = await this.showPermissionDialog(
// '',
// '便'
// );
// if (!confirm) return;
// // 3.
// const result = await permissionUtils.requestPermission('phone', '便');
// console.log('result',result)
// if (result) {
// uni.makePhoneCall({
// phoneNumber: phone //
// })
// return;
// } else {
// locationService.openAppSettings();
// return;
// // uni.showToast({ title: '', icon: 'none' });
// }
// }
},
//
async cancelService(order) {
console.log(order)
@ -314,7 +313,6 @@
content: '确定要取消该订单吗?',
success: (res) => {
if (res.confirm) {
// TODO:
let data = {
orderNo: order.number,
amount: order.pay_money,
@ -327,6 +325,7 @@
})
this.formData.page = 1;
this.orderList = [];
this.hasMore = true;
this.loadOrders();
}).catch(err => {
console.log(err)
@ -335,6 +334,7 @@
}
})
},
// 退
async refoundService(order) {
uni.showModal({
@ -342,7 +342,6 @@
content: '确定申请退款?退款后则订单取消!',
success: (res) => {
if (res.confirm) {
// TODO: 退
let data = {
orderNo: order.number,
amount: order.pay_money,
@ -365,6 +364,7 @@
})
this.formData.page = 1;
this.orderList = [];
this.hasMore = true;
this.loadOrders();
}).catch(err => {
console.log(err)
@ -376,7 +376,6 @@
//
payOrder(order) {
// TODO:
uni.navigateTo({
url: `/pages/shop/pay-order?id=${order.id}&money=${order.order_money}&title=${order.server_title}&number=${order.number}`
})
@ -391,25 +390,26 @@
//
orderAgain(order) {
// TODO:
uni.navigateTo({
url: '/pages/shop/service-detail?id=' + order.server_id
})
},
//
addComplaint(order) {
uni.navigateTo({
url: '/pages/complaint/add-complaint?number=' + order.number
})
},
//
lookComplaint(order) {
uni.navigateTo({
url: '/pages/complaint/detail?number=' + order.number
})
},
goLogin() {
// uni.oprPresentLogin()
uni.navigateTo({
url: '/pages/blogPopup/blogPopup'
});
@ -471,113 +471,155 @@
.order-item {
background-color: #FFFFFF;
border-radius: 16rpx;
border-radius: 20rpx;
margin-bottom: 24rpx;
padding: 24rpx;
box-sizing: border-box;
position: relative;
}
.order-header {
display: flex;
align-items: center;
margin-bottom: 34rpx;
}
.order-tag {
width: 74rpx;
height: 38rpx;
display: flex;
flex-flow: row nowrap;
justify-content: center;
align-items: center;
border-radius: 19rpx;
margin-right: 8rpx;
background-color: rgba(232, 16, 30, 0.2);
}
.order-tag-text {
color: #E8101E;
font-size: 24rpx;
.order-top {
position: relative;
padding-right: 120rpx;
min-height: 40rpx;
}
.order-number {
flex: 1;
font-size: 24rpx;
color: #666666;
}
.order-status {
display: block;
font-size: 28rpx;
font-weight: 500;
background-image: url('https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/5349af61-d67a-4ecf-91ce-6e4f05ad5edb.png');
color: #333333;
line-height: 40rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.order-status-badge {
font-weight: 400;
font-size: 26rpx;
color: #E8101E;
text-align: left;
font-style: normal;
position: absolute;
right: -24rpx;
top: -24rpx;
background-image: url("/static/images/icons/tabBj.png");
background-size: 100% auto;
background-position: center top;
background-repeat: no-repeat;
background-size: 100%;
height: 49rpx;
width: 128rpx;
padding-left: 30rpx;
height: 49rpx;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
.status-pending {
color: #E8101E;
.order-status-badge2 {
background-image: url("/static/images/icons/tabBj2.png");
color: #333333;
}
.status-cancelled {
color: #E8101E;
}
.status-completed {
color: #E8101E;
.order-status-badge3 {
background-image: url("/static/images/icons/tabBj2.png");
color: #999999 !important;
}
.order-content {
display: flex;
margin-bottom: 24rpx;
align-items: flex-start;
margin-top: 20rpx;
}
.service-image {
width: 182rpx;
height: 182rpx;
border-radius: 16rpx;
margin-right: 24rpx;
background-color: #000000;
width: 162rpx;
height: 162rpx;
border-radius: 24rpx;
margin-right: 20rpx;
background-color: #F5F5F5;
flex-shrink: 0;
}
.service-info {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
justify-content: flex-start;
}
.service-name {
font-size: 24rpx;
font-size: 30rpx;
color: #333333;
font-weight: 500;
line-height: 42rpx;
margin-bottom: 12rpx;
word-break: break-all;
}
.service-time,
.service-address {
.service-time {
display: flex;
align-items: center;
font-size: 24rpx;
line-height: 34rpx;
margin-bottom: 8rpx;
}
.label-text {
color: #666666;
}
.value-text {
color: #999999;
font-weight: 500;
margin-top: 8rpx;
margin-left: 8rpx;
}
.service-address {
display: flex;
align-items: flex-start;
margin-bottom: 10rpx;
}
.text-overflow-1 {
white-space: normal !important;
word-break: break-word !important;
overflow: visible !important;
text-overflow: clip !important;
flex: 1;
}
.time-icon,
.location-icon {
width: 24rpx;
height: 24rpx;
margin-right: 4rpx;
flex-shrink: 0;
margin-right: 6rpx;
margin-top: 4rpx;
flex-shrink: 0;
}
.address-text {
font-size: 24rpx;
color: #999999;
line-height: 34rpx;
word-break: break-all;
}
.price-row {
display: flex;
align-items: baseline;
margin-top: 6rpx;
}
.price-symbol {
font-size: 24rpx;
color: #FF0037;
line-height: 1;
}
.price-now {
font-size: 36rpx;
font-weight: 500;
color: #FF0037;
line-height: 1;
margin-left: 2rpx;
}
.price-old {
font-size: 22rpx;
color: #999999;
text-decoration: line-through;
margin-left: 10rpx;
line-height: 1;
}
.order-actions {
@ -586,6 +628,12 @@
align-items: center;
border-top: 1rpx solid #EEEEEE;
padding-top: 24rpx;
margin-top: 24rpx;
}
.action-left {
display: flex;
align-items: center;
}
.delete-icon {
@ -596,41 +644,33 @@
.action-right {
display: flex;
align-items: center;
flex-wrap: wrap;
justify-content: flex-end;
}
.action-btn {
display: inline-block;
width: 128rpx;
height: 48rpx;
line-height: 48rpx;
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 128rpx;
height: 60rpx;
padding: 0 28rpx;
margin-left: 16rpx;
text-align: center;
font-size: 28rpx;
border-radius: 24rpx;
border-radius: 30rpx;
font-size: 24rpx;
box-sizing: border-box;
}
.action-btn.contact {
.gray-btn {
background-color: #FFFFFF;
border: 1rpx solid #999999;
color: #333333;
}
.action-btn.primary {
background-color: #E8101E;
color: #FFFFFF;
}
.action-btn.review {
background-color: rgba(252, 67, 124, 0.40);
border: 1rpx solid #E8101E;
color: #FFFFFF;
}
.action-btn.again {
.red-btn {
background-color: #FFFFFF;
border: 1rpx solid #999999;
color: #666666;
border: 1rpx solid #E8101E;
color: #E8101E;
}
.nologin_part {
@ -686,12 +726,12 @@
opacity: 1;
visibility: visible;
}
/* #endif */
/* 平台适配 */
/* #ifdef H5 */
/* .order-list {
padding-bottom: env(safe-area-inset-bottom);
} */
padding-bottom: env(safe-area-inset-bottom);
} */
/* #endif */
</style>

View File

@ -88,6 +88,30 @@
<text class="label">下单时间</text>
<text class="value">{{orderInfo.add_time}}</text>
</view>
<view class="info-item">
<text class="label">服务时长</text>
<text class="value">{{ orderInfo.server_time }}分钟</text>
</view>
<view class="info-item" v-if="orderInfo.state != 1 && orderInfo.pay_kind">
<text class="label">支付方式</text>
<text class="value">{{
orderInfo.pay_kind == 1
? "账户余额"
: orderInfo.pay_kind == 2
? "微信支付"
: orderInfo.pay_kind == 3
? "支付宝支付"
: ""
}}</text>
</view>
<view class="info-item" v-if="orderInfo.state != 1 && orderInfo.pay_time">
<text class="label">支付时间</text>
<text class="value">{{ orderInfo.pay_time }}</text>
</view>
<view class="info-item" v-if="orderInfo.state >= 3 && orderInfo.get_time">
<text class="label">接单时间</text>
<text class="value">{{ orderInfo.get_time }}</text>
</view>
<view class="info-item" v-if="orderInfo.state != 1 && orderInfo.state != 2 && orderInfo.state != 3 && orderInfo.state != 7">
<text class="label">开始服务时间</text>
<text class="value">{{orderInfo.server_start_time}}</text>

View File

@ -251,7 +251,7 @@
<text class="value">{{orderInfo.team_buy_order_number}}</text>
</view>
</view>
<view class="order-card" v-if="Object.keys(orderInfo.coupon_info).length>0">
<view class="order-card" v-if="orderInfo.coupon_info && Object.keys(orderInfo.coupon_info).length > 0">
<text class="card-title">优惠券信息</text>
<view class="coupon-item">
<view class="info-item">
@ -285,7 +285,7 @@
<view class="handel-button btn-bg" v-if="orderInfo.state == 3" @click.stop="startOrder($event, orderInfo)">
<text class="button-text">开始服务</text>
</view>
<view class="handel-button btn-bg" v-if="orderInfo.state != 4" @click.stop="endOrder($event, orderInfo)">
<view class="handel-button btn-bg" v-if="orderInfo.state == 4" @click.stop="endOrder($event, orderInfo)">
<text class="button-text">服务完成</text>
</view>
</view>
@ -530,21 +530,19 @@
};
},
getOrderDetail() {
request.post(this.urls[this.serviceType].detail, {
return request.post(this.urls[this.serviceType].detail, {
id: this.id,
sjid: this.userInfo.id
}).then(res => {
this.orderInfo = res.data;
this.reservation_address_arr = res.data.reservation_address_arr;
//
if (res.data.user_sj) {
this.user_sj = res.data.user_sj;
this.calculateDistance(); //
const newOrderInfo = res.data;
//
if (this.orderInfo && this.orderInfo.state > newOrderInfo.state) {
newOrderInfo.state = this.orderInfo.state;
}
console.log(this.orderInfo)
})
this.orderInfo = newOrderInfo;
this.orderInfo.coupon_info = this.orderInfo.coupon_info || {};
this.reservation_address_arr = this.orderInfo.reservation_address_arr || {};
});
},
//
@ -663,40 +661,41 @@
},
//
onConfirm(code) {
this.showInput = false
if (this.clickType) {
return
}
this.clickType = true
this.showInput = false;
if (this.clickType) return;
this.clickType = true;
uni.showLoading({ title: '服务开始中...' });
request.post(this.urls[this.serviceType].startOrder, {
id: this.orderInfo.id,
server_code: code,
sjid: this.userInfo.id
}).then(res => {
console.log(res)
if (res.state == 1) {
uni.showToast({
title: res.msg,
icon: 'none'
})
this.getOrderDetail();
//
uni.showToast({ title: res.msg, icon: 'success' });
// 4
this.orderInfo.state = 4;
//
this.$forceUpdate();
//
this.getOrderDetail().catch(e => console.warn('静默同步失败', e));
//
const pages = getCurrentPages();
const prevPage = pages[pages.length - 2];
if (prevPage) {
prevPage.$vm.getOrderNumber();
prevPage.$vm.getOrderList();
if (prevPage && prevPage.$vm) {
prevPage.$vm.getOrderNumber?.();
prevPage.$vm.getOrderList?.();
}
} else if (res.state == 2) {
uni.showToast({
title: res.msg,
icon: 'none'
})
uni.showToast({ title: res.msg, icon: 'none' });
}
this.handelOrder = {};
}).catch(err => {
console.error('开始服务失败', err);
uni.showToast({ title: '操作失败', icon: 'none' });
}).finally(() => {
this.clickType = false
})
this.clickType = false;
uni.hideLoading();
});
},
//
endOrder(e, order) {