diff --git a/common/http.interceptor.js b/common/http.interceptor.js
index 5dcb86b..8961949 100644
--- a/common/http.interceptor.js
+++ b/common/http.interceptor.js
@@ -89,7 +89,7 @@ const install = (Vue, vm) => {
uni.login({
success: function(ret) {
- console.log("main.js==>res", ret)
+ // console.log("main.js==>res", ret)
// vm.$u.post('/user/login',{"js_code": ret.code}).then(res=>{
// if (res.code == 10003) {
// // console.log("新用户登录")
diff --git a/page_components/fuwu/index.vue b/page_components/fuwu/index.vue
index ff5c1b4..a68a62f 100644
--- a/page_components/fuwu/index.vue
+++ b/page_components/fuwu/index.vue
@@ -14,34 +14,38 @@
联系客服:{{deviceobj.storeContactMobile}}
-
+
- 充值失败
+ 设备未联网
- 充值失败请查看手机蓝牙是否打开
+ 检测到该设备未联网,请打开蓝牙进行蓝牙模式
第一:检查手机蓝牙是否打开
-
+
第二:设置小程序蓝牙授权
-
-
-
+
+
+
我已知晓
-
+
选择服务
@@ -74,16 +78,11 @@
-
+
-
+
@@ -96,9 +95,9 @@
-
-
-
+
+
+
@@ -111,7 +110,7 @@
return {
indexactive: -1,
checked: false,
- lanyaflag:false,
+ lanyaflag: false,
deviceobj: {},
timer: null,
expireTimeStr: '',
@@ -127,8 +126,8 @@
ver_data: '',
devicesList: [],
onlineStatus: '',
- jine:'',
- dingobj:{}
+ jine: '',
+ dingobj: {}
}
},
onLoad(option) {
@@ -141,11 +140,11 @@
let sceneValue = option.q
let decodedValue = decodeURIComponent(sceneValue);
this.id = getQueryParam(decodedValue, 's')
- console.log(this.id)
+
this.startTimer()
this.gettaoc()
this.getmac()
- if(this.onlineStatus == 0){
+ if (this.onlineStatus == 0) {
// 一开始搜索设备
xBlufi.initXBlufi(1)
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
@@ -170,7 +169,7 @@
this.startTimer()
this.gettaoc()
this.getmac()
- if(this.onlineStatus == 0){
+ if (this.onlineStatus == 0) {
// 一开始搜索设备
xBlufi.initXBlufi(1)
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
@@ -191,7 +190,7 @@
}, 2000)
}
}
-
+
},
computed: {
@@ -225,7 +224,7 @@
});
},
methods: {
- btnjxcz(){
+ btnjxcz() {
xBlufi.initXBlufi(1)
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
xBlufi.notifyStartDiscoverBle({
@@ -244,16 +243,16 @@
}
}, 2000)
},
-
+
call() {
let phoneNumber = ''
- if(this.deviceobj.storeContactMobile == null){
+ if (this.deviceobj.storeContactMobile == null) {
phoneNumber = this.deviceobj.userMobile
- }else{
+ } else {
phoneNumber = this.deviceobj.storeContactMobile
}
uni.makePhoneCall({
- phoneNumber: phoneNumber,
+ phoneNumber: phoneNumber,
success: function(res) {
console.log('拨打电话成功', res);
},
@@ -265,7 +264,7 @@
})
}
})
-
+
},
gettrue() {
@@ -315,15 +314,16 @@
// let differenceInMs = targetDate - now;
// let differenceInMinutes = Math.floor(differenceInMs / (1000 * 60));
// this.expireTimeStr = parseInt(differenceInMinutes) <= 0 ? '0' : differenceInMinutes
- let targetDateStr = this.deviceobj.expireTime;
- let targetParts = targetDateStr.split(/[- :]/);
- let targetDate = new Date(targetParts[0], targetParts[1] - 1, targetParts[2], targetParts[3], targetParts[4], targetParts[5]);
- let now = new Date();
- let differenceInMs = targetDate - now;
- if (differenceInMs <= 0) {
- this.expireTimeStr = '0';
- } else {
- this.expireTimeStr = '1'
+ let targetDateStr = this.deviceobj.expireTime;
+ let targetParts = targetDateStr.split(/[- :]/);
+ let targetDate = new Date(targetParts[0], targetParts[1] - 1, targetParts[2], targetParts[
+ 3], targetParts[4], targetParts[5]);
+ let now = new Date();
+ let differenceInMs = targetDate - now;
+ if (differenceInMs <= 0) {
+ this.expireTimeStr = '0';
+ } else {
+ this.expireTimeStr = '1'
}
}
})
@@ -335,7 +335,7 @@
icon: 'none',
duration: 1000
})
- }else if(this.indexactive == -1){
+ } else if (this.indexactive == -1) {
uni.showToast({
title: '请选择套餐 !',
icon: 'none',
@@ -391,11 +391,12 @@
}
})
} else {
- this.czflag = true
- uni.showLoading({
- title:'支付准备中'
- })
+
if (this.ver_data == '') {
+ this.czflag = true
+ uni.showLoading({
+ title: '切换中'
+ })
let that = this
xBlufi.initXBlufi(1);
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent);
@@ -406,7 +407,7 @@
xBlufi.notifyStartDiscoverBle({
'isStart': false
})
- if (that.devicesList.length > 0) {
+ if (that.devicesList.length > 0) {
xBlufi.notifyConnectBle({
isStart: true,
deviceId: that.deviceId,
@@ -416,10 +417,10 @@
}, 2000)
uni.showModal({
title: '温馨提示',
- content: '支付失败,支付的时候需要靠近设备,并打开蓝牙',
+ content: '检测到该设备未联网,为您切换为蓝牙模式,支付的时候靠近该设备,并打开蓝牙',
success: function(res) {
if (res.confirm) {
-
+
} else if (res.cancel) {
console.log('用户点击了取消');
}
@@ -446,60 +447,61 @@
signType: res.data.signType,
paySign: res.data.paySign,
success: (res) => {
- console.log(res, '支付成功');
- if (that.timer) {
+ // console.log(res, '支付成功');
+ if (that.timer) {
clearInterval(this.timer);
that.timer = null;
}
-
+
// 111111111111111111111111
- that.$u.get('/app/bill/recharge/device/fail/list').then(res => {
+ that.$u.get('/app/bill/recharge/device/fail/list').then(res => {
if (res.code == 200) {
- console.log('获取订单状态',res);
- let dingobj = res.data[0].billNo
- console.log(dingobj);
- uni.getNetworkType({
- success(res) {
- if (res.networkType !== 'none') {
- uni.getConnectedBluetoothDevices({
- success(res) {
- xBlufi.notifySendCustomData({
+ // console.log('获取订单状态',res);
+ let dingobj = res.data[0].billNo
+ // console.log(dingobj);
+ uni.getNetworkType({
+ success(res) {
+ if (res.networkType !== 'none') {
+ uni.getConnectedBluetoothDevices({
+ success(res) {
+ xBlufi.notifySendCustomData({
customData: "time@" + that.jine * 60
- });
- },
- fail(err) {
- console.error('获取已连接蓝牙设备信息失败:', err);
- }
- })
- that.$u.get(`/app/bill/recharge/${dingobj}/bluetoothSuccess`).then(res => {
- if(res.code == 200){
- console.log('蓝牙离线充值成功');
- setTimeout(()=>{
- uni.reLaunch({
- url: '/pages/shouye/index'
- })
- },1000)
- }
- })
- } else {
- console.log('手机未连接网络');
- // this.baiflag = false
- }
+ })
+ },
+ fail(err) {
+ console.error('获取已连接蓝牙设备信息失败:',err)
+ }
+ })
+ that.$u.get(`/app/bill/recharge/${dingobj}/bluetoothSuccess`).then(res => {
+ if (res.code == 200) {
+ console.log('蓝牙离线充值成功')
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '/pages/shouye/index'
+ })
+ },1000)
+ }
+ })
+ } else {
+ console.log('手机未连接网络')
+ // this.baiflag = false
}
- })
+ }
+ })
}
})
-
-
+
+
// 11111111111111111111111
-
+
// 支付成功逻辑
uni.setStorageSync('time', that.expireTimeStr)
- },fail(err) {
- setTimeout(()=>{
+ },
+ fail(err) {
+ setTimeout(() => {
this.czflag = false
uni.hideLoading()
- },500)
+ }, 500)
// 支付失败逻辑
uni.showToast({
title: '支付失败',
@@ -514,7 +516,7 @@
uni.reLaunch({
url: '/pages/login/login'
})
- }else{
+ } else {
this.czflag = false
}
})
@@ -550,19 +552,21 @@
let uniqueDevicesList = Array.from(new Set(this.devicesList));
// 将去重后的数组重新赋值给 this.devicesList
this.devicesList = uniqueDevicesList;
- }else{
+ } else {
// uni.showToast({
// title: '未找到该设备,请确认该设备在附近',
// icon: 'none',
// duration: 3000
// })
}
- });
+ })
+
}
break;
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
console.log("连接回调:" + JSON.stringify(options));
if (options.result) {
+ // console.log('125451245')
{
xBlufi.notifyInitBleEsp32({
deviceId: this.deviceId
@@ -571,14 +575,18 @@
this.deviceIds = options.data.deviceId
this.name = this.name
}
+ }else{
+
}
break;
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
this.ver_data = this.parseCustomData(options.data)
console.log("1收到设备发来的自定义数据结果:", this.ver_data);
- this.czflag = false
- uni.hideLoading()
+ setTimeout(()=>{
+ this.czflag = false
+ uni.hideLoading()
+ },1000)
break;
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
if (options.result) {
@@ -590,14 +598,14 @@
break;
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
if (!options.result) {
- this.lanyaflag = true
+ this.lanyaflag = true
uni.showToast({
title: '蓝牙未开启',
icon: 'none',
duration: 3000
});
return
- }else{
+ } else {
this.lanyaflag = false
}
break;
@@ -630,7 +638,7 @@