新增: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;
} }
+129 -120
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,44 +76,46 @@
</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
} from '@/api/think/thinkInvoice';
import type {
ThinkInvoice, ThinkInvoice,
ThinkInvoiceParam ThinkInvoiceParam
} from "@/api/think/thinkInvoice/model"; } from '@/api/think/thinkInvoice/model';
import * as InvoiceApi from "@/api/think/thinkInvoice"; 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, page,
limit, limit,
where, where,
@@ -123,121 +132,121 @@ const datasource: DatasourceFunction = ({
page, page,
limit limit
}); });
}; };
// 表格列配置 // 表格列配置
const columns = ref<ColumnItem[]>([ const columns = ref<ColumnItem[]>([
{ {
title: "操作", title: '操作',
key: "action", key: 'action',
width: 180, width: 180,
fixed: "left", fixed: 'left',
align: "center", align: 'center',
hideInSetting: true hideInSetting: true
}, },
{ {
title: "订单号", title: '订单号',
dataIndex: "orderNum", dataIndex: 'orderNum',
key: "oid", key: 'oid',
align: "center" align: 'center'
}, },
{ {
title: "公司名称", title: '公司名称',
dataIndex: "name", dataIndex: 'name',
key: "name", key: 'name',
align: "center" align: 'center'
}, },
{ {
title: "发票金额", title: '发票金额',
dataIndex: "price", dataIndex: 'price',
key: "price", key: 'price',
align: "center" align: 'center'
}, },
{ {
title: "税号", title: '税号',
dataIndex: "code", dataIndex: 'code',
key: "code", key: 'code',
align: "center" align: 'center'
}, },
{ {
title: "备注信息", title: '备注信息',
dataIndex: "info", dataIndex: 'info',
key: "info", key: 'info',
align: "center" align: 'center'
}, },
{ {
title: "是否已开", title: '是否已开',
dataIndex: "isOpen", dataIndex: 'isOpen',
key: "isOpen", key: 'isOpen',
align: "center", align: 'center'
}, },
{ {
title: "发票类型", title: '发票类型',
dataIndex: "type", dataIndex: 'type',
key: "type", key: 'type',
align: "center", align: 'center',
customRender: ({ text }) => { customRender: ({ text }) => {
if (text === 1) { if (text === 1) {
return "电子"; return '电子';
} else { } else {
return "纸质"; return '纸质';
} }
} }
}, },
{ {
title: "开票类型", title: '开票类型',
dataIndex: "invoicetype", dataIndex: 'invoicetype',
key: "invoicetype", key: 'invoicetype',
align: "center", align: 'center',
customRender: ({ text }) => { customRender: ({ text }) => {
if (text === 1) { if (text === 1) {
return "普票"; return '普票';
} else { } else {
return "专票"; return '专票';
} }
} }
}, },
{ {
title: "开票时间", title: '开票时间',
dataIndex: "createTime", dataIndex: 'createTime',
key: "createTime", key: 'createTime',
align: "center", align: 'center',
sorter: true, sorter: true,
ellipsis: true, ellipsis: true,
customRender: ({ text }) => toDateString(text, "yyyy-MM-dd HH:mm:ss") customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
} }
]); ]);
/* 搜索 */ /* 搜索 */
const reload = (where?: ThinkInvoiceParam) => { const reload = (where?: ThinkInvoiceParam) => {
selection.value = []; selection.value = [];
tableRef?.value?.reload({ where: where }); tableRef?.value?.reload({ where: where });
}; };
/* 打开编辑弹窗 */ /* 打开编辑弹窗 */
const openEdit = (row?: ThinkInvoice) => { const openEdit = (row?: ThinkInvoice) => {
current.value = row ?? null; current.value = row ?? null;
showEdit.value = true; showEdit.value = true;
}; };
const openInvoicePdf = (row: ThinkInvoice) => { const openInvoicePdf = (row: ThinkInvoice) => {
const hide = message.loading("请求中..", 0); const hide = message.loading('请求中..', 0);
InvoiceApi.showInvoice(row?.id).then((res) => { InvoiceApi.showInvoice(row?.id).then((res) => {
const parse = JSON.parse(res); const parse = JSON.parse(res);
const pdfUrl = parse[0].pdfUrl; const pdfUrl = parse[0].pdfUrl;
hide(); hide();
window.open(pdfUrl); window.open(pdfUrl);
}); });
}; };
/* 打开批量移动弹窗 */ /* 打开批量移动弹窗 */
const openMove = () => { const openMove = () => {
showMove.value = true; showMove.value = true;
}; };
/* 删除单个 */ /* 删除单个 */
const remove = (row: ThinkInvoice) => { const remove = (row: ThinkInvoice) => {
const hide = message.loading("请求中..", 0); const hide = message.loading('请求中..', 0);
removeThinkInvoice(row.id) removeThinkInvoice(row.id)
.then((msg) => { .then((msg) => {
hide(); hide();
@@ -248,21 +257,21 @@ const remove = (row: ThinkInvoice) => {
hide(); hide();
message.error(e.message); message.error(e.message);
}); });
}; };
/* 批量删除 */ /* 批量删除 */
const removeBatch = () => { const removeBatch = () => {
if (!selection.value.length) { if (!selection.value.length) {
message.error("请至少选择一条数据"); message.error('请至少选择一条数据');
return; return;
} }
Modal.confirm({ Modal.confirm({
title: "提示", title: '提示',
content: "确定要删除选中的记录吗?", content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined), icon: createVNode(ExclamationCircleOutlined),
maskClosable: true, maskClosable: true,
onOk: () => { onOk: () => {
const hide = message.loading("请求中..", 0); const hide = message.loading('请求中..', 0);
removeBatchThinkInvoice(selection.value.map((d) => d.id)) removeBatchThinkInvoice(selection.value.map((d) => d.id))
.then((msg) => { .then((msg) => {
hide(); hide();
@@ -275,30 +284,30 @@ const removeBatch = () => {
}); });
} }
}); });
}; };
/* 查询 */ /* 查询 */
const query = () => { const query = () => {
loading.value = true; loading.value = true;
}; };
const openInvoice = async (row: ThinkInvoice) => { const openInvoice = async (row: ThinkInvoice) => {
await doInvoice(row); await doInvoice(row);
message.success("操作成功"); message.success('操作成功');
reload(); reload();
}; };
const refuse = async (row: ThinkInvoice) => { const refuse = async (row: ThinkInvoice) => {
await updateThinkInvoice({ await updateThinkInvoice({
id: row.id, id: row.id,
status: 2 status: 2
}); });
message.success("操作成功"); message.success('操作成功');
reload(); reload();
}; };
/* 自定义行属性 */ /* 自定义行属性 */
const customRow = (record: ThinkInvoice) => { const customRow = (record: ThinkInvoice) => {
return { return {
// 行点击事件 // 行点击事件
onClick: () => { onClick: () => {
@@ -309,14 +318,14 @@ const customRow = (record: ThinkInvoice) => {
openEdit(record); openEdit(record);
} }
}; };
}; };
query(); 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>
@@ -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,34 +98,38 @@
</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,
@@ -116,56 +142,56 @@ const { where, resetFields } = useSearch<ThinkOrderParam>({
orderStatus: undefined, orderStatus: undefined,
payType: undefined, payType: undefined,
isInvoice: undefined isInvoice: undefined
}); });
// 请求状态 // 请求状态
const loading = ref(false); const loading = ref(false);
// 日期范围选择 // 日期范围选择
const dateRange = ref<[string, string]>(["", ""]); const dateRange = ref<[string, string]>(['', '']);
const orders = ref<ThinkOrder[] | any[]>(); const orders = ref<ThinkOrder[] | any[]>();
const xlsFileName = ref<string>(); const xlsFileName = ref<string>();
/* 搜索 */ /* 搜索 */
const search = () => { const search = () => {
const [d1, d2] = dateRange.value ?? []; const [d1, d2] = dateRange.value ?? [];
xlsFileName.value = `${d1}至${d2}`; xlsFileName.value = `${d1}至${d2}`;
where.timeStart = d1 ? dayjs(d1).valueOf() / 1000 : undefined; where.timeStart = d1 ? dayjs(d1).valueOf() / 1000 : undefined;
where.timeEnd = d2 ? dayjs(d2).valueOf() / 1000 : undefined; where.timeEnd = d2 ? dayjs(d2).valueOf() / 1000 : undefined;
// where.createTimeStart = d1 ? d1 + ' 00:00:00' : undefined; // where.createTimeStart = d1 ? d1 + ' 00:00:00' : undefined;
// where.createTimeEnd = d2 ? d2 + ' 00:00:00' : undefined; // where.createTimeEnd = d2 ? d2 + ' 00:00:00' : undefined;
emit("search", { emit('search', {
...where ...where
}); });
}; };
const chooseSiteId = (data: ThinkSite) => { const chooseSiteId = (data: ThinkSite) => {
where.sid = data.id; where.sid = data.id;
where.siteName = data.name; where.siteName = data.name;
search(); search();
}; };
/* 重置 */ /* 重置 */
const reset = () => { const reset = () => {
resetFields(); resetFields();
search(); search();
}; };
// 导出 // 导出
const handleExport = async () => { const handleExport = async () => {
loading.value = true; loading.value = true;
const array: (string | number)[][] = [ const array: (string | number)[][] = [
[ [
"订单号", '订单号',
"订单编号", '订单编号',
"姓名", '姓名',
"电话号码", '电话号码',
"预定信息", '预定信息',
"消费金额", '消费金额',
"实付金额", '实付金额',
"下单日期" '下单日期'
] ]
]; ];
if (!where.timeStart) { if (!where.timeStart) {
message.error("请选择导出的开始日期、结束日期,每次最多导出5000条记录"); message.error('请选择导出的开始日期、结束日期,每次最多导出5000条记录');
return false; return false;
} }
await listThinkOrder(where) await listThinkOrder(where)
@@ -191,7 +217,7 @@ const handleExport = async () => {
const sheet = utils.aoa_to_sheet(array); const sheet = utils.aoa_to_sheet(array);
workbook.Sheets[sheetName] = sheet; workbook.Sheets[sheetName] = sheet;
// 设置列宽 // 设置列宽
sheet["!cols"] = [ sheet['!cols'] = [
{ wch: 10 }, { wch: 10 },
{ wch: 10 }, { wch: 10 },
{ wch: 10 }, { wch: 10 },
@@ -200,12 +226,12 @@ const handleExport = async () => {
{ wch: 40 }, { wch: 40 },
{ wch: 10 } { wch: 10 }
]; ];
message.loading("正在导出..."); message.loading('正在导出...');
setTimeout(() => { setTimeout(() => {
writeFile( writeFile(
workbook, workbook,
`${ `${
where.createTimeEnd ? xlsFileName.value + "_" : "" where.createTimeEnd ? xlsFileName.value + '_' : ''
}${sheetName}.xlsx` }${sheetName}.xlsx`
); );
loading.value = false; loading.value = false;
@@ -215,26 +241,25 @@ const handleExport = async () => {
message.error(msg); message.error(msg);
loading.value = false; loading.value = false;
}) })
.finally(() => { .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
.filter((item) => item.isInvoice === 2)
.map(async (item) => {
item.isInvoice = 1; item.isInvoice = 1;
await updateThinkOrder(item); await updateThinkOrder(item);
}); });
} }
hide(); hide();
message.success("设置成功"); message.success('设置成功');
}; };
watch( watch(
() => props.selection, () => props.selection,
() => { () => {}
} );
);
</script> </script>
+170 -156
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
@@ -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,54 +261,54 @@
</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, page,
limit, limit,
where, where,
@@ -309,107 +325,105 @@ const datasource: DatasourceFunction = ({
page, page,
limit limit
}); });
}; };
// 表格列配置 // 表格列配置
const columns = ref<ColumnItem[]>([ const columns = ref<ColumnItem[]>([
{},
{ {
title: '订单号',
}, dataIndex: 'id',
{ key: 'iod',
title: "订单号",
dataIndex: "id",
key: "iod",
width: 90 width: 90
}, },
{ {
title: "姓名", title: '姓名',
dataIndex: "name", dataIndex: 'name',
key: "name", key: 'name',
align: "center" align: 'center'
}, },
{ {
title: "手机号", title: '手机号',
dataIndex: "phone", dataIndex: 'phone',
key: "phone", key: 'phone',
width: 120, width: 120,
align: "center" align: 'center'
}, },
{ {
title: "预约信息", title: '预约信息',
dataIndex: "dateTime", dataIndex: 'dateTime',
key: "dateTime", key: 'dateTime',
width: 120, width: 120,
align: "center" align: 'center'
}, },
{ {
title: "总额", title: '总额',
dataIndex: "totalPrice", dataIndex: 'totalPrice',
key: "totalPrice", key: 'totalPrice',
align: "center", align: 'center',
sorter: true, sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}` customRender: ({ text }) => `¥${formatNumber(text)}`
}, },
{ {
title: "减少金额", title: '减少金额',
dataIndex: "reducePrice", dataIndex: 'reducePrice',
key: "reducePrice", key: 'reducePrice',
align: "center", align: 'center',
sorter: true, sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}` customRender: ({ text }) => `¥${formatNumber(text)}`
}, },
{ {
title: "实付金额", title: '实付金额',
dataIndex: "payPrice", dataIndex: 'payPrice',
key: "payPrice", key: 'payPrice',
align: "center", align: 'center',
sorter: true, sorter: true,
customRender: ({ text }) => `¥${formatNumber(text)}` customRender: ({ text }) => `¥${formatNumber(text)}`
}, },
{ {
title: "支付方式", title: '支付方式',
dataIndex: "payType", dataIndex: 'payType',
key: "payType", key: 'payType',
align: "center" align: 'center'
}, },
{ {
title: "IC卡号", title: 'IC卡号',
dataIndex: "code", dataIndex: 'code',
key: "code", key: 'code',
align: "center" align: 'center'
}, },
{ {
title: "付款状态", title: '付款状态',
dataIndex: "payStatus", dataIndex: 'payStatus',
key: "payStatus", key: 'payStatus',
sorter: true, sorter: true,
align: "center" align: 'center'
}, },
{ {
title: "付款时间", title: '付款时间',
dataIndex: "payTime", dataIndex: 'payTime',
key: "payTime", key: 'payTime',
sorter: true, sorter: true,
align: "center", align: 'center',
customRender: ({ text }) => toDateString(text, "yyyy-MM-dd HH:mm:ss") customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss')
}, },
{ {
title: "订单状态", title: '订单状态',
dataIndex: "orderStatus", dataIndex: 'orderStatus',
key: "orderStatus", key: 'orderStatus',
align: "center" align: 'center'
}, },
{ {
title: "优惠类型", title: '优惠类型',
dataIndex: "couponType", dataIndex: 'couponType',
key: "couponType", key: 'couponType',
align: "center" align: 'center'
}, },
{ {
title: "开票状态", title: '开票状态',
dataIndex: "isInvoice", dataIndex: 'isInvoice',
key: "isInvoice", key: 'isInvoice',
align: "center", align: 'center',
sorter: true sorter: true
}, },
// { // {
@@ -434,42 +448,42 @@ const columns = ref<ColumnItem[]>([
// align: 'center' // align: 'center'
// }, // },
{ {
title: "操作", title: '操作',
key: "action", key: 'action',
width: 120, width: 120,
fixed: "right", fixed: 'right',
align: "center", align: 'center',
hideInSetting: true hideInSetting: true
} }
]); ]);
/* 搜索 */ /* 搜索 */
const reload = (where?: ThinkOrderParam) => { const reload = (where?: ThinkOrderParam) => {
selection.value = []; selection.value = [];
tableRef?.value?.reload({ where: where }); tableRef?.value?.reload({ where: where });
}; };
/* 打开编辑弹窗 */ /* 打开编辑弹窗 */
const openEdit = (row?: ThinkOrder) => { const openEdit = (row?: ThinkOrder) => {
current.value = row ?? null; current.value = row ?? null;
showEdit.value = true; showEdit.value = true;
}; };
const showRefund = ref(false); const showRefund = ref(false);
const refundOrder = ref<ThinkOrder>(); const refundOrder = ref<ThinkOrder>();
const openRefund = (row: ThinkOrder) => { const openRefund = (row: ThinkOrder) => {
refundOrder.value = row; refundOrder.value = row;
showRefund.value = true; showRefund.value = true;
}; };
/* 打开批量移动弹窗 */ /* 打开批量移动弹窗 */
const openMove = () => { const openMove = () => {
showMove.value = true; showMove.value = true;
}; };
/* 删除单个 */ /* 删除单个 */
const remove = (row: ThinkOrder) => { const remove = (row: ThinkOrder) => {
const hide = message.loading("请求中..", 0); const hide = message.loading('请求中..', 0);
removeThinkOrder(row.id) removeThinkOrder(row.id)
.then((msg) => { .then((msg) => {
hide(); hide();
@@ -480,21 +494,21 @@ const remove = (row: ThinkOrder) => {
hide(); hide();
message.error(e.message); message.error(e.message);
}); });
}; };
/* 批量删除 */ /* 批量删除 */
const removeBatch = () => { const removeBatch = () => {
if (!selection.value.length) { if (!selection.value.length) {
message.error("请至少选择一条数据"); message.error('请至少选择一条数据');
return; return;
} }
Modal.confirm({ Modal.confirm({
title: "提示", title: '提示',
content: "确定要删除选中的记录吗?", content: '确定要删除选中的记录吗?',
icon: createVNode(ExclamationCircleOutlined), icon: createVNode(ExclamationCircleOutlined),
maskClosable: true, maskClosable: true,
onOk: () => { onOk: () => {
const hide = message.loading("请求中..", 0); const hide = message.loading('请求中..', 0);
removeBatchThinkOrder(selection.value.map((d) => d.id)) removeBatchThinkOrder(selection.value.map((d) => d.id))
.then((msg) => { .then((msg) => {
hide(); hide();
@@ -507,19 +521,19 @@ const removeBatch = () => {
}); });
} }
}); });
}; };
/* 开具发票 */ /* 开具发票 */
const onInvoice = (row?: ThinkOrder) => { const onInvoice = (row?: ThinkOrder) => {
console.log(row?.payStatus); console.log(row?.payStatus);
if (row?.payStatus != 1) { if (row?.payStatus != 1) {
return false; return false;
} }
current.value = row ?? null; current.value = row ?? null;
showInvoice.value = true; showInvoice.value = true;
}; };
const openInvoicePdf = (row?: ThinkInvoice) => { const openInvoicePdf = (row?: ThinkInvoice) => {
if (row?.id) { if (row?.id) {
InvoiceApi.showInvoice(row?.id).then((res) => { InvoiceApi.showInvoice(row?.id).then((res) => {
const parse = JSON.parse(res); const parse = JSON.parse(res);
@@ -527,15 +541,15 @@ const openInvoicePdf = (row?: ThinkInvoice) => {
window.open(pdfUrl); window.open(pdfUrl);
}); });
} }
}; };
/* 查询 */ /* 查询 */
const query = () => { const query = () => {
loading.value = true; loading.value = true;
}; };
/* 自定义行属性 */ /* 自定义行属性 */
const customRow = (record: ThinkOrder) => { const customRow = (record: ThinkOrder) => {
return { return {
// 行点击事件 // 行点击事件
onClick: () => { onClick: () => {
@@ -546,20 +560,20 @@ const customRow = (record: ThinkOrder) => {
openEdit(record); openEdit(record);
} }
}; };
}; };
query(); 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;