|
|
@ -59,20 +59,20 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 订单操作 --> |
|
|
|
<view class="order-actions"> |
|
|
|
<view class="action-btn details-btn" v-if="[0, 1].includes(order.status)" |
|
|
|
@click="$refs.cancelOrderPopup.open(order)"> |
|
|
|
<text>取消订单</text> |
|
|
|
</view> |
|
|
|
<view class="action-btn details-btn" @click="viewOrderDetails(order.orderId)"> |
|
|
|
<text>查看详情</text> |
|
|
|
</view> |
|
|
|
<view class="action-btn pay-btn" v-if="order.status == 0" @click="goToPay(order)"> |
|
|
|
<text>去付款</text> |
|
|
|
</view> |
|
|
|
<view class="action-btn pay-btn" v-if="[0, 1].includes(order.status)" @click="modifyOrder(order)"> |
|
|
|
<text>修改订单</text> |
|
|
|
</view> |
|
|
|
<view class="order-actions"> |
|
|
|
<view class="action-btn details-btn" v-if="[0, 1, 2].includes(order.status) && !isServiceDateWithin24Hours(order)" |
|
|
|
@click="$refs.cancelOrderPopup.open(order)"> |
|
|
|
<text>取消订单</text> |
|
|
|
</view> |
|
|
|
<view class="action-btn details-btn" @click="viewOrderDetails(order.orderId)"> |
|
|
|
<text>查看详情</text> |
|
|
|
</view> |
|
|
|
<view class="action-btn pay-btn" v-if="order.status == 0" @click="goToPay(order)"> |
|
|
|
<text>去付款</text> |
|
|
|
</view> |
|
|
|
<view class="action-btn pay-btn" v-if="[0, 1, 2].includes(order.status) && !isServiceDateWithin24Hours(order)" @click="modifyOrder(order)"> |
|
|
|
<text>修改订单</text> |
|
|
|
</view> |
|
|
|
<view class="action-btn pay-btn" |
|
|
|
v-if="[11, 4].includes(order.status) && !order.evaluation" |
|
|
|
@click="goToReview(order)"> |
|
|
@ -157,6 +157,7 @@ |
|
|
|
getOrderServiceText, |
|
|
|
getProductNameText |
|
|
|
} from '@/utils/serviceTime.js' |
|
|
|
import dayjs from '@/utils/lib/dayjs.min.js' |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
Kefu, |
|
|
@ -448,6 +449,30 @@ |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
// 判断服务日期是否在24小时内 |
|
|
|
isServiceDateWithin24Hours(order) { |
|
|
|
if (!order.orderServiceList || order.orderServiceList.length === 0) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
// 获取最早的服务日期 |
|
|
|
const earliestServiceDate = order.orderServiceList |
|
|
|
.map(service => service.serviceDate) |
|
|
|
.sort((a, b) => dayjs(a).valueOf() - dayjs(b).valueOf())[0]; |
|
|
|
|
|
|
|
if (!earliestServiceDate) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
// 计算时间差 |
|
|
|
const now = dayjs(); |
|
|
|
const serviceDate = dayjs(earliestServiceDate); |
|
|
|
const hoursDiff = serviceDate.diff(now, 'hour'); |
|
|
|
|
|
|
|
// 如果服务日期距离现在小于24小时,返回true |
|
|
|
return hoursDiff < 24 && hoursDiff >= 0; |
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
// 页面加载时获取订单列表 |
|
|
|