新增: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
+5
View File
@@ -47,6 +47,8 @@ export interface ThinkVip {
updateTime?: number;
// 是否有效:1是,0否
isUse?: number;
// 是否销售:1是,0否
isSale?: number;
}
/**
@@ -54,7 +56,10 @@ export interface ThinkVip {
*/
export interface ThinkVipParam{
id?: number;
isSale?: number;
createTimeStart?: number;
createTimeEnd?: number;
timeStart?: number;
timeEnd?: number;
keywords?: string;
}
+250 -241
View File
@@ -31,8 +31,13 @@
</template>
<template v-if="column.key === 'info'">
<span v-if="record.itype !== 4">{{ record.info }}</span>
<span v-else>开票金额:{{ record.price }}元,租赁面积:{{ record.size }}㎡,租赁时间:{{ record.rentStartDate
}}~{{ record.rentEndDate }}</span>
<span v-else
>开票金额:{{ record.price }}元,租赁面积:{{
record.size
}}㎡,租赁时间:{{ record.rentStartDate }}~{{
record.rentEndDate
}}</span
>
</template>
<template v-if="column.key === 'action'">
<a-space v-if="record.isOpen === 1">
@@ -52,7 +57,9 @@
<a-divider type="vertical" />
<a class="ele-text-danger" @click="refuse(record)">拒绝</a>
</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>
</ele-pro-table>
@@ -69,254 +76,256 @@
</template>
<script lang="ts" setup>
import { createVNode, ref } from "vue";
import { message, Modal } from "ant-design-vue";
import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
import type { EleProTable } from "ele-admin-pro";
import { toDateString } from "ele-admin-pro";
import type {
DatasourceFunction,
ColumnItem
} from "ele-admin-pro/es/ele-pro-table/types";
import Search from "./components/search.vue";
import ThinkInvoiceEdit from "./components/thinkInvoiceEdit.vue";
import {
pageThinkInvoice,
removeThinkInvoice,
removeBatchThinkInvoice, updateThinkInvoice, doInvoice
} from "@/api/think/thinkInvoice";
import type {
ThinkInvoice,
ThinkInvoiceParam
} from "@/api/think/thinkInvoice/model";
import * as InvoiceApi from "@/api/think/thinkInvoice";
import { createVNode, ref } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro';
import { toDateString } from 'ele-admin-pro';
import type {
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import ThinkInvoiceEdit from './components/thinkInvoiceEdit.vue';
import {
pageThinkInvoice,
removeThinkInvoice,
removeBatchThinkInvoice,
updateThinkInvoice,
doInvoice
} from '@/api/think/thinkInvoice';
import type {
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 current = ref<ThinkInvoice | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 是否显示批量移动弹窗
const showMove = ref(false);
// 加载状态
const loading = ref(true);
// 表格选中数据
const selection = ref<ThinkInvoice[]>([]);
// 当前编辑数据
const current = ref<ThinkInvoice | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 是否显示批量移动弹窗
const showMove = ref(false);
// 加载状态
const loading = ref(true);
// 表格数据源
const datasource: DatasourceFunction = ({
page,
limit,
where,
orders,
filters
}) => {
if (filters) {
where.status = filters.status;
}
where.forAdmin = true;
return pageThinkInvoice({
...where,
...orders,
// 表格数据源
const datasource: DatasourceFunction = ({
page,
limit
});
};
// 表格列配置
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 "纸质";
}
limit,
where,
orders,
filters
}) => {
if (filters) {
where.status = filters.status;
}
},
{
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);
where.forAdmin = true;
return pageThinkInvoice({
...where,
...orders,
page,
limit
});
};
/* 批量删除 */
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 lang="ts">
export default {
name: "ThinkInvoice"
};
export default {
name: 'ThinkInvoice'
};
</script>
<style lang="less" scoped></style>
+181 -156
View File
@@ -2,13 +2,23 @@
<template>
<a-space class="flex items-center" :size="10" style="flex-wrap: wrap">
<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="1">已付款</a-select-option>
<a-select-option :value="2">未付款</a-select-option>
</a-select>
<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="1">已完成</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>
<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="1">微信支付</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>
<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="2">未开票</a-select-option>
<a-select-option :value="3">不能开票</a-select-option>
@@ -65,7 +85,9 @@
style="width: 380px"
/>
<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">-->
<!-- <template #icon>-->
<!-- <download-outlined />-->
@@ -76,165 +98,168 @@
</template>
<script lang="ts" setup>
import useSearch from "@/utils/use-search";
import { ref, watch } from "vue";
import { ThinkOrderInfoParam } from "@/api/think/thinkOrderInfo/model";
import { utils, writeFile } from "xlsx";
import { message } from "ant-design-vue";
import { toDateString } from "ele-admin-pro";
import dayjs from "dayjs";
import { listThinkOrder, updateBatchThinkOrder, updateThinkOrder } from "@/api/think/thinkOrder";
import { ThinkOrder, ThinkOrderParam } from "@/api/think/thinkOrder/model";
import { ThinkSite } from "@/api/think/thinkSite/model";
import useSearch from '@/utils/use-search';
import { ref, watch } from 'vue';
import { ThinkOrderInfoParam } from '@/api/think/thinkOrderInfo/model';
import { utils, writeFile } from 'xlsx';
import { message } from 'ant-design-vue';
import { toDateString } from 'ele-admin-pro';
import dayjs from 'dayjs';
import {
listThinkOrder,
updateBatchThinkOrder,
updateThinkOrder
} from '@/api/think/thinkOrder';
import { ThinkOrder, ThinkOrderParam } from '@/api/think/thinkOrder/model';
import { ThinkSite } from '@/api/think/thinkSite/model';
const props = withDefaults(
defineProps<{
// 选中的角色
selection?: ThinkOrder[];
}>(),
{}
);
const props = withDefaults(
defineProps<{
// 选中的角色
selection?: ThinkOrder[];
}>(),
{}
);
const emit = defineEmits<{
(e: "search", where?: ThinkOrderInfoParam): void;
(e: "add"): void;
(e: "remove"): void;
(e: "advanced"): void;
}>();
const emit = defineEmits<{
(e: 'search', where?: ThinkOrderInfoParam): void;
(e: 'add'): void;
(e: 'remove'): void;
(e: 'advanced'): void;
}>();
// 表单数据
const { where, resetFields } = useSearch<ThinkOrderParam>({
sid: undefined,
siteName: undefined,
createTimeStart: undefined,
createTimeEnd: undefined,
timeStart: undefined,
timeEnd: undefined,
categoryId: undefined,
keywords: undefined,
payStatus: undefined,
orderStatus: undefined,
payType: 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 { where, resetFields } = useSearch<ThinkOrderParam>({
sid: undefined,
siteName: undefined,
createTimeStart: undefined,
createTimeEnd: undefined,
timeStart: undefined,
timeEnd: undefined,
categoryId: undefined,
keywords: undefined,
payStatus: undefined,
orderStatus: undefined,
payType: undefined,
isInvoice: undefined
});
};
// 请求状态
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;
where.siteName = data.name;
search();
};
/* 搜索 */
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 reset = () => {
resetFields();
search();
};
const chooseSiteId = (data: ThinkSite) => {
where.sid = data.id;
where.siteName = data.name;
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;
orders.value?.forEach((d: ThinkOrder) => {
array.push([
`${d.id}`,
`${d.orderNum}`,
`${d.name}`,
`${d.phone}`,
`${d.siteName} ${d.dateTime} ${d.totalPrice}`,
`${d.totalPrice}`,
`${d.payPrice}`,
`${toDateString(d.payTime)}`
]);
});
const sheetName = `订单数据导出`;
const workbook = {
SheetNames: [sheetName],
Sheets: {}
};
const sheet = utils.aoa_to_sheet(array);
workbook.Sheets[sheetName] = sheet;
// 设置列宽
sheet["!cols"] = [
{ wch: 10 },
{ wch: 10 },
{ wch: 10 },
{ wch: 10 },
{ wch: 20 },
{ wch: 40 },
{ wch: 10 }
];
message.loading("正在导出...");
setTimeout(() => {
writeFile(
workbook,
`${
where.createTimeEnd ? xlsFileName.value + "_" : ""
}${sheetName}.xlsx`
);
/* 重置 */
const reset = () => {
resetFields();
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;
orders.value?.forEach((d: ThinkOrder) => {
array.push([
`${d.id}`,
`${d.orderNum}`,
`${d.name}`,
`${d.phone}`,
`${d.siteName} ${d.dateTime} ${d.totalPrice}`,
`${d.totalPrice}`,
`${d.payPrice}`,
`${toDateString(d.payTime)}`
]);
});
const sheetName = `订单数据导出`;
const workbook = {
SheetNames: [sheetName],
Sheets: {}
};
const sheet = utils.aoa_to_sheet(array);
workbook.Sheets[sheetName] = sheet;
// 设置列宽
sheet['!cols'] = [
{ wch: 10 },
{ wch: 10 },
{ wch: 10 },
{ wch: 10 },
{ wch: 20 },
{ wch: 40 },
{ wch: 10 }
];
message.loading('正在导出...');
setTimeout(() => {
writeFile(
workbook,
`${
where.createTimeEnd ? xlsFileName.value + '_' : ''
}${sheetName}.xlsx`
);
loading.value = false;
}, 2000);
})
.catch((msg) => {
message.error(msg);
loading.value = false;
}, 2000);
})
.catch((msg) => {
message.error(msg);
loading.value = false;
})
.finally(() => {
});
};
})
.finally(() => {});
};
const setHasInvoice = async () => {
const hide = message.loading("请求中..", 0);
if (props.selection) {
props.selection.filter(item => item.isInvoice === 2).map(async item => {
item.isInvoice = 1;
await updateThinkOrder(item);
});
const setHasInvoice = async () => {
const hide = message.loading('请求中..', 0);
if (props.selection) {
props.selection
.filter((item) => item.isInvoice === 2)
.map(async (item) => {
item.isInvoice = 1;
await updateThinkOrder(item);
});
}
hide();
message.success('设置成功');
};
}
hide();
message.success("设置成功");
};
watch(
() => props.selection,
() => {
}
);
watch(
() => props.selection,
() => {}
);
</script>
+330 -316
View File
@@ -145,8 +145,7 @@
<IdcardOutlined class="tag-icon" />
IC会员卡
</a-tag>
<a-tag v-if="record.couponType == 11" color="blue"
>
<a-tag v-if="record.couponType == 11" color="blue">
<IdcardOutlined class="tag-icon" />
免费订单
</a-tag>
@@ -178,7 +177,8 @@
</a-tag>
<a-tag
v-if="record.payStatus == 3 || record.payStatus == 0"
color="cyan">
color="cyan"
>
<CoffeeOutlined class="tag-icon" />
未付款,占场中
</a-tag>
@@ -188,20 +188,29 @@
</template>
<template v-if="column.key === 'orderStatus'">
<span v-if="record.orderStatus == 1" class="ele-text-success"
>已完成</span>
>已完成</span
>
<span v-if="record.orderStatus == 2" class="ele-text-placeholder"
>未使用</span>
>未使用</span
>
<span v-if="record.orderStatus == 3" class="ele-text-placeholder"
>已取消</span>
>已取消</span
>
<span v-if="record.orderStatus == 4" class="ele-text-warning"
>退款申请中</span>
>退款申请中</span
>
<span v-if="record.orderStatus == 5" class="ele-text-danger"
>退款被拒绝</span>
<span v-if="record.orderStatus == 6" class="ele-text-heading">退款成功</span>
>退款被拒绝</span
>
<span v-if="record.orderStatus == 6" class="ele-text-heading"
>退款成功</span
>
<span v-if="record.orderStatus == 7" class="ele-text-warning"
>客户端申请退款</span>
>客户端申请退款</span
>
<span v-if="record.orderStatus == 9" class="ele-text-warning"
>未完成</span>
>未完成</span
>
</template>
<template v-if="column.key === 'isInvoice'">
<a-tag
@@ -209,14 +218,14 @@
color="green"
class="cursor-pointer"
@click="openInvoicePdf(record)"
>已开票
>已开票
</a-tag>
<a-tag
v-if="record.isInvoice == 2"
color="red"
class="cursor-pointer"
@click="onInvoice(record)"
>未开票
>未开票
</a-tag>
<a-tag v-if="record.isInvoice == 3" color="purple">不能开</a-tag>
</template>
@@ -228,8 +237,15 @@
<a-space>
<a @click="openEdit(record)">详情</a>
<a-divider type="vertical" />
<a @click="openRefund(record)"
v-if="record.payStatus === 1 && [1, 3].includes(record.payType) && [1, 2].includes(record.orderStatus)">退款</a>
<a
@click="openRefund(record)"
v-if="
record.payStatus === 1 &&
[1, 3].includes(record.payType) &&
[1, 2].includes(record.orderStatus)
"
>退款</a
>
</a-space>
</template>
</template>
@@ -245,321 +261,319 @@
</template>
<script lang="ts" setup>
import { createVNode, ref } from "vue";
import { message, Modal } from "ant-design-vue";
import {
ExclamationCircleOutlined,
CheckOutlined,
CloseOutlined,
AlipayCircleOutlined
} from "@ant-design/icons-vue";
import { EleProTable, toDateString } from "ele-admin-pro";
import type {
DatasourceFunction,
ColumnItem
} from "ele-admin-pro/es/ele-pro-table/types";
import Search from "./components/search.vue";
import OrderInfo from "./components/orderInfo.vue";
import Invoice from "./components/invoice.vue";
import {
pageThinkOrder,
removeThinkOrder,
removeBatchThinkOrder
} from "@/api/think/thinkOrder";
import * as InvoiceApi from "@/api/think/thinkInvoice";
import type {
ThinkOrder,
ThinkOrderParam
} from "@/api/think/thinkOrder/model";
import { formatNumber } from "ele-admin-pro/es";
import type { ThinkInvoice } from "@/api/think/thinkInvoice/model";
import Refund from "@/views/think/thinkOrder/components/refund.vue";
import { createVNode, ref } from 'vue';
import { message, Modal } from 'ant-design-vue';
import {
ExclamationCircleOutlined,
CheckOutlined,
CloseOutlined,
AlipayCircleOutlined
} from '@ant-design/icons-vue';
import { EleProTable, toDateString } from 'ele-admin-pro';
import type {
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import OrderInfo from './components/orderInfo.vue';
import Invoice from './components/invoice.vue';
import {
pageThinkOrder,
removeThinkOrder,
removeBatchThinkOrder
} from '@/api/think/thinkOrder';
import * as InvoiceApi from '@/api/think/thinkInvoice';
import type {
ThinkOrder,
ThinkOrderParam
} from '@/api/think/thinkOrder/model';
import { formatNumber } from 'ele-admin-pro/es';
import type { ThinkInvoice } from '@/api/think/thinkInvoice/model';
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 current = ref<ThinkOrder | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 开具发票弹窗
const showInvoice = ref(false);
// 是否显示批量移动弹窗
const showMove = ref(false);
// 加载状态
const loading = ref(true);
// 表格选中数据
const selection = ref<ThinkOrder[]>([]);
// 当前编辑数据
const current = ref<ThinkOrder | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 开具发票弹窗
const showInvoice = ref(false);
// 是否显示批量移动弹窗
const showMove = ref(false);
// 加载状态
const loading = ref(true);
// 表格数据源
const datasource: DatasourceFunction = ({
page,
limit,
where,
orders,
filters
}) => {
if (filters) {
where.status = filters.status;
}
where.forAdmin = true;
return pageThinkOrder({
...where,
...orders,
// 表格数据源
const datasource: DatasourceFunction = ({
page,
limit
});
};
// 表格列配置
const columns = ref<ColumnItem[]>([
{
},
{
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);
});
limit,
where,
orders,
filters
}) => {
if (filters) {
where.status = filters.status;
}
});
};
/* 开具发票 */
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);
where.forAdmin = true;
return pageThinkOrder({
...where,
...orders,
page,
limit
});
}
};
};
/* 查询 */
const query = () => {
loading.value = true;
};
/* 自定义行属性 */
const customRow = (record: ThinkOrder) => {
return {
// 行点击事件
onClick: () => {
// console.log(record);
// 表格列配置
const columns = ref<ColumnItem[]>([
{},
{
title: '订单号',
dataIndex: 'id',
key: 'iod',
width: 90
},
// 行双击事件
onDblclick: () => {
openEdit(record);
{
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);
});
}
});
};
/* 开具发票 */
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 lang="ts">
import * as MenuIcons from "@/layout/menu-icons";
import * as MenuIcons from '@/layout/menu-icons';
export default {
name: "ThinkOrder",
components: MenuIcons
};
export default {
name: 'ThinkOrder',
components: MenuIcons
};
</script>
<style lang="less" scoped>
.tag-icon {
padding-right: 6px;
}
.tag-icon {
padding-right: 6px;
}
</style>
@@ -18,6 +18,10 @@
>
<span>同步会员卡权限</span>
</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
allow-clear
placeholder="会员卡名称"
@@ -46,7 +50,7 @@
);
const emit = defineEmits<{
(e: 'search', where?: GradeParam): void;
(e: 'search', where?: ThinkVipParam): void;
(e: 'add'): void;
(e: 'remove'): void;
(e: 'batchMove'): void;
@@ -55,6 +59,7 @@
// 表单数据
const { where } = useSearch<ThinkVipParam>({
id: undefined,
isSale: 1,
keywords: undefined,
timeStart: undefined,
timeEnd: undefined
@@ -135,9 +135,9 @@
{{ form.prices }}
</a-form-item>
<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="2">否</a-radio>
<a-radio :value="0">否</a-radio>
</a-radio-group>
</a-form-item>
</a-form>
+28 -1
View File
@@ -40,6 +40,15 @@
</template>
<template v-if="column.key === 'action'">
<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-divider type="vertical" />
<a-popconfirm
@@ -75,7 +84,8 @@
import {
pageThinkVip,
removeThinkVip,
removeBatchThinkVip
removeBatchThinkVip,
updateThinkVip
} from '@/api/think/thinkVip';
import type { ThinkVip, ThinkVipParam } from '@/api/think/thinkVip/model';
@@ -92,6 +102,7 @@
const showMove = ref(false);
// 加载状态
const loading = ref(true);
const isSale = ref<number>(1);
// 表格数据源
const datasource: DatasourceFunction = ({
@@ -104,6 +115,9 @@
if (filters) {
where.status = filters.status;
}
if (where.isSale == undefined) {
where.isSale = isSale.value;
}
return pageThinkVip({
...where,
...orders,
@@ -270,6 +284,9 @@
/* 搜索 */
const reload = (where?: ThinkVipParam) => {
if (where?.isSale) {
isSale.value = where.isSale;
}
selection.value = [];
tableRef?.value?.reload({ where: where });
};
@@ -280,6 +297,16 @@
showEdit.value = true;
};
const updateStatus = (row: ThinkVip) => {
updateThinkVip({
id: row.id,
isSale: row.isSale == 1 ? 0 : 1
}).then(() => {
message.success('操作成功');
reload();
});
};
/* 打开批量移动弹窗 */
const openMove = () => {
showMove.value = true;