فهرست منبع

商户端分销功能

purui 1 هفته پیش
والد
کامیت
6ad8064892

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

@@ -1262,6 +1262,24 @@ export interface BrowseRecordCountRes {
   customersAcquiredYear: number
 }
 
+/**
+ * 引荐动态
+ */
+export interface ReferralRes {
+  /* 推荐设计师 */
+  referrerStylist: number
+
+  /* 本年推荐设计师 */
+  thisYearReferrerStylist: string
+
+  /* 引荐加成奖励 */
+  referralBonus: number
+
+  /* 本年引荐加成奖励 */
+  thisYearReferralBonus: number
+
+}
+
 export enum DictType {
   /**
    *  擅长空间类型

+ 2 - 2
packages/merchant/env/.env.development

@@ -6,5 +6,5 @@ VITE_DELETE_CONSOLE=false
 VITE_SHOW_SOURCEMAP=true
 
 #VITE_SERVER_BASEURL='https://www.zhuchaohui.com'
-VITE_SERVER_BASEURL = 'http://39.106.91.179:48080'
-#VITE_SERVER_BASEURL='http://192.168.2.58:48080'
+VITE_SERVER_BASEURL = 'https://zhuchaohui.f3.ttvt.cc'
+

+ 15 - 7
packages/merchant/src/core/libs/agent-requests.ts

@@ -15,6 +15,7 @@ import {
   DesignerOrderSaleOther,
   BrowseRecordCountRes,
   BrowseRecord,
+  ReferralRes
 } from '@designer-hub/app/src/core/libs/models'
 import dayjs from 'dayjs'
 /**
@@ -321,6 +322,13 @@ export const getBrowseRecordCount = (stylistId: number) =>
     `/app-api/member/browse-record/browseRecordCount?stylistId=${stylistId}`,
   )
 /**
+ * 获取设计师引荐动态
+ */
+export const getReferralDynamics = (stylistId: number) =>
+  httpGet<ReferralRes>(
+    `/app-api/member/distribute/referralDynamics?userId=${stylistId}`,
+  )  
+/**
  * /app-api/member/browse-record/page 浏览记录
  * @param query
  */
@@ -372,13 +380,13 @@ export const getPointsCounts = (query = {}) =>
         subTitle: '本年',
         subValue: res.data.usePointsYear ?? 0,
       },
