|
@@ -195,14 +195,14 @@
|
|
|
</view>
|
|
|
<view v-show="noticeShow">
|
|
|
<uni-popup id="popupDialog" ref="popupDialog" type="dialog">
|
|
|
- <uni-popup-dialog :type="msgType" title="通知" content="欢迎使用 unisdfdd-popup!"
|
|
|
- :before-close="true" @confirm="dialogConfirm(noticeId)" @close="dialogClose">
|
|
|
- <scroll-view scroll-y="true" class="scroll-Y" :style="{height:scrollHeight*0.8+'px'}">
|
|
|
+ <uni-popup-dialog :type="msgType" title="通知" content="欢迎使用 unisdfdd-popup!" :before-close="true"
|
|
|
+ @confirm="dialogConfirm(noticeId)" @close="dialogClose">
|
|
|
+ <scroll-view scroll-y="true" class="scroll-Y" :style="{height:scrollHeight*0.8+'px'}">
|
|
|
<view class="scroll-view-item ">
|
|
|
- {{noticeTitle}}<br/>
|
|
|
+ {{noticeTitle}}<br />
|
|
|
<p v-html="noticeNote">{{noticeNote}}</p>
|
|
|
</view>
|
|
|
-
|
|
|
+
|
|
|
</scroll-view>
|
|
|
</uni-popup-dialog>
|
|
|
</uni-popup>
|
|
@@ -261,15 +261,15 @@
|
|
|
admins: [],
|
|
|
index: 0,
|
|
|
id: 0,
|
|
|
- length:0,
|
|
|
- type:null,
|
|
|
- noticeShow:false,
|
|
|
- noticeTRUE:true,
|
|
|
- noticeTitle:'',
|
|
|
- noticeNote:'',
|
|
|
- noticeId:'',
|
|
|
+ length: 0,
|
|
|
+ type: null,
|
|
|
+ noticeShow: false,
|
|
|
+ noticeTRUE: true,
|
|
|
+ noticeTitle: '',
|
|
|
+ noticeNote: '',
|
|
|
+ noticeId: '',
|
|
|
msgType: 'success',
|
|
|
- scrollHeight:uni.getSystemInfoSync().windowHeight - 130,
|
|
|
+ scrollHeight: uni.getSystemInfoSync().windowHeight - 130,
|
|
|
}
|
|
|
},
|
|
|
onReady() {
|
|
@@ -295,13 +295,14 @@
|
|
|
index: 0,
|
|
|
text: this.$t('tabs.tab1')
|
|
|
});
|
|
|
+ // uni.setStorageSync('test',1);
|
|
|
this.id = 0;
|
|
|
this.index = 0;
|
|
|
var test = uni.getStorageSync('test');
|
|
|
var globalUser = uni.getStorageSync("globalUser");
|
|
|
//test 判断是不是初次登陆
|
|
|
- if(globalUser.id!=1&&test==1){
|
|
|
- setTimeout(()=>{
|
|
|
+ if (globalUser.id != 1 && test == 1) {
|
|
|
+ setTimeout(() => {
|
|
|
this.getNOtice();
|
|
|
}, 5000);
|
|
|
}
|
|
@@ -314,7 +315,7 @@
|
|
|
});
|
|
|
}
|
|
|
if (globalUser.toString().length > 1) {
|
|
|
- if (globalUser.type > 0&&globalUser.type<4) {
|
|
|
+ if (globalUser.type > 0 && globalUser.type < 4) {
|
|
|
this.getAdmin();
|
|
|
}
|
|
|
this.id = globalUser.id;
|
|
@@ -325,7 +326,10 @@
|
|
|
mounted() {
|
|
|
var token = uni.getStorageSync("token");
|
|
|
if (token.toString().length > 1) {
|
|
|
- this.init();
|
|
|
+ var test = uni.getStorageSync('test');
|
|
|
+ if (test > 1||test==0) {
|
|
|
+ this.init();
|
|
|
+ }
|
|
|
} else {
|
|
|
uni.reLaunch({
|
|
|
url: '../Login/Login',
|
|
@@ -349,23 +353,26 @@
|
|
|
this.cHeight = uni.upx2px(370);
|
|
|
|
|
|
await this.getMainStatisticsData();
|
|
|
+ var test = uni.getStorageSync('test');
|
|
|
+ await this.initDateRang(new Date(), 'day', 0);
|
|
|
+ if (test == null || test < 2) {
|
|
|
+ await this.initDateRang(new Date(), 'week', 0);
|
|
|
+ await this.initDateRang(new Date(), 'month', 0);
|
|
|
+ await this.initDateRang(new Date(), 'year', 0);
|
|
|
+ }
|
|
|
|
|
|
- await this.initDateRang(new Date(), 'day');
|
|
|
- await this.initDateRang(new Date(), 'week');
|
|
|
- await this.initDateRang(new Date(), 'month');
|
|
|
- await this.initDateRang(new Date(), 'year');
|
|
|
var test = uni.getStorageSync('test');
|
|
|
var globalUser = uni.getStorageSync("globalUser");
|
|
|
//初次登陆跳转后,把test变成2
|
|
|
uni.setStorageSync('test', '2');
|
|
|
|
|
|
},
|
|
|
- getNOtice(){
|
|
|
+ getNOtice() {
|
|
|
// console.log("notice")
|
|
|
var globalUser = uni.getStorageSync("globalUser");
|
|
|
var token = uni.getStorageSync("token");
|
|
|
uni.request({
|
|
|
- url: this.serverurl + '/TNotice/getNotice?id='+globalUser.id,
|
|
|
+ url: this.serverurl + '/TNotice/getNotice?id=' + globalUser.id,
|
|
|
// data: {
|
|
|
// "id": globalUser.id
|
|
|
// },
|
|
@@ -374,15 +381,15 @@
|
|
|
},
|
|
|
method: "POST",
|
|
|
success: (res) => {
|
|
|
- if(res.data.code){
|
|
|
- if(res.data.message=='1'){
|
|
|
+ if (res.data.code) {
|
|
|
+ if (res.data.message == '1') {
|
|
|
var notice = res.data.data;
|
|
|
- this.noticeTitle =notice.title,
|
|
|
- this.noticeNote = notice.note,
|
|
|
- this.noticeId = notice.id,
|
|
|
- this.noticeTRUE = false,
|
|
|
- this.noticeShow = true,
|
|
|
- this.$refs.popupDialog.open()
|
|
|
+ this.noticeTitle = notice.title,
|
|
|
+ this.noticeNote = notice.note,
|
|
|
+ this.noticeId = notice.id,
|
|
|
+ this.noticeTRUE = false,
|
|
|
+ this.noticeShow = true,
|
|
|
+ this.$refs.popupDialog.open()
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -414,7 +421,7 @@
|
|
|
if (res.data.code) {
|
|
|
var admins = res.data.data;
|
|
|
// this.admins = admins;
|
|
|
- var adminss = [];
|
|
|
+ var adminss = [];
|
|
|
var adminList = [];
|
|
|
adminList.push('本商户');
|
|
|
if (admins.length > 0) {
|
|
@@ -422,10 +429,10 @@
|
|
|
adminList.push('所有下级');
|
|
|
for (var i = 0; i < admins.length; i++) {
|
|
|
// console.log(admins[i].name)
|
|
|
- if(i==0){
|
|
|
+ if (i == 0) {
|
|
|
var globalUser = uni.getStorageSync("globalUser");
|
|
|
var id = admins[i].id;
|
|
|
- if(id==globalUser.id){
|
|
|
+ if (id == globalUser.id) {
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
@@ -448,25 +455,26 @@
|
|
|
}
|
|
|
},
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
// 改变商家
|
|
|
- changeAdmin: function(e){
|
|
|
+ changeAdmin: function(e) {
|
|
|
this.index = e.target.value;
|
|
|
var id = '';
|
|
|
- if(e.target.value>1){
|
|
|
- id = this.admins[e.target.value-2].id;
|
|
|
+ if (e.target.value > 1) {
|
|
|
+ id = this.admins[e.target.value - 2].id;
|
|
|
}
|
|
|
- if(e.target.value==1){
|
|
|
+ if (e.target.value == 1) {
|
|
|
id = 'all';
|
|
|
}
|
|
|
- if(e.target.value==0){
|
|
|
+ if (e.target.value == 0) {
|
|
|
id = 0;
|
|
|
}
|
|
|
// console.log("adminID="+id);
|
|
|
this.id = id;
|
|
|
+ uni.setStorageSync('test', 1);
|
|
|
this.init();
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
equipmentStatus() {
|
|
|
var that = this;
|
|
@@ -504,7 +512,7 @@
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
- initDateRang(day, chartType) {
|
|
|
+ initDateRang(day, chartType, type) {
|
|
|
const daystr = dateUtils.formateDate(day, 'yyyy/MM/dd');
|
|
|
if (chartType === 'day') {
|
|
|
this.startDate1 = dateUtils.formateDate(day, 'yyyy/MM/dd');
|
|
@@ -522,7 +530,7 @@
|
|
|
this.endDate4 = dateUtils.formateDate(dateUtils.getCurrentYearLastDate(day), 'yyyy/MM/dd');
|
|
|
}
|
|
|
|
|
|
- return this.getStatisticsData(chartType);
|
|
|
+ return this.getStatisticsData(chartType, type);
|
|
|
},
|
|
|
/**上一个 */
|
|
|
pre(chartType) {
|
|
@@ -543,7 +551,7 @@
|
|
|
day = new Date(this.startDate4);
|
|
|
day.setFullYear(day.getFullYear() - 1);
|
|
|
}
|
|
|
- this.initDateRang(day, chartType);
|
|
|
+ this.initDateRang(day, chartType, 1);
|
|
|
},
|
|
|
/**下一个 */
|
|
|
next(chartType) {
|
|
@@ -565,9 +573,10 @@
|
|
|
day.setFullYear(day.getFullYear() + 1);
|
|
|
}
|
|
|
|
|
|
- this.initDateRang(day, chartType);
|
|
|
+ this.initDateRang(day, chartType, 1);
|
|
|
},
|
|
|
- getStatisticsData(chartType) {
|
|
|
+ getStatisticsData(chartType, type) {
|
|
|
+ //type=0 头顶统计数字变,type=1 头顶统计数字不变
|
|
|
const param = {
|
|
|
'chartType': chartType
|
|
|
};
|
|
@@ -602,38 +611,87 @@
|
|
|
if (this.equipmentId) {
|
|
|
param['equipmentId'] = this.equipmentId;
|
|
|
}
|
|
|
- if (this.id!=1) {
|
|
|
+ if (this.id != 1) {
|
|
|
var id = this.id;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
var id = 0;
|
|
|
}
|
|
|
- if(id=='all'){
|
|
|
+ if (id == 'all') {
|
|
|
param['adminId'] = null;
|
|
|
- if(this.type==1){
|
|
|
+ if (this.type == 1) {
|
|
|
param['agencyId'] = globalUser.id;
|
|
|
}
|
|
|
- if(this.type==2){
|
|
|
+ if (this.type == 2) {
|
|
|
param['merchantId'] = globalUser.id;
|
|
|
}
|
|
|
- }else if(id==0){
|
|
|
-
|
|
|
- }else{
|
|
|
+ } else if (id == 0) {
|
|
|
+
|
|
|
+ } else {
|
|
|
param['adminId'] = id;
|
|
|
}
|
|
|
+ var type = type;
|
|
|
return this.getStatistics(param)
|
|
|
.then(data => {
|
|
|
uni.stopPullDownRefresh();
|
|
|
+ var date = new Date();
|
|
|
+ var num = date.getDay(); //'日一二三四五六'0123456
|
|
|
+ var categories = data.categories;
|
|
|
+ var series = data.series;
|
|
|
if (param['chartType'] == 'day') {
|
|
|
canvaColumn1 = this.initChart('canvaColumn1', data);
|
|
|
+ if (type == 0) {
|
|
|
+ var dayTotalMoney = 0;
|
|
|
+ var dayTotalNum = 0;
|
|
|
+ for (var i = 0; i < series[0].data.length; i++) {
|
|
|
+ dayTotalMoney = dayTotalMoney + series[1].data[i];
|
|
|
+ dayTotalNum = dayTotalNum + series[0].data[i]
|
|
|
+ }
|
|
|
+ this.dayTotalNum = dayTotalNum;
|
|
|
+ this.dayTotalMoney = dayTotalMoney;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
if (param['chartType'] == 'week') {
|
|
|
canvaColumn2 = this.initChart('canvaColumn2', data);
|
|
|
+ if (type == 0) {
|
|
|
+ var weekTotalMoney = 0;
|
|
|
+ var weekTotalNum = 0;
|
|
|
+ for (var i = 0; i < series[0].data.length; i++) {
|
|
|
+ weekTotalMoney = weekTotalMoney + series[1].data[i];
|
|
|
+ weekTotalNum = weekTotalNum + series[0].data[i]
|
|
|
+ }
|
|
|
+ this.weekTotalMoney = weekTotalMoney;
|
|
|
+ this.weekTotalNum = weekTotalNum;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
if (param['chartType'] == 'month') {
|
|
|
canvaColumn3 = this.initChart('canvaColumn3', data);
|
|
|
+ if (type == 0) {
|
|
|
+ var monthTotalMoney = 0;
|
|
|
+ var monthTotalNum = 0;
|
|
|
+ for (var i = 0; i < series[0].data.length; i++) {
|
|
|
+ monthTotalMoney = monthTotalMoney + series[1].data[i];
|
|
|
+ monthTotalNum = monthTotalNum + series[0].data[i]
|
|
|
+ }
|
|
|
+ this.monthTotalMoney = monthTotalMoney;
|
|
|
+ this.monthTotalNum = monthTotalNum;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
if (param['chartType'] == 'year') {
|
|
|
canvaColumn4 = this.initChart('canvaColumn4', data);
|
|
|
+ if (type == 0) {
|
|
|
+ var yearTotalMoney = 0;
|
|
|
+ var yearTotalNum = 0;
|
|
|
+ for (var i = 0; i < series[0].data.length; i++) {
|
|
|
+ yearTotalMoney = yearTotalMoney + series[1].data[i];
|
|
|
+ yearTotalNum = yearTotalNum + series[0].data[i]
|
|
|
+ }
|
|
|
+ this.yearTotalMoney = yearTotalMoney;
|
|
|
+ this.yearTotalNum = yearTotalNum;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}, _ => {
|
|
@@ -767,23 +825,23 @@
|
|
|
if (this.equipmentId) {
|
|
|
param['equipmentId'] = this.equipmentId;
|
|
|
}
|
|
|
- if (this.id!=1) {
|
|
|
+ if (this.id != 1) {
|
|
|
var id = this.id;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
var id = 0;
|
|
|
}
|
|
|
var aid = param.adminId;
|
|
|
- if(id=='all'){
|
|
|
+ if (id == 'all') {
|
|
|
param['adminId'] = null;
|
|
|
- if(this.type==1){
|
|
|
+ if (this.type == 1) {
|
|
|
param['agencyId'] = globalUser.id;
|
|
|
}
|
|
|
- if(this.type==2){
|
|
|
+ if (this.type == 2) {
|
|
|
param['merchantId'] = globalUser.id;
|
|
|
}
|
|
|
- }else if(id==0){
|
|
|
-
|
|
|
- }else{
|
|
|
+ } else if (id == 0) {
|
|
|
+
|
|
|
+ } else {
|
|
|
param['adminId'] = id;
|
|
|
aid = id;
|
|
|
}
|
|
@@ -792,6 +850,8 @@
|
|
|
var equipmentId = this.equipmentId;
|
|
|
var serverurl = this.serverurl;
|
|
|
var token = uni.getStorageSync("token");
|
|
|
+ var test = uni.getStorageSync("test");
|
|
|
+ param['test'] = test;
|
|
|
uni.request({
|
|
|
url: serverurl + '/TEquipment/getMachineNum',
|
|
|
data: {
|
|
@@ -808,38 +868,16 @@
|
|
|
this.machineUseNum = list[1];
|
|
|
}
|
|
|
});
|
|
|
- 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'];
|
|
|
- }
|
|
|
- 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'];
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- // 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'];
|
|
@@ -857,9 +895,9 @@
|
|
|
// this.yearTotalNum = bean['saleNum'];
|
|
|
// }
|
|
|
// }
|
|
|
- // uni.stopPullDownRefresh();
|
|
|
- // }, _ => void uni.stopPullDownRefresh());
|
|
|
-
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+
|
|
|
},
|
|
|
|
|
|
touchLine1(e) {
|
|
@@ -947,12 +985,12 @@
|
|
|
}
|
|
|
},
|
|
|
// 点击确定
|
|
|
- dialogConfirm(id){
|
|
|
+ dialogConfirm(id) {
|
|
|
this.noticeTRUE = true;
|
|
|
var adminId = uni.getStorageSync("globalUser").id;
|
|
|
var token = uni.getStorageSync("token");
|
|
|
uni.request({
|
|
|
- url: this.serverurl + '/TNotice/updateNotice?adminId='+adminId+'¬iceId='+id,
|
|
|
+ url: this.serverurl + '/TNotice/updateNotice?adminId=' + adminId + '¬iceId=' + id,
|
|
|
// data: {
|
|
|
// "adminId": adminId,
|
|
|
// "noticeId":id
|
|
@@ -966,7 +1004,7 @@
|
|
|
title: "提示",
|
|
|
content: res.data.message,
|
|
|
success: (res) => {
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -974,12 +1012,12 @@
|
|
|
this.$refs.popupDialog.close()
|
|
|
},
|
|
|
//点击取消
|
|
|
- dialogClose(done){
|
|
|
+ dialogClose(done) {
|
|
|
this.noticeTRUE = true,
|
|
|
- // this.msgType = 'success'
|
|
|
- // 需要执行 done 才能关闭对话框
|
|
|
- this.$refs.popupDialog.close()
|
|
|
- }
|
|
|
+ // this.msgType = 'success'
|
|
|
+ // 需要执行 done 才能关闭对话框
|
|
|
+ this.$refs.popupDialog.close()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|