开关新增代理 待接接口

This commit is contained in:
3321822538@qq.com 2024-11-04 18:03:49 +08:00
parent 4f0d5c4390
commit a5628ff71d
12 changed files with 5501 additions and 124 deletions

View File

@ -19,8 +19,8 @@ const install = (Vue, vm) => {
// }, // },
// }); // });
Vue.prototype.$u.http.setConfig({ Vue.prototype.$u.http.setConfig({
// baseUrl: 'http://192.168.2.12:10002', baseUrl: 'http://192.168.2.12:10002',
baseUrl: 'https://kg.chuangtewl.com/prod-api', // baseUrl: 'https://kg.chuangtewl.com/prod-api',
// loadingText: '加载中...', // loadingText: '加载中...',
// loadingTime: 1000, // loadingTime: 1000,
// 设置自定义头部content-type // 设置自定义头部content-type

View File

@ -66,11 +66,12 @@
titflag:'', titflag:'',
arrlists:[], arrlists:[],
deviceList:[], deviceList:[],
shu:''
}; };
}, },
onLoad(option) { onLoad(option) {
uni.removeStorageSync('tcidlist') uni.removeStorageSync('tcidlist')
this.shu = option.shu
this.deviceId = option.id this.deviceId = option.id
if(option.title == '确定'){ if(option.title == '确定'){
this.titflag = '确定' this.titflag = '确定'
@ -213,7 +214,8 @@
getlist() { getlist() {
let data = { let data = {
pageNum: 1, pageNum: 1,
pageSize: 99 pageSize: 99,
modelTag:this.shu
} }
this.$u.get(`/app/device/list`, data).then((res) => { this.$u.get(`/app/device/list`, data).then((res) => {
if (res.code == 200) { if (res.code == 200) {

View File

@ -268,7 +268,8 @@
// delta: 1 // delta1 // delta: 1 // delta1
// }); // });
// }, // },
bind() { // and
gettihuan(){
let data = { let data = {
sn: this.storeId, sn: this.storeId,
mac: this.mac, mac: this.mac,
@ -277,7 +278,7 @@
this.$u.post('/app/device', data).then((res) => { this.$u.post('/app/device', data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
uni.showToast({ uni.showToast({
title: '录入成功', title: res.msg,
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}) })
@ -297,38 +298,38 @@
}); });
} }
}) })
},
bind() {
// this.$u.post(`/appVerify/band?sn=` + this.sn + '&mac=' + this.mac + '&hardwareVersionId=' + this this.$u.get(`/app/device/admin/byMac?mac=${this.mac}`).then(res =>{
// .hardwareVersionId).then((res) => { if(res.code == 200){
if(res.data == '' || res.data == null){
// if (res.code == 200) { this.gettihuan()
}else{
// uni.showToast({ let that = this
// title: '', uni.showModal({
// icon: 'none', title: '温馨提示',
// duration: 2000 content: '该设备已绑定SN您确定修改该设备的SN吗',
// }); success: (resModal) => {
// setTimeout(() => { if (resModal.confirm) {
// uni.navigateBack({ that.gettihuan()
// delta: 1 // delta1 } else if (resModal.cancel) { //
// }); uni.showToast({
// }, 2000) title: '已取消',
icon: 'none',
// } else { duration: 1000
// if (res.msg == 'MAC') { })
// this.showbind = true }
// } else { }
// uni.showToast({ })
// title: res.msg, }
// icon: 'none', }else{
// duration: 2000 uni.showToast({
// }); title: res.msg,
icon: 'success',
// } duration: 2000
})
// } }
// }) })
}, },
qrcode() { qrcode() {
uni.scanCode({ uni.scanCode({

View File

@ -37,7 +37,7 @@
</view> </view>
</view> </view>
<view class="anniu" @click="Search"> <view class="anniu" v-if="seachflag" @click="Search">
<button>重新扫描</button> <button>重新扫描</button>
</view> </view>
@ -103,7 +103,8 @@
snname: '', snname: '',
qrResult:'', qrResult:'',
name:'', name:'',
ver_data:null ver_data:null,
seachflag:true
} }
}, },
onLoad(option) { onLoad(option) {
@ -442,18 +443,18 @@
// if (res.code == 200) { // if (res.code == 200) {
// this.lurulist = res.data // this.lurulist = res.data
// if(this.lurulist){ // if(this.lurulist){
xBlufi.initXBlufi(1); // xBlufi.initXBlufi(1);
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); // xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
xBlufi.notifyStartDiscoverBle({ // xBlufi.notifyStartDiscoverBle({
'isStart': true // 'isStart': true
}) // })
// // //
setTimeout(() => { // setTimeout(() => {
xBlufi.notifyStartDiscoverBle({ // xBlufi.notifyStartDiscoverBle({
'isStart': false // 'isStart': false
}); // });
this.status = true // this.status = true
}, 1000) // }, 1000)
// } // }
// } // }
// }) // })
@ -485,47 +486,48 @@
return parsedData; return parsedData;
}, },
//4 //4
createBLEConnection(e) { // createBLEConnection(e) {
// this.deviceId = e.name // // this.deviceId = e.name
this.mengcflag = true // this.mengcflag = true
uni.showLoading({ // uni.showLoading({
title: '录入中...' // title: '...'
}) // })
this.mac = e.name.substring(5) // this.mac = e.name.substring(5)
// // //
let data = { // let data = {
sn: this.storeId, // sn: this.storeId,
mac: this.mac, // mac: this.mac,
modelId: this.valuexh // modelId: this.valuexh
} // }
this.$u.post('/app/device', data).then((res) => { // this.$u.post('/app/device', data).then((res) => {
if (res.code == 200) { // if (res.code == 200) {
uni.showToast({ // uni.showToast({
title: '设备:' + this.mac + '已录入成功', // title: ':' + this.mac + '',
icon: 'success', // icon: 'success',
duration: 2000 // duration: 2000
}) // })
this.mengcflag = false // this.mengcflag = false
uni.hideLoading() // uni.hideLoading()
this.Search() // this.Search()
// setTimeout(() => { // // setTimeout(() => {
// uni.navigateBack() // // uni.navigateBack()
// }, 1000) // // }, 1000)
uni.removeStorageSync('mac') // uni.removeStorageSync('mac')
} else { // } else {
this.mengcflag = false // this.mengcflag = false
uni.hideLoading() // uni.hideLoading()
uni.showToast({ // uni.showToast({
title: res.msg, // title: res.msg,
icon: 'none', // icon: 'none',
duration: 2000 // duration: 2000
}) // })
} // }
}) // })
}, // },
// //
Search() { Search() {
// if (this.status) { // if (this.status) {
this.seachflag = false
this.mengcflag = true this.mengcflag = true
uni.showLoading({ uni.showLoading({
title: '请稍后...' title: '请稍后...'
@ -551,13 +553,14 @@
xBlufi.notifyStartDiscoverBle({ xBlufi.notifyStartDiscoverBle({
'isStart': false 'isStart': false
}); });
this.seachflag = true
// //
if (this.devicesList.length == 0) { // if (this.devicesList.length == 0) {
this.tishiflag = true // this.tishiflag = true
this.texts = '扫描完毕,暂无发现设备' // this.texts = ''
} else { // } else {
this.texts = '扫描到以下设备,请点击录入!' // this.texts = ''
} // }
// } else { // } else {
// xBlufi.notifyStartDiscoverBle({ // xBlufi.notifyStartDiscoverBle({
// 'isStart': true // 'isStart': true

View File

@ -57,7 +57,13 @@
</view> </view>
</view> </view>
<view class="card2"> <view class="card2">
<view class="tit" style="border-left: 14rpx solid #8883F0;padding-left: 24rpx;">实时参数</view> <view class="" style="display: flex;justify-content: space-between;padding-right: 24rpx;box-sizing: border-box;">
<view class="tit" style="border-left: 14rpx solid #8883F0;padding-left: 24rpx;">实时参数</view>
<view @click="shuaxin" style="display: flex;color: #8883F0;justify-content: center;align-items: center;box-sizing: border-box;">
点击刷新
<image style="width: 30rpx;height: 30rpx;" src="https://api.ccttiot.com/smartmeter/img/static/uiVZaazpgTY3gE7aYtGb" mode=""></image>
</view>
</view>
<view class="bot_right"> <view class="bot_right">
<view class="cont" style="text-align: center;"> <view class="cont" style="text-align: center;">
<view class="tit"> <view class="tit">
@ -92,10 +98,23 @@
</view> </view>
</view> --> </view> -->
</view> </view>
<view @click="shuaxin" style="width: 100%;display: flex;color: #8883F0;justify-content: center;align-items: center;padding-top:40rpx;padding-bottom: 30rpx;box-sizing: border-box;"> <view class="" style="display: flex;margin-top: 20rpx;padding: 50rpx;box-sizing: border-box;width: 100%;
点击刷新实时信息 height: 80rpx;align-items: center;justify-content: space-between;background-color: #fff;border-radius: 20rpx;font-size: 32rpx;color: #3D3D3D;">
<image style="width: 32rpx;height: 32rpx;" src="https://api.ccttiot.com/smartmeter/img/static/uiVZaazpgTY3gE7aYtGb" mode=""></image> <view class="bot">开关状态{{tdtxt}}</view>
</view> <view class="cont" @click="btnkq">
<view class="top" style="padding-top: 10rpx;">
<!-- <u-switch v-model="checked" active-color="#8883F0"></u-switch> -->
<view class="rt">
<image v-if="imgflag" style="width: 160rpx;height: 80rpx;"
src="https://api.ccttiot.com/smartmeter/img/static/uccaWar4FDp37op7haWM " mode="">
</image>
<image style="width: 160rpx;height: 80rpx;" v-else
src="https://api.ccttiot.com/smartmeter/img/static/ur9HRtZKY7YcxGewJARz" mode="">
</image>
</view>
</view>
</view>
</view>
</view> </view>
<view class="card2" style="padding-bottom: 40rpx;"> <view class="card2" style="padding-bottom: 40rpx;">
@ -137,15 +156,15 @@
</view> </view>
</view> </view>
<!-- 操作 --> <!-- 操作 -->
<view class="card2" style="padding-bottom: 30rpx;box-sizing: border-box;margin-top: 20rpx;"> <!-- <view class="card2" style="padding-bottom: 30rpx;box-sizing: border-box;margin-top: 20rpx;">
<view class="tit" style="border-left: 14rpx solid #8883F0;padding-left: 24rpx;">设备控制 </view> <view class="tit" style="border-left: 14rpx solid #8883F0;padding-left: 24rpx;">设备控制 </view>
<view class="" style="display: flex;margin-top: 20rpx;padding: 50rpx;box-sizing: border-box;width: 100%; <view class="" style="display: flex;margin-top: 20rpx;padding: 50rpx;box-sizing: border-box;width: 100%;
height: 80rpx;align-items: center;justify-content: space-between;background-color: #fff;border-radius: 20rpx;font-size: 32rpx;color: #3D3D3D;"> height: 80rpx;align-items: center;justify-content: space-between;background-color: #fff;border-radius: 20rpx;font-size: 32rpx;color: #3D3D3D;">
<view class="bot">开关状态{{tdtxt}}</view> <view class="bot">开关状态{{tdtxt}}</view>
<view class="cont" @click="btnkq"> <view class="cont" @click="btnkq">
<view class="top" style="padding-top: 10rpx;"> <view class="top" style="padding-top: 10rpx;"> -->
<!-- <u-switch v-model="checked" active-color="#8883F0"></u-switch> --> <!-- <u-switch v-model="checked" active-color="#8883F0"></u-switch> -->
<view class="rt"> <!-- <view class="rt">
<image v-if="imgflag" style="width: 160rpx;height: 80rpx;" <image v-if="imgflag" style="width: 160rpx;height: 80rpx;"
src="https://api.ccttiot.com/smartmeter/img/static/uccaWar4FDp37op7haWM " mode=""> src="https://api.ccttiot.com/smartmeter/img/static/uccaWar4FDp37op7haWM " mode="">
</image> </image>
@ -156,7 +175,7 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view> -->
<view class="card3" v-if="opflag"> <view class="card3" v-if="opflag">
<view class="tit" style="border-left: 14rpx solid #8883F0;padding-left: 24rpx;">其他功能</view> <view class="tit" style="border-left: 14rpx solid #8883F0;padding-left: 24rpx;">其他功能</view>
@ -1971,7 +1990,8 @@
padding-top: 40rpx; padding-top: 40rpx;
margin-top: 20rpx; margin-top: 20rpx;
width: 670rpx; width: 670rpx;
max-height: 314rpx; max-height: 614rpx;
padding-bottom: 30rpx;
background: #FFFFFF; background: #FFFFFF;
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(53, 140, 255, 0.1); box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(53, 140, 255, 0.1);
border-radius: 28rpx; border-radius: 28rpx;

View File

@ -140,6 +140,7 @@
icon: 'success', icon: 'success',
duration: 2000, duration: 2000,
}) })
uni.hideLoading()
}else{ }else{
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
@ -157,19 +158,23 @@
// //
btnkq(){ btnkq(){
uni.showLoading({
title: '设备开启中...'
})
this.$u.put(`/app/device/admin/${this.id}/switch?open=true`).then((res) => { this.$u.put(`/app/device/admin/${this.id}/switch?open=true`).then((res) => {
if (res.code == 200) { if (res.code == 200) {
setTimeout(()=>{ // setTimeout(()=>{
this.btnsx() // this.btnsx()
},1000) // },1000)
uni.showToast({ uni.showToast({
title: res.msg, title: '开启成功',
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}) })
this.powerStatus = '开启'
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg, title: '开启失败',
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}) })
@ -178,19 +183,23 @@
}, },
// //
btngb(){ btngb(){
uni.showLoading({
title: '设备关闭中...'
})
this.$u.put(`/app/device/admin/${this.id}/switch?open=false`).then((res) => { this.$u.put(`/app/device/admin/${this.id}/switch?open=false`).then((res) => {
if (res.code == 200) { if (res.code == 200) {
setTimeout(()=>{ // setTimeout(()=>{
this.btnsx() // this.btnsx()
},1000) // },1000)
uni.showToast({ uni.showToast({
title: res.msg, title: '关闭成功',
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}) })
this.powerStatus = '关闭'
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg, title: '关闭失败',
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}) })
@ -199,17 +208,18 @@
}, },
// //
btnsx(){ btnsx(){
this.$u.get(`/app/device/${this.id}/refreshIot`).then((res) => {
this.$u.get(`/app/device/v2/refreshIot?deviceNo=${this.storeId}`).then((res) => {
if(res.code == 200){ if(res.code == 200){
this.getsn() this.getsn()
uni.showToast({ uni.showToast({
title: res.msg, title: '刷新成功',
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}) })
}else{ }else{
uni.showToast({ uni.showToast({
title: res.msg, title: '刷新失败',
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}) })

View File

@ -6,7 +6,7 @@
<view class="top_box"> <view class="top_box">
<view class="tip">账户余额()</view> <view class="tip">账户余额()</view>
<view class="txt"> <view class="txt">
{{userinfo.balance == undefined ? '' : Number(userinfo.balance) + Number(userinfo.waitBonusAmount)}} <text style="margin-left: 20rpx;">{{'待结算(' + userinfo.waitBonusAmount + ')'}}</text> {{userinfo.balance == undefined ? '' : Number(userinfo.balance) + Number(userinfo.waitBonusAmount)}} <text style="margin-left: 20rpx;">{{'待结算(' + waitBonusAmount + ')'}}</text>
</view> </view>
<view class="tip" style="display: flex;justify-content: space-between;"> <view class="tip" style="display: flex;justify-content: space-between;">
<text>累计提现{{userinfo.withDrawlAmount == undefined ? '' : userinfo.withDrawlAmount}}</text> <text>累计提现{{userinfo.withDrawlAmount == undefined ? '' : userinfo.withDrawlAmount}}</text>
@ -101,7 +101,8 @@
sjmeoey: '', sjmeoey: '',
txlist: '', txlist: '',
channelId: '', channelId: '',
listflag: true listflag: true,
waitBonusAmount:0
} }
}, },
onShow() { onShow() {
@ -229,7 +230,7 @@
title: '提现金额不能大于余额', title: '提现金额不能大于余额',
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); })
} else if (this.currentindex == -1) { } else if (this.currentindex == -1) {
uni.showToast({ uni.showToast({
title: '请选择提现方式', title: '请选择提现方式',
@ -293,6 +294,7 @@
this.$u.get("/app/user/userInfo").then((res) => { this.$u.get("/app/user/userInfo").then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.userinfo = res.data this.userinfo = res.data
this.waitBonusAmount = this.userinfo.waitBonusAmount
this.money = '' this.money = ''
} }
}) })
@ -497,3 +499,9 @@
} }
} }
</style> </style>

View File

@ -22,6 +22,37 @@
"navigationBarTextStyle": "#FFFFFF", "navigationBarTextStyle": "#FFFFFF",
"navigationStyle": "custom" "navigationStyle": "custom"
}
},
{
"path": "pages/daili/index",
"style": {
"navigationBarTitleText": "我的",
// "enablePullDownRefresh": true,
"navigationBarBackgroundColor": "#3996FD",
"navigationBarTextStyle": "#FFFFFF",
"navigationStyle": "custom"
}
},{
"path": "pages/daili/devicexq",
"style": {
"navigationBarTitleText": "我的",
// "enablePullDownRefresh": true,
"navigationBarBackgroundColor": "#3996FD",
"navigationBarTextStyle": "#FFFFFF",
"navigationStyle": "custom"
}
},{
"path": "pages/daili/dailibing",
"style": {
"navigationBarTitleText": "我的",
// "enablePullDownRefresh": true,
"navigationBarBackgroundColor": "#3996FD",
"navigationBarTextStyle": "#FFFFFF",
"navigationStyle": "custom"
} }
},{ },{
"path": "pages/tongji", "path": "pages/tongji",

815
pages/daili/dailibing.vue Normal file
View File

@ -0,0 +1,815 @@
<template>
<view class="page">
<u-navbar title="代理设置" :border-bottom="false" :background="bgc" back-icon-color="#fff" title-color='#fff' title-size='36'
height='50'></u-navbar>
<view class="card">
<view class="icon">
<view class="tit">
设备主图
</view>
<view class="imgbox" v-if="userImgs">
<view style="border: 0;outline: none;width: 143rpx;padding-left: 0rpx;height: 143rpx;border-radius: 16rpx;margin: auto;" @click="getImage">
<image style="border-radius: 10rpx;" :src="userImgs" mode="aspectFit"></image>
</view>
</view>
<view class="imgbox" v-else>
<view style="border: 0;outline: none;width: 143rpx;padding-left: 0rpx;height: 143rpx;border-radius: 16rpx;margin: auto;" @click="getImage">
<image src="https://api.ccttiot.com/smartmeter/img/static/uY8CPw9YE6JxPzcHUaqf" mode="aspectFit"></image>
</view>
</view>
<!-- 截图 -->
<ksp-cropper mode="free" :width="142" :height="142" :maxWidth="1024" :maxHeight="1024" :url="url"
@cancel="oncancel" @ok="onok"></ksp-cropper>
</view>
<view class="li" @click.stop="sremakemc()">
<view class="tit">
设备名称
</view>
<view class="info">
<view class="txt">
{{listobj.deviceName}}
</view>
<view class="iconfont icon-xiangyou1"></view>
</view>
</view>
<view class="li" @click.stop="sremake()">
<view class="tit">
备注代理
</view>
<view class="info">
<view class="txt">
{{remake == null ? '' : remake}}
</view>
<view class="iconfont icon-xiangyou1"></view>
</view>
</view>
<view class="li" @click.stop="sremakes()">
<view class="tit">
所属商户
</view>
<view class="info">
<view class="txt">
{{listobj.storeName == null ? '' : listobj.storeName}}
</view>
<!-- <view class="iconfont icon-xiangyou1"></view> -->
</view>
</view>
<view class="li">
<view class="tit">
S/N
</view>
<view class="info">
<view class="txt">
{{listobj.deviceNo == null ? '' : listobj.deviceNo}}
</view>
</view>
</view>
<view class="li">
<view class="tit">
类型
</view>
<view class="info">
<view class="txt">
{{listobj.model == null ? '' : listobj.model}}
</view>
</view>
</view>
<view class="li" v-if="modelId.some(tag => tag == 2)" style="border-bottom: 0;">
<view class="tit">
WiFi名称
</view>
<view class="info">
<view class="txt">
{{listobj.wifi == null || listobj.wifi == '创特物联TP' ? '--' : listobj.wifi}}
</view>
</view>
</view>
<view class="lis" @click="deldevice()">
解除绑定
</view>
</view>
<u-mask :show="showloading"></u-mask>
<u-mask :show="showfz"></u-mask>
<view class="fz" v-show="showfz">
<view class="fz_top">
<view class="iconfont icon-shanchu" @click="showfz=false">
</view>
<view class="tit">
设备分组
</view>
<view class="txt" @click="tosetpage()">
管理
</view>
</view>
<view class="card_cont">
<view class="cards" v-for="(item,index) in groupList" :key="index" @click="changeGp(item)">
<view class="txt">
{{item.groupName}}
</view>
<view class="num">
{{item.deviceCount}}
</view>
</view>
<view class="zhanwei" style="width: 100%;height: 100rpx;">
</view>
</view>
</view>
<view class="dd">
<u-select v-model="show" :list="list" title='欠费断电' @confirm="confirm"></u-select>
</view>
<u-popup v-model="showpopup" mode="center" border-radius='20'>
<view class="popcard" v-if="showremake">
<view class="tit">
修改备注
</view>
<view class="ipt">
<u-input v-model="remake" placeholder=" " border='surround' placeholder-style='font-size: 24rpx;' />
</view>
<view class="btnbox">
<view class="btn2" @click="close()">
取消
</view>
<view class="btn1" @click="sub(1)">
确定
</view>
</view>
</view>
<view class="popcard" v-if="showpeice">
<view class="tit">
修改备注
</view>
<view class="ipt">
<u-input v-model="price" placeholder=" " border='surround' placeholder-style='font-size: 24rpx;' />
</view>
<view class="btnbox">
<view class="btn2" @click="close()">
取消
</view>
<view class="btn1" @click="sub(2)">
确定
</view>
</view>
</view>
</u-popup>
<u-popup v-model="showmc" mode="center" border-radius='20'>
<view class="popcard" v-if="showmc">
<view class="tit">
修改名称
</view>
<view class="ipt">
<u-input v-model="xgname" placeholder=" " border='surround' placeholder-style='font-size: 24rpx;' />
</view>
<view class="btnbox">
<view class="btn2" @click="close()">
取消
</view>
<view class="btn1" @click="sub(3)">
确定
</view>
</view>
</view>
</u-popup>
<!-- 选择店铺 -->
<u-select v-model="showshop" :list="wateringList" @confirm="confirms"></u-select>
<view v-if="btnmsk" style="width: 100%;height: 100vh;position: fixed;top: 0;left: 0;background-color: #000;opacity: .1;z-index: 999;"></view>
</view>
</template>
<script>
export default {
data() {
return {
btnmsk:false,
bgc: {
backgroundColor: "#8883f0",
},
showloading: false,
showfz: false,
show: false,
showshop: false,
list: [{
value: '1',
label: '欠费立即断电'
},
{
value: '0',
label: '欠费不断电'
}
],
id: '',
xgname:'',
deviceInfo: {},
groupList: {},
showpopup: false,
remake: '',
price: '',
showpeice: false,
showremake: false,
listobj: {
deviceName:'',
storeName:'',
deviceNo:'',
model:'',
wifi:'',
},
showmc:false,
pagenum: 1,
wateringList: [],
pagesize: 10,
isLoading: false,
noMoreData: false,
total: 0,
userImgs:'',
url:'',
token:'',
modelId:''
}
},
onLoad(option) {
let id = option.id
this.id = id
this.getshua()
this.getQiniuToken()
this.getDevice(id)
this.getlistobj(id)
this.gettanc()
},
//
onShareAppMessage: function () {
return {
title: '创想物联',
path: '/pages/shouye/index'
}
},
//
onShareTimeline: function () {
return {
title: '创想物联',
query: '',
path: '/pages/shouye/index'
}
},
onShow() {
this.getgroup()
},
methods: {
getshua(){
this.$u.get(`/app/device/${this.id}/refreshIot`).then((res) => {})
},
getQiniuToken() {
this.$u.get("/common/qiniu/uploadInfo").then((res) => {
if (res.code == 200) {
this.token = res.token
}
})
},
getImage() {
uni.chooseImage({
count: 1,
success: (rst) => {
this.url = rst.tempFilePaths[0];
}
})
},
onok(ev) {
this.url = "";
this.path = ev.path;
let _this = this
let math = 'static/' + _this.$u.guid(20)
wx.uploadFile({
url: 'https://up-z2.qiniup.com',
name: 'file',
filePath: _this.path,
formData: {
token: _this.token, //token
key: 'smartmeter/img/' + math
},
success: function(res) {
let str = JSON.parse(res.data)
_this.userImgs = 'https://api.ccttiot.com/' + str.key
let data = {
deviceId:_this.id,
customPicture:_this.userImgs
}
_this.$u.put('/app/device', data).then((res) => {
if (res.code == 200) {
// this.getDevice()
uni.showToast({
title: '操作成功',
icon: 'success',
duration: 2000
})
}
})
}
})
},
oncancel() {
// url
this.url = ""
},
sremakes() {
this.showshop = true
},
confirms(e){
// console.log(e);
let data = {
deviceId: this.id,
storeId:e[0].value
}
this.putdevice(data)
setTimeout(()=>{
this.getlistobj(this.id)
},1000)
},
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, // storeIdvalue
label: row.name // namelabel
}));
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() {
let sum = this.total / this.pagesize
if (this.pagenum - 1 < sum) {
this.getlist() //
} else {
uni.showToast({
title: '没有更多订单记录了',
icon: 'none',
duration: 1000
});
}
},
changeGp(item) {
let data = {
deviceId: this.id,
groupId: item.groupId
}
this.putdevice(data)
this.showfz = false
setTimeout(() => {
this.getgroup()
}, 1000)
},
tosetpage() {
this.showfz = false
uni.navigateTo({
url: '/page_user/fenzu'
})
},
sub(num) {
if (num == 1) {
console.log(this.remake)
let data = {
deviceId: this.id,
remark: this.remake
}
this.showpopup = false
this.showremake = false
this.putdevice(data)
} else if (num == 2) {
let data = {
deviceId: this.id,
price: this.price,
}
this.showpopup = false
this.showpeice = false
this.showmc = false
this.putdevice(data)
}else if(num == 3){
// console.log(this.xgname);
let data = {
deviceId: this.id,
deviceName: this.xgname,
}
this.showpopup = false
this.showpeice = false
this.showmc = false
this.putdevice(data)
setTimeout(()=>{
this.getlistobj(this.id)
},1000)
}
},
deldevice() {
uni.showModal({
title: '确认解绑',
content: '您确定要解绑设备吗?',
success: (resModal) => {
if (resModal.confirm) {
this.btnmsk = true
this.$u.delete(`/app/device/mch/unbind/${this.id}`).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '解除成功',
icon: 'success',
duration: 2000
})
this.btnmsk = false
uni.navigateBack({
delta: 2 //
})
} else if(res.code == 500){
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
this.btnmsk = false
}
}).catch((error) => {
//
uni.showToast({
title: '请求失败',
icon: 'none',
duration: 2000
})
this.btnmsk = false
})
} else if (resModal.cancel) { //
uni.showToast({
title: '已取消',
icon: 'none',
duration: 1000
})
}
}
});
},
confirm(e) {
let data = {
deviceId: this.id,
outageWay: e[0].value
}
this.putdevice(data)
},
putdevice(data) {
this.$u.put('/app/device', data).then((res) => {
if (res.code == 200) {
this.getDevice()
uni.showToast({
title: '修改成功',
icon: 'success',
duration: 2000
})
}
})
},
sremakemc(){
// console.log(1);
this.showmc = true
this.xgname = this.listobj.deviceName
},
sremake() {
this.showpopup = true
this.showremake = true
},
sprice() {
this.showpopup = true
this.showpeice = true
},
close() {
this.showpeice = false
this.showremake = false
this.showpopup = false
this.showmc = false
},
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');
this.price = this.deviceInfo.price
this.remake = this.deviceInfo.remark
if(this.deviceInfo.customPicture == null){
this.userImgs = this.deviceInfo.picture
}else{
this.userImgs = this.deviceInfo.customPicture
}
// this.loadings=true
// this.initChart()
}
})
},
getgroup() {
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) {
this.$u.get("/app/device/" + id).then((res) => {
if (res.code == 200) {
this.listobj = res.data
this.modelId = res.data.modelTags
}
})
}
}
}
</script>
<style lang="scss">
/deep/ .u-flex{
padding-top: 20rpx !important;
box-sizing: border-box;
}
/deep/ .u-title{
padding-bottom: 22rpx;
}
/deep/ .u-icon__icon{
padding-bottom: 22rpx;
}
page {
background-color: #F7FAFE;
}
.lis{
position: fixed;
left: 50%;
transform: translateX(-50%);
bottom: 230rpx;
width: 632rpx;
height: 90rpx;
background-color: #8883f0;
text-align: center;
line-height: 90rpx;
font-size: 36rpx;
color: #fff;
border-radius: 50rpx;
}
.page {
width: 750rpx;
.popcard {
display: flex;
justify-content: center;
flex-wrap: wrap;
width: 550rpx;
height: 400rpx;
border-radius: 20rpx;
.tit {
display: flex;
justify-content: center;
width: 100%;
align-items: center;
font-size: 28rpx;
font-weight: 700;
}
.ipt {
margin-top: 60rpx;
width: 80%;
.u-input::placeholder {
font-size: 20px;
color: red;
}
}
.btnbox {
width: 100%;
display: flex;
flex-wrap: nowrap;
border-radius: 0 0 20rpx 20rpx;
.btn2 {
display: flex;
align-items: center;
justify-content: center;
width: 50%;
font-size: 32rpx;
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
font-weight: 400;
color: #000;
background-color: #fff;
}
.btn1 {
display: flex;
align-items: center;
justify-content: center;
width: 50%;
font-size: 32rpx;
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
font-weight: 400;
color: #fff;
background-color: #8883f0;
border: 1rpx solid #ccc;
}
}
}
.card {
padding: 16rpx 38rpx;
margin: 60rpx auto 0;
width: 654rpx;
background: #FFFFFF;
border-radius: 30rpx;
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1);
opacity: 1;
.li {
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
height: 94rpx;
border-bottom: #E5E5E5 solid 2rpx;
.tit {
font-size: 32rpx;
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
font-weight: 400;
color: #000000;
}
.info {
display: flex;
flex-wrap: nowrap;
align-items: center;
.txt {
font-size: 32rpx;
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
font-weight: 400;
color: #95989D;
}
.icon-xiangyou1 {
margin-left: 6rpx;
color: #95989D;
}
}
}
}
.btn {
display: flex;
align-items: center;
justify-content: center;
margin: 52rpx auto 0;
width: 654rpx;
height: 100rpx;
background: #FF4F4F;
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1);
opacity: 1;
border-radius: 30rpx;
font-size: 32rpx;
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
font-weight: 400;
color: #FFFFFF;
}
.fz {
position: fixed;
bottom: 0;
width: 750rpx;
height: 1152rpx;
background: #F7FAFE;
border-radius: 30rpx 30rpx 0 0;
z-index: 10071;
.fz_top {
margin: 18rpx 0 auto;
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
.icon-shanchu {
margin-left: 40rpx;
font-size: 50rpx;
}
.tit {
font-size: 36rpx;
font-family: Source Han Sans, Source Han Sans;
font-weight: 400;
color: #000000;
}
.txt {
margin-right: 40rpx;
font-size: 36rpx;
font-family: Source Han Sans, Source Han Sans;
font-weight: 400;
color: #2A82E4;
}
}
.card_cont {
width: 750rpx;
display: flex;
flex-wrap: wrap;
align-items: baseline;
justify-content: center;
height: 1030rpx;
overflow-y: auto;
overflow-x: hidden;
.cards {
margin-top: 32rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
padding: 0 40rpx;
width: 682rpx;
border-radius: 30rpx;
height: 114rpx;
background: #FFFFFF;
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1);
.txt {
font-size: 36rpx;
font-family: Source Han Sans, Source Han Sans;
font-weight: 400;
color: #000000;
}
.num {
font-size: 36rpx;
font-family: Source Han Sans, Source Han Sans;
font-weight: 400;
color: #000000;
}
}
}
}
}
.icon {
.tit{
padding-top: 50rpx;
box-sizing: border-box;
font-size: 32rpx;
}
margin-top: 40rpx;
margin-bottom: 30rpx;
display: flex;
justify-content: space-between;
.imgbox {
margin-left: 300rpx;
image {
width: 142rpx;
height: 142rpx;
}
}
}
/deep/ .panel{
position: fixed;
width: 100%;
height: 100%;
top: 0;
bottom: 0;
left: 0;
z-index: 99 !important;
overflow: hidden;
}
</style>

2132
pages/daili/devicexq.vue Normal file

File diff suppressed because it is too large Load Diff

2345
pages/daili/index.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@ -17,10 +17,14 @@
</view> </view>
<view class="" v-if="userinfo.deviceAdmin == true"> <view class="" v-if="userinfo.deviceAdmin == true">
<view class="botcard" @click="btnsblr"> <view class="botcard" @click="btnsblr">
<!-- <image src="https://api.ccttiot.com/smartmeter/img/static/uYWpW30vIQ6M4svb7Vnb"></image> -->
<view class="txt">设备录入</view> <view class="txt">设备录入</view>
</view> </view>
</view> </view>
<view class="" v-if="userinfo.type == 3">
<view class="botcard" @click="btndaili">
<view class="txt">代理入口</view>
</view>
</view>
</view> </view>
<!-- <view class="tit"> <!-- <view class="tit">
我的钱包 我的钱包
@ -306,6 +310,12 @@
uni.navigateTo({ uni.navigateTo({
url:'/page_fenbao/zhuce' url:'/page_fenbao/zhuce'
}) })
},
//
btndaili(){
uni.navigateTo({
url:'/pages/daili/index'
})
} }
} }
} }