Browse Source

feat: 添加获取获客记录接口,优化 honor-dialog 组件逻辑,调整页面展示样式

EvilDragon 3 months ago
parent
commit
b2dcf0b998

+ 9 - 12
packages/app/src/composables/honor-dialog.ts

@@ -1,23 +1,20 @@
 import { inject, InjectionKey } from 'vue'
 export interface DialogShowOptions {
-  title?: string
-  text?: string
-  actions?: any
-  form?: boolean
-  schema?: any
-  action?: Function
-  formData?: any
-  onConfirm?: Function
+  title: string
+  content: string
+  path: string
+  image: string
 }
 export const HonorDialogSymbol: InjectionKey<{
   show: (options: DialogShowOptions) => void
 }> = Symbol.for('HonorDialogContext')
 export const useHonorDialog = () => {
   const honorDialog = inject(HonorDialogSymbol)
-  if (!honorDialog) {
-    throw new Error('useHonorDialog must be used inside setup()')
-  }
+  // if (!honorDialog) {
+  //   throw new Error('useHonorDialog must be used inside setup()')
+  // }
+  const show = computed(() => honorDialog?.show)
   return {
-    show: honorDialog.show,
+    show,
   }
 }

+ 16 - 1
packages/app/src/core/libs/requests.ts

@@ -776,12 +776,27 @@ export const getBrowseHistories = (query) =>
       stylistId: number
       stylistName: string
       bizId: any
-      bizType: string
+      bizType: number
       duration: string
       creatorName: string
     }>
   >('/app-api/member/designer/getBrowseHistory', query)
 /**
+ * 获取获客记录
+ */
+export const getReserveHistory = (query) =>
+  httpGet<
+    ResPageData<{
+      id: number
+      stylistId: number
+      stylistName: string
+      appointmentName: string
+      appointmentPhone: string
+      appointmentTime: string
+      createTime: string
+    }>
+  >('/app-api/member/designer/getReserveHistory', query)
+/**
  * 通过ID获取用户信息
  */
 export const getUserInfoById = (id) =>

+ 2 - 2
packages/app/src/pages/common/components/honor-dialog.vue

@@ -1,6 +1,6 @@
 <script setup lang="ts">
 import { close } from '../../../core/libs/svgs'
-import { HonorDialogSymbol } from '../../../composables/honor-dialog'
+import { DialogShowOptions, HonorDialogSymbol } from '../../../composables/honor-dialog'
 import earnBadgeTitle from '@designer-hub/assets/src/libs/assets/earnBadgeTitle'
 import radiation from '@designer-hub/assets/src/libs/assets/radiation'
 import { NetImages } from '../../../core/libs/net-images'
@@ -16,7 +16,7 @@ const path = ref('')
 const src = ref(
   'https://image.zhuchaohui.com/zhucaohui/e104215c64d39e4a0f8676c48b8e7221c891eade1c8d7f02b2a7f0be862e3f76.png',
 )
