开关-充值后断开蓝牙-用户如何再次充值
This commit is contained in:
parent
749fbcec48
commit
831a718d19
|
@ -320,7 +320,8 @@
|
|||
jieshufalg:false,
|
||||
channelId:'',
|
||||
dingobj: '',
|
||||
timerone:null
|
||||
timerone:null,
|
||||
hasCalledGetczly:false
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
|
@ -511,7 +512,7 @@
|
|||
if (this.ver_data == null) {
|
||||
this.jieshufalg = true
|
||||
uni.showLoading({
|
||||
title: '切换中'
|
||||
title: '请稍等'
|
||||
})
|
||||
xBlufi.initXBlufi(1)
|
||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
||||
|
@ -675,7 +676,7 @@
|
|||
uni.reLaunch({
|
||||
url: '/pages/shouye/index'
|
||||
})
|
||||
}, 2000)
|
||||
}, 1500)
|
||||
},
|
||||
fail(err) {
|
||||
that.jieshuflag = false
|
||||
|
@ -723,7 +724,7 @@
|
|||
uni.reLaunch({
|
||||
url: '/pages/shouye/index'
|
||||
})
|
||||
},1500)
|
||||
},1000)
|
||||
}else{
|
||||
uni.reLaunch({
|
||||
url: '/pages/shouye/index'
|
||||
|
@ -742,10 +743,18 @@
|
|||
})
|
||||
} else {
|
||||
if (this.temperature == null) {
|
||||
this.jieshufalg = true
|
||||
uni.showLoading({
|
||||
title: '切换中'
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
content: `检测到该设备未联网,为您切换为蓝牙模式,支付的时候靠近该设备,并打开蓝牙`,
|
||||
showCancel: false,
|
||||
success: function(res) {
|
||||
uni.showLoading({
|
||||
title: '请稍等'
|
||||
})
|
||||
}
|
||||
})
|
||||
this.jieshufalg = true
|
||||
|
||||
let that = this
|
||||
xBlufi.initXBlufi(1);
|
||||
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent);
|
||||
|
@ -764,14 +773,7 @@
|
|||
})
|
||||
}
|
||||
}, 2000)
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
content: `检测到该设备未联网,为您切换为蓝牙模式,支付的时候靠近该设备,并打开蓝牙`,
|
||||
showCancel: false,
|
||||
success: function(res) {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
this.jieshufalg = true
|
||||
let data = {
|
||||
|
@ -801,8 +803,8 @@
|
|||
uni.reLaunch({
|
||||
url: '/pages/shouye/index'
|
||||
})
|
||||
}, 1000)
|
||||
}, 1500)
|
||||
}, 500)
|
||||
}, 1000)
|
||||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:', err)
|
||||
|
@ -850,7 +852,7 @@
|
|||
uni.reLaunch({
|
||||
url: '/pages/shouye/index'
|
||||
})
|
||||
}, 1500)
|
||||
}, 1000)
|
||||
} else {
|
||||
this.getDevice()
|
||||
this.jieshuflag = false
|
||||
|
@ -890,7 +892,7 @@
|
|||
uni.reLaunch({
|
||||
url: '/pages/shouye/index'
|
||||
})
|
||||
}, 1500)
|
||||
}, 1000)
|
||||
},
|
||||
fail(err) {
|
||||
that.getDevice()
|
||||
|
@ -944,7 +946,7 @@
|
|||
uni.reLaunch({
|
||||
url: '/pages/shouye/index'
|
||||
})
|
||||
}, 1500)
|
||||
}, 1000)
|
||||
},
|
||||
fail(err) {
|
||||
that.jieshuflag = false
|
||||
|
@ -973,8 +975,15 @@
|
|||
} else {
|
||||
// console.log(this.temperature,'this.temperature');
|
||||
if (this.temperature == null) {
|
||||
uni.showLoading({
|
||||
title: '切换中'
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
content: `检测到该设备未联网,为您切换为蓝牙模式,支付的时候靠近该设备,并打开蓝牙`,
|
||||
showCancel: false,
|
||||
success: function(res) {
|
||||
uni.showLoading({
|
||||
title: '请稍等'
|
||||
})
|
||||
}
|
||||
})
|
||||
let that = this
|
||||
xBlufi.initXBlufi(1);
|
||||
|
@ -994,14 +1003,7 @@
|
|||
})
|
||||
}
|
||||
}, 2000)
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
content: `检测到该设备未联网,为您切换为蓝牙模式,支付的时候靠近该设备,并打开蓝牙`,
|
||||
showCancel: false,
|
||||
success: function(res) {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
if (this.detaobj.suitFeeType == 1 || this.detaobj.suitFeeType == 2) {
|
||||
let data = {
|
||||
|
@ -1026,9 +1028,9 @@
|
|||
this.jieshuflag = false
|
||||
uni.reLaunch({
|
||||
url: '/pages/shouye/index'
|
||||
})
|
||||
}, 1000)
|
||||
}, 1500)
|
||||
})
|
||||
}, 500)
|
||||
}, 1000)
|
||||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:', err)
|
||||
|
@ -1097,7 +1099,7 @@
|
|||
uni.reLaunch({
|
||||
url: '/pages/shouye/index'
|
||||
})
|
||||
},1500)
|
||||
},1000)
|
||||
},
|
||||
fail(err) {
|
||||
that.jieshuflag = false
|
||||
|
@ -1398,6 +1400,11 @@
|
|||
console.log("1收到设备发来的自定义数据结果:", this.ver_data)
|
||||
this.temperature = this.ver_data.temperature / 1000
|
||||
setTimeout(() => {
|
||||
|
||||
if (!this.hasCalledGetczly) {
|
||||
this.btnjieshu()
|
||||
this.hasCalledGetczly = true
|
||||
}
|
||||
// this.czflag = false
|
||||
this.jieshuflag = false
|
||||
this.jieshufalg = false
|
||||
|
|
|
@ -203,7 +203,8 @@
|
|||
phonenumber:'',
|
||||
mchShowBillMobile:'',
|
||||
telslag:false,
|
||||
userId:''
|
||||
userId:'',
|
||||
hasCalledGetczly:false
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
|
@ -664,9 +665,6 @@
|
|||
} else {
|
||||
if (this.ver_data == '') {
|
||||
this.czflag = true
|
||||
uni.showLoading({
|
||||
title: '蓝牙连接中'
|
||||
})
|
||||
let that = this
|
||||
xBlufi.initXBlufi(1);
|
||||
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent);
|
||||
|
@ -687,8 +685,14 @@
|
|||
}, 2000)
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
content: `检测到该设备未联网,为您切换为蓝牙模式,支付的时候靠近该设备,并打开蓝牙`,
|
||||
content: '检测到该设备未联网,为您切换为蓝牙模式,支付的时候靠近该设备,并打开蓝牙',
|
||||
showCancel: false,
|
||||
//是否显示取消按钮
|
||||
success: function(res) {
|
||||
uni.showLoading({
|
||||
title: '蓝牙连接中'
|
||||
})
|
||||
}
|
||||
})
|
||||
setTimeout(()=>{
|
||||
if(this.ver_data == ''){
|
||||
|
@ -779,6 +783,12 @@
|
|||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:',err)
|
||||
that.ver_data = ''
|
||||
uni.showToast({
|
||||
title: '蓝牙已断开,充值失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
|
@ -870,6 +880,12 @@
|
|||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:',err)
|
||||
that.ver_data = ''
|
||||
uni.showToast({
|
||||
title: '蓝牙已断开,充值失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
that.$u.get(`/app/bill/recharge/${dingobj}/bluetoothSuccess`).then(res => {
|
||||
|
@ -948,6 +964,278 @@
|
|||
}
|
||||
},
|
||||
|
||||
// 蓝牙连接成功后执行
|
||||
getczly(){
|
||||
uni.showLoading({
|
||||
title: '准备支付中...'
|
||||
})
|
||||
this.getzfqd()
|
||||
this.zhifuflag = true
|
||||
let that = this
|
||||
let data = {
|
||||
deviceNo: that.id,
|
||||
suitId: that.zfobj.suitId,
|
||||
money: that.zfobj.price,
|
||||
suitDeposit:that.zfobj.deposit,
|
||||
suitTime: that.zfobj.value,
|
||||
suitTimeUnit:that.suitTimeUnit,
|
||||
suitFeeMode:that.suitFeeMode,
|
||||
suitFeeType:that.suitFeeType,
|
||||
suitGearAmount:that.suitGearAmount,
|
||||
suitGearTime:that.suitGearTime,
|
||||
suitPrice:that.suitPrice
|
||||
}
|
||||
that.$u.post('/app/bill/recharge', data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
that.orderno = res.data
|
||||
if(this.suitFeeType == 3 || this.suitFeeType == 4){
|
||||
let data = {
|
||||
billNo:that.orderno,
|
||||
channelId:that.channelId
|
||||
}
|
||||
that.$u.put(`/app/bill/payDeposit`,data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
that.payNo = res.data.payBill.payNo
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
timeStamp: res.data.payParams.timeStamp,
|
||||
nonceStr: res.data.payParams.nonceStr,
|
||||
package: res.data.payParams.packageVal,
|
||||
signType: res.data.payParams.signType,
|
||||
paySign: res.data.payParams.paySign,
|
||||
success: (res) => {
|
||||
// console.log(res, '支付成功');
|
||||
if (that.timer) {
|
||||
clearInterval(this.timer);
|
||||
that.timer = null;
|
||||
}
|
||||
// 111111111111111111111111
|
||||
that.$u.put(`/app/payBill/${that.payNo}/refreshPayResult`).then(res =>{
|
||||
// if(res.code == 200){
|
||||
that.$u.get(`/app/bill/byNo/${that.orderno}`).then(res => {
|
||||
if (res.code == 200) {
|
||||
if(res.data.status == 9){
|
||||
uni.getNetworkType({
|
||||
success(res) {
|
||||
if (res.networkType !== 'none') {
|
||||
uni.getConnectedBluetoothDevices({
|
||||
success(res) {
|
||||
that.jzflag = true
|
||||
that.startLoading()
|
||||
setTimeout(()=> {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: 'open'
|
||||
})
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: '11open'
|
||||
})
|
||||
setTimeout(() => {
|
||||
if(that.ver_data == ''){
|
||||
uni.showToast({
|
||||
title: '蓝牙已断开,蓝牙充值失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}else{
|
||||
that.zhifuflag = false
|
||||
uni.reLaunch({
|
||||
url:'/page_components/eletj?id=' + that.orderno
|
||||
})
|
||||
}
|
||||
},1000)
|
||||
},500)
|
||||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:',err)
|
||||
that.ver_data = ''
|
||||
uni.showToast({
|
||||
title: '蓝牙已断开,充值失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('手机未连接网络')
|
||||
// this.baiflag = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: '支付失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
// }
|
||||
})
|
||||
// 支付成功逻辑
|
||||
uni.setStorageSync('time', that.expireTimeStr)
|
||||
},
|
||||
fail(err) {
|
||||
this.zhifuflag = false
|
||||
setTimeout(() => {
|
||||
this.czflag = false
|
||||
uni.hideLoading()
|
||||
}, 500)
|
||||
// 支付失败逻辑
|
||||
uni.showToast({
|
||||
title: '支付失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
})
|
||||
}else{
|
||||
this.zhifuflag = false
|
||||
}
|
||||
})
|
||||
}else{
|
||||
let data = {
|
||||
billNo:that.orderno,
|
||||
channelId:that.channelId
|
||||
}
|
||||
that.$u.put(`/app/bill/pay`,data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
timeStamp: res.data.payParams.timeStamp,
|
||||
nonceStr: res.data.payParams.nonceStr,
|
||||
package: res.data.payParams.packageVal,
|
||||
signType: res.data.payParams.signType,
|
||||
paySign: res.data.payParams.paySign,
|
||||
success: (res) => {
|
||||
// console.log(res, '支付成功');
|
||||
if (that.timer) {
|
||||
clearInterval(this.timer);
|
||||
that.timer = null;
|
||||
}
|
||||
// 111111111111111111111111
|
||||
that.$u.put(`/app/bill/${that.orderno}/refreshPayResult`).then(res =>{
|
||||
// if(res.code == 200 || res.code == 500){
|
||||
that.$u.put(`/app/bill/rechargeBillDevice?billNo=${that.orderno}`).then(res=>{
|
||||
that.$u.get('/app/bill/recharge/device/fail/list').then(res => { //充值失败调用
|
||||
if (res.code == 200) {
|
||||
console.log('获取订单状态',res);
|
||||
if(res.data.length > 0 && res.data != null){
|
||||
let dingobj = res.data[0].billNo
|
||||
console.log(dingobj,'订单号');
|
||||
uni.getNetworkType({
|
||||
success(res) {
|
||||
if (res.networkType !== 'none') {
|
||||
uni.getConnectedBluetoothDevices({
|
||||
success(res) {
|
||||
that.jzflag = true
|
||||
that.startLoading()
|
||||
setTimeout(()=> {
|
||||
xBlufi.notifySendCustomData({
|
||||
customData: "time@" + that.jine
|
||||
})
|
||||
},1000)
|
||||
},
|
||||
fail(err) {
|
||||
console.error('获取已连接蓝牙设备信息失败:',err)
|
||||
that.ver_data = ''
|
||||
uni.showToast({
|
||||
title: '蓝牙已断开,充值失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
that.$u.get(`/app/bill/recharge/${dingobj}/bluetoothSuccess`).then(res => {
|
||||
if (res.code == 200) {
|
||||
that.zhifuflag = false
|
||||
console.log('蓝牙离线充值成功11')
|
||||
setTimeout(() => {
|
||||
if(that.ver_data == ''){
|
||||
uni.showToast({
|
||||
title: '蓝牙已断开,蓝牙充值失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}else{
|
||||
that.zhifuflag = false
|
||||
uni.reLaunch({
|
||||
url:'/page_components/eletj?id=' + that.orderno
|
||||
})
|
||||
}
|
||||
},1000)
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('手机未连接网络')
|
||||
// this.baiflag = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}else{
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url:'/pages/shouye/index'
|
||||
})
|
||||
},1000)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
// }
|
||||
})
|
||||
// 支付成功逻辑
|
||||
uni.setStorageSync('time', that.expireTimeStr)
|
||||
},
|
||||
fail(err) {
|
||||
this.zhifuflag = false
|
||||
setTimeout(() => {
|
||||
this.czflag = false
|
||||
uni.hideLoading()
|
||||
}, 500)
|
||||
// 支付失败逻辑
|
||||
uni.showToast({
|
||||
title: '支付失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
})
|
||||
}else{
|
||||
this.zhifuflag = false
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
} else if (res.code == 500) {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
} else {
|
||||
this.czflag = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
startLoading() {
|
||||
this.isLoading = true;
|
||||
const intervalId = setInterval(() => {
|
||||
|
@ -990,6 +1278,19 @@
|
|||
// 获取附近蓝牙设备列表
|
||||
funListenDeviceMsgEvent: function(options) {
|
||||
switch (options.type) {
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED:
|
||||
if (!options.result) {
|
||||
uni.showModal({
|
||||
title: '很抱歉提醒你!',
|
||||
content: '小程序与设备异常断开',
|
||||
showCancel: false,
|
||||
//是否显示取消按钮
|
||||
success: function(res) {
|
||||
this.ver_data = ''
|
||||
}
|
||||
})
|
||||
}
|
||||
break;
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
|
||||
if (options.result) {
|
||||
let devicesarr = options.data
|
||||
|
@ -1038,12 +1339,12 @@
|
|||
this.czflag = false
|
||||
this.zhifuflag = false
|
||||
uni.hideLoading()
|
||||
// uni.showToast({
|
||||
// title: '切换成功,请点击支付',
|
||||
// icon: 'none',
|
||||
// duration: 2000
|
||||
// })
|
||||
},1000)
|
||||
|
||||
if (!this.hasCalledGetczly) {
|
||||
this.getczly()
|
||||
this.hasCalledGetczly = true
|
||||
}
|
||||
},1000)
|
||||
break;
|
||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
|
||||
if (options.result) {
|
||||
|
@ -1160,7 +1461,7 @@
|
|||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background-color: #000;
|
||||
opacity: .6;
|
||||
opacity: .5;
|
||||
}
|
||||
.ulbox{
|
||||
width: 100%;
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
<view class="bot_right">
|
||||
<view class="cont" style="text-align: center;">
|
||||
<view class="tit">
|
||||
{{deviceInfo.surplusEle == null ? '--' : deviceInfo.surplusEle}}
|
||||
{{deviceInfo.surplusEle == null || Number(deviceInfo.surplusEle) < 0 ? '--' : deviceInfo.surplusEle}}
|
||||
</view>
|
||||
<view class="txt">
|
||||
剩余度数
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
<view class="top_box">
|
||||
<view class="tip">账户余额(元)</view>
|
||||
<view class="txt">
|
||||
¥{{userinfo.balance == undefined ? '' : userinfo.balance}}
|
||||
¥{{userinfo.balance == undefined ? '' : Number(userinfo.balance) + Number(userinfo.waitBonusAmount)}} <text style="margin-left: 20rpx;">{{'待结算(' + userinfo.waitBonusAmount + ')'}}</text>
|
||||
</view>
|
||||
<view class="tip" style="display: flex;justify-content: space-between;">
|
||||
<text>累计提现:¥{{userinfo.withDrawlAmount == undefined ? '' : userinfo.withDrawlAmount}}</text>
|
||||
<text v-if="userinfo.waitBonusAmount != 0 || userinfo.waitBonusAmount != null">待结算:¥{{userinfo.waitBonusAmount}}</text>
|
||||
<!-- <text v-if="userinfo.waitBonusAmount != 0 || userinfo.waitBonusAmount != null">待结算:¥{{userinfo.waitBonusAmount}}</text> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="tit">
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<view class="txt" style="font-size: 24rpx;">
|
||||
¥
|
||||
</view>
|
||||
{{userinfo.balance == null ? 0 : userinfo.balance}}
|
||||
{{userinfo.balance == undefined ? '' : Number(userinfo.balance) + Number(userinfo.waitBonusAmount)}}
|
||||
</view>
|
||||
<view class="bot">
|
||||
钱包余额
|
||||
|
|
Loading…
Reference in New Issue
Block a user