diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 57fd006..9c734f5 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -19,7 +19,7 @@ const install = (Vue, vm) => { // }, // }); Vue.prototype.$u.http.setConfig({ - // baseUrl: 'http://192.168.2.223:10002', + // baseUrl: 'http://192.168.2.81:10002', baseUrl: 'https://kg.chuangtewl.com/prod-api', // loadingText: '努力加载中~', // loadingTime: 1000, diff --git a/page_components/eletj.vue b/page_components/eletj.vue index d847e25..35e846c 100644 --- a/page_components/eletj.vue +++ b/page_components/eletj.vue @@ -361,7 +361,11 @@ // } }, btnljzf(){ - this.$u.get(`/app/pay/wx/${this.orderno}`).then((res) => { + 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({ @@ -372,9 +376,7 @@ 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, @@ -386,7 +388,7 @@ uni.reLaunch({ url: '/pages/shouye/index' }) - }, 1500) + }, 2000) }, fail(err) { that.jieshuflag = false @@ -465,7 +467,11 @@ }) } else { if (this.detaobj.status == 1) { - this.$u.get(`/app/pay/wx/${this.orderno}`).then((res) => { + let data = { + billNo:this.orderno, + channelId:5 + } + this.$u.put(`/app/bill/pay`,data).then.then((res) => { if (res.code == 200) { let that = this uni.requestPayment({ @@ -510,7 +516,11 @@ } this.$u.put(`/app/bill/endUse`, data).then(res => { if (res.code == 200) { - this.$u.get(`/app/pay/wx/${this.orderno}`).then((res) => { + let data = { + billNo:this.orderno, + channelId:5 + } + this.$u.put(`/app/bill/pay`,data).then.then((res) => { if (res.code == 200) { let that = this uni.requestPayment({ @@ -521,9 +531,7 @@ 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, @@ -652,12 +660,15 @@ success(res) { setTimeout(()=> { xBlufi.notifySendCustomData({ - customData: 'close' + customData: 'close' }) setTimeout(() => { - that.$u.get(`/app/pay/wx/${that.orderno}`).then((res) => { + let data = { + billNo:that.orderno, + channelId:5 + } + that.$u.put(`/app/bill/pay`,data).then.then((res) => { if (res.code == 200) { - uni.requestPayment({ provider: 'wxpay', timeStamp: res.data.payParams.timeStamp, diff --git a/page_components/fuwu/index.vue b/page_components/fuwu/index.vue index 115bd10..43b5574 100644 --- a/page_components/fuwu/index.vue +++ b/page_components/fuwu/index.vue @@ -21,10 +21,10 @@ - 设备未联网 + 设备离线 - 检测到该设备未联网,请打开蓝牙进行蓝牙模式 + 检测到该设备离线,请打开蓝牙进行蓝牙模式 @@ -110,17 +110,6 @@ - - 我已同意 @@ -277,26 +266,6 @@ if (res.code == 200) { that.mac = 'CTKG-' + res.data.mac that.onlineStatus = res.data.onlineStatus - // if (that.onlineStatus == 0) { - // // 一开始搜索设备 - // 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) - // } } }) } @@ -305,45 +274,10 @@ uni.navigateTo({ url:'/pages/shouye/index?id=' + this.id }) - // console.log(111); - // uni.showModal({ - // title: '提示', - // content: '该设备未绑定,你需进行绑定吗?', - // success: function(res) { - // if (res.confirm) { - // that.$u.put("/app/device/bind", data).then(res => { - // if(res.code == 200){ - // that.$u.get(`/app/device/${that.id}/bySn`).then((res) => { - // if (res.code == 200) { - // uni.navigateTo({ - // url: '/page_components/bindsz?id=' + res.data.deviceId - // }) - // } - // }) - // } - // }) - // } else if (res.cancel) { - - // } - // } - // }) } else if (res.data == 0) { uni.navigateTo({ url:'/pages/shouye/index?id=' + this.id }) - // uni.showModal({ - // title: '提示', - // content: '该设备未录入,你需进行录入吗?', - // success: function(res) { - // if (res.confirm) { - // uni.navigateTo({ - // url: '/page_fenbao/zhuce?sn=' + that.id - // }) - // } else if (res.cancel) { - - // } - // } - // }) } }) this.gettaoc() @@ -510,7 +444,7 @@ if(this.suitFeeType == 3 || this.suitFeeType == 4){ let data = { billNo:that.orderno, - channelId:1 + channelId:5 } that.$u.put(`/app/bill/payDeposit`,data).then(res => { if(res.code == 200){ @@ -552,7 +486,11 @@ } }) }else{ - that.$u.get(`/app/pay/wx/${that.orderno}`).then((res) => { + let data = { + billNo:that.orderno, + channelId:5 + } + that.$u.put(`/app/bill/pay/`,data).then((res) => { if (res.code == 200) { uni.requestPayment({ provider: 'wxpay', @@ -665,7 +603,7 @@ if(this.suitFeeType == 3 || this.suitFeeType == 4){ let data = { billNo:that.orderno, - channelId:1 + channelId:5 } that.$u.put(`/app/bill/payDeposit`,data).then((res) => { if (res.code == 200) { @@ -792,7 +730,11 @@ // 支付成功逻辑 // uni.setStorageSync('time', that.expireTimeStr) }else{ - that.$u.get(`/app/pay/wx/${that.orderno}`).then((res) => { + let data = { + billNo:that.orderno, + channelId:5 + } + that.$u.put(`/app/bill/pay/`,data).then((res) => { if (res.code == 200) { uni.requestPayment({ provider: 'wxpay', @@ -977,11 +919,11 @@ setTimeout(()=>{ this.czflag = false uni.hideLoading() - uni.showToast({ - title: '切换成功,请点击支付', - icon: 'none', - duration: 2000 - }) + // uni.showToast({ + // title: '切换成功,请点击支付', + // icon: 'none', + // duration: 2000 + // }) },1000) break; case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP: diff --git a/page_fenbao/statulist/myorder/detailxq/index.vue b/page_fenbao/statulist/myorder/detailxq/index.vue index 30f907d..b8e38f2 100644 --- a/page_fenbao/statulist/myorder/detailxq/index.vue +++ b/page_fenbao/statulist/myorder/detailxq/index.vue @@ -68,11 +68,23 @@ 套餐金额{{detailobj.money == undefined ? '--' : detailobj.money}} + 计时模式{{detailobj.suitFeeMode == 1 ? '单次计时' : '智能计时'}} + + + 收费模式 + 计时收费 + 按量收费 + 分时段按量收费 + 分时段计时收费 + + + 使用度数{{Number(detailobj.suitEndEle) - Number(detailobj.suitStartEle)}}度 + + 套餐时长{{detailobj.suitTime == undefined ? '--' : detailobj.suitTime}} 分钟 - 共计¥{{detailobj.money == undefined ? '--' : detailobj.money}} @@ -379,7 +391,7 @@ } .listxq{ width: 680rpx; - height: 1068rpx; + height: 1200rpx; background: #FFFFFF; border-radius: 20rpx 20rpx 20rpx 20rpx; margin: auto; diff --git a/page_fenbao/statulist/taocanlist/addtaocan/index.vue b/page_fenbao/statulist/taocanlist/addtaocan/index.vue index 839fbfc..1659e47 100644 --- a/page_fenbao/statulist/taocanlist/addtaocan/index.vue +++ b/page_fenbao/statulist/taocanlist/addtaocan/index.vue @@ -8,10 +8,13 @@ 单次收费为一次性收取费用,不退款! - 智能收费为按用时和用量智能动态计费,用户提前 结束、异常结束、商家关闭订单等操作都将动态智 能计算费用 + 智能收费为按用时和用量智能动态计费,用户提前结束、异常结束、商家关闭订单等操作都将动态智能计算费用 - 例如:1小时2元的收费模式,用户用半小时提前 结束订单,实际消费为1元,多收费用将退回原支 付账户! + 例如:1小时2元的收费模式,用户用半小时提前结束订单,实际消费为1元,多收费用将退回原支付账户! + + + 提示:当套餐的金额低于5元手续费都按0.05元收取! @@ -299,8 +302,7 @@ - + @@ -414,7 +416,7 @@ }, onLoad(option) { if (option.suitId) { - this.deviceId = option.id + this.deviceId = option.id this.title = '修改' this.suitId = option.suitId } else { @@ -549,10 +551,6 @@ }, // 收费时间 收费时间 收费时间 收费时间 - - - - // 点击删除套餐里面的设备 sbdel(id) { if (this.title == '确定') { @@ -1209,7 +1207,7 @@ .titwz { width: 654rpx; - height: 344rpx; + height: 450rpx; background: #F0EFFF; box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15); padding: 16rpx 28rpx; diff --git a/page_fenbao/statulist/taocanlist/index.vue b/page_fenbao/statulist/taocanlist/index.vue index 587eb76..d0b2e48 100644 --- a/page_fenbao/statulist/taocanlist/index.vue +++ b/page_fenbao/statulist/taocanlist/index.vue @@ -251,15 +251,14 @@ btnedit(item) { uni.navigateTo({ - url: '/page_fenbao/statulist/taocanlist/addtaocan/index?id=' + this.deviceId + '&suitId=' + - item.suitId + url: '/page_fenbao/statulist/taocanlist/addtaocan/index?id=' + this.deviceId + '&suitId=' + item.suitId }) }, click(item) { this.$u.delete(`/app/suit/${item.suitId}`).then((res) => { if (res.code == 200) { - this.$u.toast(`删除成功`); + this.$u.toast(`删除成功`) this.getlist() } else { uni.showToast({ @@ -268,8 +267,7 @@ duration: 1000, }) } - }); - + }) }, open(index) { this.list[index].show = true diff --git a/page_fenbao/zhuce.vue b/page_fenbao/zhuce.vue index 8a48d71..32647eb 100644 --- a/page_fenbao/zhuce.vue +++ b/page_fenbao/zhuce.vue @@ -4,18 +4,17 @@ back-icon-color="#fff" height='50'> 设备录入列表 - - - - - - + - 智能开关录入 + + 状态:已录入 未录入 + + + SN码: + MAC:{{item.name.substring(5)}} @@ -23,12 +22,14 @@ 蓝牙强度:{{item.RSSI}} - + 型号选择:{{item.xuanz == undefined ? '--' : item.xuanz}} - + + 扫码 录入 @@ -47,16 +48,12 @@ 3.确保设备未被添加过。 - - - + + + - @@ -67,7 +64,7 @@ export default { data() { return { - mengcflag:false, + mengcflag: false, titleflag: false, //提示隐藏 bgc: { backgroundColor: "#F7FAFE", @@ -94,10 +91,14 @@ backgroundColor: "#8883f0", }, lurulist: [], - arr:[], - shows:false, - arrname:'', - valuexh:'' + arr: [], + shows: false, + arrname: '', + valuexh: '', + deviceId: '', + arrs: [], + sn:'输入SN', + snname:'' } }, onLoad(option) { @@ -106,58 +107,96 @@ this.getxingh() this.storeId = option.sn }, - + onUnload: function() { + console.log("unload "); + xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent); + wx.closeBLEConnection({ + deviceId: this.deviceId, + }) + }, // 分享到好友(会话) - onShareAppMessage: function () { - return { - title: '创想物联', - path: '/pages/shouye/index' - } - }, - - // 分享到朋友圈 - onShareTimeline: function () { - return { - title: '创想物联', - query: '', - path: '/pages/shouye/index' - } - }, + onShareAppMessage: function() { + return { + title: '创想物联', + path: '/pages/shouye/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '创想物联', + query: '', + path: '/pages/shouye/index' + } + }, mounted() { // this.videoContext = uni.createVideoContext('myVideo', this) }, methods: { - getxingh(){ + // 扫码sn + scanQRCode(item){ + this.snname = item.name + uni.scanCode({ + onlyFromCamera: true, + scanType: ['qrCode'], + success: res => { + function getQueryParam(url, paramName) { + let regex = new RegExp(`[?&]${paramName}=([^&]*)`) + let results = regex.exec(url); + return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null + } + let sceneValue = res.result + let decodedValue = decodeURIComponent(sceneValue) + let id = getQueryParam(decodedValue, 's') + this.storeId = id + this.devicesLists.forEach(item => { + if (item.name == this.snname) { + item.sn = id + } + }) + }, + fail: err => { + console.error('扫描失败:', err) + uni.showToast({ + title: '扫描失败', + icon: 'none' + }) + } + }) + }, + + getxingh() { this.$u.get(`/app/model/all`).then(res => { - if(res.code == 200){ + if (res.code == 200) { this.arr = res.data - this.arr.forEach(item => { - if (item.hasOwnProperty('modelId')) { - item.value = item.modelId; - } - if (item.hasOwnProperty('modelName')) { - item.label = item.modelName; - } - }) - console.log(this.arr,'2121212') + this.arr.forEach(item => { + if (item.hasOwnProperty('modelId')) { + item.value = item.modelId; + } + if (item.hasOwnProperty('modelName')) { + item.label = item.modelName; + } + }) + console.log(this.arr, '2121212') } }) }, - btnshows(item,index){ + btnshows(item, index) { this.arrname = item.name this.shows = true }, // 选择型号 - confirm(e){ + confirm(e) { this.devicesLists.forEach(item => { - if(item.name == this.arrname){ + if (item.name == this.arrname) { item.xuanz = e[0].label this.valuexh = e[0].value } }) }, - - + + btnyc() { this.titleflag = false }, @@ -166,8 +205,6 @@ case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS: if (options.result) { this.devicesList = options.data - // let devicesarr = options.data - console.log(options.data,100100); } break; @@ -184,6 +221,8 @@ case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START: if (!options.result) { + this.mengcflag = false + uni.hideLoading() console.log("蓝牙未开启", options); uni.showToast({ title: '蓝牙未开启,请打开手机蓝牙', @@ -192,7 +231,7 @@ }); } else { this.searching = true - + } break; @@ -200,32 +239,59 @@ case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP: if (options.result) { let uniqueDevicesList = Array.from(new Set(this.devicesList)); - this.devicesLists = uniqueDevicesList.map(device => { - const deviceId = device.name.substring(5); - const newDevice = { ...device, xuanz: "请选择" }; // 直接在复制时添加 xuanz 字段 - return newDevice; + this.devicesLists = uniqueDevicesList.map(device => { + const deviceId = device.name.substring(5); + const newDevice = { + ...device, + xuanz: "请选择", + }; // 直接在复制时添加 xuanz 字段 + return newDevice; }) let devicesarr = options.data - + this.devicesList.forEach(device => { - if (device.name.substring(0, 4) == "CTKG" || device.name.substring(0, 4) == "CTPO") { + if (device.name.substring(0, 4) == "CTKG" || device.name.substring(0, 4) == + "CTPO") { this.devicesList.push(device); let uniqueDevicesList = Array.from(new Set(this.devicesList)); this.devicesLists = uniqueDevicesList.filter(device => { const deviceId = device.name.substring(5); - return !this.lurulist.includes(deviceId); + // return !this.lurulist.includes(deviceId); + return deviceId }) - // console.log(this.devicesLists); } }) - // console.log(devicesarr,100100); - console.log('蓝牙停止搜索ok') + // console.log('蓝牙停止搜索ok') + console.log(this.devicesLists, '蓝牙停止'); + this.mengcflag = false + uni.hideLoading() if (this.devicesLists.length == 0) { this.titleflag = true + } else { + this.devicesLists.forEach(item => { + this.arrs.push(item.name.slice(5)) + }) + this.arrs = this.arrs.join(',') + this.$u.get(`/app/device/getExistMac/${this.arrs}`).then(res => { + if (res.code == 200) { + const existingDevices = new Set(res.data); // 将 res.data 转换为 Set,以提高查找效率 + this.devicesLists = this.devicesLists.map(device => { + const trimmedName = device.name.slice(5); // 假设前缀总是5个字符长 + const flags = existingDevices.has(trimmedName); // true 如果存在,否则 false + return { + ...device, + flags, // 直接使用 flags 变量 + sn:'', + } + }) + } + }) } } else { //蓝牙停止搜索失败 + this.mengcflag = false + uni.hideLoading() console.log('蓝牙停止搜索失败'); } this.searching = false @@ -256,29 +322,29 @@ // }, // 请求已经录入设备的mac getluru() { - this.$u.get(`/app/device/listAllMac`).then(res => { - if (res.code == 200) { - this.lurulist = res.data - if(this.lurulist){ - xBlufi.initXBlufi(1); - xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); - xBlufi.notifyStartDiscoverBle({ - 'isStart': true - }) - // 两秒后停止蓝牙搜索 - setTimeout(() => { - xBlufi.notifyStartDiscoverBle({ - 'isStart': false - }); - this.status = true - }, 1000) - } - } + // this.$u.get(`/app/device/listAllMac`).then(res => { + // if (res.code == 200) { + // this.lurulist = res.data + // if(this.lurulist){ + xBlufi.initXBlufi(1); + xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); + xBlufi.notifyStartDiscoverBle({ + 'isStart': true }) + // 两秒后停止蓝牙搜索 + setTimeout(() => { + xBlufi.notifyStartDiscoverBle({ + 'isStart': false + }); + this.status = true + }, 1000) + // } + // } + // }) }, //4、建立连接 createBLEConnection(e) { - console.log(11); + this.deviceId = e.name this.mengcflag = true uni.showLoading({ title: '录入中...' @@ -288,23 +354,24 @@ let data = { sn: this.storeId, mac: this.mac, - modelId:this.valuexh + modelId: this.valuexh } this.$u.post('/app/device', data).then((res) => { if (res.code == 200) { uni.showToast({ - title: '设备:'+ this.mac +'已录入成功', + title: '设备:' + this.mac + '已录入成功', icon: 'success', - duration: 2000 - }) + duration: 2000 + }) this.mengcflag = false uni.hideLoading() - setTimeout(()=>{ - uni.navigateBack() - },1000) + this.Search() + // setTimeout(() => { + // uni.navigateBack() + // }, 1000) uni.removeStorageSync('mac'); } else { - this.mengcflag = false + this.mengcflag = false uni.hideLoading() uni.showToast({ title: res.msg, @@ -318,6 +385,10 @@ Search() { // console.log(1); // if (this.status) { + this.mengcflag = true + uni.showLoading({ + title: '请稍后...' + }) xBlufi.notifyStartDiscoverBle({ 'isStart': true }); @@ -325,6 +396,7 @@ this.bluthlist = [] this.devicesList = [] this.devicesLists = [] + this.arrs = [] // 重新搜索 // this.startBluetoothDevicesDiscovery() this.statusflag = true @@ -423,11 +495,12 @@ .dblist { display: flex; + justify-content: space-between; width: 100%; margin-top: 34rpx; background: #FFFFFF; box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08); - padding: 20rpx 0 24rpx 18rpx; + padding: 20rpx 20rpx 24rpx 18rpx; box-sizing: border-box; text-align: center; border-radius: 10rpx; @@ -475,10 +548,11 @@ .rt { margin-top: 32rpx; - padding-top: 50rpx; + padding-top: 50rpx; box-sizing: border-box; + text { - display: inline-block; + display: block; width: 108rpx; height: 60rpx; background: rgba(255, 255, 255, 0); diff --git a/page_user/sbdetail.vue b/page_user/sbdetail.vue index fd0407b..0f67947 100644 --- a/page_user/sbdetail.vue +++ b/page_user/sbdetail.vue @@ -1100,7 +1100,7 @@ case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS: if (options.result) { let devicesarr = options.data - // console.log(devicesarr,'devicesarrdevicesarr') + console.log(devicesarr,'devicesarrdevicesarr') devicesarr.forEach(device => { const mac = device.name.substring(5) if (device.name.slice(5, 17) == this.qrResult) { @@ -1171,18 +1171,18 @@ // 将去重后的数组重新赋值给 this.devicesList this.devicesList = uniqueDevicesList let list = [] - filteredDevices.forEach(device => { - // 从设备名称中提取 MAC 地址(假设 MAC 地址是设备名称的后6个字符) - let macFromName = device.name.substring(device.name.length - 12) - this.$u.get(`/app/device/${macFromName}/isBind`).then((res) => { - if (res.data == false) { - list.push(device) - } else { + // filteredDevices.forEach(device => { + // // 从设备名称中提取 MAC 地址(假设 MAC 地址是设备名称的后6个字符) + // let macFromName = device.name.substring(device.name.length - 12) + // this.$u.get(`/app/device/${macFromName}/isBind`).then((res) => { + // if (res.data == false) { + // list.push(device) + // } else { - } - }) + // } + // }) - }); + // }); setTimeout(() => { this.devicesList = list }, 200) diff --git a/pages/index/index.vue b/pages/index/index.vue index 6baa97d..1ac865d 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -433,18 +433,18 @@ // 将去重后的数组重新赋值给 this.devicesList this.devicesList = uniqueDevicesList let list = [] - filteredDevices.forEach(device => { - // 从设备名称中提取 MAC 地址(假设 MAC 地址是设备名称的后6个字符) - let macFromName = device.name.substring(device.name.length - 12) - this.$u.get(`/app/device/${macFromName}/isBind`).then((res) => { - if (res.data == false) { - list.push(device) - } else { + // filteredDevices.forEach(device => { + // // 从设备名称中提取 MAC 地址(假设 MAC 地址是设备名称的后6个字符) + // let macFromName = device.name.substring(device.name.length - 12) + // this.$u.get(`/app/device/${macFromName}/isBind`).then((res) => { + // if (res.data == false) { + // list.push(device) + // } else { - } - }) + // } + // }) - }); + // }); setTimeout(() => { this.devicesList = list }, 200) diff --git a/pages/my.vue b/pages/my.vue index 9ed10df..da3b459 100644 --- a/pages/my.vue +++ b/pages/my.vue @@ -15,11 +15,11 @@ 共{{userinfo.storeCount == null ? 0 : userinfo.storeCount}}间店铺 - - + + - - + 设备录入 +