|
|
@@ -81,7 +81,7 @@
|
|
|
}),
|
|
|
startDate: this.$getDate('start_date'),
|
|
|
endDate: this.$getDate('end_date'),
|
|
|
- flag: true,
|
|
|
+ flag: false,
|
|
|
isUserClose: false, // 是否是用户自己关闭
|
|
|
isChecked: false,
|
|
|
isConnected: false, // 是否连接上
|
|
|
@@ -112,42 +112,85 @@
|
|
|
use_amount: 0.0.toFixed(2), // 结算金额
|
|
|
amount: 0.0.toFixed(2), // 余额
|
|
|
dorm_number: '', // 宿舍号
|
|
|
+ stu_number: '', // 学号
|
|
|
// compus: '', // 校区
|
|
|
code: '',
|
|
|
ceshi: 'code',
|
|
|
- changeDate: false
|
|
|
+ changeDate: false // 是否是手动选择日期
|
|
|
}
|
|
|
},
|
|
|
- onLoad() {
|
|
|
- try {
|
|
|
- const value = uni.getStorageSync('instruction_noshow');
|
|
|
- if (value) {
|
|
|
- this.flag = false
|
|
|
- }
|
|
|
- } catch (e) {
|
|
|
- console.log(e);
|
|
|
- }
|
|
|
- // 获得code
|
|
|
- this.getCode()
|
|
|
+ onLoad(options) {
|
|
|
+ // 获取基本信息
|
|
|
+ this.get_base_info(options, 'onLoad')
|
|
|
},
|
|
|
onShow() {
|
|
|
- if (this.$store.state.payInfo.from == 'reshui_pay') {
|
|
|
- uni.showToast({
|
|
|
- title: this.$store.state.payInfo.resultMsg,
|
|
|
- icon: 'success',
|
|
|
- success: () => {
|
|
|
- this.$store.state.payInfo.resultMsg = ''
|
|
|
- this.$store.state.payInfo.from = ''
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- // this.amount = this.$store.state.reshui_amount + this.amount
|
|
|
- // 重新调用一次,刷新金额
|
|
|
- this.getCode()
|
|
|
- }
|
|
|
+ // 获取基本信息
|
|
|
+ this.get_base_info('options', 'onShow')
|
|
|
},
|
|
|
methods: {
|
|
|
/**
|
|
|
+ * 获取基本信息
|
|
|
+ */
|
|
|
+ get_base_info(options, param) {
|
|
|
+ try {
|
|
|
+ // 获取学号
|
|
|
+ this.stu_number = this.$store.state.userInfo.card_number
|
|
|
+
|
|
|
+ if (this.stu_number == '' || typeof(this.stu_number) == 'undefined') {
|
|
|
+ const userinfo = uni.getStorageSync('userinfo_storage_key')
|
|
|
+ if (userinfo) {
|
|
|
+ this.stu_number = userinfo.card_number
|
|
|
+ this.roomSelect = userinfo.campus + userinfo.dorm_number
|
|
|
+ } else {
|
|
|
+ if (options && JSON.stringify(options) != '{}' && typeof(options.from) != 'undefined') {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '../index/index?from=' + options.from
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '../index/index?from=0'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '学号为空,请进行授权',
|
|
|
+ duration: 3000
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 初始化参数
|
|
|
+ this.$store.state.building.add_class = 0;
|
|
|
+
|
|
|
+ const value = uni.getStorageSync('instruction_noshow');
|
|
|
+ if (!value) {
|
|
|
+ this.flag = true
|
|
|
+ }
|
|
|
+ // 获得code
|
|
|
+ this.getCode()
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (param == 'onShow') {
|
|
|
+ if (this.$store.state.payInfo.from == 'reshui_pay') {
|
|
|
+ uni.showToast({
|
|
|
+ title: this.$store.state.payInfo.resultMsg,
|
|
|
+ icon: 'success',
|
|
|
+ success: () => {
|
|
|
+ this.$store.state.payInfo.resultMsg = ''
|
|
|
+ this.$store.state.payInfo.from = ''
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // this.amount = this.$store.state.reshui_amount + this.amount
|
|
|
+ // 重新调用一次,刷新金额
|
|
|
+ this.getCode()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
* 获得code
|
|
|
*/
|
|
|
getCode() {
|
|
|
@@ -173,7 +216,7 @@
|
|
|
async getOpenId() {
|
|
|
if (this.code == '') {
|
|
|
uni.showToast({
|
|
|
- title: 'code未获取到!',
|
|
|
+ title: 'code未获得!',
|
|
|
icon: 'success'
|
|
|
});
|
|
|
return
|
|
|
@@ -192,21 +235,28 @@
|
|
|
|
|
|
// console.log(res);
|
|
|
if (res.data.mess == '返回成功') {
|
|
|
- // 学号
|
|
|
- this.$store.state.stu_number = res.data.info[0].stu_number
|
|
|
- // 剩余金额
|
|
|
- if (res.data.info[0].balance > 0)
|
|
|
- this.$store.state.reshui_amount = res.data.info[0].balance
|
|
|
- // 剩余金额
|
|
|
- this.amount = this.$store.state.reshui_amount
|
|
|
- // 组合楼栋宿舍号
|
|
|
- this.dorm_number = res.data.info[0].build + res.data.info[0].dom
|
|
|
- // 校区
|
|
|
- // this.compus = res.data.info[0].campus
|
|
|
-
|
|
|
- // 请求选定的月份消费记录
|
|
|
- this.request_consumption_records()
|
|
|
-
|
|
|
+ // 判断存储的stu_number与返回的stu_number是否一致
|
|
|
+ // if (res.data.info[0].stu_number == this.$store.state.userInfo.card_number) {
|
|
|
+ if (res.data.info[0].card_number == this.$store.state.userInfo.card_number) {
|
|
|
+ // 学号
|
|
|
+ this.stu_number = res.data.info[0].stu_number
|
|
|
+ // 剩余金额
|
|
|
+ this.amount = res.data.info[0].balance.toFixed(2)
|
|
|
+ if (this.amount > 0)
|
|
|
+ this.$store.state.reshui_amount = this.amount
|
|
|
+ // 组合楼栋宿舍号
|
|
|
+ this.dorm_number = res.data.info[0].build + res.data.info[0].dom
|
|
|
+ // 校区
|
|
|
+ // this.compus = res.data.info[0].campus
|
|
|
+
|
|
|
+ // 请求选定的月份消费记录
|
|
|
+ this.request_consumption_records()
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: '学工号不一致!',
|
|
|
+ icon: 'success'
|
|
|
+ });
|
|
|
+ }
|
|
|
} else if (res.data.mess == '未查询到用户信息') {
|
|
|
uni.redirectTo({
|
|
|
url: '../index/index'
|
|
|
@@ -247,7 +297,7 @@
|
|
|
* 请求选定的月份消费记录
|
|
|
*/
|
|
|
async request_consumption_records() {
|
|
|
- if (this.$store.state.stu_number != '') {
|
|
|
+ if (this.stu_number != '' && typeof(this.stu_number) != 'undefined') {
|
|
|
this.xiaofei_items = []
|
|
|
const res = await this.$myRequest({
|
|
|
host: this.ceshi,
|
|
|
@@ -257,7 +307,7 @@
|
|
|
'content-type': 'application/x-www-form-urlencoded'
|
|
|
},
|
|
|
data: {
|
|
|
- stu_number: this.$store.state.stu_number,
|
|
|
+ stu_number: this.stu_number,
|
|
|
begin_time: this.date
|
|
|
}
|
|
|
});
|
|
|
@@ -283,7 +333,7 @@
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
icon: 'success',
|
|
|
- title: '学号为空'
|
|
|
+ title: '未获得学号'
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
@@ -993,13 +1043,13 @@
|
|
|
* 请求获取设备启动码
|
|
|
*/
|
|
|
async request_device_start_code() {
|
|
|
- if (this.byte35 != '' && this.$store.state.stu_number != '') {
|
|
|
+ if (this.byte35 != '' && this.stu_number != '') {
|
|
|
const res = await this.$myRequest({
|
|
|
host: this.ceshi,
|
|
|
url: '/HotWaters/wpstart.action',
|
|
|
data: {
|
|
|
collect_code: this.byte35,
|
|
|
- stu_number: this.$store.state.stu_number
|
|
|
+ stu_number: this.stu_number
|
|
|
}
|
|
|
})
|
|
|
|