|
@@ -1,46 +1,65 @@
|
|
<template>
|
|
<template>
|
|
|
|
+ <div>
|
|
<BasicTable @register="registerTable">
|
|
<BasicTable @register="registerTable">
|
|
<template #toolbar>
|
|
<template #toolbar>
|
|
<a-button type="primary" @click="exportExcel"> 导出</a-button>
|
|
<a-button type="primary" @click="exportExcel"> 导出</a-button>
|
|
</template>
|
|
</template>
|
|
- <template #bodyCell="{ column, record }">
|
|
|
|
- <template v-if="column.key === 'action'">
|
|
|
|
|
|
+ <template #action="{ record }">
|
|
<TableAction
|
|
<TableAction
|
|
stopButtonPropagation
|
|
stopButtonPropagation
|
|
:actions="[
|
|
:actions="[
|
|
{
|
|
{
|
|
- label: '删除',
|
|
|
|
- icon: 'ic:outline-delete-outline',
|
|
|
|
- onClick: handleDelete.bind(null, record),
|
|
|
|
|
|
+ label: '开票登记',
|
|
|
|
+ icon: 'la:file-invoice-dollar',
|
|
|
|
+ ifShow:record.invoiced==0,
|
|
|
|
+ onClick: handleInvoice.bind(null, record),
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ label: '电子发票',
|
|
|
|
+ ifShow:record.type == 2 && record.invoiced==1,
|
|
|
|
+ icon: 'simple-icons:invoiceninja',
|
|
|
|
+ onClick: headleDetails.bind(null, record),
|
|
},
|
|
},
|
|
- ]"
|
|
|
|
- :dropDownActions="[
|
|
|
|
{
|
|
{
|
|
- label: '启用',
|
|
|
|
- popConfirm: {
|
|
|
|
- title: '是否启用?',
|
|
|
|
- confirm: handleOpen.bind(null, record),
|
|
|
|
- },
|
|
|
|
|
|
+ label: '快递单号',
|
|
|
|
+ ifShow:record.type != 2&& record.invoiced==1,
|
|
|
|
+ icon: 'icon-park-outline:express-delivery',
|
|
|
|
+ onClick: headleDetails.bind(null, record),
|
|
},
|
|
},
|
|
]"
|
|
]"
|
|
/>
|
|
/>
|
|
- </template>
|
|
|
|
</template>
|
|
</template>
|
|
</BasicTable>
|
|
</BasicTable>
|
|
|
|
+ <AddModal @update="reload" @register="registerAddModal" />
|
|
|
|
+ <EditModal @register="registerEditModal" @update="reload" />
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
- import { defineComponent, h } from 'vue';
|
|
|
|
- import { BasicTable, useTable, TableAction, BasicColumn, TableImg, FormProps } from '/@/components/Table';
|
|
|
|
|
|
+ import { defineComponent, h, reactive } from 'vue';
|
|
|
|
+ import { BasicTable, useTable, TableAction, TableImg } from '/@/components/Table';
|
|
import { PageWrapper } from '/@/components/Page';
|
|
import { PageWrapper } from '/@/components/Page';
|
|
- import { Time } from '/@/components/Time';
|
|
|
|
|
|
+ import { useModal } from '/@/components/Modal';
|
|
import { Descriptions } from 'ant-design-vue';
|
|
import { Descriptions } from 'ant-design-vue';
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
- import { Switch } from 'ant-design-vue';
|
|
|
|
- import { InvoiceList,DownExport } from '/@/api/order'
|
|
|
|
-
|
|
|
|
|
|
+ import { InvoiceList,InvoiceExport } from '/@/api/order'
|
|
|
|
+ import { downloadByData } from '/@/utils/file/download'
|
|
|
|
+ import { searchForm, columns } from './data'
|
|
|
|
+ import AddModal from './InvoiceModal.vue';
|
|
|
|
+ import EditModal from './EditModal.vue';
|
|
|
|
+ interface apiDataParam {
|
|
|
|
+ orderSn?: string;
|
|
|
|
+ payTimeStart?: string;
|
|
|
|
+ payTimeEnd?: string;
|
|
|
|
+ invoiceTimeStart?: string;
|
|
|
|
+ invoiceTimeEnd?: string;
|
|
|
|
+ orderBy?: string;
|
|
|
|
+ sortBy?: string;
|
|
|
|
+ }
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
components: {
|
|
components: {
|
|
|
|
+ AddModal,
|
|
|
|
+ EditModal,
|
|
BasicTable,
|
|
BasicTable,
|
|
TableAction,
|
|
TableAction,
|
|
PageWrapper,
|
|
PageWrapper,
|
|
@@ -50,92 +69,19 @@
|
|
},
|
|
},
|
|
setup() {
|
|
setup() {
|
|
const { t } = useI18n();
|
|
const { t } = useI18n();
|
|
|
|
+ const apiData = reactive<apiDataParam>({
|
|
|
|
+ orderSn: '',
|
|
|
|
+ payTimeStart: '',
|
|
|
|
+ payTimeEnd: '',
|
|
|
|
+ invoiceTimeStart: '',
|
|
|
|
+ invoiceTimeEnd: '',
|
|
|
|
+ orderBy: '',
|
|
|
|
+ sortBy: '',
|
|
|
|
+ });
|
|
const { createMessage,createConfirm } = useMessage();
|
|
const { createMessage,createConfirm } = useMessage();
|
|
- const columns: BasicColumn[] = [
|
|
|
|
- {
|
|
|
|
- title: '时间',
|
|
|
|
- dataIndex: 'createTime',
|
|
|
|
- width: 150,
|
|
|
|
- customRender: ({ record }) => {
|
|
|
|
- return (
|
|
|
|
- record.createTime &&
|
|
|
|
- h(Time, {
|
|
|
|
- value: record.createTime,
|
|
|
|
- mode: 'datetime',
|
|
|
|
- })
|
|
|
|
- );
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '订单号',
|
|
|
|
- dataIndex: 'orderSn',
|
|
|
|
- ellipsis: false,
|
|
|
|
- width: 180,
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '用户名',
|
|
|
|
- dataIndex: 'userName',
|
|
|
|
- width: 80,
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '订单金额',
|
|
|
|
- dataIndex: 'amount',
|
|
|
|
- width: 80,
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '支付方式',
|
|
|
|
- dataIndex: 'payType',
|
|
|
|
- // slots: { customRender: 'orderType' },
|
|
|
|
- width: 80,
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '订单状态',
|
|
|
|
- dataIndex: 'payStatus',
|
|
|
|
- // slots: { customRender: 'orderStatus' },
|
|
|
|
- width: 80,
|
|
|
|
- },
|
|
|
|
- ];
|
|
|
|
- const searchForm: Partial<FormProps> = {
|
|
|
|
- labelWidth: 100,
|
|
|
|
- schemas: [
|
|
|
|
- {
|
|
|
|
- field: 'sceneName',
|
|
|
|
- label: '开票申请时间',
|
|
|
|
- component: 'RangePicker',
|
|
|
|
- componentProps: {
|
|
|
|
- maxLength: 100,
|
|
|
|
- },
|
|
|
|
- colProps: {
|
|
|
|
- xl: 7,
|
|
|
|
- xxl: 7,
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- field: 'sceneName',
|
|
|
|
- label: '支付时间',
|
|
|
|
- component: 'RangePicker',
|
|
|
|
- componentProps: {
|
|
|
|
- maxLength: 100,
|
|
|
|
- },
|
|
|
|
- colProps: {
|
|
|
|
- xl: 7,
|
|
|
|
- xxl: 7,
|
|
|
|
- },
|
|
|
|
- },{
|
|
|
|
- field: 'sceneName',
|
|
|
|
- label: '订单号',
|
|
|
|
- component: 'Input',
|
|
|
|
- componentProps: {
|
|
|
|
- maxLength: 100,
|
|
|
|
- },
|
|
|
|
- colProps: {
|
|
|
|
- xl: 6,
|
|
|
|
- xxl: 6,
|
|
|
|
- },
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
- };
|
|
|
|
- const [registerTable] = useTable({
|
|
|
|
|
|
+ const [registerAddModal, { openModal: openAddModal }] = useModal();
|
|
|
|
+ const [registerEditModal, { openModal: openEditModal }] = useModal();
|
|
|
|
+ const [registerTable, { reload }] = useTable({
|
|
api: InvoiceList,
|
|
api: InvoiceList,
|
|
title: '发票列表',
|
|
title: '发票列表',
|
|
// titleHelpMessage: ['已启用expandRowByClick', '已启用stopButtonPropagation'],
|
|
// titleHelpMessage: ['已启用expandRowByClick', '已启用stopButtonPropagation'],
|
|
@@ -143,36 +89,79 @@
|
|
useSearchForm: true,
|
|
useSearchForm: true,
|
|
formConfig: searchForm,
|
|
formConfig: searchForm,
|
|
showTableSetting: true,
|
|
showTableSetting: true,
|
|
|
|
+ showIndexColumn:false,
|
|
rowKey: 'id',
|
|
rowKey: 'id',
|
|
|
|
+ beforeFetch:(params) =>{
|
|
|
|
+ let searchData = {
|
|
|
|
+ orderSn: params.orderSn,
|
|
|
|
+ payTimeStart: params.payTime && params.payTime[0],
|
|
|
|
+ payTimeEnd: params.payTime && params.payTime[1],
|
|
|
|
+ invoiceTimeStart: params.invoiceTime && params.invoiceTime[0],
|
|
|
|
+ invoiceTimeEnd: params.invoiceTime && params.invoiceTime[1],
|
|
|
|
+ }
|
|
|
|
+ apiData.orderSn = searchData.orderSn
|
|
|
|
+ apiData.payTimeStart = searchData.payTimeStart
|
|
|
|
+ apiData.payTimeEnd = searchData.payTimeEnd
|
|
|
|
+ apiData.invoiceTimeStart = searchData.invoiceTimeStart
|
|
|
|
+ apiData.invoiceTimeEnd = searchData.invoiceTimeEnd
|
|
|
|
+ return {
|
|
|
|
+ ...params,
|
|
|
|
+ ...searchData,
|
|
|
|
+ }
|
|
|
|
+ },
|
|
fetchSetting: {
|
|
fetchSetting: {
|
|
pageField: 'pageNum',
|
|
pageField: 'pageNum',
|
|
- sizeField: 'size',
|
|
|
|
- listField: 'records',
|
|
|
|
|
|
+ sizeField: 'pageSize',
|
|
|
|
+ listField: 'list',
|
|
totalField: 'total',
|
|
totalField: 'total',
|
|
},
|
|
},
|
|
|
|
+ actionColumn: {
|
|
|
|
+ width: 100,
|
|
|
|
+ title: '操作',
|
|
|
|
+ fixed: 'right',
|
|
|
|
+ dataIndex: 'action',
|
|
|
|
+ slots: { customRender: 'action' },
|
|
|
|
+ },
|
|
canResize: false,
|
|
canResize: false,
|
|
});
|
|
});
|
|
function handleDelete(record: Recordable) {
|
|
function handleDelete(record: Recordable) {
|
|
console.log('点击了删除', record);
|
|
console.log('点击了删除', record);
|
|
}
|
|
}
|
|
- function handleOpen(record: Recordable) {
|
|
|
|
- console.log('点击了启用', record);
|
|
|
|
|
|
+ function handleInvoice(record: Recordable) {
|
|
|
|
+ openAddModal(true, {
|
|
|
|
+ ...record,
|
|
|
|
+ });
|
|
}
|
|
}
|
|
- function exportExcel() {
|
|
|
|
|
|
+ function handleEdit(record: Recordable) {
|
|
|
|
+ console.log('record', record);
|
|
|
|
+ }
|
|
|
|
+ function headleDetails(record: Recordable) {
|
|
|
|
+ console.log('record', record);
|
|
|
|
+ openEditModal(true, {
|
|
|
|
+ ...record,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ function exportExcel() {
|
|
createConfirm({
|
|
createConfirm({
|
|
iconType: 'warning',
|
|
iconType: 'warning',
|
|
title: () => h('span', '温馨提示'),
|
|
title: () => h('span', '温馨提示'),
|
|
- content: () => h('span', '确定当前标签下的订单记录?'),
|
|
|
|
|
|
+ content: () => h('span', '确定导出当前发票所有记录?'),
|
|
onOk: async () => {
|
|
onOk: async () => {
|
|
- await DownExport();
|
|
|
|
|
|
+ const blodData:BlobPart = await InvoiceExport(apiData);
|
|
|
|
+ downloadByData(blodData,'发票记录')
|
|
},
|
|
},
|
|
});
|
|
});
|
|
}
|
|
}
|
|
return {
|
|
return {
|
|
registerTable,
|
|
registerTable,
|
|
handleDelete,
|
|
handleDelete,
|
|
- handleOpen,
|
|
|
|
|
|
+ registerAddModal,
|
|
|
|
+ registerEditModal,
|
|
|
|
+ handleInvoice,
|
|
exportExcel,
|
|
exportExcel,
|
|
|
|
+ handleEdit,
|
|
|
|
+ headleDetails,
|
|
|
|
+ reload,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
});
|
|
});
|