<template>
|
<ProTabs
|
v-model="queryState.status"
|
flexTitle
|
name="orderManage-tab"
|
:showPaneContent="false"
|
class="orderManage-tabs"
|
>
|
<ProTabPane
|
:title="`${OrderStatusText[OrderStatus.Passed]}(${passedCount})`"
|
:pane-key="OrderStatus.Passed"
|
></ProTabPane>
|
<ProTabPane
|
:title="`${OrderStatusText[OrderStatus.WaitToAudit]}(${waitToAuditCount})`"
|
:pane-key="OrderStatus.WaitToAudit"
|
></ProTabPane>
|
<ProTabPane
|
:title="`${OrderStatusText[OrderStatus.OffShelf]}(${offShelfCount})`"
|
:pane-key="OrderStatus.OffShelf"
|
></ProTabPane>
|
<ProTabPane
|
:title="`${OrderStatusText[OrderStatus.Reject]}(${rejectCount})`"
|
:pane-key="OrderStatus.Reject"
|
></ProTabPane>
|
</ProTabs>
|
<InfiniteLoading
|
:key="queryState.status"
|
scrollViewClassName="common-infinite-scroll-list"
|
v-bind="infiniteLoadingProps"
|
>
|
<template #renderItem="{ item }">
|
<OrderManageCard
|
:title="item.orderName"
|
:hireType="item.hireType"
|
:hireNumber="item.hireNumber"
|
:hireEndNumber="item.hireEndNumber"
|
:ageStart="item.ageStart"
|
:ageEnd="item.ageEnd"
|
:provinceName="item.provinceName"
|
:cityName="item.cityName"
|
:time="item.creationTime"
|
:orderSupplierRefundInfo="item.orderSupplierRefundInfo"
|
:integratedSalary="item.integratedSalary"
|
:status="item.status"
|
@edit="handleEdit(item)"
|
@stop="handleStop(item)"
|
@delete="handleDelete(item)"
|
@detail="handleGoDetail(item)"
|
@publish="handleRePublish(item)"
|
@copy="handleCopy(item)"
|
>
|
</OrderManageCard>
|
</template>
|
</InfiniteLoading>
|
</template>
|
|
<script setup lang="ts">
|
import { useInfiniteLoading } from '@12333/hooks';
|
import * as orderServices from '@12333/services/api/Order';
|
import {
|
OrderInputType,
|
IndustryCategoryType,
|
OrderStatusText,
|
OrderStatus,
|
} from '@12333/constants';
|
import { useAccessPersonalInfo, useCategoryMenu, useOrderActions } from '@/hooks';
|
import { CategoryUtils } from '@12333/utils';
|
import Taro from '@tarojs/taro';
|
import { ProTabs, ProTabPane } from '@12333/components';
|
|
const queryState = reactive({
|
categoryId: '',
|
status: OrderStatus.Passed,
|
});
|
|
const { ensureCategoryMenu, categoryMenuList: industryServicesCategoryList } = useCategoryMenu({
|
type: IndustryCategoryType.IndustryServices,
|
});
|
|
onMounted(async () => {
|
await ensureCategoryMenu();
|
queryState.categoryId = industryServicesCategoryList.value.find((x) =>
|
CategoryUtils.isIHasOrder(x.name)
|
).id;
|
});
|
|
const objectData = ref<{ status: OrderStatus; count: number }[]>([]);
|
|
const { infiniteLoadingProps, invalidateQueries } = useInfiniteLoading(
|
async ({ pageParam }) => {
|
let params: API.MyOrderListInput = {
|
pageModel: {
|
rows: 20,
|
page: pageParam,
|
orderInput: [{ property: 'id', order: OrderInputType.Desc }],
|
},
|
categoryId: queryState.categoryId,
|
status: queryState.status,
|
};
|
|
let res = await orderServices.getMyOrderList(params, {
|
showLoading: false,
|
});
|
objectData.value = res.objectData;
|
return res;
|
},
|
{
|
queryKey: ['orderServices/getMyOrderList', queryState],
|
enabled: computed(() => !!queryState.categoryId),
|
}
|
);
|
|
const passedCount = computed(
|
() => objectData.value?.find?.((x) => x.status === OrderStatus.Passed)?.count ?? 0
|
);
|
|
const waitToAuditCount = computed(
|
() => objectData.value?.find?.((x) => x.status === OrderStatus.WaitToAudit)?.count ?? 0
|
);
|
|
const offShelfCount = computed(
|
() => objectData.value?.find?.((x) => x.status === OrderStatus.OffShelf)?.count ?? 0
|
);
|
|
const rejectCount = computed(
|
() => objectData.value?.find?.((x) => x.status === OrderStatus.Reject)?.count ?? 0
|
);
|
|
const { handleEdit, handleGoDetail, handleStop, handleRePublish, handleCopy, handleDelete } =
|
useOrderActions({
|
onStopSuccess() {
|
invalidateQueries();
|
},
|
onDeleteSuccess() {
|
invalidateQueries();
|
},
|
});
|
</script>
|