|
|
@@ -1,10 +1,13 @@
|
|
|
<script setup lang="tsx">
|
|
|
-import { 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 { fetchGetLoginUserList } from '@/service/api/common';
|
|
|
import { useAppStore } from '@/store/modules/app';
|
|
|
import { defaultTransform, useNaivePaginatedTable } from '@/hooks/common/table';
|
|
|
+import { useAuth } from '@/hooks/business/auth';
|
|
|
import { copyTextToClipboard } from '@/utils/zt';
|
|
|
+import { commonExport } from '@/utils/common';
|
|
|
import { $t } from '@/locales';
|
|
|
import { useForm } from '@/components/zt/Form/hooks/useForm';
|
|
|
import { SearchForm, ShippingButton, dvyStatus, orderStatus, refundStatus } from './normal-order';
|
|
|
@@ -16,9 +19,36 @@ const activeTab = ref('all');
|
|
|
const statusList = ref<{ label: string; value: string; num?: number }[]>([]);
|
|
|
const orderMoadl = useTemplateRef('orderMoadl');
|
|
|
const ShipmentModal = useTemplateRef('Shipment');
|
|
|
-
|
|
|
-const [registerSearchForm, { getFieldsValue }] = useForm({
|
|
|
- schemas: SearchForm,
|
|
|
+const channelIdList = ref([]);
|
|
|
+const searchForm = ref();
|
|
|
+const searchParams = reactive({
|
|
|
+ current: 1,
|
|
|
+ size: 10
|
|
|
+});
|
|
|
+const [registerSearchForm, { getFieldsValue, setFieldsValue }] = useForm({
|
|
|
+ schemas: [
|
|
|
+ {
|
|
|
+ field: 'channelIdList',
|
|
|
+ label: '所属企业',
|
|
|
+ component: 'ApiSelect',
|
|
|
+ componentProps: {
|
|
|
+ api: () => fetchGetLoginUserList(),
|
|
|
+ labelFeild: 'channelName',
|
|
|
+ valueFeild: 'id',
|
|
|
+ multiple: true,
|
|
|
+ onUpdateValue: () => {
|
|
|
+ nextTick(() => {
|
|
|
+ handleSearch();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getOptions: async (options: any) => {
|
|
|
+ await setFieldsValue({ channelIdList: [options[0].id] });
|
|
|
+ handleSearch();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ...SearchForm
|
|
|
+ ],
|
|
|
showAdvancedButton: false,
|
|
|
labelWidth: 120,
|
|
|
layout: 'horizontal',
|
|
|
@@ -28,14 +58,10 @@ const [registerSearchForm, { getFieldsValue }] = useForm({
|
|
|
},
|
|
|
collapsedRows: 1
|
|
|
});
|
|
|
-const searchForm = ref();
|
|
|
-const searchParams = reactive({
|
|
|
- current: 1,
|
|
|
- size: 10
|
|
|
-});
|
|
|
const { columns, data, loading, getData, mobilePagination } = useNaivePaginatedTable({
|
|
|
api: () => fetchGetDeliveryOrderList({ ...searchParams, orderStatus: activeTab.value, ...unref(searchForm) }),
|
|
|
transform: response => defaultTransform(response),
|
|
|
+ immediate: false,
|
|
|
paginationProps: {
|
|
|
pageSizes: import.meta.env.VITE_PAGE_SIZE.split(',').map(Number)
|
|
|
},
|
|
|
@@ -199,6 +225,7 @@ const { columns, data, loading, getData, mobilePagination } = useNaivePaginatedT
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
+
|
|
|
async function handleDeivery(row: Api.delivery.deliveryOrder) {
|
|
|
if (!row.orderNumber) {
|
|
|
window.$message?.error('订单异常');
|
|
|
@@ -214,7 +241,7 @@ function handleOpenMoadl(row: Api.delivery.deliveryOrder) {
|
|
|
orderMoadl.value?.open(String(row.orderNumber));
|
|
|
}
|
|
|
async function getNums() {
|
|
|
- const { data: keyData } = await fetchGetDeliveryStatusNum();
|
|
|
+ const { data: keyData } = await fetchGetDeliveryStatusNum({ ...getFieldsValue() });
|
|
|
if (!keyData) return;
|
|
|
const orderStatusList = [
|
|
|
{
|
|
|
@@ -270,12 +297,20 @@ function handleSearch() {
|
|
|
form.endTime = form.createTime[1];
|
|
|
delete form.createTime;
|
|
|
}
|
|
|
+ channelIdList.value = form.channelIdList;
|
|
|
+ // if (form.channelIdList) {
|
|
|
+ // form.channelIdList = form.channelIdList.join(',');
|
|
|
+ // }
|
|
|
searchForm.value = form;
|
|
|
getData();
|
|
|
+ getNums();
|
|
|
}
|
|
|
function handleReset() {
|
|
|
searchForm.value = getFieldsValue();
|
|
|
+ searchForm.value.channelIdList = channelIdList.value;
|
|
|
+ setFieldsValue({ channelIdList: channelIdList.value });
|
|
|
getData();
|
|
|
+ getNums();
|
|
|
}
|
|
|
async function handleCopy(row: Api.delivery.deliveryOrder) {
|
|
|
if (!row.orderNumber) {
|
|
|
@@ -289,15 +324,16 @@ function handleRefsh() {
|
|
|
getNums();
|
|
|
}
|
|
|
function handleExport() {
|
|
|
- window.$message?.warning('功能开发中...');
|
|
|
+ const form = getFieldsValue();
|
|
|
+ commonExport('/platform/order/export', form);
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
|
|
|
<NCard :bordered="false" size="small">
|
|
|
- <NCollapse display-directive="show">
|
|
|
- <NCollapseItem title="搜索">
|
|
|
+ <NCollapse display-directive="show" default-expanded-names="search">
|
|
|
+ <NCollapseItem title="搜索" name="search">
|
|
|
<BasicForm @register-form="registerSearchForm" @submit="handleSearch" @reset="handleReset" />
|
|
|
</NCollapseItem>
|
|
|
</NCollapse>
|
|
|
@@ -321,7 +357,14 @@ function handleExport() {
|
|
|
</NScrollbar>
|
|
|
</template>
|
|
|
<template #header-extra>
|
|
|
- <NButton size="small" type="primary" class="ml20px mt30px" ghost @click="handleExport">
|
|
|
+ <NButton
|
|
|
+ v-if="useAuth().hasAuth('order:user:export')"
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ class="ml20px mt30px"
|
|
|
+ ghost
|
|
|
+ @click="handleExport"
|
|
|
+ >
|
|
|
<template #icon>
|
|
|
<SvgIcon icon="mingcute:file-export-line"></SvgIcon>
|
|
|
</template>
|