This commit is contained in:
2025-08-25 15:12:09 +08:00
parent b9413abf93
commit 1096c6f2de
33 changed files with 1696 additions and 875 deletions
@@ -130,7 +130,7 @@ const search = () => {
const [d1, d2] = dateRange.value ?? [];
xlsFileName.value = `${d1}至${d2}`;
where.timeStart = d1 ? dayjs(d1).valueOf() / 1000 : undefined;
where.timeEnd = d2 ? dayjs(d2).valueOf() / 1000 : undefined;
where.timeEnd = d2 ? dayjs(d2 + ' 23:59:59').valueOf() / 1000 : undefined;
// where.createTimeStart = d1 ? d1 + ' 00:00:00' : undefined;
// where.createTimeEnd = d2 ? d2 + ' 00:00:00' : undefined;
emit("search", {
@@ -4,25 +4,44 @@
:visible="visible"
:confirm-loading="loading"
title="订单列表"
:body-style="{ paddingBottom: '8px', background: '#f3f3f3' }"
:body-style="{ paddingBottom: '8px', background: '#f3f3f3',}"
@update:visible="updateVisible"
:maskClosable="false"
:footer="null"
>
<a-card :bordered="false" :body-style="{ padding: '16px' }">
<a-radio-group v-model:value="orderType" v-if="showType" @change="changeOrderType">
<a-radio-button value="order">订场订场</a-radio-button>
<a-radio-button value="usersVip">会员卡购买</a-radio-button>
</a-radio-group>
<a-radio-group v-model:value="orderType" v-if="showCardType" @change="changeOrderType">
<a-radio-button value="order">订场订单</a-radio-button>
<a-radio-button value="usersCard">实体卡购买</a-radio-button>
<a-radio-button value="usersCardCharge">实体卡续卡</a-radio-button>
</a-radio-group>
<ele-pro-table
v-if="orderType === 'order'"
ref="tableRef"
row-key="id"
:columns="columns"
:datasource="datasource"
:customRow="customRow"
:scroll="{ x: 800 }"
:scroll="{ x: 800, y: tableHeight}"
tool-class="ele-toolbar-form"
class="sys-org-table"
height="50vh"
>
<template #toolbar>
<a-input v-model:value="keywords" allow-clear @input="reload" style="width: 300px;"
placeholder="姓名/手机号搜索"></a-input>
<a-space>
<span class="font-bold text-red-400">本页合计金额: {{ total }}元</span>
<a-input v-model:value="keywords" allow-clear @input="reload" style="width: 300px;"
placeholder="姓名/手机号搜索"></a-input>
<a-select v-model:value="orderStatus" placeholder="订单状态刷新" style="width: 300px" @change="reload()">
<a-select-option value="1,2,6">全部状态</a-select-option>
<a-select-option value="1">已完成</a-select-option>
<a-select-option value="2">未使用</a-select-option>
<a-select-option value="6">退款成功</a-select-option>
</a-select>
</a-space>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'image'">
@@ -105,30 +124,6 @@
<span></span>
</template>
</template>
<template v-if="column.key === 'payStatus'">
<a-tag v-if="record.payStatus == 2" color="error">
<CloseOutlined class="tag-icon" />
未付款
</a-tag>
<a-tag v-if="record.payStatus == 1" color="green">
<CheckOutlined class="tag-icon" />
已付款
</a-tag>
<a-tag
v-if="record.payStatus == 3 || record.payStatus == 0"
color="cyan">
<CoffeeOutlined class="tag-icon" />
未付款,占场中
</a-tag>
</template>
<template v-if="column.key === 'orderInfo'">
{{ record.orderInfoList }}
</template>
<template v-if="column.key === 'status'">
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
</template>
<template v-if="column.key === 'code'">
<span v-if="record.card">{{ record.card.code }}</span>
<span v-if="record.thinkVip">{{ record.thinkVip.code }}</span>
@@ -139,6 +134,76 @@
}}</span>
</template>
</template>
</ele-pro-table>
<ele-pro-table
v-else-if="orderType === 'usersVip'"
ref="usersVipTableRef"
row-key="id"
:columns="columns1"
:datasource="datasource1"
:scroll="{ x: 800, y: tableHeight }"
height="50vh"
>
<template #toolbar>
<a-space>
<span class="font-bold text-red-400">本页合计金额: {{ total }}元</span>
<a-input v-model:value="keywords" allow-clear @input="reload" style="width: 300px;"
placeholder="姓名/手机号搜索"></a-input>
</a-space>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'dateTime'">
<div>{{ record.siteName }}</div>
<div>{{ record.dateTime }} ¥{{ record.totalPrice }}元</div>
</template>
</template>
</ele-pro-table>
<ele-pro-table
v-else-if="orderType === 'usersCard'"
ref="cardTableRef"
row-key="id"
:columns="columns2"
:datasource="datasource2"
:scroll="{ x: 800, y: tableHeight }"
height="50vh"
>
<template #toolbar>
<a-space>
<span class="font-bold text-red-400">本页合计金额: {{ total }}元</span>
<a-input v-model:value="keywords" allow-clear @input="reload" style="width: 300px;"
placeholder="卡号搜索"></a-input>
</a-space>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'dateTime'">
<div>{{ record.siteName }}</div>
<div>{{ record.dateTime }} ¥{{ record.totalPrice }}元</div>
</template>
</template>
</ele-pro-table>
<ele-pro-table
v-else-if="orderType === 'usersCardCharge'"
ref="usersCardChargeTableRef"
row-key="id"
:columns="columns3"
:datasource="datasource3"
:scroll="{ x: 800, y: tableHeight }"
height="50vh"
>
<template #toolbar>
<a-space>
<span class="font-bold text-red-400">本页合计金额: {{ total }}元</span>
<a-input v-model:value="keywords" allow-clear @input="reload" style="width: 300px;"
placeholder="姓名/手机号搜索"></a-input>
</a-space>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'dateTime'">
<div>{{ record.siteName }}</div>
<div>{{ record.dateTime }} ¥{{ record.totalPrice }}元</div>
</template>
</template>
</ele-pro-table>
</a-card>
</ele-modal>
@@ -147,8 +212,6 @@
<script lang="ts" setup>
import { ref } from "vue";
import {
CheckOutlined,
CloseOutlined,
AlipayCircleOutlined
} from "@ant-design/icons-vue";
import { EleProTable, toDateString } from "ele-admin-pro";
@@ -165,13 +228,24 @@ import type {
} from "@/api/think/thinkOrder/model";
import { formatNumber } from "ele-admin-pro/es";
import dayjs from "dayjs";
import { pageThinkRechargeLog } from "@/api/think/thinkRechargeLog";
import { ThinkRechargeLogParam } from "@/api/think/thinkRechargeLog/model";
import { pageThinkCard } from "@/api/think/thinkCard";
import { ThinkCardParam } from "@/api/think/thinkCard/model";
import { ThinkCardLogParam } from "@/api/think/thinkCardLog/model";
import { pageThinkCardLog } from "@/api/think/thinkCardLog";
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
sid: number;
createTimeStart: number;
createTimeEnd: number;
showType: boolean;
showCardType: boolean;
createTimeStart: string;
createTimeEnd: string;
wechatOrder: string;
type: number;
isPayTime: boolean;
payType: number[];
}>();
@@ -183,6 +257,8 @@ const updateVisible = (value: boolean) => {
emit("update:visible", value);
};
const orderType = ref("order");
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -191,15 +267,21 @@ const selection = ref<ThinkOrder[]>([]);
// 加载状态
const loading = ref(true);
const tableHeight = document.body.clientHeight;
console.log('tableHeight', tableHeight)
const keywords = ref();
const total = ref();
// 表格数据源
const datasource: DatasourceFunction = ({
page,
limit,
where,
orders,
filters
}) => {
const orderStatus = ref("1,2,6");
const datasource: DatasourceFunction = async ({
page,
limit,
where,
orders,
filters
}) => {
if (filters) {
where.status = filters.status;
}
@@ -207,18 +289,30 @@ const datasource: DatasourceFunction = ({
where.keywords = keywords.value;
}
where.payTypeList = props.payType.join();
if (where.payTypeList === "1,3,5") where.wechatInPos = true;
where.payStatus = 1;
where.forAdmin = true;
if (props.type === 1) where.isUseTime = true;
where.sid = props.sid;
where.createTimeStart = props.createTimeStart;
where.createTimeEnd = props.createTimeEnd;
console.log(where, props.sid)
return pageThinkOrder({
where.orderStatusList = orderStatus.value;
where.wechatOrder = props.wechatOrder;
if (props.isPayTime) {
where.payTimeStart = dayjs(props.createTimeStart).unix();
where.payTimeEnd = dayjs(props.createTimeEnd).unix();
} else {
where.createTimeStart = dayjs(props.createTimeStart).unix();
where.createTimeEnd = dayjs(props.createTimeEnd).unix();
}
const res = await pageThinkOrder({
...where,
...orders,
page,
limit
});
// console.log(res)
total.value = 0;
if (res.list !== null && res.list.length > 0) total.value = res.list.reduce((acc, cur) => acc + cur.payPrice, 0);
return res;
};
// 表格列配置
@@ -226,9 +320,123 @@ const columns = ref<ColumnItem[]>([
{
title: "场馆名称",
dataIndex: "siteName",
key: "iod",
fixed: "left",
width: 90
},
{
title: "订单号",
fixed: "left",
dataIndex: "orderNum",
width: 200,
},
{
title: "凭证号",
fixed: "left",
dataIndex: "wechatOrder",
width: 200,
},
{
title: "订单状态",
width: 100,
fixed: "left",
dataIndex: "orderStatus",
customRender: ({ text }) => ["", "已完成", "未使用", "已取消", "退款申请中", "退款被拒绝", "退款成功", "客户端申请退款"][text]
},
{
title: "金额",
dataIndex: "payPrice",
width: 90,
key: "payPrice",
align: "center",
sorter: true,
fixed: "left",
customRender: ({ text }) => `¥${formatNumber(text)}`
},
{
title: "下单时间",
width: 120,
dataIndex: "createTime",
align: "center",
customRender: ({ text }) => toDateString(text, "yyyy-MM-dd HH:mm:ss")
},
{
title: "支付时间",
dataIndex: "payTime",
width: 120,
align: "center",
customRender: ({ text }) => toDateString(text, "yyyy-MM-dd HH:mm:ss")
},
{
title: "用场时间",
width: 180,
dataIndex: "dateTime",
align: "center"
},
{
title: "手机号",
dataIndex: "phone",
key: "phone",
width: 120,
align: "center"
},
{
title: "实际转账单位/个人",
dataIndex: "name",
width: 120,
key: "name",
align: "center"
},
{
title: "支付方式",
dataIndex: "payType",
width: 100,
key: "payType",
align: "center"
},
{
title: "预付卡号",
width: 120,
key: "code",
align: "center"
},
{
title: "预付卡到期时间",
key: "expiredTime",
width: 120,
align: "center",
sorter: true
}
]);
const changeOrderType = () => {
if (orderType.value === "order") reload();
else if (orderType.value === "usersVip") vipReload();
else if (orderType.value === "usersCard") cardReload();
else if (orderType.value === "usersCardCharge") usersCardChargeReload();
};
/* 搜索 */
const reload = (where?: ThinkOrderParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
};
/* 查询 */
const query = () => {
loading.value = true;
};
query();
const columns1 = ref<ColumnItem[]>([
{
title: "卡类型",
dataIndex: "vipName"
},
{
title: "姓名",
dataIndex: "realName",
align: "center"
},
{
title: "下单时间",
dataIndex: "createTime",
@@ -243,71 +451,183 @@ const columns = ref<ColumnItem[]>([
align: "center"
},
{
title: "实际转账单位/个人",
dataIndex: "name",
key: "name",
align: "center"
},
{
title: "价格",
dataIndex: "totalPrice",
title: "金额",
dataIndex: "money",
key: "totalPrice",
align: "center",
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
},
{
title: "积分",
dataIndex: "totalPrice",
key: "totalPrice",
title: "状态",
dataIndex: "status",
align: "center",
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
},
{
title: "支付方式",
dataIndex: "payType",
key: "payType",
align: "center"
},
{
title: "预付卡号",
key: "code",
align: "center"
},
{
title: "预付卡到期时间",
key: "expiredTime",
align: "center",
sorter: true
customRender: ({ text }) => ["", "已支付", "待支付", "已退款"][text]
}
]);
/* 搜索 */
const reload = (where?: ThinkOrderParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
const datasource1: DatasourceFunction = async ({
page,
limit,
where,
orders
}) => {
if (keywords.value) {
where.keywords = keywords.value;
}
where.statusList = "1,3";
where.sid = props.sid;
where.createTimeStart = dayjs(props.createTimeStart).unix();
where.createTimeEnd = dayjs(props.createTimeEnd).unix();
const res = await pageThinkRechargeLog({
...where,
...orders,
page,
limit
});
total.value = 0;
if (res.list != null && res.list.length > 0) total.value = res.list.reduce((acc, cur) => acc + cur.money, 0);
return res;
};
/* 查询 */
const query = () => {
loading.value = true;
const usersVipTableRef = ref<InstanceType<typeof EleProTable> | null>(null);
const vipReload = (where?: ThinkRechargeLogParam) => {
usersVipTableRef?.value?.reload({ where: where });
};
/* 自定义行属性 */
const customRow = (record: ThinkOrder) => {
return {
// 行点击事件
onClick: () => {
// console.log(record);
},
// 行双击事件
onDblclick: () => {
openEdit(record);
}
};
const columns2 = ref<ColumnItem[]>([
{
title: "卡类型",
dataIndex: ["thinkVip", "name"]
},
{
title: "姓名",
dataIndex: "username",
align: "center"
},
{
title: "下单时间",
dataIndex: "createTime",
align: "center",
customRender: ({ text }) => toDateString(text, "yyyy-MM-dd HH:mm:ss")
},
{
title: "手机号",
dataIndex: "phone",
key: "phone",
width: 120,
align: "center"
},
{
title: "金额",
dataIndex: "price",
align: "center",
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
}
]);
const datasource2: DatasourceFunction = async ({
page,
limit,
where,
orders
}) => {
console.log("here");
if (keywords.value) {
where.keywords = keywords.value;
}
where.sid = props.sid;
where.status = 1;
where.createTimeStart = dayjs(props.createTimeStart).unix();
where.createTimeEnd = dayjs(props.createTimeEnd).unix();
let payTypeList = props.payType;
if (payTypeList.includes(1) && payTypeList.includes(3) && payTypeList.includes(5)) payTypeList = [1, 2, 4];
if (payTypeList.length === 1 && payTypeList[0] === 4) payTypeList = [3];
if (payTypeList.length === 1 && payTypeList[0] === 18) payTypeList = [6];
where.payTypeList = payTypeList.join();
where.notChangeCard = true;
const res = await pageThinkCard({
...where,
...orders,
page,
limit
});
total.value = 0;
if (res.list != null && res.list.length > 0) total.value = res.list.reduce((acc, cur) => acc + cur.price, 0);
return res;
};
query();
const cardTableRef = ref<InstanceType<typeof EleProTable> | null>(null);
const cardReload = (where?: ThinkCardParam) => {
cardTableRef?.value?.reload({ where: where });
};
const columns3 = ref<ColumnItem[]>([
{
title: "卡类型",
dataIndex: ["thinkCard", "name"]
},
{
title: "姓名",
dataIndex: "username",
align: "center"
},
{
title: "下单时间",
dataIndex: "createTime",
align: "center",
customRender: ({ text }) => toDateString(text, "yyyy-MM-dd HH:mm:ss")
},
{
title: "手机号",
dataIndex: "phone",
key: "phone",
width: 120,
align: "center"
},
{
title: "金额",
dataIndex: "money",
align: "center",
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
}
]);
const datasource3: DatasourceFunction = async ({
page,
limit,
where,
orders
}) => {
if (keywords.value) {
where.keywords = keywords.value;
}
where.createTimeStart = dayjs(props.createTimeStart).unix();
where.createTimeEnd = dayjs(props.createTimeEnd).unix();
let payTypeList = props.payType;
if (payTypeList.includes(1) && payTypeList.includes(3) && payTypeList.includes(5)) payTypeList = [1, 2, 4];
if (payTypeList.length === 1 && payTypeList[0] === 4) payTypeList = [3];
if (props.sid) where.sid = props.sid;
where.payTypeList = payTypeList.join();
const res = await pageThinkCardLog({
...where,
...orders,
page,
limit
});
total.value = 0;
if (res.list != null && res.list.length > 0) total.value = res.list.reduce((acc, cur) => acc + cur.money, 0);
return res;
};
const usersCardChargeTableRef = ref<InstanceType<typeof EleProTable> | null>(null);
const usersCardChargeReload = (where?: ThinkCardLogParam) => {
usersCardChargeTableRef?.value?.reload({ where: where });
};
</script>
<script lang="ts">
+68 -11
View File
@@ -27,13 +27,14 @@
</a-card>
</div>
<OrderList v-model:visible="showList" v-if="showList" :pay-type="payTypeList" :sid="sid"
:create-time-start="createTimeStart"
:showType="showType" :showCardType="showCardType" :type="type" :isPayTime="type === 0"
:create-time-start="createTimeStart" :wechat-order="wechatOrder"
:create-time-end="createTimeEnd" />
</div>
</template>
<script lang="ts" setup>
import { createVNode, ref } from "vue";
import { ref } from "vue";
import type {
ColumnItem
} from "ele-admin-pro/es/ele-pro-table/types";
@@ -42,15 +43,17 @@ import {
getThinkOrderExcelData, getThinkOrderExcelDataForCard
} from "@/api/think/thinkOrder";
import type {
ThinkOrder, ThinkOrderParam
ThinkOrderParam
} from "@/api/think/thinkOrder/model";
import OrderList from "./components/OrderList.vue";
import dayjs from "dayjs";
// 加载状态
const loading = ref(true);
const showType = ref(false);
const showCardType = ref(false);
const type = ref(0);
const type = ref<number>(0);
const changeType = (val) => {
type.value = val;
getList();
@@ -84,6 +87,7 @@ createTimeEnd.value = dayjs().format("YYYY-MM-DD 23:59:59");
getList();
const sid = ref<number>(0);
const wechatOrder = ref<string>("");
const columns1 = ref<ColumnItem[]>([
{
title: "场馆名称",
@@ -98,9 +102,12 @@ const columns1 = ref<ColumnItem[]>([
customCell: (row) => {
return {
onClick: () => {
console.log(row);
sid.value = row.sid;
wechatOrder.value = "";
payTypeList.value = [8, 11];
showList.value = true;
showType.value = false;
showCardType.value = false;
}
};
}
@@ -111,9 +118,12 @@ const columns1 = ref<ColumnItem[]>([
customCell: (row) => {
return {
onClick: () => {
console.log(row);
sid.value = row.sid;
wechatOrder.value = "";
payTypeList.value = [6, 7, 9, 10, 16, 17];
showList.value = true;
showType.value = false;
showCardType.value = false;
}
};
}
@@ -124,17 +134,31 @@ const columns1 = ref<ColumnItem[]>([
customCell: (row) => {
return {
onClick: () => {
console.log(row);
wechatOrder.value = "";
sid.value = row.sid;
payTypeList.value = [13, 14];
showList.value = true;
showType.value = false;
showCardType.value = false;
}
};
}
},
{
title: "散客订单",
dataIndex: "guest",
customRender: () => 0
dataIndex: "guestIncome",
customCell: (row) => {
return {
onClick: () => {
wechatOrder.value = "";
sid.value = row.sid;
payTypeList.value = [1, 4, 5];
showList.value = true;
showType.value = false;
showCardType.value = false;
}
};
}
},
{
title: "其他",
@@ -143,8 +167,12 @@ const columns1 = ref<ColumnItem[]>([
return {
onClick: () => {
console.log(row);
sid.value = row.sid;
wechatOrder.value = "";
payTypeList.value = [2, 3, 12, 15];
showList.value = true;
showType.value = false;
showCardType.value = false;
}
};
}
@@ -173,8 +201,11 @@ const columns = ref<ColumnItem[]>([
return {
onClick: () => {
sid.value = row.sid;
wechatOrder.value = "420000";
payTypeList.value = [1];
showList.value = true;
showType.value = true;
showCardType.value = false;
}
};
}
@@ -196,9 +227,12 @@ const columns = ref<ColumnItem[]>([
customCell: (row) => {
return {
onClick: () => {
wechatOrder.value = "";
sid.value = row.sid;
payTypeList.value = [5];
payTypeList.value = [1, 3, 5];
showList.value = true;
showType.value = false;
showCardType.value = true;
}
};
}
@@ -209,9 +243,12 @@ const columns = ref<ColumnItem[]>([
customCell: (row) => {
return {
onClick: () => {
wechatOrder.value = "";
sid.value = row.sid;
payTypeList.value = [18];
showList.value = true;
showType.value = false;
showCardType.value = true;
}
};
}
@@ -222,9 +259,27 @@ const columns = ref<ColumnItem[]>([
customCell: (row) => {
return {
onClick: () => {
wechatOrder.value = "";
sid.value = row.sid;
payTypeList.value = [4];
showList.value = true;
showType.value = false;
showCardType.value = true;
}
};
}
},
{
title: "未支付已使用",
dataIndex: "unPaidUsed",
customCell: (row) => {
return {
onClick: () => {
wechatOrder.value = "";
sid.value = row.sid;
payTypeList.value = [4];
showList.value = true;
showType.value = false;
}
};
}
@@ -235,9 +290,11 @@ const columns = ref<ColumnItem[]>([
customCell: (row) => {
return {
onClick: () => {
wechatOrder.value = "";
sid.value = row.sid;
payTypeList.value = [2, 3, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17];
payTypeList.value = [2, 12];
showList.value = true;
showType.value = false;
}
};
}