diff --git a/components/tab-bar/tab-bar.vue b/components/tab-bar/tab-bar.vue index 5b4fdd1..49c34bc 100644 --- a/components/tab-bar/tab-bar.vue +++ b/components/tab-bar/tab-bar.vue @@ -13,7 +13,7 @@
-
我的
+
商户
diff --git a/page_components/fuwu/index.vue b/page_components/fuwu/index.vue index 1507cb4..f91d448 100644 --- a/page_components/fuwu/index.vue +++ b/page_components/fuwu/index.vue @@ -93,7 +93,10 @@ 我已同意 《用户服务协议》 - + + 立即支付 + + 立即支付 @@ -110,6 +113,7 @@ export default { data() { return { + zhifuflag:true, indexactive: -1, checked: false, lanyaflag: false, @@ -131,7 +135,8 @@ jine: '', dingobj: {}, suitTimeUnit:'', - zfflag:true + zfflag:true, + prices:'' } }, onLoad(option) { @@ -144,54 +149,69 @@ let sceneValue = option.q let decodedValue = decodeURIComponent(sceneValue); this.id = getQueryParam(decodedValue, 's') + this.$u.get(`/app/device/${this.id}/bySn`).then((res) => { + if (res.code == 200) { + this.mac = 'CTKG-' + res.data.mac + this.onlineStatus = res.data.onlineStatus + + if (this.onlineStatus == 0) { + // 一开始搜索设备 + xBlufi.initXBlufi(1) + xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); + xBlufi.notifyStartDiscoverBle({ + 'isStart': true + }) + setTimeout(() => { + xBlufi.notifyStartDiscoverBle({ + 'isStart': false + }) + if (this.devicesList.length > 0) { + xBlufi.notifyConnectBle({ + isStart: true, + deviceId: this.deviceId, + name: this.name + }) + } + }, 2000) + } + } + }) this.startTimer() this.gettaoc() - this.getmac() - if (this.onlineStatus == 0) { - // 一开始搜索设备 - xBlufi.initXBlufi(1) - xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); - xBlufi.notifyStartDiscoverBle({ - 'isStart': true - }) - setTimeout(() => { - xBlufi.notifyStartDiscoverBle({ - 'isStart': false - }) - if (this.devicesList.length > 0) { - xBlufi.notifyConnectBle({ - isStart: true, - deviceId: this.deviceId, - name: this.name - }) - } - }, 2000) - } + // this.getmac() + } else { this.id = option.id + this.$u.get(`/app/device/${this.id}/bySn`).then((res) => { + if (res.code == 200) { + this.mac = 'CTKG-' + res.data.mac + this.onlineStatus = res.data.onlineStatus + if (this.onlineStatus == 0) { + // 一开始搜索设备 + xBlufi.initXBlufi(1) + xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); + xBlufi.notifyStartDiscoverBle({ + 'isStart': true + }) + setTimeout(() => { + xBlufi.notifyStartDiscoverBle({ + 'isStart': false + }) + if (this.devicesList.length > 0) { + xBlufi.notifyConnectBle({ + isStart: true, + deviceId: this.deviceId, + name: this.name + }) + } + }, 2000) + } + } + }) this.startTimer() this.gettaoc() - this.getmac() - if (this.onlineStatus == 0) { - // 一开始搜索设备 - xBlufi.initXBlufi(1) - xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); - xBlufi.notifyStartDiscoverBle({ - 'isStart': true - }) - setTimeout(() => { - xBlufi.notifyStartDiscoverBle({ - 'isStart': false - }) - if (this.devicesList.length > 0) { - xBlufi.notifyConnectBle({ - isStart: true, - deviceId: this.deviceId, - name: this.name - }) - } - }, 2000) - } + // this.getmac() + } }, computed: { @@ -312,7 +332,7 @@ }, startTimer() { this.timer = setInterval(() => { - this.gettaoc(); + // this.gettaoc(); }, 30000); }, getmac() { @@ -320,7 +340,6 @@ if (res.code == 200) { this.mac = 'CTKG-' + res.data.mac this.onlineStatus = res.data.onlineStatus - // console.log(this.mac,'期初'); } }) }, @@ -339,8 +358,7 @@ // 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 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) { @@ -365,6 +383,7 @@ duration: 1000 }) } else if (this.onlineStatus == 1) { + this.zhifuflag = false let that = this let data = { deviceNo: that.id, @@ -376,39 +395,53 @@ that.$u.post('/app/bill/recharge', data).then((res) => { if (res.code == 200) { that.orderno = res.data - that.$u.get(`/app/pay/wx/${that.orderno}`).then((res) => { - if (res.code == 200) { - uni.requestPayment({ - provider: 'wxpay', - timeStamp: res.data.timeStamp, - nonceStr: res.data.nonceStr, - package: res.data.packageVal, - signType: res.data.signType, - paySign: res.data.paySign, - success: (res) => { - console.log(res, '支付成功'); - if (that.timer) { - clearInterval(this.timer); - that.timer = null; - } - that.$u.put(`/app/bill/${that.orderno}/refreshPayResult`).then(res => {}) - // 支付成功逻辑 - uni.reLaunch({ - url: '/pages/shouye/index' + console.log(this.prices); + if(this.prices == 0){ + that.$u.put(`/app/bill/${that.orderno}/refreshPayResult`).then(res => {}) + // 支付成功逻辑 + uni.reLaunch({ + url: '/pages/shouye/index' + }) + uni.setStorageSync('time', that.expireTimeStr) + }else{ + console.log('不是0元购'); + that.$u.get(`/app/pay/wx/${that.orderno}`).then((res) => { + if (res.code == 200) { + uni.requestPayment({ + provider: 'wxpay', + timeStamp: res.data.timeStamp, + nonceStr: res.data.nonceStr, + package: res.data.packageVal, + signType: res.data.signType, + paySign: res.data.paySign, + success: (res) => { + this.zhifuflag = true + console.log(res, '支付成功'); + if (that.timer) { + clearInterval(this.timer); + that.timer = null; + } + that.$u.put(`/app/bill/${that.orderno}/refreshPayResult`).then(res => {}) + // 支付成功逻辑 + uni.reLaunch({ + url: '/pages/shouye/index' + }) + uni.setStorageSync('time', that.expireTimeStr) + }, + fail(err) { + this.zhifuflag = true + // 支付失败逻辑 + uni.showToast({ + title: '支付失败', + icon: 'none', + duration: 2000 + }); + } }) - uni.setStorageSync('time', that.expireTimeStr) - }, - fail(err) { - // 支付失败逻辑 - uni.showToast({ - title: '支付失败', - icon: 'none', - duration: 2000 - }); - } - }); - } - }) + } + }) + } +x } else if (res.code == 401) { uni.reLaunch({ url: '/pages/login/login' @@ -451,7 +484,7 @@ } }) } else { - + this.zhifuflag = false let that = this let data = { deviceNo: that.id, @@ -463,81 +496,128 @@ that.$u.post('/app/bill/recharge', data).then((res) => { if (res.code == 200) { that.orderno = res.data - that.$u.get(`/app/pay/wx/${that.orderno}`).then((res) => { - if (res.code == 200) { - uni.requestPayment({ - provider: 'wxpay', - timeStamp: res.data.timeStamp, - nonceStr: res.data.nonceStr, - package: res.data.packageVal, - signType: res.data.signType, - paySign: res.data.paySign, - success: (res) => { - // console.log(res, '支付成功'); - if (that.timer) { - clearInterval(this.timer); - that.timer = null; - } - - // 111111111111111111111111 - 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({ + if(this.prices == 0){ + 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) { - if (res.networkType !== 'none') { - uni.getConnectedBluetoothDevices({ - success(res) { - xBlufi.notifySendCustomData({ - customData: "time@" + that.jine - }) - }, - fail(err) { - console.error('获取已连接蓝牙设备信息失败:',err) - } + xBlufi.notifySendCustomData({ + customData: "time@" + that.jine }) - 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) { + this.zhifuflag = true + 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(() => { - this.czflag = false - uni.hideLoading() - }, 500) - // 支付失败逻辑 - uni.showToast({ - title: '支付失败', - icon: 'none', - duration: 2000 - }); + } + }) } - }); - } - }) + }) + // 11111111111111111111111 + // 支付成功逻辑 + uni.setStorageSync('time', that.expireTimeStr) + }else{ + that.$u.get(`/app/pay/wx/${that.orderno}`).then((res) => { + if (res.code == 200) { + uni.requestPayment({ + provider: 'wxpay', + timeStamp: res.data.timeStamp, + nonceStr: res.data.nonceStr, + package: res.data.packageVal, + signType: res.data.signType, + paySign: res.data.paySign, + success: (res) => { + // console.log(res, '支付成功'); + if (that.timer) { + clearInterval(this.timer); + that.timer = null; + } + + // 111111111111111111111111 + that.$u.get(`/app/pay/result/${this.orderno}`).then(res =>{ + if(res.code == 200){ + 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({ + customData: "time@" + that.jine + }) + }, + fail(err) { + console.error('获取已连接蓝牙设备信息失败:',err) + } + }) + that.$u.get(`/app/bill/recharge/${dingobj}/bluetoothSuccess`).then(res => { + if (res.code == 200) { + this.zhifuflag = true + console.log('蓝牙离线充值成功') + setTimeout(() => { + uni.reLaunch({ + url: '/pages/shouye/index' + }) + },1000) + } + }) + } else { + console.log('手机未连接网络') + // this.baiflag = false + } + } + }) + } + }) + } + }) + + // 支付成功逻辑 + uni.setStorageSync('time', that.expireTimeStr) + }, + fail(err) { + this.zhifuflag = true + setTimeout(() => { + this.czflag = false + uni.hideLoading() + }, 500) + // 支付失败逻辑 + uni.showToast({ + title: '支付失败', + icon: 'none', + duration: 2000 + }); + } + }) + } + }) + } + } else if (res.code == 401) { uni.reLaunch({ url: '/pages/login/login' @@ -552,6 +632,8 @@ }, //选择套餐 btnactive(item) { + this.zhifuflag = true + this.prices = item.price this.sytime = item.value this.zfobj = item this.indexactive = item.suitId diff --git a/page_components/newtaocan.vue b/page_components/newtaocan.vue index 8a84cde..b20da94 100644 --- a/page_components/newtaocan.vue +++ b/page_components/newtaocan.vue @@ -4,7 +4,8 @@ height='50'> - + + + + + + 该设备暂无套餐 @@ -23,12 +31,18 @@ + + \ No newline at end of file diff --git a/page_user/txrecord.vue b/page_user/txrecord.vue index d730355..e380198 100644 --- a/page_user/txrecord.vue +++ b/page_user/txrecord.vue @@ -2,11 +2,6 @@ - - 成功提现 @@ -17,13 +12,10 @@ -{{item.money}}元 - + 剩余金额 {{item.afterBalance}} - @@ -148,7 +140,7 @@ text-align: right; .top { - margin-top: 12rpx; + // margin-top: 12rpx; font-size: 28rpx; font-family: HarmonyOS Sans SC, HarmonyOS Sans SC; font-weight: 400; diff --git a/page_user/yetx.vue b/page_user/yetx.vue index b747493..b6e03c8 100644 --- a/page_user/yetx.vue +++ b/page_user/yetx.vue @@ -11,10 +11,13 @@ 累计提现:{{userinfo.withDrawlAmount}} - - + + + 余额提现 + + + 提现明细 - 余额提现 @@ -28,10 +31,12 @@ - - + + + + + 提现方式 - 提现方式 @@ -115,6 +120,12 @@ } }, methods: { + // 跳转到提现记录 + btntxrecord(){ + uni.navigateTo({ + url:'/page_user/txrecord' + }) + }, getinfo(){ this.$u.get('/app/account' ).then((res) => { if (res.code == 200) { @@ -234,6 +245,9 @@ font-size: 28rpx; color: #3D3D3D; line-height: 38rpx; + display: flex; + justify-content: space-between; + width: 100%; .tit_line{ margin-right: 12rpx; width: 4rpx; diff --git a/pages.json b/pages.json index cf999b0..6d9277e 100644 --- a/pages.json +++ b/pages.json @@ -498,6 +498,16 @@ "navigationBarTextStyle": "#FFFFFF", "navigationStyle": "custom" } + }, + { + "path": "shebeixz", + "style": { + "navigationBarTitleText": "添加设备", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#3996FD", + "navigationBarTextStyle": "#FFFFFF", + "navigationStyle": "custom" + } } ] } diff --git a/pages/index/index.vue b/pages/index/index.vue index a767e45..266e285 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -7,7 +7,7 @@ - 商户中心 + 店铺 @@ -28,6 +28,11 @@ + + + + + + @@ -61,7 +67,7 @@ - + {{item.name}} @@ -75,8 +81,8 @@ - - + @@ -84,8 +90,8 @@ src="https://api.ccttiot.com/smartmeter/img/static/uZFUpcz0YZZ4f4RjvGg2" mode=""> 该店铺暂无设备... - - + + @@ -136,20 +142,6 @@ - - @@ -159,11 +151,7 @@ - - - - 努力刷新中 - + @@ -230,8 +218,8 @@ shujuflag: false, id: '', - touchStartX: 0, // 触屏起始点x - touchStartY: 0, // 触屏起始点y + touchStartX: 0, // 触屏起始点x + touchStartY: 0, // 触屏起始点y } }, onLoad() { @@ -296,38 +284,38 @@ query: '', path: '/pages/shouye/index' } - }, - mounted() { - }, methods: { // 按下 touchStart(e) { - this.touchStartX = e.touches[0].clientX; - this.touchStartY = e.touches[0].clientY; - }, + this.touchStartX = e.touches[0].clientX; + this.touchStartY = e.touches[0].clientY; + }, // 松开 - touchEnd(e) { - let deltaX = e.changedTouches[0].clientX - this.touchStartX; - let deltaY = e.changedTouches[0].clientY - this.touchStartY; - if (Math.abs(deltaX) > 50 && Math.abs(deltaX) > Math.abs(deltaY)) { - if (deltaX >= 0) { - // console.log("左滑") - } else { - // console.log("右滑") - } - } else if(Math.abs(deltaY) > 50&& Math.abs(deltaX) < Math.abs(deltaY)) { - if (deltaY < 0) { - // console.log("上滑") - } else { - // console.log("下滑") - this.shuaxin = true - setTimeout(()=>{ - this.getlist() - },1000) - } - } - }, + touchEnd(e) { + let deltaX = e.changedTouches[0].clientX - this.touchStartX; + let deltaY = e.changedTouches[0].clientY - this.touchStartY; + if (Math.abs(deltaX) > 50 && Math.abs(deltaX) > Math.abs(deltaY)) { + if (deltaX >= 0) { + // console.log("左滑") + } else { + // console.log("右滑") + } + } else if (Math.abs(deltaY) > 50 && Math.abs(deltaX) < Math.abs(deltaY)) { + if (deltaY < 0) { + // console.log("上滑") + } else { + console.log(deltaY) + if(deltaY > 300){ + this.shuaxin = true + this.pagenum = 1 + setTimeout(() => { + this.getlist() + }, 1000) + } + } + } + }, // 扫一扫绑定设备 @@ -367,10 +355,16 @@ that.$u.put("/app/device/bind", data).then( res => { if (res.code == 200) { - that.$u.get(`/app/device/${id}/bySn`).then((res) => { - if (res.code == 200) { + that.$u.get( + `/app/device/${id}/bySn` + ).then((res) => { + if (res.code == + 200) { uni.navigateTo({ - url: '/page_components/bindsz?id=' + res.data.deviceId + url: '/page_components/bindsz?id=' + + res + .data + .deviceId }) } }) @@ -487,7 +481,8 @@ } else if (systemInfo.platform === 'ios') { // console.log('aaaaaaaaaaaa'); uni.navigateTo({ - url: '/page_components/wifilist/index?deviceId=' + this.deviceId + '&name=' + this.name + url: '/page_components/wifilist/index?deviceId=' + this.deviceId + + '&name=' + this.name }) } uni.showToast({ @@ -573,7 +568,9 @@ } }) } else { - this.$u.get(`/app/device/list?storeId=${this.storeId}&pageNum=${this.pagenum}&pageSize=${this.pagesize}`).then((res) => { + this.$u.get( + `/app/device/list?storeId=${this.storeId}&pageNum=${this.pagenum}&pageSize=${this.pagesize}`) + .then((res) => { if (res.code == 200) { this.shuaxin = false this.total = res.total @@ -654,7 +651,9 @@ this.pagenum = 1 // this.wateringList = [] this.titlist = item.name - this.$u.get(`/app/device/list?storeId=${item.storeId}&pageNum=${this.pagenum}&pageSize=${this.pagesize}`).then((res) => { + this.$u.get( + `/app/device/list?storeId=${item.storeId}&pageNum=${this.pagenum}&pageSize=${this.pagesize}` + ).then((res) => { if (res.code == 200) { this.total = res.total // if(this.pagenum > 1){ @@ -954,12 +953,6 @@ url: '/page_user/cbRecord' }) }, - // 点击切换设备 - switchs() { - uni.navigateTo({ - url: '/page_user/switchs' - }) - } } } @@ -967,31 +960,22 @@