|
@@ -2,7 +2,7 @@
|
|
|
<view class="content">
|
|
<view class="content">
|
|
|
<view class="container">
|
|
<view class="container">
|
|
|
<view class="header">
|
|
<view class="header">
|
|
|
- <view class="scan" @tap="scan()">
|
|
|
|
|
|
|
+ <view class="scan" @tap="scan()" hover-class="scan_hover">
|
|
|
<text class="iconfont icon-saoma"></text>
|
|
<text class="iconfont icon-saoma"></text>
|
|
|
<text>扫码连接</text>
|
|
<text>扫码连接</text>
|
|
|
</view>
|
|
</view>
|
|
@@ -123,6 +123,8 @@
|
|
|
// 获取存储的用户数据
|
|
// 获取存储的用户数据
|
|
|
const value = uni.getStorageSync('userinfo_storage_key')
|
|
const value = uni.getStorageSync('userinfo_storage_key')
|
|
|
let item = decodeURIComponent(options.item)
|
|
let item = decodeURIComponent(options.item)
|
|
|
|
|
+ // console.log(value)
|
|
|
|
|
+ // console.log(item)
|
|
|
if (item === '{}' && value == '') { // 如果没有用户信息,返回首页
|
|
if (item === '{}' && value == '') { // 如果没有用户信息,返回首页
|
|
|
uni.redirectTo({
|
|
uni.redirectTo({
|
|
|
url: '../index/index'
|
|
url: '../index/index'
|
|
@@ -143,6 +145,8 @@
|
|
|
console.log(e)
|
|
console.log(e)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ this.card_number = this.userinfo.card_number; // 卡号
|
|
|
|
|
+
|
|
|
// 查询用户信息
|
|
// 查询用户信息
|
|
|
this.select_user_info()
|
|
this.select_user_info()
|
|
|
},
|
|
},
|
|
@@ -168,37 +172,44 @@
|
|
|
* 请求选定的月份消费记录
|
|
* 请求选定的月份消费记录
|
|
|
*/
|
|
*/
|
|
|
async request_consumption_records() {
|
|
async request_consumption_records() {
|
|
|
- this.xiaofei_items = []
|
|
|
|
|
- const res = await this.$myRequest({
|
|
|
|
|
- host: 'code',
|
|
|
|
|
- url: '/HotWater/wxpayqueryConsume.action',
|
|
|
|
|
- method: 'POST',
|
|
|
|
|
- header: {
|
|
|
|
|
- 'content-type': 'application/x-www-form-urlencoded'
|
|
|
|
|
- },
|
|
|
|
|
- data: {
|
|
|
|
|
- card_number: this.card_number,
|
|
|
|
|
- begin_time: this.date
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ if (this.card_number != '') {
|
|
|
|
|
+ this.xiaofei_items = []
|
|
|
|
|
+ const res = await this.$myRequest({
|
|
|
|
|
+ host: 'code',
|
|
|
|
|
+ url: '/HotWater/wxpayqueryConsume.action',
|
|
|
|
|
+ method: 'POST',
|
|
|
|
|
+ header: {
|
|
|
|
|
+ 'content-type': 'application/x-www-form-urlencoded'
|
|
|
|
|
+ },
|
|
|
|
|
+ data: {
|
|
|
|
|
+ card_number: this.card_number,
|
|
|
|
|
+ begin_time: this.date
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- // console.log(res.data.mess, 'request_consumption_records');
|
|
|
|
|
- if (typeof(res.data.mess) != 'undefined') {
|
|
|
|
|
- let items = res.data.mess
|
|
|
|
|
- // 按时间倒序排列
|
|
|
|
|
- // items.sort((a, b) => {
|
|
|
|
|
- // return a.begin_time < b.begin_time ? 1 : -1;
|
|
|
|
|
- // })
|
|
|
|
|
- for (var i = 0; i < items.length; i++) {
|
|
|
|
|
- // 过滤掉为0的记录,只显示消费大于0的记录
|
|
|
|
|
- // if (items[i].use_amount > 0.00) {
|
|
|
|
|
|
|
+ // console.log(res.data.mess, 'request_consumption_records');
|
|
|
|
|
+ if (typeof(res.data.mess) != 'undefined') {
|
|
|
|
|
+ let items = res.data.mess
|
|
|
|
|
+ // 按时间倒序排列
|
|
|
|
|
+ // items.sort((a, b) => {
|
|
|
|
|
+ // return a.begin_time < b.begin_time ? 1 : -1;
|
|
|
|
|
+ // })
|
|
|
|
|
+ for (var i = 0; i < items.length; i++) {
|
|
|
|
|
+ // 过滤掉为0的记录,只显示消费大于0的记录
|
|
|
|
|
+ // if (items[i].use_amount > 0.00) {
|
|
|
this.xiaofei_items.push(items[i])
|
|
this.xiaofei_items.push(items[i])
|
|
|
- // }
|
|
|
|
|
|
|
+ // }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ icon: 'success',
|
|
|
|
|
+ title: '该月无消费记录'
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
icon: 'success',
|
|
icon: 'success',
|
|
|
- title: '该月无消费记录'
|
|
|
|
|
|
|
+ title: '用户卡号为空'
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -220,24 +231,30 @@
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// console.log(res, 'select_user_info');
|
|
// console.log(res, 'select_user_info');
|
|
|
- // 将JSON字符串转化为JSON对象,取余额
|
|
|
|
|
- let userinfo = res.data.info[0];
|
|
|
|
|
- let amount = userinfo.balance; // 余额
|
|
|
|
|
- let cnumber = userinfo.card_number; // 卡号
|
|
|
|
|
- this.user_name = userinfo.user_name;
|
|
|
|
|
- this.card_number = cnumber; // 卡号
|
|
|
|
|
- this.dorm_number = userinfo.dom; // 宿舍号
|
|
|
|
|
- if (amount != 0) {
|
|
|
|
|
- this.amount = amount.toFixed(2)
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (cnumber == null || cnumber == undefined || cnumber == '') {
|
|
|
|
|
- // 之前未绑定用户信息,现在去绑定用户信息
|
|
|
|
|
- this.send_save_user_info()
|
|
|
|
|
|
|
+ if (res.statusCode == 502) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ icon: 'success',
|
|
|
|
|
+ title: '服务器网关错误'
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 将JSON字符串转化为JSON对象,取余额
|
|
|
|
|
+ let userinfo = res.data.info[0]
|
|
|
|
|
+ let amount = userinfo.balance // 余额
|
|
|
|
|
+ let cnumber = this.userinfo.card_number
|
|
|
|
|
+ this.user_name = userinfo.user_name;
|
|
|
|
|
+ this.dorm_number = userinfo.dom // 宿舍号
|
|
|
|
|
+ if (amount != 0) {
|
|
|
|
|
+ this.amount = amount.toFixed(2)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (cnumber == null || cnumber == undefined || cnumber == '') {
|
|
|
|
|
+ // 之前未绑定用户信息,现在去绑定用户信息
|
|
|
|
|
+ this.send_save_user_info()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 请求选定的月份消费记录
|
|
|
|
|
+ this.request_consumption_records()
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 请求选定的月份消费记录
|
|
|
|
|
- this.request_consumption_records()
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -516,7 +533,7 @@
|
|
|
title: err.errMsg,
|
|
title: err.errMsg,
|
|
|
duration: 2000
|
|
duration: 2000
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
this.isScan = false
|
|
this.isScan = false
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -558,7 +575,7 @@
|
|
|
if (!device.name && !device.localName) {
|
|
if (!device.name && !device.localName) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (device.name == this.device_code) {
|
|
if (device.name == this.device_code) {
|
|
|
//data里面建立一个deviceId、device_code,存储起来
|
|
//data里面建立一个deviceId、device_code,存储起来
|
|
|
// this.device_code = device.name;
|
|
// this.device_code = device.name;
|
|
@@ -1137,15 +1154,18 @@
|
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
.header {
|
|
.header {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: center;
|
|
|
position: relative;
|
|
position: relative;
|
|
|
height: 200rpx;
|
|
height: 200rpx;
|
|
|
|
|
|
|
|
.scan {
|
|
.scan {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
- height: 200rpx;
|
|
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
- align-items: center;
|
|
|
|
|
justify-content: center;
|
|
justify-content: center;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ height: 200rpx;
|
|
|
|
|
+ width: 30%;
|
|
|
|
|
|
|
|
.iconfont {
|
|
.iconfont {
|
|
|
margin-bottom: 10rpx;
|
|
margin-bottom: 10rpx;
|
|
@@ -1153,6 +1173,11 @@
|
|
|
color: $my-color-primary;
|
|
color: $my-color-primary;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ .scan_hover {
|
|
|
|
|
+ border-radius: 15rpx;
|
|
|
|
|
+ background-color: $my-color-btn-background;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
.qinshihao {
|
|
.qinshihao {
|
|
|
position: fixed;
|
|
position: fixed;
|
|
@@ -1169,6 +1194,7 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.start_text {
|
|
.start_text {
|
|
|
|
|
+
|
|
|
.start_top,
|
|
.start_top,
|
|
|
.start_mid {
|
|
.start_mid {
|
|
|
display: flex;
|
|
display: flex;
|
|
@@ -1176,7 +1202,7 @@
|
|
|
height: 100rpx;
|
|
height: 100rpx;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
border-bottom: 2rpx #ccc solid;
|
|
border-bottom: 2rpx #ccc solid;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
.item_left {
|
|
.item_left {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
@@ -1245,11 +1271,11 @@
|
|
|
height: 100rpx;
|
|
height: 100rpx;
|
|
|
line-height: 100rpx;
|
|
line-height: 100rpx;
|
|
|
font-weight: bold;
|
|
font-weight: bold;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
.uni-input {
|
|
.uni-input {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
text:nth-child(1) {
|
|
text:nth-child(1) {
|
|
|
margin-right: 10rpx;
|
|
margin-right: 10rpx;
|
|
|
}
|
|
}
|