|  | @@ -7,6 +7,7 @@ import {
 | 
											
												
													
														|  |    getDesignerInfo,
 |  |    getDesignerInfo,
 | 
											
												
													
														|  |    getBrowseHistories,
 |  |    getBrowseHistories,
 | 
											
												
													
														|  |    getReserveHistory,
 |  |    getReserveHistory,
 | 
											
												
													
														|  | 
 |  | +  countThisYear,
 | 
											
												
													
														|  |  } from '../../../../core/libs/requests'
 |  |  } from '../../../../core/libs/requests'
 | 
											
												
													
														|  |  import { useUserStore } from '../../../../store'
 |  |  import { useUserStore } from '../../../../store'
 | 
											
												
													
														|  |  import { storeToRefs } from 'pinia'
 |  |  import { storeToRefs } from 'pinia'
 | 
											
										
											
												
													
														|  | @@ -17,7 +18,12 @@ import PageHelperEvo from '@/components/page-helper-evo.vue'
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  const userStore = useUserStore()
 |  |  const userStore = useUserStore()
 | 
											
												
													
														|  |  const { userInfo } = storeToRefs(userStore)
 |  |  const { userInfo } = storeToRefs(userStore)
 | 
											
												
													
														|  | -const { data, run: setData } = useRequest(() => getDesignerInfo(userInfo.value.userId))
 |  | 
 | 
											
												
													
														|  | 
 |  | +const current = ref('累计')
 | 
											
												
													
														|  | 
 |  | +const request =
 | 
											
												
													
														|  | 
 |  | +  ref<
 | 
											
												
													
														|  | 
 |  | +    () => Promise<IResData<{ shareCount: number; viewCount: number; winCustomerCount: number }>>
 | 
											
												
													
														|  | 
 |  | +  >()
 | 
											
												
													
														|  | 
 |  | +const data = ref()
 | 
											
												
													
														|  |  const info = computed(() => [
 |  |  const info = computed(() => [
 | 
											
												
													
														|  |    { label: '分享', value: data.value?.shareCount || 0, unit: '次' },
 |  |    { label: '分享', value: data.value?.shareCount || 0, unit: '次' },
 | 
											
												
													
														|  |    { label: '浏览', value: data.value?.viewCount || 0, unit: '次' },
 |  |    { label: '浏览', value: data.value?.viewCount || 0, unit: '次' },
 | 
											
										
											
												
													
														|  | @@ -29,10 +35,45 @@ const tabs = ref([
 | 
											
												
													
														|  |    { label: '浏览明细', value: '浏览' },
 |  |    { label: '浏览明细', value: '浏览' },
 | 
											
												
													
														|  |    { label: '获客明细', value: '获客' },
 |  |    { label: '获客明细', value: '获客' },
 | 
											
												
													
														|  |  ])
 |  |  ])
 | 
											
												
													
														|  | -const current = ref('累计')
 |  | 
 | 
											
												
													
														|  |  const query = computed(() => ({}))
 |  |  const query = computed(() => ({}))
 | 
											
												
													
														|  | 
 |  | +const setData = async ({ value }) => {
 | 
											
												
													
														|  | 
 |  | +  console.log(1111)
 | 
											
												
													
														|  | 
 |  | +  console.log(value)
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +  request.value = {
 | 
											
												
													
														|  | 
 |  | +    累计: () =>
 | 
											
												
													
														|  | 
 |  | +      getDesignerInfo(userInfo.value.userId).then((res) => ({
 | 
											
												
													
														|  | 
 |  | +        code: res.code,
 | 
											
												
													
														|  | 
 |  | +        msg: res.msg,
 | 
											
												
													
														|  | 
 |  | +        data: {
 | 
											
												
													
														|  | 
 |  | +          shareCount: res.data.shareCount,
 | 
											
												
													
														|  | 
 |  | +          viewCount: res.data.viewCount,
 | 
											
												
													
														|  | 
 |  | +          winCustomerCount: res.data.winCustomerCount,
 | 
											
												
													
														|  | 
 |  | +        },
 | 
											
												
													
														|  | 
 |  | +      })),
 | 
											
												
													
														|  | 
 |  | +    本年: () =>
 | 
											
												
													
														|  | 
 |  | +      countThisYear({ userId: userInfo.value.userId, year: new Date().getFullYear() }).then(
 | 
											
												
													
														|  | 
 |  | +        (res) => ({
 | 
											
												
													
														|  | 
 |  | +          code: res.code,
 | 
											
												
													
														|  | 
 |  | +          msg: res.msg,
 | 
											
												
													
														|  | 
 |  | +          data: {
 | 
											
												
													
														|  | 
 |  | +            shareCount: res.data.find((it) => it.bizType === '1')?.quantity || 0,
 | 
											
												
													
														|  | 
 |  | +            viewCount: res.data.find((it) => it.bizType === '2')?.quantity || 0,
 | 
											
												
													
														|  | 
 |  | +            winCustomerCount: res.data.find((it) => it.bizType === '3')?.quantity || 0,
 | 
											
												
													
														|  | 
 |  | +          },
 | 
											
												
													
														|  | 
 |  | +        }),
 | 
											
												
													
														|  | 
 |  | +      ),
 | 
											
												
													
														|  | 
 |  | +  }[value]
 | 
											
												
													
														|  | 
 |  | +  const { data: resData } = await request.value()
 | 
											
												
													
														|  | 
 |  | +  data.value = resData
 | 
											
												
													
														|  | 
 |  | +  console.log(data.value)
 | 
											
												
													
														|  | 
 |  | +}
 | 
											
												
													
														|  |  onMounted(async () => {
 |  |  onMounted(async () => {
 | 
											
												
													
														|  | -  await setData()
 |  | 
 | 
											
												
													
														|  | 
 |  | +  console.log(1111)
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +  await setData({ value: current.value })
 | 
											
												
													
														|  | 
 |  | +  console.log(data.value)
 | 
											
												
													
														|  | 
 |  | +  // await countThisYear({ userId: userInfo.value.userId, year: new Date().getFullYear() })
 | 
											
												
													
														|  |  })
 |  |  })
 | 
											
												
													
														|  |  </script>
 |  |  </script>
 | 
											
												
													
														|  |  <template>
 |  |  <template>
 | 
											
										
											
												
													
														|  | @@ -41,7 +82,11 @@ onMounted(async () => {
 | 
											
												
													
														|  |        <SectionHeading title="主页数据">
 |  |        <SectionHeading title="主页数据">
 | 
											
												
													
														|  |          <template #append>
 |  |          <template #append>
 | 
											
												
													
														|  |            <div>
 |  |            <div>
 | 
											
												
													
														|  | -            <wd-segmented v-model:value="current" :options="['累计']"></wd-segmented>
 |  | 
 | 
											
												
													
														|  | 
 |  | +            <wd-segmented
 | 
											
												
													
														|  | 
 |  | +              v-model:value="current"
 | 
											
												
													
														|  | 
 |  | +              :options="['累计', '本年']"
 | 
											
												
													
														|  | 
 |  | +              @change="setData"
 | 
											
												
													
														|  | 
 |  | +            ></wd-segmented>
 | 
											
												
													
														|  |            </div>
 |  |            </div>
 | 
											
												
													
														|  |          </template>
 |  |          </template>
 | 
											
												
													
														|  |        </SectionHeading>
 |  |        </SectionHeading>
 |