|
@@ -1,7 +1,14 @@
|
|
|
<script setup lang="tsx">
|
|
<script setup lang="tsx">
|
|
|
import { nextTick, reactive, ref, unref, useTemplateRef, watch } from 'vue';
|
|
import { nextTick, reactive, ref, unref, useTemplateRef, watch } from 'vue';
|
|
|
-import { NImage, NTag } from 'naive-ui';
|
|
|
|
|
-import { fetchGetDeliveryOrderList, fetchGetDeliveryStatusNum } from '@/service/api/delivery/normal-orde';
|
|
|
|
|
|
|
+import { NImage, NTag, useDialog } from 'naive-ui';
|
|
|
|
|
+import type { InternalRowData } from 'naive-ui/es/data-table/src/interface';
|
|
|
|
|
+import {
|
|
|
|
|
+ fetchBreakDownload,
|
|
|
|
|
+ fetchExportList,
|
|
|
|
|
+ fetchExportOrderList,
|
|
|
|
|
+ fetchGetDeliveryOrderList,
|
|
|
|
|
+ fetchGetDeliveryStatusNum
|
|
|
|
|
+} from '@/service/api/delivery/normal-orde';
|
|
|
import { fetchGetLoginUserList } from '@/service/api/common';
|
|
import { fetchGetLoginUserList } from '@/service/api/common';
|
|
|
import { useAppStore } from '@/store/modules/app';
|
|
import { useAppStore } from '@/store/modules/app';
|
|
|
import { defaultTransform, useNaivePaginatedTable } from '@/hooks/common/table';
|
|
import { defaultTransform, useNaivePaginatedTable } from '@/hooks/common/table';
|
|
@@ -10,6 +17,9 @@ import { copyTextToClipboard } from '@/utils/zt';
|
|
|
import { commonExport } from '@/utils/common';
|
|
import { commonExport } from '@/utils/common';
|
|
|
import { $t } from '@/locales';
|
|
import { $t } from '@/locales';
|
|
|
import { useForm } from '@/components/zt/Form/hooks/useForm';
|
|
import { useForm } from '@/components/zt/Form/hooks/useForm';
|
|
|
|
|
+import { useModal } from '@/components/zt/Modal/hooks/useModal';
|
|
|
|
|
+import { useTable } from '@/components/zt/Table/hooks/useTable';
|
|
|
|
|
+// import { type } from '../../../../packages/axios/src/index';
|
|
|
import { SearchForm, ShippingButton, dvyStatus, orderStatus, refundStatus } from './normal-order';
|
|
import { SearchForm, ShippingButton, dvyStatus, orderStatus, refundStatus } from './normal-order';
|
|
|
import DeliveryModal from './component/delivery-modal.vue';
|
|
import DeliveryModal from './component/delivery-modal.vue';
|
|
|
import NormalMoadl from './component/normal-modal.vue';
|
|
import NormalMoadl from './component/normal-modal.vue';
|
|
@@ -227,6 +237,116 @@ const { columns, data, loading, getData, mobilePagination } = useNaivePaginatedT
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+const [registerTable, { refresh, setTableLoading }] = useTable({
|
|
|
|
|
+ tableConfig: {
|
|
|
|
|
+ keyField: 'id',
|
|
|
|
|
+ title: '',
|
|
|
|
|
+ showAddButton: false,
|
|
|
|
|
+ showTableHeaderAction: false,
|
|
|
|
|
+ showSearch: false,
|
|
|
|
|
+ minHeight: 400
|
|
|
|
|
+ }
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const exportColumns: NaiveUI.TableColumn<InternalRowData>[] = [
|
|
|
|
|
+ {
|
|
|
|
|
+ key: 'index',
|
|
|
|
|
+ title: '序号',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ width: 100,
|
|
|
|
|
+ render(_, rowIndex) {
|
|
|
|
|
+ return rowIndex + 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ key: 'taskName',
|
|
|
|
|
+ title: '任务名称',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ minWidth: 100
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ key: 'updateTime',
|
|
|
|
|
+ title: '时间',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ minWidth: 100,
|
|
|
|
|
+ render: row => {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <div>创建时间:{row.createTime}</div>
|
|
|
|
|
+ <div>完成时间:{row.updateTime}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ key: 'operator',
|
|
|
|
|
+ title: '操作人',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ minWidth: 100
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ key: 'exportStatus',
|
|
|
|
|
+ title: '状态',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ minWidth: 100,
|
|
|
|
|
+ render: row => {
|
|
|
|
|
+ if (row.exportStatus == 0) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div>
|
|
|
|
|
+ 请耐心等待,正在导出中...
|
|
|
|
|
+ <n-button text type="info" onClick={() => handleBreak(row.id as string)}>
|
|
|
|
|
+ 中断
|
|
|
|
|
+ </n-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ );
|
|
|
|
|
+ } else if (row.exportStatus == 1) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div>
|
|
|
|
|
+ 未下载
|
|
|
|
|
+ <n-button text type="info" onClick={() => handleDownload(row.id as string)}>
|
|
|
|
|
+ 下载
|
|
|
|
|
+ </n-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ );
|
|
|
|
|
+ } else if (row.exportStatus == 2) {
|
|
|
|
|
+ return <div class={'text-gray-500'}>生成文件失败</div>;
|
|
|
|
|
+ } else if (row.exportStatus == 3) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div>
|
|
|
|
|
+ 已下载
|
|
|
|
|
+ <n-button text type="info" onClick={() => handleDownload(row.id as string)}>
|
|
|
|
|
+ 下载
|
|
|
|
|
+ </n-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ );
|
|
|
|
|
+ } else if (row.exportStatus == 4) {
|
|
|
|
|
+ return <div>导出失败</div>;
|
|
|
|
|
+ }
|
|
|
|
|
+ return <div>进行中</div>;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+];
|
|
|
|
|
+
|
|
|
|
|
+async function handleDownload(id: string) {
|
|
|
|
|
+ setTableLoading(true);
|
|
|
|
|
+ await commonExport('/platform/exportTask/download', { fileId: id }, '正常订单列表.xlsx');
|
|
|
|
|
+ refresh();
|
|
|
|
|
+}
|
|
|
|
|
+async function handleBreak(id: string) {
|
|
|
|
|
+ setTableLoading(true);
|
|
|
|
|
+ await fetchBreakDownload(id);
|
|
|
|
|
+ refresh();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const [registerModalPrice, { openModal }] = useModal({
|
|
|
|
|
+ title: '导出记录',
|
|
|
|
|
+ width: 1200,
|
|
|
|
|
+ height: 600,
|
|
|
|
|
+ showFooter: false
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const dialog = useDialog();
|
|
|
|
|
+
|
|
|
async function handleDeivery(row: Api.delivery.deliveryOrder) {
|
|
async function handleDeivery(row: Api.delivery.deliveryOrder) {
|
|
|
if (!row.orderNumber) {
|
|
if (!row.orderNumber) {
|
|
|
window.$message?.error('订单异常');
|
|
window.$message?.error('订单异常');
|
|
@@ -332,11 +452,38 @@ function handleRefsh() {
|
|
|
async function handleExport() {
|
|
async function handleExport() {
|
|
|
loading.value = true;
|
|
loading.value = true;
|
|
|
try {
|
|
try {
|
|
|
- await commonExport(
|
|
|
|
|
- '/platform/order/export',
|
|
|
|
|
- { ...getFieldsValue(), orderStatus: activeTab.value },
|
|
|
|
|
- '正常订单列表.xlsx'
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // await commonExport(
|
|
|
|
|
+ // '/platform/order/export',
|
|
|
|
|
+ // { ...getFieldsValue(), orderStatus: activeTab.value },
|
|
|
|
|
+ // '正常订单列表.xlsx'
|
|
|
|
|
+ // );
|
|
|
|
|
+ await fetchExportOrderList({ ...getFieldsValue(), orderStatus: activeTab.value });
|
|
|
|
|
+ dialog.success({
|
|
|
|
|
+ title: '提示',
|
|
|
|
|
+ content: () => {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <p>导出操作进行中......</p>
|
|
|
|
|
+ <p>是否进入导出记录</p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ );
|
|
|
|
|
+ },
|
|
|
|
|
+ positiveText: '确定',
|
|
|
|
|
+ negativeText: '取消',
|
|
|
|
|
+ onPositiveClick: () => {
|
|
|
|
|
+ openModal();
|
|
|
|
|
+ },
|
|
|
|
|
+ onNegativeClick: () => {}
|
|
|
|
|
+ });
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ loading.value = false;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+async function handleExportLog() {
|
|
|
|
|
+ loading.value = true;
|
|
|
|
|
+ try {
|
|
|
|
|
+ openModal();
|
|
|
} finally {
|
|
} finally {
|
|
|
loading.value = false;
|
|
loading.value = false;
|
|
|
}
|
|
}
|
|
@@ -386,6 +533,17 @@ async function handleExport() {
|
|
|
</template>
|
|
</template>
|
|
|
导出
|
|
导出
|
|
|
</NButton>
|
|
</NButton>
|
|
|
|
|
+ <NButton
|
|
|
|
|
+ v-if="useAuth().hasAuth('order:user:export')"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ class="ml20px mt30px"
|
|
|
|
|
+ ghost
|
|
|
|
|
+ :loading="loading"
|
|
|
|
|
+ @click="handleExportLog"
|
|
|
|
|
+ >
|
|
|
|
|
+ 导出记录
|
|
|
|
|
+ </NButton>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<NDataTable
|
|
<NDataTable
|
|
@@ -404,6 +562,17 @@ async function handleExport() {
|
|
|
<NormalMoadl ref="orderMoadl" @finish="handleRefsh"></NormalMoadl>
|
|
<NormalMoadl ref="orderMoadl" @finish="handleRefsh"></NormalMoadl>
|
|
|
<DeliveryModal ref="Shipment" @finish="handleRefsh"></DeliveryModal>
|
|
<DeliveryModal ref="Shipment" @finish="handleRefsh"></DeliveryModal>
|
|
|
</NCard>
|
|
</NCard>
|
|
|
|
|
+ <BasicModal @register="registerModalPrice" @after-leave="refresh">
|
|
|
|
|
+ <LayoutTable>
|
|
|
|
|
+ <ZTable
|
|
|
|
|
+ :show-table-action="false"
|
|
|
|
|
+ :columns="exportColumns"
|
|
|
|
|
+ :api="fetchExportList"
|
|
|
|
|
+ :default-params="{ exportType: 1 }"
|
|
|
|
|
+ @register="registerTable"
|
|
|
|
|
+ ></ZTable>
|
|
|
|
|
+ </LayoutTable>
|
|
|
|
|
+ </BasicModal>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|