diff --git a/page_user/fuwu.vue b/page_user/fuwu.vue index a706e96..63bf592 100644 --- a/page_user/fuwu.vue +++ b/page_user/fuwu.vue @@ -179,7 +179,8 @@ timer: null, titflag: false, kefulist: [], - scrollTop:0 + scrollTop:0, + billId:'' } }, onLoad(option) { @@ -289,7 +290,7 @@ }else{ this.picimg = true } - },500) + },100) } }, btnscrll() { @@ -356,7 +357,8 @@ } that.$u.post('/app/bill/recharge', data).then(res => { if (res.code == 200) { - that.orderno = res.data + that.orderno = res.data.billNo + that.billId = res.data.billId that.$u.get(`/app/pay/wx/${that.orderno}`).then((res) => { if (res.code == 200) { uni.requestPayment({ @@ -366,84 +368,42 @@ package: res.data.payParams.packageVal, signType: res.data.payParams.signType, paySign: res.data.payParams.paySign, - success: (res) => { + success: (res) => { if (that.timer) { clearInterval(this.timer); that.timer = null; } - // 111111111111111111111111 - that.$u.put( - `/app/bill/${that.orderno}/refreshPayResult` - ).then(res => { + that.$u.put(`/app/bill/${that.orderno}/refreshPayResult`).then(res => { // if(res.code == 200){ - 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) { - if (res.data - .length != 0) { - let dingobj = - res.data[0] - .billNo + if (res.data.length != 0) { + let dingobj = res.data[0].billNo uni.getNetworkType({ - success( - res - ) { - if (res - .networkType !== - 'none' - ) { + success(res) { + if (res.networkType !== 'none') { uni.getConnectedBluetoothDevices({ - success( - res - ) { - that.jzflag = - true + success(res) { + that.jzflag =true that.startLoading() - setTimeout - (() => { - xBlufi - .notifySendCustomData({ - customData: "11time@" + - that - .jine + setTimeout(() => { + xBlufi.notifySendCustomData({ + customData: "11time@" + that.jine }) - }, - 1500 - ) + },1500) }, - fail( - err - ) { - console - .error( - '获取已连接蓝牙设备信息失败:', - err - ) + fail(err) { + console.error('获取已连接蓝牙设备信息失败:',err) } }) - that.$u - .get( - `/app/bill/recharge/${dingobj}/bluetoothSuccess` - ) - .then( - res => { - if (res - .code == - 200 - ) { - that.zhifuflag = - true - console - .log( - '蓝牙离线充值成功11' - ) + that.$u.get(`/app/bill/recharge/${dingobj}/bluetoothSuccess`).then(res => { + if (res.code == 200) { + that.zhifuflag = true + console.log('蓝牙离线充值成功11') setTimeout (() => { - uni.reLaunch({ - url: '/pages/index/index?id=' + - that - .orderno + uni.navigateTo({ + url: '/page_user/mydetail?billId=' + that.billId }) }, 1000 @@ -451,72 +411,34 @@ } } ) - } else { - console - .log( - '手机未连接网络' - ) - // this.baiflag = false } } }) } else { uni.getNetworkType({ - success( - res - ) { - if (res - .networkType !== - 'none' - ) { + success(res) { + if (res.networkType !== 'none') { uni.getConnectedBluetoothDevices({ - success( - res - ) { - that.jzflag = - true + success(res) { + that.jzflag = true that.startLoading() - setTimeout - (() => { - xBlufi - .notifySendCustomData({ - customData: "11time@" + - that - .jine + setTimeout(() => { + xBlufi.notifySendCustomData({ + customData: "11time@" + that.jine }) - }, - 1500 - ) - }, - fail( - err - ) { - console - .error( - '获取已连接蓝牙设备信息失败:', - err - ) + },1500) + }, + fail(err) { + console.error('获取已连接蓝牙设备信息失败:',err) } }) - that.zhifuflag = - true - setTimeout - (() => { - uni.reLaunch({ - url: '/pages/index/index?id=' + - that - .orderno + that.zhifuflag = true + setTimeout(() => { + uni.navigateTo({ + url: '/page_user/mydetail?billId=' + that.billId }) - }, - 1000 - ) - } else { - console - .log( - '手机未连接网络' - ) - // this.baiflag = false - } + },1000) + } } }) } @@ -580,7 +502,8 @@ } that.$u.post('/app/bill/recharge', data).then(res => { if (res.code == 200) { - that.orderno = res.data + that.orderno = res.data.billNo + that.billId = res.data.billId let data = { billNo: that.orderno, channelId: 1 @@ -597,12 +520,10 @@ paySign: res.data.payParams.paySign, success: (res) => { that.zhifuflag = true - that.$u.put( - `/app/bill/${that.payNo}/refreshPayResult` - ).then(res => { + that.$u.put(`/app/bill/${that.payNo}/refreshPayResult`).then(res => { // 支付成功逻辑 - uni.reLaunch({ - url: '/pages/index/index' + uni.navigateTo({ + url: '/page_user/mydetail?billId=' + that.billId }) }) }, @@ -676,6 +597,11 @@ break; case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED: console.log("连接回调:" + JSON.stringify(options)); + uni.showToast({ + title: '连接成功', + icon: 'none', + duration: 2000 + }) if (options.result) { // console.log('125451245') { @@ -930,8 +856,8 @@ } .picdh { - width: 30rpx; - height: 25rpx; + width: 40rpx; + height: 35rpx; position: fixed; top: 53%; right: 76rpx; diff --git a/page_user/mydetail.vue b/page_user/mydetail.vue index d7827b4..51b1ac7 100644 --- a/page_user/mydetail.vue +++ b/page_user/mydetail.vue @@ -1,6 +1,6 @@ @@ -12,11 +13,43 @@ bgc: { backgroundColor: "#4C97E7", }, - - + name:'', + namemobel:'', + paw:'', + title:'提示', + } }, methods: { + click(){ + // 检查是否支持生物认证 + uni.checkIsSupportSoterAuthentication({ + success: (res) => { + // 调用人脸识别API + wx.startFacialRecognitionVerify({ + name: this.name, // 用户名称 + idCardNumber: this.namemobel, // 身份证号码 + success: (result) => { + if (result.errMsg === 'startFacialRecognitionVerify:ok') { + // 处理人脸识别成功的情况 + console.log('人脸识别成功'); + } + }, + fail: (error) => { + // 处理人脸识别失败的情况 + uni.showToast({ + title: '人脸识别失败', + icon: 'none', + duration: 2000 + }); + } + }); + }, + fail: (err) => { + console.log('支持生物认证失败', err); + } + }); + } } } @@ -26,6 +59,14 @@ page { background-color: #fff; } - + .title{ + width: 100%; + height: 100%; + background-color: #fff; + border-radius: 50rpx; + padding: 20rpx; + margin: auto; + + } \ No newline at end of file diff --git a/pages/zhuce.vue b/pages/zhuce.vue index bd12172..4bcce86 100644 --- a/pages/zhuce.vue +++ b/pages/zhuce.vue @@ -10,7 +10,7 @@ - 状态:已录入 已录入 未录入 @@ -31,7 +31,7 @@ - 开关 + {{item.lj}} 扫码 录入 @@ -301,6 +301,7 @@ ...device, flags, // 直接使用 flags 变量 sn: '', + lj:'连接' } }) } @@ -313,7 +314,9 @@ } else { //蓝牙停止搜索失败 this.mengcflag = false - uni.hideLoading() + setTimeout(()=>{ + uni.hideLoading() + },2000) console.log('蓝牙停止搜索失败'); } this.searching = false @@ -323,9 +326,6 @@ // 发送开关 createBLEConnections(e) { - uni.showLoading({ - title: '执行中...' - }) this.arrs = '' this.qrResult = e.name //拿到所点击的mac号 if (this.ver_data == null) { //判断是否有连接蓝牙 @@ -334,8 +334,29 @@ xBlufi.notifyStartDiscoverBle({ 'isStart': true }) + uni.showLoading({ + title: '连接准备中...' + }) // 停止蓝牙搜索 setTimeout(() => { + setTimeout(()=>{ + uni.showLoading({ + title: '连接中...' + }) + setTimeout(()=>{ + uni.hideLoading() + uni.showToast({ + title: '连接成功', + icon: 'success', + duration: 2000 + }) + this.devicesLists.forEach(item => { + if (item.name == this.qrResult) { + item.lj = '开关' + } + }) + },2000) + },500) xBlufi.notifyStartDiscoverBle({ 'isStart': false }) @@ -349,6 +370,9 @@ }) }, 1000) }else{ //有连接则发送命令 + uni.showLoading({ + title: '执行中...' + }) let that = this //改变this指向 uni.getNetworkType({ success(res) { @@ -370,6 +394,11 @@ wx.closeBLEConnection({ deviceId: that.deviceId, }) + that.devicesLists.forEach(item => { + if (item.name == that.qrResult) { + item.lj = '连接' + } + }) // console.log('guanbi'); },1000) },2000) @@ -478,9 +507,11 @@ uni.showLoading({ title: '请稍后...' }) + xBlufi.initXBlufi(1); + xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); xBlufi.notifyStartDiscoverBle({ 'isStart': true - }); + }) // 重新搜索清空蓝牙数组 this.bluthlist = [] this.devicesList = [] @@ -492,7 +523,7 @@ this.texts = '正在扫描蓝牙设备...' setTimeout(() => { this.statusflag = false - if (this.searching) { + // if (this.searching) { xBlufi.notifyStartDiscoverBle({ 'isStart': false }); @@ -503,11 +534,11 @@ } else { this.texts = '扫描到以下设备,请点击录入!' } - } else { - xBlufi.notifyStartDiscoverBle({ - 'isStart': true - }) - } + // } else { + // xBlufi.notifyStartDiscoverBle({ + // 'isStart': true + // }) + // } }, 2000) // } },