Commit 5251f39d by 李君

优化

1 parent ddbfeaaf
<!--components/echart/trend/index.wxml-->
<view class="cwrap">
<view class="stay" wx:if="{{avgVal}}">人均停留时长<text>{{avgVal}}</text>分</view>
<!-- <view class="stay" wx:if="{{avgVal}}">人均停留时长<text>{{avgVal}}</text>分</view> -->
<basic chartId="{{chartId}}" chartData="{{chartData}}" height="{{height}}"></basic>
</view>
......@@ -122,6 +122,14 @@ Component({
//optionFormat.xAxis.axisLabel.interval = optionFormat.series[0].length>30?'auto':0;
optionFormat.legend.bottom = legendBottom || 0;
let option = Object.assign({}, optionFormat, coverTemp);
option.yAxis.axisLabel.formatter= function (value, index) {
if (value >= 10000 && value < 10000000) {
value = value / 10000 + "万";
} else if (value >= 10000000) {
value = value / 10000000 + "千万";
}
return value;
}
return option;
}
}
......
......@@ -38,7 +38,7 @@ Component({
deploymentType:wx.getStorageSync('deploymentType'),
trendVal: 'account_passenger_flow',
trendName:'客流量',
rankVal: 'total_passenger',
rankVal: 'outside_traffic',
rankData: {},
belongTo: 'NewAccount',
params: {
......
......@@ -13,9 +13,11 @@
</view>
</view>
<view class="sitem">
<view class="snum color2">--</view>
<view class="sname">销售额(元)</view>
<view class="spercent">较{{dateStr}}:--% <image src="/images/ico.png" mode="aspecFill"/></view>
<view class="snum color2">{{cardData.account_passenger_flow.value || '--'}}</view>
<view class="sname">客流量(人次)</view>
<view class="spercent">较{{dateStr}}:{{cardData.account_passenger_flow.ratio}}
<image src="/images/ico{{cardData.account_passenger_flow.rstatus}}.png" mode="aspecFill"/>
</view>
</view>
</view>
</view>
......@@ -23,7 +25,7 @@
<view class="mcards ~acea-row">
<view class="card">
<view class="mnum">{{ cardData.account_passenger_flow.value||'--' }}</view>
<view class="mname">客流量(人次)</view>
<view class="mname">过店客流(人次)</view>
</view>
<view class="card">
<view class="mnum">{{ cardData.account_entry_rate_average.value||'--' }}</view>
......@@ -35,7 +37,7 @@
</view>
<view class="card">
<view class="mnum">{{ '--' }}</view>
<view class="mname">客单价(元)</view>
<view class="mname">深逛率(%)</view>
</view>
</view>
<view class="~echart-item">
......@@ -61,10 +63,10 @@
</view>
<view class="~tablist" style="width:73%;margin-top:10rpx;">
<van-tabs bindclick="changeRank" active="{{rankVal}}">
<van-tab title="客流量" name="total_passenger"></van-tab>
<van-tab title="进店率" name="avg_entry_rate"></van-tab>
<van-tab title="停留时长" name="custom_residence_time"></van-tab>
<van-tab title="销售额" disabled name="4"></van-tab>
<van-tab title="过店客流" name="outside_traffic"></van-tab>
<van-tab title="进店客流" name="total_passenger"></van-tab>
<van-tab title="顾客人数" name="total_traffic"></van-tab>
<van-tab title="深逛率" name="deep_shopping_rate"></van-tab>
</van-tabs>
</view>
<view class="~echart-item-content">
......
......@@ -51,9 +51,9 @@ Page({
},
mallLoad(data){
let list = data.detail;
if(list.length==1){
if(list.length>1){
this.setData({
isMall:true,
isMall:false,
indexType:'mall'
});
this.onZonePickerCallback({detail:list[0]});
......@@ -68,7 +68,7 @@ Page({
accountBtn(){
const orgName = wx.getStorageSync('accountName')
const accountId = wx.getStorageSync('accountId')
const indexType = 'account';
const indexType = 'mall';
this.setData({
accountId:accountId,
orgName: orgName,
......
<view class="container" style="padding-top: {{navHeight}}px">
<navbar2 bg-color="#001C90" navbar-color="#fff">
<view class="navtitle">
<van-icon bindtap="accountBtn" size="22" name="arrow-left" custom-class="back {{indexType!='mall'||isMall?'hide':''}}"/>
<!-- <van-icon bindtap="accountBtn" size="22" name="arrow-left" custom-class="back {{indexType!='mall'||isMall?'hide':''}}"/> -->
<time-picker class="picker" placeholder="请选择时间"
initDate="{{date}}"
dateType="{{dateType}}"
......
......@@ -14,7 +14,7 @@ import {
import {
getCharts
} from "../../../api/report.js";
import cardConfig from '../../../utils/card'
Component({
behaviors: [customBehavior],
......@@ -37,8 +37,8 @@ Component({
windowWidth: App.globalData.windowWidth,
navHeight: getApp().globalData.navHeight,
deploymentType: wx.getStorageSync('deploymentType'),
trendVal: 'mall_passenger_flow',
trendName: '客流量',
trendVal: '',
trendName: '',
rankVal: 'total_passenger',
rankData: {},
belongTo: 'NewMall',
......@@ -52,14 +52,20 @@ Component({
dateStr: '昨日',
trendData: {},
hbarData: {},
cardData: {}
cardData: {},
isOnce:true,
cardsList:[],
showTab:true
/********************************************/
},
lifetimes: {
attached: function () {
this.data.isOnce = false
this.getCharts().then(res => {
this.data.cardsList = res.data.cards
this.data.isOnce = true
this.changeTimerFn({
...this.data.time,
dateType: this.data.timeType
......@@ -78,15 +84,14 @@ Component({
}
},
// 获取报表chartIds
getReportCharts: function () {
getReportCharts: function (res) {
if (this.data.chartList.length == 0) return;
wx.showLoading({
title: '数据加载中',
mask: true
});
this.loadHeadData();
this.loaTrendData();
this.loadBarData();
this.loaRankData();
},
......@@ -97,7 +102,7 @@ Component({
chartIds,
orgIds
}).then(res => {
let cardData = {};
let cardData = [];
Object.keys(res.data).forEach(key => {
let item = res.data[key];
if (this.data.params.dateType == 'day') {
......@@ -113,10 +118,41 @@ Component({
item.value = String(item.value && this.toThousands(item.value)).replace('分','');
item.rstatus = (item.ratio && item.ratio.includes('-')) ? 1 : 2;
item.name = this.getChartName(key);
cardData[key] = item;
item.key = key;
item.dateType = this.data.params.dateType
cardData.push(item)
});
let newData = []
this.data.cardsList.forEach(item=>{
cardData.forEach(card=>{
if(item.chartKey==card.key){
newData.push(card)
}
})
})
let name = '',title = ''
this.data.trendVal = ''
Object.keys(cardConfig).forEach(key=>{
newData.forEach(card=>{
if(key==card.key){
card.unit = cardConfig[key].unit;
card.hasTrend = cardConfig[key][card.dateType].level && cardConfig[key][card.dateType].level.length>0
if(!name && card.hasTrend){
name = key
title = card.name
}
}
})
})
this.data.showTab = true
this.setData({
trendVal: name,
trendName: title
}, () => {
this.loaTrendData();
})
this.setData({
cardData
cardData:newData
})
})
},
......@@ -195,10 +231,12 @@ Component({
});
},
changeAccountFn: function (value) {
this.getReportCharts();
// this.getCharts({accountId:value}).then(res=>{
// this.getReportCharts();
// })
// this.getReportCharts();
if(!this.data.isOnce) return
this.getCharts({mallId:value}).then(res=>{
this.data.cardsList = res.data.cards
this.getReportCharts();
})
},
changeTimerFn: async function (value) {
let {
......
......@@ -5,49 +5,48 @@
<view class="mallselect" bindtap="mallBtn">{{orgName}} <van-icon name="play" custom-class="drop {{isMall?'hide':''}}"/></view>
<view class="slist ~acea-row ~row-around">
<view class="sitem">
<view class="snum color1">{{cardData.mall_passenger_number.value}}</view>
<view class="sname">顾客数(人)</view>
<view class="snum color1">{{cardData[0].value|| '--'}}</view>
<view class="sname">{{cardData[0].name|| '--'}}{{cardData[0].unit?'('+cardData[0].unit+')':''}}</view>
<view class="spercent">
较{{dateStr}}:{{cardData.mall_passenger_number.ratio}}
<image src="/images/ico{{cardData.mall_passenger_number.rstatus}}.png" mode="aspecFill"/>
较{{dateStr}}:{{cardData[0].ratio|| '--'}}
<image src="/images/ico{{cardData[0].rstatus}}.png" mode="aspecFill"/>
</view>
</view>
<view class="sitem">
<view class="snum color2">--</view>
<view class="sname">销售额(元)</view>
<view class="spercent">较{{dateStr}}:--% <image src="/images/ico.png" mode="aspecFill"/></view>
<view class="sitem" wx:if="{{cardData.length>1}}">
<view class="snum color2">{{cardData[1].value || '--'}}</view>
<view class="sname">{{cardData[1].name|| '--'}}{{cardData[1].unit?'('+cardData[1].unit+')':''}}</view>
<view class="spercent">较{{dateStr}}:{{cardData[1].ratio|| '--'}}
<image src="/images/ico{{cardData[1].rstatus}}.png" mode="aspecFill"/>
</view>
</view>
</view>
</view>
<view class="mcards ~acea-row">
<view class="card">
<view class="mnum">{{ cardData.mall_passenger_flow.value||'--' }}</view>
<view class="mname">客流量(人次)</view>
</view>
<view class="card">
<view class="mnum">{{ cardData.mall_entry_rate.value||'--' }}</view>
<view class="mname">进店率(%)</view>
<view class="mcards ~acea-row" wx:if="{{cardData.length>2}}">
<view class="card" wx:for="{{cardData}}" wx:for-index="index" wx:for-item="item" wx:if="{{index>1}}" wx:key='index'>
<view class="mnum">{{index}}{{ item.value||'--' }}</view>
<view class="mname">{{ item.name||'--' }}{{item.unit?'('+item.unit+')':''}}</view>
</view>
<view class="card">
<view class="mnum">{{ cardData.custom_residence_time.value||'--' }}</view>
<view class="mname">停留时长(分)</view>
<!-- <view class="card" wx:if="{{cardData.length>3}}">
<view class="mnum">{{ cardData[3].value||'--' }}</view>
<view class="mname">{{ cardData[3].name||'--' }}</view>
</view>
<view class="card">
<view class="mnum">{{ '--' }}</view>
<view class="mname">客单价(元)</view>
<view class="card" wx:if="{{cardData.length>4}}">
<view class="mnum">{{ cardData[4].value||'--' }}</view>
<view class="mname">{{ cardData[4].name||'--' }}</view>
</view>
<view class="card" wx:if="{{cardData.length>5}}">
<view class="mnum">{{ cardData[5].value||'--' }}</view>
<view class="mname">{{ cardData[5].name||'--' }}</view>
</view> -->
</view>
<view class="~echart-item">
<view class="~echart-item-title">
<view>趋势分析</view>
</view>
<view class="~tablist" style="width:73%;margin-top:10rpx;">
<van-tabs bindclick="changeTrend" active="{{trendVal}}">
<van-tab title="客流量" name="mall_passenger_flow"></van-tab>
<van-tab title="进店率" name="mall_entry_rate"></van-tab>
<van-tab title="停留时长" name="custom_residence_time"></van-tab>
<van-tab title="销售额" disabled name="4"></van-tab>
<view class="~tablist" style="margin-top:10rpx;padding: 0 15rpx;">
<van-tabs ref="tabs" tab-class='tab-box' bindclick="changeTrend" active="{{trendVal}}">
<van-tab wx:for="{{cardData}}" wx:for-index="index" wx:for-item="item" wx:if="{{item.hasTrend}}" wx:key='index' title="{{item.name}}" name="{{item.key}}"></van-tab>
</van-tabs>
</view>
<view class="~echart-item-content">
......@@ -74,7 +73,7 @@
<van-tab title="客流量" name="total_passenger"></van-tab>
<van-tab title="进店率" name="avg_entry_rate"></van-tab>
<van-tab title="停留时长" name="custom_residence_time"></van-tab>
<van-tab title="销售额" disabled name="4"></van-tab>
<!-- <van-tab title="销售额" disabled name="4"></van-tab> -->
</van-tabs>
</view>
<view class="~echart-item-content">
......
......@@ -13,7 +13,12 @@
justify-content: space-between;
position: relative;
}
.tab-box{
flex: none !important;
}
.tab-box .tabItem{
width: 80rpx;
}
.top .time {
position: relative;
width: 100%;
......
{
"description": "项目配置文件",
"description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"packOptions": {
"ignore": [],
"include": []
......@@ -40,32 +40,17 @@
"minifyWXML": true,
"showES6CompileOption": false,
"useCompilerPlugins": false,
"ignoreUploadUnusedFiles": true
"ignoreUploadUnusedFiles": true,
"useStaticServer": true
},
"compileType": "miniprogram",
"libVersion": "2.14.4",
"appid": "wx220b5d2dbb82ce64",
"projectname": "miniProject",
"cloudfunctionTemplateRoot": "cloudfunctionTemplate",
"watchOptions": {
"ignore": []
},
"debugOptions": {
"hidedInDevtools": []
},
"scripts": {},
"condition": {
"plugin": {
"list": []
},
"game": {
"list": []
},
"gamePlugin": {
"list": []
},
"miniprogram": {
"list": []
}
"cloudfunctionTemplateRoot": "cloudfunctionTemplate/",
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 4
}
}
\ No newline at end of file
{
"projectname": "miniProject",
"setting": {
"compileHotReLoad": true
},
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
"projectname": "miniProject",
"setting": {
"compileHotReLoad": true
},
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!