|
@@ -70,17 +70,11 @@
|
|
|
add_class1: '',
|
|
add_class1: '',
|
|
|
inputMoney: '', //手动输入增加金额
|
|
inputMoney: '', //手动输入增加金额
|
|
|
addMoney: 0, //选择充值金额
|
|
addMoney: 0, //选择充值金额
|
|
|
- userinfo: {}, //用户信息
|
|
|
|
|
- order_id: '', // 订单号
|
|
|
|
|
- card_number: '', //用户卡号
|
|
|
|
|
- dom: '', //房间号
|
|
|
|
|
campus: '', //校区
|
|
campus: '', //校区
|
|
|
- access_token: '',
|
|
|
|
|
sub_appid: '', //商户号
|
|
sub_appid: '', //商户号
|
|
|
- pay_info: '',
|
|
|
|
|
xiaofei_items: '', // 消费记录
|
|
xiaofei_items: '', // 消费记录
|
|
|
ceshi: 'code',
|
|
ceshi: 'code',
|
|
|
- dorm_number: '',
|
|
|
|
|
|
|
+ dorm_number: '', //房间号
|
|
|
compus: '',
|
|
compus: '',
|
|
|
test: this.$store.state.test
|
|
test: this.$store.state.test
|
|
|
}
|
|
}
|
|
@@ -89,7 +83,7 @@
|
|
|
// 初始化参数
|
|
// 初始化参数
|
|
|
this.$store.state.building.roomSelect = '';
|
|
this.$store.state.building.roomSelect = '';
|
|
|
this.$store.state.building.add_class = 0;
|
|
this.$store.state.building.add_class = 0;
|
|
|
- this.$store.state.building.dom = '';
|
|
|
|
|
|
|
+ this.$store.state.building.dorm_number = '';
|
|
|
|
|
|
|
|
this.getCode()
|
|
this.getCode()
|
|
|
},
|
|
},
|
|
@@ -98,7 +92,7 @@
|
|
|
// 如果是选择宿舍号返回
|
|
// 如果是选择宿舍号返回
|
|
|
this.roomSelect = this.$store.state.building.roomSelect;
|
|
this.roomSelect = this.$store.state.building.roomSelect;
|
|
|
this.add_class = this.$store.state.building.add_class;
|
|
this.add_class = this.$store.state.building.add_class;
|
|
|
- this.dom = this.$store.state.building.dom;
|
|
|
|
|
|
|
+ this.dorm_number = this.$store.state.building.dorm_number;
|
|
|
|
|
|
|
|
if (this.roomSelect != '') {
|
|
if (this.roomSelect != '') {
|
|
|
this.getDianLiang()
|
|
this.getDianLiang()
|
|
@@ -112,13 +106,14 @@
|
|
|
getCode(param) {
|
|
getCode(param) {
|
|
|
uni.login({
|
|
uni.login({
|
|
|
success: (res) => {
|
|
success: (res) => {
|
|
|
- console.log('jiaofei', res);
|
|
|
|
|
|
|
+ // console.log('获得code', res);
|
|
|
if (res.code) {
|
|
if (res.code) {
|
|
|
this.code = res.code
|
|
this.code = res.code
|
|
|
// 请求服务器,获得openid
|
|
// 请求服务器,获得openid
|
|
|
- if (param == 'comfirm')
|
|
|
|
|
- this.jsapi()
|
|
|
|
|
- else
|
|
|
|
|
|
|
+ if (param == 'comfirm') {
|
|
|
|
|
+ // 获取IP
|
|
|
|
|
+ this.getIP()
|
|
|
|
|
+ } else
|
|
|
this.getOpenId()
|
|
this.getOpenId()
|
|
|
} else {
|
|
} else {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
@@ -130,6 +125,26 @@
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 获取IP
|
|
|
|
|
+ */
|
|
|
|
|
+ async getIP() {
|
|
|
|
|
+ const res = await this.$myRequest({
|
|
|
|
|
+ host: 'ip',
|
|
|
|
|
+ url: '/',
|
|
|
|
|
+ method: 'POST'
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ if (res) {
|
|
|
|
|
+ // console.log(res);
|
|
|
|
|
+ const reg = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/;
|
|
|
|
|
+ let ip = reg.exec(res.data);
|
|
|
|
|
+ this.IP = ip[0]
|
|
|
|
|
+
|
|
|
|
|
+ // 组合地址,发起支付
|
|
|
|
|
+ this.jsapi()
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
* 请求服务器,获得openid
|
|
* 请求服务器,获得openid
|
|
|
*/
|
|
*/
|
|
|
async getOpenId() {
|
|
async getOpenId() {
|
|
@@ -145,10 +160,9 @@
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // console.log(res);
|
|
|
|
|
|
|
+ // console.log('获得openid', res);
|
|
|
if (res.data.mess == '返回成功') {
|
|
if (res.data.mess == '返回成功') {
|
|
|
this.$store.state.stu_number = res.data.info[0].stu_number
|
|
this.$store.state.stu_number = res.data.info[0].stu_number
|
|
|
- this.amount = res.data.info[0].balance
|
|
|
|
|
// 宿舍号
|
|
// 宿舍号
|
|
|
this.dorm_number = res.data.info[0].build + res.data.info[0].dom
|
|
this.dorm_number = res.data.info[0].build + res.data.info[0].dom
|
|
|
// 校区
|
|
// 校区
|
|
@@ -184,7 +198,7 @@
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // console.log(res);
|
|
|
|
|
|
|
+ // console.log('取得电费额度', res);
|
|
|
if (res.data.mess == '0') {
|
|
if (res.data.mess == '0') {
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
this.remainElec = res.data.amount.toFixed(2)
|
|
this.remainElec = res.data.amount.toFixed(2)
|
|
@@ -294,18 +308,19 @@
|
|
|
async jsapi() {
|
|
async jsapi() {
|
|
|
const res = await this.$myRequest({
|
|
const res = await this.$myRequest({
|
|
|
host: this.ceshi,
|
|
host: this.ceshi,
|
|
|
- url: '/HotWaters/wpPay.action',
|
|
|
|
|
|
|
+ url: '/HotWaters/elPay.action',
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
header: {
|
|
header: {
|
|
|
'content-type': 'application/x-www-form-urlencoded'
|
|
'content-type': 'application/x-www-form-urlencoded'
|
|
|
},
|
|
},
|
|
|
data: {
|
|
data: {
|
|
|
code: this.code,
|
|
code: this.code,
|
|
|
- num: this.amount,
|
|
|
|
|
|
|
+ num: this.addMoney,
|
|
|
ip: this.IP
|
|
ip: this.IP
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
- console.log(res);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // console.log(res);
|
|
|
if (res.data.pay == 'error') {
|
|
if (res.data.pay == 'error') {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: '未获得支付参数',
|
|
title: '未获得支付参数',
|
|
@@ -337,7 +352,7 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
complete: (res) => {
|
|
complete: (res) => {
|
|
|
- console.log(res);
|
|
|
|
|
|
|
+ // console.log(res);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|