Browse Source

feat: 更新获取客服列表接口,添加类型定义并优化代理数据展示逻辑

EvilDragon 3 months ago
parent
commit
775512cc6c
2 changed files with 36 additions and 10 deletions
  1. 20 1
      packages/app/src/core/libs/requests.ts
  2. 16 9
      packages/app/src/pages/mine/agents/index.vue

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

@@ -954,7 +954,26 @@ export const getRidings = (query) =>
 /**
  * 获取客服列表
  */
-export const getAgents = () => httpGet('getCustomerServiceList')
+export const getAgents = () =>
+  httpGet<
+    {
+      id?: number
+      brokeId?: string
+      headImgUrl: string
+      brokerName: string
+      password?: string
+      mobile: string
+      status?: number
+      channelType?: number
+      designersNumber: any
+      yearPoints: any
+      yearOrders: any
+      createTime?: number
+      inviteCode?: string
+      customer: number
+      customerName: string
+    }[]
+  >('/app-api/member/user/getCustomerServiceList')
 export const refreshToken = (refreshToken: string) =>
   httpPost<any>('/app-api/member/auth/refresh-token', {}, { refreshToken })
 export const httpGetMock = <T>(data: T) =>

+ 16 - 9
packages/app/src/pages/mine/agents/index.vue

@@ -4,18 +4,20 @@
 <script setup lang="ts">
 import Card from '@/components/card.vue'
 import { phone } from '../../../core/libs/svgs'
+import { getAgents } from '../../../core/libs/requests'
+import { handleCall } from '../../../core/utils/common'
 
-const data = ref([{}, {}, {}])
+const { data: agents, run: setAgents } = useRequest(() => getAgents())
 const handleClick = () => {
   uni.navigateTo({ url: '/pages/mine/orders/detail/index' })
 }
-const handleCall = (phone: string) => {
-  uni.makePhoneCall({ phoneNumber: phone })
-}
+onMounted(async () => {
+  await setAgents()
+})
 </script>
 <template>
   <div class="flex-grow flex flex-col gap-4 px-3.5 py-6">
-    <template v-for="({}, i) in data" :key="i">
+    <template v-for="(it, i) in agents" :key="i">
       <div>
         <Card>
           <div class="flex gap-4">
@@ -23,16 +25,21 @@ const handleCall = (phone: string) => {
               round
               width="63"
               height="63"
-              src="https://image.zhuchaohui.com/zhucaohui/d3a335ede20d72ebf873e1b2ebd4835749dde2b694a08dfdffd1781973e3df21.png"
+              :src="
+                it.headImgUrl ||
+                'https://image.zhuchaohui.com/zhucaohui/d3a335ede20d72ebf873e1b2ebd4835749dde2b694a08dfdffd1781973e3df21.png'
+              "
             />
             <div class="flex flex-col flex-1 justify-around">
               <div
                 class="text-start text-black/40 text-lg font-normal font-['PingFang_SC'] leading-normal"
               >
-                王玉辉
+                <!-- 王玉辉 -->
+                {{ it.brokerName }}
               </div>
               <div class="text-black/40 text-sm font-normal font-['PingFang_SC'] leading-normal">
-                平台客服
+                <!-- 平台客服 -->
+                {{ it.customerName }}
               </div>
             </div>
             <div class="flex items-center">
@@ -40,7 +47,7 @@ const handleCall = (phone: string) => {
                 type="text"
                 size="small"
                 custom-class=" bg-[#f2f2f2]! p-0! ml-4"
-                @click="handleCall('')"
+                @click="handleCall(it.mobile)"
               >
                 <wd-img width="28" height="28" :src="phone"></wd-img>
               </wd-button>