恢复代码
This commit is contained in:
@@ -0,0 +1,260 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
title="合并开具发票"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="发票金额" name="price">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入发票金额"
|
||||
v-model:value="form.price"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="单位名称" name="name">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入单位名称"
|
||||
v-model:value="form.name"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="税号/身份证号" name="code">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入税号/身份证号"
|
||||
v-model:value="form.code"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="手机号码" name="phone">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入手机号码"
|
||||
v-model:value="form.phone"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="开户行" name="bank">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入开户行"
|
||||
v-model:value="form.bank"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="开户账号" name="account">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入开户账号"
|
||||
v-model:value="form.account"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="单位地址" name="address">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入单位地址"
|
||||
v-model:value="form.address"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="公司电话" name="tel">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入公司电话"
|
||||
v-model:value="form.tel"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="电子邮箱" name="email">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入电子邮箱"
|
||||
v-model:value="form.email"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="备注信息" name="info">
|
||||
<a-textarea
|
||||
:rows="4"
|
||||
:maxlength="200"
|
||||
placeholder="请输入备注信息"
|
||||
v-model:value="form.info"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="发票类型" name="type">
|
||||
<a-radio-group v-model:value="form.type">
|
||||
<a-radio :value="1">纸质发票</a-radio>
|
||||
<a-radio :value="2">电子发票</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item label="发票类型" name="itype">
|
||||
<a-radio-group v-model:value="form.itype" :disabled="true">
|
||||
<a-radio :value="1">场地发票</a-radio>
|
||||
<a-radio :value="2">vip卡发票</a-radio>
|
||||
<a-radio :value="2">ic卡发票</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item label="发票类型" name="invoicetype">
|
||||
<a-radio-group v-model:value="form.invoicetype">
|
||||
<a-radio :value="1">普票</a-radio>
|
||||
<a-radio :value="2">专票</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from "vue";
|
||||
import { Form, message } from "ant-design-vue";
|
||||
import {
|
||||
doInvoiceByListReq
|
||||
} from "@/api/think/thinkInvoice";
|
||||
import { ThinkInvoice } from "@/api/think/thinkInvoice/model";
|
||||
import { useThemeStore } from "@/store/modules/theme";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { FormInstance } from "ant-design-vue/es/form";
|
||||
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: any;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: "done"): void;
|
||||
(e: "update:visible", visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
// 表格选中数据
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<ThinkInvoice>({
|
||||
id: undefined,
|
||||
incoiveNum: undefined,
|
||||
incoiveCode: undefined,
|
||||
orderNum: undefined,
|
||||
oid: undefined,
|
||||
uid: undefined,
|
||||
price: undefined,
|
||||
name: undefined,
|
||||
tel: undefined,
|
||||
address: undefined,
|
||||
bank: undefined,
|
||||
account: undefined,
|
||||
code: undefined,
|
||||
phone: undefined,
|
||||
email: undefined,
|
||||
info: undefined,
|
||||
isOpen: undefined,
|
||||
type: 2,
|
||||
itype: 1,
|
||||
invoicetype: 1,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
orderIdList: []
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit("update:visible", value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
price: [
|
||||
{
|
||||
required: true,
|
||||
message: "请填写发票金额",
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
type: "string",
|
||||
message: "请填写单位名称",
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
code: [
|
||||
{
|
||||
required: true,
|
||||
type: "string",
|
||||
message: "请填写税号",
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
phone: [
|
||||
{
|
||||
required: true,
|
||||
type: "string",
|
||||
message: "请填写手机号",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
doInvoiceByListReq(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit("done");
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
form.price = props.data?.price;
|
||||
form.orderIdList = props.data?.orderIdList;
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
@@ -1,265 +1,248 @@
|
||||
<!-- 搜索表单 -->
|
||||
<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-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-option value="">全部</a-select-option>
|
||||
<a-select-option :value="1">已完成</a-select-option>
|
||||
<a-select-option :value="2">未使用</a-select-option>
|
||||
<a-select-option :value="3">已取消</a-select-option>
|
||||
<a-select-option :value="4">退款中</a-select-option>
|
||||
<a-select-option :value="5">退款被拒</a-select-option>
|
||||
<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-option value="">全部</a-select-option>
|
||||
<a-select-option :value="1">微信支付</a-select-option>
|
||||
<a-select-option :value="2">余额支付</a-select-option>
|
||||
<a-select-option :value="3">支付宝</a-select-option>
|
||||
<a-select-option :value="4">现金</a-select-option>
|
||||
<a-select-option :value="5">POS机</a-select-option>
|
||||
<a-select-option :value="6">VIP月卡</a-select-option>
|
||||
<a-select-option :value="7">VIP年卡</a-select-option>
|
||||
<a-select-option :value="8">VIP次卡</a-select-option>
|
||||
<a-select-option :value="9">IC月卡</a-select-option>
|
||||
<a-select-option :value="10">IC年卡</a-select-option>
|
||||
<a-select-option :value="11">IC次卡</a-select-option>
|
||||
<a-select-option :value="12">免费</a-select-option>
|
||||
<a-select-option :value="13">VIP充值卡</a-select-option>
|
||||
<a-select-option :value="14">IC充值卡</a-select-option>
|
||||
<a-select-option :value="15">积分支付</a-select-option>
|
||||
<a-select-option :value="16">VIP季卡</a-select-option>
|
||||
<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-option value="1">已开票</a-select-option>
|
||||
<a-select-option :value="2">未开票</a-select-option>
|
||||
<a-select-option :value="3">不能开票</a-select-option>
|
||||
</a-select>
|
||||
<ThinkSelectSite
|
||||
:placeholder="`选择场馆`"
|
||||
class="input-item"
|
||||
v-model:value="where.siteName"
|
||||
@done="chooseSiteId"
|
||||
/>
|
||||
<a-range-picker
|
||||
v-model:value="dateRange"
|
||||
@change="search"
|
||||
value-format="YYYY-MM-DD"
|
||||
class="ele-fluid"
|
||||
/>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
placeholder="请输入订单号|编号|手机号"
|
||||
v-model:value="where.keywords"
|
||||
@pressEnter="search"
|
||||
@search="search"
|
||||
style="width: 380px"
|
||||
/>
|
||||
<a-button @click="reset">重置</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 />-->
|
||||
<!-- </template>-->
|
||||
<!-- <span>导出订单</span>-->
|
||||
<!-- </a-button>-->
|
||||
</a-space>
|
||||
<div class="flex flex-col justify-start items-start">
|
||||
|
||||
|
||||
<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-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-option value="">全部</a-select-option>
|
||||
<a-select-option :value="1">已完成</a-select-option>
|
||||
<a-select-option :value="2">未使用</a-select-option>
|
||||
<a-select-option :value="3">已取消</a-select-option>
|
||||
<a-select-option :value="4">退款中</a-select-option>
|
||||
<a-select-option :value="5">退款被拒</a-select-option>
|
||||
<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-option value="">全部</a-select-option>
|
||||
<a-select-option :value="1">微信支付</a-select-option>
|
||||
<a-select-option :value="2">余额支付</a-select-option>
|
||||
<a-select-option :value="3">支付宝</a-select-option>
|
||||
<a-select-option :value="4">现金</a-select-option>
|
||||
<a-select-option :value="5">POS机</a-select-option>
|
||||
<a-select-option :value="6">VIP月卡</a-select-option>
|
||||
<a-select-option :value="7">VIP年卡</a-select-option>
|
||||
<a-select-option :value="8">VIP次卡</a-select-option>
|
||||
<a-select-option :value="9">IC月卡</a-select-option>
|
||||
<a-select-option :value="10">IC年卡</a-select-option>
|
||||
<a-select-option :value="11">IC次卡</a-select-option>
|
||||
<a-select-option :value="12">免费</a-select-option>
|
||||
<a-select-option :value="13">VIP充值卡</a-select-option>
|
||||
<a-select-option :value="14">IC充值卡</a-select-option>
|
||||
<a-select-option :value="15">积分支付</a-select-option>
|
||||
<a-select-option :value="16">VIP季卡</a-select-option>
|
||||
<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-option value="1">已开票</a-select-option>
|
||||
<a-select-option :value="2">未开票</a-select-option>
|
||||
<a-select-option :value="3">不能开票</a-select-option>
|
||||
</a-select>
|
||||
<ThinkSelectSite
|
||||
:placeholder="`选择场馆`"
|
||||
class="input-item"
|
||||
v-model:value="where.siteName"
|
||||
@done="chooseSiteId"
|
||||
/>
|
||||
<a-range-picker
|
||||
v-model:value="dateRange"
|
||||
@change="search"
|
||||
value-format="YYYY-MM-DD"
|
||||
class="ele-fluid"
|
||||
/>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
placeholder="请输入订单号|编号|手机号"
|
||||
v-model:value="where.keywords"
|
||||
@pressEnter="search"
|
||||
@search="search"
|
||||
style="width: 380px"
|
||||
/>
|
||||
</a-space>
|
||||
<div class="mt-2">
|
||||
<a-space>
|
||||
<a-button @click="reset">重置</a-button>
|
||||
<a-button @click="setHasInvoice" :disabled="!selection?.length">设置已开票</a-button>
|
||||
<a-button @click="openInvoiceByList" :disabled="!selection?.length" type="primary">合并开票</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
</div>
|
||||
</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, 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;
|
||||
(e: "invoice"): 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 { 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 + " 23:59:59").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 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 chooseSiteId = (data: ThinkSite) => {
|
||||
where.sid = data.id;
|
||||
where.siteName = data.name;
|
||||
search();
|
||||
};
|
||||
|
||||
const chooseSiteId = (data: ThinkSite) => {
|
||||
where.sid = data.id;
|
||||
where.siteName = data.name;
|
||||
search();
|
||||
};
|
||||
/* 重置 */
|
||||
const reset = () => {
|
||||
resetFields();
|
||||
search();
|
||||
};
|
||||
|
||||
/* 重置 */
|
||||
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);
|
||||
// 导出
|
||||
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;
|
||||
})
|
||||
.finally(() => {});
|
||||
};
|
||||
}, 2000);
|
||||
})
|
||||
.catch((msg) => {
|
||||
message.error(msg);
|
||||
loading.value = false;
|
||||
})
|
||||
.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);
|
||||
});
|
||||
}
|
||||
hide();
|
||||
message.success('设置成功');
|
||||
};
|
||||
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);
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
}
|
||||
hide();
|
||||
message.success("设置成功");
|
||||
};
|
||||
|
||||
const openInvoiceByList = async () => {
|
||||
emit("invoice");
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user