Commit c1c785ba by Jaxon

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

1 parent 76dfa9b3
Showing 47 changed files with 2791 additions and 30 deletions
// components/SearchInput/SearchInput.js // components/SearchInput/SearchInput.js
Component({ Component({
externalClasses: ['container-class', 'field-class', 'input-class'],
// options: { // options: {
// styleIsolation: 'shared' // styleIsolation: 'shared'
// }, // },
...@@ -81,4 +82,4 @@ Component({ ...@@ -81,4 +82,4 @@ Component({
}) })
} }
} }
})
\ No newline at end of file \ No newline at end of file
})
<view class="search-box" style="{{styleValue}}"> <view class="search-box container-class" style="{{styleValue}}">
<view class="search-input"> <view class="search-input field-class">
<block wx:if="{{!edit}}"> <block wx:if="{{!edit}}">
<view class="input {{value?'':'placeholder'}}" bindtap="open"> <view class="input input-class {{value?'':'placeholder'}}" bindtap="open">
<block wx:if="{{value}}"> <block wx:if="{{value}}">
{{value}} {{value}}
</block> </block>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</view> </view>
</block> </block>
<block wx:else> <block wx:else>
<input type="text" maxlength="{{maxlength}}" class="input" value='{{value}}' focus='{{inputFocus}}' confirm-type="search" bindinput='input' bindblur="inputBlur" bindconfirm="inputConfifm" /> <input type="text" maxlength="{{maxlength}}" class="input input-class" value='{{value}}' focus='{{inputFocus}}' confirm-type="search" bindinput='input' bindblur="inputBlur" bindconfirm="inputConfifm" />
</block> </block>
</view> </view>
</view>
\ No newline at end of file \ No newline at end of file
</view>
/* components/SearchInput/SearchInput.wxss */ /* components/SearchInput/SearchInput.wxss */
.search-box { .search-box {
height: var(--fontSize104); height: var(--fontSize104);
display: flex; display: flex;
align-items: center; align-items: center;
font-size: var(--fontSize28); font-size: var(--fontSize28);
width: 100%;
overflow: hidden;
} }
.search-box .search-input { .search-box .search-input {
width: 100%; width: 100%;
height: var(--fontSize72); height: var(--fontSize72);
background: #F7F8FA; background: #f7f8fa;
border-radius: var(--fontSize38); border-radius: var(--fontSize38);
color: #333; color: #333;
overflow: hidden;
} }
.search-input .input{ .search-input .input {
display: flex; display: flex;
align-items: center; align-items: center;
height: 100%; height: 100%;
width: 100%; width: 100%;
padding: 0 24rpx; padding: 0 24rpx;
} }
.search-input .icon{ .search-input .icon {
width: var(--fontSize28); width: var(--fontSize28);
height: var(--fontSize28); height: var(--fontSize28);
margin-right: var(--fontSize10); margin-right: var(--fontSize10);
}
.search-input .placeholder {
color: #c8c9cc;
} }
.search-input .placeholder{
color: #C8C9CC;
}
\ No newline at end of file \ No newline at end of file
Component({
properties: {
show: {
type: Boolean,
value: false,
observer(show) {
if (show) {
this.openTooltip();
return;
}
this.closeTooltip({ triggerEvent: false });
},
},
duration: {
type: Number,
value: 2000,
},
content: {
type: String,
value: "",
},
placement: {
type: String,
value: "top",
},
customStyle: {
type: String,
value: "",
},
},
data: {
rendered: false,
visible: false,
popperStyle: "",
arrowStyle: "",
currentPlacement: "top",
},
lifetimes: {
detached() {
this.clearAutoHideTimer();
this.clearCloseAnimationTimer();
},
},
methods: {
openTooltip() {
this.clearAutoHideTimer();
this.clearCloseAnimationTimer();
this.setData(
{
rendered: true,
visible: true,
popperStyle: "left: -9999px; top: -9999px;",
arrowStyle: "",
currentPlacement: this.properties.placement,
},
() => {
wx.nextTick(() => {
this.updatePopperPosition();
this.emitChange(true);
this.startAutoHideTimer();
});
},
);
},
show() {
this.openTooltip();
},
hide() {
this.closeTooltip();
},
handleTriggerTap() {
if (this.data.visible) {
this.closeTooltip();
return;
}
this.openTooltip();
},
preventTap() {},
updatePopperPosition() {
const query = this.createSelectorQuery();
query.select(".tooltip-reference").boundingClientRect();
query.select(".tooltip-popper").boundingClientRect();
query.exec((res) => {
const referenceRect = res && res[0];
const popperRect = res && res[1];
if (!referenceRect || !popperRect) {
return;
}
const systemInfo = wx.getSystemInfoSync();
const viewportWidth = systemInfo.windowWidth;
const viewportHeight = systemInfo.windowHeight;
const margin = this.rpxToPx(16, viewportWidth);
const gap = this.rpxToPx(16, viewportWidth);
const arrowSize = this.rpxToPx(20, viewportWidth);
const placement = this.getAvailablePlacement(this.properties.placement, referenceRect, popperRect, viewportWidth, viewportHeight, margin, gap);
const position = this.getPopperPosition(placement, referenceRect, popperRect, viewportWidth, viewportHeight, margin, gap, arrowSize);
this.setData({
popperStyle: `left: ${position.left}px; top: ${position.top}px;`,
arrowStyle: position.arrowStyle,
currentPlacement: placement,
});
});
},
getAvailablePlacement(placement, referenceRect, popperRect, viewportWidth, viewportHeight, margin, gap) {
const enoughMap = {
top: referenceRect.top >= popperRect.height + gap + margin,
bottom: viewportHeight - referenceRect.bottom >= popperRect.height + gap + margin,
left: referenceRect.left >= popperRect.width + gap + margin,
right: viewportWidth - referenceRect.right >= popperRect.width + gap + margin,
};
if (enoughMap[placement]) {
return placement;
}
const fallbackMap = {
top: ["bottom", "right", "left"],
bottom: ["top", "right", "left"],
left: ["right", "top", "bottom"],
right: ["left", "top", "bottom"],
};
const fallbackList = fallbackMap[placement] || ["top", "bottom", "right", "left"];
const target = fallbackList.find((item) => enoughMap[item]);
return target || placement;
},
getPopperPosition(placement, referenceRect, popperRect, viewportWidth, viewportHeight, margin, gap, arrowSize) {
let left = 0;
let top = 0;
if (placement === "top" || placement === "bottom") {
left = referenceRect.left + referenceRect.width / 2 - popperRect.width / 2;
left = Math.min(Math.max(left, margin), viewportWidth - popperRect.width - margin);
top = placement === "top" ? referenceRect.top - popperRect.height - gap : referenceRect.bottom + gap;
top = Math.min(Math.max(top, margin), viewportHeight - popperRect.height - margin);
const arrowLeft = referenceRect.left + referenceRect.width / 2 - left - arrowSize / 2;
const safeArrowLeft = Math.min(Math.max(arrowLeft, this.rpxToPx(24, viewportWidth)), popperRect.width - this.rpxToPx(24, viewportWidth) - arrowSize);
return {
left,
top,
arrowStyle: `left: ${safeArrowLeft}px;`,
};
}
top = referenceRect.top + referenceRect.height / 2 - popperRect.height / 2;
top = Math.min(Math.max(top, margin), viewportHeight - popperRect.height - margin);
left = placement === "left" ? referenceRect.left - popperRect.width - gap : referenceRect.right + gap;
left = Math.min(Math.max(left, margin), viewportWidth - popperRect.width - margin);
const arrowTop = referenceRect.top + referenceRect.height / 2 - top - arrowSize / 2;
const safeArrowTop = Math.min(Math.max(arrowTop, this.rpxToPx(24, viewportWidth)), popperRect.height - this.rpxToPx(24, viewportWidth) - arrowSize);
return {
left,
top,
arrowStyle: `top: ${safeArrowTop}px;`,
};
},
rpxToPx(rpx, windowWidth) {
return (Number(rpx) * windowWidth) / 750;
},
startAutoHideTimer() {
const duration = Number(this.properties.duration) || 0;
if (duration <= 0) {
return;
}
this.autoHideTimer = setTimeout(() => {
this.closeTooltip();
}, duration);
},
clearAutoHideTimer() {
if (!this.autoHideTimer) {
return;
}
clearTimeout(this.autoHideTimer);
this.autoHideTimer = null;
},
clearCloseAnimationTimer() {
if (!this.closeAnimationTimer) {
return;
}
clearTimeout(this.closeAnimationTimer);
this.closeAnimationTimer = null;
},
closeTooltip(options = {}) {
const { triggerEvent = true } = options;
this.clearAutoHideTimer();
if (!this.data.visible) {
if (triggerEvent) {
this.emitChange(false);
}
return;
}
this.clearCloseAnimationTimer();
this.setData(
{
visible: false,
},
() => {
this.closeAnimationTimer = setTimeout(() => {
this.setData(
{
rendered: false,
popperStyle: "",
arrowStyle: "",
currentPlacement: this.properties.placement,
},
() => {
if (triggerEvent) {
this.emitChange(false);
}
},
);
this.closeAnimationTimer = null;
}, 100);
},
);
},
emitChange(show) {
if (!show) {
this.triggerEvent("close");
}
this.triggerEvent("change", { show });
},
},
});
{
"component": true,
"usingComponents": {}
}
.tooltip-wrapper {
position: relative;
display: inline-flex;
box-sizing: border-box;
width: 100%;
}
.tooltip-reference {
display: inline-flex;
box-sizing: border-box;
width: 100%;
}
.tooltip-popper {
position: fixed;
z-index: 9999;
max-width: 560rpx;
min-width: 180rpx;
opacity: 0;
transition: opacity 100ms ease;
}
.tooltip-popper-visible {
opacity: 1;
}
.tooltip-inner {
padding: 24rpx 28rpx;
box-sizing: border-box;
background: #ffffff;
border-radius: 16rpx;
box-shadow: 0 12rpx 40rpx rgba(0, 0, 0, 0.12);
color: #333333;
line-height: 1.5;
word-break: break-all;
}
.tooltip-arrow {
position: absolute;
width: 20rpx;
height: 20rpx;
background: #ffffff;
transform: rotate(45deg);
box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.08);
}
.tooltip-top {
}
.tooltip-top .tooltip-arrow {
bottom: -8rpx;
transform: rotate(45deg);
}
.tooltip-bottom {
}
.tooltip-bottom .tooltip-arrow {
top: -8rpx;
transform: rotate(45deg);
}
.tooltip-left {
}
.tooltip-left .tooltip-arrow {
right: -8rpx;
transform: rotate(45deg);
}
.tooltip-right {
}
.tooltip-right .tooltip-arrow {
left: -8rpx;
transform: rotate(45deg);
}
<view class="tooltip-wrapper">
<view class="tooltip-reference" catchtap="handleTriggerTap">
<slot></slot>
</view>
<view wx:if="{{ rendered }}"
class="tooltip-popper tooltip-{{ currentPlacement }} {{ visible ? 'tooltip-popper-visible' : '' }}"
style="{{ popperStyle }}{{ customStyle }}"
catchtap="preventTap">
<view class="tooltip-arrow" style="{{ arrowStyle }}"></view>
<view class="tooltip-inner">
<text class="tooltip-text">{{ content }}</text>
</view>
</view>
</view>
const DEFAULT_BREAKPOINTS = {
xs: 0,
sm: 375,
md: 768,
lg: 1024,
};
Component({
externalClasses: ["custom-class"],
options: {
virtualHost: true,
styleIsolation: "apply-shared",
},
relations: {
"../venusRow/venusRow": {
type: "ancestor",
},
},
properties: {
span: {
type: null,
value: 24,
observer() {
this.syncCol();
},
},
offset: {
type: Number,
value: 0,
observer() {
this.syncCol();
},
},
align: {
type: String,
value: "stretch",
observer() {
this.syncCol();
},
},
customStyle: {
type: String,
value: "",
observer() {
this.syncCol();
},
},
clickable: {
type: Boolean,
value: false,
observer() {
this.syncCol();
},
},
contentSpan: {
type: Number,
value: 24,
observer() {
this.syncCol();
},
},
responsive: {
type: Object,
value: null,
observer() {
this.syncCol();
},
},
},
data: {
itemClass: "",
itemStyleText: "",
clickable: false,
currentBreakpoint: "xs",
},
lifetimes: {
attached() {
this.syncCol();
},
},
methods: {
updateFromRow(rowContext) {
this.rowContext = rowContext || null;
this.syncCol();
},
getParentRow() {
const rows = this.getRelationNodes("../venusRow/venusRow") || [];
return rows[0] || null;
},
getStandaloneContext() {
const width = this.getWindowWidth();
const breakpoints = DEFAULT_BREAKPOINTS;
return {
columns: 24,
breakpoints,
viewportWidth: width,
activeBreakpoint: this.getActiveBreakpoint(width, breakpoints),
};
},
getWindowWidth() {
const info = typeof wx.getWindowInfo === "function" ? wx.getWindowInfo() : wx.getSystemInfoSync();
return Number(info.windowWidth || info.screenWidth || 375);
},
syncCol() {
const rowContext = this.rowContext || this.getStandaloneContext();
const config = this.resolveConfig(rowContext);
const columns = this.normalizeColumns(rowContext.columns);
const isContent = config.span === "content";
const span = isContent ? this.normalizeSpan(config.contentSpan, columns) : this.normalizeSpan(config.span, columns);
const offset = this.normalizeOffset(config.offset, columns);
const align = this.normalizeAlign(config.align || (isContent ? "start" : "stretch"));
const clickable = Boolean(config.clickable);
const itemClassList = [];
if (isContent) itemClassList.push("is-content");
if (clickable) itemClassList.push("is-clickable");
const itemStyleList = [`grid-column-end:span ${span}`, `justify-self:${align}`, "min-width:0", "box-sizing:border-box"];
if (offset > 0) {
itemStyleList.push(`grid-column-start:${offset + 1}`);
}
if (isContent) {
itemStyleList.push("width:fit-content");
itemStyleList.push("max-width:100%");
}
if (config.customStyle) {
itemStyleList.push(config.customStyle);
}
this.currentConfig = config;
this.setData({
itemClass: itemClassList.join(" "),
itemStyleText: itemStyleList.join(";"),
clickable,
currentBreakpoint: rowContext.activeBreakpoint || "xs",
});
},
resolveConfig(rowContext) {
let config = {
span: this.properties.span,
offset: this.properties.offset,
align: this.properties.align,
customStyle: this.properties.customStyle,
clickable: this.properties.clickable,
contentSpan: this.properties.contentSpan,
};
const responsive = this.properties.responsive;
if (responsive && typeof responsive === "object") {
const merged = {};
this.getSortedBreakpoints(rowContext.breakpoints).forEach((point) => {
const pointConfig = responsive[point.key];
if (rowContext.viewportWidth >= point.value && this.isPlainObject(pointConfig)) {
Object.assign(merged, pointConfig);
}
});
config = Object.assign({}, config, merged);
}
return config;
},
onTap() {
if (!this.data.clickable) return;
const detail = {
item: this.currentConfig || {},
breakpoint: this.data.currentBreakpoint,
};
this.triggerEvent("itemtap", detail);
const row = this.getParentRow();
if (row && typeof row.emitItemTap === "function") {
row.emitItemTap(detail);
}
},
normalizeColumns(value) {
const columns = Number(value);
if (!Number.isFinite(columns)) return 24;
return Math.max(1, Math.round(columns));
},
normalizeSpan(value, columns) {
const span = Number(value);
if (!Number.isFinite(span)) return columns;
return Math.min(columns, Math.max(1, Math.round(span)));
},
normalizeOffset(value, columns) {
const offset = Number(value);
if (!Number.isFinite(offset)) return 0;
return Math.min(Math.max(columns - 1, 0), Math.max(0, Math.round(offset)));
},
normalizeAlign(value) {
const alignMap = {
start: "start",
center: "center",
end: "end",
stretch: "stretch",
};
return alignMap[value] || "stretch";
},
getActiveBreakpoint(width, breakpoints) {
const list = this.getSortedBreakpoints(breakpoints);
if (!list.length) return "xs";
let activeKey = list[0].key;
list.forEach((item) => {
if (width >= item.value) {
activeKey = item.key;
}
});
return activeKey;
},
getSortedBreakpoints(breakpoints) {
return Object.keys(breakpoints || {})
.map((key) => ({
key,
value: Number(breakpoints[key]),
}))
.filter((item) => Number.isFinite(item.value))
.sort((a, b) => a.value - b.value);
},
isPlainObject(value) {
return !!value && Object.prototype.toString.call(value) === "[object Object]";
},
},
});
.venus-col {
min-width: 0;
box-sizing: border-box;
&.is-content {
max-width: 100%;
}
}
.venus-col--active {
opacity: 0.92;
}
<view class="venus-col custom-class {{ itemClass }}"
style="{{ itemStyleText }}"
hover-class="{{ clickable ? 'venus-col--active' : '' }}"
bind:tap="onTap">
<slot></slot>
</view>
const DEFAULT_BREAKPOINTS = {
xs: 0,
sm: 375,
md: 768,
lg: 1024,
};
Component({
externalClasses: ["custom-class"],
options: {
styleIsolation: "apply-shared",
},
relations: {
"../venusCol/venusCol": {
type: "descendant",
linked() {
this.notifyChildren();
},
linkChanged() {
this.notifyChildren();
},
unlinked() {
this.notifyChildren();
},
},
},
properties: {
columns: {
type: Number,
value: 24,
observer() {
this.syncRow();
},
},
gap: {
type: null,
value: [0, 0],
observer() {
this.syncRow();
},
},
dense: {
type: Boolean,
value: false,
observer() {
this.syncRow();
},
},
breakpoints: {
type: Object,
value: DEFAULT_BREAKPOINTS,
observer() {
this.syncRow();
},
},
},
data: {
rowStyle: "",
activeBreakpoint: "xs",
viewportWidth: 0,
},
lifetimes: {
attached() {
this.bindWindowResize();
this.syncRow();
},
detached() {
this.unbindWindowResize();
},
},
methods: {
bindWindowResize() {
if (typeof wx.onWindowResize !== "function" || this.resizeHandler) return;
this.resizeHandler = (res) => {
const size = (res && res.size) || {};
const width = Number(size.windowWidth || res.windowWidth || this.getWindowWidth());
if (width && width !== this.data.viewportWidth) {
this.syncRow(width);
}
};
wx.onWindowResize(this.resizeHandler);
},
unbindWindowResize() {
if (!this.resizeHandler || typeof wx.offWindowResize !== "function") return;
wx.offWindowResize(this.resizeHandler);
this.resizeHandler = null;
},
getWindowWidth() {
const info = typeof wx.getWindowInfo === "function" ? wx.getWindowInfo() : wx.getSystemInfoSync();
return Number(info.windowWidth || info.screenWidth || 375);
},
syncRow(forcedWidth) {
const columns = this.normalizeColumns(this.properties.columns);
const viewportWidth = Number(forcedWidth || this.getWindowWidth()) || 375;
const activeBreakpoint = this.getActiveBreakpoint(viewportWidth, this.properties.breakpoints);
const rowStyle = this.buildRowStyle(columns, this.properties.gap, this.properties.dense);
this.setData(
{
rowStyle,
activeBreakpoint,
viewportWidth,
},
() => {
this.notifyChildren();
},
);
},
buildRowStyle(columns, gap, dense) {
const normalizedGap = this.normalizeGap(gap);
return [
"display:grid",
"width:100%",
"box-sizing:border-box",
"align-items:start",
`grid-template-columns:repeat(${columns}, minmax(0, 1fr))`,
`column-gap:${normalizedGap.columnGap}`,
`row-gap:${normalizedGap.rowGap}`,
`grid-auto-flow:${dense ? "row dense" : "row"}`,
].join(";");
},
notifyChildren() {
const children = this.getRelationNodes("../venusCol/venusCol") || [];
const context = {
columns: this.normalizeColumns(this.properties.columns),
breakpoints: this.properties.breakpoints,
activeBreakpoint: this.data.activeBreakpoint,
viewportWidth: this.data.viewportWidth || this.getWindowWidth(),
};
children.forEach((child) => {
if (child && typeof child.updateFromRow === "function") {
child.updateFromRow(context);
}
});
},
emitItemTap(detail) {
this.triggerEvent("itemtap", detail);
},
normalizeColumns(value) {
const columns = Number(value);
if (!Number.isFinite(columns)) return 24;
return Math.max(1, Math.round(columns));
},
normalizeGap(value) {
let columnGap = "0rpx";
let rowGap = "0rpx";
if (Array.isArray(value)) {
columnGap = this.toCssSize(value[0]);
rowGap = this.toCssSize(value.length > 1 ? value[1] : value[0]);
} else if (value && typeof value === "object") {
columnGap = this.toCssSize(value.x != null ? value.x : value.column);
rowGap = this.toCssSize(value.y != null ? value.y : value.row);
} else {
columnGap = this.toCssSize(value);
rowGap = this.toCssSize(value);
}
return {
columnGap,
rowGap,
};
},
toCssSize(value) {
if (value == null || value === "") return "0rpx";
if (typeof value === "number") return `${value}rpx`;
if (typeof value !== "string") return "0rpx";
if (/^-?\d+(\.\d+)?$/.test(value)) {
return `${value}rpx`;
}
return value;
},
getActiveBreakpoint(width, breakpoints) {
const list = this.getSortedBreakpoints(breakpoints);
if (!list.length) return "xs";
let activeKey = list[0].key;
list.forEach((item) => {
if (width >= item.value) {
activeKey = item.key;
}
});
return activeKey;
},
getSortedBreakpoints(breakpoints) {
return Object.keys(breakpoints || {})
.map((key) => ({
key,
value: Number(breakpoints[key]),
}))
.filter((item) => Number.isFinite(item.value))
.sort((a, b) => a.value - b.value);
},
},
});
.venus-row {
width: 100%;
box-sizing: border-box;
}
<view class="venus-row custom-class" style="{{ rowStyle }}">
<slot></slot>
</view>
import api from "~/utils/request/request.js";
// 盯防驻店销售业绩接口
export function getSupervisorStaffApi(data) {
return api.post("dj.api.supervisor.staff.performance", data, [], "/rop-dj-supervisor-mini/router");
}
// 盯防门店业绩接口
export function getSupervisorStoreApi(data) {
return api.post("dj.api.supervisor.store.performance", data, [], "/rop-dj-supervisor-mini/router");
}
// components/dateScreen/dateScreen.js
Component({
options: {
multipleSlots: true,
},
/**
* 组件的属性列表
*/
properties: {
// hideColon 是否隐藏colon , 默认false
// name : - 唯一key , 数据的键值
// label : 文案
// col : 占24分之几
// valueWidth : 值的宽度,默认为100%
// labelWidth : 标签宽度,默认为150px
// slot : 整体的插槽名,优先级高于name
// itemStyle: 每一项的样式
// tooltip: boolean 是否用tooltip 展示data数据
// tooltipProps: el-tooltip 的传参
// render ?:(h,{ data,schemaItem,schema } )=>{} 自定义渲染
// isHide 是否隐藏 (data)=>boolean || boolean
// parentProps:{
// className:'text-hide' // 默认
// },
schema: {
type: Array,
value: [],
observer: function (schema) {
const hasMore = Array.isArray(schema) && schema.some((item) => item && item.isMore);
this.setData({
hasMore,
expanded: hasMore ? this.data.expanded : false,
});
this.measureMoreHeight();
},
},
data: {
type: Object,
value: {},
},
title: {
type: String,
value: "",
},
beTap: {
type: Boolean,
value: true,
},
hideValue: {
type: String,
value: "2",
},
},
/**
* 组件的初始数据
*/
data: {
expanded: false,
hasMore: false,
moreHeight: 0,
tooltipIconPath: "/images/tips-icon.png",
},
lifetimes: {
ready() {
this.measureMoreHeight();
},
},
/**
* 组件的方法列表
*/
methods: {
onToggleMore() {
if (!this.data.hasMore) return;
if (this.data.expanded) {
this.setData({ expanded: false });
return;
}
this.measureMoreHeight(() => {
this.setData({ expanded: true });
});
},
handleTapItem() {
this.triggerEvent("tapItem", {
// item: this.data.normalizedList[nextIndex],
});
},
measureMoreHeight(done) {
wx.nextTick(() => {
const query = this.createSelectorQuery().in(this);
query.select("#moreMeasureInner").boundingClientRect();
query.exec((res) => {
const rect = res && res[0];
const height = Math.max(0, Math.round((rect && rect.height) || 0));
console.log(height);
if (height !== this.data.moreHeight) {
this.setData({ moreHeight: height }, () => {
if (typeof done === "function") done();
});
return;
}
if (typeof done === "function") done();
});
});
},
},
});
{
"component": true,
"usingComponents": {
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index",
"van-divider": "@vant/weapp/divider/index",
"van-icon": "@vant/weapp/icon/index",
"Tooltip": "/components/tooltip/tooltip",
"VenusCol": "/components/venusCol/venusCol",
"VenusRow": "/components/venusRow/venusRow"
}
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.statistics-item-wrapper {
background-color: white;
padding: var(--fontSize16) 0;
box-sizing: border-box;
overflow: hidden;
border-radius: var(--fontSize24);
position: relative;
transition: background 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
&.is-tap {
&:active {
background: rgb(252, 252, 252);
}
}
.title-wrapper {
display: flex;
align-items: center;
padding: var(--fontSize16) var(--fontSize32);
border-bottom: 1px solid #eeeef0;
overflow: hidden;
.title-label-wrapper {
flex-shrink: 0;
flex: 1;
overflow: hidden;
margin-right: var(--fontSize32);
.title-label {
font-weight: 500;
font-size: var(--fontSize28);
line-height: var(--fontSize44);
color: rgba(0, 0, 0, 0.9);
}
.title-sub-label {
font-weight: 400;
font-size: 10px;
line-height: 16px;
color: #00000066;
&:empty + .title-sub-label__default {
display: block;
}
&__default {
display: none;
font-weight: 400;
font-size: 10px;
line-height: 16px;
color: #00000066;
}
}
}
.title-right-wrapper {
max-width: 50%;
display: flex;
align-items: center;
justify-content: flex-end;
overflow: hidden;
.title-right-content {
&:empty + .title-right-content__default {
display: flex;
align-items: center;
.right-item {
text-align: center;
margin-left: var(--fontSize24);
&:first-child {
margin-left: 0;
}
.value {
font-family: numberBold;
font-weight: 700;
font-style: Bold;
font-size: 20px;
line-height: 20px;
text-align: center;
color: var(--primary-color);
}
.label {
font-weight: 400;
font-size: 10px;
line-height: 16px;
text-align: center;
color: #00000042;
}
}
}
&__default {
display: none;
flex: 1;
flex-shrink: 0;
flex-basis: 0;
}
}
.arrow-right {
flex-shrink: 0;
flex-basis: 0;
margin-left: var(--fontSize32);
}
}
}
.schema-wrapper {
padding: 0 var(--fontSize32) var(--fontSize10);
box-sizing: border-box;
&.is-expanded {
padding-bottom: var(--fontSize48);
}
.grid-container {
margin-top: var(--fontSize16);
border-radius: var(--fontSize16);
overflow: hidden;
position: relative;
}
}
}
.col-wrapper {
overflow: hidden;
.item-wrapper {
background: rgba(248, 248, 248, 1);
padding: var(--fontSize16) var(--fontSize20);
overflow: hidden;
box-sizing: border-box;
width: 100%;
&.tooltip-wrapper {
.label {
display: flex;
align-items: center;
.icon {
width: 16px;
height: 16px;
margin-left: var(--fontSize8);
flex-shrink: 0;
}
}
}
.label {
font-weight: 400;
font-size: var(--fontSize24);
line-height: var(--fontSize40);
color: rgba(0, 0, 0, 0.26);
}
.value {
margin-top: var(--fontSize8);
font-family: numberNor;
font-weight: 500;
font-size: var(--fontSize32);
line-height: var(--fontSize40);
color: var(--primary-color);
}
}
}
.toggle-more-wrapper {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
text-align: center;
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.5) 15%, rgba(255, 255, 255, 0.7) 30%, #ffffff 100%);
}
.toggle-icon {
margin-left: var(--fontSize4);
transform: rotate(90deg);
transition: transform 300ms ease;
}
.toggle-icon.is-expanded {
transform: rotate(-90deg);
}
.toggle-more-content {
display: flex;
align-items: center;
justify-content: center;
padding: var(--fontSize16) 0;
color: rgba(0, 0, 0, 0.9);
font-size: var(--fontSize24);
line-height: var(--fontSize40);
}
.toggle-more-text {
line-height: inherit;
font-weight: 400;
font-size: var(--fontSize24);
line-height: var(--fontSize40);
color: #00000066;
}
.more-collapse {
overflow: hidden;
transition: height 300ms ease;
}
.more-inner {
overflow: hidden;
}
.more-measure {
position: absolute;
left: 0;
top: 0;
width: 100%;
visibility: hidden;
z-index: -1;
pointer-events: none;
}
<view class="statistics-item-wrapper {{ beTap ? 'is-tap' : '' }}"
bind:tap="handleTapItem">
<view class="title-wrapper">
<view class="title-label-wrapper ">
<view class="title-label text-hide">
{{ title }}
</view>
<view class="title-sub-label">
<slot name="title-sub"></slot>
</view>
<view class="title-sub-label__default text-hide"></view>
</view>
<view class="title-right-wrapper">
<view class="title-right-content">
<slot name="title-right"></slot>
</view>
<view class="title-right-content__default">
<view class="right-item"
wx:for="{{ schema }}"
wx:key="index"
wx:if="{{ item.titleInfo }}">
<view class="value">
{{ data[item.name] }}
</view>
<view class="label">
{{ item.label }}
</view>
</view>
</view>
<van-icon wx:if="{{ beTap }}"
class="arrow-right"
name="arrow" />
</view>
</view>
<view class="schema-wrapper {{ expanded ? 'is-expanded' : '' }}">
<VenusRow custom-class="grid-container " gap="4">
<VenusCol wx:for="{{ schema }}"
wx:key="index"
wx:if="{{ !item.isMore && !item.titleInfo }}"
span="{{ item.col }}"
contentSpan="{{ item.contentSpan || 24 }}"
custom-class="col-wrapper">
<Tooltip duration="{{ 2000 }}"
wx:if="{{ item.tips }}"
placement="top"
content="{{ item.tips }}">
<view class="item-wrapper tooltip-wrapper" style="{{ item.style }}">
<view class="label text-hide ">
{{ item.label }}
<image class="icon"
src="{{ tooltipIconPath }}"
mode="aspectFit" />
</view>
<view class="value text-hide ">
{{ data[item.name] }}
</view>
</view>
</Tooltip>
<view wx:else
class="item-wrapper"
style="{{ item.style }}">
<view class="label text-hide ">
{{ item.label }}
</view>
<view class="value text-hide ">
{{ data[item.name] }}
</view>
</view>
</VenusCol>
<VenusCol wx:for="{{ schema }}"
wx:key="index"
wx:if="{{ item.isMore }}"
span="{{ item.col }}"
contentSpan="{{ item.contentSpan || 24 }}"
custom-class="col-wrapper">
<view class="more-collapse"
style="height: {{ expanded ? (moreHeight + 'px') : '0px' }};">
<view id="moreInner" class="more-inner">
<view class="item-wrapper" style="{{ item.style }}">
<view class="label text-hide ">
{{ item.label }}
</view>
<view class="value text-hide ">
{{ data[item.name] }}
</view>
</view>
</view>
</view>
</VenusCol>
</VenusRow>
<VenusRow custom-class="more-measure" gap="4">
<VenusCol wx:for="{{ schema }}"
wx:key="index"
wx:if="{{ item.isMore }}"
span="{{ item.col }}"
contentSpan="{{ item.contentSpan || 24 }}"
custom-class="col-wrapper">
<view id="moreMeasureInner" class="more-inner">
<view class="item-wrapper" style="{{ item.style }}">
<view class="label text-hide ">
{{ item.label }}
</view>
<view class="value text-hide ">
{{ data[item.name] }}
</view>
</view>
</view>
</VenusCol>
</VenusRow>
<view class="toggle-more-wrapper"
catch:tap="onToggleMore"
wx:if="{{ hasMore }}">
<view class="toggle-more-content">
<view class="toggle-more-text">
已隐藏{{ hideValue }}项售后成交指标
</view>
<van-icon name="play"
size="12px"
color="#A2A6B1"
custom-class="toggle-icon {{ expanded ? 'is-expanded' : '' }}" />
</view>
</view>
</view>
<!-- <van-row custom-class="container {{ expanded ? 'is-expanded' : '' }}">
<van-col wx:for="{{ schema }}"
wx:key="index"
wx:if="{{ !item.isMore }}"
span="{{ item.col }}"
custom-class="col-wrapper">
<Tooltip duration="{{ 2000 }}"
placement="top"
content="asdasd">
<view class="item-wrapper" style="{{ item.style }}">
<view class="label text-hide ">
{{ item.label }}
</view>
<view class="value text-hide ">
{{ item.name }}
</view>
</view>
</Tooltip>
</van-col>
<van-col span="24" wx:if="{{ hasMore }}">
<view class="more-collapse"
style="height: {{ expanded ? (moreHeight + 'px') : '0px' }};">
<view id="moreInner" class="more-inner">
<van-row gutter="4">
<van-col wx:for="{{ schema }}"
wx:key="index"
wx:if="{{ item.isMore }}"
span="{{ item.col }}"
custom-class="col-wrapper">
<view class="item-wrapper" style="{{ item.style }}">
<view class="label text-hide ">
{{ item.label }}
</view>
<view class="value text-hide ">
{{ item.name }}
</view>
</view>
</van-col>
</van-row>
</view>
</view>
<view class="more-measure">
<view id="moreMeasureInner" class="more-inner">
<van-row>
<van-col wx:for="{{ schema }}"
wx:key="index"
wx:if="{{ item.isMore }}"
span="{{ item.col }}"
custom-class="col-wrapper">
<view class="item-wrapper" style="{{ item.style }}">
<view class="label text-hide ">
{{ item.label }}
</view>
<view class="value text-hide ">
{{ item.name }}
</view>
</view>
</van-col>
</van-row>
</view>
</view>
</van-col>
<view class="toggle-more-wrapper"
catch:tap="onToggleMore"
wx:if="{{ hasMore }}">
<view class="toggle-more-content">
<view class="toggle-more-text">
查看更多
</view>
<van-icon name="play"
size="12px"
color="#A2A6B1"
custom-class="toggle-icon {{ expanded ? 'is-expanded' : '' }}" />
</view>
</view>
</van-row> -->
</view>
// components/dateScreen/dateScreen.js
Component({
options: {
multipleSlots: true,
},
/**
* 组件的属性列表
*/
properties: {
// hideColon 是否隐藏colon , 默认false
// name : - 唯一key , 数据的键值
// label : 文案
// col : 占24分之几
// valueWidth : 值的宽度,默认为100%
// labelWidth : 标签宽度,默认为150px
// slot : 整体的插槽名,优先级高于name
// itemStyle: 每一项的样式
// tooltip: boolean 是否用tooltip 展示data数据
// tooltipProps: el-tooltip 的传参
// render ?:(h,{ data,schemaItem,schema } )=>{} 自定义渲染
// isHide 是否隐藏 (data)=>boolean || boolean
// parentProps:{
// className:'text-hide' // 默认
// },
itemSchemaList: {},
title: {},
itemTitleKey: {
type: String,
value: "employeeName",
},
list: {
type: Array,
value: [],
},
},
lifetimes: {
ready() {},
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
handleTapItem() {
this.triggerEvent("tapItem", {});
},
},
});
{
"component": true,
"usingComponents": {
"StatisticsItem": "../statisticsItem/statisticsItem"
}
}
.statisticsList-wrapper {
.title-wrapper {
font-weight: 400;
font-size: var(--fontSize28);
line-height: var(--fontSize28);
padding: var(--fontSize16) var(--fontSize24);
}
.container-wrapper {
padding: 0 var(--fontSize24) var(--fontSize16);
.item-wrapper {
margin-bottom: 8px;
}
}
}
<view class="statisticsList-wrapper">
<view class="title-wrapper">
{{ title }}
</view>
<view class="container-wrapper">
<view class="item-wrapper"
wx:for="{{ list }}"
wx:key="index">
<StatisticsItem data="{{ item }}"
title="{{ item[itemTitleKey] }}"
bind:tapItem="handleTapItem"
schema="{{ itemSchemaList }}" />
</view>
</view>
</view>
// components/dateScreen/dateScreen.js
Component({
/**
* 组件的属性列表
*/
properties: {
list: {
type: Array,
value: [],
observer: function () {
this.syncFromProps();
},
},
value: {
type: null,
value: null,
observer: function () {
this.syncFromProps();
},
},
},
lifetimes: {
ready() {
this.syncFromProps();
},
},
/**
* 组件的初始数据
*/
data: {
normalizedList: [],
activeKey: null,
activeIndex: 0,
sliderX: 0,
sliderWidth: 0,
scrollIntoView: "",
},
/**
* 组件的方法列表
*/
methods: {
syncFromProps() {
const normalizedList = this.normalizeList(this.properties.list);
let activeKey = this.getValidActiveKey({
normalizedList,
value: this.properties.value,
prevActiveKey: this.data.activeKey,
});
const activeIndex = this.getIndexByKey(normalizedList, activeKey);
const shouldAutoScroll = normalizedList.length > 2;
this.setData(
{
normalizedList,
activeKey,
activeIndex,
scrollIntoView: shouldAutoScroll && activeIndex > -1 ? `type-tab-${activeIndex}` : "",
},
() => {
this.updateSlider();
},
);
},
normalizeList(list) {
if (!Array.isArray(list)) return [];
return list
.map((raw) => {
const item = raw || {};
const key = item.key ?? item.value ?? item.id ?? (item.label && typeof item.label === "object" ? (item.label.key ?? item.label.value) : undefined);
const label = typeof item.label === "object" ? (item.label.text ?? item.label.name ?? item.label.label ?? item.label.value ?? item.label.key) : (item.label ?? item.text ?? item.name ?? "");
return {
icon: item.icon || "",
key,
label: label == null ? "" : String(label),
showIconOnActiveOnly: Boolean(item.showIconOnActiveOnly),
};
})
.filter((it) => it.key !== undefined && it.key !== null)
.map((it) => ({
...it,
key: String(it.key),
}));
},
getValidActiveKey({ normalizedList, value, prevActiveKey }) {
const keys = normalizedList.map((it) => it.key);
const val = value === undefined || value === null ? null : String(value);
if (val != null && keys.includes(val)) return val;
if (prevActiveKey != null && keys.includes(String(prevActiveKey))) return String(prevActiveKey);
return normalizedList[0]?.key ?? null;
},
getIndexByKey(normalizedList, key) {
if (!normalizedList?.length || key == null) return 0;
const idx = normalizedList.findIndex((it) => it.key === String(key));
return idx > -1 ? idx : 0;
},
onTap(e) {
const { key, index } = e.currentTarget.dataset || {};
const nextKey = key == null ? null : String(key);
if (!nextKey || nextKey === this.data.activeKey) return;
const nextIndex = Number(index) || 0;
const shouldAutoScroll = this.data.normalizedList.length > 2;
this.setData(
{
activeKey: nextKey,
activeIndex: nextIndex,
scrollIntoView: shouldAutoScroll ? `type-tab-${nextIndex}` : "",
},
() => {
this.updateSlider();
this.triggerEvent("change", {
key: nextKey,
index: nextIndex,
item: this.data.normalizedList[nextIndex],
});
},
);
},
updateSlider() {
if (!this.data.normalizedList.length) {
this.setData({ sliderX: 0, sliderWidth: 0 });
return;
}
const activeIndex = this.data.activeIndex || 0;
const tabSelector = `#type-tab-${activeIndex}`;
const containerSelector = "#tabsInner";
this.getViewInfo(containerSelector, (container) => {
if (!container) return;
this.getViewInfo(tabSelector, (tab) => {
if (!tab) return;
const sliderX = tab.left - container.left;
const sliderWidth = tab.width;
this.setData({ sliderX, sliderWidth });
});
});
},
getViewInfo(selector, cb) {
const query = wx.createSelectorQuery().in(this);
query
.select(selector)
.boundingClientRect((res) => {
cb && cb(res);
})
.exec();
},
},
});
{
"component": true,
"usingComponents": {}
}
.tabs-wrapper {
width: 100%;
box-sizing: border-box;
}
.tabs-inner {
position: relative;
display: flex;
align-items: center;
padding: var(--fontSize6);
min-width: 100%;
width: fit-content;
box-sizing: border-box;
border-radius: var(--fontSize48);
overflow: hidden;
}
.tabs-bg {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: var(--fontSize48);
pointer-events: none;
}
.slider {
position: absolute;
top: var(--fontSize6);
bottom: var(--fontSize6);
left: 0;
border-radius: var(--fontSize48);
background-color: var(--primary-color);
z-index: 1;
transition:
transform 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;
pointer-events: none;
}
.tab-item {
position: relative;
padding: var(--fontSize12) var(--fontSize28);
border-radius: var(--fontSize48);
display: flex;
align-items: center;
justify-content: center;
white-space: nowrap;
color: #222222;
background: rgba(243, 243, 244, 1);
transition: color 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
&.is-active {
color: #ffffff;
}
.icon {
width: var(--fontSize32);
height: var(--fontSize32);
margin-right: var(--fontSize12);
flex-shrink: 0;
position: relative;
z-index: 2;
}
.label {
line-height: var(--fontSize40);
font-size: var(--fontSize26);
transition: color 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
position: relative;
z-index: 2;
}
}
.tab-item + .tab-item {
margin-left: var(--fontSize12);
}
<!--components/dateScreen/dateScreen.wxml-->
<scroll-view class="tabs-wrapper"
scroll-x
show-scrollbar="{{ false }}"
scroll-with-animation
scroll-into-view="{{ scrollIntoView }}">
<view class="tabs-inner" id="tabsInner">
<view class="tabs-bg" />
<view class="slider"
wx:if="{{ normalizedList.length }}"
style="width: {{ sliderWidth }}px; transform: translate3d({{ sliderX }}px, 0, 0);" />
<block wx:for="{{ normalizedList }}" wx:key="key">
<view class="tab-item {{ activeKey === item.key ? 'is-active' : '' }}"
id="type-tab-{{ index }}"
data-index="{{ index }}"
data-key="{{ item.key }}"
bind:tap="onTap">
<image class="icon"
src="{{ item.icon }}"
mode="aspectFit"
wx:if="{{ item.icon && (!item.showIconOnActiveOnly || activeKey === item.key) }}" />
<view class="label">
{{ item.label }}
</view>
</view>
</block>
</view>
</scroll-view>
import { storeWarnList } from "~/packageIndex/constant/performance.js";
const DEFAULT_WARN_STYLE = "color: #FA8C16; background: rgba(250, 140, 22, 0.12);";
function keyBy(list, key) {
return (Array.isArray(list) ? list : []).reduce((result, item) => {
const targetKey = item && item[key];
if (targetKey === undefined || targetKey === null || targetKey === "") {
return result;
}
result[targetKey] = item;
return result;
}, {});
}
const storeWarnMap = keyBy(storeWarnList, "key");
Component({
/**
* 组件的属性列表
*/
properties: {
list: {
type: Array,
value: [],
observer: function (list) {
this.updateWarnItems(list);
},
},
},
lifetimes: {
attached() {
this.updateWarnItems(this.data.list);
},
},
/**
* 组件的初始数据
*/
data: {
warnItems: [],
},
/**
* 组件的方法列表
*/
methods: {
updateWarnItems(list) {
const warnItems = (Array.isArray(list) ? list : [])
.map((warn) => {
const warnKey = String(warn);
const warnConfig = storeWarnMap[warnKey] || {};
return {
key: warnKey,
label: warnConfig.label || warnKey,
style: warnConfig.style || DEFAULT_WARN_STYLE,
};
})
.filter((item) => item.label);
this.setData({
warnItems,
});
},
},
});
{
"component": true,
"usingComponents": {}
}
.warn-wrapper {
display: flex;
align-items: center;
flex-wrap: wrap;
}
.warn-item {
margin-right: var(--fontSize12);
padding: var(--fontSize4) var(--fontSize8);
border-radius: var(--fontSize6);
font-weight: 400;
font-size: var(--fontSize16);
line-height: var(--fontSize24);
text-align: center;
box-sizing: border-box;
}
<view wx:if="{{ warnItems.length }}" class="warn-wrapper">
<view class="warn-item"
wx:for="{{ warnItems }}"
wx:key="key"
style="{{ item.style }}">
{{ item.label }}
</view>
</view>
export const brandTypeList = [
{
showIconOnActiveOnly: true,
icon: "/packageIndex/images/brand-tabs-icon.png",
key: "1",
label: "问界鸿蒙-延保权益",
},
{
showIconOnActiveOnly: true,
icon: "/packageIndex/images/brand-tabs-icon.png",
key: "2",
label: "通用品牌-延保权益",
},
];
export const storeWarnList = [
{
key: 2,
label: "兜底",
style: "background-color:#FFF5E7;color:#FF9D0A",
},
{
key: 3,
label: "生态",
style: "color:#F24724;background-color:#FEECE8",
},
{
key: 4,
label: "红色",
style: "background-color:#EE3140;color:white",
},
{
key: 5,
label: "黄色",
style: "background-color:#FF9D0A;color:white",
},
];
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: "预警门店数",
},
];
export const brandTypeList = [
{
showIconOnActiveOnly: true,
icon: "/packageIndex/images/brand-tabs-icon.png",
key: "1",
label: "问界鸿蒙-延保权益",
},
{
showIconOnActiveOnly: true,
icon: "/packageIndex/images/brand-tabs-icon.png",
key: "2",
label: "通用品牌-延保权益",
},
];
export const schemaList = [
{
name: "displayTotalOutput",
label: "总产值",
col: 8,
titleInfo: true,
},
{
name: "displayDeliveryCount",
label: "交付数",
col: 8,
titleInfo: true,
},
{
name: "displayPreSalesTouchCount",
label: "触客数",
col: 8,
titleInfo: true,
},
{
name: "displayVehicleWarrantyRate",
label: "整车延保",
col: 8,
tips: "整车延保触客转化率",
},
{
name: "displayPeaceOfMindRate",
label: "安心包",
col: 6,
tips: "安心包触客转化率",
},
{
name: "displayBatteryWarrantyRate",
label: "电池",
col: 5,
tips: "电池延保触客转化率",
},
{
name: "displayTireInsuranceRate",
label: "轮胎",
col: 5,
tips: "轮胎险触客转化率",
},
{
name: "displayVehicleWarrantyAfterSalesRate",
label: "整车延保售后成交/总成交",
col: 12,
},
{
name: "displayPeaceOfMindAfterSalesRate",
label: "安心包售后成交/总成交",
col: 12,
},
{
name: "displayBatteryAfterSalesRate",
label: "电池售后成交/总成交",
col: 12,
isMore: true,
},
{
name: "displayTireInsuranceAfterSalesRate",
label: "轮胎售后成交/总成交",
col: 12,
isMore: true,
},
];
export const schemaCommonBrandList = [
{
name: "displayDeliveryCount",
label: "交付数",
col: 8,
titleInfo: true,
},
{
name: "displayPreSalesTouchCount",
label: "触客数",
col: 8,
titleInfo: true,
},
{
name: "displayTotalOutput",
label: "总产值(万)",
col: 8,
titleInfo: true,
},
{
name: "displayTouchConversionRate",
label: "触客成交率",
col: 7,
},
{
name: "displayWarrantyRate",
label: "延保",
col: 5,
tips: "延保触客转化率",
},
{
name: "displayEquityProductRate",
label: "权益商品",
col: 7,
tips: "权益商品触客转化率",
},
{
name: "displayEquityRate",
label: "权益",
col: 5,
tips: "权益触客转化率",
},
{
name: "displayWarrantyAfterSalesRate",
label: "延保售后成交/总成交",
col: 12,
},
{
name: "displayEquityProductAfterSalesRate",
label: "权益商品售后成交/总成交",
col: 12,
},
{
name: "displayEquityAfterSalesRate",
label: "权益售后成交/总成交",
col: 12,
isMore: true,
},
{
name: "displayEquityAvgUnitPrice",
label: "权益平均客单价(元)",
col: 12,
isMore: true,
},
];
import { schemaList, schemaCommonBrandList } from "./stationStaffPerformance.data.js";
import { brandTypeList } from "~/packageIndex/constant/performance.js";
import { getSupervisorStaffApi } from "~/packageIndex/api/performance.js";
const IMG_URL = "https://img02.glsx.com.cn/weapp/resource/miniprogram/supervisor-miniprogram/";
Page({
data: {
IMG_URL,
pageTitle: "驻店人员业绩列表",
merchantName: undefined,
navBarHeight: 84,
brandTypeList: [],
schemaList: schemaList,
originList: [],
list: [],
query: {
statDimension: "1",
dateType: 0,
filterKey: "",
merchantId: undefined,
},
},
navbarReady(e) {
this.setData({
navBarHeight: e.detail.height,
});
},
onRoute(options) {
console.log("options", options);
if (options.merchantId && options.merchantName) {
if (options.pageTitle) {
this.setData({
pageTitle: options.pageTitle,
});
}
const query = options?.query || {};
this.setData({
brandTypeList: [
{
key: query.statDimension,
label: `${query.statDimension === "1" ? "问界鸿蒙" : "通用品牌"}-${options.merchantName}`,
},
],
merchantName: options.merchantName,
query: {
...this.data.query,
...query,
dateType: Number(query.dateType),
merchantId: options.merchantId,
},
});
return;
}
this.setData({
brandTypeList: wx.$util.deepClone(brandTypeList),
});
},
// onLoad(options) {
// console.log("options", options);
// },
onReady() {},
onShow() {},
filterData(list) {
if (!this.data.query.filterKey.trim()) {
return list || this.data.originList;
}
return (list || this.data.originList).filter((item) => item?.employeeName?.includes(this.data.query.filterKey));
},
async getData() {
wx.$util.showLoading();
this.setData({
originList: [],
list: [],
});
try {
let userInfo = wx.$util.getUserInfo();
const { data } = await getSupervisorStaffApi({
supervisorId: userInfo.uuid,
...this.data.query,
});
this.setData({
originList: data.splice(0, 10),
list: this.filterData(data.splice(0, 10)),
});
} finally {
wx.$util.hideLoading();
}
},
async handleBrandTabChange({ detail }) {
const schemaLists = String(detail.key) === "1" ? schemaList : schemaCommonBrandList;
this.setData({
schemaList: schemaLists,
query: {
...this.data.query,
statDimension: detail.key,
},
});
await this.getData();
},
async handleSearch({ detail }) {
this.setData({
query: {
...this.data.query,
startDate: detail.startDay?.replace(/\//g, "-"),
endDate: detail.endDay?.replace(/\//g, "-"),
dateType: detail.timeDimension,
},
});
await this.getData();
},
handleFilterKeyChange({ detail }) {
wx.$util.showLoading();
this.setData({
query: {
...this.data.query,
filterKey: detail,
},
});
this.setData(
{
list: this.filterData(),
},
function () {
wx.$util.hideLoading();
},
);
},
handleTapItem() {},
handleBack() {
wx.navigateBack();
},
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
async onPullDownRefresh() {
try {
await this.getData();
} finally {
wx.stopPullDownRefresh();
}
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});
{
"usingComponents": {
"TypeTabs": "/packageIndex/components/typeTabs/typeTabs",
"StatisticsItem": "/packageIndex/components/statisticsItem/statisticsItem",
"date-screen": "/components/dateScreen/dateScreen",
"van-search": "@vant/weapp/search/index"
},
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
/* packageIndex/pages/specialTask/specialTask.wxss */
page {
background: #f2f3f7;
height: 100%;
.filter-wrapper {
background-color: white;
.tab-wrapper {
padding: var(--fontSize12) var(--fontSize24);
}
.date-filter-wrapper {
padding: var(--fontSize16) var(--fontSize24);
}
.search-input-wrapper {
padding: var(--fontSize16) var(--fontSize24);
width: 100%;
overflow: hidden;
box-sizing: border-box;
}
}
.list-wrapper {
padding: 0 var(--fontSize24) var(--fontSize16);
.title-wrapper {
font-weight: 400;
font-size: 14px;
line-height: 14px;
color: #000000e5;
padding: var(--fontSize16) 0;
}
.item-wrapper {
margin-bottom: 8px;
}
.last-tips {
padding: var(--fontSize30) 0;
text-align: center;
font-size: var(--fontSize24);
color: #999999;
}
}
}
<!--packageIndex/pages/specialTask/specialTask.wxml-->
<navigation-bar bind:navbarReady="navbarReady"
class="navigation-header"
showBack
bind:back="handleBack"
navStyle="background-color: white;box-shadow:none;">
<view class="page-title">
{{ pageTitle }}
</view>
</navigation-bar>
<scroll-view scroll-y
class="container"
style="padding-top: calc({{ navBarHeight }}px);">
<view class="filter-wrapper">
<view class="tab-wrapper">
<TypeTabs bind:change="handleBrandTabChange"
list="{{ brandTypeList }}"
value="{{ query.statDimension }}" />
</view>
<view class="date-filter-wrapper">
<date-screen customBackground="#f3f3f4"
tabSelected="{{ 3 }}"
initStartDate="{{ query.startDate }}"
initEndDate="{{ query.endDate }}"
initTimeDimension="{{ query.dateType }}"
bind:search="handleSearch"></date-screen>
</view>
<van-search value="{{ query.filterKey }}"
shape="round"
custom-class="search-input-wrapper"
background="#fff"
bind:change="handleFilterKeyChange"
placeholder="搜索驻店销售姓名..." />
</view>
<view class="list-wrapper">
<view class="title-wrapper">
驻店列表
</view>
<block wx:if="{{ list && list.length > 0 }}">
<view class="item-wrapper"
wx:for="{{ list }}"
wx:key="index">
<StatisticsItem title="{{ item.employeeName }}"
data="{{ item }}"
beTap="{{ false }}"
schema="{{ schemaList }}">
<view slot="title-sub">
{{ item.merchantName }}
</view>
</StatisticsItem>
</view>
<view class="last-tips">
到底了~
</view>
</block>
<block wx:else>
<empty-data />
</block>
</view>
</scroll-view>
export const schemaList = [
{
name: "displayTotalOutput",
label: "总产值(万)",
col: 8,
},
{
name: "displayDeliveryCount",
label: "交付数",
col: 8,
},
{
name: "displayPreSalesTouchCount",
label: "触客数",
col: 8,
},
{
name: "displayVehicleWarrantyRate",
label: "整车延保",
col: 8,
tips: "整车延保触客转化率",
},
{
name: "displayPeaceOfMindRate",
label: "安心包",
col: 6,
tips: "安心包触客转化率",
},
{
name: "displayBatteryWarrantyRate",
label: "电池",
col: 5,
tips: "电池延保触客转化率",
},
{
name: "displayTireInsuranceRate",
label: "轮胎",
col: 5,
tips: "轮胎险触客转化率",
},
{
name: "displayVehicleWarrantyAfterSalesRate",
label: "整车延保售后成交/总成交",
col: 12,
isMore: true,
},
{
name: "displayPeaceOfMindAfterSalesRate",
label: "安心包售后成交/总成交",
col: 12,
isMore: true,
},
{
name: "displayBatteryAfterSalesRate",
label: "电池售后成交/总成交",
col: 12,
isMore: true,
},
{
name: "displayTireInsuranceAfterSalesRate",
label: "轮胎售后成交/总成交",
col: 12,
isMore: true,
},
];
export const schemaCommonBrandList = [
{
name: "displayTotalOutput",
label: "总产值(万)",
col: 8,
},
{
name: "displayDeliveryCount",
label: "交付数",
col: 8,
},
{
name: "displayPreSalesTouchCount",
label: "触客数",
col: 8,
},
{
name: "displayTouchConversionRate",
label: "触客成交率",
col: 7,
},
{
name: "displayWarrantyRate",
label: "延保",
col: 5,
tips: "延保触客转化率",
},
{
name: "displayEquityProductRate",
label: "权益商品",
col: 7,
tips: "权益商品触客转化率",
},
{
name: "displayEquityRate",
label: "权益",
col: 5,
tips: "权益触客转化率",
},
{
name: "displayWarrantyAfterSalesRate",
label: "延保售后成交/总成交",
col: 12,
isMore: true,
},
{
name: "displayEquityProductAfterSalesRate",
label: "权益商品售后成交/总成交",
col: 12,
isMore: true,
},
{
name: "displayEquityAfterSalesRate",
label: "权益售后成交/总成交",
col: 12,
isMore: true,
},
{
name: "displayEquityAvgUnitPrice",
label: "权益平均客单价(元)",
col: 12,
isMore: true,
},
];
import { schemaList, schemaCommonBrandList } from "./storePerformance.data.js";
import { brandTypeList, staticInfoList } from "~/packageIndex/constant/performance.js";
import { getSupervisorStoreApi } from "~/packageIndex/api/performance.js";
const IMG_URL = "https://img02.glsx.com.cn/weapp/resource/miniprogram/supervisor-miniprogram/";
Page({
data: {
IMG_URL,
navBarHeight: 84,
brandType: {
list: brandTypeList,
},
schemaList: schemaList,
staticInfoList: staticInfoList,
statistics: {
totalStoreCount: 0,
redStoreCount: 0,
yellowStoreCount: 0,
greenStoreCount: 0,
},
originList: [],
list: [],
query: {
statDimension: "1",
dateType: 0,
filterKey: "",
startDate: undefined,
endDate: undefined,
},
},
navbarReady(e) {
let navBarHeight = e.detail.height;
this.setData({
navBarHeight,
});
},
onLoad(options) {
// this.setData({
// pageQuery: options,
// });
// this.getDetail(options);
},
onReady() {},
onShow() {},
filterData(list) {
if (!this.data.query.filterKey.trim()) {
return list || this.data.originList;
}
return (list || this.data.originList).filter((item) => item?.merchantName?.includes(this.data.query.filterKey));
},
async getData() {
wx.$util.showLoading();
this.setData({
originList: [],
list: [],
});
try {
let userInfo = wx.$util.getUserInfo();
const { data } = await getSupervisorStoreApi({
supervisorId: userInfo.uuid,
...this.data.query,
});
this.setData({
originList: data.storeList,
statistics: data.statistics,
list: this.filterData(data.storeList),
});
} finally {
wx.$util.hideLoading();
}
},
async handleBrandTabChange({ detail }) {
const schemaLists = String(detail.key) === "1" ? schemaList : schemaCommonBrandList;
this.setData({
schemaList: schemaLists,
query: {
...this.data.query,
statDimension: detail.key,
},
});
await this.getData();
},
async handleSearch({ detail }) {
this.setData({
query: {
...this.data.query,
startDate: detail.startDay?.replace(/\//g, "-"),
endDate: detail.endDay?.replace(/\//g, "-"),
dateType: detail.timeDimension,
},
});
await this.getData();
},
handleFilterKeyChange({ detail }) {
wx.$util.showLoading();
this.setData({
query: {
...this.data.query,
filterKey: detail,
},
});
this.setData(
{
list: this.filterData(),
},
function () {
wx.$util.hideLoading();
},
);
},
handleTapItem({ currentTarget }) {
const row = currentTarget.dataset.item;
wx.$router.go("packageIndex.stationStaffPerformance", {
merchantName: row.merchantName,
merchantId: row.merchantId,
pageTitle: "门店驻店销售列表",
query: this.data.query,
});
},
back() {
wx.navigateBack();
},
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
async onPullDownRefresh() {
try {
await this.getData();
} finally {
wx.stopPullDownRefresh();
}
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});
{
"usingComponents": {
"TypeTabs": "/packageIndex/components/typeTabs/typeTabs",
"StatisticsItem": "/packageIndex/components/statisticsItem/statisticsItem",
"date-screen": "/components/dateScreen/dateScreen",
"van-search": "@vant/weapp/search/index",
"WarnList": "/packageIndex/components/warnList/index"
},
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
/* packageIndex/pages/specialTask/specialTask.wxss */
page {
background: #f2f3f7;
height: 100%;
.filter-wrapper {
background-color: white;
.tab-wrapper {
padding: var(--fontSize12) var(--fontSize24);
}
.date-filter-wrapper {
padding: var(--fontSize16) var(--fontSize24);
}
.search-input-wrapper {
padding: var(--fontSize16) var(--fontSize24);
width: 100%;
overflow: hidden;
box-sizing: border-box;
}
.statistics-wrapper {
display: flex;
align-items: center;
padding: var(--fontSize16) var(--fontSize32);
.static-item {
margin-left: var(--fontSize8);
padding: var(--fontSize24);
border-radius: var(--fontSize16);
flex: 1;
.label {
font-weight: 400;
font-size: 14px;
line-height: 16px;
color: white;
}
.value {
font-family: numberBold;
font-weight: 700;
font-style: Bold;
font-size: 20px;
margin-top: var(--fontSize10);
color: white;
}
}
}
}
.list-wrapper {
padding: 0 var(--fontSize24) var(--fontSize16);
.title-wrapper {
font-weight: 400;
font-size: 14px;
line-height: 14px;
color: #000000e5;
padding: var(--fontSize16) 0;
}
.item-wrapper {
margin-bottom: 8px;
.title-sub-wrapper {
display: flex;
align-items: center;
.label {
margin-right: var(--fontSize16);
}
}
}
.last-tips {
padding: var(--fontSize30) 0;
text-align: center;
font-size: var(--fontSize24);
color: #999999;
}
}
}
<!--packageIndex/pages/specialTask/specialTask.wxml-->
<navigation-bar bind:navbarReady="navbarReady"
class="navigation-header"
showBack
bind:back="back"
navStyle="background-color: white;box-shadow:none;">
<view class="page-title">
门店业绩列表
</view>
</navigation-bar>
<scroll-view scroll-y
class="container"
style="padding-top: calc({{ navBarHeight }}px);">
<view class="filter-wrapper">
<view class="tab-wrapper">
<TypeTabs bind:change="handleBrandTabChange"
list="{{ brandType.list }}"
value="{{ query.statDimension }}" />
</view>
<view class="date-filter-wrapper">
<date-screen customBackground="#f3f3f4"
tabSelected="{{ 3 }}"
bind:search="handleSearch"></date-screen>
</view>
<view class="statistics-wrapper"
wx:if="{{ query.dateType === 1 || query.dateType === 2 }}">
<view wx:for="{{ staticInfoList }}"
wx:key="{{ item.key }}"
class="static-item"
style="background:{{ item.background }}">
<view class="label">
{{ item.label }}
</view>
<view class="value">
{{ statistics[item.key] }}
</view>
</view>
</view>
<van-search value="{{ query.filterKey }}"
shape="round"
custom-class="search-input-wrapper"
background="#fff"
bind:change="handleFilterKeyChange"
placeholder="搜索门店名称..." />
</view>
<view class="list-wrapper">
<view class="title-wrapper">
门店列表
</view>
<block wx:if="{{ list && list.length > 0 }}">
<view class="item-wrapper"
wx:for="{{ list }}"
wx:key="index"
data-item="{{ item }}"
bind:tap="handleTapItem">
<StatisticsItem title="{{ item.merchantName }}"
data="{{ item }}"
hideValue="4"
schema="{{ schemaList }}">
<view slot="title-sub" class="title-sub-wrapper">
<view class="label">
{{ item.staffCount }}名驻店人员
</view>
<view wx:if="{{ item.warnList && item.warnList.length }}">
<WarnList list="{{ item.warnList }}" />
</view>
</view>
</StatisticsItem>
</view>
<view class="last-tips">
到底了~
</view>
</block>
<block wx:else>
<empty-data />
</block>
</view>
</scroll-view>
...@@ -137,6 +137,16 @@ Page({ ...@@ -137,6 +137,16 @@ Page({
} }
}); });
}, },
handleNavigatePerformance(e) {
const { key } = e.currentTarget.dataset;
const urlMap = {
staffCount: "/packageIndex/pages/stationStaffPerformance/stationStaffPerformance",
shopCount: "/packageIndex/pages/storePerformance/storePerformance",
};
const url = urlMap[key];
if (!url) return;
wx.navigateTo({ url });
},
tabClick(e) { tabClick(e) {
let eventCode = ["supervisor_dayTask_tab", "supervisor_weeklyTask_tab", "supervisor_monthlyTask_tab", "supervisor_specificTask_tab"]; let eventCode = ["supervisor_dayTask_tab", "supervisor_weeklyTask_tab", "supervisor_monthlyTask_tab", "supervisor_specificTask_tab"];
......
...@@ -25,10 +25,12 @@ ...@@ -25,10 +25,12 @@
</view> </view>
</view> </view>
<view class="static-info"> <view class="static-info">
<view class="static-item" <view wx:for="{{ staticList }}"
wx:key="{{ item.key }}"
class="static-item"
style="flex: {{ item.width }}rpx 0 0;background: {{ item.background }};" style="flex: {{ item.width }}rpx 0 0;background: {{ item.background }};"
wx:for="{{ staticList }}" data-key="{{ item.key }}"
wx:key="index"> bind:tap="handleNavigatePerformance">
<view class="label"> <view class="label">
{{ item.label }} {{ item.label }}
</view> </view>
...@@ -42,7 +44,7 @@ ...@@ -42,7 +44,7 @@
<view class="sticky-box {{ isSticky ? 'is-sticky' : '' }}"> <view class="sticky-box {{ isSticky ? 'is-sticky' : '' }}">
<view class="tab-box"> <view class="tab-box">
<tab-bar tabList="{{ tabList }}" <tab-bar tabList="{{ tabList }}"
bindclick="tabClick" bind:click="tabClick"
activeIndex="{{ tabIndex }}" /> activeIndex="{{ tabIndex }}" />
</view> </view>
<view class="date"> <view class="date">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!