Explorar o código

feat: 添加年份选择器并优化数据查询逻辑,移除不必要的代码

EvilDragon hai 1 mes
pai
achega
8da43527ba

+ 17 - 4
packages/merchant/src/pages/agent/points/index.vue

@@ -13,13 +13,23 @@ import { NetImages } from '../../../core/libs/enums'
 import { getPointsFlow } from '../../../core/libs/agent-requests'
 import PageHelperEvo from '@/components/page-helper-evo.vue'
 import { getBroker } from '../../../core/libs/requests'
+import PickerEvo from '@/components/picker-evo.vue'
 
 const userStore = useUserStore()
 const { userInfo } = storeToRefs(userStore)
+const yearState = ref(true)
+const year = ref(dayjs().toDate().getTime())
+const query = computed(() => ({
+  brokerId: userInfo.value.userId,
+  year: dayjs(year.value).format('YYYY'),
+}))
 
 const { data, run: setData } = useRequest(() =>
   getBroker({ brokerId: String(userInfo.value.userId) }),
 )
+const handleSelect = () => {
+  yearState.value = false
+}
 onMounted(async () => {
   await setData()
 })
@@ -53,12 +63,15 @@ onMounted(async () => {
         </div>
         <div class="flex-1"></div>
         <div></div>
-        <div class="text-[white] text-sm font-normal font-['PingFang_SC'] leading-relaxed">
-          2024
-        </div>
+        <wd-datetime-picker type="year" v-model="year" use-default-slot>
+          <div class="text-[white] text-sm font-normal font-['PingFang_SC'] leading-relaxed">
+            {{ dayjs(year).format('YYYY') }}
+            <wd-icon name="arrow-down" size="12" class="text-[#ffffff]"></wd-icon>
+          </div>
+        </wd-datetime-picker>
       </div>
       <Card custom-class="relative">
-        <PageHelperEvo :request="getPointsFlow" :query="{ brokerId: userInfo.userId, year: 2024 }">
+        <PageHelperEvo :request="getPointsFlow" :query="query">
           <template #default="{ source }">
             <div class="flex flex-col gap-4">
               <template v-for="(it, i) in source?.list" :key="i">

+ 1 - 17
packages/merchant/src/pages/agent/report-infos/index.vue

@@ -34,22 +34,6 @@ const handleDelete = async (reportInfo: ReportInfo) => {
 </script>
 <template>
   <div class="flex-grow flex flex-col">
-    <!-- <PageHelperEvo
-      :request="
-        async () => ({
-          code: 0,
-          msg: '',
-          data: { list: [{ title: '', a: 1, sss: 444 }], total: 0 },
-        })
-      "
-    >
-      <template #default="{ source }">
-        {{ source.list[0].title }}
-        {{ source.list[0].a }}
-        {{ source.list[0].sss }}
-      </template>
-    </PageHelperEvo> -->
-
     <PageHelperEvo ref="pageHelperRef" :request="getReportInfoPage" :query="query">
       <template #top>
         <wd-tabs v-model="tab">
@@ -60,7 +44,7 @@ const handleDelete = async (reportInfo: ReportInfo) => {
       </template>
       <template #default="{ source }">
         <div class="flex flex-col gap-4 p-4">
-          <template v-for="(it, i) in source.list" :key="i">
+          <template v-for="(it, i) in source?.list" :key="i">
             <Card>
               <!-- {{ it.stylistName }} -->
               <div class="flex items-center justify-between">