-      {
-        userId: '',
-        title: '累计跟进次数',
-        value: res.data.followUpCount ?? 0,
-        subTitle: '本年',
-        subValue: res.data.followUpYearCount ?? 0,
-      },
+      // {
+      //   userId: '',
+      //   title: '累计跟进次数',
+      //   value: res.data.followUpCount ?? 0,
+      //   subTitle: '本年',
+      //   subValue: res.data.followUpYearCount ?? 0,
+      // },
       {
         userId: '',
         title: '累计消耗次数',

+ 4 - 4
packages/merchant/src/core/libs/requests.ts

@@ -252,10 +252,10 @@ export const getByDictType = (
   >('/app-api/system/dict-data/type', { type })
 export const getDistribute = () =>
   httpGet<string>('/app-api/member/distribute/getDistribute')  
-export const referrerCount = () =>
-  httpGet<string>('/app-api/member/distribute/referrerCount')
-export const distributePointsSum = () =>
-  httpGet<string>('/app-api/member/distribute/distributePointsSum')
+export const referrerCount = (query) =>
+  httpGet<string>('/app-api/member/distribute/referrerCount', query)
+export const distributePointsSum = (query) =>
+  httpGet<string>('/app-api/member/distribute/distributePointsSum', query)
 export const pageReferrerDetail = (query) =>
   httpGet('/app-api/member/distribute/pageReferrerDetail', query)  
 export const getDistributePage = (query) =>

+ 24 - 0
packages/merchant/src/pages.json

@@ -191,6 +191,30 @@
       }
     },
     {
+      "path": "pages/mine/refferrer/details",
+      "type": "page",
+      "style": {
+        "navigationBarTitleText": "",
+        "navigationBarBackgroundColor": "#fff"
+      }
+    },
+    {
+      "path": "pages/mine/refferrer/index",
+      "type": "page",
+      "style": {
+        "navigationBarTitleText": "引荐奖励",
+        "navigationBarBackgroundColor": "#fff"
+      }
+    },
+    {
+      "path": "pages/mine/refferrer/rule",
+      "type": "page",
+      "style": {
+        "navigationBarTitleText": "规则说明",
+        "navigationBarBackgroundColor": "#fff"
+      }
+    },
+    {
       "path": "pages/agent/designer/archives/index",
       "type": "page",
       "style": {

+ 64 - 2
packages/merchant/src/pages/agent/designer/detail.vue

@@ -15,6 +15,7 @@ import {
   getBrowseRecordCount,
   getBrowseRecords,
   getBrowseRecordRemarks,
+  getReferralDynamics,
 } from '@/core/libs/agent-requests'
 import {
   desinTopBg,
@@ -60,6 +61,9 @@ const followUpQuery = computed(() => ({
 const { data: browseRecordCount, run: setBrowseRecordCount } = useRequest(() =>
   getBrowseRecordCount(id.value),
 )
+const { data: referralDynamics, run: setReferralDynamics } = useRequest(() =>
+  getReferralDynamics(id.value),
+)
 console.log('browseRecordCount data', data)
 const browseRecordCountItems = computed(() => [
   {
@@ -102,6 +106,20 @@ const browseRecordCountItems = computed(() => [
     subValue: browseRecordCount.value?.customersAcquiredYear ?? 0,
   },
 ])
+const referraItems = computed(() => [
+  {
+    title: '推荐设计师',
+    subTitle: '本年',
+    value: referralDynamics.value?.referrerStylist ?? 0,
+    subValue: referralDynamics.value?.thisYearReferrerStylist ?? 0,
+  },
+  {
+    title: '引荐加成奖励',
+    subTitle: '本年',
+    value: referralDynamics.value?.referralBonus ?? 0,
+    subValue: referralDynamics.value?.thisYearReferralBonus ?? 0,
+  },
+])
 const recentActivities = computed(() => [
   { label: '最近浏览品牌', value: '' },
   { label: '最近到店品牌', value: '' },
@@ -118,6 +136,9 @@ const toOrderDetails = (it: any) => {
 const toArchives = () => {
   uni.navigateTo({ url: '/pages/agent/designer/archives/index?id=' + id.value })
 }
+const toRefferrer= () => {
+  uni.navigateTo({ url: '/pages/mine/refferrer/index?id=' + id.value })
+}
 const formatDuration = (duration: number) => {
   if (duration < 60) {
     return `${duration}秒`
@@ -149,8 +170,8 @@ function formatDuration1(seconds) {
 onLoad(async (query) => {
   id.value = query?.id
   await setData()
-  await Promise.all([setBrowseRecordCount()])
-  console.log(browseRecordCount.value)
+  await Promise.all([setBrowseRecordCount(),setReferralDynamics()])
+  console.log(referralDynamics.value)
 })
 </script>
 
@@ -309,6 +330,47 @@ onLoad(async (query) => {
               </ListHelperEvo>
             </div>
           </Card>
+		  
+		  <Card custom-class="my-4">
+		    <div class="flex items-center justify-between">
+		      <div class="text-black/90 text-base font-normal font-['PingFang_SC'] leading-relaxed">
+		        引荐动态
+		      </div>
+			  <div class="text-black/40 text-[24rpx] font-['PingFang_SC']" @click="toRefferrer">查看详情</div>
+		    </div>
+		    <div class="mt-3">
+		      <ListHelperEvo
+		        :content-class="`grid grid-cols-3 gap-2.5`"
+		        :items="referraItems"
+		        custom-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"
+		            >
+		              {{ item.title }}
+		            </div>
+		            <div class="text-black/90 text-lg font-bold font-['D-DIN_Exp'] leading-normal">
+		              {{ item.value }}
+		            </div>
+		            <div class="flex items-center gap-1 whitespace-nowrap">
+		              <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"
+		              >
+		                {{ item.subValue }}
+		              </div>
+		            </div>
+		          </div>
+		        </template>
+		      </ListHelperEvo>
+		    </div>
+		  </Card>
 
           <div class="my-4">
             <Card>

+ 6 - 0
packages/merchant/src/pages/agent/designer/index.vue

@@ -357,6 +357,12 @@ onLoad(async (params: { title?: string; filter?: string; tags?: string }) => {
                         >
                           积分:{{ it.points || 0 }}
                         </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>

+ 4 - 2
packages/merchant/src/pages/mine/refferrer/details.vue

@@ -13,9 +13,10 @@ const PageHelperEvoRef = ref<ComponentExposed<typeof PageHelperEvo>>()
 const referrerId = ref<number | string>('')
 // const { data: referrer, run: setReferrer } = useRequest(() => pageReferrerDetail())
 // const { data: distribute, run: setDistribute } = useRequest(() => getDistributePage())
-const queryReward = computed(() => ({ status: tabsReward.value[tab.value]?.value }))
-const queryRecommend = computed(() => (referrerId.value?{ auditStatus: tabsRecommend.value[tab.value]?.value, referrerId:referrerId.value }:{auditStatus: tabsRecommend.value[tab.value]?.value}))
+const queryReward = computed(() => ({ status: tabsReward.value[tab.value]?.value,userId:id.value }))
+const queryRecommend = computed(() => (referrerId.value?{ auditStatus: tabsRecommend.value[tab.value]?.value, referrerId:referrerId.value,userId:id.value }:{auditStatus: tabsRecommend.value[tab.value]?.value,userId:id.value}))
 
+const id = ref()
 const type = ref("recommend")
 const tab = ref(0)
 const tabsReward = ref([
@@ -77,6 +78,7 @@ onLoad((options:object)=>{
 			title:"奖励明细"
 		})
 	}
+	id.value = options?.id
 	type.value = options?.type
 })
 

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

@@ -5,10 +5,9 @@
 import Card from '@/components/card.vue'
 import { phone, right } from '../../../core/libs/svgs'
 import { referrerCount, distributePointsSum } from '../../../core/libs/requests'
-import { handleCall } from '../../../core/utils/common'
-
-const { data: count, run: setCount } = useRequest(() => referrerCount())
-const { data: pointsSum, run: setPointsSum} = useRequest(() => distributePointsSum())
+const id = ref()
+const { data: count, run: setCount } = useRequest(() => referrerCount({ userId:id.value }))
+const { data: pointsSum, run: setPointsSum} = useRequest(() => distributePointsSum({ userId:id.value }))
 const handleClick = (path) => {
   uni.navigateTo({ url: path })
 }
@@ -19,7 +18,9 @@ const tips = () =>{
 		duration:3000
 	})
 }
-onMounted(async () => {
+onLoad(async (query?: Record<string | 'id', any>) => {
+  id.value = query?.id
+  console.log(id.value)
   await setCount();
   await setPointsSum();
 })
@@ -29,7 +30,7 @@ onMounted(async () => {
 	<view class="bg-white rounded-[32rpx] px-[24rpx] pt-[34rpx] pb-[60rpx] mb-[30rpx]">
 	  <view class="flex items-center justify-between mb-[60rpx] border-b-1 pb-[20rpx]">
 		  <view class="text-[36rpx] font-bold">我的推荐</view>
-		  <view class="text-[28rpx] text-black/40" @click="handleClick('/pages-sub/mine/refferrer/details?type=recommend')">
+		  <view class="text-[28rpx] text-black/40" @click="handleClick('/pages/mine/refferrer/details?type=recommend&id='+ id)">
 			  <text>查看明细</text>
 			  <wd-img :src="right" width="12" height="12"></wd-img>
 		  </view>
@@ -66,7 +67,7 @@ onMounted(async () => {
 	<view class="bg-white rounded-[32rpx] px-[24rpx] pt-[34rpx] pb-[60rpx] mb-[30rpx]">
 	  <view class="flex items-center justify-between mb-[60rpx] border-b-1 pb-[20rpx]">
 		  <view class="text-[36rpx] font-bold">引荐加成奖励</view>
-		  <view class="text-[28rpx] text-black/40" @click="handleClick('/pages-sub/mine/refferrer/details?type=reward')">
+		  <view class="text-[28rpx] text-black/40" @click="handleClick('/pages/mine/refferrer/details?type=reward&id='+ id)">
 			  <text>查看明细</text>
 			  <wd-img :src="right" width="12" height="12"></wd-img>
 		  </view>
@@ -92,7 +93,7 @@ onMounted(async () => {
 		</div>
 	  </div>
 	</view>
-	<view class="flex bg-white rounded-[32rpx] px-[24rpx] py-[34rpx]" @click="handleClick('/pages-sub/mine/refferrer/rule')">
+	<view class="flex bg-white rounded-[32rpx] px-[24rpx] py-[34rpx]" @click="handleClick('/pages/mine/refferrer/rule')">
 		<view class="text-[32rpx] flex-grow">引荐奖励规则</view>
 		<icon type="info_circle" size="22" color="#999"></icon>
 	</view>

+ 3 - 0
packages/merchant/src/types/uni-pages.d.ts

@@ -21,6 +21,9 @@ interface NavigateToOptions {
        "/pages/home/result/orderConfirm" |
        "/pages/home/result/success" |
        "/pages/mine/merchant/merchant_settings" |
+       "/pages/mine/refferrer/details" |
+       "/pages/mine/refferrer/index" |
+       "/pages/mine/refferrer/rule" |
        "/pages/agent/designer/archives/index" |
        "/pages/agent/designer/points/index" |
        "/pages/agent/designer/points_details/index" |