生活费额度提交更新

parent 076f9730
......@@ -103,8 +103,8 @@
</view>
</view>
<view class="school-report-context-card-one-context-txt">
消费 <text class="txt-important">{{consumerAmountObj.consumerAmount}}</text>元,超过全校
<text class="txt-important">{{consumerAmountObj.exceedRate}}%</text>
消费 <text class="txt-important">{{consumerAmountObj.consumerrental}}</text>元,超过全校
<text class="txt-important">{{consumerAmountObj.gtgraderate}}%</text>
的同学<text v-if="isReasonable">,请及时评估生活费是否合理</text>
</view>
</view>
......@@ -285,15 +285,15 @@
<view class="school-report-context-card-four-conclusion">
<view class="school-report-context-card-four-conclusion-item">
<text>消费<text
class="consume-total">{{consumerAmountObj.consumerAmount}}</text>元,超过全校<text
class="consume-total">{{consumerAmountObj.exceedRate}}%</text>的同学<text
class="consume-total">{{consumerAmountObj.consumerrental}}</text>元,超过同年级<text
class="consume-total">{{consumerAmountObj.gtgraderate}}%</text>的同学<text
v-if="isReasonable">,请及时评估生活费是否合理</text></text>
</view>
</view>
<view class="consume-total-img">
<view class="school-average" :style="{height:schoolAverageHeight+'rpx'}">
<view class="school-average-num">
<text>{{consumerAmountObj.schoolAmount}}</text>
<text>{{consumerAmountObj.schoolavgamount}}</text>
</view>
<view class="school-average-img">
<image src="../../static/images/greenArrow.png" mode=""></image>
......@@ -301,20 +301,31 @@
</view>
<view class="user-consume" :style="{height:userConsumeHeight+'rpx'}">
<view class="user-consume-num">
<text>{{consumerAmountObj.consumerAmount}}</text>
<text>{{consumerAmountObj.consumerrental}}</text>
</view>
<view class="user-consume-img">
<image src="../../static/images/yellowArrow.png" mode=""></image>
</view>
</view>
<view class="school-average" :style="{height:gradeAverageHeight+'rpx'}">
<view class="school-average-num">
<text>{{consumerAmountObj.gradeavgamount}}</text>
</view>
<view class="school-average-img">
<image src="../../static/images/greenArrow.png" mode=""></image>
</view>
</view>
</view>
<view class="consume-total-img-des">
<view class="consume-total-img-des-item school-average-des">
<view class="consume-total-img-des-item">
<text>全校平均</text>
</view>
<view class="consume-total-img-des-item">
<view class="consume-total-img-des-item consume-des">
<text>本人消费</text>
</view>
<view class="consume-total-img-des-item">
<text>全年级平均</text>
</view>
</view>
</view>
<view v-if="tabIndex==1&&isOpen" class="school-report-context-card-five">
......@@ -785,6 +796,7 @@
isReasonable: false,
schoolAverageHeight: '',
userConsumeHeight: '',
gradeAverageHeight: '',
// 消费趋势
consumerTrend: {},
isAbnormal: false,
......@@ -832,10 +844,10 @@
}
},
mounted() {
if (this.isPeakPeriod()) {
this.showReport = false;
return
}
// if (this.isPeakPeriod()) {
// this.showReport = false;
// return
// }
this.showReport = true;
// 有无消费报告入口
if (new Date().getTime() <= new Date('2022/06/30').getTime()) {
......@@ -865,11 +877,11 @@
this.memberInfo.invalidDateStr = '2022年6月30日';
this.memberInfo.differDay = dayjs('2022/06/30').diff(dayjs(), 'day');
this.containerHeight = 4200;
this.queryStudentConsumerPreference(1).then(e => this.piechart());
this.queryConsumerSummaryAmount(1).then(e => this.piechart());
this.queryDayConsumerTrend(1).then(e => this.linechart(this.reportTypeIndex));
} else {
this.queryIsDredgeMember(1002, 1).then(() => {
this.queryStudentConsumerPreference(1).then(e => this
this.queryConsumerSummaryAmount(1).then(e => this
.piechart());
this.queryDayConsumerTrend(1).then(e => this.linechart(this
.reportTypeIndex));
......@@ -883,11 +895,11 @@
this.memberInfo.invalidDateStr = '2022年6月30日';
this.memberInfo.differDay = dayjs('2022/06/30').diff(dayjs(), 'day');
this.containerHeight = 4200;
this.queryStudentConsumerPreference(1).then(e => this.piechart());
this.queryConsumerSummaryAmount(1).then(e => this.piechart());
this.queryDayConsumerTrend(1).then(e => this.linechart(this.reportTypeIndex));
} else {
this.queryIsDredgeMember(1002, 1).then(() => {
this.queryStudentConsumerPreference();
this.queryConsumerSummaryAmount();
this.queryDayConsumerTrend();
});
}
......@@ -924,7 +936,6 @@
this.diningSituations.notRepastDetails = {};
}
});
this.queryConsumerTrend();
},
methods: {
// 当天6:30 ~ 9:00,11:30 ~ 12:00, 17:30 ~ 19:00属于高峰期
......@@ -969,14 +980,14 @@
this.diningSituations.notRepastDetails = {};
}
});
this.queryConsumerTrend();
this.queryConsumerSummaryAmount();
this.$nextTick(() => {
if (this.isOpen) {
this.queryStudentConsumerPreference(1).then(e => this.piechart());
this.queryConsumerSummaryAmount(1).then(e => this.piechart());
this.queryDayConsumerTrend(1).then(e => this.linechart(this
.reportTypeIndex));
} else {
this.queryStudentConsumerPreference();
this.queryConsumerSummaryAmount();
this.queryDayConsumerTrend();
}
})
......@@ -1640,7 +1651,8 @@ color: #FF8646;padding:13rpx 12rpx 30rpx 17rpx;`,
schoolId: getQueryParams('schoolId'),
userId: getQueryParams('userId'),
startDate,
endDate
endDate,
timeType: this.dataRangeIndex == 0 ? 2 : 1
})
if (data.code != 200) {
uni.showToast({
......@@ -1676,64 +1688,61 @@ color: #FF8646;padding:13rpx 12rpx 30rpx 17rpx;`,
})
}
},
// 查询学生消费偏好类型
async queryStudentConsumerPreference(num) {
try {
let data = await this.$http.get({
url: gHost +
'/report-push/campus-consumer-report/queryStudentConsumerPreference'
}, {
schoolId: getQueryParams('schoolId'),
userId: getQueryParams('userId'),
startDate: this.dataRangeArr[this.dataRangeIndex].startDate,
endDate: this.dataRangeArr[this.dataRangeIndex].endDate,
})
if (data.code != 200) {
uni.showToast({
icon: "none",
mask: true,
title: data.msg
})
return
}
if (!data.obj) return;
const tmpObj = data.obj;
this.isEatLow = tmpObj.canteenAmount / tmpObj.grossAmount < 0.5 ? true : false;
if (num) {
this.pieDatas = [
[{
name: '正餐',
value: tmpObj.canteenAmount
}, {
name: '超市',
value: tmpObj.supermarketAmount
}, {
name: '其他',
value: tmpObj.otherAmount
}]
]
// 三数排序
numsort(obj1, obj2, obj3) {
obj1.num < obj2.num && (
obj1.num = obj1.num ^ obj2.num,
obj2.num = obj2.num ^ obj1.num,
obj1.num = obj1.num ^ obj2.num
);
obj2.num < obj3.num && (
obj2.num = obj2.num ^ obj3.num,
obj3.num = obj3.num ^ obj2.num,
obj2.num = obj2.num ^ obj3.num
);
obj1.num < obj2.num && (
obj1.num = obj1.num ^ obj2.num,
obj2.num = obj2.num ^ obj1.num,
obj1.num = obj1.num ^ obj2.num
);
return [{
name: obj1.name,
value: obj1.num,
tag: 0
}, {
name: obj2.name,
value: obj2.num,
tag: 1
}, {
name: obj3.name,
value: obj3.num,
tag: 2
}];
},
// 数组中数据的个数
counterArray(arr) {
var obj = {}
arr.forEach(function(v, k) {
if (obj[v]) {
obj[v]++;
} else {
obj[v] = 1;
}
} catch (e) {
//TODO handle the exception
console.log(e);
uni.showToast({
icon: "none",
mask: true,
title: e.message
})
}
})
return obj;
},
// 查询生活费额度
async queryConsumerTrend() {
// 查询消费总额及学生消费偏好类型
async queryConsumerSummaryAmount(num) {
try {
let data = await this.$http.get({
url: gHost +
'/report-push/campus-consumer-report/queryConsumerTrend'
'/report-push/campus-consumer-report/queryConsumerSummaryAmount'
}, {
schoolId: getQueryParams('schoolId'),
userId: getQueryParams('userId'),
startDate: this.dataRangeArr[this.dataRangeIndex].startDate,
endDate: this.dataRangeArr[this.dataRangeIndex].endDate,
timeType: this.dataRangeIndex == 0 ? 2 : 1
})
if (data.code != 200) {
uni.showToast({
......@@ -1744,16 +1753,47 @@ color: #FF8646;padding:13rpx 12rpx 30rpx 17rpx;`,
return
}
if (!data.obj) return;
this.consumerAmountObj = data.obj;
this.isReasonable = this.consumerAmountObj.exceedRate >= 40 && this
.consumerAmountObj.exceedRate <=
60 ? false : true;
this.schoolAverageHeight = this.consumerAmountObj.schoolAmount <= this
.consumerAmountObj
.consumerAmount ? 139 : 192;
this.userConsumeHeight = this.consumerAmountObj.consumerAmount <= this
.consumerAmountObj
.schoolAmount ? 139 : 192;
if (data.obj.length) {
const tmpObj = data.obj[0];
this.isEatLow = tmpObj.canteenamount / tmpObj.consumerrental < 0.5 ? true : false;
if (num) {
this.pieDatas = [
[{
name: '正餐',
value: tmpObj.canteenamount
}, {
name: '超市',
value: tmpObj.supermarketamount
}, {
name: '其他',
value: tmpObj.otheramount
}]
]
}
this.consumerAmountObj = tmpObj;
this.isReasonable = this.consumerAmountObj.gtgraderate >= 40 && this
.consumerAmountObj.gtgraderate <=
60 ? false : true;
const sortArr = this.numsort({
name: 'schoolAverageHeight',
num: this.consumerAmountObj.schoolavgamount
}, {
name: 'userConsumeHeight',
num: this.consumerAmountObj.consumerrental
}, {
name: 'gradeAverageHeight',
num: this.consumerAmountObj.gradeavgamount
});
const tempArr = [this.consumerAmountObj.schoolavgamount, this.consumerAmountObj.consumerrental,
this.consumerAmountObj.gradeavgamount
];
const heightArr = Object.keys(this.counterArray(tempArr)).length == 1 ? [139, 139, 139] : (
Object.keys(this.counterArray(tempArr)).length == 2 ? [139, 139, 160] : [139, 160, 192]
);
sortArr.forEach(e => {
this[e.name] = heightArr[e.tag]
})
}
} catch (e) {
//TODO handle the exception
console.log(e);
......@@ -1776,6 +1816,7 @@ color: #FF8646;padding:13rpx 12rpx 30rpx 17rpx;`,
startDate: this.dataRangeArr[this.dataRangeIndex]
.startDate,
endDate: this.dataRangeArr[this.dataRangeIndex].endDate,
timeType: this.dataRangeIndex == 0 ? 2 : 1
})
if (data.code != 200) {
uni.showToast({
......@@ -3223,7 +3264,6 @@ color: #FF8646;padding:13rpx 12rpx 30rpx 17rpx;`,
width: 110rpx;
background: linear-gradient(360deg, #04B871 0%, #07D66A 100%);
border-radius: 16rpx 16rpx 0 0;
margin-right: 74rpx;
display: flex;
flex-direction: column;
align-items: center;
......@@ -3253,6 +3293,7 @@ color: #FF8646;padding:13rpx 12rpx 30rpx 17rpx;`,
align-items: center;
padding: 14rpx 0 0;
box-sizing: border-box;
margin: 0 74rpx 0;
.user-consume-img {
width: 52rpx;
......@@ -3272,7 +3313,7 @@ color: #FF8646;padding:13rpx 12rpx 30rpx 17rpx;`,
.consume-total-img-des {
margin: 16rpx 0 0;
display: flex;
justify-content: center;
padding-left: 100rpx;
.consume-total-img-des-item {
height: 40rpx;
......@@ -3282,8 +3323,8 @@ color: #FF8646;padding:13rpx 12rpx 30rpx 17rpx;`,
color: rgba(0, 0, 0, 0.5);
line-height: 40rpx;
&.school-average-des {
margin-right: 74rpx;
&.consume-des {
margin: 0 64rpx 0 74rpx;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment