From 1d472eb06970c85b0edfb58871956bc2c8d69916 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期四, 25 十二月 2025 17:44:46 +0800
Subject: [PATCH] fix: 甲方小程序
---
apps/housekeepingMiniApp/src/pages/service/InnerPage.vue | 104 ++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 92 insertions(+), 12 deletions(-)
diff --git a/apps/housekeepingMiniApp/src/pages/service/InnerPage.vue b/apps/housekeepingMiniApp/src/pages/service/InnerPage.vue
index b0a12a9..408f1a6 100644
--- a/apps/housekeepingMiniApp/src/pages/service/InnerPage.vue
+++ b/apps/housekeepingMiniApp/src/pages/service/InnerPage.vue
@@ -1,32 +1,112 @@
<template>
- <nut-category :category="data.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, useTaskList } from '@12333/hooks';
-import { EnumTaskCheckReceiveStatus, EnumTaskCheckReceiveMethod } 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 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, 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,
+ catName: x.label,
+ }))
+);
+
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