diff --git a/page_components/eletj.vue b/page_components/eletj.vue index 1c664d6..d1b6868 100644 --- a/page_components/eletj.vue +++ b/page_components/eletj.vue @@ -44,8 +44,7 @@ {{timeDifferenceString == '' ? '1分' : timeDifferenceString}} - {{du}}度 + {{du}}度 {{formattedTime}} @@ -166,7 +165,7 @@ - + - + - 立即支付 - 结束订单 + 立即支付 + 结束订单 - 立即支付 - 结束订单 + 立即支付 + 结束订单 - + + 您要提前结束此订单吗? - 当前预估消费金额为{{Number(feeprice) < 0.01 ? '0.01' : feeprice}}元,实际消费以实际金额为准 用电量为{{Number(totalElectriQuantity) - Number(suitStartEle)}}度 + 当前预估消费金额为{{Number(feeprice) < 0.01 ? '0.01' : feeprice}}元,实际消费以实际金额为准 用电量为{{Number(totalElectriQuantity) - Number(suitStartEle)}}度 @@ -210,7 +211,7 @@ - + @@ -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) { @@ -312,7 +314,7 @@ console.log("unload "); xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent); wx.closeBLEConnection({ - deviceId: this.deviceId, + deviceId: this.deviceId, }) }, // 分享到好友(会话) @@ -367,379 +369,487 @@ }) // } }, - btnljzf(){ + btnljzf() { let data = { - billNo:this.orderno, - channelId:5 + billNo: this.orderno, + channelId: 5 } - this.$u.put(`/app/bill/pay`,data).then((res) => { - if (res.code == 200) { - let that = this - 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(`/app/bill/${that.orderno}/refreshPayResult`).then(res => {}) - // 支付成功逻辑 - uni.showToast({ - title: res.msg, - icon: 'success', - duration: 1000 - }) - setTimeout(() => { - that.jieshuflag = false - uni.reLaunch({ - url: '/pages/shouye/index' - }) - }, 2000) - }, - fail(err) { - that.jieshuflag = false - // 支付失败逻辑 - uni.showToast({ - title: '支付失败', - icon: 'none', - duration: 2000 - }); - } - }) - } - }) - }, - btnjieshu(){ - if(this.detaobj.suitFeeMode == 1){ - let that = this - uni.showModal({ - title: '提示', - content: '您确定要提前结束订单吗,将不会产生任何退款和赔偿?', - success: function(res) { - if (res.confirm) { - let data = { - billId: that.billId - } - that.$u.put(`/app/bill/endUse`, data).then(res => { - if(res.code == 200){ - uni.reLaunch({ - url:'/pages/shouye/index' - }) - }else{ - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 1000 - }) - } + this.$u.put(`/app/bill/pay`, data).then((res) => { + if (res.code == 200) { + let that = this + 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(`/app/bill/${that.orderno}/refreshPayResult`).then( + res => {}) + // 支付成功逻辑 + uni.showToast({ + title: res.msg, + icon: 'success', + duration: 1000 }) - } + setTimeout(() => { + that.jieshuflag = false + uni.reLaunch({ + url: '/pages/shouye/index' + }) + }, 2000) + }, + fail(err) { + that.jieshuflag = false + // 支付失败逻辑 + uni.showToast({ + title: '支付失败', + icon: 'none', + duration: 2000 + }); + } + }) + } + }) + }, + btnjieshu() { + if (this.detaobj.suitFeeMode == 1) { + if (this.onlineStatus == 1) { + let that = this + uni.showModal({ + title: '提示', + content: '您确定要提前结束订单吗,将不会产生任何退款和赔偿?', + success: function(res) { + if (res.confirm) { + let data = { + billId: that.billId + } + that.$u.put(`/app/bill/endUse`, data).then(res => { + if (res.code == 200) { + uni.reLaunch({ + url: '/pages/shouye/index' + }) + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 1000 + }) + } + }) + } + } + }) + } 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{ + } + } else { this.getsb() this.trueboxfalg = true } }, btnbox() { - this.trueboxfalg = false - this.jieshuflag = true - if (this.onlineStatus == 1) { - if (this.detaobj.suitFeeType == 1 || this.detaobj.suitFeeType == 2) { - let data = { - billId: this.billId - } - this.$u.put(`/app/bill/endUse`, data).then(res => { - if (res.code == 200) { - uni.showToast({ - title: res.msg, - icon: 'success', - duration: 1000 - }) - setTimeout(() => { - this.jieshuflag = false - uni.reLaunch({ - url: '/pages/shouye/index' - }) - }, 1500) - } else { - this.getDevice() - this.jieshuflag = false - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }) - } - }) - } else { - if (this.detaobj.status == 1) { - let data = { - billNo:this.orderno, - channelId:5 - } - this.$u.put(`/app/bill/pay`,data).then((res) => { - if (res.code == 200) { - let that = this - 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(`/app/bill/${that.orderno}/refreshPayResult`) - .then(res => {}) - // 支付成功逻辑 - uni.showToast({ - title: res.msg, - icon: 'success', - duration: 1000 - }) - setTimeout(() => { - that.jieshuflag = false - uni.reLaunch({ - url: '/pages/shouye/index' - }) - }, 1500) - }, - fail(err) { - that.getDevice() - that.jieshuflag = false - // 支付失败逻辑 - uni.showToast({ - title: '支付失败', - icon: 'none', - duration: 2000 - }); - } - }) - } - }) - } else { - let data = { - billId: this.billId - } - this.$u.put(`/app/bill/endUse`, data).then(res => { - if (res.code == 200) { - let data = { - billNo:this.orderno, - channelId:5 - } - this.$u.put(`/app/bill/pay`,data).then((res) => { - if (res.code == 200) { - let that = this - 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(`/app/bill/${that.orderno}/refreshPayResult`).then(res => {}) - // 支付成功逻辑 - uni.showToast({ - title: res.msg, - icon: 'success', - duration: 1000 - }) - setTimeout(() => { - that.jieshuflag = false - uni.reLaunch({ - url: '/pages/shouye/index' - }) - }, 1500) - }, - fail(err) { - that.jieshuflag = false - // 支付失败逻辑 - uni.showToast({ - title: '支付失败', - icon: 'none', - duration: 2000 - }); - } - }) - } - }) - } else { - this.getDevice() - this.jieshuflag = false - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }) - } - }) - } - } - } else { - // console.log(this.temperature,'this.temperature'); - if (this.temperature == null) { - 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{ - if(this.detaobj.suitFeeType == 1 || this.detaobj.suitFeeType == 2){ - let data = { - billId: this.billId, - totalEle:this.temperature - } - 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' - }) - setTimeout(() => { - this.jieshuflag = false - uni.reLaunch({ - url: '/pages/shouye/index' - }) - },1000) - },1500) - }, - fail(err) { - console.error('获取已连接蓝牙设备信息失败:',err) - } - }) - } else { - console.log('手机未连接网络') - // this.baiflag = false - } - } - }) - } else { - this.jieshuflag = false - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }) - } - }) - }else{ - let data = { - billId: this.billId, - totalEle:this.temperature - } - this.$u.put(`/app/bill/endUse`, data).then(res => { - if (res.code == 200) { - let that = this - uni.getNetworkType({ - success(res) { - if (res.networkType !== 'none') { - uni.getConnectedBluetoothDevices({ - success(res) { - setTimeout(()=> { - xBlufi.notifySendCustomData({ - customData: 'close' - }) - setTimeout(() => { - let data = { - billNo:that.orderno, - channelId:5 - } - 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) => { - that.$u.put( - `/app/bill/${that.orderno}/refreshPayResult` - ).then(res => {}) - // 支付成功逻辑 - uni.showToast({ - title: res.msg, - icon: 'success', - duration: 1000 - }) - setTimeout(() => { - that.jieshuflag = false - uni.reLaunch({ - url: '/pages/shouye/index' - }) - }, 1500) - }, - fail(err) { - that.jieshuflag = false - // 支付失败逻辑 - uni.showToast({ - title: '支付失败', - icon: 'none', - duration: 2000 - }); - } - }) - } - }) - },1000) - },1500) - }, - fail(err) { - console.error('获取已连接蓝牙设备信息失败:',err) - } - }) - } else { - console.log('手机未连接网络') - // this.baiflag = false - } - } - }) - } else { - this.getDevice() - this.jieshuflag = false - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }) - } - }) - } - - } - } + this.trueboxfalg = false + this.jieshuflag = true + if (this.onlineStatus == 1) { + if (this.detaobj.suitFeeType == 1 || this.detaobj.suitFeeType == 2) { + let data = { + billId: this.billId + } + this.$u.put(`/app/bill/endUse`, data).then(res => { + if (res.code == 200) { + uni.showToast({ + title: res.msg, + icon: 'success', + duration: 1000 + }) + setTimeout(() => { + this.jieshuflag = false + uni.reLaunch({ + url: '/pages/shouye/index' + }) + }, 1500) + } else { + this.getDevice() + this.jieshuflag = false + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + } else { + if (this.detaobj.status == 1) { + let data = { + billNo: this.orderno, + channelId: 5 + } + this.$u.put(`/app/bill/pay`, data).then((res) => { + if (res.code == 200) { + let that = this + 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(`/app/bill/${that.orderno}/refreshPayResult`) + .then(res => {}) + // 支付成功逻辑 + uni.showToast({ + title: res.msg, + icon: 'success', + duration: 1000 + }) + setTimeout(() => { + that.jieshuflag = false + uni.reLaunch({ + url: '/pages/shouye/index' + }) + }, 1500) + }, + fail(err) { + that.getDevice() + that.jieshuflag = false + // 支付失败逻辑 + uni.showToast({ + title: '支付失败', + icon: 'none', + duration: 2000 + }); + } + }) + } + }) + } else { + let data = { + billId: this.billId + } + this.$u.put(`/app/bill/endUse`, data).then(res => { + if (res.code == 200) { + let data = { + billNo: this.orderno, + channelId: 5 + } + this.$u.put(`/app/bill/pay`, data).then((res) => { + if (res.code == 200) { + let that = this + 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( + `/app/bill/${that.orderno}/refreshPayResult` + ).then(res => {}) + // 支付成功逻辑 + uni.showToast({ + title: res.msg, + icon: 'success', + duration: 1000 + }) + setTimeout(() => { + that.jieshuflag = false + uni.reLaunch({ + url: '/pages/shouye/index' + }) + }, 1500) + }, + fail(err) { + that.jieshuflag = false + // 支付失败逻辑 + uni.showToast({ + title: '支付失败', + icon: 'none', + duration: 2000 + }); + } + }) + } + }) + } else { + this.getDevice() + this.jieshuflag = false + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + } + } + } else { + // console.log(this.temperature,'this.temperature'); + if (this.temperature == null) { + 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 { + if (this.detaobj.suitFeeType == 1 || this.detaobj.suitFeeType == 2) { + let data = { + billId: this.billId, + totalEle: this.temperature + } + 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' + }) + setTimeout(() => { + this.jieshuflag = false + uni.reLaunch({ + url: '/pages/shouye/index' + }) + }, 1000) + }, 1500) + }, + fail(err) { + console.error('获取已连接蓝牙设备信息失败:', err) + } + }) + } else { + console.log('手机未连接网络') + // this.baiflag = false + } + } + }) + } else { + this.jieshuflag = false + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + } else { + let data = { + billId: this.billId, + totalEle: this.temperature + } + this.$u.put(`/app/bill/endUse`, data).then(res => { + if (res.code == 200) { + let that = this + uni.getNetworkType({ + success(res) { + if (res.networkType !== 'none') { + uni.getConnectedBluetoothDevices({ + success(res) { + setTimeout(() => { + xBlufi.notifySendCustomData({ + customData: 'close' + }) + setTimeout(() => { + let data = { + billNo: that.orderno, + channelId: 5 + } + 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 + ) => { + that.$u + .put( + `/app/bill/${that.orderno}/refreshPayResult` + ) + .then( + res => {} + ) + // 支付成功逻辑 + uni.showToast({ + title: res + .msg, + icon: 'success', + duration: 1000 + }) + setTimeout + (() => { + that.jieshuflag = + false + uni.reLaunch({ + url: '/pages/shouye/index' + }) + }, + 1500 + ) + }, + fail( + err + ) { + that.jieshuflag = + false + // 支付失败逻辑 + uni.showToast({ + title: '支付失败', + icon: 'none', + duration: 2000 + }); + } + }) + } + }) + }, 1000) + }, 1500) + }, + fail(err) { + console.error('获取已连接蓝牙设备信息失败:', err) + } + }) + } else { + console.log('手机未连接网络') + // this.baiflag = false + } + } + }) + } else { + this.getDevice() + this.jieshuflag = false + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + } + + } + } }, // 每一分钟请求更新一次 @@ -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() } @@ -955,11 +1065,11 @@ funListenDeviceMsgEvent: function(options) { - switch (options.type) { + switch (options.type) { 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,8 +1102,8 @@ this.deviceIds = options.data.deviceId this.name = this.name } - }else{ - + } else { + } break; @@ -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.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; } @@ -1108,8 +1220,8 @@ padding-bottom: 300rpx; 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; @@ -1142,15 +1258,17 @@ } } } - + .jieshu { width: 558rpx; height: 90rpx; - text{ + + text { width: 558rpx; height: 90rpx; display: block; } + line-height: 90rpx; background: #8883F0; border-radius: 54rpx 54rpx 54rpx 54rpx; diff --git a/page_components/fuwu/index.vue b/page_components/fuwu/index.vue index eeba89c..77e3cf9 100644 --- a/page_components/fuwu/index.vue +++ b/page_components/fuwu/index.vue @@ -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 } diff --git a/page_user/yetx.vue b/page_user/yetx.vue index d1e7d26..c39e2a5 100644 --- a/page_user/yetx.vue +++ b/page_user/yetx.vue @@ -204,54 +204,62 @@ }) }, sub() { - if (this.userinfo.isReal == true) { - if (this.money > this.userinfo.balance) { - uni.showToast({ - title: '提现金额不能大于余额', - icon: 'none', - duration: 2000 - }); - } else if (this.currentindex == -1) { - uni.showToast({ - title: '请选择提现方式', - icon: 'none', - duration: 2000 - }) - } else { - this.btnmsk = true - let data = { - money: this.money, - arrivalAmount: this.roundToTwoDecimalsTraditional(Number(this.money) - Number(this - .roundToTwoDecimalsTraditional(this.serviceRates))), - serviceCharge: this.roundToTwoDecimalsTraditional(this.serviceRates), - channelId: this.channelId, - serviceRate: this.serviceRate, //服务费 - serviceType: this.serviceType //服务费收取方式 - } - this.$u.post('/app/bill/withdraw', data).then((res) => { - if (res.code == 200) { - this.getuserinfo() - uni.showToast({ - title: '申请提现成功', - icon: 'success', - duration: 2000 - }) - this.serviceRates = 0 - this.btnmsk = false - } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }) - this.btnmsk = false + 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({ + title: '提现金额不能大于余额', + icon: 'none', + duration: 2000 + }); + } else if (this.currentindex == -1) { + uni.showToast({ + title: '请选择提现方式', + icon: 'none', + duration: 2000 + }) + } else { + this.btnmsk = true + let data = { + money: this.money, + arrivalAmount: this.roundToTwoDecimalsTraditional(Number(this.money) - Number(this + .roundToTwoDecimalsTraditional(this.serviceRates))), + serviceCharge: this.roundToTwoDecimalsTraditional(this.serviceRates), + channelId: this.channelId, + serviceRate: this.serviceRate, //服务费 + serviceType: this.serviceType //服务费收取方式 } + this.$u.post('/app/bill/withdraw', data).then((res) => { + if (res.code == 200) { + this.getuserinfo() + uni.showToast({ + title: '申请提现成功', + icon: 'success', + duration: 2000 + }) + this.serviceRates = 0 + this.btnmsk = false + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + this.btnmsk = false + } + }) + } + } else { + uni.navigateTo({ + url: '/page_components/shiming' }) } - } else { - uni.navigateTo({ - url: '/page_components/shiming' - }) } }, getuserinfo() {