Compare commits
No commits in common. 'main' and 'dev-cjl' have entirely different histories.
@ -1,8 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
export const getList = async (data) => { |
||||
return await request.post({ url: '/admin-api/crm/sch-clue/clueQuality/report', data }) |
||||
} |
||||
|
||||
export const getPeriodList = async (data) => { |
||||
return await request.post({ url: '/admin-api/crm/sch-clue/clueQuality/period/report', data }) |
||||
} |
@ -1,8 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
export const getInfo = async (data) => { |
||||
return await request.post({ url: '/admin-api/crm/sch-clue/sale/report/detail', data }) |
||||
} |
||||
|
||||
export const getList = async (data) => { |
||||
return await request.post({ url: '/admin-api/crm/sch-clue/sale/report', data }) |
||||
} |
@ -1,8 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
export const getInfo = async (data) => { |
||||
return await request.post({ url: '/admin-api/crm/sch-clue/signData/report/one', data }) |
||||
} |
||||
|
||||
export const getList = async (data) => { |
||||
return await request.post({ url: '/admin-api/crm/sch-clue/signData/report/two', data }) |
||||
} |
@ -1,4 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
export const getList = async (data) => { |
||||
return await request.post({ url: '/admin-api/crm/sch-clue/signRate/report', data }) |
||||
} |
@ -1,33 +0,0 @@ |
||||
import request from '@/config/axios' |
||||
// 查询列表
|
||||
export const getSupplierPage = async (params) => { |
||||
return await request.get({ url: '/admin-api/crm/erp-supplier/page', params }) |
||||
} |
||||
|
||||
export const getSupplierSimpleList = async (params) => { |
||||
return await request.get({ url: '/admin-api/crm/erp-supplier/simple-list', params }) |
||||
} |
||||
|
||||
// 查询详情
|
||||
export const getSupplier = async (id) => { |
||||
return await request.get({ url: '/admin-api/crm/erp-supplier/get?id=' + id }) |
||||
} |
||||
|
||||
// 新增
|
||||
export const createSupplier = async (data) => { |
||||
return await request.post({ |
||||
url: '/admin-api/crm/erp-supplier/create', |
||||
data: data, |
||||
isSubmitForm: true |
||||
}) |
||||
} |
||||
|
||||
// 修改
|
||||
export const updateSupplier = async (params) => { |
||||
return await request.put({ url: '/admin-api/crm/erp-supplier/update', data: params }) |
||||
} |
||||
|
||||
// 删除
|
||||
export const deleteSupplier = async (id) => { |
||||
return await request.delete({ url: '/admin-api/crm/erp-supplier/delete?id=' + id }) |
||||
} |
@ -1,130 +0,0 @@ |
||||
<template> |
||||
<Dialog title="添加产品" v-model="show" width="800px"> |
||||
<el-form :model="form" ref="formRef" :rules="rules" label-width="80px"> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="12" :offset="0"> |
||||
<el-form-item label="成交产品" prop="productId"> |
||||
<el-select |
||||
v-model="form.productId" |
||||
placeholder="选择成交产品" |
||||
filterable |
||||
@change="form.specsId = undefined" |
||||
> |
||||
<el-option |
||||
v-for="item in prodOptions" |
||||
:key="item.productId" |
||||
:label="item.productName" |
||||
:value="item.productId" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12" :offset="0"> |
||||
<el-form-item label="产品规格" prop="specsId"> |
||||
<el-select |
||||
v-model="form.specsId" |
||||
placeholder="选择规格" |
||||
filterable |
||||
:disabled="!form.productId" |
||||
> |
||||
<el-option |
||||
v-for="item in specsOptions(form.productId)" |
||||
:key="item.specsId" |
||||
:label="item.specsName" |
||||
:value="item.specsId" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12" :offset="0"> |
||||
<el-form-item label="成交数量" prop="signNum"> |
||||
<el-input-number v-model="form.signNum" :min="1" :controls="false" /> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="12" :offset="0"> |
||||
<el-form-item label="生产状态" prop="isProduced"> |
||||
<el-radio-group v-model="form.isProduced"> |
||||
<el-radio :label="0">待生产</el-radio> |
||||
<el-radio :label="1">已生产</el-radio> |
||||
</el-radio-group> |
||||
</el-form-item> |
||||
</el-col> |
||||
<el-col :span="24" :offset="0"> |
||||
<el-form-item label="备注" prop="remark"> |
||||
<el-input |
||||
type="textarea" |
||||
:autoSize="{ minRows: 3 }" |
||||
v-model="form.remark" |
||||
placeholder="请输入备注" |
||||
/> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form> |
||||
<template #footer> |
||||
<span> |
||||
<el-button @click="show = false">取 消</el-button> |
||||
<el-button :disabled="formLoading" type="primary" @click="handleSave">保 存</el-button> |
||||
</span> |
||||
</template> |
||||
</Dialog> |
||||
</template> |
||||
|
||||
<script setup name="DialogProduct"> |
||||
import { addOrderProduct } from '@/api/clue/sign' |
||||
|
||||
const message = useMessage() // 消息弹窗 |
||||
|
||||
const specsOptions = computed({ |
||||
get() { |
||||
return (prodId) => { |
||||
if (prodId) { |
||||
return prodOptions.value.find((it) => it.productId == prodId).productSpecList |
||||
} |
||||
return [] |
||||
} |
||||
} |
||||
}) |
||||
|
||||
const show = ref(false) |
||||
const form = ref({}) |
||||
const rules = { |
||||
productId: { required: true, message: '成交产品不可为空', trigger: 'change' }, |
||||
specsId: { required: true, message: '产品规格不可为空', trigger: 'change' }, |
||||
signNum: { required: true, message: '成交数量不可为空', trigger: 'blur' } |
||||
} |
||||
|
||||
const prodOptions = ref([]) |
||||
|
||||
function open(signId, arr) { |
||||
prodOptions.value = arr |
||||
form.value.signId = signId |
||||
form.value.isProduced = 0 |
||||
show.value = true |
||||
} |
||||
defineExpose({ open }) |
||||
|
||||
const emit = defineEmits(['success']) |
||||
const formRef = ref() |
||||
const formLoading = ref(false) |
||||
async function handleSave() { |
||||
// 校验表单 |
||||
if (!formRef.value) return |
||||
const valid = await formRef.value.validate() |
||||
if (!valid) return |
||||
|
||||
// 提交请求 |
||||
formLoading.value = true |
||||
try { |
||||
await addOrderProduct(form.value) |
||||
message.success('新增成功!') |
||||
show.value = false |
||||
// 发送操作成功的事件 |
||||
emit('success') |
||||
} finally { |
||||
formLoading.value = false |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,35 +0,0 @@ |
||||
<template> |
||||
<div> |
||||
<el-tabs v-model="tabName" type="border-card" tab-position="top"> |
||||
<el-tab-pane label="月度统计" name="monthly"> |
||||
<ChannelMonthly :sourceOptions="sourceOptions" /> |
||||
</el-tab-pane> |
||||
<el-tab-pane label="周期统计" name="period"> |
||||
<ChannelPeriod :sourceOptions="sourceOptions" /> |
||||
</el-tab-pane> |
||||
</el-tabs> |
||||
</div> |
||||
</template> |
||||
|
||||
<script setup name="ChannelReport"> |
||||
import ChannelMonthly from './Comp/ChannelMonthly.vue' |
||||
import ChannelPeriod from './Comp/ChannelPeriod.vue' |
||||
import { getSimpleSourceList } from '@/api/clue/source' |
||||
import { handleTree } from '@/utils/tree' |
||||
|
||||
const tabName = ref('monthly') |
||||
|
||||
onMounted(() => { |
||||
getOptions() |
||||
}) |
||||
|
||||
const sourceOptions = ref([]) |
||||
|
||||
function getOptions() { |
||||
getSimpleSourceList().then((data) => { |
||||
sourceOptions.value = handleTree(data, 'sourceId') |
||||
}) |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,112 +1,7 @@ |
||||
<template> |
||||
<div> |
||||
<ContentWrap> |
||||
<el-form :model="searchForm" label-width="0" inline> |
||||
<el-form-item> |
||||
<el-date-picker |
||||
v-model="searchForm.year" |
||||
type="year" |
||||
format="YYYY" |
||||
value-format="YYYY" |
||||
placeholder="选择年" |
||||
:clearable="false" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-input v-model="searchForm.nickname" placeholder="销售姓名" clearable /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button @click="handleSearch">查询</el-button> |
||||
<el-button @click="handleReset">重置</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
|
||||
<el-table v-loading="loading" :data="tableList" border stripe> |
||||
<el-table-column type="index" width="50" fixed="left" /> |
||||
<el-table-column prop="nickname" label="姓名" width="80" fixed="left" /> |
||||
<el-table-column |
||||
v-for="(item, index) in new Date().getMonth() + 1" |
||||
:key="index" |
||||
:label="item + '月'" |
||||
sortable |
||||
min-width="150" |
||||
:sort-method="(pre, cur) => monthSort(pre, cur, index)" |
||||
> |
||||
<template #default="{ row }"> |
||||
<span>{{ (row.monthClueSignRateReportList[index].rate * 100).toFixed(2) }}%</span> |
||||
<span>({{ row.monthClueSignRateReportList[index].clueSignNum }}/</span> |
||||
<span>{{ row.monthClueSignRateReportList[index].followClueNum }})</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column |
||||
label="总成交率" |
||||
prop="totalRate" |
||||
min-width="150" |
||||
fixed="right" |
||||
sortable |
||||
:sort-method="totalSort" |
||||
/> |
||||
</el-table> |
||||
</ContentWrap> |
||||
</div> |
||||
<div> 成交率 </div> |
||||
</template> |
||||
|
||||
<script setup name="CloseRate"> |
||||
import * as reportApi from '@/api/home/reportSignRate' |
||||
import { removeNullField } from '@/utils' |
||||
|
||||
onMounted(() => { |
||||
handleReset() |
||||
handleSearch() |
||||
}) |
||||
|
||||
const searchForm = ref({}) |
||||
|
||||
function handleReset() { |
||||
searchForm.value = { |
||||
nickname: undefined, |
||||
year: new Date().getFullYear() + '' |
||||
} |
||||
} |
||||
|
||||
const loading = ref(false) |
||||
const tableList = ref([]) |
||||
async function handleSearch() { |
||||
loading.value = true |
||||
try { |
||||
const data = await reportApi.getList(removeNullField(searchForm.value)) |
||||
tableList.value = data.map((item) => { |
||||
const count = item.monthClueSignRateReportList.reduce( |
||||
(pre, cur) => { |
||||
return { |
||||
signCount: pre.signCount + cur.clueSignNum, |
||||
clueCount: pre.clueCount + cur.followClueNum |
||||
} |
||||
}, |
||||
{ signCount: 0, clueCount: 0 } |
||||
) |
||||
const rate = count.clueCount > 0 ? ((count.signCount * 100) / count.clueCount).toFixed(2) : 0 |
||||
return { |
||||
...item, |
||||
totalRate: `${rate}%(${count.signCount}/${count.clueCount})`, |
||||
totalRateNum: rate |
||||
} |
||||
}) |
||||
} finally { |
||||
loading.value = false |
||||
} |
||||
} |
||||
|
||||
function totalSort(pre, cur) { |
||||
return Number(pre.totalRateNum) - Number(cur.totalRateNum) |
||||
} |
||||
|
||||
function monthSort(pre, cur, idx) { |
||||
return ( |
||||
Number(pre.monthClueSignRateReportList[idx].rate) - |
||||
Number(cur.monthClueSignRateReportList[idx].rate) |
||||
) |
||||
} |
||||
</script> |
||||
<script setup name="CloseRate"></script> |
||||
|
||||
<style lang="scss" scoped></style> |
||||
|
@ -1,62 +0,0 @@ |
||||
<template> |
||||
<Echart :options="optionsData" :width="400" :height="200" /> |
||||
</template> |
||||
|
||||
<script setup name="BarSalerClueReport"> |
||||
import { set } from 'lodash-es' |
||||
|
||||
onMounted(() => { |
||||
nextTick(() => { |
||||
getReportData() |
||||
}) |
||||
}) |
||||
|
||||
const optionsData = ref({}) |
||||
|
||||
const getReportData = async () => { |
||||
// const data = await HomeApi.getClueSignSignRate() |
||||
set(optionsData, 'radiusAxis', { |
||||
type: 'category', |
||||
data: ['宝典', '一点通', '抖音', '小红书'], |
||||
z: 10 |
||||
}) |
||||
set(optionsData, 'series', [ |
||||
{ |
||||
type: 'bar', |
||||
data: [1, 2, 3, 4], |
||||
coordinateSystem: 'polar', |
||||
name: '高意向A', |
||||
stack: 'a', |
||||
emphasis: { |
||||
focus: 'series' |
||||
} |
||||
}, |
||||
{ |
||||
type: 'bar', |
||||
data: [2, 4, 6, 8], |
||||
coordinateSystem: 'polar', |
||||
name: '中意向B', |
||||
stack: 'a', |
||||
emphasis: { |
||||
focus: 'series' |
||||
} |
||||
}, |
||||
{ |
||||
type: 'bar', |
||||
data: [1, 2, 3, 4], |
||||
coordinateSystem: 'polar', |
||||
name: '低意向C', |
||||
stack: 'a', |
||||
emphasis: { |
||||
focus: 'series' |
||||
} |
||||
} |
||||
]) |
||||
} |
||||
|
||||
defineExpose({ |
||||
getReportData |
||||
}) |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,147 +0,0 @@ |
||||
<template> |
||||
<ContentWrap> |
||||
<el-form :model="searchForm" label-width="0" inline> |
||||
<el-form-item> |
||||
<el-date-picker |
||||
v-model="searchForm.period" |
||||
type="month" |
||||
format="YYYY-MM" |
||||
value-format="YYYY-MM" |
||||
placeholder="选择年月" |
||||
:clearable="false" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-tree-select |
||||
v-model="searchForm.sourceId" |
||||
:data="props.sourceOptions" |
||||
:props="defaultProps" |
||||
check-strictly |
||||
node-key="sourceId" |
||||
placeholder="请选择渠道" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button @click="handleSearch">查询</el-button> |
||||
<el-button @click="handleReset">重置</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
|
||||
<el-table |
||||
v-loading="loading" |
||||
:data="tableList" |
||||
border |
||||
stripe |
||||
:summary-method="getSummaries" |
||||
show-summary |
||||
> |
||||
<el-table-column prop="sourceName" label="渠道名称" /> |
||||
<el-table-column prop="newClueSignNum" label="新线索当月成交数" sortable> |
||||
<template #header> |
||||
<Tooltip message="当月咨询且当月成交的线索数" /> <span>新线索当月成交数</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="newClueNum" label="新线索总数" sortable> |
||||
<template #header> |
||||
<Tooltip message="当月咨询的线索数" /> <span>新线索总数</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="rate" label="新线索当月成交率" sortable :formatter="parseRate" /> |
||||
<el-table-column prop="reallyClueSignNum" sortable> |
||||
<template #header> |
||||
<Tooltip message="成交日期在本月的线索数" /> <span>当月总成交数</span> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</ContentWrap> |
||||
</template> |
||||
|
||||
<script setup name="ChannelMonthly"> |
||||
import * as reportApi from '@/api/home/reportChannel' |
||||
import { removeNullField } from '@/utils' |
||||
import { formatDate } from '@/utils/formatTime' |
||||
|
||||
const props = defineProps({ |
||||
sourceOptions: { |
||||
type: Array, |
||||
default: () => [] |
||||
} |
||||
}) |
||||
|
||||
const defaultProps = { |
||||
children: 'children', |
||||
label: 'sourceName', |
||||
value: 'sourceId', |
||||
isLeaf: 'leaf' |
||||
} |
||||
|
||||
onMounted(() => { |
||||
getOptions() |
||||
handleReset() |
||||
handleSearch() |
||||
}) |
||||
|
||||
const searchForm = ref({}) |
||||
|
||||
function handleReset() { |
||||
searchForm.value = { |
||||
sourceId: undefined, |
||||
period: formatDate(new Date(), 'YYYY-MM') |
||||
} |
||||
} |
||||
|
||||
function getOptions() {} |
||||
|
||||
const loading = ref(false) |
||||
const tableList = ref([]) |
||||
async function handleSearch() { |
||||
loading.value = true |
||||
try { |
||||
const data = await reportApi.getList(removeNullField(searchForm.value)) |
||||
tableList.value = data |
||||
} finally { |
||||
loading.value = false |
||||
} |
||||
} |
||||
|
||||
function parseRate(row) { |
||||
return Number(row.rate * 100).toFixed(2) + '%' |
||||
} |
||||
|
||||
function getSummaries({ columns, data }) { |
||||
let sums = [] |
||||
columns.forEach((column, index) => { |
||||
if (index == 0) { |
||||
sums[index] = '合计' |
||||
return |
||||
} |
||||
const values = data.map((item) => Number(item[column.property])) |
||||
if (!values.every((value) => Number.isNaN(value))) { |
||||
if (column.property == 'rate') { |
||||
const sum = data.reduce( |
||||
(pre, cur) => ({ |
||||
clueNum: pre.clueNum + cur.newClueNum, |
||||
signNum: pre.signNum + cur.newClueSignNum |
||||
}), |
||||
{ clueNum: 0, signNum: 0 } |
||||
) |
||||
sums[index] = sum.clueNum > 0 ? ((sum.signNum * 100) / sum.clueNum).toFixed(2) + '%' : 0 |
||||
} else { |
||||
sums[index] = values.reduce((prev, curr) => { |
||||
const value = Number(curr) |
||||
if (!Number.isNaN(value)) { |
||||
return prev + curr |
||||
} else { |
||||
return prev |
||||
} |
||||
}, 0) |
||||
} |
||||
} else { |
||||
sums[index] = '' |
||||
} |
||||
}) |
||||
return sums |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,169 +0,0 @@ |
||||
<template> |
||||
<ContentWrap> |
||||
<el-form ref="searchRef" :model="searchForm" :rules="searchRules" label-width="100px" inline> |
||||
<el-form-item label="咨询日期" prop="consultDate"> |
||||
<el-date-picker |
||||
v-model="searchForm.consultDate" |
||||
type="daterange" |
||||
format="YYYY-MM-DD" |
||||
value-format="YYYY-MM-DD" |
||||
start-placeholder="选择日期" |
||||
end-placeholder="选择日期" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item label="成交周期" prop="periodNumber"> |
||||
<el-input-number |
||||
v-model="searchForm.periodNumber" |
||||
:min="1" |
||||
:controls="false" |
||||
style="width: 100%" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item label="渠道来源" prop="sourceId"> |
||||
<el-tree-select |
||||
v-model="searchForm.sourceId" |
||||
:data="props.sourceOptions" |
||||
:props="defaultProps" |
||||
check-strictly |
||||
node-key="sourceId" |
||||
placeholder="请选择渠道" |
||||
style="width: 100%" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button @click="handleSearch">查询</el-button> |
||||
<el-button @click="handleReset">重置</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
|
||||
<el-table |
||||
v-loading="loading" |
||||
:data="tableList" |
||||
border |
||||
stripe |
||||
:summary-method="getSummaries" |
||||
show-summary |
||||
> |
||||
<el-table-column prop="sourceName" label="渠道名称" /> |
||||
<el-table-column prop="newClueSignNum" label="新线索成交数" sortable> |
||||
<template #header> |
||||
<Tooltip message="咨询日期在查询范围内,且在所查成交周期内成交的线索数" /> |
||||
<span>新线索成交数</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="newClueNum" label="新线索总数" sortable> |
||||
<template #header> |
||||
<Tooltip message="咨询日期在查询范围内,咨询的线索数" /> <span>新线索总数</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="rate" label="新线索成交率" sortable :formatter="parseRate" /> |
||||
</el-table> |
||||
</ContentWrap> |
||||
</template> |
||||
|
||||
<script setup name="ChannelPeriod"> |
||||
import { getPeriodList } from '@/api/home/reportChannel' |
||||
import { removeNullField } from '@/utils' |
||||
import { formatDate } from '@/utils/formatTime' |
||||
|
||||
const props = defineProps({ |
||||
sourceOptions: { |
||||
type: Array, |
||||
default: () => [] |
||||
} |
||||
}) |
||||
|
||||
const defaultProps = { |
||||
children: 'children', |
||||
label: 'sourceName', |
||||
value: 'sourceId', |
||||
isLeaf: 'leaf' |
||||
} |
||||
|
||||
const searchRef = ref() |
||||
|
||||
const searchRules = { |
||||
// consultDate: { required: true, type: 'array', message: '请选择咨询日期', trigger: 'change,blur' }, |
||||
periodNumber: { required: true, message: '请输入成交周期', trigger: 'blur' } |
||||
} |
||||
|
||||
onMounted(() => { |
||||
getOptions() |
||||
handleReset() |
||||
handleSearch() |
||||
}) |
||||
|
||||
const searchForm = ref({}) |
||||
|
||||
function handleReset() { |
||||
const date = new Date() |
||||
date.setDate(1) |
||||
searchForm.value = { |
||||
sourceId: undefined, |
||||
periodNumber: 30, |
||||
consultDate: [formatDate(date), formatDate(new Date())] |
||||
} |
||||
} |
||||
|
||||
function getOptions() {} |
||||
|
||||
const loading = ref(false) |
||||
const tableList = ref([]) |
||||
async function handleSearch() { |
||||
try { |
||||
const valid = await searchRef.value.validate() |
||||
if (!valid) return |
||||
loading.value = true |
||||
const params = { ...searchForm.value } |
||||
if (params.consultDate && params.consultDate.length) { |
||||
params.startDateTime = params.consultDate[0] |
||||
params.endDateTime = params.consultDate[1] |
||||
} |
||||
const data = await getPeriodList(removeNullField(params)) |
||||
tableList.value = data |
||||
} finally { |
||||
loading.value = false |
||||
} |
||||
} |
||||
|
||||
function parseRate(row) { |
||||
return Number(row.rate * 100).toFixed(2) + '%' |
||||
} |
||||
|
||||
function getSummaries({ columns, data }) { |
||||
let sums = [] |
||||
columns.forEach((column, index) => { |
||||
if (index == 0) { |
||||
sums[index] = '合计' |
||||
return |
||||
} |
||||
const values = data.map((item) => Number(item[column.property])) |
||||
if (!values.every((value) => Number.isNaN(value))) { |
||||
if (column.property == 'rate') { |
||||
const sum = data.reduce( |
||||
(pre, cur) => ({ |
||||
clueNum: pre.clueNum + cur.newClueNum, |
||||
signNum: pre.signNum + cur.newClueSignNum |
||||
}), |
||||
{ clueNum: 0, signNum: 0 } |
||||
) |
||||
sums[index] = sum.clueNum > 0 ? ((sum.signNum * 100) / sum.clueNum).toFixed(2) + '%' : 0 |
||||
} else { |
||||
sums[index] = values.reduce((prev, curr) => { |
||||
const value = Number(curr) |
||||
if (!Number.isNaN(value)) { |
||||
return prev + curr |
||||
} else { |
||||
return prev |
||||
} |
||||
}, 0) |
||||
} |
||||
} else { |
||||
sums[index] = '' |
||||
} |
||||
}) |
||||
return sums |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,402 +0,0 @@ |
||||
<template> |
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1000px"> |
||||
<el-form :model="searchForm" label-width="0" inline> |
||||
<el-form-item> |
||||
<el-date-picker |
||||
v-model="searchForm.consultTime" |
||||
type="daterange" |
||||
format="YYYY-MM-DD" |
||||
value-format="YYYY-MM-DD" |
||||
start-placeholder="选择日期" |
||||
end-placeholder="选择日期" |
||||
:clearable="false" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-tree-select |
||||
v-model="searchForm.sourceId" |
||||
:data="props.sourceOptions" |
||||
:props="defaultProps" |
||||
check-strictly |
||||
clearable |
||||
filterable |
||||
node-key="sourceId" |
||||
placeholder="请选择渠道" |
||||
@change="sourceChange" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item v-if="appStore.getAppInfo?.instanceType == 1"> |
||||
<el-select |
||||
v-model="searchForm.licenseTypeList" |
||||
placeholder="选择驾照类型" |
||||
clearable |
||||
multiple |
||||
> |
||||
<el-option |
||||
v-for="item in props.licenseTypeOptions" |
||||
:key="item.label" |
||||
:label="item.label" |
||||
:value="item.label" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
|
||||
<el-form-item> |
||||
<el-button @click="handleSearch">查询</el-button> |
||||
<el-button @click="handleReset">重置</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
|
||||
<el-tabs v-model="showPane" class="pb-10px"> |
||||
<el-tab-pane label="详细数据" :name="1"> |
||||
<el-table v-loading="loading" :data="tableList" border stripe> |
||||
<el-table-column prop="sourceName" label="渠道名称" width="100" fixed="left" /> |
||||
<el-table-column prop="newClueNumber" label="新线索数" sortable min-width="100" /> |
||||
<el-table-column prop="signNumber" label="成交数" sortable min-width="100" /> |
||||
<el-table-column |
||||
prop="signRate" |
||||
label="成交率" |
||||
sortable |
||||
min-width="100" |
||||
:formatter="(row) => row.signRate + '%'" |
||||
/> |
||||
<el-table-column prop="averageSignPeriod" label="成交周期" sortable min-width="100" /> |
||||
<el-table-column |
||||
prop="grossProfitOfSingleSign" |
||||
label="毛利/单" |
||||
sortable |
||||
min-width="100" |
||||
/> |
||||
<el-table-column prop="payPriceOfSingleSign" label="支出/单" sortable min-width="100" /> |
||||
<el-table-column prop="costOfSingleClue" label="线索成本/条" sortable min-width="100" /> |
||||
<el-table-column |
||||
prop="netProfitOfSingleSign" |
||||
label="净利润/单" |
||||
sortable |
||||
min-width="100" |
||||
/> |
||||
<el-table-column label="总线索成本" prop="clueCostTotal" sortable min-width="100" /> |
||||
<el-table-column label="总支出" prop="payPriceTotal" sortable min-width="100" /> |
||||
<el-table-column label="总利润" prop="profitTotal" sortable min-width="100" /> |
||||
</el-table> |
||||
</el-tab-pane> |
||||
<el-tab-pane label="图表展示" :name="2" lazy> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="24" :offset="0"> |
||||
<el-checkbox-group v-model="showChannel" @change="setReportData"> |
||||
<el-checkbox v-for="(item, index) in channelArr" :key="index" :label="item" /> |
||||
</el-checkbox-group> |
||||
</el-col> |
||||
|
||||
<el-col :span="12" :offset="0"> |
||||
<el-skeleton :loading="loading" animated> |
||||
<Echart :options="echart1Option" width="100%" :height="400" /> |
||||
</el-skeleton> |
||||
</el-col> |
||||
<el-col :span="12" :offset="0" v-if="appStore.getAppInfo?.instanceType == 1"> |
||||
<Echart :options="echart2Option" width="100%" :height="400" /> |
||||
</el-col> |
||||
<el-col :span="24" :offset="0"> |
||||
<Echart :options="echart3Option" width="100%" :height="400" /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-tab-pane> |
||||
</el-tabs> |
||||
</Dialog> |
||||
</template> |
||||
|
||||
<script setup name="DialogSalerReportDetail"> |
||||
import { set } from 'lodash-es' |
||||
import * as reportApi from '@/api/home/reportSaler' |
||||
import { getIntDictOptions } from '@/utils/dict' |
||||
import { removeNullField } from '@/utils' |
||||
import { useAppStore } from '@/store/modules/app' |
||||
import { formatDate } from '@/utils/formatTime' |
||||
|
||||
const appStore = useAppStore() |
||||
|
||||
const props = defineProps({ |
||||
licenseTypeOptions: { |
||||
type: Array, |
||||
default: () => [] |
||||
}, |
||||
sourceOptions: { |
||||
type: Array, |
||||
default: () => [] |
||||
} |
||||
}) |
||||
|
||||
const defaultProps = { |
||||
children: 'children', |
||||
label: 'sourceName', |
||||
value: 'sourceId', |
||||
isLeaf: 'leaf' |
||||
} |
||||
|
||||
const showChannel = ref([]) |
||||
const intentionOptions = getIntDictOptions('intention_state') |
||||
|
||||
const channelArr = computed(() => { |
||||
if (searchForm.value.sourceId) { |
||||
let arr = |
||||
props.sourceOptions.find((it) => it.sourceId == searchForm.value.sourceId)?.children || [] |
||||
return arr.map((it) => it.sourceName) |
||||
} else { |
||||
return props.sourceOptions.map((it) => it.sourceName) |
||||
} |
||||
}) |
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示 |
||||
const dialogTitle = ref('') // 弹窗的标题 |
||||
const loading = ref(false) |
||||
const searchForm = ref({}) |
||||
|
||||
const showPane = ref(1) |
||||
|
||||
function handleReset() { |
||||
searchForm.value = { |
||||
nickname: undefined, |
||||
consultTime: [`${year}-${month}-01`, formatDate(new Date())], |
||||
licenseTypeList: [], |
||||
sourceId: undefined |
||||
} |
||||
} |
||||
|
||||
/** 打开弹窗 */ |
||||
const open = async (info, queryInfo) => { |
||||
showPane.value = 1 |
||||
dialogVisible.value = true |
||||
dialogTitle.value = info.nickname |
||||
searchForm.value = { ...queryInfo } |
||||
searchForm.value.userId = info.userId |
||||
|
||||
sourceChange() |
||||
} |
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
||||
|
||||
const tableList = ref([]) |
||||
|
||||
async function handleSearch() { |
||||
loading.value = true |
||||
try { |
||||
const params = { ...searchForm.value } |
||||
const data = await reportApi.getInfo(removeNullField(params)) |
||||
tableList.value = data.sourceDetailVOList |
||||
setReportData(data) |
||||
} finally { |
||||
loading.value = false |
||||
} |
||||
} |
||||
|
||||
function sourceChange() { |
||||
handleSearch() |
||||
showChannel.value = channelArr.value |
||||
} |
||||
|
||||
const echart1Option = ref({ |
||||
title: { |
||||
text: '线索分布图' |
||||
}, |
||||
radiusAxis: {}, |
||||
angleAxis: {}, |
||||
tooltip: { |
||||
show: true, |
||||
formatter: '{b0}-{a}: {c}' |
||||
}, |
||||
polar: {}, |
||||
legend: { |
||||
show: true, |
||||
type: 'scroll', |
||||
left: 100 |
||||
} |
||||
}) |
||||
|
||||
const echart2Option = ref({ |
||||
title: { |
||||
text: '成交分布图' |
||||
}, |
||||
radiusAxis: {}, |
||||
angleAxis: {}, |
||||
tooltip: { |
||||
show: true, |
||||
formatter: '{b0}-{a}: {c}' |
||||
}, |
||||
polar: {}, |
||||
legend: { |
||||
show: true, |
||||
type: 'scroll', |
||||
left: 100 |
||||
} |
||||
}) |
||||
|
||||
const echart3Option = ref({ |
||||
title: { |
||||
text: '销售雷达图' |
||||
}, |
||||
radar: { |
||||
indicator: [ |
||||
{ name: '成交周期' }, |
||||
{ name: '毛利/单' }, |
||||
{ name: '支出/单' }, |
||||
{ name: '线索成本/条' }, |
||||
{ name: '净利润/单' }, |
||||
{ name: '成交率' } |
||||
// { name: '线索总成本' }, |
||||
// { name: '总支出' }, |
||||
// { name: '总利润' } |
||||
] |
||||
}, |
||||
legend: { |
||||
show: true, |
||||
right: '10px', |
||||
orient: 'vertical' |
||||
} |
||||
}) |
||||
|
||||
const setReportData = async (data) => { |
||||
// const data = await HomeApi.getClueSignSignRate() |
||||
|
||||
const channelClueArr = showChannel.value.sort((pre, cur) => { |
||||
const preArr = tableList.value.find((it) => it.sourceName == pre).clueIntentionNumVOList || [] |
||||
const curArr = tableList.value.find((it) => it.sourceName == cur).clueIntentionNumVOList || [] |
||||
const preCount = preArr.reduce((preVal, curVal) => preVal + curVal.intentionNum, 0) |
||||
const curCount = curArr.reduce((preVal, curVal) => preVal + curVal.intentionNum, 0) |
||||
return preCount - curCount |
||||
}) |
||||
|
||||
const arr1 = intentionOptions.map((intention) => { |
||||
const list = [] |
||||
channelClueArr.map((item) => { |
||||
const row = tableList.value.find((it) => item == it.sourceName) |
||||
if (row) { |
||||
list.push( |
||||
row.clueIntentionNumVOList.find((it) => it.intentionState == intention.value).intentionNum |
||||
) |
||||
} |
||||
}) |
||||
return { |
||||
type: 'bar', |
||||
data: list, |
||||
coordinateSystem: 'polar', |
||||
name: intention.label, |
||||
stack: 'a', |
||||
emphasis: { |
||||
focus: 'series' |
||||
}, |
||||
label: { |
||||
show: true, |
||||
position: 'middle' |
||||
} |
||||
} |
||||
}) |
||||
|
||||
const channelSignArr = showChannel.value.sort((pre, cur) => { |
||||
const preArr = tableList.value.find((it) => it.sourceName == pre).signLicenseTypeNumVOList || [] |
||||
const curArr = tableList.value.find((it) => it.sourceName == cur).signLicenseTypeNumVOList || [] |
||||
const preCount = preArr.reduce((preVal, curVal) => preVal + curVal.licenseTypeNum, 0) |
||||
const curCount = curArr.reduce((preVal, curVal) => preVal + curVal.licenseTypeNum, 0) |
||||
return preCount - curCount |
||||
}) |
||||
const arr2 = props.licenseTypeOptions.map((cartype) => { |
||||
const list = [] |
||||
channelClueArr.map((item) => { |
||||
const row = tableList.value.find((it) => item == it.sourceName) |
||||
if (row) { |
||||
list.push( |
||||
row.signLicenseTypeNumVOList.find((it) => it.licenseType == cartype.label).licenseTypeNum |
||||
) |
||||
} |
||||
}) |
||||
return { |
||||
type: 'bar', |
||||
data: list, |
||||
coordinateSystem: 'polar', |
||||
name: cartype.label, |
||||
stack: 'a', |
||||
emphasis: { |
||||
focus: 'series' |
||||
}, |
||||
label: { |
||||
show: true, |
||||
position: 'middle' |
||||
} |
||||
} |
||||
}) |
||||
|
||||
set(echart1Option.value, 'radiusAxis', { |
||||
type: 'category', |
||||
data: channelClueArr, |
||||
axisLabel: { |
||||
margin: 5, |
||||
fontSize: 10, |
||||
interval: 0 |
||||
} |
||||
}) |
||||
|
||||
set(echart1Option.value, 'series', arr1) |
||||
|
||||
set(echart2Option.value, 'radiusAxis', { |
||||
type: 'category', |
||||
data: channelSignArr, |
||||
axisLabel: { |
||||
margin: 5, |
||||
fontSize: 10, |
||||
interval: 0 |
||||
} |
||||
}) |
||||
set(echart2Option.value, 'series', arr2) |
||||
const { personDetail, averageDetail } = data |
||||
set(echart3Option.value, 'series', [ |
||||
{ |
||||
type: 'radar', |
||||
data: [ |
||||
{ |
||||
value: [ |
||||
averageDetail.averageSignPeriod, |
||||
averageDetail.grossProfitOfSingleSign, |
||||
averageDetail.payPriceOfSingleSign, |
||||
averageDetail.costOfSingleClue, |
||||
averageDetail.netProfitOfSingleSign, |
||||
averageDetail.signRate |
||||
// averageDetail.clueCostTotal, |
||||
// averageDetail.payPriceTotal, |
||||
// averageDetail.profitTotal |
||||
], |
||||
name: '平均水平', |
||||
lineStyle: { |
||||
type: 'dashed' |
||||
}, |
||||
areaStyle: { |
||||
color: 'rgba(0, 191, 255, 0.6)' |
||||
}, |
||||
label: { |
||||
show: true |
||||
} |
||||
}, |
||||
{ |
||||
value: [ |
||||
personDetail.averageSignPeriod, |
||||
personDetail.grossProfitOfSingleSign, |
||||
personDetail.payPriceOfSingleSign, |
||||
personDetail.costOfSingleClue, |
||||
personDetail.netProfitOfSingleSign, |
||||
personDetail.signRate |
||||
// personDetail.clueCostTotal, |
||||
// personDetail.payPriceTotal, |
||||
// personDetail.profitTotal |
||||
], |
||||
name: dialogTitle.value, |
||||
areaStyle: { |
||||
color: 'rgba(255, 145, 124, 0.4)' |
||||
}, |
||||
label: { |
||||
show: true |
||||
} |
||||
} |
||||
] |
||||
} |
||||
]) |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,162 +0,0 @@ |
||||
<template> |
||||
<ContentWrap> |
||||
<el-form :model="searchForm" label-width="0" inline> |
||||
<el-form-item> |
||||
<el-select v-model="searchForm.detailType" :clearable="false" filterable> |
||||
<el-option |
||||
v-for="item in detailTypeOptions" |
||||
:key="item.value" |
||||
:label="item.label" |
||||
:value="item.value" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item v-if="searchForm.detailType == 1"> |
||||
<el-date-picker |
||||
v-model="searchForm.month" |
||||
type="month" |
||||
format="YYYY-MM" |
||||
value-format="YYYY-MM" |
||||
placeholder="选择年月" |
||||
:clearable="false" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item v-if="[2, 3].includes(searchForm.detailType)"> |
||||
<el-date-picker |
||||
v-model="searchForm.year" |
||||
type="year" |
||||
format="YYYY" |
||||
value-format="YYYY" |
||||
placeholder="选择年" |
||||
:clearable="false" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button @click="handleSearch">查询</el-button> |
||||
<el-button @click="handleReset">重置</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
<el-table :data="tableList" border stripe show-summary :summary-method="getSummaries"> |
||||
<el-table-column label="周期" prop="period" width="110px" /> |
||||
<el-table-column label="成交" align="center"> |
||||
<el-table-column prop="signNumber" label="成交数" /> |
||||
<el-table-column prop="signPrice" label="成交额" /> |
||||
<el-table-column prop="signPriceSequentialGrowth" label="环比" :formatter="parseRate" /> |
||||
<el-table-column |
||||
prop="signPriceSamePeriodCompareGrowth" |
||||
label="同比" |
||||
:formatter="parseRate" |
||||
/> |
||||
</el-table-column> |
||||
<el-table-column label="利润" align="center"> |
||||
<el-table-column prop="profit"> |
||||
<template #header> <Tooltip message="公司利润" /> <span>利润</span> </template> |
||||
</el-table-column> |
||||
<el-table-column prop="profitSequentialGrowth" label="环比" :formatter="parseRate" /> |
||||
<el-table-column prop="profitSamePeriodCompareGrowth" label="同比" :formatter="parseRate" /> |
||||
</el-table-column> |
||||
|
||||
<el-table-column prop="notReceivedMoney"> |
||||
<template #header> |
||||
<Tooltip message="回款列表中未审核的公司利润" /> <span>未到账</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="receivedMoney"> |
||||
<template #header> |
||||
<Tooltip message="回款列表中已审核的公司利润" /> <span>已到账</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="waitSettleMoney" label="待结算金额" /> |
||||
<el-table-column prop="settledMoney" label="已结算金额" /> |
||||
<el-table-column prop="refundAmount" label="已退款金额" /> |
||||
<el-table-column prop="remainMoney"> |
||||
<template #header> |
||||
<Tooltip message="已到账金额-已结算金额-已退款金额" /> <span>结余</span> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</ContentWrap> |
||||
</template> |
||||
|
||||
<script setup name="SignListCard"> |
||||
import { getList } from '@/api/home/reportSignDetail' |
||||
import { formatDate } from '@/utils/formatTime' |
||||
import { removeNullField } from '@/utils' |
||||
|
||||
const detailTypeOptions = [ |
||||
{ label: '日明细', value: 1 }, |
||||
{ label: '月明细', value: 2 }, |
||||
{ label: '季明细', value: 3 }, |
||||
{ label: '年明细', value: 4 } |
||||
] |
||||
|
||||
onMounted(() => { |
||||
handleReset() |
||||
handleSearch() |
||||
}) |
||||
|
||||
const searchForm = ref({}) |
||||
|
||||
function handleReset() { |
||||
searchForm.value = { |
||||
detailType: 2, |
||||
month: formatDate(new Date(), 'YYYY-MM'), |
||||
year: new Date().getFullYear() + '' |
||||
} |
||||
} |
||||
const loading = ref(false) |
||||
const tableList = ref([]) |
||||
async function handleSearch() { |
||||
loading.value = true |
||||
try { |
||||
let params = { detailType: searchForm.value.detailType } |
||||
if (params.detailType == 1) { |
||||
const d = new Date(searchForm.value.month) |
||||
params.month = d.getMonth() + 1 |
||||
params.year = d.getFullYear() |
||||
} else if ([2, 3].includes(params.detailType)) { |
||||
params.year = searchForm.value.year |
||||
} |
||||
const data = await getList(removeNullField(params)) |
||||
tableList.value = data |
||||
} finally { |
||||
loading.value = false |
||||
} |
||||
} |
||||
|
||||
function parseRate(row, column) { |
||||
return Number(row[column.property] * 100).toFixed(2) + '%' |
||||
} |
||||
|
||||
function getSummaries({ columns, data }) { |
||||
let sums = [] |
||||
columns.forEach((column, index) => { |
||||
if (index == 0) { |
||||
sums[index] = '合计' |
||||
return |
||||
} |
||||
const values = data.map((item) => Number(item[column.property])) |
||||
if (!values.every((value) => Number.isNaN(value))) { |
||||
if (column.property.includes('Growth')) { |
||||
sums[index] = '' |
||||
} else { |
||||
sums[index] = values |
||||
.reduce((prev, curr) => { |
||||
const value = Number(curr) |
||||
if (!Number.isNaN(value)) { |
||||
return prev + curr |
||||
} else { |
||||
return prev |
||||
} |
||||
}, 0) |
||||
.toFixed(2) |
||||
} |
||||
} else { |
||||
sums[index] = '' |
||||
} |
||||
}) |
||||
return sums |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,195 +0,0 @@ |
||||
<template> |
||||
<ContentWrap> |
||||
<div class="flex items-center"> |
||||
<span class="mr-20px">成交概况</span> |
||||
<el-dropdown> |
||||
<el-button size="small" |
||||
>{{ periodTypeOptions[periodType] }} <Icon icon="ep:arrow-down" |
||||
/></el-button> |
||||
<template #dropdown> |
||||
<el-dropdown-menu> |
||||
<el-dropdown-item |
||||
v-for="(item, index) in periodTypeOptions" |
||||
:key="index" |
||||
@click="handleSearchTotalInfo(index)" |
||||
> |
||||
{{ item }} |
||||
</el-dropdown-item> |
||||
</el-dropdown-menu> |
||||
</template> |
||||
</el-dropdown> |
||||
</div> |
||||
<el-row :gutter="20" v-loading="infoLoading"> |
||||
<el-col :span="8" :offset="0"> |
||||
<div class="statistic-card"> |
||||
<el-statistic :value="totalData.signNumber" title="成交数" /> |
||||
<div |
||||
class="statistic-footer" |
||||
:class="periodType != 4 ? 'justify-between' : 'justify-center'" |
||||
> |
||||
<div class="footer-item"> |
||||
<span>环比</span> |
||||
<span :class="getColor(totalData.signNumberSequentialGrowth)"> |
||||
{{ totalData.signNumberSequentialGrowth }}% |
||||
<Icon class="ml-2px" :icon="getIcon(totalData.signNumberSequentialGrowth)" /> |
||||
</span> |
||||
</div> |
||||
<div class="footer-item" v-if="periodType != 4"> |
||||
<span>同比</span> |
||||
<span :class="getColor(totalData.signNumberPeriodCompareGrowth)"> |
||||
{{ totalData.signNumberPeriodCompareGrowth }}% |
||||
<Icon class="ml-2px" :icon="getIcon(totalData.signNumberPeriodCompareGrowth)" /> |
||||
</span> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</el-col> |
||||
<el-col :span="8" :offset="0"> |
||||
<div class="statistic-card"> |
||||
<el-statistic :value="totalData.signPrice" title="成交额" :precision="2" /> |
||||
<div |
||||
class="statistic-footer" |
||||
:class="periodType != 4 ? 'justify-between' : 'justify-center'" |
||||
> |
||||
<div class="footer-item"> |
||||
<span>环比</span> |
||||
<span :class="getColor(totalData.signPriceSequentialGrowth)"> |
||||
{{ totalData.signPriceSequentialGrowth }}% |
||||
<Icon class="ml-2px" :icon="getIcon(totalData.signPriceSequentialGrowth)" /> |
||||
</span> |
||||
</div> |
||||
<div class="footer-item" v-if="periodType != 4"> |
||||
<span>同比</span> |
||||
<span :class="getColor(totalData.signPriceSamePeriodCompareGrowth)"> |
||||
{{ totalData.signPriceSamePeriodCompareGrowth }}% |
||||
<Icon class="ml-2px" :icon="getIcon(totalData.signPriceSamePeriodCompareGrowth)" /> |
||||
</span> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</el-col> |
||||
<el-col :span="8" :offset="0"> |
||||
<div class="statistic-card"> |
||||
<el-statistic :value="totalData.profit" title="利润" :precision="2" /> |
||||
<div |
||||
class="statistic-footer" |
||||
:class="periodType != 4 ? 'justify-between' : 'justify-center'" |
||||
> |
||||
<div class="footer-item"> |
||||
<span>环比</span> |
||||
<span :class="getColor(totalData.profitSequentialGrowth)"> |
||||
{{ totalData.profitSequentialGrowth }}% |
||||
<Icon class="ml-2px" :icon="getIcon(totalData.profitSequentialGrowth)" /> |
||||
</span> |
||||
</div> |
||||
<div class="footer-item" v-if="periodType != 4"> |
||||
<span>同比</span> |
||||
<span :class="getColor(totalData.profitSamePeriodCompareGrowth)"> |
||||
{{ totalData.profitSamePeriodCompareGrowth }}% |
||||
<Icon class="ml-2px" :icon="getIcon(totalData.profitSamePeriodCompareGrowth)" /> |
||||
</span> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</el-col> |
||||
</el-row> |
||||
</ContentWrap> |
||||
</template> |
||||
|
||||
<script setup name="SignTotalCard"> |
||||
import { getInfo } from '@/api/home/reportSignDetail' |
||||
|
||||
const periodTypeOptions = ['本日', '本周', '本月', '本季', '本年'] |
||||
|
||||
const periodType = ref(2) |
||||
const totalData = ref({}) |
||||
|
||||
onMounted(() => { |
||||
handleSearchTotalInfo(2) |
||||
}) |
||||
|
||||
const infoLoading = ref(false) |
||||
async function handleSearchTotalInfo(index) { |
||||
periodType.value = index |
||||
infoLoading.value = true |
||||
try { |
||||
const data = await getInfo({ periodType: periodType.value + 1 }) |
||||
totalData.value = data |
||||
} finally { |
||||
infoLoading.value = false |
||||
} |
||||
} |
||||
|
||||
function getIcon(val) { |
||||
if (val > 0) { |
||||
return 'ep:caret-top' |
||||
} else if (val < 0) { |
||||
return 'ep:caret-bottom' |
||||
} else { |
||||
return 'ep:minus' |
||||
} |
||||
} |
||||
|
||||
function getColor(val) { |
||||
if (val > 0) { |
||||
return 'green' |
||||
} else if (val < 0) { |
||||
return 'red' |
||||
} else { |
||||
return 'gley' |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.el-col { |
||||
text-align: center; |
||||
} |
||||
:global(h2#card-usage ~ .example .example-showcase) { |
||||
background-color: var(--el-fill-color) !important; |
||||
} |
||||
|
||||
.el-statistic { |
||||
--el-statistic-content-font-size: 28px; |
||||
} |
||||
|
||||
.statistic-card { |
||||
height: 100%; |
||||
// padding: 20px; |
||||
border-radius: 4px; |
||||
background-color: var(--el-bg-color-overlay); |
||||
} |
||||
|
||||
.statistic-footer { |
||||
margin: 16px auto 0; |
||||
display: flex; |
||||
// justify-content: space-between; |
||||
align-items: center; |
||||
flex-wrap: wrap; |
||||
font-size: 12px; |
||||
color: var(--el-text-color-regular); |
||||
width: 300px; |
||||
} |
||||
|
||||
.statistic-footer .footer-item { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
} |
||||
|
||||
.statistic-footer .footer-item span:last-child { |
||||
display: inline-flex; |
||||
align-items: center; |
||||
margin-left: 4px; |
||||
} |
||||
|
||||
.green { |
||||
color: var(--el-color-success); |
||||
} |
||||
.gley { |
||||
color: var(--el-color-info); |
||||
} |
||||
.red { |
||||
color: var(--el-color-error); |
||||
} |
||||
</style> |
@ -1,248 +0,0 @@ |
||||
<template> |
||||
<ContentWrap> |
||||
<el-form :model="searchForm" label-width="0" inline> |
||||
<el-form-item> |
||||
<el-date-picker |
||||
v-model="searchForm.consultTime" |
||||
type="daterange" |
||||
format="YYYY-MM-DD" |
||||
value-format="YYYY-MM-DD" |
||||
start-placeholder="选择日期" |
||||
end-placeholder="选择日期" |
||||
:clearable="false" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-input v-model="searchForm.nickname" placeholder="销售姓名" clearable /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-tree-select |
||||
v-model="searchForm.sourceId" |
||||
:data="sourceOptions" |
||||
:props="defaultProps" |
||||
check-strictly |
||||
clearable |
||||
filterable |
||||
node-key="sourceId" |
||||
placeholder="请选择渠道" |
||||
/> |
||||
</el-form-item> |
||||
<el-form-item v-if="appStore.getAppInfo?.instanceType == 1"> |
||||
<el-select |
||||
v-model="searchForm.licenseTypeList" |
||||
placeholder="选择驾照类型" |
||||
clearable |
||||
multiple |
||||
> |
||||
<el-option |
||||
v-for="item in licenseTypeOptions" |
||||
:key="item.label" |
||||
:label="item.label" |
||||
:value="item.label" |
||||
/> |
||||
</el-select> |
||||
</el-form-item> |
||||
|
||||
<el-form-item> |
||||
<el-button @click="handleSearch">查询</el-button> |
||||
<el-button @click="handleReset">重置</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
|
||||
<el-table |
||||
v-loading="loading" |
||||
:data="tableList" |
||||
border |
||||
stripe |
||||
show-summary |
||||
:summary-method="getSummaries" |
||||
> |
||||
<el-table-column type="index" width="60" fixed="left" align="center" /> |
||||
<el-table-column prop="nickname" label="姓名" width="80" fixed="left"> |
||||
<template #default="{ row }"> |
||||
<el-button type="primary" style="padding: 0" text @click="handleDetail(row)">{{ |
||||
row.nickname |
||||
}}</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="newClueNumber" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip message="咨询日期在所选周期内的线索总数" /> |
||||
<span>新线索数</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="成交数" prop="signNumber" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip message="成交日期在所选周期内的成交数" /> |
||||
<span>成交数</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column |
||||
label="成交率" |
||||
prop="signRate" |
||||
sortable |
||||
min-width="100" |
||||
:formatter="(row) => row.signRate + '%'" |
||||
/> |
||||
<el-table-column label="跟进数/日" prop="dayFollowNumber" sortable min-width="100" /> |
||||
<el-table-column label="成交数/日" prop="daySignNumber" sortable min-width="100" /> |
||||
<el-table-column label="平均成交周期" prop="averageSignPeriod" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip message="平均每条成交的线索,从咨询开始到成交所需要的天数" /> |
||||
<span>平均成交周期</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="grossProfitOfSingleSign" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip |
||||
message="平均每笔成交订单的公司利润【按照登记,不按审核到账】=总公司利润/总成交数" |
||||
/> |
||||
<span>毛利/单</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="payPriceOfSingleSign" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip |
||||
message="平均每笔成交订单的额外支出(返费等)【按照登记,不按审核到账】=总支出/总成交数" |
||||
/> |
||||
<span>支出/单</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="costOfSingleClue" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip message="平均每条线索的成本=总线索成本/新线索条数" /> |
||||
<span>线索成本/条</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="netProfitOfSingleSign" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip message="=(总公司利润-总支出-总线索成本)/总成交数" /> |
||||
<span>净利润/单</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="总线索成本" prop="clueCostTotal" sortable min-width="100" /> |
||||
<el-table-column label="总支出" prop="payPriceTotal" sortable min-width="100" /> |
||||
<el-table-column label="总利润" prop="profitTotal" sortable min-width="100" /> |
||||
<el-table-column prop="efficiency" sortable min-width="100"> |
||||
<template #header> |
||||
<Tooltip message="=总利润/(总成本+总支出)" /> |
||||
<span>能效</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="撞单数" prop="repeatClueNum" sortable min-width="100" /> |
||||
<el-table-column label="撞单成交数" prop="repeatClueSignNum" sortable min-width="100" /> |
||||
</el-table> |
||||
|
||||
<DialogSalerReportDetail |
||||
:licenseTypeOptions="licenseTypeOptions" |
||||
:source-options="sourceOptions" |
||||
ref="SalerDetailDialog" |
||||
/> |
||||
</ContentWrap> |
||||
</template> |
||||
|
||||
<script setup name="SalesReport"> |
||||
import DialogSalerReportDetail from './Comp/DialogSalerReportDetail.vue' |
||||
|
||||
import * as reportApi from '@/api/home/reportSaler' |
||||
import { getSimpleSourceList as getResourceOptions } from '@/api/clue/source' |
||||
|
||||
import { removeNullField } from '@/utils' |
||||
import { formatDate } from '@/utils/formatTime' |
||||
import { handleTree } from '@/utils/tree' |
||||
import { getIntDictOptions } from '@/utils/dict' |
||||
import { useAppStore } from '@/store/modules/app' |
||||
|
||||
const appStore = useAppStore() |
||||
onMounted(() => { |
||||
getOptions() |
||||
handleReset() |
||||
handleSearch() |
||||
}) |
||||
|
||||
const defaultProps = { |
||||
children: 'children', |
||||
label: 'sourceName', |
||||
value: 'sourceId', |
||||
isLeaf: 'leaf' |
||||
} |
||||
|
||||
const sourceOptions = ref([]) |
||||
const licenseTypeOptions = ref([]) |
||||
|
||||
const searchForm = ref({}) |
||||
|
||||
function handleReset() { |
||||
const year = new Date().getFullYear() |
||||
const month = new Date().getMonth() + 1 |
||||
searchForm.value = { |
||||
nickname: undefined, |
||||
consultTime: [`${year}-${month}-01`, formatDate(new Date())], |
||||
licenseTypeList: [], |
||||
sourceId: undefined |
||||
} |
||||
} |
||||
|
||||
const loading = ref(false) |
||||
const tableList = ref([]) |
||||
const avgData = ref({}) |
||||
async function handleSearch() { |
||||
loading.value = true |
||||
try { |
||||
const data = await reportApi.getList(removeNullField(searchForm.value)) |
||||
tableList.value = data.personDataVOList |
||||
avgData.value = data.averageDataVO |
||||
} finally { |
||||
loading.value = false |
||||
} |
||||
} |
||||
|
||||
function getSummaries({ columns, data }) { |
||||
const sums = [] |
||||
columns.forEach((column, index) => { |
||||
if (index == 0) { |
||||
sums[index] = '统计' |
||||
return |
||||
} |
||||
|
||||
const doubleSumsColumns = [ |
||||
'newClueNumber', |
||||
'signNumber', |
||||
'clueCostTotal', |
||||
'payPriceTotal', |
||||
'profitTotal' |
||||
] |
||||
if (column.property in avgData.value) { |
||||
sums[index] = `均值: ${avgData.value[column.property]}` |
||||
} else if (doubleSumsColumns.includes(column.property)) { |
||||
const values = data.map((item) => Number(item[column.property])) |
||||
let sum = values.reduce((prev, curr) => prev + curr, 0) |
||||
let avg = sum / values.length |
||||
if (['newClueNumber', 'signNumber'].includes(column.property)) { |
||||
avg = Math.floor(avg) |
||||
} else { |
||||
sum = sum.toFixed(2) |
||||
avg = avg.toFixed(2) |
||||
} |
||||
sums[index] = h('div', {}, [h('div', {}, `合计:${sum}`), h('div', {}, `均值:${avg}`)]) |
||||
} else { |
||||
sums[index] = '' |
||||
} |
||||
}) |
||||
return sums |
||||
} |
||||
|
||||
const SalerDetailDialog = ref() |
||||
function handleDetail(info) { |
||||
SalerDetailDialog.value.open(info, searchForm.value) |
||||
} |
||||
|
||||
function getOptions() { |
||||
getResourceOptions().then((data) => { |
||||
sourceOptions.value = handleTree(data, 'sourceId') |
||||
}) |
||||
licenseTypeOptions.value = getIntDictOptions('license_type') |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -1,13 +0,0 @@ |
||||
<template> |
||||
<div> |
||||
<SignTotalCard /> |
||||
<SignListCard /> |
||||
</div> |
||||
</template> |
||||
|
||||
<script setup name="SignReport"> |
||||
import SignTotalCard from './Comp/SignTotalCard.vue' |
||||
import SignListCard from './Comp/SignListCard.vue' |
||||
</script> |
||||
|
||||
<style lang="scss" scoped></style> |
@ -0,0 +1,7 @@ |
||||
<template> |
||||
<div> </div> |
||||
</template> |
||||
|
||||
<script setup></script> |
||||
|
||||
<style lang="scss" scoped></style> |
Loading…
Reference in new issue