Browse Source

feat: 添加获取设计师列表和经纪人接口,更新相关数据模型,优化个人主页展示逻辑

EvilDragon 3 months ago
parent
commit
14dc044ef0

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

@@ -710,6 +710,37 @@ export interface Todo {
   creator: string
   executionTime: string
 }
+export interface Agent {
+  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: any
+  customerName: string
+}
+export interface Designer {
+  id: string
+  name: string
+  avatar: string
+  levelName: string
+  points: number
+  mobile: string
+  accessTime: any
+  followUp30Days: boolean
+  generatePoints60Days: boolean
+  expendPoints60Days: boolean
+  focus: boolean
+  brokerId: number
+}
 
 export enum DictType {
   /**

+ 14 - 0
packages/merchant/src/core/libs/agent-requests.ts

@@ -0,0 +1,14 @@
+import { httpGet } from '../../utils/http'
+import {
+  PointsOrder,
+  ResPageData,
+  Todo,
+  Agent,
+  Designer,
+} from '@designer-hub/app/src/core/libs/models'
+
+/**
+ * 设计师列表
+ */
+export const getDesigners = (query = {}) =>
+  httpGet<ResPageData<Designer>>('/app-api/member/app-broker/pageStylist', query)

+ 8 - 3
packages/merchant/src/core/libs/requests.ts

@@ -2,7 +2,7 @@ import { httpGet, httpPost, httpPut, httpDelete } from '../../utils/http'
 import { Schedule } from '../models/schedule'
 import { Moment } from '../models/moment'
 import dayjs from 'dayjs'
-import { PointsOrder, ResPageData, Todo } from '@designer-hub/app/src/core/libs/models'
+import { PointsOrder, ResPageData, Todo, Agent } from '@designer-hub/app/src/core/libs/models'
 import { get } from 'radash'
 
 export const getUserInfo = () =>
@@ -373,16 +373,21 @@ export const getYearTarget = (query?: { brokerId?: string }) =>
 /**
  * 渠道端-获取设计师统计
  */
-export const getDesignerStatistics = (query) =>
+export const getDesignerStatistics = (query = {}) =>
   httpPost<any>('/app-api/member/app-broker/statisticsStylist', query)
 /**
  * 渠道端-获取跟进统计
  */
-export const getFollowStatistics = (query) =>
+export const getFollowStatistics = (query = {}) =>
   httpPost<{ type: number; typeName: string; quantity?: number; thisYearQuantity?: number }[]>(
     '/app-api/member/app-broker/statisticsFollowUp',
     query,
   )
+/**
+ * 渠道端-获取经纪人
+ */
+export const getBroker = (query: { brokerId: string }) =>
+  httpGet<Agent>('/app-api/member/app-broker/get', query)
 export const httpGetMock = <T>(data: T) =>
   new Promise<IResData<T>>((resolve) => resolve({ code: 1, msg: '', data } as IResData<T>))
 export interface Circle {

+ 134 - 112
packages/merchant/src/pages/designer/index.vue

@@ -1,12 +1,17 @@
-<route lang="yaml">
-style:
-  navigationBarTitleText: 全部设计师
-  navigationBarBackgroundColor: '#fff'
+<route lang="json">
+{
+  "style": {
+    "navigationBarTitleText": "全部设计师",
+    "navigationBarBackgroundColor": "#fff"
+  }
+}
 </route>
 
 <script setup lang="ts">
 import Card from '@/components/card.vue'
 import DataForm from '@/components/data-form.vue'
+import PageHelperEvo from '@/components/page-helper-evo.vue'
+import { getDesigners } from '../../core/libs/agent-requests'
 import { vipIcon, rightArrowIcon, filterIcon } from '@designer-hub/assets/src/svgs'
 const searchText = ref('')
 const publishState = ref(false)
@@ -50,6 +55,7 @@ const schema = ref({
     max: 9,
   },
 })
+const query = ref({})
 const searchFocus = () => {
   console.log('focus')
 }
@@ -80,136 +86,152 @@ const filterData = () => {
 
 <template>
   <view class="flex-grow">
-    <div class="flex items-center justify-between bg-white pr-3.5">
-      <div class="flex-1">
-        <wd-search
-          v-model="searchText"
-          @focus="searchFocus"
-          @blur="searchBlur"
-          @search="search"
-          @cancel="cancelSearch"
-          @change="searchChange"
-          hide-cancel
-        />
-      </div>
-      <wd-img :src="filterIcon" width="22px" height="22px" @click="filterData"></wd-img>
-    </div>
-    <div class="p-3.5 gap-3.5 flex flex-col">
-      <template v-for="({ title, createdAt, content }, i) in msgs" :key="i">
-        <Card>
-          <div class="items-center">
-            <div class="">
-              <div class="flex items-center">
-                <div
-                  class="w-[55px] h-[55px] bg-neutral-100 rounded-full mr-2 flex items-center justify-center"
-                >
-                  <wd-img src=""></wd-img>
+    <PageHelperEvo :request="getDesigners" :query="query">
+      <template #top>
+        <div class="flex items-center justify-between bg-white pr-3.5">
+          <div class="flex-1">
+            <wd-search
+              v-model="searchText"
+              @focus="searchFocus"
+              @blur="searchBlur"
+              @search="search"
+              @cancel="cancelSearch"
+              @change="searchChange"
+              hide-cancel
+            />
+          </div>
+          <wd-img :src="filterIcon" width="22px" height="22px" @click="filterData"></wd-img>
+        </div>
+      </template>
+      <template #default="{ source }">
+        <div class="p-3.5 gap-3.5 flex flex-col">
+          <template v-for="(it, i) in source.list" :key="i">
+            <Card>
+              <div class="items-center">
+                <div class="">
+                  <div class="flex items-center">
+                    <div
+                      class="w-[55px] h-[55px] bg-neutral-100 rounded-full mr-2 flex items-center justify-center"
+                    >
+                      <wd-img width="100%" height="100%" round :src="it.avatar"></wd-img>
+                    </div>
+                    <div class="flex flex-col flex-1">
+                      <div class="flex-row flex items-center justify-between w-full">
+                        <div class="flex-row flex items-center">
+                          <div
+                            class="text-black/90 text-base font-normal font-['PingFang_SC'] leading-[10.18px]"
+                          >
+                            <!-- 苏小萌 -->
+                            {{ it.name }}
+                          </div>
+
+                          <div
+                            class="h-4 bg-neutral-100 rounded-[20px] justify-start items-center inline-flex flex-row ml-[9px]"
+                          >
+                            <wd-img width="17" height="17" :src="vipIcon"></wd-img>
+
+                            <div
+                              class="text-black/40 text-[10px] font-normal font-['PingFang_SC'] px-[7px] leading-none"
+                            >
+                              <!-- 白银会员 -->
+                              {{ it.levelName }}
+                            </div>
+                          </div>
+                        </div>
+                        <div
+                          class="text-black/60 text-xs font-normal font-['PingFang_SC'] leading-snug flex items-center"
+                          @click="toDetail"
+                        >
+                          <div>分享主页</div>
+                          <wd-img width="13" height="13" :src="rightArrowIcon"></wd-img>
+                        </div>
+                      </div>
+                      <div class="flex items-center gap-2 mt-[18px]">
+                        <div
+                          class="text-black/30 text-xs font-normal font-['PingFang_SC'] leading-none"
+                        >
+                          2天前访问
+                        </div>
+                        <div class="bg-[#eeeeee] w-[2px] h-[10px]"></div>
+                        <div
+                          class="text-black/30 text-xs font-normal font-['PingFang_SC'] leading-none"
+                        >
+                          积分:0
+                        </div>
+                      </div>
+                    </div>
+                  </div>
                 </div>
-                <div class="flex flex-col flex-1">
-                  <div class="flex-row flex items-center justify-between w-full">
-                    <div class="flex-row flex items-center">
+
+                <div class="row-start-2 col-start-2 col-end-4">
+                  <div class="flex items-center justify-between w-full mt-[20px]">
+                    <div class="flex items-center">
+                      <div class="w-2 h-2 bg-[#89f4e2] rounded-full mr-[7px]"></div>
                       <div
-                        class="text-black/90 text-base font-normal font-['PingFang_SC'] leading-[10.18px]"
+                        class="text-black/90 text-xs font-normal font-['PingFang_SC'] leading-snug"
                       >
-                        苏小萌
+                        30天未跟进
                       </div>
-
+                    </div>
+                    <div class="flex items-center">
+                      <div class="w-2 h-2 bg-[#ffb96a] rounded-full mr-[7px]"></div>
                       <div
-                        class="h-4 bg-neutral-100 rounded-[20px] justify-start items-center inline-flex flex-row ml-[9px]"
+                        class="text-black/90 text-xs font-normal font-['PingFang_SC'] leading-snug"
                       >
-                        <wd-img width="17" height="17" :src="vipIcon"></wd-img>
-
-                        <div
-                          class="text-black/40 text-[10px] font-normal font-['PingFang_SC'] px-[7px] leading-none"
-                        >
-                          白银会员
-                        </div>
+                        60天未产生积分
+                      </div>
+                    </div>
+                    <div class="flex items-center">
+                      <div class="w-2 h-2 bg-[#c493ff] rounded-full mr-[7px]"></div>
+                      <div
+                        class="text-black/90 text-xs font-normal font-['PingFang_SC'] leading-snug"
+                      >
+                        60天未消耗积分
                       </div>
                     </div>
+                  </div>
+                </div>
+                <div
+                  class="row-start-5 col-start-2 col-end-4 flex items-center mt-[26px] justify-around"
+                >
+                  <div
+                    class="px-3 py-1.5 rounded-[30px] border border-[#ff2d2d] justify-center items-center gap-1 flex"
+                    style="border: 1px solid #ff2d2d"
+                  >
+                    <span style="color: #ff2d2d" class="flex items-center">+</span>
                     <div
-                      class="text-black/60 text-xs font-normal font-['PingFang_SC'] leading-snug flex items-center"
-                      @click="toDetail"
+                      class="text-[#ff2d2d] text-xs font-normal font-['PingFang_SC'] leading-none"
                     >
-                      <div>分享主页</div>
-                      <wd-img width="13" height="13" :src="rightArrowIcon"></wd-img>
+                      重点跟进
                     </div>
                   </div>
-                  <div class="flex items-center gap-2 mt-[18px]">
+                  <div
+                    class="px-5 py-1 bg-[#e1ecff] rounded-[30px] border border-[#2357e9] justify-center items-center gap-1 inline-flex"
+                    @click="callPhone('13700000000')"
+                  >
                     <div
-                      class="text-black/30 text-xs font-normal font-['PingFang_SC'] leading-none"
+                      class="text-center text-[#2357e9] text-sm font-normal font-['PingFang_SC'] leading-normal"
                     >
-                      2天前访问
+                      打电话
                     </div>
-                    <div class="bg-[#eeeeee] w-[2px] h-[10px]"></div>
+                  </div>
+                  <div
+                    class="px-5 py-1 bg-[#0052d9] rounded-[30px] justify-center items-center gap-1 inline-flex"
+                  >
                     <div
-                      class="text-black/30 text-xs font-normal font-['PingFang_SC'] leading-none"
+                      class="text-center text-white text-sm font-normal font-['PingFang_SC'] leading-normal"
+                      @click="publishState = true"
                     >
-                      积分:0
+                      写跟进
                     </div>
                   </div>
                 </div>
               </div>
-            </div>
-
-            <div class="row-start-2 col-start-2 col-end-4">
-              <div class="flex items-center justify-between w-full mt-[20px]">
-                <div class="flex items-center">
-                  <div class="w-2 h-2 bg-[#89f4e2] rounded-full mr-[7px]"></div>
-                  <div class="text-black/90 text-xs font-normal font-['PingFang_SC'] leading-snug">
-                    30天未跟进
-                  </div>
-                </div>
-                <div class="flex items-center">
-                  <div class="w-2 h-2 bg-[#ffb96a] rounded-full mr-[7px]"></div>
-                  <div class="text-black/90 text-xs font-normal font-['PingFang_SC'] leading-snug">
-                    60天未产生积分
-                  </div>
-                </div>
-                <div class="flex items-center">
-                  <div class="w-2 h-2 bg-[#c493ff] rounded-full mr-[7px]"></div>
-                  <div class="text-black/90 text-xs font-normal font-['PingFang_SC'] leading-snug">
-                    60天未消耗积分
-                  </div>
-                </div>
-              </div>
-            </div>
-            <div
-              class="row-start-5 col-start-2 col-end-4 flex items-center mt-[26px] justify-around"
-            >
-              <div
-                class="px-3 py-1.5 rounded-[30px] border border-[#ff2d2d] justify-center items-center gap-1 flex"
-                style="border: 1px solid #ff2d2d"
-              >
-                <span style="color: #ff2d2d" class="flex items-center">+</span>
-                <div class="text-[#ff2d2d] text-xs font-normal font-['PingFang_SC'] leading-none">
-                  重点跟进
-                </div>
-              </div>
-              <div
-                class="px-5 py-1 bg-[#e1ecff] rounded-[30px] border border-[#2357e9] justify-center items-center gap-1 inline-flex"
-                @click="callPhone('13700000000')"
-              >
-                <div
-                  class="text-center text-[#2357e9] text-sm font-normal font-['PingFang_SC'] leading-normal"
-                >
-                  打电话
-                </div>
-              </div>
-              <div
-                class="px-5 py-1 bg-[#0052d9] rounded-[30px] justify-center items-center gap-1 inline-flex"
-              >
-                <div
-                  class="text-center text-white text-sm font-normal font-['PingFang_SC'] leading-normal"
-                  @click="publishState = true"
-                >
-                  写跟进
-                </div>
-              </div>
-            </div>
-          </div>
-        </Card>
+            </Card>
+          </template>
+        </div>
       </template>
-    </div>
+    </PageHelperEvo>
   </view>
   <wd-action-sheet v-model="publishState" title="创建跟进" @close="publishState = false">
     <view class="flex flex-col p-4">

+ 3 - 3
packages/merchant/src/pages/home/index.vue

@@ -27,7 +27,7 @@ defineOptions({
 })
 const router = useRouter()
 const userStore = useUserStore()
-const { isLogined, userInfo } = storeToRefs(userStore)
+const { isLogined, userInfo, isAgent, isMerchant } = storeToRefs(userStore)
 const orderAmount = ref()
 const pointsAmount = computed(() => orderAmount.value * 10)
 const toDesigner = () => {
@@ -73,7 +73,7 @@ onShareAppMessage(() => ({}))
 
 <template>
   <view class="flex-grow relative">
-    <template v-if="userInfo.appLoginType === 1">
+    <template v-if="isAgent">
       <div class="aspect-[0.96/1] absolute left-0 right-0 top--1">
         <wd-img
           width="100%"
@@ -187,7 +187,7 @@ onShareAppMessage(() => ({}))
         </div>
       </div>
     </template>
-    <template v-if="userInfo.appLoginType === 2">
+    <template v-if="isMerchant">
       <div
         class="bg-white backdrop-blur-[60px] my-[16px] flex flex-col justify-center items-center p-[16px] mt-[20px]"
       >

+ 12 - 8
packages/merchant/src/pages/mine/index.vue

@@ -10,6 +10,7 @@ import {
   getYearTarget,
   getDesignerStatistics,
   getFollowStatistics,
+  getBroker,
 } from '../../core/libs/requests'
 
 import { storeToRefs } from 'pinia'
@@ -22,6 +23,7 @@ import dayjs from 'dayjs'
 import PageHelper from '../../components/page-helper.vue'
 import { NetImages } from '../../core/libs/net-images'
 import { useUserStore } from '../../store'
+import qrCode from '@designer-hub/assets/src/libs/assets/qrCode'
 
 const userStore = useUserStore()
 const { isLogined, userInfo, isMerchant, isAgent } = storeToRefs(userStore)
@@ -33,6 +35,9 @@ const { data: orders, run: setOrders } = useRequest(() => getOrders())
 const { data: yearTarget, run: setYearTarget } = useRequest(() => getYearTarget())
 const { data: designerData, run: setdesignerData } = useRequest(() => getDesignerStatistics())
 const { data: followData, run: setFollowData } = useRequest(() => getFollowStatistics())
+const { data: agent, run: setAgent } = useRequest(() =>
+  getBroker({ brokerId: userInfo.value.userId.toString() }),
+)
 const nickNameClickHandle = async () => {
   if (isLogined.value) return
 
@@ -50,6 +55,7 @@ onShow(async () => {
 
   if (isLogined.value && isAgent?.value) {
     // await setData()
+    await setAgent()
     await Promise.all([setYearTarget(), setdesignerData(), setFollowData()])
   }
 })
@@ -87,21 +93,19 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
       ></wd-navbar>
       <div class="p-4 flex flex-col gap-4 relative">
         <div class="flex items-center px-4 mb-4">
-          <img
-            class="w-14 h-14 rounded-full border border-white"
-            src="https://via.placeholder.com/56x56"
-          />
+          <img class="w-14 h-14 rounded-full border border-white" :src="agent.headImgUrl" />
           <div class="mx-4 flex-1">
             <div class="text-white text-lg font-normal font-['PingFang_SC'] leading-normal">
-              <!-- 李晓东 -->
-              {{ userInfo.nickname }}
+              {{ agent.brokerName }}
             </div>
             <div class="text-white text-xs font-normal font-['PingFang_SC'] leading-relaxed">
-              ID:1023621
+              ID:{{ agent.inviteCode }}
             </div>
           </div>
           <div>
-            <div class="w-[29px] h-[29px] relative bg-[#ff523f]"></div>
+            <div class="w-[29px] h-[29px] relative">
+              <wd-img width="28" height="28" :src="qrCode"></wd-img>
+            </div>
             <div class="text-white text-[10px] font-normal font-['PingFang_SC'] leading-relaxed">
               邀请码
             </div>