Browse Source

feat: 更新推荐人验证接口,添加渠道来源字段;优化任务卡片组件,使用组合式 API 管理任务类型;重构任务详情页面样式

EvilDragon 3 months ago
parent
commit
2604031a24

+ 1 - 1
packages/app/src/core/libs/requests.ts

@@ -128,7 +128,7 @@ export const getByDictType = (
       status: number
       status: number
     }[]
     }[]
   >('/app-api/system/dict-data/type', { type })
   >('/app-api/system/dict-data/type', { type })
-export const validateReferrerCode = (data: { code: string }) =>
+export const validateReferrerCode = (data: { code: string; channelSource: string }) =>
   httpPost('/app-api/member/user-auth-info/referrer-validate-code', {}, data)
   httpPost('/app-api/member/user-auth-info/referrer-validate-code', {}, data)
 export const createUserAuthInfo = (
 export const createUserAuthInfo = (
   data: Partial<{
   data: Partial<{

+ 14 - 9
packages/app/src/pages/mine/authentication/index.vue

@@ -42,8 +42,8 @@ const schema = ref<DataFormSchema>({
   channelSource: {
   channelSource: {
     type: 'Select',
     type: 'Select',
     label: '来源',
     label: '来源',
+    labelWidth: 63,
     props: {
     props: {
-      labelWidth: 63,
       placeholder: '请选择通过哪个渠道入驻的筑巢荟',
       placeholder: '请选择通过哪个渠道入驻的筑巢荟',
       columns: [],
       columns: [],
       disabled: userAuthInfo.value != null,
       disabled: userAuthInfo.value != null,
@@ -54,8 +54,8 @@ const schema = ref<DataFormSchema>({
     type: 'TextField',
     type: 'TextField',
     label: '推荐人',
     label: '推荐人',
     existing: true,
     existing: true,
+    labelWidth: 63,
     props: {
     props: {
-      labelWidth: 63,
       placeholder: '请填写推荐人编号',
       placeholder: '请填写推荐人编号',
       disabled: userAuthInfo.value != null,
       disabled: userAuthInfo.value != null,
     },
     },
@@ -63,16 +63,16 @@ const schema = ref<DataFormSchema>({
   designerName: {
   designerName: {
     type: 'TextField',
     type: 'TextField',
     label: '姓名',
     label: '姓名',
+    labelWidth: 63,
     props: {
     props: {
-      labelWidth: 63,
       placeholder: '请输入真实姓名',
       placeholder: '请输入真实姓名',
     },
     },
   },
   },
   mobile: {
   mobile: {
     type: 'TextField',
     type: 'TextField',
     label: '电话',
     label: '电话',
+    labelWidth: 63,
     props: {
     props: {
-      labelWidth: 63,
       placeholder: '请输入电话号码',
       placeholder: '请输入电话号码',
       disabled: true,
       disabled: true,
     },
     },
@@ -80,16 +80,16 @@ const schema = ref<DataFormSchema>({
   employer: {
   employer: {
     type: 'TextField',
     type: 'TextField',
     label: '公司',
     label: '公司',
+    labelWidth: 63,
     props: {
     props: {
-      labelWidth: 63,
       placeholder: '请输入所在公司或自己公司名称',
       placeholder: '请输入所在公司或自己公司名称',
     },
     },
   },
   },
   spatialExpertiseType: {
   spatialExpertiseType: {
     type: 'Checkbox',
     type: 'Checkbox',
     label: '擅长空间类型',
     label: '擅长空间类型',
+    labelWidth: 84,
     props: {
     props: {
-      labelWidth: 84,
       placeholder: ' ',
       placeholder: ' ',
       columns: [],
       columns: [],
     },
     },
@@ -108,11 +108,13 @@ const setReferrerExisting = (value: string) => {
 }
 }
 const handleSubmit = async () => {
 const handleSubmit = async () => {
   console.log(formData.value)
   console.log(formData.value)
-  // return
   if (!userAuthInfo.value) {
   if (!userAuthInfo.value) {
     if (formData.value.channelSource !== '4') {
     if (formData.value.channelSource !== '4') {
       const { data, code: status } = await requestToast(() =>
       const { data, code: status } = await requestToast(() =>
-        validateReferrerCode({ code: formData.value.referrer }),
+        validateReferrerCode({
+          code: formData.value.referrer,
+          channelSource: formData.value.channelSource,
+        }),
       )
       )
       if (data === false || status !== 0) {
       if (data === false || status !== 0) {
         uni.showToast({ title: '推荐人编号不正确', icon: 'none' })
         uni.showToast({ title: '推荐人编号不正确', icon: 'none' })
@@ -134,7 +136,10 @@ const handleSubmit = async () => {
   } else {
   } else {
     if (formData.value.channelSource !== '4') {
     if (formData.value.channelSource !== '4') {
       const { data, code: status } = await requestToast(() =>
       const { data, code: status } = await requestToast(() =>
-        validateReferrerCode({ code: formData.value.referrer }),
+        validateReferrerCode({
+          code: formData.value.referrer,
+          channelSource: formData.value.channelSource,
+        }),
       )
       )
       if (data === false || status !== 0) {
       if (data === false || status !== 0) {
         uni.showToast({ title: '推荐人编号不正确', icon: 'none' })
         uni.showToast({ title: '推荐人编号不正确', icon: 'none' })

+ 29 - 0
packages/merchant/src/composables/task.ts

@@ -0,0 +1,29 @@
+export const useTask = () => {
+  const types = ref({
+    // 0: { title: '团队任务', bg: '', bgClass: 'bg-gradient-to-r from-[#cfe0ff] to-[#e1ecff]' },
+    1: {
+      title: '团队任务',
+      bg: '',
+      bgClass: 'bg-gradient-to-r from-[#cfe0ff] to-[#e1ecff]',
+      color: '#2357e9',
+    },
+    2: {
+      title: '抢单任务',
+      bg: '',
+      bgClass: 'bg-gradient-to-r from-[#ffcfcf] to-[#ffeae1]',
+      color: '#f04c47',
+    },
+    3: {
+      title: '指定任务',
+      bg: '',
+      bgClass: 'bg-gradient-to-r from-[#ffe8cf] to-[#fff3e1]',
+      color: '#f89a2e',
+    },
+  })
+  const getBgClass = (type: number) => types.value[type].bgClass
+  return {
+    types,
+    getBgClass,
+    getColor: (type: number) => types.value[type].color,
+  }
+}

+ 3 - 6
packages/merchant/src/pages/home/agent/components/task-card.vue

@@ -4,15 +4,12 @@ import { taskReceive } from '../../../../core/libs/requests'
 import { useUserStore } from '../../../../store'
 import { useUserStore } from '../../../../store'
 import Card from '@designer-hub/app/src/components/card.vue'
 import Card from '@designer-hub/app/src/components/card.vue'
 import dayjs from 'dayjs'
 import dayjs from 'dayjs'
+import { useTask } from '../../../../composables/task'
 const props = withDefaults(defineProps<{ options: any }>(), { options: () => ({}) })
 const props = withDefaults(defineProps<{ options: any }>(), { options: () => ({}) })
 const userStore = useUserStore()
 const userStore = useUserStore()
 const { userInfo } = storeToRefs(userStore)
 const { userInfo } = storeToRefs(userStore)
-const types = ref({
+
-  // 0: { title: '团队任务', bg: '', bgClass: 'bg-gradient-to-r from-[#cfe0ff] to-[#e1ecff]' },
+const { types } = useTask()
-  1: { title: '团队任务', bg: '', bgClass: 'bg-gradient-to-r from-[#cfe0ff] to-[#e1ecff]' },
-  2: { title: '抢单任务', bg: '', bgClass: 'bg-gradient-to-r from-[#ffcfcf] to-[#ffeae1]' },
-  3: { title: '指定任务', bg: '', bgClass: 'bg-gradient-to-r from-[#ffe8cf] to-[#fff3e1]' },
-})
 const status = ref({
 const status = ref({
   1: {
   1: {
     title: '未开始',
     title: '未开始',

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

@@ -8,18 +8,20 @@ import Card from '@designer-hub/app/src/components/card.vue'
 import SectionHeading from '@designer-hub/app/src/components/section-heading.vue'
 import SectionHeading from '@designer-hub/app/src/components/section-heading.vue'
 import BottomAppBar from '@/components/bottom-app-bar.vue'
 import BottomAppBar from '@/components/bottom-app-bar.vue'
 import DataForm from '@/components/data-form.vue'
 import DataForm from '@/components/data-form.vue'
-import {appTaskReport, getTaskDetail, taskReceive} from '../../../../core/libs/requests'
+import { appTaskReport, getTaskDetail, taskReceive } from '../../../../core/libs/requests'
 import { useUserStore } from '../../../../store'
 import { useUserStore } from '../../../../store'
 import { storeToRefs } from 'pinia'
 import { storeToRefs } from 'pinia'
 import dayjs from 'dayjs'
 import dayjs from 'dayjs'
 import { DataFormSchema } from '../../../../components/data-form'
 import { DataFormSchema } from '../../../../components/data-form'
 import { ComponentExposed } from 'vue-component-type-helpers'
 import { ComponentExposed } from 'vue-component-type-helpers'
+import { useTask } from '../../../../composables/task'
+
+const { getBgClass, getColor } = useTask()
 const taskId = ref()
 const taskId = ref()
 const types = ref({
 const types = ref({
   1: { title: '到店', bg: '', bgClass: 'bg-gradient-to-r from-[#cfe0ff] to-[#e1ecff]' },
   1: { title: '到店', bg: '', bgClass: 'bg-gradient-to-r from-[#cfe0ff] to-[#e1ecff]' },
   2: { title: '订单', bg: '', bgClass: 'bg-gradient-to-r from-[#ffe8cf] to-[#fff3e1]' },
   2: { title: '订单', bg: '', bgClass: 'bg-gradient-to-r from-[#ffe8cf] to-[#fff3e1]' },
 })
 })
-const current = ref<number>(10)
 const type = ref(1)
 const type = ref(1)
 const publishState = ref(false)
 const publishState = ref(false)
 const formData = ref<any>({})
 const formData = ref<any>({})
@@ -97,14 +99,15 @@ onLoad(async (query: { taskId: string }) => {
 </script>
 </script>
 <template>
 <template>
   <view class="flex-grow flex flex-col p-4 gap-4" style="position: relative">
   <view class="flex-grow flex flex-col p-4 gap-4" style="position: relative">
-    <Card :custom-class="`${types[type].bgClass} px-0 py-0`">
+    <Card :custom-class="`${getBgClass(Number(taskDetails?.taskType))} px-0 py-0`">
       <div class="flex items-center py-[20px] px-[15px]">
       <div class="flex items-center py-[20px] px-[15px]">
         <div class="text-black/90 text-lg font-normal font-['PingFang SC'] leading-none">
         <div class="text-black/90 text-lg font-normal font-['PingFang SC'] leading-none">
           {{ taskDetails?.name }}
           {{ taskDetails?.name }}
         </div>
         </div>
         <div class="flex-1"></div>
         <div class="flex-1"></div>
         <div
         <div
-          class="w-[47px] h-[23px] px-1 bg-[#2357e9] rounded border justify-center items-center gap-2.5 inline-flex"
+          class="w-[47px] h-[23px] px-1 rounded border justify-center items-center gap-2.5 inline-flex"
+          :style="{ backgroundColor: getColor(Number(taskDetails?.taskType)) }"
         >
         >
           <div class="text-right text-white text-xs font-normal font-['PingFang_SC'] leading-tight">
           <div class="text-right text-white text-xs font-normal font-['PingFang_SC'] leading-tight">
             {{ taskDetails?.statusName }}
             {{ taskDetails?.statusName }}
@@ -117,7 +120,7 @@ onLoad(async (query: { taskId: string }) => {
             <wd-circle
             <wd-circle
               :model-value="(taskDetails.completedNum / taskDetails.storeQuantity) * 100"
               :model-value="(taskDetails.completedNum / taskDetails.storeQuantity) * 100"
               :size="50"
               :size="50"
-              color="rgba(66, 113, 255, 1)"
+              :color="getColor(Number(taskDetails?.taskType))"
               :clockwise="false"
               :clockwise="false"
             >
             >
               <div class="flex flex-col items-center">
               <div class="flex flex-col items-center">
@@ -266,34 +269,36 @@ onLoad(async (query: { taskId: string }) => {
           </div>
           </div>
         </template>
         </template>
       </div>
       </div>
-      <div v-else class="bg-[#f7fbff] rounded-[10px] py-[22px] px-[16px] mt-[20px]">
+      <div v-else>
         <template v-for="(item, i) in taskDetails?.reportList" :key="i">
         <template v-for="(item, i) in taskDetails?.reportList" :key="i">
-          <div class="flex items-center justify-between">
+          <div class="bg-[#f7fbff] rounded-[10px] py-[22px] px-[16px] mt-[20px]">
-            <div class="text-black/40 text-xs font-normal font-['PingFang SC'] leading-normal">
+            <div class="flex items-center justify-between">
-              {{ dayjs(item.createTime).format('YYYY/MM/DD HH:mm') }}
+              <div class="text-black/40 text-xs font-normal font-['PingFang SC'] leading-normal">
+                {{ dayjs(item.createTime).format('YYYY/MM/DD HH:mm') }}
+              </div>
+              <div class="text-[#2357e9] text-xs font-normal font-['PingFang SC'] leading-normal">
+                {{ item.status == '0' ? '审核通过' : item.status == '1' ? '审核中' : '驳回' }}
+              </div>
             </div>
             </div>
-            <div class="text-[#2357e9] text-xs font-normal font-['PingFang SC'] leading-normal">
+            <div class="mt-[7px]">
-              {{ item.status == '0' ? '审核通过' : item.status == '1' ? '审核中' : '驳回' }}
+              <span class="text-black/60 text-sm font-normal font-['PingFang SC'] leading-normal">
+                个人完成量:
+              </span>
+              <span class="text-black/90 text-sm font-normal font-['PingFang SC'] leading-normal">
+                {{ item.num }}
+              </span>
+            </div>
+            <div class="mt-[2px]">
+              <span class="text-black/60 text-sm font-normal font-['PingFang SC'] leading-normal">
+                上报说明
+              </span>
+              <span class="text-black/90 text-sm font-normal font-['PingFang SC'] leading-normal">
+                :
+              </span>
+              <span class="text-black/90 text-sm font-normal font-['PingFang SC'] leading-normal">
+                {{ item.remark }}
+              </span>
             </div>
             </div>
-          </div>
-          <div class="mt-[7px]">
-            <span class="text-black/60 text-sm font-normal font-['PingFang SC'] leading-normal">
-              个人完成量:
-            </span>
-            <span class="text-black/90 text-sm font-normal font-['PingFang SC'] leading-normal">
-              {{ item.num }}
-            </span>
-          </div>
-          <div class="mt-[2px]">
-            <span class="text-black/60 text-sm font-normal font-['PingFang SC'] leading-normal">
-              上报说明
-            </span>
-            <span class="text-black/90 text-sm font-normal font-['PingFang SC'] leading-normal">
-              :
-            </span>
-            <span class="text-black/90 text-sm font-normal font-['PingFang SC'] leading-normal">
-              {{ item.remark }}
-            </span>
           </div>
           </div>
         </template>
         </template>
       </div>
       </div>