修复缴费记录逾期天数问题

This commit is contained in:
2025-08-07 22:53:18 +08:00
parent 69d5cbfa73
commit a1a681c84e
3 changed files with 34 additions and 18 deletions

View File

@@ -1,7 +1,7 @@
VITE_APP_NAME=后台管理系统
#VITE_API_URL=http://localhost:9090/api
#VITE_API_URL=http://yxw.wsdns.cn/api
VITE_API_URL=http://yxw.wsdns.cn/api
#VITE_SOCKET_URL=ws://localhost:9190
VITE_API_URL=http://127.0.0.1:9090/api
#VITE_API_URL=http://127.0.0.1:9090/api
#VITE_API_URL=https://server.gxwebsoft.com/api
VITE_SOCKET_URL=wss://server.gxwebsoft.com

View File

@@ -35,6 +35,7 @@ export interface Order {
sortNumber?: number;
// 配送方式
deliveryType?: string;
payTime?: string;
// 付款状态
payStatus?: number;
expressPrice?: string;

View File

@@ -267,9 +267,6 @@
<div>电池押金:¥{{ record.batteryDeposit }}</div>
<div>电池保险:¥{{ record.batteryInsurance }}</div>
</template>
<template v-if="column.key === 'expirationDay'">
<span class="ele-text-danger">{{ expirationDay(record) }}</span>
</template>
<template v-if="column.key === 'duration'">
<span class="ele-text-danger">{{ countDuration(record) }}</span>
@@ -278,7 +275,7 @@
</a-table>
</a-spin>
</a-card>
<a-card title="租期记录" class="order-card">
<a-card title="缴费记录" class="order-card">
<a-spin :spinning="loading">
<a-table
:data-source="renewOrderList"
@@ -288,10 +285,15 @@
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'orderNo'">
<span :class="[record.isAdminRenew === 1 ? 'ele-text-primary' : '']">{{ record.orderNo }}</span>
<span
:class="[record.isAdminRenew === 1 ? 'ele-text-primary' : '']"
>{{ record.orderNo }}</span
>
</template>
<template v-if="column.key === 'batteryModel'">
<div :class="[record.isAdminRenew === 1 ? 'ele-text-primary' : '']">
<div
:class="[record.isAdminRenew === 1 ? 'ele-text-primary' : '']"
>
<div>电池租金:¥{{ record.batteryRent }}</div>
<div>电池押金:¥{{ record.batteryDeposit }}</div>
<div>电池保险:¥{{ record.batteryInsurance }}</div>
@@ -302,7 +304,14 @@
<div>{{ record.expirationTime }}</div>
</template>
<template v-if="column.key === 'expirationDay'">
<span class="ele-text-danger">{{ expirationDay(record) }}</span>
<span
class="ele-text-danger"
v-if="expirationDay(record).includes('逾期')"
>{{ expirationDay(record) }}</span
>
<span class="ele-text-success" v-else>{{
expirationDay(record)
}}</span>
</template>
<template v-if="column.key === 'action'">
@@ -454,6 +463,7 @@
import { listOrder, listOrderPay } from '@/api/order';
import { CopyOutlined } from '@ant-design/icons-vue';
import { EquipmentRecord } from '@/api/apps/equipment/record/model';
import dayjs from 'dayjs';
const useForm = Form.useForm;
// 是否开启响应式布局
@@ -809,15 +819,20 @@
// };
const expirationDay = (order) => {
const setTime = new Date(order.expirationTime);
const nowTime = new Date();
const restSec = setTime.getTime() - nowTime.getTime();
console.log('计算剩余天数');
console.log(restSec);
// 剩余天数
const day = parseInt(String(restSec / (60 * 60 * 24 * 1000)));
if (day < 0) {
return '逾期' + Math.abs(day) + '天';
if (dayjs(order.expirationTime).isBefore(dayjs())) {
const useDay = dayjs(order.expirationTime).diff(
dayjs(props?.data?.payTime),
'd'
);
return `使用${useDay}天`;
} else {
const day = dayjs(order.expirationTime).diff(dayjs(order.payTime), 'd');
if (day < 0) {
return '逾期' + Math.abs(day) + '天';
} else {
const useDay = dayjs().diff(dayjs(props?.data?.payTime), 'd');
return `使用${useDay}天`;
}
}
};