Commit cd6ac55f by Jaxon

feat(督导统计): 业务开发

1 parent 3a762e25
...@@ -5,3 +5,11 @@ import api from "@/api/request"; ...@@ -5,3 +5,11 @@ import api from "@/api/request";
export function getSupervisorPerformance(data = {}) { export function getSupervisorPerformance(data = {}) {
return api.post("dj.api.supervisor.management.supervisor.performance", data, "supervisorUrl"); return api.post("dj.api.supervisor.management.supervisor.performance", data, "supervisorUrl");
} }
export function getStorePerformance(data = {}) {
return api.post("dj.api.supervisor.management.store.performance", data, "supervisorUrl");
}
// export function getStorePerformance(data = {}) {
// return api.post("dj.api.supervisor.management.store.performance", data, "supervisorUrl");
// }
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
sliderStyle() { sliderStyle() {
return { return {
width: this.sliderWidth + "px", width: this.sliderWidth + "px",
transform: "translate3d(" + this.sliderX + "px, 0, 0)", left: this.sliderX + "px",
}; };
}, },
}, },
...@@ -286,6 +286,7 @@ export default { ...@@ -286,6 +286,7 @@ export default {
box-sizing: border-box; box-sizing: border-box;
border-radius: 24px; border-radius: 24px;
overflow: hidden; overflow: hidden;
isolation: isolate;
} }
.tabs-bg { .tabs-bg {
...@@ -300,19 +301,19 @@ export default { ...@@ -300,19 +301,19 @@ export default {
top: 3px; top: 3px;
bottom: 3px; bottom: 3px;
left: 0; left: 0;
z-index: 1; z-index: 0;
border-radius: 24px; border-radius: 24px;
background-color: var(--themeColor, #3975c6); background-color: var(--themeColor, #3975c6);
transition: transition:
transform 250ms cubic-bezier(0.2, 0.8, 0.2, 1), left 250ms cubic-bezier(0.2, 0.8, 0.2, 1),
width 250ms cubic-bezier(0.2, 0.8, 0.2, 1); width 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
will-change: transform, width; will-change: left, width;
pointer-events: none; pointer-events: none;
} }
.tab-item { .tab-item {
position: relative; position: relative;
z-index: 2; z-index: 1;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
......
...@@ -92,6 +92,7 @@ export default { ...@@ -92,6 +92,7 @@ export default {
.row-wrapper { .row-wrapper {
display: flex; display: flex;
align-items: center; align-items: center;
flex-wrap: wrap;
} }
.van-col-wrapper { .van-col-wrapper {
overflow: hidden; overflow: hidden;
......
...@@ -10,9 +10,11 @@ ...@@ -10,9 +10,11 @@
<div class="main-label text-hide"> <div class="main-label text-hide">
{{ title }} {{ title }}
</div> </div>
<slot name="sub-title" :data="data">
<div v-if="subTitle" class="sub-label text-hide"> <div v-if="subTitle" class="sub-label text-hide">
{{ subTitle }} {{ subTitle }}
</div> </div>
</slot>
</div> </div>
<div class="title-info-wrapper"> <div class="title-info-wrapper">
<slot name="title-info"> <slot name="title-info">
...@@ -35,11 +37,13 @@ ...@@ -35,11 +37,13 @@
</slot> </slot>
</div> </div>
</div> </div>
<SpecialItem style="margin: 8px 0" <SpecialItem v-if="specialSchema.length"
style="margin: 8px 0"
:data="data" :data="data"
:schema="specialSchema"> :schema="specialSchema">
</SpecialItem> </SpecialItem>
<GridItem :data="data" :schema="defaultSchema"></GridItem> <GridItem :data="data" :schema="defaultSchema"></GridItem>
<div class="container" gutter="4"> <div class="container" gutter="4">
<div v-show="showMoreToggle" span="24"> <div v-show="showMoreToggle" span="24">
<div class="more-collapse" <div class="more-collapse"
...@@ -62,7 +66,7 @@ ...@@ -62,7 +66,7 @@
class="toggle-wrapper" class="toggle-wrapper"
:class="{ 'is-expanded': expanded }" :class="{ 'is-expanded': expanded }"
@click.stop="onToggleMore"> @click.stop="onToggleMore">
{{ expanded ? '收起2项售后成交指标' : '已隐藏2项售后成交指标' }} {{ expanded ? `收起${moreSchema.length}项售后成交指标` : `已隐藏${moreSchema.length}项售后成交指标` }}
<svg-icon class="toggle-icon" <svg-icon class="toggle-icon"
name="show-more" name="show-more"
size="16px" /> size="16px" />
......
export const brandTypeList = [ export const supervisorSchemaList = [
{ {
showIconOnActiveOnly: true, name: "displayTotalOutput",
icon: "brand-icon|svg", label: "总产值(万)",
key: "1", colStyle: "flex: 1 0 calc((100% - 16px) / 3);margin-bottom:4px;margin-top:8px",
label: "问界鸿蒙-延保权益",
style: {
backgroundColor: "#fff",
}, },
{
name: "displayDeliveryCount",
label: "交付数",
colStyle: "flex: 1 0 calc((100% - 16px) / 3);margin-bottom:4px;margin-top:8px",
}, },
{ {
showIconOnActiveOnly: true, name: "displayPreSalesTouchCount",
icon: "brand-icon|svg", label: "触客数",
key: "2", colStyle: "flex: 1 0 calc((100%) / 3);margin-right:0;margin-bottom:4px;margin-top:8px",
label: "通用品牌-延保权益",
style: {
backgroundColor: "#fff",
}, },
{
name: "displayVehicleWarrantyRate",
label: "整车延保",
colStyle: "flex: 0 auto;",
tips: "整车延保触客转化率",
}, },
]; {
name: "displayPeaceOfMindRate",
label: "安心包",
colStyle: "flex:1",
tips: "安心包触客转化率",
export const staticInfoList = [ },
{ {
key: "", name: "displayBatteryWarrantyRate",
background: "linear-gradient(90deg, #42CCCF 0%, #36D9A5 100%)", label: "电池",
label: "达标门店数", colStyle: "flex:1",
tips: "电池延保触客转化率",
},
{
name: "displayTireInsuranceRate",
label: "轮胎",
colStyle: "flex:1",
tips: "轮胎险触客转化率",
},
{
name: "displayVehicleWarrantyAfterSalesRate",
label: "整车延保售后成交/总成交",
colStyle: "flex: 1 0 calc((100% - 8px) / 2);margin-bottom:4px ",
isMore: true,
}, },
{ {
key: "", name: "displayPeaceOfMindAfterSalesRate",
background: "linear-gradient(90deg, #7552FF 0%, #977DFF 100%)", label: "安心包售后成交/总成交",
label: "需关注门店数", colStyle: "flex: 1 0 calc((100% - 8px) / 2); margin-right:0; margin-bottom:4px",
isMore: true,
}, },
{ {
key: "", name: "displayBatteryAfterSalesRate",
background: "linear-gradient(90deg, #3D76FC 0%, #4DA6FF 100%)", label: "电池售后成交/总成交",
label: "预警门店数", colStyle: "flex: 1 0 calc((100% - 8px) / 2);margin-bottom:4px ",
isMore: true,
},
{
name: "displayTireInsuranceAfterSalesRate",
label: "轮胎售后成交/总成交",
colStyle: "flex: 1 0 calc((100% - 8px) / 2); margin-right:0; margin-bottom:4px",
isMore: true,
}, },
]; ];
export const supervisorSchemaList = [ export const supervisorCommonSchemaList = [
{ {
name: "displayDeliveryCount", name: "displayDeliveryCount",
label: "交付数", label: "交付数",
...@@ -86,55 +117,53 @@ export const supervisorSchemaList = [ ...@@ -86,55 +117,53 @@ export const supervisorSchemaList = [
special: true, special: true,
}, },
{ {
name: "displayVehicleWarrantyRate", name: "displayTouchConversionRate",
label: "整车延保", label: "触客成交率",
colStyle: "flex: 0 auto;", colStyle: "flex: 0 auto;",
tips: "整车延保触客转化率",
}, },
{ {
name: "displayPeaceOfMindRate", name: "displayPeaceOfMindRate",
label: "安心包", label: "延保",
colStyle: "flex:1", colStyle: "flex:1",
tips: "安心包触客转化率", tips: "延保触客转化率",
}, },
{ {
name: "displayBatteryWarrantyRate", name: "displayEquityProductRate",
label: "电池", label: "权益商品",
colStyle: "flex:1", colStyle: "flex:1",
tips: "电池延保触客转化率", tips: "权益商品触客转化率",
}, },
{ {
name: "displayTireInsuranceRate", name: "displayEquityRate",
label: "轮胎", label: "权益",
colStyle: "flex:1", colStyle: "flex:1",
tips: "轮胎险触客转化率", tips: "权益触客转化率",
}, },
{ {
name: "displayVehicleWarrantyAfterSalesRate", name: "displayWarrantyAfterSalesRate",
label: "整车延保售后成交/总成交", label: "延保售后成交/总成交",
colStyle: "width:50%", colStyle: "width:50%",
style: "margin-bottom: 4px;", style: "margin-bottom: 4px;",
isMore: true, isMore: true,
}, },
{ {
name: "displayPeaceOfMindAfterSalesRate", name: "displayPeaceOfMindAfterSalesRate",
label: "安心包售后成交/总成交", label: "权益商品售后成交/总成交",
colStyle: "width:50%", colStyle: "width:50%",
style: "margin-bottom: 4px;", style: "margin-bottom: 4px;",
isMore: true, isMore: true,
}, },
{ {
name: "displayBatteryAfterSalesRate", name: "displayEquityAfterSalesRate",
label: "电池售后成交/总成交", label: "权益售后成交/总成交",
colStyle: "width:50%", colStyle: "width:50%",
isMore: true, isMore: true,
}, },
{ {
name: "displayTireInsuranceAfterSalesRate", name: "displayEquityAvgUnitPrice",
label: "轮胎售后成交/总成交", label: "权益平均客单价(元)",
colStyle: "width:50%", colStyle: "width:50%",
isMore: true, isMore: true,
}, },
......
<template>
<van-pull-refresh v-model="list.loading"
class="pull-refresh-wrapper"
@refresh="handleResetList">
<div class="filter-wrapper">
<div class="brand-filter">
<BrandTabs v-model="list.query.statDimension"
:list="options.brandTypeList"
@change="getData()" />
</div>
<div class="date-filter">
<DateTypeTabs v-model="list.query.dateType" />
<DatePicker v-model="list.query.date"
style="margin-left:16px"
:type="options.dateType[list.query.dateType]"
@change="getData()" />
</div>
<div class="static-wrapper">
<StaticInfo :list="options.staticInfoList" />
</div>
<div class="search-wrapper">
<SearchInput v-model="list.query.searchKeyword"
placeholder="搜索门店名称"
@input="throttledFilterSearchKeyword" />
</div>
</div>
<div class="list-wrapper">
<div class="title-wrapper">
<div>
门店列表
</div>
<div class="region" @click="handleShowRegionPicker">
<span>筛选门店区域</span>
<SvgIcon color="#A2A6B1"
name="triangle-down"
size="16" />
</div>
</div>
<div :key="list.query.statDimension" class="container-wrapper">
<StatisticsItem v-for="(item, index) in list.data"
:key="index"
class="statistics-item"
:data="item"
:schema="list.query.statDimension === '1' ? options.supervisorSchemaList : options.supervisorCommonSchemaList"
:title="item.merchantName"
@tap="handleTapItem">
<template #sub-title="{ data }">
<div class="sub-title-wrapper">
<div class="staff-label">
{{ getStaffLength(data) }}名驻店人员
</div>
</div>
</template>
</StatisticsItem>
</div>
</div>
</van-pull-refresh>
</template>
<script>
import dayjs from "dayjs";
import { cloneDeep, throttle } from "lodash-es";
import { getRegionList } from "@/api/region";
import DatePicker from "@/components/datePicker/index.vue";
import DateTypeTabs from "@/components/dateTypeTabs/index.vue";
import SearchInput from "@/components/searchBar/index.vue";
import StaticInfo from "@/components/staticInfo/index.vue";
import SvgIcon from "@/components/svgIcon/index.vue";
import { getStorePerformance } from "@/views/performance/api";
import StatisticsItem from "@/views/performance/components/statisticsItem/statisticsItem.vue";
import { brandTypeList, staticInfoList } from "@/views/performance/constant/performance";
import BrandTabs from "../brandTabs/index.vue";
import { supervisorCommonSchemaList, supervisorSchemaList } from "./index.data";
export default {
name: "StorePerformance",
components: {
SvgIcon,
BrandTabs,
DatePicker,
DateTypeTabs,
StaticInfo,
SearchInput,
StatisticsItem,
},
data() {
return {
throttledFilterSearchKeyword: null,
options: {
brandTypeList,
staticInfoList,
supervisorSchemaList,
supervisorCommonSchemaList,
regionList: [],
dateType: {
// "date" | "week" | "year-month"
0: "date",
1: "week",
2: "year-month",
},
},
list: {
loading: false,
statistics: {},
originData: [],
data: [],
query: {
dateType: 0,
statDimension: "1",
searchKeyword: "",
region: "",
date: {
startDayjs: dayjs(),
},
},
},
};
},
created() {
this.throttledFilterSearchKeyword = throttle(() => {
this.list.data = this.filterSearchKeyword();
}, 300);
},
async mounted() {
await this.getRegionOptions();
await this.getData();
},
beforeDestroy() {
this.throttledFilterSearchKeyword?.cancel?.();
},
methods: {
async getRegionOptions() {
const data = await getRegionList({});
console.log(data);
},
handleShowRegionPicker() {
},
getStaffLength(row) {
return row?.length || 0;
},
getItemSubTitle(rows) {
return rows?.storeList?.map(i => i.merchantName).join("、");
},
getQuery() {
return {
...this.list.query,
startDate: this.list.query.date.startDate,
endDate: this.list.query.date.endDate,
date: undefined,
};
},
async getData() {
this.$loading.show();
try {
this.list.data = [];
this.list.originData = [];
await this.$nextTick();
const data = await getStorePerformance(this.getQuery());
this.$set(this.list, "statistics", data?.statistics || {});
this.list.originData = cloneDeep(data.storeList);
this.list.data = this.afterGetData(data.storeList);
} finally {
this.$loading.hide();
}
},
afterGetData(list) {
return this.filterSearchKeyword();
},
filterSearchKeyword() {
const keyword = (this.list.query.searchKeyword || "").trim();
if (!keyword) {
return this.list.originData;
}
return this.list.originData.filter(item => item?.supervisorName?.includes(keyword));
},
handleTapItem() {
this.$router.push({
name: "supervisorOutlet",
});
},
async handleResetList() {
this.list.loading = true;
await this.getData();
this.list.loading = false;
},
search() {},
},
};
</script>
<style lang="scss" scoped>
.pull-refresh-wrapper {
height: 100%;
overflow: auto !important;
box-sizing: border-box;
}
.filter-wrapper {
padding: 0 12px;
.brand-filter {
padding: 6px 0;
}
.date-filter {
padding: 8px 0;
width: 100%;
display: flex;
align-items: center;
}
.static-wrapper {
padding: 8px 0;
::v-deep .static-info {
padding: 0;
}
}
.search-wrapper {
padding: 8px 0;
.search-bar-wrapper {
padding: 0;
::v-deep .van-search {
padding: 0;
}
}
}
}
.list-wrapper {
padding: 0 12px 20px;
> .title-wrapper {
font-weight: 400;
font-size: 14px;
line-height: 14px;
color: #000000e5;
padding: 8px 0;
display: flex;
justify-content: space-between;
> .region {
color: #00000066;
}
}
.container-wrapper {
margin-top: 4px;
.statistics-item {
margin-top: 8px;
&:first-child {
margin-top: 0;
}
}
.sub-title-wrapper {
.staff-label {
font-weight: 400;
font-size: 12px;
line-height: 20px;
color: #00000066;
}
}
}
}
</style>
export const supervisorSchemaList = [
{
name: "displayDeliveryCount",
label: "交付数",
col: 8,
titleInfo: true,
},
{
name: "displayPreSalesTouchCount",
label: "触客数",
col: 8,
titleInfo: true,
},
{
name: "displayTotalOutput",
label: "总产值(万)",
col: 8,
titleInfo: true,
},
{
name: "staffCount",
label: "管理驻店",
col: 6,
style: "color: #000000E5;",
special: true,
},
{
name: "totalStoreCount",
label: "辖区门店",
col: 6,
style: "color: #000000E5;",
special: true,
},
{
name: "yellowStoreCount",
label: "需关注门店",
col: 6,
style: "color: #FF9D0A;",
special: true,
},
{
name: "redStoreCount",
label: "预警门店",
col: 6,
style: "color: #F24724;",
special: true,
},
{
name: "displayVehicleWarrantyRate",
label: "整车延保",
colStyle: "flex: 0 auto;",
tips: "整车延保触客转化率",
},
{
name: "displayPeaceOfMindRate",
label: "安心包",
colStyle: "flex:1",
tips: "安心包触客转化率",
},
{
name: "displayBatteryWarrantyRate",
label: "电池",
colStyle: "flex:1",
tips: "电池延保触客转化率",
},
{
name: "displayTireInsuranceRate",
label: "轮胎",
colStyle: "flex:1",
tips: "轮胎险触客转化率",
},
{
name: "displayVehicleWarrantyAfterSalesRate",
label: "整车延保售后成交/总成交",
colStyle: "width:50%",
style: "margin-bottom: 4px;",
isMore: true,
},
{
name: "displayPeaceOfMindAfterSalesRate",
label: "安心包售后成交/总成交",
colStyle: "width:50%",
style: "margin-bottom: 4px;",
isMore: true,
},
{
name: "displayBatteryAfterSalesRate",
label: "电池售后成交/总成交",
colStyle: "width:50%",
isMore: true,
},
{
name: "displayTireInsuranceAfterSalesRate",
label: "轮胎售后成交/总成交",
colStyle: "width:50%",
isMore: true,
},
];
export const supervisorCommonSchemaList = [
{
name: "displayDeliveryCount",
label: "交付数",
col: 8,
titleInfo: true,
},
{
name: "displayPreSalesTouchCount",
label: "触客数",
col: 8,
titleInfo: true,
},
{
name: "displayTotalOutput",
label: "总产值(万)",
col: 8,
titleInfo: true,
},
{
name: "staffCount",
label: "管理驻店",
col: 6,
style: "color: #000000E5;",
special: true,
},
{
name: "totalStoreCount",
label: "辖区门店",
col: 6,
style: "color: #000000E5;",
special: true,
},
{
name: "yellowStoreCount",
label: "需关注门店",
col: 6,
style: "color: #FF9D0A;",
special: true,
},
{
name: "redStoreCount",
label: "预警门店",
col: 6,
style: "color: #F24724;",
special: true,
},
{
name: "displayTouchConversionRate",
label: "触客成交率",
colStyle: "flex: 0 auto;",
},
{
name: "displayPeaceOfMindRate",
label: "延保",
colStyle: "flex:1",
tips: "延保触客转化率",
},
{
name: "displayEquityProductRate",
label: "权益商品",
colStyle: "flex:1",
tips: "权益商品触客转化率",
},
{
name: "displayEquityRate",
label: "权益",
colStyle: "flex:1",
tips: "权益触客转化率",
},
{
name: "displayWarrantyAfterSalesRate",
label: "延保售后成交/总成交",
colStyle: "width:50%",
style: "margin-bottom: 4px;",
isMore: true,
},
{
name: "displayPeaceOfMindAfterSalesRate",
label: "权益商品售后成交/总成交",
colStyle: "width:50%",
style: "margin-bottom: 4px;",
isMore: true,
},
{
name: "displayEquityAfterSalesRate",
label: "权益售后成交/总成交",
colStyle: "width:50%",
isMore: true,
},
{
name: "displayEquityAvgUnitPrice",
label: "权益平均客单价(元)",
colStyle: "width:50%",
isMore: true,
},
];
<template>
<van-pull-refresh v-model="list.loading"
class="pull-refresh-wrapper"
@refresh="handleResetList">
<div class="filter-wrapper">
<div class="brand-filter">
<BrandTabs v-model="list.query.statDimension"
:list="options.brandTypeList"
@change="getData()" />
</div>
<div class="date-filter">
<DateTypeTabs v-model="list.query.dateType" />
<DatePicker v-model="list.query.date"
style="margin-left:16px"
:type="options.dateType[list.query.dateType]"
@change="getData()" />
</div>
<!-- <div class="static-wrapper">
<StaticInfo :data="list.statistics" :list="options.staticInfoList" />
</div> -->
<div class="search-wrapper">
<SearchInput v-model="list.query.searchKeyword" @input="throttledFilterSearchKeyword" />
</div>
</div>
<div class="list-wrapper">
<div class="title-wrapper">
督导列表
</div>
<div :key="list.query.statDimension" class="container-wrapper">
<StatisticsItem v-for="(item, index) in list.data"
:key="index"
class="statistics-item"
:data="item"
:schema="list.query.statDimension === '1' ? options.supervisorSchemaList : options.supervisorCommonSchemaList"
:sub-title="getItemSubTitle(item)"
:title="item.supervisorName"
@tap="handleTapItem" />
</div>
</div>
</van-pull-refresh>
</template>
<script>
import dayjs from "dayjs";
import { cloneDeep, throttle } from "lodash-es";
import DatePicker from "@/components/datePicker/index.vue";
import DateTypeTabs from "@/components/dateTypeTabs/index.vue";
import SearchInput from "@/components/searchBar/index.vue";
import StaticInfo from "@/components/staticInfo/index.vue";
import { getSupervisorPerformance } from "@/views/performance/api";
import StatisticsItem from "@/views/performance/components/statisticsItem/statisticsItem.vue";
import { brandTypeList, staticInfoList } from "@/views/performance/constant/performance";
import BrandTabs from "../brandTabs/index.vue";
import { supervisorCommonSchemaList, supervisorSchemaList } from "./index.data";
export default {
name: "PerformanceOverview",
components: {
BrandTabs,
DatePicker,
DateTypeTabs,
StaticInfo,
SearchInput,
StatisticsItem,
},
data() {
return {
throttledFilterSearchKeyword: null,
options: {
brandTypeList,
staticInfoList,
supervisorSchemaList,
supervisorCommonSchemaList,
dateType: {
// "date" | "week" | "year-month"
0: "date",
1: "week",
2: "year-month",
},
},
list: {
loading: false,
originData: [],
data: [],
query: {
dateType: 0,
statDimension: "1",
searchKeyword: "",
date: {
startDayjs: dayjs(),
},
},
},
};
},
created() {
this.throttledFilterSearchKeyword = throttle(() => {
this.list.data = this.filterSearchKeyword();
}, 300);
},
async mounted() {
},
beforeDestroy() {
this.throttledFilterSearchKeyword?.cancel?.();
},
methods: {
getItemSubTitle(rows) {
return rows?.storeList?.map(i => i.merchantName).join("、");
},
getQuery() {
return {
...this.list.query,
startDate: this.list.query.date.startDate,
endDate: this.list.query.date.endDate,
date: undefined,
};
},
async getData() {
console.log("??");
this.$loading.show();
try {
this.list.data = [];
this.list.originData = [];
await this.$nextTick();
const list = await getSupervisorPerformance(this.getQuery());
this.list.originData = cloneDeep(list);
this.list.data = this.afterGetData(list);
} finally {
this.$loading.hide();
}
},
afterGetData(list) {
return this.filterSearchKeyword();
},
filterSearchKeyword(list) {
const keyword = (this.list.query.searchKeyword || "").trim();
if (!keyword) {
return this.list.originData;
}
return this.list.originData.filter(item => item?.supervisorName?.includes(keyword));
},
handleTapItem() {
this.$router.push({
name: "supervisorOutlet",
});
},
async handleResetList() {
this.list.loading = true;
await this.getData();
this.list.loading = false;
},
search() {},
},
};
</script>
<style lang="scss" scoped>
.pull-refresh-wrapper {
height: 100%;
overflow: auto !important;
box-sizing: border-box;
}
.filter-wrapper {
padding: 0 12px;
.brand-filter {
padding: 6px 0;
}
.date-filter {
padding: 8px 0;
width: 100%;
display: flex;
align-items: center;
}
.static-wrapper {
padding: 8px 0;
::v-deep .static-info {
padding: 0;
}
}
.search-wrapper {
padding: 8px 0;
.search-bar-wrapper {
padding: 0;
::v-deep .van-search {
padding: 0;
}
}
}
}
.list-wrapper {
padding: 0 12px 20px;
> .title-wrapper {
font-weight: 400;
font-size: 14px;
line-height: 14px;
color: #000000e5;
padding: 8px 0;
}
.container-wrapper {
margin-top: 4px;
.statistics-item {
margin-top: 8px;
&:first-child {
margin-top: 0;
}
}
}
}
</style>
export const brandTypeList = [
{
showIconOnActiveOnly: true,
icon: "brand-icon|svg",
key: "1",
label: "问界鸿蒙-延保权益",
style: {
backgroundColor: "#fff",
},
},
{
showIconOnActiveOnly: true,
icon: "brand-icon|svg",
key: "2",
label: "通用品牌-延保权益",
style: {
backgroundColor: "#fff",
},
},
];
export const staticInfoList = [
{
key: "greenStoreCount",
background: "linear-gradient(90deg, #42CCCF 0%, #36D9A5 100%)",
label: "达标门店数",
},
{
key: "yellowStoreCount",
background: "linear-gradient(90deg, #7552FF 0%, #977DFF 100%)",
label: "需关注门店数",
},
{
key: "redStoreCount",
background: "linear-gradient(90deg, #3D76FC 0%, #4DA6FF 100%)",
label: "预警门店数",
},
];
<template> <template>
<div class="page-container" :style="{ backgroundImage: `url(${pageBgUrl})` }"> <div class="page-container"
<van-pull-refresh v-model="list.loading" lazy-render
@refresh="handleResetList"> :style="{ backgroundImage: `url(${pageBgUrl})` }">
<van-tabs> <van-tabs animated>
<van-tab title="督导业绩" /> <van-tab title="督导业绩">
<van-tab title="门店业绩" /> <SupervisorTabItem />
</van-tabs> </van-tab>
<div class="filter-wrapper"> <van-tab title="门店业绩">
<div class="brand-filter"> <StoreTabItem />
<BrandTabs v-model="list.query.statDimension" </van-tab>
:list="options.brandTypeList"
@change="getData()" />
</div>
<div class="date-filter">
<DateTypeTabs v-model="list.query.dateType" />
<DatePicker v-model="list.query.date"
style="margin-left:16px"
:type="options.dateType[list.query.dateType]"
@change="getData()" />
</div>
<!-- <div class="static-wrapper">
<StaticInfo :list="options.staticInfoList" />
</div> -->
<div class="search-wrapper">
<SearchInput v-model="list.query.searchKeyword" />
</div>
</div>
<div class="list-wrapper">
<div class="title-wrapper">
督导列表
</div>
<div class="container-wrapper">
<StatisticsItem v-for="(item, index) in list.data"
:key="index"
class="statistics-item"
:data="item"
:schema="options.supervisorSchemaList"
:sub-title="getItemSubTitle(item)"
:title="item.supervisorName"
@tap="handleTapItem" />
</div>
</div>
</van-pull-refresh>
</van-tabs>
</div> </div>
</template> </template>
<script> <script>
import dayjs from "dayjs"; import StoreTabItem from "../components/storeTabItem";
import { cloneDeep, throttle } from "lodash-es"; import SupervisorTabItem from "../components/supervisorTabItem";
import DatePicker from "@/components/datePicker/index.vue";
import DateTypeTabs from "@/components/dateTypeTabs/index.vue";
import SearchInput from "@/components/searchBar/index.vue";
import StaticInfo from "@/components/staticInfo/index.vue";
import { getSupervisorPerformance } from "@/views/performance/api";
import StatisticsItem from "@/views/performance/components/statisticsItem/statisticsItem.vue";
import BrandTabs from "../components/brandTabs/index.vue";
import { brandTypeList, staticInfoList, supervisorSchemaList } from "./index.data";
export default { export default {
name: "PerformanceOverview", name: "PerformanceOverview",
components: { components: {
BrandTabs, SupervisorTabItem,
DatePicker, StoreTabItem,
DateTypeTabs,
StaticInfo,
SearchInput,
StatisticsItem,
}, },
data() { data() {
return { return {
throttledFilterSearchKeyword: null,
pageBgUrl: "https://img02.glsx.com.cn/weapp/resource/supervise-wecom/page-bg.png", pageBgUrl: "https://img02.glsx.com.cn/weapp/resource/supervise-wecom/page-bg.png",
options: {
brandTypeList,
staticInfoList,
supervisorSchemaList,
dateType: {
// "date" | "week" | "year-month"
0: "date",
1: "week",
2: "year-month",
},
},
list: {
loading: false,
originData: [],
data: [],
query: {
dateType: 0,
statDimension: 1,
searchKeyword: "",
date: {
startDayjs: dayjs(),
},
},
},
}; };
}, },
watch: {
"list.query.searchKeyword": function () {
this.throttledFilterSearchKeyword();
},
},
created() { created() {
this.throttledFilterSearchKeyword = throttle(() => {
this.list.data = this.filterSearchKeyword();
}, 300);
}, },
async mounted() { async mounted() {
await this.getData();
},
beforeDestroy() {
this.throttledFilterSearchKeyword?.cancel?.();
}, },
methods: { methods: {
log() {
console.log("this.list.query", this.list.query);
},
getItemSubTitle(rows) {
return rows?.storeList?.map(i => i.merchantName).join("、");
},
getQuery() {
return {
...this.list.query,
startDate: this.list.query.date.startDate,
endDate: this.list.query.date.endDate,
date: undefined,
};
},
async getData() {
this.$loading.show();
try {
await this.$nextTick();
const list = await getSupervisorPerformance(this.getQuery());
this.list.originData = cloneDeep(list);
this.list.data = this.afterGetData(list);
} finally {
this.$loading.hide();
}
},
afterGetData(list) {
return this.filterSearchKeyword();
},
filterSearchKeyword(list) {
const keyword = (this.list.query.searchKeyword || "").trim();
if (!keyword) {
return this.list.originData;
}
return this.list.originData.filter(item => item?.supervisorName?.includes(keyword));
},
handleTapItem() {
this.$router.push({
name: "supervisorOutlet",
});
},
async handleResetList() {
this.list.loading = true;
await this.getData();
this.list.loading = false;
},
search() {},
}, },
}; };
</script> </script>
...@@ -177,14 +47,11 @@ export default { ...@@ -177,14 +47,11 @@ export default {
background-color: #f2f3f7; background-color: #f2f3f7;
box-sizing: border-box; box-sizing: border-box;
overflow: hidden; overflow: hidden;
::v-deep .van-pull-refresh {
height: 100%;
overflow: auto !important;
box-sizing: border-box;
}
::v-deep .van-tabs { ::v-deep .van-tabs {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
.van-tab { .van-tab {
flex: none; flex: none;
font-weight: 500; font-weight: 500;
...@@ -198,11 +65,19 @@ export default { ...@@ -198,11 +65,19 @@ export default {
&--active { &--active {
color: var(--themeColor); color: var(--themeColor);
} }
&__pane {
height: 100%;
overflow-y: hidden;
}
} }
&__wrap { &__wrap {
background-color: transparent; background-color: transparent;
padding: 0 12px; padding: 0 12px;
} }
&__content {
flex: 1;
overflow: hidden;
}
&__nav { &__nav {
background-color: transparent; background-color: transparent;
} }
...@@ -211,52 +86,5 @@ export default { ...@@ -211,52 +86,5 @@ export default {
width: 18px; width: 18px;
} }
} }
.filter-wrapper {
padding: 0 12px;
.brand-filter {
padding: 6px 0;
}
.date-filter {
padding: 8px 0;
width: 100%;
display: flex;
align-items: center;
}
.static-wrapper {
padding: 8px 0;
::v-deep .static-info {
padding: 0;
}
}
.search-wrapper {
padding: 8px 0;
.search-bar-wrapper {
padding: 0;
::v-deep .van-search {
padding: 0;
}
}
}
}
.list-wrapper {
padding: 0 12px 20px;
> .title-wrapper {
font-weight: 400;
font-size: 14px;
line-height: 14px;
color: #000000e5;
padding: 8px 0;
}
.container-wrapper {
margin-top: 4px;
.statistics-item {
margin-top: 8px;
&:first-child {
margin-top: 0;
}
}
}
}
} }
</style> </style>
...@@ -44,7 +44,6 @@ import SearchInput from "@/components/searchBar/index.vue"; ...@@ -44,7 +44,6 @@ import SearchInput from "@/components/searchBar/index.vue";
import StaticInfo from "@/components/staticInfo/index.vue"; import StaticInfo from "@/components/staticInfo/index.vue";
import StatisticsItem from "@/views/performance/components/statisticsItem/statisticsItem.vue"; import StatisticsItem from "@/views/performance/components/statisticsItem/statisticsItem.vue";
import BrandTabs from "../../components/brandTabs/index.vue"; import BrandTabs from "../../components/brandTabs/index.vue";
import { brandTypeList, staticInfoList, supervisorSchemaList } from "../index.data";
export default { export default {
name: "PerformanceOverview", name: "PerformanceOverview",
...@@ -59,9 +58,9 @@ export default { ...@@ -59,9 +58,9 @@ export default {
return { return {
pageBgUrl: "https://img02.glsx.com.cn/weapp/resource/supervise-wecom/page-bg.png", pageBgUrl: "https://img02.glsx.com.cn/weapp/resource/supervise-wecom/page-bg.png",
options: { options: {
brandTypeList, brandTypeList: [],
staticInfoList, staticInfoList: [],
supervisorSchemaList, supervisorSchemaList: [],
}, },
list: { list: {
loading: false, loading: false,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!