Browse Source

任务列表,详情接口

Jake 3 months ago
parent
commit
693e0ff943

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

@@ -5,6 +5,6 @@ VITE_DELETE_CONSOLE = false
 # 是否开启sourcemap
 VITE_SHOW_SOURCEMAP = true
 
-VITE_SERVER_BASEURL = 'https://www.zhuchaohui.com'
+#VITE_SERVER_BASEURL = 'https://www.zhuchaohui.com'
 # VITE_SERVER_BASEURL = 'http://39.106.91.179:48080'
-# VITE_SERVER_BASEURL = 'http://192.168.2.45:48080'
+ VITE_SERVER_BASEURL = 'http://192.168.2.45:48080'

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

@@ -224,6 +224,12 @@ export const getDesignerList = (query: { brokerId: string; pageNo: number; pageS
   httpGet('/app-api/member/report-info/pageStylistByBrokerId', query)
 // 添加关系报备
 export const createReportInfo = (data) => httpPost<any>('/app-api/member/report-info/create', data)
+// 获取任务列表
+export const getTaskList = (query) => httpGet<any>('/app-api/member/task/task-list', query)
+// 任务详情
+export const getTaskDetail = (query) => httpGet<any>('/app-api/member/task/task-detail', query)
+// 领取任务
+export const taskReceive = (data) => httpPost<any>('/app-api/member/task/task-receive', data)
 
 export const getTasks = (query) =>
   httpGet<{

+ 1 - 1
packages/merchant/src/pages/home/merchant/add-reporting-information.vue

@@ -3,7 +3,7 @@
 </route>
 <script setup lang="ts">
 import DataForm from '../../../components/data-form.vue'
-import {createReportInfo, getDesignerList} from '@/core/libs/requests'
+import { createReportInfo, getDesignerList } from '@/core/libs/requests'
 import { useUserStore } from '@/store'
 import { storeToRefs } from 'pinia'
 

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

@@ -7,7 +7,11 @@ style:
 import Card from '@designer-hub/app/src/components/card.vue'
 import SectionHeading from '@designer-hub/app/src/components/section-heading.vue'
 import BottomAppBar from '@/components/bottom-app-bar.vue'
-import DataForm from "@/components/data-form.vue";
+import DataForm from '@/components/data-form.vue'
+// eslint-disable-next-line import/named
+import { getTaskDetail } from '@/core/libs/requests'
+import { useUserStore } from '@/store'
+import { storeToRefs } from 'pinia'
 const types = ref({
   1: { title: '到店', bg: '', bgClass: 'bg-gradient-to-r from-[#cfe0ff] to-[#e1ecff]' },
   2: { title: '订单', bg: '', bgClass: 'bg-gradient-to-r from-[#ffe8cf] to-[#fff3e1]' },
@@ -17,6 +21,8 @@ const type = ref(1)
 const taskType = ref(2)
 const publishState = ref(false)
 const fromModel = ref()
+const userStore = useUserStore()
+const { userInfo } = storeToRefs(userStore)
 const customerSchema = ref({
   customerName: {
     type: 'TextField',
@@ -35,6 +41,12 @@ const customerSchema = ref({
     },
   },
 })
+const initData = async () => {
+  const res = await getTaskDetail({ brokerId: userInfo.value.userId, taskId: '' })
+}
+onMounted(async () => {
+  initData()
+})
 </script>
 <template>
   <view class="flex-grow flex flex-col p-4 gap-4" style="position: relative">
@@ -169,7 +181,7 @@ const customerSchema = ref({
         <div class="mr-2.5 w-1 h-4 rotate-180 bg-[#2357e9] rounded-[20px]"></div>
         <SectionHeading title="数据明细" size="base"></SectionHeading>
       </div>
-      <div v-if="taskType == 1" class="flex flex-col gap-4 mt-5 ">
+      <div v-if="taskType == 1" class="flex flex-col gap-4 mt-5">
         <div class="flex gap-2.5 p-3.5 bg-[#f7fbff] items-center rounded-[10px]">
           <img class="w-11 h-11 rounded-full" src="https://via.placeholder.com/44x44" />
           <div class="flex-1 flex flex-col gap-2">
@@ -268,7 +280,7 @@ const customerSchema = ref({
     </BottomAppBar>
     <wd-action-sheet v-model="publishState" title="" @close="publishState = false">
       <view class="flex flex-col p-4 mt-4">
-        <data-form :schema="customerSchema" v-model="fromModel" ></data-form>
+        <data-form :schema="customerSchema" v-model="fromModel"></data-form>
 <!--        <div><DataForm :schema="schema" direction="horizontal"></DataForm></div>-->
         <div><wd-button block :round="false">提交</wd-button></div>
       </view>

+ 54 - 35
packages/merchant/src/pages/home/tasks/index.vue

@@ -5,39 +5,44 @@ navigationBarBackgroundColor: '#fff'
 </route>
 <script setup lang="ts">
 import Card from '@designer-hub/app/src/components/card.vue'
-
-const tasks = ref([
-  {
-    status: 0,
-    type: 1,
-    name: 'imola',
-    brand: 'imola瓷砖',
-    start: '2024/06/07',
-    end: '2024/06/15',
-    targe: 30,
-    finished: 22,
-  },
-  {
-    status: 0,
-    type: 2,
-    name: 'imola',
-    brand: 'imola瓷砖',
-    start: '2024/06/07',
-    end: '2024/06/15',
-    targe: 30,
-    finished: 22,
-  },
-  {
-    status: 0,
-    type: 1,
-    name: 'imola',
-    brand: 'imola瓷砖',
-    start: '2024/06/07',
-    end: '2024/06/15',
-    targe: 30,
-    finished: 22,
-  },
-])
+import { getTaskList, taskReceive } from '@/core/libs/requests'
+import { useUserStore } from '@/store'
+import { storeToRefs } from 'pinia'
+const userStore = useUserStore()
+const { userInfo } = storeToRefs(userStore)
+// const tasks = ref([
+//   {
+//     status: 0,
+//     type: 1,
+//     name: 'imola',
+//     brand: 'imola瓷砖',
+//     start: '2024/06/07',
+//     end: '2024/06/15',
+//     targe: 30,
+//     finished: 22,
+//   },
+//   {
+//     status: 0,
+//     type: 2,
+//     name: 'imola',
+//     brand: 'imola瓷砖',
+//     start: '2024/06/07',
+//     end: '2024/06/15',
+//     targe: 30,
+//     finished: 22,
+//   },
+//   {
+//     status: 0,
+//     type: 1,
+//     name: 'imola',
+//     brand: 'imola瓷砖',
+//     start: '2024/06/07',
+//     end: '2024/06/15',
+//     targe: 30,
+//     finished: 22,
+//   },
+// ])
+const tasksList = ref([])
 const types = ref({
   1: { title: '到店', bg: '', bgClass: 'bg-gradient-to-r from-[#cfe0ff] to-[#e1ecff]' },
   2: { title: '订单', bg: '', bgClass: 'bg-gradient-to-r from-[#ffe8cf] to-[#fff3e1]' },
@@ -45,6 +50,16 @@ const types = ref({
 const toDetail = async () => {
   await uni.navigateTo({ url: '/pages/home/tasks/detail/index' })
 }
+const acceptingOrders = async () => {
+  const res = await taskReceive({ brokerId: '', taskId: '' })
+}
+const initData = async () => {
+  const res = await getTaskList({ brokerId: userInfo.value.userId })
+  tasksList.value = res.data
+}
+onMounted(async () => {
+  initData()
+})
 </script>
 <template>
   <div class="bg-white rounded-lg shadow flex m-[18px] p-[11px]">
@@ -56,7 +71,7 @@ const toDetail = async () => {
     <div class="w-6 h-6 relative"></div>
   </div>
   <div class="flex-grow flex flex-col gap-4 p-4">
-    <template v-for="({ type }, i) of tasks" :key="i">
+    <template v-for="({ type }, i) of tasksList" :key="i">
       <div @click="toDetail()">
         <Card :custom-class="`${types[type].bgClass} p-0`" style="padding: 0">
           <div class="flex p-4 items-center">
@@ -106,12 +121,16 @@ const toDetail = async () => {
             <div class="flex items-center border-t border-t-solid border-t-[#efefef] pt-1.5">
               <div class="text-black/90 text-sm font-normal font-['PingFang SC']">目标 30</div>
               <div class="flex-1"></div>
-              <div class="mr-[16px] w-[68px] h-7 px-2.5 py-[3px] rounded-[30px] border border-[#fe5053] justify-center items-center gap-2.5 inline-flex" style="border: 1px solid #fe5053">
+              <div
+                class="mr-[16px] w-[68px] h-7 px-2.5 py-[3px] rounded-[30px] border border-[#fe5053] justify-center items-center gap-2.5 inline-flex"
+                style="border: 1px solid #fe5053"
+              >
                 <div class="w-9 text-[#ff2d2d] text-xs font-normal font-['PingFang SC']">
                   不接单
                 </div>
               </div>
               <div
+                @click="acceptingOrders()"
                 class="w-[68px] h-7 px-2.5 py-[3px] bg-[#2357e9] rounded-[30px] justify-center items-center gap-2.5 inline-flex"
               >
                 <div class="text-white text-xs font-normal font-['PingFang SC']">接单</div>