|
@@ -1,5 +1,5 @@
|
|
|
<script setup lang="tsx">
|
|
<script setup lang="tsx">
|
|
|
-import { nextTick, onMounted, reactive, ref, watch } from 'vue';
|
|
|
|
|
|
|
+import { nextTick, onMounted, reactive, ref, unref, useTemplateRef, watch } from 'vue';
|
|
|
import type { TabsInst } from 'naive-ui';
|
|
import type { TabsInst } from 'naive-ui';
|
|
|
import { NImage, NTag } from 'naive-ui';
|
|
import { NImage, NTag } from 'naive-ui';
|
|
|
import { fetchGetDeliveryOrderList, fetchGetDeliveryStatusNum } from '@/service/api/delivery/normal-orde';
|
|
import { fetchGetDeliveryOrderList, fetchGetDeliveryStatusNum } from '@/service/api/delivery/normal-orde';
|
|
@@ -8,12 +8,13 @@ import { defaultTransform, useNaivePaginatedTable } from '@/hooks/common/table';
|
|
|
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 { SearchForm, orderStatus, refundStatus } from './normal-order';
|
|
import { SearchForm, orderStatus, refundStatus } from './normal-order';
|
|
|
|
|
+import NormalMoadl from './component/normal-moadl.vue';
|
|
|
const appStore = useAppStore();
|
|
const appStore = useAppStore();
|
|
|
const checkedRowKeys = ref([]);
|
|
const checkedRowKeys = ref([]);
|
|
|
const activeTab = ref('all');
|
|
const activeTab = ref('all');
|
|
|
const statusList = ref<{ label: string; value: string; num?: number }[]>([]);
|
|
const statusList = ref<{ label: string; value: string; num?: number }[]>([]);
|
|
|
-const wrapperRef = ref<HTMLElement | null>(null);
|
|
|
|
|
const tabsInstRef = ref<TabsInst | null>(null);
|
|
const tabsInstRef = ref<TabsInst | null>(null);
|
|
|
|
|
+const orderMoadl = useTemplateRef('orderMoadl');
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
|
tabsInstRef.value?.syncBarPosition();
|
|
tabsInstRef.value?.syncBarPosition();
|
|
@@ -31,12 +32,13 @@ const [registerSearchForm, { getFieldsValue }] = useForm({
|
|
|
},
|
|
},
|
|
|
collapsedRows: 1
|
|
collapsedRows: 1
|
|
|
});
|
|
});
|
|
|
|
|
+const searchForm = ref();
|
|
|
const searchParams = reactive({
|
|
const searchParams = reactive({
|
|
|
current: 1,
|
|
current: 1,
|
|
|
size: 10
|
|
size: 10
|
|
|
});
|
|
});
|
|
|
const { columns, data, loading, getData, mobilePagination } = useNaivePaginatedTable({
|
|
const { columns, data, loading, getData, mobilePagination } = useNaivePaginatedTable({
|
|
|
- api: () => fetchGetDeliveryOrderList({ ...searchParams, orderStatus: activeTab.value, ...getFieldsValue() }),
|
|
|
|
|
|
|
+ api: () => fetchGetDeliveryOrderList({ ...searchParams, orderStatus: activeTab.value, ...unref(searchForm) }),
|
|
|
transform: response => defaultTransform(response),
|
|
transform: response => defaultTransform(response),
|
|
|
onPaginationParamsChange: params => {
|
|
onPaginationParamsChange: params => {
|
|
|
searchParams.current = Number(params.page);
|
|
searchParams.current = Number(params.page);
|
|
@@ -151,11 +153,26 @@ const { columns, data, loading, getData, mobilePagination } = useNaivePaginatedT
|
|
|
title: $t('common.operate'),
|
|
title: $t('common.operate'),
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
width: 130,
|
|
width: 130,
|
|
|
- fixed: 'right'
|
|
|
|
|
|
|
+ fixed: 'right',
|
|
|
|
|
+ render: row => {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div class={'mt7'}>
|
|
|
|
|
+ <n-button size="small" type="primary" quaternary onClick={() => handleOpenMoadl(row)}>
|
|
|
|
|
+ 查看订单
|
|
|
|
|
+ </n-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
|
|
+function handleOpenMoadl(row: Api.delivery.deliveryOrder) {
|
|
|
|
|
+ if (!row.orderNumber) {
|
|
|
|
|
+ window.$message?.error('订单异常');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ orderMoadl.value?.open(String(row.orderNumber));
|
|
|
|
|
+}
|
|
|
async function getNums() {
|
|
async function getNums() {
|
|
|
const { data: keyData } = await fetchGetDeliveryStatusNum();
|
|
const { data: keyData } = await fetchGetDeliveryStatusNum();
|
|
|
if (!keyData) return;
|
|
if (!keyData) return;
|
|
@@ -202,17 +219,32 @@ getNums();
|
|
|
watch(
|
|
watch(
|
|
|
() => [activeTab.value],
|
|
() => [activeTab.value],
|
|
|
() => {
|
|
() => {
|
|
|
|
|
+ searchParams.current = 1;
|
|
|
getData();
|
|
getData();
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
|
|
+function handleSearch() {
|
|
|
|
|
+ const form = getFieldsValue();
|
|
|
|
|
+ if (form.createTime) {
|
|
|
|
|
+ form.startTime = form.createTime[0];
|
|
|
|
|
+ form.endTime = form.createTime[1];
|
|
|
|
|
+ delete form.createTime;
|
|
|
|
|
+ }
|
|
|
|
|
+ searchForm.value = form;
|
|
|
|
|
+ getData();
|
|
|
|
|
+}
|
|
|
|
|
+function handleReset() {
|
|
|
|
|
+ searchForm.value = getFieldsValue();
|
|
|
|
|
+ getData();
|
|
|
|
|
+}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
<template>
|
|
|
- <div ref="wrapperRef" class="flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
|
|
|
|
|
|
|
+ <div class="flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
|
|
|
<NCard :bordered="false" size="small">
|
|
<NCard :bordered="false" size="small">
|
|
|
- <NCollapse display-directive="show" :default-expanded-names="['dept-search']">
|
|
|
|
|
- <NCollapseItem title="搜索" name="dept-search">
|
|
|
|
|
- <BasicForm @register-form="registerSearchForm" />
|
|
|
|
|
|
|
+ <NCollapse display-directive="show">
|
|
|
|
|
+ <NCollapseItem title="搜索">
|
|
|
|
|
+ <BasicForm @register-form="registerSearchForm" @submit="handleSearch" @reset="handleReset" />
|
|
|
</NCollapseItem>
|
|
</NCollapseItem>
|
|
|
</NCollapse>
|
|
</NCollapse>
|
|
|
</NCard>
|
|
</NCard>
|
|
@@ -240,8 +272,7 @@ watch(
|
|
|
/>
|
|
/>
|
|
|
</NTabPane>
|
|
</NTabPane>
|
|
|
</NTabs>
|
|
</NTabs>
|
|
|
-
|
|
|
|
|
- <!-- <BasicModal @register="registerModal" @ok="handleSubmit"></BasicModal> -->
|
|
|
|
|
|
|
+ <NormalMoadl ref="orderMoadl" @finish="(getData, getNums)"></NormalMoadl>
|
|
|
</NCard>
|
|
</NCard>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|