Commit 64817be0 by Jaxon

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

1 parent 78b6d601
......@@ -5,6 +5,7 @@
class="tab-section"
:class="{ isSticky }"
:style="{ background: customBackground }">
<div class="tab-slider" :style="tabSliderStyle"></div>
<div v-for="item in dateList"
:key="item.index"
class="tab"
......@@ -127,6 +128,13 @@ export default {
maxDateObj() {
return new Date(this.maxDate);
},
tabSliderStyle() {
const tabCount = this.dateList.length || 1;
return {
width: `calc((100% - 4px) / ${tabCount})`,
transform: `translateX(${this.dateCurrent * 100}%)`,
};
},
},
watch: {
tabSelected(n) {
......@@ -415,9 +423,10 @@ export default {
justify-content: center;
.tab-section {
position: relative;
overflow: hidden;
box-sizing: border-box;
width: 139px;
height: 28px;
display: flex;
align-items: center;
background: #ffffff;
......@@ -425,35 +434,47 @@ export default {
font-size: 13px;
color: #999999;
padding: 2px;
flex-shrink: 0;
.tab-slider {
position: absolute;
top: 2px;
left: 2px;
height: 24px;
border-radius: 24px;
background: #2c66f71a;
transition: transform 0.25s ease;
}
&.isSticky {
background: #f7f8fa;
}
.tab {
position: relative;
z-index: 1;
flex: 1;
text-align: center;
height: 24px;
line-height: 24px;
line-height: 26px;
border-radius: 24px;
transition: color 0.25s ease;
flex-shrink: 0;
&.active {
color: #2c66f7;
font-weight: 500;
background: #2c66f71a;
}
}
}
.date-section {
box-sizing: border-box;
height: 28px;
flex: 1;
// max-width: calc(100% - 139px);
display: flex;
align-items: center;
justify-content: space-between;
margin-left: 22px;
flex-shrink: 0;
.date-text {
font-family: "numberNor";
font-size: 13px;
......
......@@ -15,6 +15,14 @@ export const performance = [
showTabBar: true,
},
},
{
path: "supervisor-outlet",
name: "supervisorOutlet",
component: () => import("@/views/performance/view/supervisorOutlet/index.vue"),
meta: {
title: "门店业绩",
},
},
],
},
];
......@@ -11,6 +11,7 @@
:ref="`tab-${index}`"
class="tab-item"
:class="{ 'is-active': activeKey === item.key }"
:style="item.style"
@click="onTap(item, index)">
<SvgIcon v-if="shouldRenderSvgIcon(item)"
class="icon svg-icon-image"
......@@ -99,12 +100,12 @@ export default {
},
methods: {
syncFromProps() {
let nextActiveKey = this.getValidActiveKey({
const nextActiveKey = this.getValidActiveKey({
normalizedList: this.normalizedList,
value: this.value,
prevActiveKey: this.activeKey,
});
let nextActiveIndex = this.getIndexByKey(this.normalizedList, nextActiveKey);
const nextActiveIndex = this.getIndexByKey(this.normalizedList, nextActiveKey);
this.activeKey = nextActiveKey;
this.activeIndex = nextActiveIndex;
......@@ -118,59 +119,26 @@ export default {
if (!Array.isArray(list)) {
return [];
}
return list
.map((raw) => {
let item = raw || {};
let labelObject = item.label && typeof item.label === "object" ? item.label : null;
let key
= item.key != null ? item.key : item.value != null ? item.value : item.id != null ? item.id : labelObject ? (labelObject.key != null ? labelObject.key : labelObject.value) : undefined;
let label = labelObject
? labelObject.text != null
? labelObject.text
: labelObject.name != null
? labelObject.name
: labelObject.label != null
? labelObject.label
: labelObject.value != null
? labelObject.value
: labelObject.key
: item.label != null
? item.label
: item.text != null
? item.text
: item.name != null
? item.name
: "";
return {
icon: item.icon || "",
key,
label: label == null ? "" : String(label),
showIconOnActiveOnly: Boolean(item.showIconOnActiveOnly),
};
})
.filter((item) => {
return item.key !== undefined && item.key !== null;
})
.map((item) => {
return {
icon: item.icon,
key: String(item.key),
label: item.label,
showIconOnActiveOnly: item.showIconOnActiveOnly,
};
});
return list.map((raw) => {
const item = raw || {};
return {
icon: item.icon || "",
key: String(item.key),
label: item.label,
showIconOnActiveOnly: Boolean(item.showIconOnActiveOnly),
style: item.style || {},
};
});
},
getValidActiveKey(options) {
let normalizedList = options.normalizedList || [];
let value = options.value;
let prevActiveKey = options.prevActiveKey;
let keys = normalizedList.map((item) => {
const normalizedList = options.normalizedList || [];
const value = options.value;
const prevActiveKey = options.prevActiveKey;
const keys = normalizedList.map((item) => {
return item.key;
});
let nextValue = value === undefined || value === null ? null : String(value);
let prevValue = prevActiveKey === undefined || prevActiveKey === null ? null : String(prevActiveKey);
const nextValue = value === undefined || value === null ? null : String(value);
const prevValue = prevActiveKey === undefined || prevActiveKey === null ? null : String(prevActiveKey);
if (nextValue !== null && keys.includes(nextValue)) {
return nextValue;
......@@ -186,8 +154,8 @@ export default {
return 0;
}
let targetKey = String(key);
for (let i = 0; i < normalizedList.length; i += 1) {
const targetKey = String(key);
for (const i = 0; i < normalizedList.length; i += 1) {
if (normalizedList[i].key === targetKey) {
return i;
}
......@@ -196,7 +164,7 @@ export default {
return 0;
},
onTap(item, index) {
let nextKey = item && item.key != null ? String(item.key) : null;
const nextKey = item && item.key != null ? String(item.key) : null;
if (!nextKey || nextKey === this.activeKey) {
return;
}
......@@ -239,7 +207,7 @@ export default {
return;
}
let tabEl = this.getTabElement(this.activeIndex);
const tabEl = this.getTabElement(this.activeIndex);
if (!tabEl) {
return;
}
......@@ -252,15 +220,15 @@ export default {
return;
}
let wrapperEl = this.$refs.wrapper;
let tabEl = this.getTabElement(this.activeIndex);
const wrapperEl = this.$refs.wrapper;
const tabEl = this.getTabElement(this.activeIndex);
if (!wrapperEl || !tabEl) {
return;
}
let targetScrollLeft = tabEl.offsetLeft - (wrapperEl.clientWidth - tabEl.offsetWidth) / 2;
let maxScrollLeft = Math.max(wrapperEl.scrollWidth - wrapperEl.clientWidth, 0);
let nextScrollLeft = Math.max(0, Math.min(targetScrollLeft, maxScrollLeft));
const targetScrollLeft = tabEl.offsetLeft - (wrapperEl.clientWidth - tabEl.offsetWidth) / 2;
const maxScrollLeft = Math.max(wrapperEl.scrollWidth - wrapperEl.clientWidth, 0);
const nextScrollLeft = Math.max(0, Math.min(targetScrollLeft, maxScrollLeft));
wrapperEl.scrollTo({
left: nextScrollLeft,
......@@ -268,7 +236,7 @@ export default {
});
},
getTabElement(index) {
let ref = this.$refs["tab-" + index];
const ref = this.$refs["tab-" + index];
return Array.isArray(ref) ? ref[0] : ref;
},
bindResizeObserver() {
......@@ -276,7 +244,7 @@ export default {
return;
}
let tabsInner = this.$refs.tabsInner;
const tabsInner = this.$refs.tabsInner;
if (!tabsInner) {
return;
}
......@@ -313,8 +281,8 @@ export default {
display: inline-flex;
align-items: center;
min-width: 100%;
padding: 3px 0;
width: max-content;
padding: 3px;
box-sizing: border-box;
border-radius: 24px;
overflow: hidden;
......@@ -362,7 +330,7 @@ export default {
.tab-item.is-active {
color: #ffffff;
background: transparent;
background: transparent !important;
}
.tab-item + .tab-item {
......
<template>
<div class="statistics-item-wrapper"
:class="{
'is-tap': beTap,
'is-expand': expanded,
}"
@click="handleTapItem">
<div class="title-wrapper">
<div class="title-label-wrapper text-hide">
<div class="main-label text-hide">
張三
</div>
<div class="sub-label text-hide">
北京博福汽车4S店北京博福汽车4S店北京博福汽车4S店北京博福汽车4S店北京博福汽车4S店北京博福汽车4S店
</div>
</div>
<div class="title-info-wrapper">
<slot name="title-info">
</slot>
<slot name="title-info-icon">
<van-icon color="#000000E5"
name="arrow"
:size="16" />
</slot>
</div>
</div>
<van-row class="container" gutter="4">
<van-col v-for="item in defaultSchema"
:key="item.name"
class="van-col-wrapper"
:span="item.col">
<div class="item-wrapper" :style="item.style">
<div class="label text-hide ">
{{ item.label }}
</div>
<div class="value text-hide ">
{{ item.name }}
</div>
</div>
</van-col>
<van-col v-if="showMoreToggle" span="24">
<div class="more-collapse"
:style="{
height: expanded ? (`${moreHeight}px`) : '0px',
}">
<div class="more-inner">
<van-row gutter="4">
<van-col v-for="item in moreSchema"
:key="item.name"
class="van-col-wrapper"
:span="item.col">
<div class="item-wrapper" :style="item.style">
<div class="label text-hide ">
{{ item.label }}
</div>
<div class="value text-hide ">
{{ item.name }}
</div>
</div>
</van-col>
</van-row>
</div>
</div>
<!-- 用来记录高度 -->
<div class="more-measure">
<div ref="moreMeasureInner" class="more-inner">
<van-row gutter="4">
<van-col v-for="item in moreSchema"
:key="item.name"
class="van-col-wrapper"
:span="item.col">
<div class="item-wrapper" :style="item.style">
<div class="label text-hide ">
{{ item.label }}
</div>
<div class="value text-hide ">
{{ item.name }}
</div>
</div>
</van-col>
</van-row>
</div>
</div>
</van-col>
</van-row>
<div v-if="showMoreToggle"
class="toggle-wrapper"
@click.stop="onToggleMore">
{{ expanded ? '收起2项售后成交指标' : '已隐藏2项售后成交指标' }}
</div>
</div>
</template>
<script>
import { Col, Divider, Icon, Row } from "vant";
export default {
name: "",
components: {
[Col.name]: Col,
[Row.name]: Row,
[Divider.name]: Divider,
[Icon.name]: Icon,
},
props: {
schema: {
type: Array,
default: () => ([]),
},
beTap: {
type: Boolean,
default: true,
},
hasMore: {
type: Boolean,
default: true,
},
},
data() {
return {
expanded: false,
moreHeight: 0,
};
},
computed: {
defaultSchema() {
return this.schema.filter(item => !item.isMore);
},
moreSchema() {
return this.schema.filter(item => item.isMore);
},
showMoreToggle() {
return this.hasMore && this.moreSchema.length > 0;
},
},
watch: {
schema: {
handler() {
this.updateMoreHeight();
},
deep: true,
immediate: true,
},
},
mounted() {
this.updateMoreHeight();
},
methods: {
handleTapItem() {
this.$emit("tap");
},
onToggleMore() {
if (!this.showMoreToggle) {
return;
}
this.updateMoreHeight();
this.expanded = !this.expanded;
},
updateMoreHeight() {
this.$nextTick(() => {
const moreMeasureInner = this.$refs.moreMeasureInner;
this.moreHeight = moreMeasureInner ? moreMeasureInner.clientHeight : 0;
});
},
},
};
</script>
<style scoped lang="scss">
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.statistics-item-wrapper {
background-color: white;
padding: 8px;
box-sizing: border-box;
overflow: hidden;
border-radius: 12px;
position: relative;
transition: background 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
padding-bottom: 14px;
&.is-expand {
padding-bottom: 42px;
}
&.is-tap {
&:active {
background: rgb(252, 252, 252);
}
}
> .title-wrapper {
display: flex;
align-items: center;
padding: 8px 16px;
border-bottom: 1px solid #eeeef0;
overflow: hidden;
.title-label-wrapper {
flex-shrink: 0;
width: 45%;
font-weight: 500;
font-size: 14px;
line-height: 22px;
color: rgba(0, 0, 0, 0.9);
.sub-label {
font-weight: 400;
font-size: 10px;
line-height: 16px;
color: #00000066;
}
}
.title-info-wrapper {
flex: 1;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: flex-end;
overflow: hidden;
margin-left: 16px;
.sub-label {
font-weight: 400;
font-size: 14px;
line-height: 22px;
text-align: right;
flex: 1;
flex-shrink: 0;
color: rgba(0, 0, 0, 0.4);
}
.icon {
flex-shrink: 0;
width: 16px;
height: 16px;
margin-left: 8px;
display: flex;
align-items: center;
justify-content: flex-end;
}
}
}
.container {
overflow: hidden;
box-sizing: border-box;
border-radius: 8px;
margin-top: 8px;
}
}
.van-col-wrapper {
overflow: hidden;
.item-wrapper {
background: #f8f8f8;
padding: 8px 12px;
overflow: hidden;
box-sizing: border-box;
.label {
font-weight: 400;
font-size: 12px;
line-height: 20px;
color: rgba(0, 0, 0, 0.26);
}
.value {
margin-top: 4px;
font-family: D-numberNor;
font-weight: 500;
font-size: 16px;
line-height: 20px;
color: var(--themeColor);
}
}
}
.toggle-wrapper {
background-image: linear-gradient(top, rgba(255, 255, 255, 0.2) 15%, rgba(255, 255, 255, 0.6) 30%, #ffffff 100%);
padding: 6px 0;
position: absolute;
left: 0;
bottom: 4px;
width: 100%;
text-align: center;
font-size: 12px;
line-height: 20px;
color: #00000066;
}
.more-collapse {
overflow: hidden;
transition: height 300ms ease;
}
.more-measure {
position: absolute;
left: 0;
top: 0;
width: 100%;
visibility: hidden;
z-index: -1;
pointer-events: none;
}
</style>
export const brandTypeList = [
{
showIconOnActiveOnly: true,
icon: "brand-icon|svg",
key: "0",
label: "问界鸿蒙-延保权益",
},
{
showIconOnActiveOnly: true,
icon: "brand-icon|svg",
key: "1",
label: "通用品牌-延保权益",
},
];
export const brandTypeList = [
{
showIconOnActiveOnly: true,
icon: "brand-icon|svg",
key: "0",
label: "问界鸿蒙-延保权益",
style: {
backgroundColor: "#fff",
},
},
{
showIconOnActiveOnly: true,
icon: "brand-icon|svg",
key: "1",
label: "通用品牌-延保权益",
style: {
backgroundColor: "#fff",
},
},
];
export const staticInfoList = [
{
key: "",
background: "linear-gradient(90deg, #42CCCF 0%, #36D9A5 100%)",
label: "达标门店数",
},
{
key: "",
background: "linear-gradient(90deg, #7552FF 0%, #977DFF 100%)",
label: "需关注门店数",
},
{
key: "",
background: "linear-gradient(90deg, #3D76FC 0%, #4DA6FF 100%)",
label: "预警门店数",
},
];
export const supervisorSchemaList = [
{
name: "brandType",
label: "总产值",
col: 8,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "交付数",
col: 8,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "触客数",
col: 8,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "整车延保",
col: 6,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "安心包",
col: 6,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "电池",
col: 6,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "轮胎",
col: 6,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "整车延保售后成交/总成交",
col: 12,
isMore: true,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "安心包售后成交/总成交",
col: 12,
isMore: true,
style: "margin-bottom: 4px",
},
{
name: "brandType",
label: "电池售后成交/总成交",
col: 12,
isMore: true,
},
{
name: "brandType",
label: "轮胎售后成交/总成交",
col: 12,
isMore: true,
},
];
<template>
<div class="page-container" :style="{ backgroundImage: `url(${pageBgUrl})` }">
<van-tabs>
<van-tab title="督导业绩" />
<van-tab title="门店业绩" />
</van-tabs>
<div class="filter-wrapper">
<BrandTabs :list="options.brandTypeList" />
<van-pull-refresh v-model="list.loading"
@refresh="handleResetList">
<van-tabs>
<van-tab title="督导业绩" />
<van-tab title="门店业绩" />
</van-tabs>
<div class="filter-wrapper">
<div class="brand-filter">
<BrandTabs :list="options.brandTypeList" />
</div>
<div class="date-filter">
<DateSearch show-date-type-filter
:is-sticky="false"
:tab-selected="3"
@search="search">
</DateSearch>
</div>
<div class="static-wrapper">
<StaticInfo :list="options.staticInfoList" />
</div>
<div class="search-wrapper">
<SearchInput />
</div>
</div>
<div class="list-wrapper">
<div class="title-wrapper">
督导列表
</div>
<div class="container-wrapper">
<StatisticsItem v-for="(item, index) in 10"
:key="index"
class="statistics-item"
:schema="options.supervisorSchemaList"
@tap="handleTapItem" />
</div>
</div>
</van-pull-refresh>
</div>
</div>
</template>
<script>
import DateSearch from "@/components/dateSearch/dateSearch.vue";
import SearchInput from "@/components/searchBar/index.vue";
import StaticInfo from "@/components/staticInfo/index.vue";
import StatisticsItem from "@/views/performance/components/statisticsItem/statisticsItem.vue";
import BrandTabs from "../components/brandTabs/index.vue";
import { brandTypeList } from "./data";
import { brandTypeList, staticInfoList, supervisorSchemaList } from "./index.data";
export default {
name: "PerformanceOverview",
components: {
BrandTabs,
DateSearch,
StaticInfo,
SearchInput,
StatisticsItem,
},
data() {
return {
pageBgUrl: "https://img02.glsx.com.cn/weapp/resource/supervise-wecom/page-bg.png",
options: {
brandTypeList,
staticInfoList,
supervisorSchemaList,
},
list: {
loading: false,
data: [],
},
};
},
methods: {
handleTapItem() {
this.$router.push({
name: "supervisorOutlet",
});
},
handleResetList() {
this.list.loading = true;
setTimeout(() => {
this.list.loading = false;
}, 3000);
},
search() {},
},
};
</script>
<style lang="scss" scoped>
.page-container {
height: 100%;
background-position: 0 0;
background-size: 100% 240px;
background-repeat: no-repeat;
height: 100%;
padding-top: 12px;
.page-header {
display: flex;
align-items: center;
padding: 0 12px 12px;
}
background-color: #f2f3f7;
box-sizing: border-box;
overflow: hidden;
.page-title {
color: #3975c6;
font-size: 16px;
font-weight: 600;
line-height: 20px;
margin-left: 8px;
::v-deep .van-pull-refresh {
height: 100%;
overflow: auto !important;
box-sizing: border-box;
}
::v-deep .van-tabs {
......@@ -80,5 +134,49 @@ export default {
width: 18px;
}
}
.filter-wrapper {
padding: 0 12px;
.brand-filter {
padding: 6px 0;
}
.date-filter {
padding: 8px 0;
}
.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>
<template>
<div class="page-container" :style="{ backgroundImage: `url(${pageBgUrl})` }">
<van-pull-refresh v-model="list.loading"
@refresh="handleResetList">
<div class="filter-wrapper">
<div class="brand-filter">
<BrandTabs :list="options.brandTypeList" />
</div>
<div class="date-filter">
<DateSearch show-date-type-filter
:is-sticky="false"
:tab-selected="3"
@search="search">
</DateSearch>
</div>
<div class="static-wrapper">
<StaticInfo :list="options.staticInfoList" />
</div>
<div class="search-wrapper">
<SearchInput />
</div>
</div>
<div class="list-wrapper">
<div class="title-wrapper">
督导 - 门店列表
</div>
<div class="container-wrapper">
<StatisticsItem v-for="(item, index) in 10"
:key="index"
class="statistics-item"
:schema="options.supervisorSchemaList"
@tap="handleTapItem" />
</div>
</div>
</van-pull-refresh>
</div>
</template>
<script>
import DateSearch from "@/components/dateSearch/dateSearch.vue";
import SearchInput from "@/components/searchBar/index.vue";
import StaticInfo from "@/components/staticInfo/index.vue";
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 {
name: "PerformanceOverview",
components: {
BrandTabs,
DateSearch,
StaticInfo,
SearchInput,
StatisticsItem,
},
data() {
return {
pageBgUrl: "https://img02.glsx.com.cn/weapp/resource/supervise-wecom/page-bg.png",
options: {
brandTypeList,
staticInfoList,
supervisorSchemaList,
},
list: {
loading: false,
data: [],
},
};
},
methods: {
handleTapItem() {
this.$router.push({
name: "supervisorOutlet",
});
},
handleResetList() {
this.list.loading = true;
setTimeout(() => {
this.list.loading = false;
}, 3000);
},
search() {},
},
};
</script>
<style lang="scss" scoped>
.page-container {
height: 100%;
background-position: 0 0;
background-size: 100% 240px;
background-repeat: no-repeat;
background-color: #f2f3f7;
box-sizing: border-box;
overflow: hidden;
::v-deep .van-pull-refresh {
height: 100%;
overflow: auto !important;
box-sizing: border-box;
}
::v-deep .van-tabs {
.van-tab {
flex: none;
font-weight: 500;
line-height: 20px;
margin-left: 16px;
&:first-child {
margin-left: 0;
}
&__text {
}
&--active {
color: var(--themeColor);
}
}
&__wrap {
background-color: transparent;
padding: 0 12px;
}
&__nav {
background-color: transparent;
}
&__line {
bottom: 18px;
width: 18px;
}
}
.filter-wrapper {
padding: 0 12px;
.brand-filter {
padding: 6px 0;
}
.date-filter {
padding: 8px 0;
}
.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>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!