|
@@ -2,7 +2,7 @@
|
|
|
<div class="p-4">
|
|
|
<BasicTable @register="registerTable" :rowSelection="{ type: 'checkbox' }">
|
|
|
<template #toolbar>
|
|
|
- <!-- <a-button type="primary" @click="sendPackage"> 发货</a-button> -->
|
|
|
+ <a-button type="primary" @click="exportExcel"> 导出</a-button>
|
|
|
<PopConfirmButton
|
|
|
title="是否确定收货?"
|
|
|
primary
|
|
@@ -71,18 +71,23 @@
|
|
|
TableImg,
|
|
|
} from '/@/components/Table';
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
- // import { Switch } from 'ant-design-vue';
|
|
|
- // import { h } from 'vue';
|
|
|
- import { ListApi, BrandListApi, GetOrderInfoApi } from '/@/api/order/list';
|
|
|
+
|
|
|
+ import { ListApi, BrandListApi, GetOrderInfoApi, exportExcelApi } from '/@/api/order/list';
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
// import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
|
|
|
import { useGo } from '/@/hooks/web/usePage';
|
|
|
import { Time } from '/@/components/Time';
|
|
|
import { PopConfirmButton } from '/@/components/Button';
|
|
|
- // import printJS from 'print-js';
|
|
|
+
|
|
|
import { useModal } from '/@/components/Modal';
|
|
|
import ConfirmModal from './confirmModal.vue';
|
|
|
import PrintModal from './printModal.vue';
|
|
|
+ import {
|
|
|
+ downloadByUrl,
|
|
|
+ // downloadByData,
|
|
|
+ // downloadByBase64,
|
|
|
+ // downloadByOnlineUrl,
|
|
|
+ } from '/@/utils/file/download';
|
|
|
|
|
|
export default defineComponent({
|
|
|
components: {
|
|
@@ -267,7 +272,7 @@
|
|
|
|
|
|
const [registerPrintModal, { openModal: openPrintModal }] = useModal();
|
|
|
|
|
|
- const [registerTable, { getSelectRowKeys, reload }] = useTable({
|
|
|
+ const [registerTable, { getSelectRowKeys, getSelectRows, reload }] = useTable({
|
|
|
title: '订单列表',
|
|
|
api: ListApi,
|
|
|
columns: columns,
|
|
@@ -358,19 +363,25 @@
|
|
|
});
|
|
|
console.log('orderInfo', orderInfo);
|
|
|
openPrintModal(true, orderInfo);
|
|
|
- // printJS({
|
|
|
- // printable: [
|
|
|
- // { name: '订单号', email: '20210908174503807397842', phone: '123' },
|
|
|
- // { name: 'qq', email: '456@gmail.com', phone: '456' },
|
|
|
- // ],
|
|
|
- // properties: ['name', 'email', 'phone'],
|
|
|
- // type: 'json',
|
|
|
- // gridHeaderStyle: 'color: red; border: 2px solid #3971A5;',
|
|
|
- // gridStyle: 'border: 2px solid #3971A5;',
|
|
|
- // header: '<h3 class="custom-h3">订单详情</h3>',
|
|
|
- // documentTitle: '订单详情',
|
|
|
- // style: '.custom-h3 { color: red; }',
|
|
|
- // });
|
|
|
+ }
|
|
|
+ async function exportExcel() {
|
|
|
+ const rows = getSelectRows();
|
|
|
+ if (rows.length === 0) {
|
|
|
+ createMessage.info(t('modal.atLeastOne'));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const data = rows.reduce((pre, current) => pre.concat(current['orderSn']), []).join(',');
|
|
|
+ console.log('data', data);
|
|
|
+ const res = await exportExcelApi({
|
|
|
+ orderSnList: data,
|
|
|
+ });
|
|
|
+ if (res.url) {
|
|
|
+ downloadByUrl({
|
|
|
+ url: res.url,
|
|
|
+ target: '_self',
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return {
|
|
@@ -389,6 +400,7 @@
|
|
|
reload,
|
|
|
printDetail,
|
|
|
registerPrintModal,
|
|
|
+ exportExcel,
|
|
|
};
|
|
|
},
|
|
|
});
|