|
@@ -5,7 +5,8 @@
|
|
|
<image class="userFlagimg" src="../../static/img/userFlag.png" mode=""></image>
|
|
|
</view>
|
|
|
<view class="pname">
|
|
|
- <font class="wenzi" style="color: #BDD6F3;font-size:28upx"> {{$t('mainStatistics.name')}}: {{pnameData}}</font>
|
|
|
+ <font class="wenzi" style="color: #BDD6F3;font-size:28upx"> {{$t('mainStatistics.name')}}: {{pnameData}}
|
|
|
+ </font>
|
|
|
</view>
|
|
|
<view class="company">
|
|
|
<font style="color: #BDD6F3;font-size:28upx">{{$t('mainStatistics.company')}}</font>
|
|
@@ -14,7 +15,8 @@
|
|
|
<view class="ri">
|
|
|
<view class="riShell">
|
|
|
<view class="riImg">
|
|
|
- <image style="width: 64upx;height: 64upx;padding-top: 20upx;" :src="$t('mainStatistics.dayImg')"></image>
|
|
|
+ <image style="width: 64upx;height: 64upx;padding-top: 20upx;" :src="$t('mainStatistics.dayImg')">
|
|
|
+ </image>
|
|
|
</view>
|
|
|
<view class="riTitle">
|
|
|
<view style="text-align:left;font-size:28upx;font-family:PingFang-SC-Medium">
|
|
@@ -39,7 +41,8 @@
|
|
|
<view class="fourTitle">
|
|
|
<view class="four">
|
|
|
<view class="fourImg">
|
|
|
- <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.weekImg')" mode=""></image>
|
|
|
+ <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.weekImg')"
|
|
|
+ mode=""></image>
|
|
|
</view>
|
|
|
<view class="fourShell">
|
|
|
<view class="one">
|
|
@@ -55,7 +58,8 @@
|
|
|
|
|
|
<view class="four">
|
|
|
<view class="fourImg">
|
|
|
- <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.monthImg')" mode=""></image>
|
|
|
+ <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.monthImg')"
|
|
|
+ mode=""></image>
|
|
|
</view>
|
|
|
<view class="fourShell">
|
|
|
<view class="one">
|
|
@@ -71,7 +75,8 @@
|
|
|
|
|
|
<view class="four">
|
|
|
<view class="fourImg">
|
|
|
- <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.yearImg')" mode=""></image>
|
|
|
+ <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.yearImg')"
|
|
|
+ mode=""></image>
|
|
|
</view>
|
|
|
<view class="fourShell">
|
|
|
<view class="one">
|
|
@@ -87,7 +92,8 @@
|
|
|
|
|
|
<view class="four">
|
|
|
<view class="fourImg">
|
|
|
- <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.allImg')" mode=""></image>
|
|
|
+ <image style="width: 54upx;height: 54upx;padding-top: 20upx;" :src="$t('mainStatistics.allImg')"
|
|
|
+ mode=""></image>
|
|
|
</view>
|
|
|
<view class="fourShell">
|
|
|
<view class="one">
|
|
@@ -101,6 +107,21 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <!-- 商家选择 -->
|
|
|
+ <view v-if="id!=1&&type<4&&length>0" class="td-right">
|
|
|
+ <view class="uni-list">
|
|
|
+ <view class="uni-list-cell">
|
|
|
+ <view class="uni-list-cell-left">
|
|
|
+ 当前商家:
|
|
|
+ </view>
|
|
|
+ <view class="uni-list-cell-db" style="overflow: hidden;text-overflow: ellipsis;">
|
|
|
+ <picker @change="changeAdmin" :value="index" :range="adminList">
|
|
|
+ <view class="uni-input">{{adminList[index]}}</view>
|
|
|
+ </picker>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<view class="qiun-columns">
|
|
|
<view class="qiun-bg-white qiun-title-bar qiun-common-mt">
|
|
|
<view class="qiun-title-dot-light">
|
|
@@ -113,8 +134,9 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="qiun-charts" style="background-color: #FFFFFF;">
|
|
|
- <canvas canvas-id="canvaColumn1" id="canvaColumn1" class="charts" disable-scroll=true @touchstart="touchLine1"
|
|
|
- @touchmove="moveLine1" @touchend="touchEndLine1" style="background-color: #FFFFFF;"></canvas>
|
|
|
+ <canvas canvas-id="canvaColumn1" id="canvaColumn1" class="charts" disable-scroll=true
|
|
|
+ @touchstart="touchLine1" @touchmove="moveLine1" @touchend="touchEndLine1"
|
|
|
+ style="background-color: #FFFFFF;"></canvas>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="line"></view>
|
|
@@ -130,8 +152,9 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="qiun-charts" style="background-color: #FFFFFF;">
|
|
|
- <canvas canvas-id="canvaColumn2" id="canvaColumn2" class="charts" disable-scroll=true @touchstart="touchLine2"
|
|
|
- @touchmove="moveLine2" @touchend="touchEndLine2" style="background-color: #FFFFFF;"></canvas>
|
|
|
+ <canvas canvas-id="canvaColumn2" id="canvaColumn2" class="charts" disable-scroll=true
|
|
|
+ @touchstart="touchLine2" @touchmove="moveLine2" @touchend="touchEndLine2"
|
|
|
+ style="background-color: #FFFFFF;"></canvas>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="line"></view>
|
|
@@ -147,8 +170,9 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="qiun-charts" style="background-color: #FFFFFF;">
|
|
|
- <canvas canvas-id="canvaColumn3" id="canvaColumn3" class="charts" disable-scroll=true @touchstart="touchLine3"
|
|
|
- @touchmove="moveLine3" @touchend="touchEndLine3" style="background-color: #FFFFFF;"></canvas>
|
|
|
+ <canvas canvas-id="canvaColumn3" id="canvaColumn3" class="charts" disable-scroll=true
|
|
|
+ @touchstart="touchLine3" @touchmove="moveLine3" @touchend="touchEndLine3"
|
|
|
+ style="background-color: #FFFFFF;"></canvas>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="line"></view>
|
|
@@ -164,8 +188,9 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="qiun-charts" style="background-color: #FFFFFF;">
|
|
|
- <canvas canvas-id="canvaColumn4" id="canvaColumn4" class="charts" disable-scroll=true @touchstart="touchLine4"
|
|
|
- @touchmove="moveLine4" @touchend="touchEndLine4" style="background-color: #FFFFFF;"></canvas>
|
|
|
+ <canvas canvas-id="canvaColumn4" id="canvaColumn4" class="charts" disable-scroll=true
|
|
|
+ @touchstart="touchLine4" @touchmove="moveLine4" @touchend="touchEndLine4"
|
|
|
+ style="background-color: #FFFFFF;"></canvas>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -217,7 +242,13 @@
|
|
|
startDate4: '',
|
|
|
endDate4: '',
|
|
|
today: '',
|
|
|
- week: ''
|
|
|
+ week: '',
|
|
|
+ adminList: [],
|
|
|
+ admins: [],
|
|
|
+ index: 0,
|
|
|
+ id: 0,
|
|
|
+ length:0,
|
|
|
+ type: null,
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -236,6 +267,8 @@
|
|
|
index: 0,
|
|
|
text: this.$t('tabs.tab1')
|
|
|
});
|
|
|
+ this.id = 0;
|
|
|
+ this.index = 0;
|
|
|
var token = uni.getStorageSync("token");
|
|
|
if (token.toString().length > 1) {
|
|
|
this.init();
|
|
@@ -249,11 +282,16 @@
|
|
|
var globalUser = uni.getStorageSync("globalUser");
|
|
|
if (globalUser.toString().length > 1) {
|
|
|
//判断是不是初次登陆
|
|
|
- if (test == 2) {
|
|
|
- this.init();
|
|
|
+ // if (test == 2) {
|
|
|
+ // this.init();
|
|
|
+ // }
|
|
|
+ if (globalUser.type > 0&&globalUser.type<4) {
|
|
|
+ this.getAdmin();
|
|
|
}
|
|
|
+ this.id = globalUser.id;
|
|
|
+ this.type = globalUser.type;
|
|
|
}
|
|
|
- var id = this.adminId;
|
|
|
+ // var id = this.adminId;
|
|
|
|
|
|
this.day();
|
|
|
// this.equipmentStatus();
|
|
@@ -271,7 +309,7 @@
|
|
|
this.equipmentStatus();
|
|
|
},
|
|
|
methods: {
|
|
|
- ...mapActions('chart', ['getStatistics', 'getMainStatistics', 'getMachineNum']),
|
|
|
+ ...mapActions('chart', ['getStatistics', 'getMachineNum']),
|
|
|
async init() {
|
|
|
if (!this.pname) {
|
|
|
this.pname = this.loginUser.name;
|
|
@@ -301,6 +339,92 @@
|
|
|
this.week = this.$t('mainStatistics.week' + date.getDay());
|
|
|
|
|
|
},
|
|
|
+ //查询下级用户
|
|
|
+ getAdmin() {
|
|
|
+ var param = {};
|
|
|
+ var token = uni.getStorageSync("token");
|
|
|
+ var globalUser = uni.getStorageSync("globalUser");
|
|
|
+ param['id'] = globalUser.id;
|
|
|
+ uni.request({
|
|
|
+ url: this.serverurl + '/TAdmin/selectLowAdmin',
|
|
|
+ data: param,
|
|
|
+ header: {
|
|
|
+ 'token': token
|
|
|
+ },
|
|
|
+ method: "POST",
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.code) {
|
|
|
+ var admins = res.data.data;
|
|
|
+ this.admins = admins;
|
|
|
+ var adminList = [];
|
|
|
+ adminList.push('本商户');
|
|
|
+ if (admins.length > 0) {
|
|
|
+ this.length = admins.length;
|
|
|
+ adminList.push('所有下级');
|
|
|
+ for (var i = 1; i < admins.length; i++) {
|
|
|
+ // console.log(admins[i].name)
|
|
|
+ if (admins[i].name != null || admins[i].name != '') {
|
|
|
+ adminList.push(admins[i].name);
|
|
|
+ } else {
|
|
|
+ adminList.push(admins[i].username);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.adminList = adminList;
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: `获取信息失败:` + res.data.message,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
+ // this.selectLowAdmin(param)
|
|
|
+ // .then(res => {
|
|
|
+ // if (res.code) {
|
|
|
+ // var admins = res.data;
|
|
|
+ // this.admins = admins;
|
|
|
+ // var adminList = [];
|
|
|
+ // adminList.push('本商户');
|
|
|
+ // if (admins.length > 0) {
|
|
|
+ // this.length = admins.length;
|
|
|
+ // adminList.push('所有下级');
|
|
|
+ // for (var i = 1; i < admins.length; i++) {
|
|
|
+ // // console.log(admins[i].name)
|
|
|
+ // if (admins[i].name != null || admins[i].name != '') {
|
|
|
+ // adminList.push(admins[i].name);
|
|
|
+ // } else {
|
|
|
+ // adminList.push(admins[i].username);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // this.adminList = adminList;
|
|
|
+ // } else {
|
|
|
+ // uni.showToast({
|
|
|
+ // title: `获取信息失败:` + res.message,
|
|
|
+ // icon: 'none'
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ // 改变商家
|
|
|
+ changeAdmin: function(e){
|
|
|
+ this.index = e.target.value;
|
|
|
+ var id = '';
|
|
|
+ if(e.target.value>1){
|
|
|
+ id = this.admins[e.target.value-1].id;
|
|
|
+ }
|
|
|
+ if(e.target.value==1){
|
|
|
+ id = 'all';
|
|
|
+ }
|
|
|
+ if(e.target.value==0){
|
|
|
+ id = 0;
|
|
|
+ }
|
|
|
+ // console.log("adminID="+id);
|
|
|
+ this.id = id;
|
|
|
+ this.init();
|
|
|
+
|
|
|
+ },
|
|
|
equipmentStatus() {
|
|
|
var that = this;
|
|
|
var id = uni.getStorageSync("globalUser").id;
|
|
@@ -321,7 +445,7 @@
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
- checkEquipmentStatus(id){
|
|
|
+ checkEquipmentStatus(id) {
|
|
|
var token = uni.getStorageSync("token");
|
|
|
uni.request({
|
|
|
url: this.serverurl + '/TEquipment/checkEquipmentStatus',
|
|
@@ -333,7 +457,7 @@
|
|
|
},
|
|
|
method: "POST",
|
|
|
success: (res) => {
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
});
|
|
|
},
|
|
@@ -435,6 +559,24 @@
|
|
|
if (this.equipmentId) {
|
|
|
param['equipmentId'] = this.equipmentId;
|
|
|
}
|
|
|
+ if (this.id!=1) {
|
|
|
+ var id = this.id;
|
|
|
+ }else{
|
|
|
+ var id = 0;
|
|
|
+ }
|
|
|
+ if(id=='all'){
|
|
|
+ param['adminId'] = null;
|
|
|
+ if(this.type==1){
|
|
|
+ param['agencyId'] = globalUser.id;
|
|
|
+ }
|
|
|
+ if(this.type==2){
|
|
|
+ param['merchantId'] = globalUser.id;
|
|
|
+ }
|
|
|
+ }else if(id==0){
|
|
|
+
|
|
|
+ }else{
|
|
|
+ param['adminId'] = id;
|
|
|
+ }
|
|
|
return this.getStatistics(param)
|
|
|
.then(data => {
|
|
|
uni.stopPullDownRefresh();
|
|
@@ -492,36 +634,39 @@
|
|
|
});
|
|
|
},
|
|
|
initChart(canvasId, chartData) {
|
|
|
- if (this.$t('lang') != 'zh') {
|
|
|
- chartData.categories = chartData.categories.map(e => {
|
|
|
- if (e.indexOf('点') >= 0) {
|
|
|
- return e.replace('点', this.$t('mainStatistics.oclock'));
|
|
|
- }
|
|
|
- if (e.indexOf('周') >= 0) {
|
|
|
- const weekNum = e.substring(e.length - 1) == '日' ? '0' : e.substring(e.length - 1);
|
|
|
- return this.$t('mainStatistics.week' + weekNum);
|
|
|
- }
|
|
|
- if (e.indexOf('月') >= 0) {
|
|
|
- var res = e.toString();
|
|
|
- if (res.length > 3) {
|
|
|
- return e.replace('月', this.$t('mainStatistics.mon'));
|
|
|
- } else {
|
|
|
- return e.replace('月', this.$t('mainStatistics.y'));
|
|
|
+ if (this.$t('lang') != null && this.$t('lang') != '') {
|
|
|
+ if (this.$t('lang') != 'zh') {
|
|
|
+ chartData.categories = chartData.categories.map(e => {
|
|
|
+ if (e.indexOf('点') >= 0) {
|
|
|
+ return e.replace('点', this.$t('mainStatistics.oclock'));
|
|
|
}
|
|
|
- }
|
|
|
- return e;
|
|
|
- });
|
|
|
+ if (e.indexOf('周') >= 0) {
|
|
|
+ const weekNum = e.substring(e.length - 1) == '日' ? '0' : e.substring(e.length - 1);
|
|
|
+ return this.$t('mainStatistics.week' + weekNum);
|
|
|
+ }
|
|
|
+ if (e.indexOf('月') >= 0) {
|
|
|
+ var res = e.toString();
|
|
|
+ if (res.length > 3) {
|
|
|
+ return e.replace('月', this.$t('mainStatistics.mon'));
|
|
|
+ } else {
|
|
|
+ return e.replace('月', this.$t('mainStatistics.y'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return e;
|
|
|
+ });
|
|
|
|
|
|
- chartData.series = chartData.series.map(e => {
|
|
|
- if (e['name'] == '销售个数') {
|
|
|
- e['name'] = this.$t('mainStatistics.saleNum');
|
|
|
- }
|
|
|
- if (e['name'] == '销售额') {
|
|
|
- e['name'] = this.$t('mainStatistics.saleroom');
|
|
|
- }
|
|
|
- return e;
|
|
|
- });
|
|
|
+ chartData.series = chartData.series.map(e => {
|
|
|
+ if (e['name'] == '销售个数') {
|
|
|
+ e['name'] = this.$t('mainStatistics.saleNum');
|
|
|
+ }
|
|
|
+ if (e['name'] == '销售额') {
|
|
|
+ e['name'] = this.$t('mainStatistics.saleroom');
|
|
|
+ }
|
|
|
+ return e;
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
return new uCharts({
|
|
|
$this: _self,
|
|
|
canvasId: canvasId,
|
|
@@ -579,6 +724,26 @@
|
|
|
if (this.equipmentId) {
|
|
|
param['equipmentId'] = this.equipmentId;
|
|
|
}
|
|
|
+ if (this.id!=1) {
|
|
|
+ var id = this.id;
|
|
|
+ }else{
|
|
|
+ var id = 0;
|
|
|
+ }
|
|
|
+ var aid = param.adminId;
|
|
|
+ if(id=='all'){
|
|
|
+ param['adminId'] = null;
|
|
|
+ if(this.type==1){
|
|
|
+ param['agencyId'] = globalUser.id;
|
|
|
+ }
|
|
|
+ if(this.type==2){
|
|
|
+ param['merchantId'] = globalUser.id;
|
|
|
+ }
|
|
|
+ }else if(id==0){
|
|
|
+
|
|
|
+ }else{
|
|
|
+ param['adminId'] = id;
|
|
|
+ aid = id;
|
|
|
+ }
|
|
|
// console.log('getMainStatisticsData:{}', param);
|
|
|
var adminId = param.adminId;
|
|
|
var equipmentId = this.equipmentId;
|
|
@@ -587,7 +752,7 @@
|
|
|
uni.request({
|
|
|
url: serverurl + '/TEquipment/getMachineNum',
|
|
|
data: {
|
|
|
- "adminId": adminId,
|
|
|
+ "adminId": aid,
|
|
|
"equipmentId": equipmentId
|
|
|
},
|
|
|
method: "POST",
|
|
@@ -600,9 +765,16 @@
|
|
|
this.machineUseNum = list[1];
|
|
|
}
|
|
|
});
|
|
|
- return this.getMainStatistics(param)
|
|
|
- .then(data => {
|
|
|
- for (let bean of data) {
|
|
|
+ uni.request({
|
|
|
+ url: serverurl + '/TOrder/getMainStatistics',
|
|
|
+ data: param,
|
|
|
+ method: "POST",
|
|
|
+ header: {
|
|
|
+ 'token': token
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ var list = res.data.data;
|
|
|
+ for (let bean of list) {
|
|
|
if (bean['categorie'] === 'day') {
|
|
|
this.dayTotalMoney = bean['salePrice'];
|
|
|
this.dayTotalNum = bean['saleNum'];
|
|
@@ -620,8 +792,31 @@
|
|
|
this.yearTotalNum = bean['saleNum'];
|
|
|
}
|
|
|
}
|
|
|
- uni.stopPullDownRefresh();
|
|
|
- }, _ => void uni.stopPullDownRefresh());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // return this.getMainStatistics(param)
|
|
|
+ // .then(data => {
|
|
|
+ // for (let bean of data) {
|
|
|
+ // if (bean['categorie'] === 'day') {
|
|
|
+ // this.dayTotalMoney = bean['salePrice'];
|
|
|
+ // this.dayTotalNum = bean['saleNum'];
|
|
|
+ // }
|
|
|
+ // if (bean['categorie'] === 'week') {
|
|
|
+ // this.weekTotalMoney = bean['salePrice'];
|
|
|
+ // this.weekTotalNum = bean['saleNum'];
|
|
|
+ // }
|
|
|
+ // if (bean['categorie'] === 'month') {
|
|
|
+ // this.monthTotalMoney = bean['salePrice'];
|
|
|
+ // this.monthTotalNum = bean['saleNum'];
|
|
|
+ // }
|
|
|
+ // if (bean['categorie'] === 'year') {
|
|
|
+ // this.yearTotalMoney = bean['salePrice'];
|
|
|
+ // this.yearTotalNum = bean['saleNum'];
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // uni.stopPullDownRefresh();
|
|
|
+ // }, _ => void uni.stopPullDownRefresh());
|
|
|
+
|
|
|
},
|
|
|
|
|
|
touchLine1(e) {
|
|
@@ -916,4 +1111,30 @@
|
|
|
.fontLeft {
|
|
|
margin-right: 6upx;
|
|
|
}
|
|
|
+
|
|
|
+ .tr {
|
|
|
+ padding-top: 15upx;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ justify-content: flex-start;
|
|
|
+ font-size: 26upx;
|
|
|
+ font-family: "PingFang-SC-Bold";
|
|
|
+ }
|
|
|
+
|
|
|
+ .td-left {
|
|
|
+ font-family: "PingFang-SC-Bold";
|
|
|
+ margin: auto;
|
|
|
+ font-size: 26upx;
|
|
|
+ width: 30%;
|
|
|
+ text-align: right;
|
|
|
+ }
|
|
|
+
|
|
|
+ .td-right {
|
|
|
+ font-family: "PingFang-SC-Bold";
|
|
|
+ /* font-weight: bold; */
|
|
|
+ margin: auto;
|
|
|
+ /* font-size: 26upx; */
|
|
|
+ width: 70%;
|
|
|
+ text-align: left;
|
|
|
+ }
|
|
|
</style>
|