소스 검색

refactor(agent): 重构设计师积分页面

- 移除不必要的导入和未使用的代码
- 优化类型定义和函数参数
-重构积分详情页面布局和样式- 添加新的积分查询功能
- 更新页面路由和导航
EvilDragon 4 달 전
부모
커밋
4bdfda9e37

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

@@ -1,9 +1,6 @@
 import { httpDelete, httpGet, httpPost, httpPut } from '../../utils/http'
 import {
-  PointsOrder,
   ResPageData,
-  Todo,
-  Agent,
   Designer,
   AgentTask,
   ReportInfo,
@@ -16,7 +13,7 @@ import {
 /**
  * 通过ID获取用户信息
  */
-export const getUserInfoById = (id) =>
+export const getUserInfoById = (id: string | number) =>
   httpGet<
     Partial<{
       mobile: string
@@ -132,3 +129,38 @@ export const focusOrCancel = (data: { brokerId: number; userId: number }) =>
  */
 export const getPointsFlow = (query = {}) =>
   httpGet<ResPageData<AgentPoint>>('/app-api/member/task/points_flow', query)
+/**
+ * /app-api/member/points-details/pageAllByYear/2024?pageNo=1&pageSize=10&stylistId=287&year=2024 设计师积分详情
+ */
+export const getPointsDetails = (query: { year?: string } = {}) =>
+  httpGet<
+    ResPageData<{
+      id: number
+      pointsType: string
+      typeName: string
+      pointsCategory: string
+      categoryName: string
+      sourceId: number
+      name: string
+      pointsStauts: string
+      points: number
+      orderMoney: string
+      materialsId: number
+      materialsBrand: string
+      stylistId: number
+      brokerId: number
+      stylistName: string
+      brokerName: string
+      generateTime: string
+      verifyTime: string
+      completeTime: string
+      turnDownTime: string
+      cancelTime: string
+      cancelReason: string
+      turnDownReason: string
+      remark: string
+      couponId: number
+      orderNo: string
+      createTime: string
+    }>
+  >(`/app-api/member/points-details/pageAllByYear/${query.year}`, query)

+ 2 - 3
packages/merchant/src/pages.json

@@ -167,11 +167,10 @@
       }
     },
     {
-      "path": "pages/agent/designer/points_details/index",
+      "path": "pages/agent/designer/points/index",
       "type": "page",
       "style": {
-        "navigationBarTitleText": "积分明细",
-        "navigationBarBackgroundColor": "#fff"
+        "navigationStyle": "custom"
       }
     },
     {

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

@@ -32,7 +32,7 @@ const tabs = ref([
 ])
 const followUpQuery = ref({})
 const toPointsDetails = () => {
-  uni.navigateTo({ url: '/pages/designer/points_details/index' })
+  uni.navigateTo({ url: `/pages/agent/designer/points/index?id=${id.value}` })
 }
 const toOrderDetails = () => {
   uni.navigateTo({ url: '/pages/mine/merchant/orders/detail/index' })

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

@@ -41,7 +41,7 @@ const filterQuery = ref<{
 }>({
   tags: [],
   levels: [],
-  brokerId: userInfo.value.userId.toString(),
+  brokerId: String(userInfo.value.userId),
 })
 const query = ref({})
 const searchFocus = () => {
@@ -62,7 +62,7 @@ const searchChange = (e: any) => {
 const toDetail = async (designer: any) => {
   await uni.navigateTo({ url: '/pages/agent/designer/detail' + '?id=' + designer.id })
 }
-const callPhone = (phoneNumber) => {
+const callPhone = (phoneNumber: string) => {
   uni.makePhoneCall({
     phoneNumber,
   })
@@ -74,7 +74,7 @@ const handleImportant = async (designer: Designer) => {
   const { code } = await requestToast(
     () =>
       focusOrCancel({
-        brokerId: userInfo.value.userId,
+        brokerId: Number(userInfo.value.userId),
         userId: Number(designer.id),
       }),
     {
@@ -95,7 +95,7 @@ const handleSubmit = () => {
   filterState.value = false
 }
 const handleReset = () => {
-  filterQuery.value = { tags: [], levels: [], brokerId: userInfo.value.userId.toString() }
+  filterQuery.value = { tags: [], levels: [], brokerId: String(userInfo.value.userId) }
   query.value = {}
 }
 onLoad(async (params: { title?: string; filter?: string; tags?: string }) => {
@@ -137,7 +137,7 @@ onLoad(async (params: { title?: string; filter?: string; tags?: string }) => {
       </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">
+          <template v-for="(it, i) in source?.list" :key="i">
             <Card>
               <div class="items-center" @click="toDetail(it)">
                 <div class="">

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

@@ -0,0 +1,114 @@
+<route lang="json">
+{ "style": { "navigationStyle": "custom" } }
+</route>
+<script setup lang="ts">
+import Card from '@/components/card.vue'
+
+import { useUserStore } from '../../../../store'
+import { storeToRefs } from 'pinia'
+import dayjs from 'dayjs'
+import NavbarEvo from '@/components/navbar-evo.vue'
+import { NetImages } from '../../../../core/libs/enums'
+import {
+  getPointsFlow,
+  getPointsDetails,
+  getUserInfoById,
+} from '../../../../core/libs/agent-requests'
+import PageHelperEvo from '@/components/page-helper-evo.vue'
+import { getBroker } from '../../../../core/libs/requests'
+
+const userStore = useUserStore()
+const { userInfo } = storeToRefs(userStore)
+const yearState = ref(true)
+const id = ref()
+const year = ref(dayjs().toDate().getTime())
+const query = computed(() => ({
+  brokerId: userInfo.value.userId,
+  stylistId: id.value,
+  year: dayjs(year.value).format('YYYY'),
+}))
+
+const { data, run: setData } = useRequest(() => getUserInfoById(id.value))
+const handleSelect = () => {
+  yearState.value = false
+}
+onLoad(async (query: { id: string }) => {
+  id.value = query.id
+  await setData()
+})
+</script>
+<template>
+  <div class="flex-grow">
+    <NavbarEvo title="任务积分" transparent dark></NavbarEvo>
+    <div class="relative aspect-[3/1]">
+      <div class="aspect-[1.25/1] absolute top-0 w-full">
+        <div class="relative w-full h-full">
+          <div class="absolute top-0 left-0 right-0">
+            <wd-img
+              width="100%"
+              :src="NetImages.DefaultPointsHeadBg"
+              mode="widthFix"
+              custom-class=""
+            ></wd-img>
+          </div>
+        </div>
+      </div>
+    </div>
+    <div class="relative px-3.5">
+      <div class="flex items-end px-3.5 mb-5">
+        <div class="text-white text-sm font-normal font-['PingFang_SC'] leading-relaxed">
+          当前积分
+        </div>
+        <div>
+          <span class="text-white text-4xl font-normal font-['D-DIN_Exp'] leading-9">
+            {{ data.point }}
+          </span>
+        </div>
+        <div class="flex-1"></div>
+        <div></div>
+        <wd-datetime-picker type="year" v-model="year" use-default-slot>
+          <div class="text-[white] text-sm font-normal font-['PingFang_SC'] leading-relaxed">
+            {{ dayjs(year).format('YYYY') }}
+            <wd-icon name="arrow-down" size="12" class="text-[#ffffff]"></wd-icon>
+          </div>
+        </wd-datetime-picker>
+      </div>
+      <Card custom-class="relative">
+        <PageHelperEvo :request="getPointsDetails" :query="query">
+          <template #default="{ source }">
+            <div class="flex flex-col gap-4">
+              <template v-for="(it, i) in source?.list" :key="i">
+                <div class="flex items-center py-4">
+                  <div class="flex-1 flex flex-col">
+                    <div
+                      class="text-black/90 text-base font-normal font-['PingFang_SC'] leading-relaxed"
+                    >
+                      {{ it.name }}
+                    </div>
+                    <div
+                      class="text-black/40 text-sm font-normal font-['PingFang_SC'] leading-relaxed"
+                    >
+                      <!-- 2024/08/10 14:21:54 -->
+                      {{ dayjs(it.createTime).format('YYYY/MM/DD HH:mm:ss') }}
+                    </div>
+                  </div>
+                  <div>
+                    <div
+                      class="text-lg font-normal font-['D-DIN_Exp'] leading-relaxed"
+                      :class="`${it.pointsType === '1' ? 'text-[#ef4343]' : 'text-black'}`"
+                    >
+                      <!-- 8200 -->
+                      {{ { '1': '+', '2': '-' }[it.pointsType] }}
+                      {{ it.points }}
+                    </div>
+                  </div>
+                </div>
+                <div class="h-0.25 bg-[#dadada]" v-if="i !== source?.list.length - 1"></div>
+              </template>
+            </div>
+          </template>
+        </PageHelperEvo>
+      </Card>
+    </div>
+  </div>
+</template>

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

@@ -1,63 +0,0 @@
-<route lang="yaml">
-style:
-  navigationBarTitleText: 积分明细
-  navigationBarBackgroundColor: '#fff'
-</route>
-
-<script setup lang="ts">
-import { desinTopBg } from '@designer-hub/assets/src/svgs'
-const tab = ref(0)
-const tabs = ref([
-  { label: '案例', value: 'integral' },
-  { label: '动态', value: 'system' },
-  { label: '视频', value: 'interact' },
-])
-</script>
-
-<template>
-  <view>
-    <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>
-    </div>
-    <div class="flex flex-col relative mt-[27px] p-[16px]">
-      <div class="flex items-center justify-between">
-        <div class="flex items-center">
-          <div class="text-white text-sm font-['PingFang_SC'] leading-relaxed mr-[10px]">
-            当前积分
-          </div>
-          <div>
-            <span
-              class="text-white text-4xl font-normal font-['D-DIN Exp'] leading-relaxed tracking-[3.60px]"
-            >
-              32
-            </span>
-          </div>
-        </div>
-        <div class="text-white text-sm font-normal font-['PingFang_SC'] leading-relaxed">2024</div>
-      </div>
-      <div class="bg-white rounded-lg backdrop-blur-[60px] p-[16px] mt-[29px]">
-        <div class="flex items-center justify-between flex-row mb-[16px]">
-          <div>
-            <div class="text-black/90 text-base font-normal font-['PingFang_SC'] leading-relaxed">
-              Imola材料商
-            </div>
-            <div
-              class="text-black/40 text-sm font-normal font-['PingFang_SC'] leading-relaxed mt-[5px]"
-            >
-              2024/08/10 14:21:54
-            </div>
-          </div>
-          <div class="text-[#ef4343] text-lg font-normal font-['D-DIN Exp'] leading-relaxed">
-            +8200
-          </div>
-        </div>
-      </div>
-    </div>
-  </view>
-</template>
-
-<style scoped lang="scss">
-:deep(.wd-tabs) {
-  background: transparent;
-}
-</style>

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

@@ -18,7 +18,7 @@ interface NavigateToOptions {
        "/pages/home/merchant/settlement" |
        "/pages/mine/merchant/merchant_settings" |
        "/pages/agent/designer/archives/index" |
-       "/pages/agent/designer/points_details/index" |
+       "/pages/agent/designer/points/index" |
        "/pages/agent/tasks/detail/index" |
        "/pages/mine/agent/invite/index" |
        "/pages/mine/agent/settings/index" |