Commit 5b854a8f by 李君

优化

1 parent 54a2adcf
......@@ -11,7 +11,7 @@ page{
padding: 0 28rpx;
width: 100%;
background: linear-gradient(154deg, #C7D3FF 0%, #E9F9FF 48%, #FFFFFF 100%);
padding-top: 120rpx;
/* padding-top: 120rpx; */
}
.van-picker__confirm{
color: #000!important;
......
......@@ -51,12 +51,12 @@ Component({
switchTab(e) {
const data = e.currentTarget.dataset
const url = data.path
wx.switchTab({
url
})
this.setData({
selected: data.index
wx.reLaunch({
url
})
// this.setData({
// curClick: data.index
// })
}
}
})
\ No newline at end of file
<!--miniprogram/custom-tab-bar/index.wxml-->
<view class="tab-bar" wx:if="{{show}}">
<view class="tab-bar-border"></view>
<view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.pagePath}}" data-index="{{index}}" bindtap="switchTab">
<view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.pagePath}}" data-index="{{item.curr}}" bindtap="switchTab">
<image src="{{curClick === item.curr ? item.selectedIconPath : item.iconPath}}"></image>
<view class="{{curClick === item.curr ? 'active text' : 'text'}}">{{item.text}}</view>
</view>
......
.tab-bar {
padding-top: 10rpx;
position: absolute;
bottom: 0;
left: 0;
......@@ -24,7 +25,7 @@
.tab-bar-item {
flex: 1;
text-align: center;
display: flex;
/* display: flex; */
justify-content: center;
align-items: center;
flex-direction: column;
......
......@@ -4,6 +4,7 @@ import {
getAccountMallRank
} from '../api/shop'
import moment from 'moment'
const App = getApp();
Component({
pageLifetimes: {
show() {
......@@ -19,6 +20,8 @@ Component({
this.loadData()
},
data: {
navHeight: getApp().globalData.navHeight,
isFirst:true,
selectName: '',//集团名称
openMllNum:0,//开业门店数
exposure:0,//路过客流量
......@@ -35,7 +38,7 @@ Component({
rankData: [],
indexVal: 'PassengerFlow',
indexList: [{
name: '客流量',
name: '进店客流',
val: 'PassengerFlow'
}, {
name: '过店人次',
......@@ -47,7 +50,7 @@ Component({
name: '顾客人数',
val: 'CustomerNum'
}, {
name: '平均停留时间',
name: '停留时间',
val: 'AvgResidenceTime'
}, {
name: '深逛人数',
......@@ -61,6 +64,9 @@ Component({
}],
},
methods: {
switchTab(){
this.loadData()
},
// 关闭自定义日期选择
onClose() {
this.getTabBar().setData({
......@@ -169,7 +175,7 @@ Component({
accountId:wx.getStorageSync('accountId'),
startDate:startTime,
endDate:endTime,
dataLevel:'hour',
dataLevel:(this.data.types==1 || this.data.types==2)?'hour':'day',
dataIndex:this.data.trendtypes
}).then(res => {
setTimeout(()=>{
......@@ -210,9 +216,13 @@ Component({
},
// 获取所有数据
loadData() {
this.getCardList()
this.getTrendList()
this.getMallRank()
this.setData({
isFirst:false
},()=>{
this.getCardList()
this.getTrendList()
this.getMallRank()
})
},
//点击客流趋势tab触发
ClickPassageFlow(e) {
......@@ -265,7 +275,7 @@ Component({
formatter: function (params) {
let html = ''
params.forEach(item => {
html += item.axisValue+ ': ' + item.value
html += item.axisValue+ ': ' + (item.value||'')
})
return html
}
......
<!--pages/homes/index.wxml-->
<view class="container" style="padding-bottom: 80px;">
<navbar page-name="集团首页" bg-color="RGBA(213, 227, 255, 1)" navbar-color="#000"></navbar>
<view class="~backgroundColor">
<view class="~backgroundColor" style="padding-top: {{navHeight}}px">
<!-- 名称 -->
<view class="contianer_shop">
<image src="../images/banner.png" class='images'></image>
......@@ -26,12 +26,12 @@
<view class="card">
<view class="card_passage">
<image src="../images/keliulaing.png" class="card_image"></image>
<view class="cardName"> 路过客流</view>
<view class="cardName"> 路过客流</view>
<view class="cardNum"> {{exposure}}</view>
</view>
<view class="card_passage">
<image src="../images/keliuliangyellow.png" class="card_image"></image>
<view class="cardName"> 客流量</view>
<view class="cardName"> 进店客流</view>
<view class="cardNum"> {{traffic}}</view>
</view>
<view class="card_passage">
......@@ -49,7 +49,7 @@
<view class="keliuliang">
<text class="title_chart">客流趋势分析</text>
<view class="tab_tll">
<text class="text_tltle {{trendtypes=='PassengerFlow'?'actives':'defaults'}}" bindtap="ClickPassageFlow" data-type='PassengerFlow'>过店客流</text>
<text class="text_tltle {{trendtypes=='PassengerFlow'?'actives':'defaults'}}" bindtap="ClickPassageFlow" data-type='PassengerFlow'>路过客流</text>
<text class="text_tltle {{trendtypes=='Exposure'?'actives':'defaults'}}" bindtap="ClickPassageFlow" data-type='Exposure'>进店客流</text>
<text class="text_tltle {{trendtypes=='CustomerNum'?'actives':'defaults'}}" bindtap="ClickPassageFlow" data-type='CustomerNum'>顾客人数</text>
<text class="text_tltle {{trendtypes=='IntoStoreRate'?'actives':'defaults'}}" bindtap="ClickPassageFlow" data-type='IntoStoreRate'>进店率</text>
......
......@@ -10,6 +10,7 @@ import {
getAgeSexData,
getAgeData
} from "../api/shop";
const App = getApp();
Component({
pageLifetimes: {
show() {
......@@ -19,14 +20,39 @@ Component({
curClick: 2
})
}
if (wx.getStorageSync('shopName') && this.data.shopList.length > 0) {
let selectId = this.data.shopList.find(item => item.name == wx.getStorageSync('shopName')).id
this.setData({
selectName: wx.getStorageSync('shopName'),
selectId
}, () => {
this.loadData()
getShopDetailData({
id: this.data.selectId
}).then(res => {
if (res.code == 200) {
let startTime = res.data.startTime.split(' ')[1].slice(0, 5)
let endTime = res.data.endTime.split(' ')[1].slice(0, 5)
this.setData({
info: {
...res.data,
startTime,
endTime
}
})
}
})
})
} else {
}
}
},
/**
* 组件的初始数据
*/
data: {
navHeight: getApp().globalData.navHeight,
currentTime: moment().format("YYYY-MM-DD"),
types: 1, //选中的时间类型
trendtypes: 1, //选中的业态趋势类型
......@@ -38,15 +64,7 @@ Component({
minDate: new Date(2022, 0, 1).getTime(), //自定义时间的开始日期
// maxDate: new Date(2022, 11, 31).getTime(), //自定义时间的结束日期
maxDate: new Date(2025, 11, 31).getTime(), //自定义时间的结束日期
shopList: [
// {
// id: 1,
// name: '小米'
// }, {
// id: 2,
// name: '华为'
// }
], //店铺列表数据
shopList: [], //店铺列表数据
selectId: '', //选中的店铺id
selectName: '', //选中店铺名字
columnsListName: [], //店铺的名字下拉列表
......@@ -57,12 +75,17 @@ Component({
info: {}
},
ready(){
if (wx.getStorageSync('shopName') && this.data.shopList.length > 0) {
let selectId = this.data.shopList.find(item => item.name == wx.getStorageSync('shopName')).id
getMalls({
url: '/report/malls',
accountId: wx.getStorageSync('accountId')
}).then((res) => {
this.setData({
selectName: wx.getStorageSync('shopName'),
selectId
shopList: res.data,
selectName: res.data[0] && res.data[0].name,
selectId: res.data[0] && res.data[0].id,
columnsListName: res.data && res.data.map(item => item.name)
}, () => {
wx.setStorageSync('shopName', res.data[0] && res.data[0].name)
this.loadData()
getShopDetailData({
id: this.data.selectId
......@@ -80,39 +103,8 @@ Component({
}
})
})
} else {
getMalls({
url: '/report/malls',
accountId: wx.getStorageSync('accountId')
}).then((res) => {
this.setData({
shopList: res.data,
selectName: res.data[0] && res.data[0].name,
selectId: res.data[0] && res.data[0].id,
columnsListName: res.data && res.data.map(item => item.name)
}, () => {
wx.setStorageSync('shopName', res.data[0] && res.data[0].name)
this.loadData()
// let params={id:this.selectId}
getShopDetailData({
id: this.data.selectId
}).then(res => {
if (res.code == 200) {
let startTime = res.data.startTime.split(' ')[1].slice(0, 5)
let endTime = res.data.endTime.split(' ')[1].slice(0, 5)
this.setData({
info: {
...res.data,
startTime,
endTime
}
})
}
})
})
})
}
})
},
methods: {
// 关闭自定义日期选择
......@@ -360,7 +352,7 @@ Component({
formatter: function (params) {
let html = ''
params.forEach(item => {
html += item.axisValue + '\n' + item.seriesName + ': ' + item.value
html += item.axisValue + ': ' + (item.value||'')
})
return html
}
......@@ -443,17 +435,6 @@ Component({
},
// 返回停留时长配置
getStopTimeConfig(confingData) {
// let data_sample = [
// ["type", "停留时长", ''],
// ["进样", 50, 200],
// ["离心", 10, 200],
// ["去盖", 30, 200],
// ["侧轨", 15, 200],
// ["侧轨1", 15, 200],
// ["侧轨2", 15, 200],
// ["侧轨3", 15, 200],
// ["出样", 18, 200]
// ];
if (confingData.series.length <= 0) {
return {
title: {
......@@ -552,23 +533,8 @@ Component({
},
// 返回客群性别占比配置
getGroupSexConfig(faceGender) {
// let faceGender = {
// "title": "人脸性别统计",
// "series": [{
// "name": "人脸性别统计",
// "data": [{
// "name": "男",
// "value": 85
// },
// {
// "name": "女",
// "value": 262
// }
// ],
// "type": "pie"
// }]
// }
if (faceGender.series[0] && faceGender.series[0].data.every(item => item)) {
console.log(faceGender.series[0] && faceGender.series[0].data)
if (!(faceGender.series[0] && faceGender.series[0].data)) {
return {
title: {
text: '暂无数据',
......@@ -623,28 +589,14 @@ Component({
center: ["30%", "50%"],
radius: ["36%", "70%"],
showEmptyCircle: true,
itemStyle: {
// normal: {
// borderColor: "#050e31",
// borderWidth: 2
// }
},
label: {
normal: {
show: false,
position: "inside",
// color: "rgba(255, 255, 255, 0.8)",
color: "#000",
// formatter: "{value|{c}}",
formatter: function (params) {
return params.name + "\n" + params.percent + "%";
}
// rich: {
// value: {
// fontSize: 20,
// color: "#000",
// },
// },
}
},
labelLine: {
......@@ -658,48 +610,6 @@ Component({
},
// 返回客群年龄占比
getAgeConfig(faceAge) {
// let faceAge = {
// "title": "人脸年龄统计",
// "series": [{
// "name": "少年(18岁以内)",
// "data": [
// 7,
// 21
// ],
// "type": "bar"
// },
// {
// "name": "青年(19-35岁)",
// "data": [
// 54,
// 193
// ],
// "type": "bar"
// },
// {
// "name": "中年(36-55岁)",
// "data": [
// 20,
// 45
// ],
// "type": "bar"
// },
// {
// "name": "老年(55岁以上)",
// "data": [
// 4,
// 3
// ],
// "type": "bar"
// }
// ],
// "xaxis": {
// "data": [
// "男",
// "女"
// ]
// }
// }
if (faceAge.series.length <= 0) {
return {
title: {
......@@ -735,7 +645,7 @@ Component({
transitionDuration: 0
},
grid: {
top: "5%",
top: "8%",
right: "5%",
left: "10%",
bottom: "15%"
......
<!--pages/homes/index.wxml-->
<view class="container" style="padding-bottom: 80px;">
<navbar page-name="店铺首页" bg-color="RGBA(213, 227, 255, 1)" navbar-color="#000"></navbar>
<view class="~backgroundColor">
<view class="~backgroundColor" style="padding-top: {{navHeight}}px">
<!-- 名称 -->
<view class="contianer_shop">
<image src="../images/back.svg" class='images'></image>
......@@ -30,12 +30,12 @@
<view class="card">
<view class="card_passage">
<image src="../images/keliulaing.png" class="card_image"></image>
<view class="er"> 客流量</view>
<view class="er"> 进店客流</view>
<view class="er cardNum"> {{traffic}}</view>
</view>
<view class="card_passage">
<image src="../images/keliuliangyellow.png" class="card_image"></image>
<view class="er"> 曝光量</view>
<view class="er"> 路过客流</view>
<view class="er cardNum"> {{exposure}}</view>
</view>
<view class="card_passage">
......@@ -51,7 +51,7 @@
</view>
<!-- 客流趋势分析 -->
<view class="keliuliang" style="margin-top:30rpx">
<text class="title_chart">业态客流TOP5走势</text>
<text class="title_chart">客流趋势分析</text>
<view class="tab_tll">
<text class="text_tltle {{trendtypes==1?'actives':'defaults'}}" bindtap="ClickPassageFlow" data-type='1'>过店客流</text>
<text class="text_tltle {{trendtypes==2?'actives':'defaults'}}" bindtap="ClickPassageFlow" data-type='2'>进店客流</text>
......
<view class="container" style="height:{{windowHeight}}px">
<navbar page-name="我的" bg-color="RGBA(213, 227, 255, 1)" navbar-color="#000">
</navbar>
<view class="~backgroundColor">
<view class="~backgroundColor" style="padding-top: {{navHeight}}px">
<view class="header">
<image src="../images/me/avatar.png" class="avatar" />
<view class="name">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!