feat(order): 更新API配置和订单支付功能
- 修改开发和生产环境配置文件中的API和WebSocket地址 - 添加updateOrderPay API方法用于更新订单支付信息 - 在订单信息组件中添加日期选择器用于修改开始和过期时间 - 实现订单过期天数计算逻辑的改进 - 添加数据保存成功提示消息 - 更新头像文件存储地址配置
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
VITE_APP_NAME=后台管理系统
|
VITE_APP_NAME=后台管理系统
|
||||||
#VITE_API_URL=http://localhost:9090/api
|
#VITE_API_URL=http://localhost:9090/api
|
||||||
VITE_API_URL=http://yxw.wsdns.cn/api
|
VITE_API_URL=https://yxw-api.websoft.top/api
|
||||||
#VITE_SOCKET_URL=ws://localhost:9190
|
#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.websoft.top
|
||||||
VITE_SOCKET_URL=wss://server.gxwebsoft.com
|
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
VITE_APP_NAME=后台管理系统
|
VITE_APP_NAME=后台管理系统
|
||||||
#VITE_API_URL=https://server.jimeigroup.cn/api
|
VITE_API_URL=https://yxw-api.websoft.top/api
|
||||||
#VITE_API_URL=https://server.gxwebsoft.com/api
|
VITE_SOCKET_URL=wss://server.websoft.top
|
||||||
VITE_API_URL=http://yxw.wsdns.cn/api
|
|
||||||
#VITE_API_URL=http://1.14.132.108:10032/api
|
|
||||||
VITE_SOCKET_URL=wss://server.gxwebsoft.com
|
|
||||||
|
|||||||
@@ -67,6 +67,14 @@ export async function addOrderPay(data: OrderPay) {
|
|||||||
return Promise.reject(new Error(res.data.message));
|
return Promise.reject(new Error(res.data.message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function updateOrderPay(data: OrderPay) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>('/shop/order-pay', data);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id查询订单
|
* 根据id查询订单
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -119,7 +119,7 @@
|
|||||||
<a-page-header
|
<a-page-header
|
||||||
:title="item.nickname"
|
:title="item.nickname"
|
||||||
:sub-title="`${item.createTime}`"
|
:sub-title="`${item.createTime}`"
|
||||||
:avatar="{ src: item.avatar ? item.avatar : 'https://file.gxwebsoft.com/20230217/c8a5c699b3174866a36dd6d378a09bb9.jpg' }"
|
:avatar="{ src: item.avatar ? item.avatar : 'https://file.wsdns.cn/20230217/c8a5c699b3174866a36dd6d378a09bb9.jpg' }"
|
||||||
>
|
>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<a-button key="2" href="#bottom" @click="onReply(item)">回复</a-button>
|
<a-button key="2" href="#bottom" @click="onReply(item)">回复</a-button>
|
||||||
@@ -147,7 +147,7 @@
|
|||||||
<a-page-header
|
<a-page-header
|
||||||
:title="item.nickname"
|
:title="item.nickname"
|
||||||
:sub-title="`${item.createTime}`"
|
:sub-title="`${item.createTime}`"
|
||||||
:avatar="{ src: item.avatar ? item.avatar : 'https://file.gxwebsoft.com/20230217/c8a5c699b3174866a36dd6d378a09bb9.jpg' }"
|
:avatar="{ src: item.avatar ? item.avatar : 'https://file.wsdns.cn/20230217/c8a5c699b3174866a36dd6d378a09bb9.jpg' }"
|
||||||
>
|
>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<template v-for="(role,index) in loginUser.roles" :key="index">
|
<template v-for="(role,index) in loginUser.roles" :key="index">
|
||||||
|
|||||||
@@ -115,7 +115,7 @@
|
|||||||
<a-page-header
|
<a-page-header
|
||||||
:title="item.nickname"
|
:title="item.nickname"
|
||||||
:sub-title="`${item.createTime}`"
|
:sub-title="`${item.createTime}`"
|
||||||
:avatar="{ src: item.avatar ? item.avatar : 'https://file.gxwebsoft.com/20230217/c8a5c699b3174866a36dd6d378a09bb9.jpg' }"
|
:avatar="{ src: item.avatar ? item.avatar : 'https://file.wsdns.cn/20230217/c8a5c699b3174866a36dd6d378a09bb9.jpg' }"
|
||||||
>
|
>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<a-button key="2" href="#bottom" @click="onReply(item)">回复</a-button>
|
<a-button key="2" href="#bottom" @click="onReply(item)">回复</a-button>
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
<a-page-header
|
<a-page-header
|
||||||
:title="item.nickname"
|
:title="item.nickname"
|
||||||
:sub-title="`${item.createTime}`"
|
:sub-title="`${item.createTime}`"
|
||||||
:avatar="{ src: item.avatar ? item.avatar : 'https://file.gxwebsoft.com/20230217/c8a5c699b3174866a36dd6d378a09bb9.jpg' }"
|
:avatar="{ src: item.avatar ? item.avatar : 'https://file.wsdns.cn/20230217/c8a5c699b3174866a36dd6d378a09bb9.jpg' }"
|
||||||
>
|
>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<template v-for="(role,index) in loginUser.roles" :key="index">
|
<template v-for="(role,index) in loginUser.roles" :key="index">
|
||||||
|
|||||||
@@ -283,7 +283,7 @@
|
|||||||
ref="tableRef2"
|
ref="tableRef2"
|
||||||
:pagination="true"
|
:pagination="true"
|
||||||
>
|
>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record, index }">
|
||||||
<template v-if="column.key === 'orderNo'">
|
<template v-if="column.key === 'orderNo'">
|
||||||
<span
|
<span
|
||||||
:class="[record.isAdminRenew === 1 ? 'ele-text-primary' : '']"
|
:class="[record.isAdminRenew === 1 ? 'ele-text-primary' : '']"
|
||||||
@@ -300,17 +300,33 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'expirationTime'">
|
<template v-if="column.key === 'expirationTime'">
|
||||||
<div>{{ record.startTime }}</div>
|
<div>
|
||||||
<div>{{ record.expirationTime }}</div>
|
<a-date-picker
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
@change="changeData(record, 'startTime')"
|
||||||
|
class="ele-fluid"
|
||||||
|
placeholder="请选择时间"
|
||||||
|
v-model:value="record.startTime"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a-date-picker
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
@change="changeData(record, 'expirationTime')"
|
||||||
|
class="ele-fluid"
|
||||||
|
placeholder="请选择时间"
|
||||||
|
v-model:value="record.expirationTime"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'expirationDay'">
|
<template v-if="column.key === 'expirationDay'">
|
||||||
<span
|
<span
|
||||||
class="ele-text-danger"
|
class="ele-text-danger"
|
||||||
v-if="expirationDay(record).includes('逾期')"
|
v-if="expirationDay(record, index).includes('逾期')"
|
||||||
>{{ expirationDay(record) }}</span
|
>{{ expirationDay(record, index) }}</span
|
||||||
>
|
>
|
||||||
<span class="ele-text-success" v-else>{{
|
<span class="ele-text-success" v-else>{{
|
||||||
expirationDay(record)
|
expirationDay(record, index)
|
||||||
}}</span>
|
}}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -444,13 +460,13 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, reactive, watch } from 'vue';
|
import { ref, reactive, watch } from 'vue';
|
||||||
import { Form } from 'ant-design-vue';
|
import { Form, message } from 'ant-design-vue';
|
||||||
import { assignObject, EleProTable, timeAgo } from 'ele-admin-pro';
|
import { assignObject, EleProTable, timeAgo } from 'ele-admin-pro';
|
||||||
import { useThemeStore } from '@/store/modules/theme';
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
import { formatNumber } from 'ele-admin-pro/es';
|
import { formatNumber } from 'ele-admin-pro/es';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { copyText } from '@/utils/common';
|
import { copyText } from '@/utils/common';
|
||||||
import { Order } from '@/api/order/model';
|
import { Order, OrderPay } from '@/api/order/model';
|
||||||
import OrderXufei from '../components/order-xufei.vue';
|
import OrderXufei from '../components/order-xufei.vue';
|
||||||
import { listEquipmentOrderGoods } from '@/api/apps/equipment/order/goods';
|
import { listEquipmentOrderGoods } from '@/api/apps/equipment/order/goods';
|
||||||
import { EquipmentOrderGoods } from '@/api/apps/equipment/order/goods/model';
|
import { EquipmentOrderGoods } from '@/api/apps/equipment/order/goods/model';
|
||||||
@@ -460,7 +476,7 @@
|
|||||||
ColumnItem,
|
ColumnItem,
|
||||||
DatasourceFunction
|
DatasourceFunction
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
import { listOrder, listOrderPay } from '@/api/order';
|
import { listOrder, listOrderPay, updateOrderPay } from '@/api/order';
|
||||||
import { CopyOutlined } from '@ant-design/icons-vue';
|
import { CopyOutlined } from '@ant-design/icons-vue';
|
||||||
import { EquipmentRecord } from '@/api/apps/equipment/record/model';
|
import { EquipmentRecord } from '@/api/apps/equipment/record/model';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
@@ -795,7 +811,8 @@
|
|||||||
const getEquipmentRecordList = () => {
|
const getEquipmentRecordList = () => {
|
||||||
EquipmentRecordApi.pageEquipmentRecord({
|
EquipmentRecordApi.pageEquipmentRecord({
|
||||||
orderId: order.orderId,
|
orderId: order.orderId,
|
||||||
userId: order.userId
|
userId: order.userId,
|
||||||
|
limit: 100
|
||||||
}).then((data) => {
|
}).then((data) => {
|
||||||
EquipmentRecordList.value = data.list;
|
EquipmentRecordList.value = data.list;
|
||||||
});
|
});
|
||||||
@@ -818,13 +835,18 @@
|
|||||||
// });
|
// });
|
||||||
// };
|
// };
|
||||||
|
|
||||||
const expirationDay = (order) => {
|
const expirationDay = (order, index) => {
|
||||||
if (dayjs(order.expirationTime).isBefore(dayjs())) {
|
if (dayjs(order.expirationTime).isBefore(dayjs())) {
|
||||||
|
if (index === 0) {
|
||||||
|
const useDay = dayjs().diff(dayjs(order.expirationTime), 'd');
|
||||||
|
return `逾期${useDay}天`;
|
||||||
|
} else {
|
||||||
const useDay = dayjs(order.expirationTime).diff(
|
const useDay = dayjs(order.expirationTime).diff(
|
||||||
dayjs(props?.data?.payTime),
|
dayjs(props?.data?.payTime),
|
||||||
'd'
|
'd'
|
||||||
);
|
);
|
||||||
return `使用${useDay}天`;
|
return `使用${useDay}天`;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const day = dayjs(order.expirationTime).diff(dayjs(order.payTime), 'd');
|
const day = dayjs(order.expirationTime).diff(dayjs(order.payTime), 'd');
|
||||||
if (day < 0) {
|
if (day < 0) {
|
||||||
@@ -865,6 +887,11 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const changeData = async (data: OrderPay) => {
|
||||||
|
await updateOrderPay(data);
|
||||||
|
message.success('保存成功');
|
||||||
|
};
|
||||||
|
|
||||||
/* 保存编辑 */
|
/* 保存编辑 */
|
||||||
const save = () => {};
|
const save = () => {};
|
||||||
|
|
||||||
@@ -884,6 +911,7 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
resetFields();
|
resetFields();
|
||||||
|
emit('done')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user