|
@@ -8,7 +8,7 @@
|
|
|
</route>
|
|
|
<script setup lang="ts">
|
|
|
import Card from '@designer-hub/app/src/components/card.vue'
|
|
|
-import { getTaskList, taskReceive } from '../../../core/libs/requests'
|
|
|
+import { getBroker, getTaskList, taskReceive } from '../../../core/libs/requests'
|
|
|
import { useUserStore } from '../../../store'
|
|
|
import { storeToRefs } from 'pinia'
|
|
|
import dayjs from 'dayjs'
|
|
@@ -16,10 +16,11 @@ import PageHelperEvo from '@/components/page-helper-evo.vue'
|
|
|
import { getTasks } from '../../../core/libs/agent-requests'
|
|
|
import { useTask } from '../../../composables/task'
|
|
|
import { AgentTask } from '@designer-hub/app/src/core/libs/models'
|
|
|
+import { ComponentExposed } from 'vue-component-type-helpers'
|
|
|
const userStore = useUserStore()
|
|
|
const { userInfo } = storeToRefs(userStore)
|
|
|
const { types } = useTask()
|
|
|
-const tasksList = ref([])
|
|
|
+const pageHelperRef = ref<ComponentExposed<typeof PageHelperEvo>>()
|
|
|
const status = ref<any>({
|
|
|
1: {
|
|
|
title: '未开始',
|
|
@@ -34,42 +35,46 @@ const status = ref<any>({
|
|
|
})
|
|
|
const query = computed(() => ({ brokerId: userInfo.value.userId }))
|
|
|
|
|
|
+const { data, run: setData } = useRequest(() =>
|
|
|
+ getBroker({ brokerId: String(userInfo.value.userId) }),
|
|
|
+)
|
|
|
+
|
|
|
// 状态(1-未开始,2-进行中,3-已撤回,4-已完成,5-未完成,6-待确认)
|
|
|
const toDetail = async (item: AgentTask) => {
|
|
|
- await uni.navigateTo({ url: `/pages/home/tasks/detail/index?taskId=${item.id}` })
|
|
|
+ await uni.navigateTo({ url: `/pages/agent/tasks/detail/index?taskId=${item.id}` })
|
|
|
}
|
|
|
const acceptingOrders = async (item: AgentTask) => {
|
|
|
uni.showLoading()
|
|
|
- const res = await taskReceive({ brokerId: userInfo.value.userId, taskId: item.id, orders: true })
|
|
|
+ await taskReceive({ brokerId: userInfo.value.userId, taskId: item.id, orders: true })
|
|
|
uni.hideLoading()
|
|
|
- initData()
|
|
|
+ pageHelperRef.value?.refresh()
|
|
|
}
|
|
|
const acceptingNoOrders = async (item: AgentTask) => {
|
|
|
uni.showLoading()
|
|
|
- const res = await taskReceive({ brokerId: userInfo.value.userId, taskId: item.id, orders: false })
|
|
|
+ await taskReceive({ brokerId: userInfo.value.userId, taskId: item.id, orders: false })
|
|
|
uni.hideLoading()
|
|
|
- initData()
|
|
|
+ pageHelperRef.value?.refresh()
|
|
|
}
|
|
|
-
|
|
|
-const initData = async () => {
|
|
|
- const res = await getTaskList({ brokerId: userInfo.value.userId })
|
|
|
- tasksList.value = res.data
|
|
|
+const toPoints = async () => {
|
|
|
+ await uni.navigateTo({ url: '/pages/agent/points/index' })
|
|
|
}
|
|
|
onMounted(async () => {
|
|
|
- initData()
|
|
|
+ await setData()
|
|
|
})
|
|
|
</script>
|
|
|
<template>
|
|
|
- <div class="bg-white rounded-lg shadow flex m-[18px] p-[11px]">
|
|
|
+ <div class="bg-white rounded-lg shadow flex m-[18px] p-[11px]" @click="toPoints">
|
|
|
<div class="text-black/90 text-base font-normal font-['PingFang_SC'] leading-relaxed">
|
|
|
任务积分
|
|
|
</div>
|
|
|
<div class="flex-1"></div>
|
|
|
- <div class="text-[#ff2e2e] text-[22px] font-medium font-['DIN'] leading-none">6153</div>
|
|
|
+ <div class="text-[#ff2e2e] text-[22px] font-medium font-['DIN'] leading-none">
|
|
|
+ {{ data.points }}
|
|
|
+ </div>
|
|
|
<div class="w-6 h-6 relative"></div>
|
|
|
</div>
|
|
|
|
|
|
- <PageHelperEvo :request="getTasks" :query="query">
|
|
|
+ <PageHelperEvo ref="pageHelperRef" :request="getTasks" :query="query">
|
|
|
<template #default="{ source }">
|
|
|
<div class="flex-grow flex flex-col gap-4 p-4">
|
|
|
<template v-for="item in source?.list" :key="item.id">
|