【招生小程序】 优化# 电销和招生共用总结模板
parent
4528f8f7e2
commit
a4930290b5
|
@ -15,3 +15,7 @@ export function apiSummaryDetail(params: any) {
|
||||||
export function apiEditSummary(params: any) {
|
export function apiEditSummary(params: any) {
|
||||||
return request.post({ url: '/summary/template/edit', data: params })
|
return request.post({ url: '/summary/template/edit', data: params })
|
||||||
}
|
}
|
||||||
|
// 模板列表
|
||||||
|
export function apiSummaryLists(params: any) {
|
||||||
|
return request.get({ url: '/summary/template/list', data: params })
|
||||||
|
}
|
||||||
|
|
|
@ -8,57 +8,56 @@
|
||||||
</template>
|
</template>
|
||||||
<template #title>
|
<template #title>
|
||||||
<view class="w-4/5 flex items-center justify-center">
|
<view class="w-4/5 flex items-center justify-center">
|
||||||
<date-picker :bindingDate="bindingDate" />
|
<date-picker
|
||||||
|
:bindingDate="queryParams.date"
|
||||||
|
format="YYYY-MM"
|
||||||
|
@confirm="confirmDate"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</w-navbarComp>
|
</w-navbarComp>
|
||||||
<view class="flex-1 overflow-auto px-[24rpx] pt-[24rpx] bg-[#F8F8F8]">
|
<view class="flex-1 overflow-auto px-[24rpx] pt-[24rpx] bg-[#F8F8F8]">
|
||||||
<!-- <z-paging
|
<z-paging
|
||||||
ref="paging"
|
ref="paging"
|
||||||
v-model="dataList"
|
v-model="dataList"
|
||||||
@query="queryList"
|
@query="queryList"
|
||||||
:fixed="false"
|
:fixed="false"
|
||||||
height="100%"
|
height="100%"
|
||||||
> -->
|
>
|
||||||
<summary-card v-for="(item, index) in cardList" :key="`unique-${index}`" :item="item" />
|
<summary-card
|
||||||
<!-- </z-paging> -->
|
v-for="(item, index) in dataList"
|
||||||
|
:key="`unique-${index}`"
|
||||||
|
:item="item"
|
||||||
|
/>
|
||||||
|
</z-paging>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
|
||||||
import summaryCard, { ISummaryCard } from './summary-card.vue'
|
|
||||||
import datePicker from '@/components/date-picker/date-picker.vue'
|
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { ref, reactive } from 'vue'
|
||||||
|
import summaryCard, { ISummaryCard } from './summary-card.vue'
|
||||||
|
import { useZPaging } from '@/hooks/useZPaging'
|
||||||
|
import datePicker from '@/components/date-picker/date-picker.vue'
|
||||||
|
import { apiSummaryLists } from '@/api/summary'
|
||||||
|
import { formatDate } from '@/utils/util'
|
||||||
|
|
||||||
const cardList = ref<ISummaryCard[]>([
|
const dataList = ref<ISummaryCard[]>([])
|
||||||
{
|
const queryParams = reactive({
|
||||||
date: '2025-02-17 09:40',
|
date: formatDate(new Date().getTime(), 'YYYY-MM')
|
||||||
templateItems: [
|
})
|
||||||
{ formType: 1, formTitle: '今日打电话数量(包括不接、挂、空)', value: '10' },
|
|
||||||
{ formType: 1, formTitle: '今日打出多少条有效数据(可以加微信)', value: '20' },
|
const { paging, queryList, refresh } = useZPaging(queryParams, apiSummaryLists)
|
||||||
{ formType: 1, formTitle: '家长主动加我们微信数据', value: '30' },
|
const confirmDate = (selectedDate: number) => {
|
||||||
{ formType: 1, formTitle: '有遇到什么问题', value: '无' }
|
queryParams.date = formatDate(selectedDate, 'YYYY-MM')
|
||||||
]
|
refresh(queryParams)
|
||||||
},
|
}
|
||||||
{
|
|
||||||
date: '2025-02-17 09:40',
|
|
||||||
templateItems: [
|
|
||||||
{ formType: 1, formTitle: '今日打电话数量(包括不接、挂、空)', value: '10' },
|
|
||||||
{ formType: 1, formTitle: '今日打出多少条有效数据(可以加微信)', value: '20' },
|
|
||||||
{ formType: 1, formTitle: '家长主动加我们微信数据', value: '30' },
|
|
||||||
{ formType: 1, formTitle: '有遇到什么问题', value: '无' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
])
|
|
||||||
const handleBack = () => {
|
const handleBack = () => {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}
|
}
|
||||||
const bindingDate = ref()
|
|
||||||
const bindingType = ref('')
|
const bindingType = ref('')
|
||||||
onLoad(option => {
|
onLoad(option => {
|
||||||
bindingDate.value = option?.date || Date.now()
|
|
||||||
bindingType.value = option?.type || ''
|
bindingType.value = option?.type || ''
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<w-card>
|
<w-card>
|
||||||
<template #title>
|
<template #title>
|
||||||
<text>{{ item.date }}</text>
|
<text>{{ item.addTime }}</text>
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<view class="flex flex-col gap-[16rpx]">
|
<view class="flex flex-col gap-[16rpx]">
|
||||||
<view v-for="(data, index) in item.templateItems" :key="`unique_${index}`">
|
<view v-for="(data, index) in item.templateContentList" :key="`unique_${index}`">
|
||||||
<text>{{ data.formTitle }}:</text>
|
<text>{{ data.formTitle }}:</text>
|
||||||
<text>{{ data.value }}</text>
|
<text>{{ data.value }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
@ -19,8 +19,8 @@ import { PropType } from 'vue'
|
||||||
import { ISummary } from '@/components/widgets/summary-form/summary-form.vue'
|
import { ISummary } from '@/components/widgets/summary-form/summary-form.vue'
|
||||||
|
|
||||||
export interface ISummaryCard {
|
export interface ISummaryCard {
|
||||||
date: string
|
addTime: string
|
||||||
templateItems: ISummary[]
|
templateContentList: ISummary[]
|
||||||
}
|
}
|
||||||
defineProps({
|
defineProps({
|
||||||
item: {
|
item: {
|
||||||
|
|
|
@ -30,7 +30,7 @@ const props = defineProps({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['update:bindingDate'])
|
const emit = defineEmits(['update:bindingDate', 'confirm'])
|
||||||
|
|
||||||
const maxDate = new Date().getTime()
|
const maxDate = new Date().getTime()
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ const handleTogglePicker = () => {
|
||||||
const handleConfirmDate = ({ value }) => {
|
const handleConfirmDate = ({ value }) => {
|
||||||
handleToggle()
|
handleToggle()
|
||||||
emit('update:bindingDate', value)
|
emit('update:bindingDate', value)
|
||||||
|
emit('confirm', value)
|
||||||
}
|
}
|
||||||
/**取消 */
|
/**取消 */
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
|
|
|
@ -25,7 +25,7 @@ const props = defineProps({
|
||||||
const parseDate = computed(() => dayjs(props.curDate).format('YYYY-MM'))
|
const parseDate = computed(() => dayjs(props.curDate).format('YYYY-MM'))
|
||||||
const handleMore = () => {
|
const handleMore = () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/bundle/pages/summary-list/index?date=' + props.curDate + '&type=' + props.type
|
url: '/bundle/pages/summary-list/index?type=' + props.type
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -0,0 +1,121 @@
|
||||||
|
<template>
|
||||||
|
<TContainer>
|
||||||
|
<view class="pb-[24rpx]">
|
||||||
|
<w-date-more :curDate="addTime" type="telesale" />
|
||||||
|
<date-strip
|
||||||
|
v-model="templateInfo.dateValue"
|
||||||
|
@change="handleDateChange"
|
||||||
|
height="160rpx"
|
||||||
|
/>
|
||||||
|
<w-summary-form
|
||||||
|
v-model="templateInfo.templateFormList"
|
||||||
|
:loading="loading"
|
||||||
|
@handle-confirm="handleConfirm"
|
||||||
|
/>
|
||||||
|
<view
|
||||||
|
class="px-[60rpx] mt-[48rpx]"
|
||||||
|
v-if="templateInfo.templateFormList?.length > 0 && isToday"
|
||||||
|
>
|
||||||
|
<u-button class="btn" color="#0E66FB" shape="circle" @click="handleConfirm">
|
||||||
|
确认
|
||||||
|
</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</TContainer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref } from 'vue'
|
||||||
|
import dateStrip from '@/components/date-strip/index.vue'
|
||||||
|
import { apiAddSummary, apiEditSummary, apiSummary, apiSummaryDetail } from '@/api/summary'
|
||||||
|
import cache from '@/utils/cache'
|
||||||
|
import { ROLEINDEX } from '@/enums/cacheEnums'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
import { storeToRefs } from 'pinia'
|
||||||
|
import { formatDate, toast } from '@/utils/util'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
const { userInfo } = storeToRefs(userStore)
|
||||||
|
const roles = computed(() => userInfo.value.roles)
|
||||||
|
const roleIndex = cache.get(ROLEINDEX)
|
||||||
|
const curRole = computed(() => roles.value[roleIndex])
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
const templateInfo = ref({
|
||||||
|
id: '',
|
||||||
|
dateValue: new Date().getTime(),
|
||||||
|
templateFormList: [],
|
||||||
|
isFill: 0
|
||||||
|
})
|
||||||
|
const addTime = ref(new Date().getTime())
|
||||||
|
const date = computed(
|
||||||
|
() =>
|
||||||
|
(format = 'YYYY-MM-DD') =>
|
||||||
|
formatDate(templateInfo.value.dateValue, format)
|
||||||
|
)
|
||||||
|
const isToday = computed(() => {
|
||||||
|
const today = new Date()
|
||||||
|
const selectedDate = new Date(templateInfo.value.dateValue)
|
||||||
|
return (
|
||||||
|
today.getFullYear() === selectedDate.getFullYear() &&
|
||||||
|
today.getMonth() === selectedDate.getMonth() &&
|
||||||
|
today.getDate() === selectedDate.getDate()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
const handleDateChange = item => {
|
||||||
|
templateInfo.value.dateValue = dayjs(item.key).valueOf()
|
||||||
|
isToday.value ? fetchSummaryTemplate() : fetchSummaryDetail()
|
||||||
|
}
|
||||||
|
// 提交模板(今天的模板都允许修改)
|
||||||
|
const handleConfirm = async () => {
|
||||||
|
try {
|
||||||
|
const { templateFormList, isFill, id } = templateInfo.value
|
||||||
|
const { id: postId } = curRole.value
|
||||||
|
const params = {
|
||||||
|
id,
|
||||||
|
templateFormList: templateFormList,
|
||||||
|
addTime: date.value('YYYY-MM-DD HH:mm:ss'),
|
||||||
|
postId
|
||||||
|
}
|
||||||
|
const flag = isToday.value && isFill
|
||||||
|
const api = flag ? apiEditSummary : apiAddSummary
|
||||||
|
const msg = flag ? '编辑' : '提交'
|
||||||
|
await api(params)
|
||||||
|
toast(`${msg}成功`)
|
||||||
|
fetchSummaryTemplate()
|
||||||
|
} catch (error) {}
|
||||||
|
}
|
||||||
|
// 获取模板
|
||||||
|
const fetchSummaryTemplate = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const { id: postId } = curRole.value
|
||||||
|
const result = await apiSummary({ postId })
|
||||||
|
templateInfo.value.templateFormList = result.templateFormList ?? []
|
||||||
|
templateInfo.value.isFill = result.isFill
|
||||||
|
templateInfo.value.id = result.id
|
||||||
|
} catch (error) {}
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
const fetchSummaryDetail = async () => {
|
||||||
|
try {
|
||||||
|
const { id: postId } = curRole.value
|
||||||
|
const params = {
|
||||||
|
date: date.value('YYYY-MM-DD'),
|
||||||
|
postId
|
||||||
|
}
|
||||||
|
const result = await apiSummaryDetail(params)
|
||||||
|
templateInfo.value.templateFormList = result.templateContentList ?? []
|
||||||
|
templateInfo.value.isFill = result.isFill ?? 0
|
||||||
|
} catch (error) {}
|
||||||
|
}
|
||||||
|
fetchSummaryTemplate()
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
:deep(.btn) {
|
||||||
|
button {
|
||||||
|
@apply h-[88rpx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -1,51 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<TContainer>
|
<w-summary />
|
||||||
<view class="pb-[24rpx]">
|
|
||||||
<w-date-more :curDate="curDate" type="recruitsale" />
|
|
||||||
<date-strip v-model="curDate" @change="handleDateChange" height="160rpx" />
|
|
||||||
<w-summary-form
|
|
||||||
v-model="templateItems"
|
|
||||||
@handle-confirm="handleConfirm"
|
|
||||||
:readonly="type"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
</TContainer>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts"></script>
|
||||||
import { ref } from 'vue'
|
|
||||||
import dateStrip from '@/components/date-strip/index.vue'
|
|
||||||
|
|
||||||
const templateItems = ref([
|
|
||||||
{ formType: 1, formTitle: '今日加微信数量', value: '' },
|
|
||||||
{ formType: 1, formTitle: '今日添加微信通过人数', value: '' },
|
|
||||||
{ formType: 1, formTitle: '今日和多少家长微信语音', value: '' },
|
|
||||||
{ formType: 1, formTitle: '今日有群发消息给家长', value: '' },
|
|
||||||
{ formType: 1, formTitle: '今日有群发消息给家长', value: '' },
|
|
||||||
{ formType: 1, formTitle: '学生已被统招录取多少', value: '' },
|
|
||||||
{ formType: 1, formTitle: '不想在湛江读书多少', value: '' },
|
|
||||||
{ formType: 1, formTitle: '中专类型有多少 ', value: '' },
|
|
||||||
{ formType: 1, formTitle: '340分以下有多少', value: '' },
|
|
||||||
{ formType: 1, formTitle: '340到400分有多少', value: '' },
|
|
||||||
{ formType: 1, formTitle: '400以上有多少', value: '' },
|
|
||||||
{ formType: 1, formTitle: '情况不清楚不回多少', value: '' },
|
|
||||||
{ formType: 1, formTitle: '现在总添加微信量', value: '' },
|
|
||||||
{ formType: 1, formTitle: '第二天有多少家长到校参观', value: '' },
|
|
||||||
{ formType: 1, formTitle: '本周六日有多少家长到校参观', value: '' },
|
|
||||||
{ formType: 1, formTitle: '目前加的数据有多少意向学生', value: '' },
|
|
||||||
{ formType: 1, formTitle: '本周报名目标', value: '' },
|
|
||||||
{ formType: 1, formTitle: '明天工作计划', value: '' },
|
|
||||||
{ formType: 2, formTitle: '有遇到什么问题', value: '' }
|
|
||||||
])
|
|
||||||
const handleConfirm = () => {
|
|
||||||
if (date <= curDate.value) return
|
|
||||||
console.log(templateItems.value)
|
|
||||||
}
|
|
||||||
const curDate = ref(new Date().getTime())
|
|
||||||
const type = ref('')
|
|
||||||
|
|
||||||
const handleDateChange = item => {
|
|
||||||
type.value = item.type
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<style scoped lang="scss"></style>
|
<style scoped lang="scss"></style>
|
||||||
|
|
|
@ -1,117 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<TContainer>
|
<w-summary />
|
||||||
<view class="pb-[24rpx]">
|
|
||||||
<w-date-more :curDate="addTime" type="telesale" />
|
|
||||||
<date-strip
|
|
||||||
v-model="templateInfo.dateValue"
|
|
||||||
@change="handleDateChange"
|
|
||||||
height="160rpx"
|
|
||||||
/>
|
|
||||||
<w-summary-form
|
|
||||||
v-model="templateInfo.templateFormList"
|
|
||||||
:loading="loading"
|
|
||||||
@handle-confirm="handleConfirm"
|
|
||||||
/>
|
|
||||||
<view
|
|
||||||
class="px-[60rpx] mt-[48rpx]"
|
|
||||||
v-if="templateInfo.templateFormList?.length > 0 && isToday"
|
|
||||||
>
|
|
||||||
<u-button class="btn" color="#0E66FB" shape="circle" @click="handleConfirm">
|
|
||||||
确认
|
|
||||||
</u-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</TContainer>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts"></script>
|
||||||
import { computed, ref } from 'vue'
|
<style scoped lang="scss"></style>
|
||||||
import dateStrip from '@/components/date-strip/index.vue'
|
|
||||||
import { apiAddSummary, apiEditSummary, apiSummary, apiSummaryDetail } from '@/api/summary'
|
|
||||||
import cache from '@/utils/cache'
|
|
||||||
import { ROLEINDEX } from '@/enums/cacheEnums'
|
|
||||||
import { useUserStore } from '@/stores/user'
|
|
||||||
import { storeToRefs } from 'pinia'
|
|
||||||
import { formatDate, toast } from '@/utils/util'
|
|
||||||
import dayjs from 'dayjs'
|
|
||||||
import { onMounted } from 'vue'
|
|
||||||
|
|
||||||
const userStore = useUserStore()
|
|
||||||
const { userInfo } = storeToRefs(userStore)
|
|
||||||
const roles = computed(() => userInfo.value.roles)
|
|
||||||
const loading = ref(false)
|
|
||||||
const templateInfo = ref({
|
|
||||||
id: '',
|
|
||||||
dateValue: new Date().getTime(),
|
|
||||||
templateFormList: [],
|
|
||||||
isFill: 0
|
|
||||||
})
|
|
||||||
const addTime = ref(new Date().getTime())
|
|
||||||
const date = computed(
|
|
||||||
() =>
|
|
||||||
(format = 'YYYY-MM-DD') =>
|
|
||||||
formatDate(templateInfo.value.dateValue, format)
|
|
||||||
)
|
|
||||||
const isToday = computed(() => {
|
|
||||||
const today = new Date()
|
|
||||||
const selectedDate = new Date(templateInfo.value.dateValue)
|
|
||||||
return (
|
|
||||||
today.getFullYear() === selectedDate.getFullYear() &&
|
|
||||||
today.getMonth() === selectedDate.getMonth() &&
|
|
||||||
today.getDate() === selectedDate.getDate()
|
|
||||||
)
|
|
||||||
})
|
|
||||||
const handleDateChange = item => {
|
|
||||||
templateInfo.value.dateValue = dayjs(item.key).valueOf()
|
|
||||||
isToday.value ? fetchSummaryTemplate() : fetchSummaryDetail()
|
|
||||||
}
|
|
||||||
// 提交模板(今天的模板都允许修改)
|
|
||||||
const handleConfirm = async () => {
|
|
||||||
try {
|
|
||||||
const { templateFormList, isFill, id } = templateInfo.value
|
|
||||||
const params = {
|
|
||||||
id,
|
|
||||||
templateFormList: templateFormList,
|
|
||||||
addTime: date.value('YYYY-MM-DD HH:mm:ss')
|
|
||||||
}
|
|
||||||
const flag = isToday.value && isFill
|
|
||||||
const api = flag ? apiEditSummary : apiAddSummary
|
|
||||||
const msg = flag ? '编辑' : '提交'
|
|
||||||
await api(params)
|
|
||||||
toast(`${msg}成功`)
|
|
||||||
fetchSummaryTemplate()
|
|
||||||
} catch (error) {}
|
|
||||||
}
|
|
||||||
// 获取模板
|
|
||||||
const fetchSummaryTemplate = async () => {
|
|
||||||
loading.value = true
|
|
||||||
try {
|
|
||||||
const roleIndex = cache.get(ROLEINDEX)
|
|
||||||
const curRole = roles.value[roleIndex]
|
|
||||||
const { id: postId } = curRole
|
|
||||||
const result = await apiSummary({ postId })
|
|
||||||
templateInfo.value.templateFormList = result.templateFormList ?? []
|
|
||||||
templateInfo.value.isFill = result.isFill
|
|
||||||
templateInfo.value.id = result.id
|
|
||||||
} catch (error) {}
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
const fetchSummaryDetail = async () => {
|
|
||||||
try {
|
|
||||||
const params = {
|
|
||||||
date: date.value('YYYY-MM-DD')
|
|
||||||
}
|
|
||||||
const result = await apiSummaryDetail(params)
|
|
||||||
templateInfo.value.templateFormList = result.templateContentList ?? []
|
|
||||||
templateInfo.value.isFill = result.isFill ?? 0
|
|
||||||
} catch (error) {}
|
|
||||||
}
|
|
||||||
fetchSummaryTemplate()
|
|
||||||
</script>
|
|
||||||
<style scoped lang="scss">
|
|
||||||
:deep(.btn) {
|
|
||||||
button {
|
|
||||||
@apply h-[88rpx];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
Loading…
Reference in New Issue