-const show = (options: { title: string; content: string; path: string; image: string }) => {
+const show = (options: DialogShowOptions) => {
   title.value = options.title
   content.value = options.content
   path.value = options.path

+ 3 - 0
packages/app/src/pages/home/index.vue

@@ -43,11 +43,13 @@ import { pick, sort } from 'radash'
 import { Activity, StudyTour } from '../../core/libs/models'
 import PageHelperEvo from '@/components/page-helper-evo.vue'
 import { useMessage } from 'wot-design-uni'
+import { useHonorDialog } from '../../composables/honor-dialog'
 
 defineOptions({
   name: 'Home',
 })
 useMessage()
+const { show } = useHonorDialog()
 const userStore = useUserStore()
 const { userInfo } = storeToRefs(userStore)
 const { features } = usePermissions()
@@ -108,6 +110,7 @@ onLoad(async () => {
   swiperData.value = indexConfigsData.value.list.map((it) => ({
     data: it,
   }))
+  show.value({ title: '看不见', content: '看不见', path: '', image: '' })
 })
 onShareAppMessage(async ({ from, target }) => {
   console.log('from', from)

+ 2 - 1
packages/app/src/pages/home/offline-activity/cycling-rankings/index.vue

@@ -20,7 +20,7 @@ import PageHelperEvo from '@/components/page-helper-evo.vue'
         :src="NetImages.CyclingRankingsHeaderBg"
       ></wd-img>
     </div>
-    <PageHelperEvo :request="getRidings" :query="{}">
+    <PageHelperEvo class="flex-grow flex flex-col" :request="getRidings" :query="{}">
       <template #default="{ source }">
         <div class="flex-grow relative bg-[linear-gradient(180deg,#EFEFEF_0.4%,#FFF_21.41%)]">
           <div class="absolute h-4 top--4 left-0 right-0 bg-[#EFEFEF] rounded-t-2xl"></div>
@@ -48,6 +48,7 @@ import PageHelperEvo from '@/components/page-helper-evo.vue'
                     class="rounded-full border-2 border-solid border-[#c5cdd4] overflow-hidden"
                     width="71"
                     height="71"
+                    round
                     :src="it.avatar"
                   ></wd-img>
                   <div

+ 87 - 23
packages/app/src/pages/mine/homepage/statistics/index.vue

@@ -3,12 +3,17 @@
 </route>
 <script setup lang="ts">
 import SectionHeading from '@/components/section-heading.vue'
-import { getDesignerInfo, getBrowseHistories } from '../../../../core/libs/requests'
+import {
+  getDesignerInfo,
+  getBrowseHistories,
+  getReserveHistory,
+} from '../../../../core/libs/requests'
 import { useUserStore } from '../../../../store'
 import { storeToRefs } from 'pinia'
 import Card from '@/components/card.vue'
 import PageHelper from '@/components/page-helper.vue'
 import dayjs from 'dayjs'
+import PageHelperEvo from '@/components/page-helper-evo.vue'
 
 const userStore = useUserStore()
 const { userInfo } = storeToRefs(userStore)
@@ -20,9 +25,9 @@ const info = computed(() => [
 ])
 const tab = ref('分享')
 const tabs = ref([
-  //   { label: '分享明细', value: '分享' },
+  { label: '分享明细', value: '分享' },
   { label: '浏览明细', value: '浏览' },
-  //   { label: '获客明细', value: '获客' },
+  { label: '获客明细', value: '获客' },
 ])
 const current = ref('累计')
 const query = computed(() => ({}))
@@ -64,31 +69,90 @@ onMounted(async () => {
           <wd-tab :title="it.label" :name="it.value"></wd-tab>
         </template>
       </wd-tabs>
-      <PageHelper :request="getBrowseHistories" :query="query">
-        <template #default="{ source }">
-          <template v-for="(it, i) in source.list" :key="i">
-            <div class="py-4">
-              <div class="flex">
-                <div
-                  class="flex-1 text-black text-sm font-normal font-['PingFang_SC'] leading-normal"
-                >
-                  <!-- 银色飞行船 -->
-                  {{ it.creatorName }}
+      <template v-if="tab === '分享'">
+        <PageHelper :request="getBrowseHistories" :query="{ bizType: 1 }">
+          <template #default="{ source }">
+            <template v-for="(it, i) in source.list" :key="i">
+              <div class="py-4">
+                <div class="flex">
+                  <div
+                    class="flex-1 text-black text-sm font-normal font-['PingFang_SC'] leading-normal"
+                  >
+                    <!-- 银色飞行船 -->
+                    {{ it.creatorName }}
+                  </div>
+                  <div
+                    class="text-black/40 text-xs font-normal font-['PingFang_SC'] leading-normal"
+                  >
+                    <!-- 浏览时长:{{ (Number(it.duration) / 60).toFixed(2) }}分钟 -->
+                  </div>
                 </div>
-                <div class="text-black/40 text-xs font-normal font-['PingFang SC'] leading-normal">
-                  浏览时长:{{ (Number(it.duration) / 60).toFixed(2) }}分钟
+                <div class="text-black/40 text-xs font-normal font-['PingFang_SC'] leading-normal">
+                  分享时间:
+                  <!-- 2024/04/01 14:52 -->
+                  {{ dayjs(it.createTime).format('YYYY/MM/DD HH:mm') }}
                 </div>
               </div>
-              <div class="text-black/40 text-xs font-normal font-['PingFang SC'] leading-normal">
-                查看时间:
-                <!-- 2024/04/01 14:52 -->
-                {{ dayjs(it.createTime).format('YYYY/MM/DD HH:mm') }}
+              <div v-if="i < source.list.length - 1" class="bg-[#f6f6f6] h-.25"></div>
+            </template>
+          </template>
+        </PageHelper>
+      </template>
+      <template v-if="tab === '浏览'">
+        <PageHelper :request="getBrowseHistories" :query="query">
+          <template #default="{ source }">
+            <template v-for="(it, i) in source.list" :key="i">
+              <div class="py-4">
+                <div class="flex">
+                  <div
+                    class="flex-1 text-black text-sm font-normal font-['PingFang_SC'] leading-normal"
+                  >
+                    <!-- 银色飞行船 -->
+                    {{ it.creatorName }}
+                  </div>
+                  <div
+                    class="text-black/40 text-xs font-normal font-['PingFang_SC'] leading-normal"
+                  >
+                    浏览时长:{{ (Number(it.duration) / 60).toFixed(2) }}分钟
+                  </div>
+                </div>
+                <div class="text-black/40 text-xs font-normal font-['PingFang_SC'] leading-normal">
+                  查看时间:
+                  <!-- 2024/04/01 14:52 -->
+                  {{ dayjs(it.createTime).format('YYYY/MM/DD HH:mm') }}
+                </div>
               </div>
-            </div>
-            <div v-if="i < source.list.length - 1" class="bg-[#f6f6f6] h-.25"></div>
+              <div v-if="i < source.list.length - 1" class="bg-[#f6f6f6] h-.25"></div>
+            </template>
           </template>
-        </template>
-      </PageHelper>
+        </PageHelper>
+      </template>
+      <template v-if="tab === '获客'">
+        <PageHelperEvo :request="getReserveHistory" :query="query">
+          <template #default="{ source }">
+            <template v-for="(it, i) in source.list" :key="i">
+              <div class="py-4">
+                <div class="flex gap-3">
+                  <div class="text-black text-sm font-normal font-['PingFang_SC'] leading-normal">
+                    <!-- 银色飞行船 -->
+                    {{ it.appointmentName }}
+                  </div>
+                  <div class="text-black text-sm font-normal font-['PingFang_SC'] leading-normal">
+                    <!-- 浏览时长:{{ (Number(it.duration) / 60).toFixed(2) }}分钟 -->
+                    {{ it.appointmentPhone }}
+                  </div>
+                </div>
+                <div class="text-black/40 text-xs font-normal font-['PingFang_SC'] leading-normal">
+                  获客时间:
+                  <!-- 2024/04/01 14:52 -->
+                  {{ dayjs(it.createTime).format('YYYY/MM/DD HH:mm') }}
+                </div>
+              </div>
+              <div v-if="i < source.list.length - 1" class="bg-[#f6f6f6] h-.25"></div>
+            </template>
+          </template>
+        </PageHelperEvo>
+      </template>
     </Card>
   </div>
 </template>

+ 5 - 5
packages/app/src/pages/mine/index.vue

@@ -290,13 +290,12 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
         <div class="flex items-center">
           <div class="text-white text-base font-normal font-['PingFang_SC'] leading-normal mr-1">
             <!-- 0 -->
-            <!-- {{designerInfo.c}} -->
-            {{ designerInfo?.winCustomerCount || 0 }}
+            {{ designerInfo?.viewCount || 0 }}
           </div>
           <div
             class="text-center text-[#e9e7e4] text-xs font-normal font-['PingFang_SC'] leading-normal"
           >
-            获客
+            浏览
           </div>
         </div>
 
@@ -305,12 +304,13 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
         <div class="flex items-center">
           <div class="text-white text-base font-normal font-['PingFang_SC'] leading-normal mr-1">
             <!-- 0 -->
-            {{ designerInfo?.viewCount || 0 }}
+            <!-- {{designerInfo.c}} -->
+            {{ designerInfo?.winCustomerCount || 0 }}
           </div>
           <div
             class="text-center text-[#e9e7e4] text-xs font-normal font-['PingFang_SC'] leading-normal"
           >
-            浏览
+            获客
           </div>
         </div>
       </div>

+ 2 - 2
packages/app/src/pages/mine/setting/index.vue

@@ -79,10 +79,10 @@ const handleLogout = () => {
     <SectionHeading title="性别" size="sm" end-text="设置" end-arrow></SectionHeading>
     <SectionHeading title="生日" size="sm" end-text="设置" end-arrow></SectionHeading>
 
-    <!-- <SectionHeading title="手机号" size="sm" :end-text="''" end-arrow></SectionHeading>
+    <SectionHeading title="手机号" size="sm" :end-text="''" end-arrow></SectionHeading>
     <SectionHeading title="公司" size="sm"></SectionHeading>
     <SectionHeading title="推荐人" size="sm"></SectionHeading>
-    <SectionHeading title="经纪人" size="sm"></SectionHeading> -->
+    <SectionHeading title="经纪人" size="sm"></SectionHeading>
     <div class="flex-1"></div>
     <div><wd-button block :round="false" @click="handleLogout">退出登录</wd-button></div>
   </div>