|
@@ -8,6 +8,9 @@
|
|
|
</route>
|
|
|
<script setup lang="ts">
|
|
|
import {
|
|
|
+ createAward,
|
|
|
+ deleteAward,
|
|
|
+ getAwards,
|
|
|
getDesignerBasicInfo,
|
|
|
getDesignerExtraEvents,
|
|
|
getDesignerFamilyInfo,
|
|
@@ -20,12 +23,15 @@ import { renders } from '../../../../core/libs/renders'
|
|
|
import DataRender from '@/components/data-render.vue'
|
|
|
import PageHelperEvo from '@/components/page-helper-evo.vue'
|
|
|
import { DataFormSchema } from '../../../../components/data-form'
|
|
|
-import { DesignerFamilyInfo } from '@designer-hub/app/src/core/libs/models'
|
|
|
+import { DesignerAward, DesignerFamilyInfo } from '@designer-hub/app/src/core/libs/models'
|
|
|
import DataForm from '@/components/data-form.vue'
|
|
|
import { requestToast } from '@designer-hub/app/src/core/utils/common'
|
|
|
import { ComponentExposed } from 'vue-component-type-helpers'
|
|
|
+import ListHelperEvo from '@/components/list-helper-evo.vue'
|
|
|
+import SectionHeading from '@designer-hub/app/src/components/section-heading.vue'
|
|
|
+import dayjs from 'dayjs'
|
|
|
|
|
|
-const tab = ref('basic')
|
|
|
+const tab = ref('sale')
|
|
|
// 基础信息 家庭信息 奖项信息 销售信息 游学/活动信息
|
|
|
const tabs = [
|
|
|
{ label: '基础信息', value: 'basic' },
|
|
@@ -42,8 +48,9 @@ const eventsQuery = computed(() => ({ type: '3' }))
|
|
|
const actionSheetStatus = ref(false)
|
|
|
const schema = ref<DataFormSchema>()
|
|
|
const formData = ref({})
|
|
|
-const submitType = ref<'family'>()
|
|
|
+const submitType = ref<'family' | 'award'>()
|
|
|
const familyPageRef = ref<ComponentExposed<typeof PageHelperEvo>>()
|
|
|
+const awardsListRef = ref<ComponentExposed<typeof ListHelperEvo>>()
|
|
|
// const {} = useRequest()
|
|
|
const handleEditBasicInfo = async () => {
|
|
|
await uni.navigateTo({ url: `/pages/designer/archives/basic-info/index?id=${id.value}` })
|
|
@@ -85,6 +92,37 @@ const handleAddFamilyInfo = async () => {
|
|
|
schema.value = familySchema
|
|
|
actionSheetStatus.value = true
|
|
|
}
|
|
|
+const handleAddAward = async () => {
|
|
|
+ submitType.value = 'award'
|
|
|
+ schema.value = {
|
|
|
+ awardsName: {
|
|
|
+ type: 'TextField',
|
|
|
+ label: messages.objects.designerAward.awardsName,
|
|
|
+ props: {
|
|
|
+ placeholder: messages.objects.designerAward.awardsNamePlaceHolder,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ awardsRank: {
|
|
|
+ type: 'TextField',
|
|
|
+ label: messages.objects.designerAward.awardsRank,
|
|
|
+ props: {
|
|
|
+ placeholder: messages.objects.designerAward.awardsRankPlaceHolder,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ awardsTime: {
|
|
|
+ type: 'TimePick',
|
|
|
+ label: messages.objects.designerAward.awardsTime,
|
|
|
+ props: {
|
|
|
+ placeholder: messages.objects.designerAward.awardsTimePlaceHolder,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ awardsFileUrl: {
|
|
|
+ type: 'ImageUploader',
|
|
|
+ label: messages.objects.designerAward.awardsFileUrl,
|
|
|
+ },
|
|
|
+ }
|
|
|
+ actionSheetStatus.value = true
|
|
|
+}
|
|
|
const handleSubmit = async () => {
|
|
|
switch (submitType.value) {
|
|
|
case 'family': {
|
|
@@ -101,23 +139,45 @@ const handleSubmit = async () => {
|
|
|
}
|
|
|
break
|
|
|
}
|
|
|
+ case 'award':
|
|
|
+ {
|
|
|
+ const { code } = await requestToast(
|
|
|
+ () => createAward({ ...formData.value, userId: Number(id.value) }),
|
|
|
+ {
|
|
|
+ success: true,
|
|
|
+ successTitle: '保存成功',
|
|
|
+ },
|
|
|
+ )
|
|
|
+ if (code === 0) {
|
|
|
+ actionSheetStatus.value = false
|
|
|
+ awardsListRef.value?.reload()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break
|
|
|
default:
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
-onLoad(async (query: { id: string }) => {
|
|
|
- id.value = query.id
|
|
|
+const handleDeleteAward = async (item: DesignerAward) => {
|
|
|
+ await requestToast(() => deleteAward(item.id), {
|
|
|
+ success: true,
|
|
|
+ successTitle: '删除成功',
|
|
|
+ })
|
|
|
+ awardsListRef.value?.reload()
|
|
|
+}
|
|
|
+onLoad(async (query?: Record<string | 'id', any>) => {
|
|
|
+ id.value = query?.id
|
|
|
await setBasicData()
|
|
|
})
|
|
|
</script>
|
|
|
<template>
|
|
|
- <div class="flex-grow bg-white">
|
|
|
+ <div class="flex-grow flex flex-col">
|
|
|
<wd-tabs v-model="tab" :swipeable="true" :slidable-num="4">
|
|
|
<template v-for="(it, index) in tabs" :key="index">
|
|
|
<wd-tab :title="it.label" :name="it.value"></wd-tab>
|
|
|
</template>
|
|
|
</wd-tabs>
|
|
|
- <div class="flex flex-col px-5 gap-5">
|
|
|
+ <div class="flex flex-col flex-grow gap-5">
|
|
|
<template v-if="tab === 'basic'">
|
|
|
<template
|
|
|
v-for="([key, value], index) in Object.entries(omit(basicData, ['id', 'userId']))"
|
|
@@ -146,6 +206,123 @@ onLoad(async (query: { id: string }) => {
|
|
|
</template>
|
|
|
</PageHelperEvo>
|
|
|
</template>
|
|
|
+ <template v-if="tab === 'award'">
|
|
|
+ <div class="bg-white p-4 mt-4 flex-grow flex flex-col">
|
|
|
+ <div class="flex items-center justify-between">
|
|
|
+ <div>奖项信息</div>
|
|
|
+ <div>
|
|
|
+ <wd-button type="text" icon="add-circle1" @click="handleAddAward">
|
|
|
+ 添加获奖信息
|
|
|
+ </wd-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <ListHelperEvo
|
|
|
+ ref="awardsListRef"
|
|
|
+ :request="getAwards"
|
|
|
+ :query="{ userId: id }"
|
|
|
+ :mock-list="[
|
|
|
+ { awardsName: '123', awardsRank: '123' },
|
|
|
+ {
|
|
|
+ awardsName: '筑巢奖',
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ <template #default="{ item, isLast }">
|
|
|
+ <div class="flex flex-col gap-4 py-4">
|
|
|
+ <SectionHeading
|
|
|
+ title="奖项名称"
|
|
|
+ size="base"
|
|
|
+ :end-text="item.awardsName"
|
|
|
+ ></SectionHeading>
|
|
|
+ <SectionHeading
|
|
|
+ title="奖项日期"
|
|
|
+ :end-text="dayjs(item.awardsTime).format('YYYY-MM-DD')"
|
|
|
+ ></SectionHeading>
|
|
|
+ <SectionHeading title="奖项名次" :end-text="item.awardsRank"></SectionHeading>
|
|
|
+ <SectionHeading title="奖项照片" end-arrow></SectionHeading>
|
|
|
+ <wd-button type="text" @click="handleDeleteAward(item)">删除</wd-button>
|
|
|
+ <div v-if="!isLast" class="w-full h-1 bg-[#dadada]"></div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </ListHelperEvo>
|
|
|
+ <!-- <template v-for="(it, index) in source?.list" :key="index">-->
|
|
|
+ <!-- <div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </template>-->
|
|
|
+ <!-- <PageHelperEvo-->
|
|
|
+ <!-- class="flex-grow flex flex-col"-->
|
|
|
+ <!-- :request="async () => ({data: { list: [{}], total: 0 }, msg: 0, code: 0})"-->
|
|
|
+ <!-- :query="eventsQuery"-->
|
|
|
+ <!-- custom-class="flex-grow flex flex-col"-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- <template #default="{ source }">-->
|
|
|
+ <!-- -->
|
|
|
+ <!-- </template>-->
|
|
|
+ <!-- </PageHelperEvo>-->
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-if="tab === 'sale'">
|
|
|
+ <div class="bg-white p-4 mt-4 flex-grow flex flex-col">
|
|
|
+ <div class="flex items-center justify-between">
|
|
|
+ <div>销售信息</div>
|
|
|
+ <!-- <div>-->
|
|
|
+ <!-- <wd-button type="text" icon="add-circle1" @click="handleAddAward">-->
|
|
|
+ <!-- 添加获奖信息-->
|
|
|
+ <!-- </wd-button>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ </div>
|
|
|
+ <ListHelperEvo
|
|
|
+ ref="saleListRef"
|
|
|
+ :items="[
|
|
|
+ { label: '', value: 0, userId: '' },
|
|
|
+ { label: '', value: '' },
|
|
|
+ ]"
|
|
|
+ :query="{ userId: id }"
|
|
|
+ :mock-list="[
|
|
|
+ { label: '今年成交订单数', value: 6 },
|
|
|
+ { label: '今年成交金额', value: 100000 },
|
|
|
+ { label: '累计成交订单数', value: 6 },
|
|
|
+ { label: '累计成交金额', value: 100000 },
|
|
|
+ { label: '其他销售信息', value: '2条' },
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ <template #default="{ item, isLast }">
|
|
|
+ <div class="flex flex-col gap-4 py-4">
|
|
|
+ <div v-if="isLast" class="w-full h-1 bg-[#dadada]"></div>
|
|
|
+ <SectionHeading
|
|
|
+ :title="item.label"
|
|
|
+ size="base"
|
|
|
+ :end-text="String(item.value)"
|
|
|
+ end-arrow
|
|
|
+ path="/pages/agent/designer/archives/sale-info/index"
|
|
|
+ ></SectionHeading>
|
|
|
+ <!-- <SectionHeading-->
|
|
|
+ <!-- title="奖项日期"-->
|
|
|
+ <!-- :end-text="dayjs(item.awardsTime).format('YYYY-MM-DD')"-->
|
|
|
+ <!-- ></SectionHeading>-->
|
|
|
+ <!-- <SectionHeading title="奖项名次" :end-text="item.awardsRank"></SectionHeading>-->
|
|
|
+ <!-- <SectionHeading title="奖项照片" end-arrow></SectionHeading>-->
|
|
|
+ <!-- <wd-button type="text" @click="handleDeleteAward(item)">删除</wd-button>-->
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </ListHelperEvo>
|
|
|
+ <!-- <template v-for="(it, index) in source?.list" :key="index">-->
|
|
|
+ <!-- <div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </template>-->
|
|
|
+ <!-- <PageHelperEvo-->
|
|
|
+ <!-- class="flex-grow flex flex-col"-->
|
|
|
+ <!-- :request="async () => ({data: { list: [{}], total: 0 }, msg: 0, code: 0})"-->
|
|
|
+ <!-- :query="eventsQuery"-->
|
|
|
+ <!-- custom-class="flex-grow flex flex-col"-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- <template #default="{ source }">-->
|
|
|
+ <!-- -->
|
|
|
+ <!-- </template>-->
|
|
|
+ <!-- </PageHelperEvo>-->
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
<template v-if="tab === 'events'">
|
|
|
<PageHelperEvo :request="getDesignerExtraEvents" :query="eventsQuery">
|
|
|
<template #default="{ source }">
|