From 5f5562ebe13124dcfbc089c045e8ded11f755ac7 Mon Sep 17 00:00:00 2001 From: "3321822538@qq.com" <3321822538@qq.com> Date: Tue, 5 Nov 2024 18:03:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=85=B3=E4=BB=A3=E7=90=86=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E6=96=B0=E5=A2=9E=20=E6=97=B6=E9=97=B4=E5=BE=85?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- page_components/bindszthr.vue | 5 +- page_components/eletj.vue | 19 ++- page_components/fuwu/index.vue | 150 +---------------- page_components/shebeixz.vue | 6 +- page_components/shiming.vue | 61 ++++--- .../statulist/taocanlist/addtaocan/index.vue | 15 ++ pages/daili/dailibing.vue | 84 +++++----- pages/daili/devicexq.vue | 37 ++--- pages/daili/index.vue | 151 ++++-------------- 9 files changed, 168 insertions(+), 360 deletions(-) diff --git a/page_components/bindszthr.vue b/page_components/bindszthr.vue index 5e2be32..9d1d10b 100644 --- a/page_components/bindszthr.vue +++ b/page_components/bindszthr.vue @@ -154,7 +154,8 @@ countdown: 10, // 初始倒计时时间 intervalId: null, contwz:'', - sn:'' + sn:'', + arrlists:[] } }, onLoad(option) { @@ -306,6 +307,8 @@ this.$u.get("/app/device/" + id).then((res) => { if (res.code == 200) { this.listobj = res.data + this.arrlists.push(res.data) + uni.setStorageSync('tcidlist', this.arrlists) } }) }, diff --git a/page_components/eletj.vue b/page_components/eletj.vue index b443a8d..45e17fe 100644 --- a/page_components/eletj.vue +++ b/page_components/eletj.vue @@ -343,6 +343,7 @@ computed: { // 计算剩余时间 formattedTime() { + // console.log(this.timeday,'00000'); if (this.timeday.days > 0) { // 只展示天和小时 return `${this.timeday.days}天${this.timeday.hours}小时` @@ -400,7 +401,7 @@ }, 1000) }, onHide() { - this.stopTimer(); + // this.stopTimer(); }, beforeDestroy() { // 组件销毁前清除定时器,防止内存泄漏 @@ -615,6 +616,7 @@ // 点击进行强刷数据 shuaxin(txt){ + // this.timeday = '' this.$u.get(`/app/device/${this.sbid}/refreshIot`).then((res) => { if(res.code == 200){ this.getDevice() @@ -1158,7 +1160,10 @@ clearInterval(this.timerId) } // 设置定时器,每分钟执行一次 timerCallback 函数 - this.timerId = setInterval(this.getDevice, 60000) + // this.timerId = setInterval(this.getDevice,this.shuaxin, 60000) + this.timerId = setInterval(() => { + this.shuaxin() + }, 60000); }, // 销毁定时器 stopTimer() { @@ -1208,14 +1213,16 @@ if (this.detaobj.suitExpireTime == null) { this.timeday = 0 } else { - let expireTimeStr = this.detaobj.suitExpireTime + let expireTimeStr = '' + expireTimeStr = this.detaobj.suitExpireTime let expireTimeParts = expireTimeStr.split(" ") let expireDateParts = expireTimeParts[0].split("-") let expireTimePartsTime = expireTimeParts[1].split(":") - let expireDate = new Date(expireDateParts[0], expireDateParts[1] - 1, expireDateParts[ - 2], expireTimePartsTime[0], expireTimePartsTime[1], expireTimePartsTime[2]) + let expireDate = new Date(expireDateParts[0], expireDateParts[1] - 1, expireDateParts[2], expireTimePartsTime[0], expireTimePartsTime[1], expireTimePartsTime[2]) let now = new Date() - let differenceInMs = expireDate - now; + let differenceInMs = expireDate - now + console.log(differenceInMs,expireDate,now,this.formatMilliseconds(differenceInMs),'101010'); + this.timeday == '' if (differenceInMs <= 0) { this.timeday = 0 } else { diff --git a/page_components/fuwu/index.vue b/page_components/fuwu/index.vue index ec5cdb4..2d3fcce 100644 --- a/page_components/fuwu/index.vue +++ b/page_components/fuwu/index.vue @@ -206,7 +206,8 @@ userId:'', hasCalledGetczly:false, hasCalledGetczlys:false, - hasCalledGetczlyss:false + hasCalledGetczlyss:false, + arrlists:[] } }, onLoad(option) { @@ -284,15 +285,17 @@ }) }, methods: { - // 点击我已知晓 + // 点击我已知晓判断设备是否有套餐 btnswindleflag(){ this.swindleflag = false if(this.userId == this.deviceobj.userId && this.deviceobj.suitList.length == 0){ + let that = this uni.showModal({ title: '提示', content: '该设备暂无套餐,是否前去配置?', success: function(res) { if (res.confirm) { + uni.setStorageSync('tcidlist', that.arrlists) uni.navigateTo({ url: '/page_components/newtaocan' }) @@ -331,6 +334,8 @@ if (res.code == 200) { that.$u.get(`/app/device/${that.id}/bySn`).then((res) => { if (res.code == 200) { + that.arrlists.push(res.data) + console.log(that.arrlists); that.mac = 'CTKG-' + res.data.mac that.onlineStatus = res.data.onlineStatus } @@ -796,39 +801,6 @@ // }) } }) - // this.czflag = true - // let that = this - // xBlufi.initXBlufi(1); - // xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvents); - // 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) - // setTimeout(()=>{ - // if(this.ver_data == ''){ - // uni.showToast({ - // title: '未连接成功,如多次失败请点击右上角联系客服咨询', - // icon: 'none', - // duration: 5000 - // }) - // this.czflag = false - // this.zhifuflag = false - // setTimeout(()=>{ - // uni.hideLoading() - // },5000) - // } - // },10000) } }) } else { @@ -932,38 +904,6 @@ // }) } }) - // that.czflag = true - // xBlufi.initXBlufi(1); - // xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEventss); - // 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) - // setTimeout(()=>{ - // if(that.ver_data == ''){ - // uni.showToast({ - // title: '未连接成功,如多次失败请点击右上角联系客服咨询', - // icon: 'none', - // duration: 5000 - // }) - // that.czflag = false - // that.zhifuflag = false - // setTimeout(()=>{ - // uni.hideLoading() - // },5000) - // } - // },10000) } }) if(that.ver_data != ''){ @@ -1139,38 +1079,6 @@ // }) } }) - // that.czflag = true - // xBlufi.initXBlufi(1); - // xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvents); - // 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) - // setTimeout(()=>{ - // if(that.ver_data == ''){ - // uni.showToast({ - // title: '未连接成功,如多次失败请点击右上角联系客服咨询', - // icon: 'none', - // duration: 5000 - // }) - // that.czflag = false - // that.zhifuflag = false - // setTimeout(()=>{ - // uni.hideLoading() - // },5000) - // } - // },10000) } }) } else { @@ -1305,53 +1213,9 @@ // }) } }) - // that.czflag = true - // xBlufi.initXBlufi(1); - // xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEventss); - // 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) - // setTimeout(()=>{ - // if(that.ver_data == ''){ - // uni.showToast({ - // title: '未连接成功,如多次失败请点击右上角联系客服咨询', - // icon: 'none', - // duration: 5000 - // }) - // that.czflag = false - // that.zhifuflag = false - // setTimeout(()=>{ - // uni.hideLoading() - // },5000) - // }else{ - // uni.showToast({ - // title: '未连接成功,如多次失败请点击右上角联系客服咨询', - // icon: 'none', - // duration: 5000 - // }) - // that.czflag = false - // that.zhifuflag = false - // setTimeout(()=>{ - // uni.hideLoading() - // },5000) - // } - // },10000) } }) - } else { console.log('手机未连接网络') // this.baiflag = false diff --git a/page_components/shebeixz.vue b/page_components/shebeixz.vue index 5885880..1be9c3d 100644 --- a/page_components/shebeixz.vue +++ b/page_components/shebeixz.vue @@ -72,6 +72,7 @@ onLoad(option) { uni.removeStorageSync('tcidlist') this.shu = option.shu + this.deviceId = option.id if(option.title == '确定'){ this.titflag = '确定' @@ -215,7 +216,7 @@ let data = { pageNum: 1, pageSize: 99, - modelTag:this.shu + // modelTag:this.shu } this.$u.get(`/app/device/list`, data).then((res) => { if (res.code == 200) { @@ -231,7 +232,6 @@ }else{ this.getao() } - // console.log(this.list); this.loading = true }else{ @@ -239,7 +239,7 @@ } } - }); + }) }, } diff --git a/page_components/shiming.vue b/page_components/shiming.vue index b5fb0d5..84940b1 100644 --- a/page_components/shiming.vue +++ b/page_components/shiming.vue @@ -133,26 +133,49 @@ url:'/page_user/yetx' }) }, + btnyz() { - let data = { - realName: this.name, - realIdCard: this.names, - type:this.type - } - this.$u.put('/app/user/realName', data).then(res => { - if (res.code == 200) { - let https = encodeURIComponent(res.data.jumpUrl) - uni.navigateTo({ - url: '/pages/sjshiming?https=' + https - }) - } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }) - } - }) + function isAgeOver18(idCard) { + // 提取出生年份 + const birthYear = idCard.substr(6, 4); // 身份证号码的第7到第10位是出生年份 + // 获取当前年份 + const currentYear = new Date().getFullYear(); + // 计算年龄 + const age = currentYear - parseInt(birthYear, 10); + // 判断是否年满18岁 + return age >= 18; + } + const idCard = this.names + // 调用函数并输出结果 + if (isAgeOver18(idCard)) { + console.log('身份证对应的用户已年满18岁'); + let data = { + realName: this.name, + realIdCard: this.names, + type:this.type + } + this.$u.put('/app/user/realName', data).then(res => { + if (res.code == 200) { + let https = encodeURIComponent(res.data.jumpUrl) + uni.navigateTo({ + url: '/pages/sjshiming?https=' + https + }) + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + } else { + console.log('身份证对应的用户未满18岁'); + uni.showToast({ + title: '实名认证需年满18岁', + icon: 'none', + duration: 2000 + }) + } } } diff --git a/page_fenbao/statulist/taocanlist/addtaocan/index.vue b/page_fenbao/statulist/taocanlist/addtaocan/index.vue index e5c8a9d..1ea08b3 100644 --- a/page_fenbao/statulist/taocanlist/addtaocan/index.vue +++ b/page_fenbao/statulist/taocanlist/addtaocan/index.vue @@ -471,6 +471,21 @@ this.getxieyi() if (uni.getStorageSync('tcidlist')) { this.deviceList = uni.getStorageSync('tcidlist') + function uniqueByProperty(arr, prop) { + const seen = new Set(); + return arr.filter(item => { + const val = item[prop]; + if (seen.has(val)) { + return false; + } else { + seen.add(val); + return true; + } + }); + } + // 使用该函数对 this.deviceList 进行去重,假设我们基于 'id' 属性进行去重 + this.deviceList = uniqueByProperty(this.deviceList, 'id'); + console.log(this.deviceList) } setTimeout(() => { if (this.suitId) { diff --git a/pages/daili/dailibing.vue b/pages/daili/dailibing.vue index 5476c72..25b4788 100644 --- a/pages/daili/dailibing.vue +++ b/pages/daili/dailibing.vue @@ -27,16 +27,16 @@ - 设备名称 + 服务费费率 - {{listobj.deviceName}} + {{listobj.agentServiceRate == undefined ? '--' : listobj.agentServiceRate + '%'}} - + + + 所属商户 - {{listobj.storeName == null ? '' : listobj.storeName}} + {{listobj.userName == null ? '' : listobj.userName}} @@ -164,7 +165,7 @@ - 修改名称 + 修改服务费费率 @@ -329,7 +330,6 @@ this.showshop = true }, confirms(e){ - // console.log(e); let data = { deviceId: this.id, storeId:e[0].value @@ -341,26 +341,26 @@ }, gettanc(){ - this.$u.get('/app/store/listCount').then((res) => { - if (res.code == 200) { - this.total = res.total - if (res.data.length > 0) { - // 有数据,追加到列表 - let arr = res.data.map(row => ({ - value: row.storeId, // 将storeId赋值给value - label: row.name // 将name赋值给label - })); - this.wateringList = this.wateringList.concat(arr) - this.wateringList = this.wateringList.slice(1) - this.pagenum++ - console.log(this.wateringList); - } else { - // 没有更多数据 - this.noMoreData = true; - } - this.isLoading = false; - } - }) + // this.$u.get('/app/store/listCount').then((res) => { + // if (res.code == 200) { + // this.total = res.total + // if (res.data.length > 0) { + // // 有数据,追加到列表 + // let arr = res.data.map(row => ({ + // value: row.storeId, // 将storeId赋值给value + // label: row.name // 将name赋值给label + // })); + // this.wateringList = this.wateringList.concat(arr) + // this.wateringList = this.wateringList.slice(1) + // this.pagenum++ + // console.log(this.wateringList); + // } else { + // // 没有更多数据 + // this.noMoreData = true; + // } + // this.isLoading = false; + // } + // }) }, onReachBottom() { @@ -372,7 +372,7 @@ title: '没有更多订单记录了', icon: 'none', duration: 1000 - }); + }) } }, @@ -415,10 +415,9 @@ this.showmc = false this.putdevice(data) }else if(num == 3){ - // console.log(this.xgname); let data = { deviceId: this.id, - deviceName: this.xgname, + agentServiceRate: this.xgname, } this.showpopup = false this.showpeice = false @@ -482,7 +481,7 @@ this.putdevice(data) }, putdevice(data) { - this.$u.put('/app/device', data).then((res) => { + this.$u.put('/agent/device', data).then((res) => { if (res.code == 200) { this.getDevice() uni.showToast({ @@ -496,7 +495,7 @@ sremakemc(){ // console.log(1); this.showmc = true - this.xgname = this.listobj.deviceName + this.xgname = this.listobj.agentServiceRate }, sremake() { this.showpopup = true @@ -514,7 +513,6 @@ }, getDevice(id) { this.$u.get("/app/device/" + this.id).then((res) => { - // this.$forceUpdate() if (res.code == 200) { this.deviceInfo = res.data console.log(this.deviceInfo, 'resres'); @@ -531,14 +529,14 @@ }) }, getgroup() { - this.$u.get("/app/store/listCount").then((res) => { - // this.$forceUpdate() - if (res.code == 200) { - this.groupList = res.data - // this.loadings=true - // this.initChart() - } - }); + // this.$u.get("/app/store/listCount").then((res) => { + // // this.$forceUpdate() + // if (res.code == 200) { + // this.groupList = res.data + // // this.loadings=true + // // this.initChart() + // } + // }); }, getlistobj(id) { @@ -550,7 +548,7 @@ }) } } - } + }