Commit 5251f39d by 李君

优化

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