|
@@ -4,8 +4,8 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { onMounted, ref } from 'vue'
|
|
|
-import { getOrders, getVendorAppInfo } from '../../core/libs/requests'
|
|
|
-import { useUserStore } from '../../store'
|
|
|
+import { getOrders, getVendorAppInfo, getYearTarget } from '../../core/libs/requests'
|
|
|
+
|
|
|
import { storeToRefs } from 'pinia'
|
|
|
import { isEmpty } from 'radash'
|
|
|
import Card from '@designer-hub/app/src/components/card.vue'
|
|
@@ -13,18 +13,18 @@ import SectionHeading from '@designer-hub/app/src/components/section-heading.vue
|
|
|
import { merchantPageHeaderBg, desinTopBg } from '@designer-hub/assets/src/svgs'
|
|
|
import NavBarEvo from '@designer-hub/app/src/components/navbar-evo.vue'
|
|
|
import dayjs from 'dayjs'
|
|
|
-import { useRouter } from '@designer-hub/app/src/core/utils/router'
|
|
|
import PageHelper from '../../components/page-helper.vue'
|
|
|
+import { NetImages } from '../../core/libs/net-images'
|
|
|
+import { useUserStore } from '../../store'
|
|
|
|
|
|
-const router = useRouter()
|
|
|
const userStore = useUserStore()
|
|
|
-
|
|
|
-const { isLogined, userInfo } = storeToRefs(userStore)
|
|
|
+const { isLogined, userInfo, isMerchant, isAgent } = storeToRefs(userStore)
|
|
|
const avatar = computed(() =>
|
|
|
!isEmpty(userInfo.value.avatar) ? userInfo.value.avatar : 'https://via.placeholder.com/72x72',
|
|
|
)
|
|
|
const { data, run: setData } = useRequest(() => getVendorAppInfo())
|
|
|
const { data: orders, run: setOrders } = useRequest(() => getOrders())
|
|
|
+const { data: yearTarget, run: setYearTarget } = useRequest(() => getYearTarget())
|
|
|
const nickNameClickHandle = async () => {
|
|
|
if (isLogined.value) return
|
|
|
|
|
@@ -35,10 +35,15 @@ const toInfoSeting = () => {
|
|
|
uni.navigateTo({ url: '/pages/mine/merchant/merchant_settings' })
|
|
|
}
|
|
|
onShow(async () => {
|
|
|
- if (isLogined.value) {
|
|
|
+ if (isLogined.value && isMerchant?.value) {
|
|
|
await setData()
|
|
|
await setOrders()
|
|
|
}
|
|
|
+
|
|
|
+ if (isLogined.value && isAgent?.value) {
|
|
|
+ // await setData()
|
|
|
+ await Promise.all([setYearTarget()])
|
|
|
+ }
|
|
|
})
|
|
|
onMounted(async () => {
|
|
|
// await run()
|
|
@@ -55,12 +60,12 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
|
|
|
<template>
|
|
|
<view>
|
|
|
<NavBarEvo title="我的" transparent dark placeholder></NavBarEvo>
|
|
|
- <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%"
|
|
|
height="100%"
|
|
|
- :src="merchantPageHeaderBg"
|
|
|
+ :src="NetImages.AgentMineHeaderBg"
|
|
|
custom-class="vertical-bottom"
|
|
|
></wd-img>
|
|
|
</div>
|
|
@@ -80,7 +85,8 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
|
|
|
/>
|
|
|
<div class="mx-4 flex-1">
|
|
|
<div class="text-white text-lg font-normal font-['PingFang_SC'] leading-normal">
|
|
|
- 李晓东
|
|
|
+ <!-- 李晓东 -->
|
|
|
+ {{ userInfo.nickname }}
|
|
|
</div>
|
|
|
<div class="text-white text-xs font-normal font-['PingFang_SC'] leading-relaxed">
|
|
|
ID:1023621
|
|
@@ -96,15 +102,7 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
|
|
|
<Card>
|
|
|
<SectionHeading title="本年目标" size="base"></SectionHeading>
|
|
|
<div class="flex flex-col gap-2.5 mt-3">
|
|
|
- <template
|
|
|
- v-for="{ name } of [
|
|
|
- { name: 'Imola订单金额目标' },
|
|
|
- { name: '平台订单金额目标' },
|
|
|
- { name: '拜访次数' },
|
|
|
- { name: '到店次数' },
|
|
|
- ]"
|
|
|
- :key="name"
|
|
|
- >
|
|
|
+ <template v-for="(it, i) in yearTarget" :key="i">
|
|
|
<div
|
|
|
class="bg-gradient-to-r from-[#fef3ee] to-[#f0f4f9] rounded-lg flex items-center p-4 gap-6"
|
|
|
>
|
|
@@ -115,18 +113,20 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
|
|
|
</div>
|
|
|
<div class="flex-1">
|
|
|
<div class="text-black/60 text-xs font-normal font-['PingFang_SC']">
|
|
|
- {{ name }}
|
|
|
+ {{ it.typeName }}
|
|
|
</div>
|
|
|
<div class="flex items-center gap-1">
|
|
|
<div class="text-black/90 text-lg font-medium font-['DIN'] leading-normal">
|
|
|
- 6000
|
|
|
+ <!-- 6000 -->
|
|
|
+ {{ it.target / 10000 }}
|
|
|
</div>
|
|
|
<div class="text-black text-xs font-normal font-['PingFang_SC']">万</div>
|
|
|
</div>
|
|
|
<div class="flex items-center gap-1">
|
|
|
<div class="text-black/60 text-xs font-normal font-['PingFang_SC']">差值</div>
|
|
|
<div class="text-[#ff2d2d] text-xs font-medium font-['DIN'] leading-normal">
|
|
|
- 3000
|
|
|
+ <!-- 3000 -->
|
|
|
+ {{ (it.target - it.thisYearComplete) / 10000 }}
|
|
|
</div>
|
|
|
<div class="text-[#ff2d2d] text-[10px] font-medium font-['DIN'] leading-normal">
|
|
|
万
|
|
@@ -137,14 +137,16 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
|
|
|
<div class="text-black/60 text-xs font-normal font-['PingFang_SC']">当年完成</div>
|
|
|
<div class="flex items-center gap-1">
|
|
|
<div class="text-black/90 text-lg font-medium font-['DIN'] leading-normal">
|
|
|
- 6000
|
|
|
+ <!-- 6000 -->
|
|
|
+ {{ it.thisYearComplete / 10000 }}
|
|
|
</div>
|
|
|
<div class="text-black text-xs font-normal font-['PingFang_SC']">万</div>
|
|
|
</div>
|
|
|
<div class="flex items-center gap-1">
|
|
|
<div class="text-black/60 text-xs font-normal font-['PingFang_SC']">本月</div>
|
|
|
<div class="text-[#0FC187] text-xs font-medium font-['DIN'] leading-normal">
|
|
|
- 3000
|
|
|
+ <!-- 3000 -->
|
|
|
+ {{ it.thisMonthComplete / 10000 }}
|
|
|
</div>
|
|
|
<div class="text-[#0FC187] text-[10px] font-medium font-['DIN'] leading-normal">
|
|
|
万
|
|
@@ -220,7 +222,7 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
|
|
|
</Card>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <template v-if="userInfo.appLoginType === 2">
|
|
|
+ <template v-if="isMerchant">
|
|
|
<view class="p-[16px]">
|
|
|
<div class="aspect-[1.575/1] absolute left-0 right-0 top-0">
|
|
|
<wd-img width="100%" height="100%" :src="desinTopBg" custom-class="vertical-top"></wd-img>
|