提交更新1

parent 2878b96c
......@@ -465,7 +465,7 @@
this.queryIsDredgeMember(1).then(() => {
if (this.isOpen) {
this.queryStudentConsumerPreference(1).then(e => this
.piechart());
.piechart());
this.queryDayConsumerTrend(1).then(e => this.linechart(this
.reportTypeIndex));
} else {
......@@ -516,10 +516,12 @@
this.diningSituations.diningSituationsRequestDate = this.dataRangeArr[this.dataRangeIndex].startDate;
this.diningSituations.diningSituationsDate = this.formatDate(this.minDate);
this.queryCampusStudentInfo();
this.queryNotRepastDetails(this.diningSituations.diningSituationsRequestDate, this.diningSituations
.diningSituationsRequestDate, 1);
let tmpDate=this.formatDateTwo(this.minDate);
this.queryNotRepastDetails(this.dataRangeArr[this.dataRangeIndex].startDate, this.dataRangeArr[this
.dataRangeIndex].endDate, 2);
.dataRangeIndex].endDate).then(()=>{
let today = this.diningSituations.notRepastDetailsDTOS.filter(e => e.repastDate === tmpDate)[0];
this.diningSituations.notRepastDetails = today;
});
this.queryConsumerTrend();
},
methods: {
......@@ -606,10 +608,12 @@
this.diningSituations.diningSituationsDate = this.formatDate(this.minDate);
this.diningSituations.diningSituationsRequestDate = this.dataRangeArr[this.dataRangeIndex]
.startDate;
this.queryNotRepastDetails(this.diningSituations.diningSituationsRequestDate, this.diningSituations
.diningSituationsRequestDate, 1);
let tmpDate=this.formatDateTwo(this.minDate);
this.queryNotRepastDetails(this.dataRangeArr[this.dataRangeIndex].startDate, this.dataRangeArr[this
.dataRangeIndex].endDate, 2);
.dataRangeIndex].endDate).then(()=>{
let today = this.diningSituations.notRepastDetailsDTOS.filter(e => e.repastDate === tmpDate)[0];
this.diningSituations.notRepastDetails = today;
});;
this.queryConsumerTrend();
if (this.isOpen) {
this.queryStudentConsumerPreference(1).then(e => this.piechart());
......@@ -649,7 +653,8 @@
this.diningSituations.diningSituationsDate = this.formatDate(date);
var dateStr =
`${date.getFullYear()}-${date.getMonth()<9?'0'+(date.getMonth()+1):date.getMonth()+1}-${date.getDate()<10?'0'+date.getDate():date.getDate()}`;
this.queryNotRepastDetails(dateStr, dateStr, 1);
let today = this.diningSituations.notRepastDetailsDTOS.filter(e => e.repastDate === dateStr)[0];
this.diningSituations.notRepastDetails = today;
},
piechart: function() {
var myChart = echarts.init(document.getElementById('consumer-preferences-pie'));
......@@ -857,11 +862,10 @@
}
},
// 查询就餐情况
async queryNotRepastDetails(startDate, endDate, num) {
async queryNotRepastDetails(startDate, endDate) {
try {
let data = await this.$http.get({
url: gHost +
'/report-push/campus-consumer-report/queryNotRepastDetails'
url: gHost +'/report-push/campus-consumer-report/queryNotRepastDetails'
}, {
schoolId: getQueryParams('schoolId'),
userId: getQueryParams('userId'),
......@@ -876,294 +880,287 @@
})
return
}
switch (num) {
case 1:
this.diningSituations.notRepastDetails = data.obj.notRepastDetailsDTOS[0];
break;
case 2:
this.diningSituations.notRepastDay = data.obj.notRepastDay;
this.diningSituations.notRepastDetailsDTOS = data.obj.notRepastDetailsDTOS;
this.diningSituations.cateringLevel = data.obj.cateringLevel;
this.diningSituations.notCateringNumber = data.obj.notCateringNumber;
this.diningSituations.notCateringType = this.diningSituations
.cateringLevel ? ['早餐', '午餐',
'晚餐'
][this.diningSituations.cateringLevel - 1] : '';
this.diningSituations.clues = this.diningSituations.cateringLevel ? [
'早餐吃好,一天才能活力满满哦',
'及时补充能量,下午才能集中精神学习哦', '晚餐好好吃,身体才能更健康'
][this.diningSituations.cateringLevel - 1] : '';
break;
}
} catch (e) {
//TODO handle the exception
console.log(e);
this.diningSituations.notRepastDay = data.obj.notRepastDay;
this.diningSituations.notRepastDetailsDTOS = data.obj.notRepastDetailsDTOS;
this.diningSituations.cateringLevel = data.obj.cateringLevel;
this.diningSituations.notCateringNumber = data.obj.notCateringNumber;
this.diningSituations.notCateringType = this.diningSituations
.cateringLevel ? ['早餐', '午餐',
'晚餐'
][this.diningSituations.cateringLevel - 1] : '';
this.diningSituations.clues = this.diningSituations.cateringLevel ? [
'早餐吃好,一天才能活力满满哦',
'及时补充能量,下午才能集中精神学习哦', '晚餐好好吃,身体才能更健康'
][this.diningSituations.cateringLevel - 1] : '';
} catch (e) {
//TODO handle the exception
console.log(e);
uni.showToast({
icon: "none",
mask: true,
title: e.message
})
}
},
// 查询学生消费偏好类型
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: e.message
title: data.msg
})
return
}
},
// 查询学生消费偏好类型
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
}
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
}]
]
}
} catch (e) {
//TODO handle the exception
console.log(e);
uni.showToast({
icon: "none",
mask: true,
title: e.message
})
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
}]
]
}
},
// 查询消费总额
async queryConsumerTrend() {
try {
let data = await this.$http.get({
url: gHost +
'/report-push/campus-consumer-report/queryConsumerTrend'
}, {
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
}
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;
} catch (e) {
//TODO handle the exception
console.log(e);
} catch (e) {
//TODO handle the exception
console.log(e);
uni.showToast({
icon: "none",
mask: true,
title: e.message
})
}
},
// 查询消费总额
async queryConsumerTrend() {
try {
let data = await this.$http.get({
url: gHost +
'/report-push/campus-consumer-report/queryConsumerTrend'
}, {
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: e.message
title: data.msg
})
return
}
},
// 日消费趋势
async queryDayConsumerTrend(num) {
try {
let data = await this.$http.get({
url: gHost +
'/report-push/campus-consumer-report/queryDayConsumerTrend'
}, {
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
}
var exceptionDate = data.obj.exceptionDate;
this.isAbnormal = exceptionDate.length ? true : false;
var clues = '';
exceptionDate.forEach((item, index) => item.slice(5, 6) == '0' ? (
clues += item.slice(6, 7) + '' +
item.slice(8, 10) + '' + (index == exceptionDate.length -
1 ? '' : '')) : (clues +=
item.slice(5, 7) + '' + item.slice(8, 10) + '' + (
index == exceptionDate.length - 1 ?
'' : '')))
this.consumerTrend.clues = clues;
if (num) {
var lineDatas = data.obj.dayConsumerAmount.map(item => Object
.assign(item, {
value: item.consumerAmount,
name: item.date.slice(5)
}));
this.lineDatas = lineDatas;
}
} catch (e) {
//TODO handle the exception
console.log(e);
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;
} catch (e) {
//TODO handle the exception
console.log(e);
uni.showToast({
icon: "none",
mask: true,
title: e.message
})
}
},
// 日消费趋势
async queryDayConsumerTrend(num) {
try {
let data = await this.$http.get({
url: gHost +
'/report-push/campus-consumer-report/queryDayConsumerTrend'
}, {
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: e.message
title: data.msg
})
return
}
},
// 是否开通消费报告
async queryIsDredgeMember(num) {
try {
let data = await this.$http.get({
url: gHost +
'/report-push/member-info/queryIsDredgeMember'
}, {
schoolId: getQueryParams('schoolId'),
userId: getQueryParams('userId'),
serviceItemCode: 4001
})
if (data.code != 200) {
uni.showToast({
icon: "none",
mask: true,
title: data.msg
})
return
}
this.isOpen = data.obj.status;
if (num == 1) {
if (this.isOpen) {
this.queryMemberValidTime();
this.containerHeight = 4200;
} else {
this.queryMemberConsumerAmount();
this.containerHeight = 2340;
}
}
} catch (e) {
//TODO handle the exception
console.log(e);
var exceptionDate = data.obj.exceptionDate;
this.isAbnormal = exceptionDate.length ? true : false;
var clues = '';
exceptionDate.forEach((item, index) => item.slice(5, 6) == '0' ? (
clues += item.slice(6, 7) + '' +
item.slice(8, 10) + '' + (index == exceptionDate.length -
1 ? '' : '')) : (clues +=
item.slice(5, 7) + '' + item.slice(8, 10) + '' + (
index == exceptionDate.length - 1 ?
'' : '')))
this.consumerTrend.clues = clues;
if (num) {
var lineDatas = data.obj.dayConsumerAmount.map(item => Object
.assign(item, {
value: item.consumerAmount,
name: item.date.slice(5)
}));
this.lineDatas = lineDatas;
}
} catch (e) {
//TODO handle the exception
console.log(e);
uni.showToast({
icon: "none",
mask: true,
title: e.message
})
}
},
// 是否开通消费报告
async queryIsDredgeMember(num) {
try {
let data = await this.$http.get({
url: gHost +
'/report-push/member-info/queryIsDredgeMember'
}, {
schoolId: getQueryParams('schoolId'),
userId: getQueryParams('userId'),
serviceItemCode: 4001
})
if (data.code != 200) {
uni.showToast({
icon: "none",
mask: true,
title: e.message
title: data.msg
})
return
}
},
// 查询会员消费金额
async queryMemberConsumerAmount() {
try {
let data = await this.$http.get({
url: gHost +
'/report-push/member-info/queryMemberConsumerAmount'
}, {
schoolId: getQueryParams('schoolId'),
userId: getQueryParams('userId'),
serviceItemCode: 4001
})
if (data.code != 200) {
uni.showToast({
icon: "none",
mask: true,
title: data.msg
})
return
this.isOpen = data.obj.status;
if (num == 1) {
if (this.isOpen) {
this.queryMemberValidTime();
this.containerHeight = 4200;
} else {
this.queryMemberConsumerAmount();
this.containerHeight = 2340;
}
this.memberInfo.leastAmount = data.obj.leastAmount;
} catch (e) {
//TODO handle the exception
console.log(e);
}
} catch (e) {
//TODO handle the exception
console.log(e);
uni.showToast({
icon: "none",
mask: true,
title: e.message
})
}
},
// 查询会员消费金额
async queryMemberConsumerAmount() {
try {
let data = await this.$http.get({
url: gHost +
'/report-push/member-info/queryMemberConsumerAmount'
}, {
schoolId: getQueryParams('schoolId'),
userId: getQueryParams('userId'),
serviceItemCode: 4001
})
if (data.code != 200) {
uni.showToast({
icon: "none",
mask: true,
title: e.message
title: data.msg
})
return
}
},
// 查询会员有效期
async queryMemberValidTime() {
try {
let data = await this.$http.get({
url: gHost +
'/report-push/member-info/queryMemberValidTime'
}, {
schoolId: getQueryParams('schoolId'),
userId: getQueryParams('userId'),
serviceItemCode: 4001
})
if (data.code != 200) {
uni.showToast({
icon: "none",
mask: true,
title: data.msg
})
return
}
this.memberInfo.differDay = data.obj.differDay;
this.memberInfo.invalidDate = data.obj.invalidDate;
let month = data.obj.invalidDate.slice(5, 6) == 0 ? data
.obj.invalidDate.slice(6, 7) : data.obj
.invalidDate.slice(5, 7);
let date = data.obj.invalidDate.slice(8, 9) == 0 ? data.obj
.invalidDate.slice(9) : data.obj
.invalidDate.slice(8);
this.memberInfo.invalidDateStr = data.obj.invalidDate
.slice(0, 4) + '' + month + '' + date + '';
} catch (e) {
//TODO handle the exception
console.log(e);
this.memberInfo.leastAmount = data.obj.leastAmount;
} catch (e) {
//TODO handle the exception
console.log(e);
uni.showToast({
icon: "none",
mask: true,
title: e.message
})
}
},
// 查询会员有效期
async queryMemberValidTime() {
try {
let data = await this.$http.get({
url: gHost +
'/report-push/member-info/queryMemberValidTime'
}, {
schoolId: getQueryParams('schoolId'),
userId: getQueryParams('userId'),
serviceItemCode: 4001
})
if (data.code != 200) {
uni.showToast({
icon: "none",
mask: true,
title: e.message
title: data.msg
})
return
}
},
equityPay: function() {
jWeixin.miniProgram.switchTab({
url: `/pages/Member/main`,
success: function success() {
console.log('skip success')
},
fail: function fail(_fail) {
console.warn(_fail);
uni.showModal({
content: JSON.stringify(_fail)
});
}
});
},
this.memberInfo.differDay = data.obj.differDay;
this.memberInfo.invalidDate = data.obj.invalidDate;
let month = data.obj.invalidDate.slice(5, 6) == 0 ? data
.obj.invalidDate.slice(6, 7) : data.obj
.invalidDate.slice(5, 7);
let date = data.obj.invalidDate.slice(8, 9) == 0 ? data.obj
.invalidDate.slice(9) : data.obj
.invalidDate.slice(8);
this.memberInfo.invalidDateStr = data.obj.invalidDate
.slice(0, 4) + '' + month + '' + date + '';
} catch (e) {
//TODO handle the exception
console.log(e);
uni.showToast({
icon: "none",
mask: true,
title: e.message
})
}
},
equityPay: function() {
jWeixin.miniProgram.switchTab({
url: `/pages/Member/main`,
success: function success() {
console.log('skip success')
},
fail: function fail(_fail) {
console.warn(_fail);
uni.showModal({
content: JSON.stringify(_fail)
});
}
});
},
},
}
</script>
......
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