新增:VIP卡的上架下架功能、及是否有效属性

This commit is contained in:
2025-04-21 21:48:26 +08:00
parent e5a28615e8
commit 90c79c16cb
8 changed files with 804 additions and 719 deletions
+2 -2
View File
@@ -2,10 +2,10 @@ VITE_APP_NAME=后台管理系统
VITE_SOCKET_URL=wss://server.gxwebsoft.com VITE_SOCKET_URL=wss://server.gxwebsoft.com
VITE_SERVER_URL=https://gxtyzx-server.websoft.top/api VITE_SERVER_URL=https://gxtyzx-server.websoft.top/api
VITE_API_URL=https://gxtyzx-modules.websoft.top/api VITE_API_URL=https://gxtyzx-modules.websoft.top/api
VITE_THINK_URL=https://gxtyzx-api2.websoft.top/api #VITE_THINK_URL=https://gxtyzx-api2.websoft.top/api
#VITE_SERVER_URL=http://127.0.0.1:30000/api #VITE_SERVER_URL=http://127.0.0.1:30000/api
#VITE_API_URL=http://127.0.0.1:9002/api #VITE_API_URL=http://127.0.0.1:9002/api
#VITE_THINK_URL=http://127.0.0.1:9099/api VITE_THINK_URL=http://127.0.0.1:9099/api
#/booking/bookingItem #/booking/bookingItem
+5
View File
@@ -47,6 +47,8 @@ export interface ThinkVip {
updateTime?: number; updateTime?: number;
// 是否有效:1是,0否 // 是否有效:1是,0否
isUse?: number; isUse?: number;
// 是否销售:1是,0否
isSale?: number;
} }
/** /**
@@ -54,7 +56,10 @@ export interface ThinkVip {
*/ */
export interface ThinkVipParam{ export interface ThinkVipParam{
id?: number; id?: number;
isSale?: number;
createTimeStart?: number; createTimeStart?: number;
createTimeEnd?: number; createTimeEnd?: number;
timeStart?: number;
timeEnd?: number;
keywords?: string; keywords?: string;
} }
+250 -241
View File
@@ -31,8 +31,13 @@
</template> </template>
<template v-if="column.key === 'info'"> <template v-if="column.key === 'info'">
<span v-if="record.itype !== 4">{{ record.info }}</span> <span v-if="record.itype !== 4">{{ record.info }}</span>
<span v-else>开票金额:{{ record.price }}元,租赁面积:{{ record.size }}㎡,租赁时间:{{ record.rentStartDate <span v-else
}}~{{ record.rentEndDate }}</span> >开票金额:{{ record.price }}元,租赁面积:{{
record.size
}}㎡,租赁时间:{{ record.rentStartDate }}~{{
record.rentEndDate
}}</span
>
</template> </template>
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<a-space v-if="record.isOpen === 1"> <a-space v-if="record.isOpen === 1">
@@ -52,7 +57,9 @@
<a-divider type="vertical" /> <a-divider type="vertical" />
<a class="ele-text-danger" @click="refuse(record)">拒绝</a> <a class="ele-text-danger" @click="refuse(record)">拒绝</a>
</a-space> </a-space>
<span v-if="record.status === 2" class="ele-text-danger">已拒绝</span> <span v-if="record.status === 2" class="ele-text-danger"
>已拒绝</span
>
</template> </template>
</template> </template>
</ele-pro-table> </ele-pro-table>
@@ -69,254 +76,256 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { createVNode, ref } from "vue"; import { createVNode, ref } from 'vue';
import { message, Modal } from "ant-design-vue"; import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from "@ant-design/icons-vue"; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from "ele-admin-pro"; import type { EleProTable } from 'ele-admin-pro';
import { toDateString } from "ele-admin-pro"; import { toDateString } from 'ele-admin-pro';
import type { import type {
DatasourceFunction, DatasourceFunction,
ColumnItem ColumnItem
} from "ele-admin-pro/es/ele-pro-table/types"; } from 'ele-admin-pro/es/ele-pro-table/types';
import Search from "./components/search.vue"; import Search from './components/search.vue';
import ThinkInvoiceEdit from "./components/thinkInvoiceEdit.vue"; import ThinkInvoiceEdit from './components/thinkInvoiceEdit.vue';
import { import {
pageThinkInvoice, pageThinkInvoice,
removeThinkInvoice, removeThinkInvoice,
removeBatchThinkInvoice, updateThinkInvoice, doInvoice removeBatchThinkInvoice,
} from "@/api/think/thinkInvoice"; updateThinkInvoice,
import type { doInvoice
ThinkInvoice, } from '@/api/think/thinkInvoice';
ThinkInvoiceParam import type {
} from "@/api/think/thinkInvoice/model"; ThinkInvoice,
import * as InvoiceApi from "@/api/think/thinkInvoice"; ThinkInvoiceParam
} from '@/api/think/thinkInvoice/model';
import * as InvoiceApi from '@/api/think/thinkInvoice';
// 表格实例 // 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null); const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格选中数据 // 表格选中数据
const selection = ref<ThinkInvoice[]>([]); const selection = ref<ThinkInvoice[]>([]);
// 当前编辑数据 // 当前编辑数据
const current = ref<ThinkInvoice | null>(null); const current = ref<ThinkInvoice | null>(null);
// 是否显示编辑弹窗 // 是否显示编辑弹窗
const showEdit = ref(false); const showEdit = ref(false);
// 是否显示批量移动弹窗 // 是否显示批量移动弹窗
const showMove = ref(false); const showMove = ref(false);
// 加载状态 // 加载状态
const loading = ref(true); const loading = ref(true);
// 表格数据源 // 表格数据源
const datasource: DatasourceFunction = ({ const datasource: DatasourceFunction = ({
page,
limit,
where,
orders,
filters
}) => {
if (filters) {
where.status = filters.status;
}
where.forAdmin = true;
return pageThinkInvoice({
...where,
...orders,
page, page,
limit limit,
}); where,
}; orders,
filters
// 表格列配置 }) => {
const columns = ref<ColumnItem[]>([ if (filters) {
{ where.status = filters.status;
title: "操作",
key: "action",
width: 180,
fixed: "left",
align: "center",
hideInSetting: true
},
{
title: "订单号",
dataIndex: "orderNum",
key: "oid",
align: "center"
},
{
title: "公司名称",
dataIndex: "name",
key: "name",
align: "center"
},
{
title: "发票金额",
dataIndex: "price",
key: "price",
align: "center"
},
{
title: "税号",
dataIndex: "code",
key: "code",
align: "center"
},
{
title: "备注信息",
dataIndex: "info",
key: "info",
align: "center"
},
{
title: "是否已开",
dataIndex: "isOpen",
key: "isOpen",
align: "center",
},
{
title: "发票类型",
dataIndex: "type",
key: "type",
align: "center",
customRender: ({ text }) => {
if (text === 1) {
return "电子";
} else {
return "纸质";
}
} }
}, where.forAdmin = true;
{ return pageThinkInvoice({
title: "开票类型", ...where,
dataIndex: "invoicetype", ...orders,
key: "invoicetype", page,
align: "center", limit
customRender: ({ text }) => {
if (text === 1) {
return "普票";
} else {
return "专票";
}
}
},
{
title: "开票时间",
dataIndex: "createTime",
key: "createTime",
align: "center",
sorter: true,
ellipsis: true,
customRender: ({ text }) => toDateString(text, "yyyy-MM-dd HH:mm:ss")
}
]);
/* 搜索 */
const reload = (where?: ThinkInvoiceParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
};
/* 打开编辑弹窗 */
const openEdit = (row?: ThinkInvoice) => {
current.value = row ?? null;
showEdit.value = true;
};
const openInvoicePdf = (row: ThinkInvoice) => {
const hide = message.loading("请求中..", 0);
InvoiceApi.showInvoice(row?.id).then((res) => {
const parse = JSON.parse(res);
const pdfUrl = parse[0].pdfUrl;
hide();
window.open(pdfUrl);
});
};
/* 打开批量移动弹窗 */
const openMove = () => {
showMove.value = true;
};
/* 删除单个 */
const remove = (row: ThinkInvoice) => {
const hide = message.loading("请求中..", 0);
removeThinkInvoice(row.id)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
}); });
};
/* 批量删除 */
const removeBatch = () => {
if (!selection.value.length) {
message.error("请至少选择一条数据");
return;
}
Modal.confirm({
title: "提示",
content: "确定要删除选中的记录吗?",
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
onOk: () => {
const hide = message.loading("请求中..", 0);
removeBatchThinkInvoice(selection.value.map((d) => d.id))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
}
});
};
/* 查询 */
const query = () => {
loading.value = true;
};
const openInvoice = async (row: ThinkInvoice) => {
await doInvoice(row);
message.success("操作成功");
reload();
};
const refuse = async (row: ThinkInvoice) => {
await updateThinkInvoice({
id: row.id,
status: 2
});
message.success("操作成功");
reload();
};
/* 自定义行属性 */
const customRow = (record: ThinkInvoice) => {
return {
// 行点击事件
onClick: () => {
// console.log(record);
},
// 行双击事件
onDblclick: () => {
openEdit(record);
}
}; };
};
query(); // 表格列配置
const columns = ref<ColumnItem[]>([
{
title: '操作',
key: 'action',
width: 180,
fixed: 'left',
align: 'center',
hideInSetting: true
},
{
title: '订单号',
dataIndex: 'orderNum',
key: 'oid',
align: 'center'
},
{
title: '公司名称',
dataIndex: 'name',
key: 'name',
align: 'center'
},
{
title: '发票金额',
dataIndex: 'price',
key: 'price',
align: 'center'
},
{
title: '税号',
dataIndex: 'code',
key: 'code',
align: 'center'
},
{
title: '备注信息',
dataIndex: 'info',
key: 'info',
align: 'center'
},
{
title: '是否已开',
dataIndex: 'isOpen',
key: 'isOpen',
align: 'center'
},
{
title: '发票类型',
dataIndex: 'type',
key: 'type',
align: 'center',
customRender: ({ text }) => {
if (text === 1) {
return '电子';
} else {
return '纸质';
}
}
},
{
title: '开票类型',
dataIndex: 'invoicetype',
key: 'invoicetype',
align: 'center',
customRender: ({ text }) => {
if (text === 1) {
return '普票';
} else {
return '专票';
}
}
},
{
title: '开票时间',
dataIndex: 'createTime',
key: 'createTime',
align: 'center',
sorter: true,
ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
}
]);
/* 搜索 */
const reload = (where?: ThinkInvoiceParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
};
/* 打开编辑弹窗 */
const openEdit = (row?: ThinkInvoice) => {
current.value = row ?? null;
showEdit.value = true;
};
const openInvoicePdf = (row: ThinkInvoice) => {
const hide = message.loading('请求中..', 0);
InvoiceApi.showInvoice(row?.id).then((res) => {
const parse = JSON.parse(res);
const pdfUrl = parse[0].pdfUrl;
hide();
window.open(pdfUrl);
});
};
/* 打开批量移动弹窗 */
const openMove = () => {
showMove.value = true;
};
/* 删除单个 */
const remove = (row: ThinkInvoice) => {
const hide = message.loading('请求中..', 0);
removeThinkInvoice(row.id)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
/* 批量删除 */
const removeBatch = () => {
if (!selection.value.length) {
message.error('请至少选择一条数据');
return;
}
Modal.confirm({
title: '提示',
content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchThinkInvoice(selection.value.map((d) => d.id))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
}
});
};
/* 查询 */
const query = () => {
loading.value = true;
};
const openInvoice = async (row: ThinkInvoice) => {
await doInvoice(row);
message.success('操作成功');
reload();
};
const refuse = async (row: ThinkInvoice) => {
await updateThinkInvoice({
id: row.id,
status: 2
});
message.success('操作成功');
reload();
};
/* 自定义行属性 */
const customRow = (record: ThinkInvoice) => {
return {
// 行点击事件
onClick: () => {
// console.log(record);
},
// 行双击事件
onDblclick: () => {
openEdit(record);
}
};
};
query();
</script> </script>
<script lang="ts"> <script lang="ts">
export default { export default {
name: "ThinkInvoice" name: 'ThinkInvoice'
}; };
</script> </script>
<style lang="less" scoped></style> <style lang="less" scoped></style>
+181 -156
View File
@@ -2,13 +2,23 @@
<template> <template>
<a-space class="flex items-center" :size="10" style="flex-wrap: wrap"> <a-space class="flex items-center" :size="10" style="flex-wrap: wrap">
<span class="text-gray-400">付款状态</span> <span class="text-gray-400">付款状态</span>
<a-select v-model:value="where.payStatus" style="width: 150px" placeholder="付款状态筛选" @change="search"> <a-select
v-model:value="where.payStatus"
style="width: 150px"
placeholder="付款状态筛选"
@change="search"
>
<a-select-option value="">全部</a-select-option> <a-select-option value="">全部</a-select-option>
<a-select-option :value="1">已付款</a-select-option> <a-select-option :value="1">已付款</a-select-option>
<a-select-option :value="2">未付款</a-select-option> <a-select-option :value="2">未付款</a-select-option>
</a-select> </a-select>
<span class="text-gray-400">订单状态</span> <span class="text-gray-400">订单状态</span>
<a-select v-model:value="where.orderStatus" style="width: 150px" placeholder="订单状态筛选" @change="search"> <a-select
v-model:value="where.orderStatus"
style="width: 150px"
placeholder="订单状态筛选"
@change="search"
>
<a-select-option value="">全部</a-select-option> <a-select-option value="">全部</a-select-option>
<a-select-option :value="1">已完成</a-select-option> <a-select-option :value="1">已完成</a-select-option>
<a-select-option :value="2">未使用</a-select-option> <a-select-option :value="2">未使用</a-select-option>
@@ -18,7 +28,12 @@
<a-select-option :value="6">退款成功</a-select-option> <a-select-option :value="6">退款成功</a-select-option>
</a-select> </a-select>
<span class="text-gray-400">付款方式</span> <span class="text-gray-400">付款方式</span>
<a-select v-model:value="where.payType" style="width: 150px" placeholder="付款方式筛选" @change="search"> <a-select
v-model:value="where.payType"
style="width: 150px"
placeholder="付款方式筛选"
@change="search"
>
<a-select-option value="">全部</a-select-option> <a-select-option value="">全部</a-select-option>
<a-select-option :value="1">微信支付</a-select-option> <a-select-option :value="1">微信支付</a-select-option>
<a-select-option :value="2">余额支付</a-select-option> <a-select-option :value="2">余额支付</a-select-option>
@@ -39,7 +54,12 @@
<a-select-option :value="17">IC季卡</a-select-option> <a-select-option :value="17">IC季卡</a-select-option>
</a-select> </a-select>
<span class="text-gray-400">开票状态</span> <span class="text-gray-400">开票状态</span>
<a-select v-model:value="where.isInvoice" style="width: 150px" placeholder="开票状态筛选" @change="search"> <a-select
v-model:value="where.isInvoice"
style="width: 150px"
placeholder="开票状态筛选"
@change="search"
>
<a-select-option value="1">已开票</a-select-option> <a-select-option value="1">已开票</a-select-option>
<a-select-option :value="2">未开票</a-select-option> <a-select-option :value="2">未开票</a-select-option>
<a-select-option :value="3">不能开票</a-select-option> <a-select-option :value="3">不能开票</a-select-option>
@@ -65,7 +85,9 @@
style="width: 380px" style="width: 380px"
/> />
<a-button @click="reset">重置</a-button> <a-button @click="reset">重置</a-button>
<a-button @click="setHasInvoice" :disabled="!selection?.length">设置已开票</a-button> <a-button @click="setHasInvoice" :disabled="!selection?.length"
>设置已开票</a-button
>
<!-- <a-button class="ele-btn-icon" :disabled="loading" @click="handleExport">--> <!-- <a-button class="ele-btn-icon" :disabled="loading" @click="handleExport">-->
<!-- <template #icon>--> <!-- <template #icon>-->
<!-- <download-outlined />--> <!-- <download-outlined />-->
@@ -76,165 +98,168 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import useSearch from "@/utils/use-search"; import useSearch from '@/utils/use-search';
import { ref, watch } from "vue"; import { ref, watch } from 'vue';
import { ThinkOrderInfoParam } from "@/api/think/thinkOrderInfo/model"; import { ThinkOrderInfoParam } from '@/api/think/thinkOrderInfo/model';
import { utils, writeFile } from "xlsx"; import { utils, writeFile } from 'xlsx';
import { message } from "ant-design-vue"; import { message } from 'ant-design-vue';
import { toDateString } from "ele-admin-pro"; import { toDateString } from 'ele-admin-pro';
import dayjs from "dayjs"; import dayjs from 'dayjs';
import { listThinkOrder, updateBatchThinkOrder, updateThinkOrder } from "@/api/think/thinkOrder"; import {
import { ThinkOrder, ThinkOrderParam } from "@/api/think/thinkOrder/model"; listThinkOrder,
import { ThinkSite } from "@/api/think/thinkSite/model"; updateBatchThinkOrder,
updateThinkOrder
} from '@/api/think/thinkOrder';
import { ThinkOrder, ThinkOrderParam } from '@/api/think/thinkOrder/model';
import { ThinkSite } from '@/api/think/thinkSite/model';
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
// 选中的角色 // 选中的角色
selection?: ThinkOrder[]; selection?: ThinkOrder[];
}>(), }>(),
{} {}
); );
const emit = defineEmits<{ const emit = defineEmits<{
(e: "search", where?: ThinkOrderInfoParam): void; (e: 'search', where?: ThinkOrderInfoParam): void;
(e: "add"): void; (e: 'add'): void;
(e: "remove"): void; (e: 'remove'): void;
(e: "advanced"): void; (e: 'advanced'): void;
}>(); }>();
// 表单数据 // 表单数据
const { where, resetFields } = useSearch<ThinkOrderParam>({ const { where, resetFields } = useSearch<ThinkOrderParam>({
sid: undefined, sid: undefined,
siteName: undefined, siteName: undefined,
createTimeStart: undefined, createTimeStart: undefined,
createTimeEnd: undefined, createTimeEnd: undefined,
timeStart: undefined, timeStart: undefined,
timeEnd: undefined, timeEnd: undefined,
categoryId: undefined, categoryId: undefined,
keywords: undefined, keywords: undefined,
payStatus: undefined, payStatus: undefined,
orderStatus: undefined, orderStatus: undefined,
payType: undefined, payType: undefined,
isInvoice: undefined isInvoice: undefined
});
// 请求状态
const loading = ref(false);
// 日期范围选择
const dateRange = ref<[string, string]>(["", ""]);
const orders = ref<ThinkOrder[] | any[]>();
const xlsFileName = ref<string>();
/* 搜索 */
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.createTimeStart = d1 ? d1 + ' 00:00:00' : undefined;
// where.createTimeEnd = d2 ? d2 + ' 00:00:00' : undefined;
emit("search", {
...where
}); });
}; // 请求状态
const loading = ref(false);
// 日期范围选择
const dateRange = ref<[string, string]>(['', '']);
const orders = ref<ThinkOrder[] | any[]>();
const xlsFileName = ref<string>();
const chooseSiteId = (data: ThinkSite) => { /* 搜索 */
where.sid = data.id; const search = () => {
where.siteName = data.name; const [d1, d2] = dateRange.value ?? [];
search(); xlsFileName.value = `${d1}至${d2}`;
}; where.timeStart = d1 ? dayjs(d1).valueOf() / 1000 : undefined;
where.timeEnd = d2 ? dayjs(d2).valueOf() / 1000 : undefined;
// where.createTimeStart = d1 ? d1 + ' 00:00:00' : undefined;
// where.createTimeEnd = d2 ? d2 + ' 00:00:00' : undefined;
emit('search', {
...where
});
};
/* 重置 */ const chooseSiteId = (data: ThinkSite) => {
const reset = () => { where.sid = data.id;
resetFields(); where.siteName = data.name;
search(); search();
}; };
// 导出 /* 重置 */
const handleExport = async () => { const reset = () => {
loading.value = true; resetFields();
const array: (string | number)[][] = [ search();
[ };
"订单号",
"订单编号", // 导出
"姓名", const handleExport = async () => {
"电话号码", loading.value = true;
"预定信息", const array: (string | number)[][] = [
"消费金额", [
"实付金额", '订单号',
"下单日期" '订单编号',
] '姓名',
]; '电话号码',
if (!where.timeStart) { '预定信息',
message.error("请选择导出的开始日期、结束日期,每次最多导出5000条记录"); '消费金额',
return false; '实付金额',
} '下单日期'
await listThinkOrder(where) ]
.then((list) => { ];
orders.value = list; if (!where.timeStart) {
orders.value?.forEach((d: ThinkOrder) => { message.error('请选择导出的开始日期、结束日期,每次最多导出5000条记录');
array.push([ return false;
`${d.id}`, }
`${d.orderNum}`, await listThinkOrder(where)
`${d.name}`, .then((list) => {
`${d.phone}`, orders.value = list;
`${d.siteName} ${d.dateTime} ${d.totalPrice}`, orders.value?.forEach((d: ThinkOrder) => {
`${d.totalPrice}`, array.push([
`${d.payPrice}`, `${d.id}`,
`${toDateString(d.payTime)}` `${d.orderNum}`,
]); `${d.name}`,
}); `${d.phone}`,
const sheetName = `订单数据导出`; `${d.siteName} ${d.dateTime} ${d.totalPrice}`,
const workbook = { `${d.totalPrice}`,
SheetNames: [sheetName], `${d.payPrice}`,
Sheets: {} `${toDateString(d.payTime)}`
}; ]);
const sheet = utils.aoa_to_sheet(array); });
workbook.Sheets[sheetName] = sheet; const sheetName = `订单数据导出`;
// 设置列宽 const workbook = {
sheet["!cols"] = [ SheetNames: [sheetName],
{ wch: 10 }, Sheets: {}
{ wch: 10 }, };
{ wch: 10 }, const sheet = utils.aoa_to_sheet(array);
{ wch: 10 }, workbook.Sheets[sheetName] = sheet;
{ wch: 20 }, // 设置列宽
{ wch: 40 }, sheet['!cols'] = [
{ wch: 10 } { wch: 10 },
]; { wch: 10 },
message.loading("正在导出..."); { wch: 10 },
setTimeout(() => { { wch: 10 },
writeFile( { wch: 20 },
workbook, { wch: 40 },
`${ { wch: 10 }
where.createTimeEnd ? xlsFileName.value + "_" : "" ];
}${sheetName}.xlsx` message.loading('正在导出...');
); setTimeout(() => {
writeFile(
workbook,
`${
where.createTimeEnd ? xlsFileName.value + '_' : ''
}${sheetName}.xlsx`
);
loading.value = false;
}, 2000);
})
.catch((msg) => {
message.error(msg);
loading.value = false; loading.value = false;
}, 2000); })
}) .finally(() => {});
.catch((msg) => { };
message.error(msg);
loading.value = false;
})
.finally(() => {
});
};
const setHasInvoice = async () => { const setHasInvoice = async () => {
const hide = message.loading("请求中..", 0); const hide = message.loading('请求中..', 0);
if (props.selection) { if (props.selection) {
props.selection.filter(item => item.isInvoice === 2).map(async item => { props.selection
item.isInvoice = 1; .filter((item) => item.isInvoice === 2)
await updateThinkOrder(item); .map(async (item) => {
}); item.isInvoice = 1;
await updateThinkOrder(item);
});
}
hide();
message.success('设置成功');
};
} watch(
hide(); () => props.selection,
message.success("设置成功"); () => {}
}; );
watch(
() => props.selection,
() => {
}
);
</script> </script>
+330 -316
View File
@@ -145,8 +145,7 @@
<IdcardOutlined class="tag-icon" /> <IdcardOutlined class="tag-icon" />
IC会员卡 IC会员卡
</a-tag> </a-tag>
<a-tag v-if="record.couponType == 11" color="blue" <a-tag v-if="record.couponType == 11" color="blue">
>
<IdcardOutlined class="tag-icon" /> <IdcardOutlined class="tag-icon" />
免费订单 免费订单
</a-tag> </a-tag>
@@ -178,7 +177,8 @@
</a-tag> </a-tag>
<a-tag <a-tag
v-if="record.payStatus == 3 || record.payStatus == 0" v-if="record.payStatus == 3 || record.payStatus == 0"
color="cyan"> color="cyan"
>
<CoffeeOutlined class="tag-icon" /> <CoffeeOutlined class="tag-icon" />
未付款,占场中 未付款,占场中
</a-tag> </a-tag>
@@ -188,20 +188,29 @@
</template> </template>
<template v-if="column.key === 'orderStatus'"> <template v-if="column.key === 'orderStatus'">
<span v-if="record.orderStatus == 1" class="ele-text-success" <span v-if="record.orderStatus == 1" class="ele-text-success"
>已完成</span> >已完成</span
>
<span v-if="record.orderStatus == 2" class="ele-text-placeholder" <span v-if="record.orderStatus == 2" class="ele-text-placeholder"
>未使用</span> >未使用</span
>
<span v-if="record.orderStatus == 3" class="ele-text-placeholder" <span v-if="record.orderStatus == 3" class="ele-text-placeholder"
>已取消</span> >已取消</span
>
<span v-if="record.orderStatus == 4" class="ele-text-warning" <span v-if="record.orderStatus == 4" class="ele-text-warning"
>退款申请中</span> >退款申请中</span
>
<span v-if="record.orderStatus == 5" class="ele-text-danger" <span v-if="record.orderStatus == 5" class="ele-text-danger"
>退款被拒绝</span> >退款被拒绝</span
<span v-if="record.orderStatus == 6" class="ele-text-heading">退款成功</span> >
<span v-if="record.orderStatus == 6" class="ele-text-heading"
>退款成功</span
>
<span v-if="record.orderStatus == 7" class="ele-text-warning" <span v-if="record.orderStatus == 7" class="ele-text-warning"
>客户端申请退款</span> >客户端申请退款</span
>
<span v-if="record.orderStatus == 9" class="ele-text-warning" <span v-if="record.orderStatus == 9" class="ele-text-warning"
>未完成</span> >未完成</span
>
</template> </template>
<template v-if="column.key === 'isInvoice'"> <template v-if="column.key === 'isInvoice'">
<a-tag <a-tag
@@ -209,14 +218,14 @@
color="green" color="green"
class="cursor-pointer" class="cursor-pointer"
@click="openInvoicePdf(record)" @click="openInvoicePdf(record)"
>已开票 >已开票
</a-tag> </a-tag>
<a-tag <a-tag
v-if="record.isInvoice == 2" v-if="record.isInvoice == 2"
color="red" color="red"
class="cursor-pointer" class="cursor-pointer"
@click="onInvoice(record)" @click="onInvoice(record)"
>未开票 >未开票
</a-tag> </a-tag>
<a-tag v-if="record.isInvoice == 3" color="purple">不能开</a-tag> <a-tag v-if="record.isInvoice == 3" color="purple">不能开</a-tag>
</template> </template>
@@ -228,8 +237,15 @@
<a-space> <a-space>
<a @click="openEdit(record)">详情</a> <a @click="openEdit(record)">详情</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a @click="openRefund(record)" <a
v-if="record.payStatus === 1 && [1, 3].includes(record.payType) && [1, 2].includes(record.orderStatus)">退款</a> @click="openRefund(record)"
v-if="
record.payStatus === 1 &&
[1, 3].includes(record.payType) &&
[1, 2].includes(record.orderStatus)
"
>退款</a
>
</a-space> </a-space>
</template> </template>
</template> </template>
@@ -245,321 +261,319 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { createVNode, ref } from "vue"; import { createVNode, ref } from 'vue';
import { message, Modal } from "ant-design-vue"; import { message, Modal } from 'ant-design-vue';
import { import {
ExclamationCircleOutlined, ExclamationCircleOutlined,
CheckOutlined, CheckOutlined,
CloseOutlined, CloseOutlined,
AlipayCircleOutlined AlipayCircleOutlined
} from "@ant-design/icons-vue"; } from '@ant-design/icons-vue';
import { EleProTable, toDateString } from "ele-admin-pro"; import { EleProTable, toDateString } from 'ele-admin-pro';
import type { import type {
DatasourceFunction, DatasourceFunction,
ColumnItem ColumnItem
} from "ele-admin-pro/es/ele-pro-table/types"; } from 'ele-admin-pro/es/ele-pro-table/types';
import Search from "./components/search.vue"; import Search from './components/search.vue';
import OrderInfo from "./components/orderInfo.vue"; import OrderInfo from './components/orderInfo.vue';
import Invoice from "./components/invoice.vue"; import Invoice from './components/invoice.vue';
import { import {
pageThinkOrder, pageThinkOrder,
removeThinkOrder, removeThinkOrder,
removeBatchThinkOrder removeBatchThinkOrder
} from "@/api/think/thinkOrder"; } from '@/api/think/thinkOrder';
import * as InvoiceApi from "@/api/think/thinkInvoice"; import * as InvoiceApi from '@/api/think/thinkInvoice';
import type { import type {
ThinkOrder, ThinkOrder,
ThinkOrderParam ThinkOrderParam
} from "@/api/think/thinkOrder/model"; } from '@/api/think/thinkOrder/model';
import { formatNumber } from "ele-admin-pro/es"; import { formatNumber } from 'ele-admin-pro/es';
import type { ThinkInvoice } from "@/api/think/thinkInvoice/model"; import type { ThinkInvoice } from '@/api/think/thinkInvoice/model';
import Refund from "@/views/think/thinkOrder/components/refund.vue"; import Refund from '@/views/think/thinkOrder/components/refund.vue';
// 表格实例 // 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null); const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格选中数据 // 表格选中数据
const selection = ref<ThinkOrder[]>([]); const selection = ref<ThinkOrder[]>([]);
// 当前编辑数据 // 当前编辑数据
const current = ref<ThinkOrder | null>(null); const current = ref<ThinkOrder | null>(null);
// 是否显示编辑弹窗 // 是否显示编辑弹窗
const showEdit = ref(false); const showEdit = ref(false);
// 开具发票弹窗 // 开具发票弹窗
const showInvoice = ref(false); const showInvoice = ref(false);
// 是否显示批量移动弹窗 // 是否显示批量移动弹窗
const showMove = ref(false); const showMove = ref(false);
// 加载状态 // 加载状态
const loading = ref(true); const loading = ref(true);
// 表格数据源 // 表格数据源
const datasource: DatasourceFunction = ({ const datasource: DatasourceFunction = ({
page,
limit,
where,
orders,
filters
}) => {
if (filters) {
where.status = filters.status;
}
where.forAdmin = true;
return pageThinkOrder({
...where,
...orders,
page, page,
limit limit,
}); where,
}; orders,
filters
// 表格列配置 }) => {
const columns = ref<ColumnItem[]>([ if (filters) {
{ where.status = filters.status;
},
{
title: "订单号",
dataIndex: "id",
key: "iod",
width: 90
},
{
title: "姓名",
dataIndex: "name",
key: "name",
align: "center"
},
{
title: "手机号",
dataIndex: "phone",
key: "phone",
width: 120,
align: "center"
},
{
title: "预约信息",
dataIndex: "dateTime",
key: "dateTime",
width: 120,
align: "center"
},
{
title: "总额",
dataIndex: "totalPrice",
key: "totalPrice",
align: "center",
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
},
{
title: "减少金额",
dataIndex: "reducePrice",
key: "reducePrice",
align: "center",
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
},
{
title: "实付金额",
dataIndex: "payPrice",
key: "payPrice",
align: "center",
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
},
{
title: "支付方式",
dataIndex: "payType",
key: "payType",
align: "center"
},
{
title: "IC卡号",
dataIndex: "code",
key: "code",
align: "center"
},
{
title: "付款状态",
dataIndex: "payStatus",
key: "payStatus",
sorter: true,
align: "center"
},
{
title: "付款时间",
dataIndex: "payTime",
key: "payTime",
sorter: true,
align: "center",
customRender: ({ text }) => toDateString(text, "yyyy-MM-dd HH:mm:ss")
},
{
title: "订单状态",
dataIndex: "orderStatus",
key: "orderStatus",
align: "center"
},
{
title: "优惠类型",
dataIndex: "couponType",
key: "couponType",
align: "center"
},
{
title: "开票状态",
dataIndex: "isInvoice",
key: "isInvoice",
align: "center",
sorter: true
},
// {
// title: '类型',
// dataIndex: 'type',
// key: 'type',
// align: 'center',
// customRender: ({ text }) =>
// ['商城订单', '客户预定', '俱乐部训练场', '活动订场'][text]
// },
// {
// title: '申请退款时间',
// dataIndex: 'refundApplyTime',
// key: 'refundApplyTime',
// align: 'center',
// customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
// },
// {
// title: '备注',
// dataIndex: 'comments',
// key: 'comments',
// align: 'center'
// },
{
title: "操作",
key: "action",
width: 120,
fixed: "right",
align: "center",
hideInSetting: true
}
]);
/* 搜索 */
const reload = (where?: ThinkOrderParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
};
/* 打开编辑弹窗 */
const openEdit = (row?: ThinkOrder) => {
current.value = row ?? null;
showEdit.value = true;
};
const showRefund = ref(false);
const refundOrder = ref<ThinkOrder>();
const openRefund = (row: ThinkOrder) => {
refundOrder.value = row;
showRefund.value = true;
};
/* 打开批量移动弹窗 */
const openMove = () => {
showMove.value = true;
};
/* 删除单个 */
const remove = (row: ThinkOrder) => {
const hide = message.loading("请求中..", 0);
removeThinkOrder(row.id)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
/* 批量删除 */
const removeBatch = () => {
if (!selection.value.length) {
message.error("请至少选择一条数据");
return;
}
Modal.confirm({
title: "提示",
content: "确定要删除选中的记录吗?",
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
onOk: () => {
const hide = message.loading("请求中..", 0);
removeBatchThinkOrder(selection.value.map((d) => d.id))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
} }
}); where.forAdmin = true;
}; return pageThinkOrder({
...where,
/* 开具发票 */ ...orders,
const onInvoice = (row?: ThinkOrder) => { page,
console.log(row?.payStatus); limit
if (row?.payStatus != 1) {
return false;
}
current.value = row ?? null;
showInvoice.value = true;
};
const openInvoicePdf = (row?: ThinkInvoice) => {
if (row?.id) {
InvoiceApi.showInvoice(row?.id).then((res) => {
const parse = JSON.parse(res);
const pdfUrl = parse[0].pdfUrl;
window.open(pdfUrl);
}); });
} };
};
/* 查询 */ // 表格列配置
const query = () => { const columns = ref<ColumnItem[]>([
loading.value = true; {},
}; {
title: '订单号',
/* 自定义行属性 */ dataIndex: 'id',
const customRow = (record: ThinkOrder) => { key: 'iod',
return { width: 90
// 行点击事件
onClick: () => {
// console.log(record);
}, },
// 行双击事件 {
onDblclick: () => { title: '姓名',
openEdit(record); dataIndex: 'name',
key: 'name',
align: 'center'
},
{
title: '手机号',
dataIndex: 'phone',
key: 'phone',
width: 120,
align: 'center'
},
{
title: '预约信息',
dataIndex: 'dateTime',
key: 'dateTime',
width: 120,
align: 'center'
},
{
title: '总额',
dataIndex: 'totalPrice',
key: 'totalPrice',
align: 'center',
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
},
{
title: '减少金额',
dataIndex: 'reducePrice',
key: 'reducePrice',
align: 'center',
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
},
{
title: '实付金额',
dataIndex: 'payPrice',
key: 'payPrice',
align: 'center',
sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}`
},
{
title: '支付方式',
dataIndex: 'payType',
key: 'payType',
align: 'center'
},
{
title: 'IC卡号',
dataIndex: 'code',
key: 'code',
align: 'center'
},
{
title: '付款状态',
dataIndex: 'payStatus',
key: 'payStatus',
sorter: true,
align: 'center'
},
{
title: '付款时间',
dataIndex: 'payTime',
key: 'payTime',
sorter: true,
align: 'center',
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
},
{
title: '订单状态',
dataIndex: 'orderStatus',
key: 'orderStatus',
align: 'center'
},
{
title: '优惠类型',
dataIndex: 'couponType',
key: 'couponType',
align: 'center'
},
{
title: '开票状态',
dataIndex: 'isInvoice',
key: 'isInvoice',
align: 'center',
sorter: true
},
// {
// title: '类型',
// dataIndex: 'type',
// key: 'type',
// align: 'center',
// customRender: ({ text }) =>
// ['商城订单', '客户预定', '俱乐部训练场', '活动订场'][text]
// },
// {
// title: '申请退款时间',
// dataIndex: 'refundApplyTime',
// key: 'refundApplyTime',
// align: 'center',
// customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
// },
// {
// title: '备注',
// dataIndex: 'comments',
// key: 'comments',
// align: 'center'
// },
{
title: '操作',
key: 'action',
width: 120,
fixed: 'right',
align: 'center',
hideInSetting: true
}
]);
/* 搜索 */
const reload = (where?: ThinkOrderParam) => {
selection.value = [];
tableRef?.value?.reload({ where: where });
};
/* 打开编辑弹窗 */
const openEdit = (row?: ThinkOrder) => {
current.value = row ?? null;
showEdit.value = true;
};
const showRefund = ref(false);
const refundOrder = ref<ThinkOrder>();
const openRefund = (row: ThinkOrder) => {
refundOrder.value = row;
showRefund.value = true;
};
/* 打开批量移动弹窗 */
const openMove = () => {
showMove.value = true;
};
/* 删除单个 */
const remove = (row: ThinkOrder) => {
const hide = message.loading('请求中..', 0);
removeThinkOrder(row.id)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
/* 批量删除 */
const removeBatch = () => {
if (!selection.value.length) {
message.error('请至少选择一条数据');
return;
}
Modal.confirm({
title: '提示',
content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined),
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchThinkOrder(selection.value.map((d) => d.id))
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
}
});
};
/* 开具发票 */
const onInvoice = (row?: ThinkOrder) => {
console.log(row?.payStatus);
if (row?.payStatus != 1) {
return false;
}
current.value = row ?? null;
showInvoice.value = true;
};
const openInvoicePdf = (row?: ThinkInvoice) => {
if (row?.id) {
InvoiceApi.showInvoice(row?.id).then((res) => {
const parse = JSON.parse(res);
const pdfUrl = parse[0].pdfUrl;
window.open(pdfUrl);
});
} }
}; };
};
query(); /* 查询 */
const query = () => {
loading.value = true;
};
/* 自定义行属性 */
const customRow = (record: ThinkOrder) => {
return {
// 行点击事件
onClick: () => {
// console.log(record);
},
// 行双击事件
onDblclick: () => {
openEdit(record);
}
};
};
query();
</script> </script>
<script lang="ts"> <script lang="ts">
import * as MenuIcons from "@/layout/menu-icons"; import * as MenuIcons from '@/layout/menu-icons';
export default { export default {
name: "ThinkOrder", name: 'ThinkOrder',
components: MenuIcons components: MenuIcons
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.tag-icon { .tag-icon {
padding-right: 6px; padding-right: 6px;
} }
</style> </style>
@@ -18,6 +18,10 @@
> >
<span>同步会员卡权限</span> <span>同步会员卡权限</span>
</a-button> </a-button>
<a-radio-group v-model:value="where.isSale" @change="search">
<a-radio-button :value="1">已上架</a-radio-button>
<a-radio-button :value="0">已下架</a-radio-button>
</a-radio-group>
<a-input-search <a-input-search
allow-clear allow-clear
placeholder="会员卡名称" placeholder="会员卡名称"
@@ -46,7 +50,7 @@
); );
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'search', where?: GradeParam): void; (e: 'search', where?: ThinkVipParam): void;
(e: 'add'): void; (e: 'add'): void;
(e: 'remove'): void; (e: 'remove'): void;
(e: 'batchMove'): void; (e: 'batchMove'): void;
@@ -55,6 +59,7 @@
// 表单数据 // 表单数据
const { where } = useSearch<ThinkVipParam>({ const { where } = useSearch<ThinkVipParam>({
id: undefined, id: undefined,
isSale: 1,
keywords: undefined, keywords: undefined,
timeStart: undefined, timeStart: undefined,
timeEnd: undefined timeEnd: undefined
@@ -135,9 +135,9 @@
{{ form.prices }} {{ form.prices }}
</a-form-item> </a-form-item>
<a-form-item label="是否有效" name="isUse"> <a-form-item label="是否有效" name="isUse">
<a-radio-group v-model:value="form.isIntegral"> <a-radio-group v-model:value="form.isUse">
<a-radio :value="1">是</a-radio> <a-radio :value="1">是</a-radio>
<a-radio :value="2">否</a-radio> <a-radio :value="0">否</a-radio>
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
</a-form> </a-form>
+28 -1
View File
@@ -40,6 +40,15 @@
</template> </template>
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<a-space> <a-space>
<a @click="updateStatus(record)">
<span class="text-green-500" v-if="record.isSale == 1"
>已上架</span
>
<span class="text-gray-400" v-if="record.isSale == 0"
>已下架</span
>
</a>
<a-divider type="vertical" />
<a @click="openEdit(record)">修改</a> <a @click="openEdit(record)">修改</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a-popconfirm <a-popconfirm
@@ -75,7 +84,8 @@
import { import {
pageThinkVip, pageThinkVip,
removeThinkVip, removeThinkVip,
removeBatchThinkVip removeBatchThinkVip,
updateThinkVip
} from '@/api/think/thinkVip'; } from '@/api/think/thinkVip';
import type { ThinkVip, ThinkVipParam } from '@/api/think/thinkVip/model'; import type { ThinkVip, ThinkVipParam } from '@/api/think/thinkVip/model';
@@ -92,6 +102,7 @@
const showMove = ref(false); const showMove = ref(false);
// 加载状态 // 加载状态
const loading = ref(true); const loading = ref(true);
const isSale = ref<number>(1);
// 表格数据源 // 表格数据源
const datasource: DatasourceFunction = ({ const datasource: DatasourceFunction = ({
@@ -104,6 +115,9 @@
if (filters) { if (filters) {
where.status = filters.status; where.status = filters.status;
} }
if (where.isSale == undefined) {
where.isSale = isSale.value;
}
return pageThinkVip({ return pageThinkVip({
...where, ...where,
...orders, ...orders,
@@ -270,6 +284,9 @@
/* 搜索 */ /* 搜索 */
const reload = (where?: ThinkVipParam) => { const reload = (where?: ThinkVipParam) => {
if (where?.isSale) {
isSale.value = where.isSale;
}
selection.value = []; selection.value = [];
tableRef?.value?.reload({ where: where }); tableRef?.value?.reload({ where: where });
}; };
@@ -280,6 +297,16 @@
showEdit.value = true; showEdit.value = true;
}; };
const updateStatus = (row: ThinkVip) => {
updateThinkVip({
id: row.id,
isSale: row.isSale == 1 ? 0 : 1
}).then(() => {
message.success('操作成功');
reload();
});
};
/* 打开批量移动弹窗 */ /* 打开批量移动弹窗 */
const openMove = () => { const openMove = () => {
showMove.value = true; showMove.value = true;