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

View File

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

View File

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