Commit a671a80d authored by 袁玲利's avatar 袁玲利

异常报告和消费报告

parent 388a6c9a
......@@ -89,12 +89,12 @@
"disableHostCheck": true,
"proxy": {
"/": {
"target": "https://fpdev.xiaopay.net",
"target": "https://uat-pay.xiaopay.net",
"changeOrigin": true,
"secure": false
},
"/cgi-xpay": {
"target": "https://fpdev.xiaopay.net",
"target": "https://uat-pay.xiaopay.net",
"changeOrigin": true,
"secure": false,
"pathRewrite": {
......
<template>
<view class="AbnormalConsumption">
<view class="exceptionContent">
<view class="" v-if="auth == 'false'">
<div class="orderHeadWrapper">
<img :src="ImgUrl+'wechatXZF/orderHead.png'" class="orderHead" alt="">
</div>
<div class="fixedBottomBtn" @click="openAzMenber">
<img :src="ImgUrl+'wechatXZF/goToCost.png'" class="goToCost" alt="">
</div>
</view>
<view class="exceptionContent" v-else>
<view class="itemBar" v-if="cateringAbnormalGroupList.length">
<view class="itemtitle">
<image :src="ImgUrl+'user/remind.png'" class="img">
......@@ -101,7 +109,24 @@
</view>
</view>
</view>
<view class="tips">【注】根据学校预设的餐标提醒,异常判定仅供参考</view>
<view class="tips">
<view class="what">
<image :src="ImgUrl+'wechatXZF/question.png'" class="question">
<view>什么是消费异常提醒?</view>
</view>
<view class="tipBlock">
<view class="dotLine">在校消费超出学校建议范围时触发提醒,结果仅供参考:</view>
<view class="dotLine">
<view class="dot"></view>无就餐记录:餐别范围内无消费记录
</view>
<view class="dotLine">
<view class="dot"></view>就餐时间异常:用餐时间早于/晚于学校的建议范围
</view>
<view class="dotLine">
<view class="dot"></view>就餐金额提醒:餐别消费金额超出学校的建议范围
</view>
</view>
</view>
</view>
<view class="nodatatoday" v-else>
<view class="itemtitle">
......@@ -231,122 +256,134 @@
</template>
<script>
// 时间处理模块
import dayjs from 'dayjs'
import {
Dialog
} from 'vant';
let gHost = "https://" + window.location.host;
if (window.location.protocol != "https:") {
// 时间处理模块
import dayjs from "dayjs";
import { Dialog } from "vant";
let gHost = "https://" + window.location.host;
if (window.location.protocol != "https:") {
gHost = "https://dev-az-cloud-api.xiaopay.net";
}
if (window.location.host == 'fpdev.xiaopay.net') {
}
if (window.location.host == "fpdev.xiaopay.net") {
gHost = "https://dev-az-cloud-api.xiaopay.net";
}
if (window.location.host == 'uat.xiaopay.net') {
}
if (window.location.host == "uat.xiaopay.net") {
gHost = "https://test-az-cloud-api.xiaopay.net";
}
if (window.location.host == 'pay.xiaopay.net') {
}
if (window.location.host == "pay.xiaopay.net") {
gHost = "https://az-cloud-api.xiaopay.net";
}
export default {
}
export default {
name: "AbnormalConsumption",
data() {
return {
cateringAbnormalGroupList: [],
ImgUrl: this.$ImgUrl,
userInfo: {
name: ''
}
name: "",
},
auth: "",
};
},
onLoad(options) {
console.warn(options)
if (!options['schoolId'] || !options['userId']) {
console.warn(options);
this.auth = options.auth;
if (!options["schoolId"] || !options["userId"]) {
Dialog({
title: '温馨提示!',
message: '学生Id或学校Id为必传参数!',
confirmButtonText: "知道了"
}).then(res => {
window.close()
})
title: "温馨提示!",
message: "学生Id或学校Id为必传参数!",
confirmButtonText: "知道了",
}).then((res) => {
window.close();
});
return;
}
this.userInfo['name'] = options['name'] || '***'
this.userInfo["name"] = options["name"] || "***";
// 查询记录
this.getCateringAbnormalGroupList(options['schoolId'], options['userId'])
this.getCateringAbnormalGroupList(options["schoolId"], options["userId"]);
// this.CloudGatewayToken(options['schoolId'], options['userId'])
},
methods: {
// 跳转云平台权益中心
async openAzMenber() {
jWeixin.miniProgram.navigateTo({
url: '/pages/nationalCenterForLesbianRights/index?productId=3'
})
},
// 页面跳转
toDoOtherPage() {
try {
my.navigateTo({
url: 'pages/ConsumptIoninfo/ConsumptIoninfo',
url: "pages/ConsumptIoninfo/ConsumptIoninfo",
});
} catch (e) {
//TODO handle the exception
uni.showToast({
icon: 'none',
title: '功能升级中!'
})
icon: "none",
title: "功能升级中!",
});
}
},
// 根据学生id获取用户信息
getByStuInfo(studentId, Authorization, AuthOauthToken) {
const header = {
'Authorization': Authorization || '',
'AuthOauthToken': AuthOauthToken || '',
}
Authorization: Authorization || "",
AuthOauthToken: AuthOauthToken || "",
};
const student1 = this.$http.get({
// 云平台
url: `${gHost}/cloud-gateway/basic-web/student/${studentId}`,
header,
})
});
const student2 = this.$http.get({
// 校园
url: `${gHost}/cloud-gateway/basic-service/getByAzxyStuId/${studentId}`,
header,
})
});
const student3 = this.$http.get({
// 校智付
url: `${gHost}/cloud-gateway/basic-service/getByXzfStuId/${studentId}`,
header,
})
return Promise.all([student1, student2, student3])
});
return Promise.all([student1, student2, student3]);
},
// 获取云平台网关token
async CloudGatewayToken(schoolId, userId) {
let res = await this.$http.post({
let res = await this.$http.post(
{
url: `${gHost}/cloud-gateway/auth/oauth/token`,
header: {
'Content-Type': 'application/x-www-form-urlencoded'
"Content-Type": "application/x-www-form-urlencoded",
},
}, {
client_id: '',
client_secret: '',
grant_type: ''
})
},
{
client_id: "",
client_secret: "",
grant_type: "",
}
);
if (res.code == 200) {
const Authorization = res.data.tokenHead + res.data
.token
const AuthOauthToken = res.data.token
uni.setStorageSync('Authorization', Authorization);
uni.setStorageSync('AuthOauthToken', AuthOauthToken);
const Authorization = res.data.tokenHead + res.data.token;
const AuthOauthToken = res.data.token;
uni.setStorageSync("Authorization", Authorization);
uni.setStorageSync("AuthOauthToken", AuthOauthToken);
// 查询记录
this.getCateringAbnormalGroupList(schoolId, userId)
this.getCateringAbnormalGroupList(schoolId, userId);
// 获取学生信息
const StuInfo = await this.getByStuInfo(userId, Authorization, AuthOauthToken)
const StuInfo = await this.getByStuInfo(
userId,
Authorization,
AuthOauthToken
);
for (let s of StuInfo) {
if (s.code == 10000 && s.data) {
this.userInfo = s.data
this.userInfo = s.data;
}
}
} else {
uni.showToast({
icon: 'none',
title: '获取云平台token失败!'
})
icon: "none",
title: "获取云平台token失败!",
});
}
},
// 用户消费异常列表分组信息
......@@ -354,55 +391,143 @@
const params = {
userId,
schoolId,
startDate: dayjs().subtract(30, 'days').format("YYYY-M-DD"),
startDate: dayjs().subtract(30, "days").format("YYYY-M-DD"),
endDate: dayjs().format("YYYY-M-DD"),
}
};
try {
let data = await this.$http.post({
let data = await this.$http.post(
{
header: {
'Authorization': uni.getStorageSync('Authorization') || '',
'AuthOauthToken': uni.getStorageSync('AuthOauthToken') || '',
'Content-Type': 'application/x-www-form-urlencoded'
Authorization: uni.getStorageSync("Authorization") || "",
AuthOauthToken: uni.getStorageSync("AuthOauthToken") || "",
"Content-Type": "application/x-www-form-urlencoded",
},
url: `${gHost}/cloud-gateway/bill/cateringAbnormal/getCateringAbnormalGroupList`,
}, params)
},
params
);
if (data.code != 10000) {
uni.showToast({
icon: 'none',
title: data.message || '发生异常!'
})
return
icon: "none",
title: data.message || "发生异常!",
});
return;
}
let res = data.data;
this.cateringAbnormalGroupList = res;
if (res.length) {
this.lastMeal = new Date(res[0].statisticalDate).getMonth() + 1 + "" + new Date(res[0]
.statisticalDate).getDate() + "";
this.lastMeal =
new Date(res[0].statisticalDate).getMonth() +
1 +
"" +
new Date(res[0].statisticalDate).getDate() +
"";
}
} catch (e) {
console.warn(e)
console.warn(e);
//TODO handle the exception
uni.showToast({
icon: 'none',
title: "发生异常错误!"
})
icon: "none",
title: "发生异常错误!",
});
}
},
}
}
},
};
</script>
<style lang="scss">
.AbnormalConsumption {
background: #F0F1F1;
.orderHeadWrapper {
width: 100%;
background: #f0f1f1;
display: flex;
flex-direction: column;
padding-top: 24rpx;
padding-bottom: 160rpx;
.orderHead {
width: 702rpx;
height: 2275rpx;
margin: 0 auto;
}
}
.fixedBottomBtn {
width: 100%;
position: fixed;
left: 0;
right: 0;
bottom: 0;
height: 154rpx;
text-align: center;
.goToCost {
width: 742rpx;
height: 154rpx;
}
}
.tips {
margin: 0 auto;
margin-top: 24rpx;
width: 622rpx;
height: 218rpx;
background: #f8f8f8;
display: flex;
flex-direction: column;
.exceptionContent {
.what {
margin-top: 18rpx;
font-size: 26rpx;
color: rgba(0, 0, 0, 0.85);
height: 37rpx;
line-height: 37rpx;
padding-left: 25rpx;
display: inline-flex;
.question {
width: 24rpx;
height: 24rpx;
margin-right: 8rpx;
align-self: center;
}
}
.tipBlock {
margin-top: 9rpx;
margin-left: 38rpx;
width: calc(100% - 38rpx);
display: flex;
flex-direction: column;
font-size: 22rpx;
margin-top: 9rpx;
line-height: 34rpx;
color: rgba(0, 0, 0, 0.5);
.dotLine {
height: 34rpx;
display: inline-flex;
.dot {
align-self: center;
width: 7rpx;
height: 7rpx;
border-radius: 50%;
background: rgba(0, 0, 0, 0.5);
margin-right: 10rpx;
}
}
}
}
.AbnormalConsumption {
background: #f0f1f1;
padding-top: 24rpx;
}
.exceptionContent {
width: 702rpx;
height: 100%;
min-height: 100vh;
background: #F0F1F1;
background: #f0f1f1;
margin: 0 auto;
// padding: 24rpx 5vw 0;
// margin-left: -5vw;
......@@ -478,7 +603,7 @@
.itemBar {
width: 100%;
background: #FFFFFF;
background: #ffffff;
border-radius: 16rpx;
display: flex;
flex-direction: column;
......@@ -501,7 +626,7 @@
.redBlock {
display: inline-block;
position: relative;
color: #EF4034;
color: #ef4034;
.line {
position: absolute;
......@@ -524,7 +649,7 @@
margin: 20rpx 40rpx 0 40rpx;
display: flex;
flex-direction: column;
background: #FCF5F5;
background: #fcf5f5;
border-radius: 12rpx;
padding-top: 20rpx;
padding-bottom: 28rpx;
......@@ -558,7 +683,7 @@
padding-left: 14rpx;
padding-right: 10rpx;
border-radius: 5rpx;
color: #EF4034;
color: #ef4034;
font-size: 28rpx;
.icon {
......@@ -608,7 +733,7 @@
}
}
.detail+.detail {
.detail + .detail {
margin-top: 0;
}
......@@ -621,8 +746,7 @@
.breakfast,
.lunch {
// padding-bottom: 28rpx;
border-bottom: 1rpx dashed #FFCBC9;
;
border-bottom: 1rpx dashed #ffcbc9;
}
.dinner {
......@@ -659,7 +783,7 @@
left: 46rpx;
top: 35rpx;
width: 1rpx;
background: #D2D2D2;
background: #d2d2d2;
height: calc(100% + 20rpx);
z-index: 1;
}
......@@ -671,7 +795,7 @@
}
}
.lineBlock+.lineBlock {
.lineBlock + .lineBlock {
margin-top: 32rpx;
}
......@@ -691,7 +815,7 @@
width: 12rpx;
height: 12rpx;
margin-right: 22rpx;
background: #EF4034;
background: #ef4034;
border-radius: 50%;
align-self: center;
position: relative;
......@@ -719,8 +843,6 @@
padding-bottom: 0;
}
}
}
.more {
......@@ -729,7 +851,7 @@
height: 94rpx;
line-height: 94rpx;
justify-content: center;
background: #FFFFFF;
background: #ffffff;
border-radius: 16rpx;
font-size: 28rpx;
color: rgba(0, 0, 0, 0.85);
......@@ -742,8 +864,8 @@
.green {
margin-left: 4rpx;
font-weight: 500;
color: #04B871;
}
color: #04b871;
}
}
}
</style>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
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