This commit is contained in:
3321822538@qq.com 2024-09-13 18:02:54 +08:00
parent 8c39f40a65
commit 781a3b5372
3 changed files with 576 additions and 450 deletions

View File

@ -44,8 +44,7 @@
<view class="" v-else> <view class="" v-else>
<text <text
v-if="detaobj.suitFeeType == 3 || detaobj.suitFeeType == 4">{{timeDifferenceString == '' ? '1分' : timeDifferenceString}}</text> v-if="detaobj.suitFeeType == 3 || detaobj.suitFeeType == 4">{{timeDifferenceString == '' ? '1分' : timeDifferenceString}}</text>
<text <text v-if="detaobj.suitFeeType == 2">{{du}}</text>
v-if="detaobj.suitFeeType == 2">{{du}}</text>
<text v-if="detaobj.suitFeeType == 1">{{formattedTime}}</text> <text v-if="detaobj.suitFeeType == 1">{{formattedTime}}</text>
</view> </view>
<view class="" v-if="detaobj.suitEndTime"> <view class="" v-if="detaobj.suitEndTime">
@ -191,6 +190,7 @@
<text v-else @click="btnjieshu">结束订单</text> <text v-else @click="btnjieshu">结束订单</text>
</view> </view>
</view> </view>
<view class="mask" v-if="jieshufalg"></view>
<!-- 点击结束弹窗 --> <!-- 点击结束弹窗 -->
<view class="truebox" v-if="trueboxfalg"> <view class="truebox" v-if="trueboxfalg">
@ -198,7 +198,8 @@
您要提前结束此订单吗 您要提前结束此订单吗
</view> </view>
<view class="titvalue"> <view class="titvalue">
当前预估消费金额为{{Number(feeprice) < 0.01 ? '0.01' : feeprice}},实际消费以实际金额为准 <text v-if="detaobj.suitFeeMode == 2 && detaobj.suitFeeType == 3">用电量为{{Number(totalElectriQuantity) - Number(suitStartEle)}}</text> 当前预估消费金额为{{Number(feeprice) < 0.01 ? '0.01' : feeprice}},实际消费以实际金额为准 <text
v-if="detaobj.suitFeeMode == 2 && detaobj.suitFeeType == 3">用电量为{{Number(totalElectriQuantity) - Number(suitStartEle)}}</text>
</view> </view>
<view class="truebtn"> <view class="truebtn">
<view class="quxiao" @click="trueboxfalg = false"> <view class="quxiao" @click="trueboxfalg = false">
@ -227,7 +228,7 @@
data() { data() {
return { return {
checkeds: false, checkeds: false,
trueboxfalg:false, trueboxfalg: false,
bgc: { bgc: {
backgroundColor: "#8883f0", backgroundColor: "#8883f0",
}, },
@ -272,11 +273,12 @@
orderno: '', orderno: '',
jieshuflag: false, jieshuflag: false,
feeprice: '', feeprice: '',
temperature:null, temperature: null,
du:'', du: '',
totalElectriQuantity:'', totalElectriQuantity: '',
suitStartEle :'', suitStartEle: '',
sbobj:{} sbobj: {},
jieshufalg:false
} }
}, },
onLoad(option) { onLoad(option) {
@ -367,12 +369,12 @@
}) })
// } // }
}, },
btnljzf(){ btnljzf() {
let data = { let data = {
billNo:this.orderno, billNo: this.orderno,
channelId:5 channelId: 5
} }
this.$u.put(`/app/bill/pay`,data).then((res) => { this.$u.put(`/app/bill/pay`, data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
let that = this let that = this
uni.requestPayment({ uni.requestPayment({
@ -383,7 +385,8 @@
signType: res.data.payParams.signType, signType: res.data.payParams.signType,
paySign: res.data.payParams.paySign, paySign: res.data.payParams.paySign,
success: (res) => { success: (res) => {
that.$u.put(`/app/bill/${that.orderno}/refreshPayResult`).then(res => {}) that.$u.put(`/app/bill/${that.orderno}/refreshPayResult`).then(
res => {})
// //
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
@ -410,8 +413,9 @@
} }
}) })
}, },
btnjieshu(){ btnjieshu() {
if(this.detaobj.suitFeeMode == 1){ if (this.detaobj.suitFeeMode == 1) {
if (this.onlineStatus == 1) {
let that = this let that = this
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
@ -422,11 +426,11 @@
billId: that.billId billId: that.billId
} }
that.$u.put(`/app/bill/endUse`, data).then(res => { that.$u.put(`/app/bill/endUse`, data).then(res => {
if(res.code == 200){ if (res.code == 200) {
uni.reLaunch({ uni.reLaunch({
url:'/pages/shouye/index' url: '/pages/shouye/index'
}) })
}else{ } else {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'none', icon: 'none',
@ -437,7 +441,88 @@
} }
} }
}) })
}else{ } else {
if (this.temperature == null) {
this.jieshufalg = true
uni.showLoading({
title: '切换中'
})
let that = this
xBlufi.initXBlufi(1);
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent);
xBlufi.notifyStartDiscoverBle({
'isStart': true
})
setTimeout(() => {
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
if (that.devicesList.length > 0) {
xBlufi.notifyConnectBle({
isStart: true,
deviceId: that.deviceId,
name: that.name
})
}
}, 2000)
uni.showModal({
title: '温馨提示',
content: `检测到该设备未联网,为您切换为蓝牙模式,支付的时候靠近该设备,并打开蓝牙`,
showCancel: false,
success: function(res) {
}
})
} else {
this.jieshufalg = true
let data = {
billId: this.billId,
}
this.$u.put(`/app/bill/endUse`, data).then(res => {
if (res.code == 200) {
uni.getNetworkType({
success(res) {
if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({
success(res) {
setTimeout(() => {
xBlufi.notifySendCustomData({
customData: 'close'
})
uni.showToast({
title: res.msg,
icon: 'success',
duration: 2000
})
this.jieshufalg = false
setTimeout(() => {
uni.reLaunch({
url: '/pages/shouye/index'
})
}, 1000)
}, 1500)
},
fail(err) {
console.error('获取已连接蓝牙设备信息失败:', err)
}
})
} else {
console.log('手机未连接网络')
// this.baiflag = false
}
}
})
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}
}
} else {
this.getsb() this.getsb()
this.trueboxfalg = true this.trueboxfalg = true
} }
@ -476,10 +561,10 @@
} else { } else {
if (this.detaobj.status == 1) { if (this.detaobj.status == 1) {
let data = { let data = {
billNo:this.orderno, billNo: this.orderno,
channelId:5 channelId: 5
} }
this.$u.put(`/app/bill/pay`,data).then((res) => { this.$u.put(`/app/bill/pay`, data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
let that = this let that = this
uni.requestPayment({ uni.requestPayment({
@ -525,10 +610,10 @@
this.$u.put(`/app/bill/endUse`, data).then(res => { this.$u.put(`/app/bill/endUse`, data).then(res => {
if (res.code == 200) { if (res.code == 200) {
let data = { let data = {
billNo:this.orderno, billNo: this.orderno,
channelId:5 channelId: 5
} }
this.$u.put(`/app/bill/pay`,data).then((res) => { this.$u.put(`/app/bill/pay`, data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
let that = this let that = this
uni.requestPayment({ uni.requestPayment({
@ -539,7 +624,9 @@
signType: res.data.payParams.signType, signType: res.data.payParams.signType,
paySign: res.data.payParams.paySign, paySign: res.data.payParams.paySign,
success: (res) => { success: (res) => {
that.$u.put(`/app/bill/${that.orderno}/refreshPayResult`).then(res => {}) that.$u.put(
`/app/bill/${that.orderno}/refreshPayResult`
).then(res => {})
// //
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
@ -605,15 +692,15 @@
title: '温馨提示', title: '温馨提示',
content: `检测到该设备未联网,为您切换为蓝牙模式,支付的时候靠近该设备,并打开蓝牙`, content: `检测到该设备未联网,为您切换为蓝牙模式,支付的时候靠近该设备,并打开蓝牙`,
showCancel: false, showCancel: false,
success: function (res) { success: function(res) {
} }
}) })
}else{ } else {
if(this.detaobj.suitFeeType == 1 || this.detaobj.suitFeeType == 2){ if (this.detaobj.suitFeeType == 1 || this.detaobj.suitFeeType == 2) {
let data = { let data = {
billId: this.billId, billId: this.billId,
totalEle:this.temperature totalEle: this.temperature
} }
this.$u.put(`/app/bill/endUse`, data).then(res => { this.$u.put(`/app/bill/endUse`, data).then(res => {
if (res.code == 200) { if (res.code == 200) {
@ -622,7 +709,7 @@
if (res.networkType !== 'none') { if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({ uni.getConnectedBluetoothDevices({
success(res) { success(res) {
setTimeout(()=> { setTimeout(() => {
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: 'close' customData: 'close'
}) })
@ -631,11 +718,11 @@
uni.reLaunch({ uni.reLaunch({
url: '/pages/shouye/index' url: '/pages/shouye/index'
}) })
},1000) }, 1000)
},1500) }, 1500)
}, },
fail(err) { fail(err) {
console.error('获取已连接蓝牙设备信息失败:',err) console.error('获取已连接蓝牙设备信息失败:', err)
} }
}) })
} else { } else {
@ -653,10 +740,10 @@
}) })
} }
}) })
}else{ } else {
let data = { let data = {
billId: this.billId, billId: this.billId,
totalEle:this.temperature totalEle: this.temperature
} }
this.$u.put(`/app/bill/endUse`, data).then(res => { this.$u.put(`/app/bill/endUse`, data).then(res => {
if (res.code == 200) { if (res.code == 200) {
@ -666,43 +753,66 @@
if (res.networkType !== 'none') { if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({ uni.getConnectedBluetoothDevices({
success(res) { success(res) {
setTimeout(()=> { setTimeout(() => {
xBlufi.notifySendCustomData({ xBlufi.notifySendCustomData({
customData: 'close' customData: 'close'
}) })
setTimeout(() => { setTimeout(() => {
let data = { let data = {
billNo:that.orderno, billNo: that.orderno,
channelId:5 channelId: 5
} }
that.$u.put(`/app/bill/pay`,data).then((res) => { that.$u.put(`/app/bill/pay`,data).then((res) => {
if (res.code == 200) { if (res.code ==200) {
uni.requestPayment({ uni.requestPayment({
provider: 'wxpay', provider: 'wxpay',
timeStamp: res.data.payParams.timeStamp, timeStamp: res.data.payParams.timeStamp,
nonceStr: res.data.payParams.nonceStr, nonceStr: res.data.payParams.nonceStr,
package: res.data.payParams.packageVal, package: res
signType: res.data.payParams.signType, .data
paySign: res.data.payParams.paySign, .payParams
success: (res) => { .packageVal,
that.$u.put( signType: res
.data
.payParams
.signType,
paySign: res
.data
.payParams
.paySign,
success: (
res
) => {
that.$u
.put(
`/app/bill/${that.orderno}/refreshPayResult` `/app/bill/${that.orderno}/refreshPayResult`
).then(res => {}) )
.then(
res => {}
)
// //
uni.showToast({ uni.showToast({
title: res.msg, title: res
.msg,
icon: 'success', icon: 'success',
duration: 1000 duration: 1000
}) })
setTimeout(() => { setTimeout
that.jieshuflag = false (() => {
that.jieshuflag =
false
uni.reLaunch({ uni.reLaunch({
url: '/pages/shouye/index' url: '/pages/shouye/index'
}) })
}, 1500)
}, },
fail(err) { 1500
that.jieshuflag = false )
},
fail(
err
) {
that.jieshuflag =
false
// //
uni.showToast({ uni.showToast({
title: '支付失败', title: '支付失败',
@ -713,11 +823,11 @@
}) })
} }
}) })
},1000) }, 1000)
},1500) }, 1500)
}, },
fail(err) { fail(err) {
console.error('获取已连接蓝牙设备信息失败:',err) console.error('获取已连接蓝牙设备信息失败:', err)
} }
}) })
} else { } else {
@ -788,7 +898,7 @@
this.newArr.push(value) this.newArr.push(value)
} }
} }
if(this.detaobj.suitEndEle){ if (this.detaobj.suitEndEle) {
let du = Number(this.detaobj.suitEndEle) - Number(this.detaobj.deviceTotalEle) let du = Number(this.detaobj.suitEndEle) - Number(this.detaobj.deviceTotalEle)
this.du = du.toFixed(2) this.du = du.toFixed(2)
} }
@ -806,7 +916,7 @@
if (differenceInMs <= 0) { if (differenceInMs <= 0) {
this.timeday = 0 this.timeday = 0
} else { } else {
if(this.timeday == ''){ if (this.timeday == '') {
this.timeday = this.formatMilliseconds(differenceInMs) this.timeday = this.formatMilliseconds(differenceInMs)
this.startTimer() this.startTimer()
} }
@ -959,7 +1069,7 @@
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS: case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
if (options.result) { if (options.result) {
let devicesarr = options.data let devicesarr = options.data
console.log(devicesarr,this.mac,'111'); console.log(devicesarr, this.mac, '111');
devicesarr.forEach(device => { devicesarr.forEach(device => {
const mac = device.name.substring(4); const mac = device.name.substring(4);
if (device.name.slice(5, 17) == this.qrResult) { if (device.name.slice(5, 17) == this.qrResult) {
@ -992,7 +1102,7 @@
this.deviceIds = options.data.deviceId this.deviceIds = options.data.deviceId
this.name = this.name this.name = this.name
} }
}else{ } else {
} }
@ -1001,16 +1111,18 @@
this.ver_data = this.parseCustomData(options.data) this.ver_data = this.parseCustomData(options.data)
console.log("1收到设备发来的自定义数据结果", this.ver_data); console.log("1收到设备发来的自定义数据结果", this.ver_data);
this.temperature = this.ver_data.temperature / 1000 this.temperature = this.ver_data.temperature / 1000
setTimeout(()=>{ setTimeout(() => {
// this.czflag = false // this.czflag = false
this.jieshuflag = false this.jieshuflag = false
this.jieshufalg = false
uni.hideLoading() uni.hideLoading()
},1000) }, 1000)
break; break;
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP: case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
if (options.result) { if (options.result) {
let uniqueDevicesList = Array.from(new Set(this.devicesList)); let uniqueDevicesList = Array.from(new Set(this.devicesList));
let filteredDevices = uniqueDevicesList.filter(device => device.name.substring(0, 4) === "CTKG"); let filteredDevices = uniqueDevicesList.filter(device => device.name.substring(0, 4) ===
"CTKG");
// this.devicesList // this.devicesList
this.devicesList = filteredDevices; this.devicesList = filteredDevices;
} }
@ -1109,7 +1221,7 @@
overflow: scroll; overflow: scroll;
} }
.truebox{ .truebox {
width: 500rpx; width: 500rpx;
max-height: 380rpx; max-height: 380rpx;
border-radius: 20rpx; border-radius: 20rpx;
@ -1121,19 +1233,23 @@
z-index: 99; z-index: 99;
padding: 30rpx; padding: 30rpx;
box-sizing: border-box; box-sizing: border-box;
.titvalue{
.titvalue {
width: 100%; width: 100%;
text-align: center; text-align: center;
margin-top: 30rpx; margin-top: 30rpx;
font-size: 32rpx; font-size: 32rpx;
} }
.truebtn{
.truebtn {
display: flex; display: flex;
margin-top: 30rpx; margin-top: 30rpx;
.quxiao{
.quxiao {
border-right: 1px solid #ccc; border-right: 1px solid #ccc;
} }
view{
view {
width: 50%; width: 50%;
text-align: center; text-align: center;
height: 90rpx; height: 90rpx;
@ -1146,11 +1262,13 @@
.jieshu { .jieshu {
width: 558rpx; width: 558rpx;
height: 90rpx; height: 90rpx;
text{
text {
width: 558rpx; width: 558rpx;
height: 90rpx; height: 90rpx;
display: block; display: block;
} }
line-height: 90rpx; line-height: 90rpx;
background: #8883F0; background: #8883F0;
border-radius: 54rpx 54rpx 54rpx 54rpx; border-radius: 54rpx 54rpx 54rpx 54rpx;

View File

@ -235,10 +235,10 @@
clearInterval(this.timer) clearInterval(this.timer)
this.timer = null; this.timer = null;
} }
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent); // xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
wx.closeBLEConnection({ // wx.closeBLEConnection({
deviceId: this.deviceId, // deviceId: this.deviceId,
}) // })
}, },
onHide() { onHide() {
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent); xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
@ -904,7 +904,7 @@
xBlufi.notifyInitBleEsp32({ xBlufi.notifyInitBleEsp32({
deviceId: this.deviceId deviceId: this.deviceId
}); });
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvents); // xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvents);
this.deviceIds = options.data.deviceId this.deviceIds = options.data.deviceId
this.name = this.name this.name = this.name
} }

View File

@ -204,6 +204,13 @@
}) })
}, },
sub() { sub() {
if (this.userinfo.limitWithdraw == true) {
uni.showToast({
title: this.userinfo.limitWithdrawReason,
icon: 'none',
duration: 2000
})
}else{
if (this.userinfo.isReal == true) { if (this.userinfo.isReal == true) {
if (this.money > this.userinfo.balance) { if (this.money > this.userinfo.balance) {
uni.showToast({ uni.showToast({
@ -253,6 +260,7 @@
url: '/page_components/shiming' url: '/page_components/shiming'
}) })
} }
}
}, },
getuserinfo() { getuserinfo() {
this.$u.get("/app/user/userInfo").then((res) => { this.$u.get("/app/user/userInfo").then((res) => {