From 25708e3f81956c1517f495e3303a6c8d08bb730c Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期四, 25 十二月 2025 16:09:02 +0800
Subject: [PATCH] fix: 甲方小程序
---
apps/housekeepingMiniApp/src/pages/service/InnerPage.vue | 93 +++++++++++++++++++++++++++++++++++++++-------
1 files changed, 79 insertions(+), 14 deletions(-)
diff --git a/apps/housekeepingMiniApp/src/pages/service/InnerPage.vue b/apps/housekeepingMiniApp/src/pages/service/InnerPage.vue
index b46deb7..408f1a6 100644
--- a/apps/housekeepingMiniApp/src/pages/service/InnerPage.vue
+++ b/apps/housekeepingMiniApp/src/pages/service/InnerPage.vue
@@ -1,35 +1,93 @@
<template>
- <nut-category :category="category" @change="change" class="category-page-inner">
+ <ProCategory ref="categoryRef" :category="category" @change="change" class="category-page-inner">
<nut-category-pane :categoryChild="data.categoryChild" @onChange="onChange">
</nut-category-pane>
- </nut-category>
+ </ProCategory>
</template>
<script setup lang="ts">
import Taro from '@tarojs/taro';
-import { useCheckReceiveTasks, useDictionaryDataSelect, useTaskList } from '@12333/hooks';
-import { CategoryCode, PositionCodeEnum } from '@12333/constants';
-import dayjs from 'dayjs';
-import { categorydata } from './3x_categoryData';
+import { useDictionaryDataSelect, useStandardServiceList } from '@12333/hooks';
+import { CategoryCode, EnumStandardServiceReleaseStatus, PositionCodeEnum } from '@12333/constants';
+import { setOSSLink } from '@12333/utils';
+import { ProCategory } from '@12333/components';
+import { useSystemStore } from '@/stores/modules/system';
defineOptions({
name: 'InnerPage',
});
const router = Taro.useRouter();
-const id = router.params?.id ?? '';
+const systemStore = useSystemStore();
+const { servicePageJobCode } = storeToRefs(systemStore);
+
+const categoryRef = ref();
const data = reactive({
- categoryInfo: categorydata.categoryInfo,
- category: categorydata.categoryInfo.category,
- categoryChild: categorydata.categoryChild,
+ category: [],
+ categoryChild: [],
});
-const { dictionaryDataList: positionList } = useDictionaryDataSelect({
+const { dictionaryDataList: positionList, ensureQueryData } = useDictionaryDataSelect({
categoryCode: CategoryCode.Position,
field1: PositionCodeEnum.Housekeeping,
});
+const { ensureStandardServiceList, standardServiceListForCategoryMap } = useStandardServiceList({
+ params: {
+ releaseStatus: EnumStandardServiceReleaseStatus.InProcess,
+ },
+});
+
+onMounted(async () => {
+ try {
+ await Promise.all([ensureQueryData(), ensureStandardServiceList()]);
+ if (positionList.value.length > 0 && categoryRef.value) {
+ initCategory();
+ // const first = positionList.value[0];
+ // data.categoryChild = convertCategoryChild(
+ // first.value,
+ // standardServiceListForCategoryMap.value[first.value]
+ // );
+ }
+ } catch (error) {}
+});
+
+function initCategory() {
+ const currentIndex = Math.max(
+ positionList.value.findIndex((x) => x.value === servicePageJobCode.value),
+ 0
+ );
+ categoryRef.value.getChildList(currentIndex);
+ systemStore.setServicePageJobCode('');
+}
+
+watch(servicePageJobCode, () => {
+ if (servicePageJobCode.value) {
+ initCategory();
+ }
+});
+
+function convertCategoryChild(jobCode: string, list: API.GetStandardServicesQueryResultItem[]) {
+ const categoryChild = {
+ catId: jobCode,
+ catName: '',
+ catLevel: 2,
+ catType: 1,
+ childCateList: [],
+ };
+ if (list?.length > 0) {
+ categoryChild.childCateList = list.map((x) => ({
+ backImg: setOSSLink(x.file),
+ catId: x.id,
+ catName: x.name,
+ showPic: true,
+ showVideo: false,
+ }));
+ }
+ return [categoryChild];
+}
+
const category = computed(() =>
positionList.value.map((x) => ({
...x,
@@ -38,10 +96,17 @@
);
const change = (index: number) => {
- data.categoryChild = [].concat(data.categoryInfo.category[index + 1].children);
+ const current = positionList.value[index];
+ data.categoryChild = convertCategoryChild(
+ current.value,
+ standardServiceListForCategoryMap.value[current.value]
+ );
};
-const onChange = () => {
- console.log('褰撳墠鍒嗙被鏁版嵁');
+const onChange = (ev) => {
+ console.log('褰撳墠鍒嗙被鏁版嵁', ev);
+ Taro.navigateTo({
+ url: `${RouterPath.serciceDetail}?id=${ev.catId}`,
+ });
};
</script>
--
Gitblit v1.10.0