Ver Fonte

feat(agent): 添加设计师积分统计功能

- 新增 getPointsCount 和 getPointsCounts 接口获取设计师积分统计
- 在设计师详情页面添加积分统计卡片
- 优化 ListHelperEvo 组件,支持自定义内容布局
- 更新 PageSpy 配置,使用新的 API 地址
EvilDragon há 4 meses atrás
pai
commit
df66c403dc

+ 50 - 0
packages/app/src/core/libs/models.ts

@@ -824,6 +824,56 @@ export interface DesignerEvent {
   name: string
   applyTime: string
 }
+export interface DesignerPointsStatistics {
+  /**
+   * 剩余积分
+   */
+  points: number
+  /**
+   * 积分变动时间
+   */
+  pointsTime: string
+  /**
+   * 累计获得积分
+   */
+  gainPoints: number
+  /**
+   * 今年获得积分
+   */
+  gainPointsYear: number
+  /**
+   * 今年消耗积分
+   */
+  usePoints: number
+  /**
+   * 消耗积分
+   */
+  usePointsYear: number
+  /**
+   * 累计跟进次数
+   */
+  followUpCount: number
+  /**
+   * 今年跟进次数
+   */
+  followUpYearCount: number
+  /**
+   * 消耗次数
+   */
+  usageCount: number
+  /**
+   * 今年消耗次数
+   */
+  usageYearCount: number
+  /**
+   * 累计获得次数
+   */
+  obtainedCount: number
+  /**
+   * 今年获得次数
+   */
+  obtainedYearCount: number
+}
 export interface Broker {
   createTime: string
   updateTime: string

+ 1 - 1
packages/app/src/core/utils/page-spy.ts

@@ -1,5 +1,5 @@
 import PageSpy from '@huolala-tech/page-spy-uniapp'
 export const pageSpy = new PageSpy({
-  api: 'page-spy.sxwobo.cn',
+  api: 'page-spy.sxwbny.com',
   title: '',
 })

+ 1 - 1
packages/app/src/main.ts

@@ -14,7 +14,7 @@ export function createApp() {
   app.use(routeInterceptor)
   app.use(requestInterceptor)
   app.use(prototypeInterceptor)
-  pageSpy.init()
+  pageSpy.init().then()
   return {
     app,
   }

+ 13 - 8
packages/merchant/src/components/list-helper-evo.vue

@@ -8,10 +8,12 @@ const props = withDefaults(
     query?: Partial<T>
     automatic?: boolean
     mockList?: Partial<T>[]
+    contentClass?: string
   }>(),
   {
     automatic: true,
     query: () => ({}),
+    contentClass: 'flex flex-col',
   },
 )
 const slot = defineSlots<{
@@ -56,15 +58,18 @@ defineExpose({
 </script>
 
 <template>
-  <div class="flex-grow flex flex-col relative">
-    <template v-for="(it, index) in data" :key="index">
-      <slot
-        :item="it as UnwrapRef<T>"
-        :index="index"
-        :isLast="index == (data?.length ?? 0) - 1"
-      ></slot>
-    </template>
+  <div class="flex-grow relative flex flex-col">
+    <div :class="contentClass">
+      <template v-for="(it, index) in data" :key="index">
+        <slot
+          :item="it as UnwrapRef<T>"
+          :index="index"
+          :isLast="index == (data?.length ?? 0) - 1"
+        ></slot>
+      </template>
+    </div>
     <div
+      v-if="mockList"
       class="construction-dashed absolute top-0 right-0 left-0 bottom-0 bg-red/20 flex items-center justify-center pointer-events-none"
     >
       <div class="text-16 text-black/30">Debug</div>

+ 70 - 1
packages/merchant/src/core/libs/agent-requests.ts

@@ -10,6 +10,7 @@ import {
   DesignerFamilyInfo,
   AgentPoint,
   DesignerAward,
+  DesignerPointsStatistics,
 } from '@designer-hub/app/src/core/libs/models'
 /**
  * 通过ID获取用户信息
@@ -112,7 +113,7 @@ export const createFollowUp = (data: Partial<FollowUp>) =>
  */
 export const getFollowUpPage = (query = {}) =>
   httpGet<ResPageData<FollowUp & { followTypeName: string; brokerName: string }>>(
-    '/app-api/member/stylist-follow-up/page',
+    '/app-api/member/app-broker/pageFollowUp',
     query,
   )
 /**
@@ -195,3 +196,71 @@ export const getSalesOrders = (query = {}) =>
       orderMoney: number
     }>
   >('/app-api/member/stylist-other-sales/pageByDate', query)
+/**
+ * 获取设计师积分统计
+ */
+export const getPointsCount = (query = {}) =>
+  httpGet<DesignerPointsStatistics>('/app-api/member/points-details/getPointsCount', query)
+// { name: '当前剩余积分', des: '最近', value: 220 },
+// { name: '累计获得积分', des: '本年', value: 220 },
+// { name: '累计消耗积分', des: '本年', value: 220 },
+// { name: '累计跟进次数', des: '本年', value: 220 },
+// { name: '累计消耗次数', des: '本年', value: 220 },
+// { name: '累计获得次数', des: '本年', value: 220 },
+// Object.entries(res.data).map((it) => ({
+//   title: '',
+//   value: 0,
+//   subTitle: '',
+//   subValue: 0,
+// }))
+/**
+ * 获取设计师积分统计数组
+ */
+export const getPointsCounts = (query = {}) =>
+  getPointsCount(query).then((res) => ({
+    ...res,
+    data: [
+      {
+        userId: '',
+        title: '当前剩余积分',
+        value: res.data.points ?? 0,
+        subTitle: '年新增',
+        subValue: res.data.gainPointsYear ?? 0,
+      },
+      {
+        userId: '',
+        title: '累计获得积分',
+        value: res.data.gainPoints ?? 0,
+        subTitle: '年新增',
+        subValue: res.data.gainPointsYear ?? 0,
+      },
+      {
+        userId: '',
+        title: '累计消耗积分',
+        value: res.data.usePoints ?? 0,
+        subTitle: '年新增',
+        subValue: res.data.usePointsYear ?? 0,
+      },
+      {
+        userId: '',
+        title: '累计跟进次数',
+        value: res.data.followUpCount ?? 0,
+        subTitle: '年新增',
+        subValue: res.data.followUpYearCount ?? 0,
+      },
+      {
+        userId: '',
+        title: '累计消耗次数',
+        value: res.data.usageCount ?? 0,
+        subTitle: '年新增',
+        subValue: res.data.usageYearCount ?? 0,
+      },
+      {
+        userId: '',
+        title: '累计获得次数',
+        value: res.data.obtainedCount ?? 0,
+        subTitle: '年新增',
+        subValue: res.data.obtainedYearCount ?? 0,
+      },
+    ],
+  }))

+ 20 - 19
packages/merchant/src/pages/agent/designer/detail.vue

@@ -7,7 +7,12 @@ style:
 
 <script setup lang="ts">
 import NavbarEvo from '@/components/navbar-evo.vue'
-import { getFollowUpPage, getUserInfoById } from '../../../core/libs/agent-requests'
+import {
+  getFollowUpPage,
+  getPointsCounts,
+  getPointsCountToArray,
+  getUserInfoById,
+} from '../../../core/libs/agent-requests'
 import {
   desinTopBg,
   rightArrowIcon,
@@ -24,10 +29,11 @@ import { toHomePage } from '@/core/libs/actions'
 import arcBottom from '@designer-hub/assets/src/libs/assets/arcBottom'
 import { useMemberLevelsStore } from '@/store/member-levles'
 import TaskCard from '@/pages/agent/components/task-card.vue'
-import {getDesignerPointsActivities, getPointsOrders} from '@/core/libs/requests'
+import { getDesignerPointsActivities, getPointsOrders } from '@/core/libs/requests'
 import { useUserStore } from '@/store'
 import { storeToRefs } from 'pinia'
 import Card from '@designer-hub/app/src/components/card.vue'
+import ListHelperEvo from '@/components/list-helper-evo.vue'
 
 const userStore = useUserStore()
 const { userInfo } = storeToRefs(userStore)
@@ -144,38 +150,33 @@ onLoad((query) => {
                 <wd-icon size="12" name="arrow-right" color="rgba(0,0,0,.3)"></wd-icon>
               </div>
             </div>
-            <div class="mt-3 grid grid-cols-3 gap-2.5">
-              <template
-                v-for="{ name, value } of [
-                  { name: '当前剩余积分', des: '最近', value: 220 },
-                  { name: '累计获得积分', des: '本年', value: 220 },
-                  { name: '累计消耗积分', des: '本年', value: 220 },
-                  { name: '累计跟进次数', des: '本年', value: 220 },
-                  { name: '累计消耗次数', des: '本年', value: 220 },
-                  { name: '累计获得次数', des: '本年', value: 220 },
-                ]"
-                :key="name"
-              >
+
+            <ListHelperEvo
+              :request="getPointsCounts"
+              :query="{ userId: id }"
+              content-class="grid grid-cols-3 gap-2.5"
+            >
+              <template #default="{ item }">
                 <div class="rounded-lg aspect-[1/1] flex flex-col justify-around p-2.5">
                   <div class="text-black/60 text-xs font-normal font-['PingFang_SC'] leading-none">
-                    {{ name }}
+                    {{ item.title }}
                   </div>
                   <div class="text-black/90 text-lg font-bold font-['D-DIN Exp'] leading-normal">
-                    {{ value }}
+                    {{ item.value }}
                   </div>
                   <div class="flex items-center gap-1">
                     <div
                       class="text-black/40 text-xs font-normal font-['PingFang_SC'] leading-none"
                     >
-                      年新增
+                      {{ item.subTitle }}
                     </div>
                     <div class="text-black/90 text-xs font-normal font-['D-DIN Exp'] leading-norma">
-                      20
+                      {{ item.subValue }}
                     </div>
                   </div>
                 </div>
               </template>
-            </div>
+            </ListHelperEvo>
           </Card>
 
           <Card custom-class="my-4">