生活费额度提交更新

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