Jelajahi Sumber

接口对接

xhj 3 tahun lalu
induk
melakukan
67cd08209c

+ 2 - 0
machineAndCell/BMS/BMS.css

@@ -95,4 +95,6 @@
 }
 .bms-row-data{
 	color: #A8A5A5;
+	flex: 1;
+	text-align: right;
 }

+ 114 - 73
machineAndCell/BMS/BMS.vue

@@ -18,8 +18,8 @@
 		<block v-if="queryType==1">
 			<view class="option-box">
 				<view class="option-time ddflex">
-					<view>更新时间: 2023-04-03 11:09:08</view>
-					<view class="refresh ddflex">
+					<view>更新时间: {{time}}</view>
+					<view class="refresh ddflex" @click="getData()">
 						<image src="../../static/pages/images/refresh.png"></image>
 						<text>刷新</text>
 					</view>
@@ -27,7 +27,7 @@
 				<view style="position: relative;">
 					<view style="height: 130rpx;"></view>
 					<view style="margin-top: 40rpx;justify-content: center;position: absolute;left: 50%;transform: translateX(-50%);top: -50%;" class="ddflex">
-						<cell :width="99" :height="197" :soc="6*10" :showsoc="true" :rotate="90"></cell>
+						<cell :width="99" :height="197" :soc="info.State.SOC" :showsoc="true" :rotate="90"></cell>
 					</view>
 				</view>
 			</view>
@@ -35,92 +35,92 @@
 			<view class="bms-info">
 				<view class="bms-row ddflex">
 					<view class="fflex ddflex">
-						<text>电池数量:</text>
-						<text class="bms-row-data">17 串</text>
+						<text>电池类型:</text>
+						<text class="bms-row-data">{{info.State.BetteryType==1?'铁锂':'三元'}} </text>
 					</view>
-					<view class="fflex ddflex bms-row-right">
-						<text>剩余容量:</text>
-						<text class="bms-row-data">31.6 AH</text>
+				</view>
+				<view class="bms-row ddflex">
+					<view class="fflex ddflex">
+						<text>工作状态:</text>
+						<text class="bms-row-data">{{info.State.WorkStatus==1?'充电中':info.State.WorkStatus==2?'闲置':'放电中'}} </text>
 					</view>
 				</view>
 				<view class="bms-row ddflex">
 					<view class="fflex ddflex">
 						<text>总电压:</text>
-						<text class="bms-row-data">66.99V</text>
-					</view>
-					<view class="fflex ddflex bms-row-right">
-						<text>电流数据:</text>
-						<text class="bms-row-data">0A</text>
+						<text class="bms-row-data">{{info.State.BetteryV_All}}V </text>
 					</view>
 				</view>
 				<view class="bms-row ddflex">
 					<view class="fflex ddflex">
-						<text>最低电压:</text>
-						<text class="bms-row-data">3.934 V</text>
-					</view>
-					<view class="fflex ddflex bms-row-right">
-						<text>最高电压:</text>
-						<text class="bms-row-data">3.946V</text>
+						<text>标称容量:</text>
+						<text class="bms-row-data">{{info.State.FCC}} </text>
 					</view>
 				</view>
 				<view class="bms-row ddflex">
 					<view class="fflex ddflex">
-						<text>相差电压:</text>
-						<text class="bms-row-data">0.012V</text>
-					</view>
-					<view class="fflex ddflex bms-row-right">
-						<text>平均电压:</text>
-						<text class="bms-row-data">3.94V</text>
+						<text>剩余容量:</text>
+						<text class="bms-row-data">{{info.State.SYLA}} </text>
 					</view>
 				</view>
 				<view class="bms-row ddflex">
 					<view class="fflex ddflex">
-						<text>温度数量:</text>
-						<text class="bms-row-data">2个</text>
+						<text>充电电流:</text>
+						<text class="bms-row-data">{{info.State.CPowerA}}A </text>
 					</view>
-					<view class="fflex ddflex bms-row-right">
-						<text>校准容量:</text>
-						<text class="bms-row-data">36.1AH</text>
+				</view>
+				<view class="bms-row ddflex">
+					<view class="fflex ddflex">
+						<text>剩余容量百分比:</text>
+						<text class="bms-row-data">{{info.State.SOC}}% </text>
 					</view>
 				</view>
 				<view class="bms-row ddflex">
 					<view class="fflex ddflex">
-						<text>温度:</text>
-						<text class="bms-row-data"> [20°C][20°C]</text>
+						<text>充电保护状态:</text>
+						<text class="bms-row-data">{{info.State.CPStatus==1?'硬控保护':info.State.CPStatus==2?'软控保护':'正常'}} </text>
 					</view>
-					<view class="fflex ddflex bms-row-right">
-						<text>功率:</text>
-						<text class="bms-row-data">0KW</text>
+				</view>
+				<view class="bms-row ddflex">
+					<view class="fflex ddflex">
+						<text>放电保护状态:</text>
+						<text class="bms-row-data">{{info.State.DPStatus==1?'硬控保护':info.State.DPStatus==2?'软控保护':'正常'}} </text>
 					</view>
 				</view>
 				<view class="bms-row ddflex">
 					<view class="fflex ddflex">
-						<text>充电状态:</text>
-						<text class="bms-row-data">静止</text>
+						<text>短路保护:</text>
+						<text class="bms-row-data">{{info.State.SCProtect==1?'保护':'正常'}} </text>
 					</view>
-					<view class="fflex ddflex bms-row-right">
-						<text>均衡开闭:</text>
-						<text class="bms-row-data">关闭</text>
+				</view>
+				<view class="bms-row ddflex">
+					<view class="fflex ddflex">
+						<text>均衡类型:</text>
+						<text class="bms-row-data">{{info.State.BetteryType==1?'被动':info.State.BetteryType==2?'主动':'无'}} </text>
 					</view>
 				</view>
 				<view class="bms-row ddflex">
 					<view class="fflex ddflex">
-						<text>循环摞碍次数:</text>
-						<text class="bms-row-data">216次</text>
+						<text>均衡开关:</text>
+						<text class="bms-row-data">{{(info.State.EM==1||info.State.EM=='Open')?'打开':'关闭'}} </text>
 					</view>
-					<view class="fflex ddflex bms-row-right">
-						<text>固件版本:</text>
-						<text class="bms-row-data">0KW</text>
+				</view>
+				<view class="bms-row ddflex">
+					<view class="fflex ddflex">
+						<text>保护板温度:</text>
+						<text class="bms-row-data">{{info.State.TC_T}}°C </text>
 					</view>
 				</view>
 				<view class="bms-row ddflex">
 					<view class="fflex ddflex">
-						<text>连接状态:</text>
-						<text class="bms-row-data">已连接</text>
+						<text>出厂日期:</text>
+						<text class="bms-row-data">{{info.State.CCXX}} </text>
 					</view>
-					<view class="fflex ddflex bms-row-right">
-						<text>设备编码:</text>
-						<text class="bms-row-data">613880983244</text>
+				</view>
+				<view class="bms-row ddflex">
+					<view class="fflex ddflex">
+						<text>厂商编码:</text>
+						<text class="bms-row-data">{{info.State.BMSCode}} </text>
 					</view>
 				</view>
 			</view>
@@ -129,25 +129,25 @@
 		<block v-if="queryType==2">
 			<view class="option-box">
 				<view class="option-time ddflex">
-					<view>更新时间: 2023-04-03 11:09:08</view>
-					<view class="refresh ddflex">
+					<view>更新时间: {{time}}</view>
+					<view class="refresh ddflex" @click="getData()">
 						<image src="../../static/pages/images/refresh.png"></image>
 						<text>刷新</text>
 					</view>
 				</view>
-				<view class="ddflex state">
+				<!-- <view class="ddflex state">
 					<view class="ddflex">
 						<view>充电开关:</view>
-						<view style="color: #A8A5A5;">开启</view>
+						<view style="color: #A8A5A5;">{{info.Seting.CHON==1?'开启':'关闭'}}</view>
 					</view>
-					<switch style="transform: scale(0.6);" color="#FF753A"></switch>
-				</view>
+					<switch style="transform: scale(0.6);" :checked="info.Seting.CHON" color="#FF753A"></switch>
+				</view> -->
 				<view class="ddflex state">
 					<view class="ddflex">
 						<view>放电开关:</view>
-						<view style="color: #A8A5A5;">关闭</view>
+						<view style="color: #A8A5A5;">{{info.Seting.DHON==1?'开启':'关闭'}}</view>
 					</view>
-					<switch style="transform: scale(0.6);" color="#FF753A"></switch>
+					<switch style="transform: scale(0.6);" :checked="info.Seting.DHON==1?true:false" color="#FF753A" @change="switchChange"></switch>
 				</view>
 			</view>
 		</block>
@@ -159,6 +159,7 @@
 	const app = getApp();
 	const req = require("../../utils/request.js");
 	import cell from "../../components/cell/index";
+	const utils = require("../../utils/util");
 
 	export default {
 		components: {
@@ -171,10 +172,15 @@
 				isTop:0,
 				
 				queryType: 1,
+				
+				id:null,
+				info:{},
+				time:''
 			}
 		},
 		onLoad(options) {
-
+			this.id = options.id
+			this.getData()
 		},
 		onShow() {
 			
@@ -191,24 +197,59 @@
 				if (this.queryType == val) return false
 				this.queryType = val
 			},
+			getData(){
+				uni.showLoading({
+					title:'加载中'
+				})
+				req.getRequest('/admin/v2/battery/bmsData',{batteryId:this.id},res=>{
+					this.info = res[0]
+					this.info.Seting = JSON.parse(this.info.Seting)
+					this.info.State = JSON.parse(this.info.State)
+					this.time = utils.formatTime(new Date()).t1
+					uni.hideLoading()
+				})
+			},
+			switchChange(event){
+				event.detail.value = event.detail.value?1:0
+				this.info.Seting.DHON = event.detail.value
+				let that = this
+				uni.showModal({
+					title:'提示',
+					content:event.detail.value?'确定开启放电开关?':'确定关闭放电开关?',
+					success: (r) => {
+						if(r.confirm){
+							uni.showLoading({
+								title:event.detail.value?'开启中':'关闭中',
+							})
+							req.postRequest('/admin/v2/battery/bmsSend',{batteryId:this.id,type:event.detail.value},res=>{
+								uni.hideLoading()
+								if(res){
+									// req.msg(event.detail.value?'开启成功':'关闭成功')
+									uni.showModal({
+										title:'提示',
+										content:'操作成功,该操作会有延迟,请稍候查看最新状态',
+										showCancel:false,
+										success() {
+											that.getData()
+										}
+									})
+								}else {
+									req.msg(event.detail.value?'开启失败':'关闭失败')
+									this.info.Seting.DHON = this.info.Seting.DHON==1?0:1
+								}
+							})
+						}else{
+							this.info.Seting.DHON = this.info.Seting.DHON==1?0:1
+							// this.getData()
+						}
+						
+					}
+				})
+			},
 		},
 		mounted() {
-			const systemInfo = uni.getSystemInfoSync();
-			// px转换到rpx的比例
-			let pxToRpxScale = 750 / systemInfo.windowWidth;
-			let systems = {
-				ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
-				navigationHeight: 44 * pxToRpxScale // 导航栏的高度
-			};
-			systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
-			this.systems = systems;
 		},
 		onPageScroll: function(e) {
-			if (e.scrollTop > this.systems.barHeight) {
-				this.isTop = 1;
-			} else {
-				this.isTop = 0;
-			}
 		}
 	}
 </script>

+ 81 - 41
machineAndCell/cellDetail/cellDetail.vue

@@ -4,88 +4,95 @@
 			<view class="item ddflex">
 				<view class="label">所属门店</view>
 				<view class="item-input fflex ddflex">
-					<view>白云科技门店</view>
+					<view>{{info.storeName}}</view>
 					<!-- <view class="state">在线</view> -->
 				</view>
 			</view>
 			<view class="item ddflex">
-				<view class="label">机柜名称</view>
+				<!-- <view class="label">机柜名称</view> -->
+				<view class="label">设备名称</view>
 				<view class="item-input fflex">
-					CHZD04TTCC200329109
+					{{info.name}}
 				</view>
 			</view>
 			<view class="item ddflex">
-				<view class="label">电池ID</view>
+				<view class="label">电池编号</view>
 				<view class="item-input fflex">
-					613880983244
+					{{info.batteryId}}
 				</view>
 			</view>
-			<view class="item ddflex">
+			<!-- <view class="item ddflex">
 				<view class="label">租赁用户</view>
 				<view class="item-input fflex">
 					王鸿  15700317367
 				</view>
-			</view>
-			<view class="item ddflex">
+			</view> -->
+			<!-- <view class="item ddflex">
 				<view class="label">品牌</view>
 				<view class="item-input fflex">
 					乐享换电
 				</view>
-			</view>
+			</view> -->
 			<view class="item ddflex">
 				<view class="label">型号</view>
 				<view class="item-input fflex">
-					60V  40AH
+					{{info.model}}
 				</view>
 			</view>
 			<view class="item ddflex">
 				<view class="label">设备类型</view>
 				<view class="item-input fflex">
-					BWHY
+					{{info.macName}}
 				</view>
 			</view>
 			<view class="item ddflex">
 				<view class="label">电芯</view>
 				<view class="item-input fflex">
-					三元理
+					{{info.type}}
 				</view>
 			</view>
-			<view class="item ddflex">
+			<!-- <view class="item ddflex">
 				<view class="label">BMS保护板</view>
 				<view class="item-input fflex">
 					V1.2
 				</view>
-			</view>
-			<view class="item ddflex">
+			</view> -->
+			<!-- <view class="item ddflex">
 				<view class="label">软件版本</view>
 				<view class="item-input fflex">
 					百维
 				</view>
-			</view>
+			</view> -->
 			<view class="item ddflex">
 				<view class="label">押金</view>
 				<view class="item-input fflex">
-					349元/月
+					{{info.deposit}}
 				</view>
 			</view>
 			<view class="item ddflex">
+				<view class="label">单价</view>
+				<view class="item-input fflex">
+					{{info.price}}
+				</view>
+			</view>
+			<!-- <view class="item ddflex">
 				<view class="label">起租时间</view>
 				<view class="item-input fflex">
 					2022-07-0314:07:15
 				</view>
-			</view>
+			</view> -->
 			<view class="item ddflex">
 				<view class="label">到期时间</view>
 				<view class="item-input fflex">
-					2023-05-0300:00:00
+					{{info.blockDate}}
 				</view>
 			</view>
-			<view class="item ddflex">
+			<!-- <view class="item ddflex">
 				<view class="label">备注</view>
 				<view class="item-input fflex">
 					2.18更换新品头
 				</view>
-			</view>
+			</view> -->
 			
 		</view>
 		
@@ -93,10 +100,10 @@
 		<view style="height: 165rpx;" class="savepadding"></view>
 		<view class="bottom-btns savepadding">
 			<view class="ddflex" style="margin: 30rpx;justify-content: space-between;">
-				<view class="btn1" @click="jumpUrl('/warning/machineAlarm/machineAlarm')">断电</view>
-				<view class="btn1" @click="jumpUrl('/machineAndCell/machineDetail/machineDetail')">通电</view>
+				<view class="btn1 fflex" @click="switchChange(!DHON)">{{DHON?'断电':'通电'}}</view>
+				<!-- <view class="btn1" @click="jumpUrl('/machineAndCell/machineDetail/machineDetail')">通电</view>
 				<view class="btn2">解绑</view>
-				<view class="btn3">保存</view>
+				<view class="btn3">保存</view> -->
 			</view>
 		</view>
 		
@@ -112,12 +119,14 @@
 		props: {},
 		data() {
 			return {
-				systems: {},
-				isTop:0,
+				id:null,
+				info:{},
+				DHON:false
 			}
 		},
 		onLoad(options) {
-			
+			this.id = options.id
+			this.getData()
 		},
 		onShow() {
 			
@@ -130,24 +139,55 @@
 					})
 				}
 			},
+			getData(){
+				uni.showLoading({
+					title:'加载中'
+				})
+				req.getRequest('/admin/v2/battery/'+this.id,{},res=>{
+					this.info = res
+					uni.hideLoading()
+				})
+				req.getRequest('/admin/v2/battery/bmsData',{batteryId:this.id},res=>{
+					this.DHON = JSON.parse(res[0].State).DHON==1?true:false
+				})
+			},
+			switchChange(value){
+				uni.showModal({
+					title:'提示',
+					content:value?'确定开启放电开关?':'确定关闭放电开关?',
+					success: (r) => {
+						if(r.confirm){
+							uni.showLoading({
+								title:value?'开启中':'关闭中',
+							})
+							req.postRequest('/admin/v2/battery/bmsSend',{batteryId:this.id,type:value},res=>{
+								uni.hideLoading()
+								if(res){
+									// req.msg(event.detail.value?'开启成功':'关闭成功')
+									uni.showModal({
+										title:'提示',
+										content:'操作成功,该操作会有延迟,请稍候查看最新状态',
+										showCancel:false,
+										success:() =>{
+											this.DHON = value
+											this.getData()
+										}
+									})
+								}else {
+									req.msg(value?'开启失败':'关闭失败')
+								}
+							})
+						}else{
+						}
+						
+					}
+				})
+			},
 		},
 		mounted() {
-			const systemInfo = uni.getSystemInfoSync();
-			// px转换到rpx的比例
-			let pxToRpxScale = 750 / systemInfo.windowWidth;
-			let systems = {
-				ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
-				navigationHeight: 44 * pxToRpxScale // 导航栏的高度
-			};
-			systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
-			this.systems = systems;
 		},
 		onPageScroll: function(e) {
-			if (e.scrollTop > this.systems.barHeight) {
-				this.isTop = 1;
-			} else {
-				this.isTop = 0;
-			}
+			
 		}
 	}
 </script>

+ 109 - 27
machineAndCell/cellSearch/cellSearch.vue

@@ -1,60 +1,55 @@
 <template>
-	<view style="padding-bottom: 30rpx;">
+	<view style="overflow: hidden;">
 		<view class="top-box">
 			<view class="search-box ddflex">
-				<image class="search-saoma" src="../../static/pages/images/saoma.png"></image>
+				<image class="search-saoma" src="../../static/pages/images/saoma.png" @click="saomaFn()"></image>
 				<view class="search-input ddflex fflex">
 					<image class="search-input-icon" src="../../static/pages/images/search.png"></image>
-					<input class="fflex"  placeholder="请输入编号查询"/>
-					<view class="search-btn">搜索</view>
+					<input class="fflex" v-model="searchValue" confirm-type="search" @confirm="searchFn" placeholder="请输入编号查询"/>
+					<view class="search-btn" @click="searchFn">搜索</view>
 				</view>
 			</view>
 		</view>
 		
 		<view :style="'height: '+ (134) + 'rpx;'"></view>
 		
-		
 		<!-- 电池 -->
 		<view>
-			<view class="cell-box" v-for="item,index in 10">
+			<view class="cell-box" v-for="item,index in groupList">
 				<view class="ddflex">
 					<view style="margin-right: 35rpx;">
 						<cell :width="99" :height="197" :soc="index*10" :showsoc="true"></cell>
 					</view>
 					<view class="cell-info fflex">
 						<view class="ddflex">
-							<view class="cell-title">60V40AH</view>
-							<view class="cell-state">已租</view>
+							<view class="cell-title">{{item.model}}</view>
+							<view class="cell-state" :style="item.leaseStatus==1?'':'background-color: #0FCB27;'">{{item.leaseStatus==1?'已租':'空闲'}}</view>
 						</view>
-						<view class="cell-info ddflex">
-							<view>机柜名称:</view>
-							<view>CHZD04TTCC200329109</view>
+						<view class="cell-info  ddflex">
+							<view>电池Id:</view>
+							<view>{{item.batteryId}}</view>
 						</view>
 						<view class="cell-info  ddflex">
-							<view>电池ID:</view>
-							<view>613880983244</view>
+							<view>设备编号:</view>
+							<view>{{item.number}}</view>
 						</view>
 						<view class="cell-info ddflex">
 							<view>门店:</view>
-							<view>白云科技门店</view>
+							<view>{{item.storeName}}</view>
 						</view>
 						<view class="cell-info ddflex">
-							<view>剩余30天</view>
-						</view>
-						<view class="cell-info ddflex">
-							<view>2023-04-03  11:07:46</view>
+							<view>到期时间:</view>
+							<view>{{item.blockDate}}</view>
 						</view>
 					</view>
 				</view>
 				<view class="cell-option ddflex">
-					<view class="fflex" @click="jumpUrl('/machineAndCell/map/map')">定位</view>
-					<view class="fflex" @click="jumpUrl('/machineAndCell/BMS/BMS')">BMS</view>
-					<view class="fflex" @click="jumpUrl('/machineAndCell/cellDetail/cellDetail')">详情</view>
+					<view class="fflex" @click="jumpUrl('/machineAndCell/map/map?id='+item.batteryId)">定位</view>
+					<view class="fflex" @click="jumpUrl('/machineAndCell/BMS/BMS?id='+item.batteryId)">BMS</view>
+					<view class="fflex" @click="jumpUrl('/machineAndCell/cellDetail/cellDetail?id='+item.batteryId)">详情</view>
 				</view>
 			</view>
 		</view>
-		
-		<view class="data-end">没有更多信息了</view>
 
 	</view>
 </template>
@@ -66,7 +61,7 @@
 
 	export default {
 		components: {
-			cell
+			cell,
 		},
 		props: {},
 		data() {
@@ -74,14 +69,44 @@
 				systems: {},
 				isTop:0,
 				
-				queryType:1
+				userInfo:{},
+				
+				showPop: false,
+				tempData: null,
+				
+				groupList: [],
+				page: 1,
+				limit: 10,
+				searchValue:'',
+				isQuerying:false,//正在查询数据
+				
+				queryType:'',
+				
+				merchantList: [],
+				merchantPage: 1,
+				merchantLimit: 10,
+				
+				actMerchant:null,//当前门店
+				
+				count:{},
+				
+				storeId:null
 			}
 		},
 		onLoad(options) {
-
+			this.storeId = options.storeId
+			if(options.searchValue){
+				this.searchValue = options.searchValue
+			}
+			if(options.type){
+				this.queryType = options.type
+			}
+			this.getMachineList()
 		},
 		onShow() {
-			
+		},
+		onReachBottom() {
+			this.getMachineList(true)
 		},
 		methods: {
 			jumpUrl(url){
@@ -94,7 +119,64 @@
 			queryTypeChange(val) {
 				if (this.queryType == val) return false
 				this.queryType = val
+				this.queryType = val==-1?'':val
+				this.getMachineList()
+			},
+			// 获取电池列表
+			getMachineList(isPage){
+				if(this.isQuerying) return
+				else this.isQuerying = true
+				if (!isPage) {
+					this.page = 1
+				}
+				let queryParams = {
+					page: this.page,
+					limit: this.limit,
+				}
+				if(this.searchValue){
+					queryParams.number=this.searchValue
+				}
+				if(this.queryType){
+					queryParams.type = this.queryType
+				}
+				queryParams.storeId = this.storeId
+				req.getRequest(
+					'/admin/v2/battery/page',
+					queryParams,
+					data => {
+						if (data != null && data.list.length > 0) {
+							if (!isPage) {
+								this.groupList = data.list
+							} else {
+								this.groupList = this.groupList.concat(data.list)
+							}
+							this.page++
+						} else {
+							if (!isPage)
+								this.groupList = data.list
+							else {}
+						}
+						uni.hideLoading()
+						this.isQuerying = false
+					}
+				)
+			},
+			searchFn(){
+				this.getMachineList()
 			},
+			saomaFn(){
+				// 只允许通过相机扫码
+				uni.scanCode({
+					onlyFromCamera: false,
+					success: (res) =>{
+						console.log('条码类型:' + res.scanType);
+						console.log('条码内容:' + res.result);
+						// did设备id
+						this.searchValue = res.result
+						this.searchFn()
+					}
+				});
+			}
 		},
 		mounted() {
 			const systemInfo = uni.getSystemInfoSync();

+ 1 - 1
machineAndCell/machineInfo/machineInfo.vue

@@ -53,7 +53,7 @@
 		<view style="height: 165rpx;" class="savepadding"></view>
 		<view class="bottom-btns savepadding">
 			<view class="ddflex" style="margin: 30rpx;justify-content: space-between;">
-				<view class="btn1" @click="jumpUrl('/warning/machineAlarm/machineAlarm')">故障告警</view>
+				<view class="btn1" @click="jumpUrl('/warning/machineAlarm/machineAlarm?id='+id)">故障告警</view>
 				<view class="btn1" @click="jumpUrl('/machineAndCell/machineDetail/machineDetail?id='+id)">柜体信息</view>
 				<view class="btn2" @click="getDataList()">刷新</view>
 			</view>

+ 98 - 164
machineAndCell/map/map.vue

@@ -4,11 +4,11 @@
 			:longitude="longitude" :markers="marker" :scale="scale" @markertap="markertap"
 			@callouttap='callouttap'></map>
 		<view class="cover-box ddflex">
-			<view style="justify-content: center;" class="ddflex fflex">
+			<!-- <view style="justify-content: center;" class="ddflex fflex">
 				<image class="cover-icon" src="../static/images/baojing.png"></image>
 				<view>报警</view>
-			</view>
-			<view style="justify-content: center;" class="ddflex fflex">
+			</view> -->
+			<view style="justify-content: center;" class="ddflex fflex" @click="daohang">
 				<image class="cover-icon" src="../static/images/daohang.png"></image>
 				<view>导航</view>
 			</view>
@@ -22,46 +22,25 @@
 			</view>
 			<view class="ddflex info-card-item">
 				<view class="fflex">
-					名称: ZX03D209685
-				</view>
-				<view class="fflex info-card-item-right">
-					状态:静止(30秒)
-				</view>
-			</view>
-			<view class="ddflex info-card-item">
-				<view class="fflex">
-					编号: 016881209685
+					设备名称: {{info.user_name}}
 				</view>
 				<view class="fflex info-card-item-right">
-					设防状态:撤防
+					设备类型:{{info.product_type}}
 				</view>
 			</view>
 			<view class="ddflex info-card-item">
 				<view class="fflex">
-					控制: 已通电
-				</view>
-				<view class="fflex info-card-item-right">
-					定位类型:LBS
+					设备编号: {{info.sim_id}}
 				</view>
 			</view>
 			<view class="ddflex info-card-item">
 				<view class="fflex">
-					电压: 66.99V(主电接通)
+					设备定位时间: {{getTime(info.datetime)}}
 				</view>
 			</view>
 			<view class="ddflex info-card-item">
 				<view class="fflex">
-					通信: 2023-04-0311:08:16
-				</view>
-			</view>
-			<view class="ddflex info-card-item">
-				<view class="fflex">
-					定位: 2023-04-03 11:07:46
-				</view>
-			</view>
-			<view class="ddflex info-card-item">
-				<view class="fflex">
-					地址:广东省东莞市兴育路东一街2号
+					地址:{{info.address}}
 				</view>
 			</view>
 		</view>
@@ -69,155 +48,80 @@
 </template>
 
 <script>
+	import util from "../../utils/util.js";
 	const app = getApp();
 	const req = require("../../utils/request.js");
+	// 引入SDK核心类
+	var QQMapWX = require("../../utils/qqmap.js");
 
 	export default {
 		components: {},
 		props: {},
 		data() {
 			return {
-				map:null,
+				id: null,
+				map: null,
+				info: {},
 				latitude: 23.106574, //纬度
 				longitude: 113.324587, //经度
 				scale: 13, //缩放级别
-				marker: [{
-						id: 0,
-						latitude: 23.13065, //纬度
-						longitude: 113.3274, //经度
-						iconPath: '', //显示的图标        
-						rotate: 0, // 旋转度数
-						width: 20, //宽
-						height: 30, //高
-						//   title:'我在这里',//标注点名
-						alpha: 0.5, //透明度
-						callout: { //自定义标记点上方的气泡窗口 点击有效  
-							content: '天宝大厦', //文本
-							color: '#ffffff', //文字颜色
-							fontSize: 14, //文本大小
-							borderRadius: 15, //边框圆角
-							borderWidth: '10',
-							bgColor: '#e51860', //背景颜色
-							display: 'ALWAYS', //常显
-						},
-					},
-					{
-						id: 1234597,
-						latitude: 23.106574, //纬度
-						longitude: 113.324587, //经度
-						iconPath: '', //显示的图标        
-						rotate: 0, // 旋转度数
-						width: 20, //宽
-						height: 30, //高
-						//  title:'我在这里',//标注点名
-						alpha: 0.5, //透明度
-						//      label:{//为标记点旁边增加标签   //因背景颜色H5不支持
-						//   color:'red',//文本颜色
-						//      },
-						callout: { //自定义标记点上方的气泡窗口 点击有效  
-							content: '广州塔', //文本
-							color: '#ffffff', //文字颜色
-							fontSize: 14, //文本大小
-							borderRadius: 15, //边框圆角
-							borderWidth: '10',
-							bgColor: '#e51860', //背景颜色
-							display: 'ALWAYS', //常显
-						},
-					},
-					{
-						id: 2,
-						latitude: 23.1338, //纬度
-						longitude: 113.33052, //经度
-						iconPath: '', //显示的图标        
-						rotate: 0, // 旋转度数
-						width: 20, //宽
-						height: 30, //高
-						alpha: 0.5, //透明度
-						callout: { //自定义标记点上方的气泡窗口 点击有效  
-							content: '德隆大厦', //文本
-							color: '#ffffff', //文字颜色
-							fontSize: 14, //文本大小
-							borderRadius: 15, //边框圆角
-							borderWidth: '10',
-							bgColor: '#e51860', //背景颜色
-							display: 'ALWAYS', //常显
-						},
-					},
-					{
-						id: 3,
-						latitude: 23.136455, //纬度
-						longitude: 113.329002, //经度
-						iconPath: '', //显示的图标        
-						rotate: 0, // 旋转度数
-						width: 20, //宽
-						height: 30, //高
-						alpha: 0.5, //透明度
-						callout: { //自定义标记点上方的气泡窗口 点击有效  
-							content: '羊城国际商贸中心', //文本
-							color: '#ffffff', //文字颜色
-							fontSize: 14, //文本大小
-							borderRadius: 15, //边框圆角
-							borderWidth: '10',
-							bgColor: '#e51860', //背景颜色
-							display: 'ALWAYS', //常显
-						},
-					},
-					{
-						id: 4,
-						latitude: 23.224781, //纬度
-						longitude: 113.293911, //经度
-						iconPath: '', //显示的图标        
-						rotate: 0, // 旋转度数
-						width: 20, //宽
-						height: 30, //高
-						alpha: 0.5, //透明度
-						callout: { //自定义标记点上方的气泡窗口 点击有效  
-							content: '天瑞广场A座', //文本
-							color: '#ffffff', //文字颜色
-							fontSize: 16, //文本大小
-							borderRadius: 15, //边框圆角
-							borderWidth: '12',
-							bgColor: '#e51860', //背景颜色
-							display: 'ALWAYS', //常显
-						},
-					},
-					{
-						id: 5,
-						latitude: 23.072726, //纬度
-						longitude: 113.277921, //经度
-						iconPath: '', //显示的图标        
-						rotate: 0, // 旋转度数
-						width: 20, //宽
-						height: 30, //高
-						alpha: 0.5, //透明度
-						callout: { //自定义标记点上方的气泡窗口 点击有效  
-							content: '大米和小米儿童康复(广州盈丰)中心', //文本
-							color: '#ffffff', //文字颜色
-							fontSize: 14, //文本大小
-							borderRadius: 15, //边框圆角
-							borderWidth: '8',
-							bgColor: '#e51860', //背景颜色
-							display: 'ALWAYS', //常显
-						},
-					},
-				],
+				marker: [],
 
 
 			}
 		},
-		onLoad(options) {
+		async onLoad(options) {
+			this.id = options.id
+			await this.getMap()
 			this.toLocation()
 		},
 		onShow() {
 
 		},
 		onReady() {
-			
-		},
-		mounted(){
+
 		},
+		mounted() {},
 		computed: {},
 		methods: {
+			getMap() {
+				return new Promise((r, j) => {
+					req.getRequest('/admin/v2/battery/bmsLocation', {
+						batteryId: this.id
+					}, res => {
+						// this.info = res
+						for (let key in res.key) {
+							let index = res.key[key]
+							this.info[key] = res.records[0][index]
+						}
+						this.marker = [{
+							id: 0,
+							latitude: this.info.weidu, //纬度
+							longitude: this.info.jingdu, //经度
+							iconPath: '', //显示的图标        
+							rotate: 0, // 旋转度数
+							width: 20, //宽
+							height: 30, //高
+							//   title:'我在这里',//标注点名
+							alpha: 0.5, //透明度
+							callout: { //自定义标记点上方的气泡窗口 点击有效  
+								content: this.info.user_name, //文本
+								color: '#ffffff', //文字颜色
+								fontSize: 14, //文本大小
+								borderRadius: 15, //边框圆角
+								borderWidth: '10',
+								bgColor: '#e51860', //背景颜色
+								display: 'ALWAYS', //常显
+							}
+						}]
+						this.getAddress()
+						uni.setNavigationBarTitle({
+							title:this.info.user_name
+						})
+						r()
+					})
+				})
+			},
 			//地图点击事件
 			markertap(e) {
 				console.log("===你点击了标记点===", e)
@@ -228,16 +132,46 @@
 			},
 			toLocation() {
 				console.log('地图控件回到原位');
-				req.getLocation((res) =>{
-						console.log('当前位置:' ,res);
-						console.log('当前位置的经度:' + res.longitude);
-						console.log('当前位置的纬度:' + res.latitude);
-						this.longitude = res.longitude;
-						this.latitude = res.latitude;
-						this.map = uni.createMapContext("map", this);
-						this.map.moveToLocation()
-					})
-			}
+				req.getLocation((res) => {
+					console.log('当前位置:', res);
+					console.log('当前位置的经度:' + res.longitude);
+					console.log('当前位置的纬度:' + res.latitude);
+					this.longitude = res.longitude;
+					this.latitude = res.latitude;
+					this.map = uni.createMapContext("map", this);
+					this.map.moveToLocation()
+				})
+			},
+			getAddress() {
+				QQMapWX.initMap();
+				this.location = {
+					longitude: this.info.jingdu,
+					latitude: this.info.weidu
+				}
+				QQMapWX.reverseGeocoder(location, data => {
+					this.info.address = data.address
+					console.log('解析后的地址地址数据:', data);
+				});
+			},
+			getTime(time) {
+				if (!time) return ''
+				return util.formatTime(new Date(parseInt(time))).t1
+			},
+			daohang() {
+				let plugin = requirePlugin('routePlan');
+				let key = req.public.mapLBSKEY; //使用在腾讯位置服务申请的key
+				let referer = '皮小店商家端'; //调用插件的app的名称
+				// console.log("名称====" + referer);
+				let endPoint = JSON.stringify({
+					//终点
+					'name': this.info.user_name,
+					'latitude': this.info.weidu,
+					'longitude':this.info.jingdu,
+				});
+				uni.navigateTo({
+					url: 'plugin://routePlan/index?key=' + key + '&referer=' + referer + '&endPoint=' + endPoint
+				});
+			},
 		},
 		mounted() {
 

+ 5 - 0
pages.json

@@ -362,6 +362,11 @@
 					"style": {
 						"navigationBarTitleText": ""
 					}
+				},{
+					"path": "cellSearch/cellSearch",
+					"style": {
+						"navigationBarTitleText": "搜索"
+					}
 				}
 			]
 		}

+ 77 - 28
pages/cell/cell.vue

@@ -9,7 +9,7 @@
 			</view>
 			<view class="tab-box ddflex">
 				<view class="fflex ddflex">
-					<view :class="'tab-item fflex '+(queryType==1?'tab-item-active':'')" @click="queryTypeChange(1)">
+					<view :class="'tab-item fflex '+(queryType==''?'tab-item-active':'')" @click="queryTypeChange(-1)">
 						<view>全部</view>
 						<image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
 					</view>
@@ -17,14 +17,14 @@
 						<view>未租</view>
 						<image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
 					</view>
-					<view :class="'tab-item fflex '+(queryType==3?'tab-item-active':'')" @click="queryTypeChange(3)">
+					<view :class="'tab-item fflex '+(queryType==1?'tab-item-active':'')" @click="queryTypeChange(1)">
 						<view>已租</view>
 						<image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
 					</view>
 				</view>
 				<view class="ddflex">
-					<image class="saoma" src="../../static/pages/images/saoma.png"></image>
-					<image class="sousuo" src="../../static/pages/images/search.png" @click="jumpUrl('/machineAndCell/cellSearch/cellSearch')"></image>
+					<image class="saoma" src="../../static/pages/images/saoma.png" @click="saomaFn()"></image>
+					<image class="sousuo" src="../../static/pages/images/search.png" @click="jumpUrl('/machineAndCell/cellSearch/cellSearch?storeId='+actMerchant.id+'&type='+queryType)"></image>
 				</view>
 			</view>
 		</view>
@@ -38,8 +38,8 @@
 					<view class="state-label">租赁中</view>
 				</view>
 				<view class="ddflex state-data">
-					<view>6</view>
-					<view>16.66%</view>
+					<view>{{count.leaseCount}}</view>
+					<view>{{getP(1)}}%</view>
 				</view>
 			</view>
 			<view class="state-item">
@@ -48,48 +48,46 @@
 					<view class="state-label">空闲</view>
 				</view>
 				<view class="ddflex fflex state-data">
-					<view>30</view>
-					<view>83.33%</view>
+					<view>{{count.noLeaseCount}}</view>
+					<view>{{getP(2)}}%</view>
 				</view>
 			</view>
 		</view>
 		
 		<!-- 电池 -->
 		<view>
-			<view class="cell-box" v-for="item,index in 10">
+			<view class="cell-box" v-for="item,index in groupList">
 				<view class="ddflex">
 					<view style="margin-right: 35rpx;">
 						<cell :width="99" :height="197" :soc="index*10" :showsoc="true"></cell>
 					</view>
 					<view class="cell-info fflex">
 						<view class="ddflex">
-							<view class="cell-title">60V40AH</view>
-							<view class="cell-state">已租</view>
+							<view class="cell-title">{{item.model}}</view>
+							<view class="cell-state" :style="item.leaseStatus==1?'':'background-color: #0FCB27;'">{{item.leaseStatus==1?'已租':'空闲'}}</view>
 						</view>
-						<view class="cell-info ddflex">
-							<view>机柜名称:</view>
-							<view>CHZD04TTCC200329109</view>
+						<view class="cell-info  ddflex">
+							<view>电池Id:</view>
+							<view>{{item.batteryId}}</view>
 						</view>
 						<view class="cell-info  ddflex">
-							<view>电池ID:</view>
-							<view>613880983244</view>
+							<view>设备编号:</view>
+							<view>{{item.number}}</view>
 						</view>
 						<view class="cell-info ddflex">
 							<view>门店:</view>
-							<view>白云科技门店</view>
-						</view>
-						<view class="cell-info ddflex">
-							<view>剩余30天</view>
+							<view>{{item.storeName}}</view>
 						</view>
 						<view class="cell-info ddflex">
-							<view>2023-04-03  11:07:46</view>
+							<view>到期时间:</view>
+							<view>{{item.blockDate}}</view>
 						</view>
 					</view>
 				</view>
 				<view class="cell-option ddflex">
-					<view class="fflex" @click="jumpUrl('/machineAndCell/map/map')">定位</view>
-					<view class="fflex" @click="jumpUrl('/machineAndCell/BMS/BMS')">BMS</view>
-					<view class="fflex" @click="jumpUrl('/machineAndCell/cellDetail/cellDetail')">详情</view>
+					<view class="fflex" @click="jumpUrl('/machineAndCell/map/map?id='+item.batteryId)">定位</view>
+					<view class="fflex" @click="jumpUrl('/machineAndCell/BMS/BMS?id='+item.batteryId)">BMS</view>
+					<view class="fflex" @click="jumpUrl('/machineAndCell/cellDetail/cellDetail?id='+item.batteryId)">详情</view>
 				</view>
 			</view>
 		</view>
@@ -144,13 +142,15 @@
 				searchValue:'',
 				isQuerying:false,//正在查询数据
 				
-				queryType:1,
+				queryType:'',
 				
 				merchantList: [],
 				merchantPage: 1,
 				merchantLimit: 10,
 				
 				actMerchant:null,//当前门店
+				
+				count:{}
 			}
 		},
 		onLoad(options) {
@@ -160,18 +160,38 @@
 				
 				if(!this.userInfo.storeId){
 					this.getMerchantList()
+				}else{
+					this.actMerchant={
+						id:this.userInfo.storeId
+					}
+					this.getMachineList()
 				}
 			}else{
 				this.getMachineList()
 			}
 		},
 		onShow() {
-			
 		},
 		onReachBottom() {
 			this.getMachineList(true)
 		},
 		methods: {
+			getP(type){
+				let p = 0
+				if(type==1){
+					if(this.count.leaseCount == 0){}
+					else{
+						return (this.count.leaseCount/(this.count.leaseCount+this.count.noLeaseCount)).toFixed(4)*100
+					}
+				}
+				if(type==2){
+					if(this.count.noLeaseCount == 0){}
+					else{
+						return (this.count.noLeaseCount/(this.count.leaseCount+this.count.noLeaseCount)).toFixed(4)*100
+					}
+				}
+				return p*100
+			},
 			jumpUrl(url){
 				if(req.isLogins(true)){
 					uni.navigateTo({
@@ -182,6 +202,7 @@
 			queryTypeChange(val) {
 				if (this.queryType == val) return false
 				this.queryType = val
+				this.queryType = val==-1?'':val
 				this.getMachineList()
 			},
 			// 弹窗弹出
@@ -196,6 +217,18 @@
 				this.actMerchant = item
 				this.closePop()
 				this.getMachineList()
+				this.getTopNum()
+			},
+			// 电池数量
+			getTopNum(){
+				console.log('getTopNum')
+				req.getRequest(
+					'/admin/v2/battery/count',
+					{storeId:this.actMerchant.id},
+					data => {
+						this.count = data
+					}
+				)
 			},
 			// 获取电池列表
 			getMachineList(isPage){
@@ -209,11 +242,14 @@
 					limit: this.limit,
 				}
 				if(this.searchValue){
-					queryParams.devId=this.searchValue
+					queryParams.number=this.searchValue
+				}
+				if(this.queryType){
+					queryParams.type = this.queryType
 				}
 				queryParams.storeId = this.actMerchant.id
 				req.getRequest(
-					'/admin/v2/cab/page',
+					'/admin/v2/battery/page',
 					queryParams,
 					data => {
 						if (data != null && data.list.length > 0) {
@@ -268,10 +304,23 @@
 								this.actMerchant = this.merchantList[0]
 							}
 							this.getMachineList()
+							this.getTopNum()
 						}
 					}
 				)
 			},
+			saomaFn(){
+				// 只允许通过相机扫码
+				uni.scanCode({
+					onlyFromCamera: false,
+					success: (res) =>{
+						console.log('条码类型:' + res.scanType);
+						console.log('条码内容:' + res.result);
+						// did设备id
+						this.jumpUrl('/machineAndCell/cellSearch/cellSearch?storeId='+this.actMerchant.id+'&searchValue='+res.result+'&type='+this.queryType)
+					}
+				});
+			}
 		},
 		mounted() {
 			const systemInfo = uni.getSystemInfoSync();

+ 16 - 6
pages/index/index.vue

@@ -280,8 +280,8 @@
 						confine: true
 					},
 					grid: {
-						left: 0,
-						right: 20,
+						left: -60,
+						right: 5,
 						bottom: 40,
 						top: 40,
 						containLabel: true
@@ -289,6 +289,7 @@
 					xAxis: [{
 						type: 'value',
 						// data: [],
+						show: false,
 						axisLine: {
 							lineStyle: {
 								color: '#999999'
@@ -298,7 +299,10 @@
 							color: '#666666',
 							// interval: 0,
 
-						}
+						},
+						splitLine:{
+							show:false // 不显示网格线
+						},
 					}],
 					yAxis: [{
 						type: 'category',
@@ -314,11 +318,14 @@
 						axisLabel: {
 							color: '#666666',
 							// inside:true,
-							padding: [0, 0, 0, 0]
-						}
+							width:10,
+							padding: [-20, -100, 0, 10],
+							verticalAlign:'top',
+							align:'left'
+						},
 					}],
 					series: [{
-						name: '订单',
+						name: '营业额',
 						type: 'bar',
 						label: {
 							normal: {
@@ -326,6 +333,9 @@
 								position: 'right',
 								color: '#4c4a4a',
 								formatter:'¥{c}',
+								padding: [-20, 5, 0, -100],
+								verticalAlign:'top',
+								align:'right'
 							},
 						},
 						data: [300, 270, 340, 344, 300, 320, 310],

+ 20 - 4
pages/machine/machine.vue

@@ -8,11 +8,11 @@
 				</view>
 			</view>
 			<view class="search-box ddflex">
-				<image class="search-saoma" src="../../static/pages/images/saoma.png"></image>
+				<image class="search-saoma" src="../../static/pages/images/saoma.png" @click="saomaFn()"></image>
 				<view class="search-input ddflex fflex">
 					<image class="search-input-icon" src="../../static/pages/images/search.png"></image>
-					<input class="fflex"  placeholder="请输入编号查询"/>
-					<view class="search-btn">搜索</view>
+					<input class="fflex" v-model="searchValue" confirm-type="search" @confirm="searchFn"  placeholder="请输入编号查询"/>
+					<view class="search-btn" @click="searchFn">搜索</view>
 				</view>
 			</view>
 		</view>
@@ -23,7 +23,7 @@
 		<view class="machine-item" v-for="item,index in groupList" @click="jumpUrl('/machineAndCell/machineInfo/machineInfo?id='+item.devId)">
 			<view class="ddflex" style="justify-content: space-between;">
 				<view class="machine-title fflex tover">{{item.devName}}</view>
-				<view class="state">在线</view>
+				<!-- <view class="state">在线</view> -->
 			</view>
 			<view class="machine-number">机柜编号:{{item.devId}}</view>
 			<view class="machine-info ddflex">
@@ -230,6 +230,22 @@
 					url: 'plugin://routePlan/index?key=' + key + '&referer=' + referer + '&endPoint=' + endPoint
 				});
 			},
+			searchFn(){
+				this.getMachineList()
+			},
+			saomaFn(){
+				// 只允许通过相机扫码
+				uni.scanCode({
+					onlyFromCamera: false,
+					success: (res) =>{
+						console.log('条码类型:' + res.scanType);
+						console.log('条码内容:' + res.result);
+						// did设备id
+						this.searchValue = res.result
+						this.searchFn()
+					}
+				});
+			}
 		},
 		mounted() {
 			const systemInfo = uni.getSystemInfoSync();

+ 10 - 3
pages/myMerchant/myMerchant.vue

@@ -59,9 +59,9 @@
 					</view> -->
 				</view>
 				<view class="ddflex" style="justify-content: space-between;margin-top: 30rpx;">
-					<view class="sjyy-btn" style="border: 2rpx solid #EB5C20;color: #EB5C20;" @click="jumpUrl()">查看订单</view>
-					<view class="sjyy-btn" @click="jumpUrl()">查看设备</view>
-					<view class="sjyy-btn" @click="jumpUrl('/pages/operationDataPersonal/operationDataPersonal')">运营情况</view>
+					<view class="sjyy-btn" style="border: 2rpx solid #EB5C20;color: #EB5C20;" @click.stop="jumpUrl()">查看订单</view>
+					<view class="sjyy-btn" @click.stop="jumpUrl()">查看设备</view>
+					<view class="sjyy-btn" @click.stop="jumpUrl('/pages/operationDataPersonal/operationDataPersonal?storeId='+item.id)">运营情况</view>
 				</view>
 			</view>
 		</view>
@@ -98,6 +98,13 @@
 			this.getDataList(true)
 		},
 		methods: {
+			jumpUrl(url){
+				if(req.isLogins(true)){
+					uni.navigateTo({
+						url:url
+					})
+				}
+			},
 			getDataList(isPage) {
 				if(this.isQuerying) return
 				else this.isQuerying = true

+ 3 - 3
pages/myStore/myStore.vue

@@ -74,9 +74,9 @@
 					</view>
 				</view>
 				<view class="ddflex" style="justify-content: space-between;margin-top: 30rpx;">
-					<view class="sjyy-btn" style="border: 2rpx solid #EB5C20;color: #EB5C20;" @click="jumpUrl()">查看订单</view>
-					<view class="sjyy-btn" @click="jumpUrl()">查看设备</view>
-					<view class="sjyy-btn" @click="jumpUrl('/pages/operationDataPersonal/operationDataPersonal')">运营情况</view>
+					<view class="sjyy-btn" style="border: 2rpx solid #EB5C20;color: #EB5C20;" @click.stop="jumpUrl()">查看订单</view>
+					<view class="sjyy-btn" @click.stop="jumpUrl()">查看设备</view>
+					<view class="sjyy-btn" @click.stop="jumpUrl('/pages/operationDataPersonal/operationDataPersonal?merchantId='+item.id)">运营情况</view>
 				</view>
 			</view>
 		</view>

+ 8 - 8
pages/order/order.vue

@@ -9,6 +9,10 @@
 			</view>
 			<view class="tab-box ddflex">
 				<view class="fflex ddflex">
+					<view :class="'tab-item fflex '+(!queryType?'tab-item-active':'')" @click="queryTypeChange(-1)">
+						<view>全部</view>
+						<image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
+					</view>
 					<view :class="'tab-item fflex '+(queryType==1?'tab-item-active':'')" @click="queryTypeChange(1)">
 						<view>未完成</view>
 						<image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
@@ -17,10 +21,6 @@
 						<view>已完成</view>
 						<image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
 					</view>
-					<view :class="'tab-item fflex '+(!queryType?'tab-item-active':'')" @click="queryTypeChange(-1)">
-						<view>全部</view>
-						<image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
-					</view>
 				</view>
 				<view class="ddflex">
 					<image class="saoma" src="../../static/pages/images/saoma.png"></image>
@@ -33,9 +33,9 @@
 		
 		<!-- 订单 -->
 		<view>
-			<view class="order-item" v-for="item,index in groupList" @click="jumpUrl('/pages/orderDetail/orderDetail?id='+item)">
+			<view class="order-item" v-for="item,index in groupList" @click="jumpUrl('/pages/orderDetail/orderDetail?id='+item.id)">
 				<view class="ddflex order-item-header">
-					<view class="order-time">{{item.createDate}}</view>
+					<view class="order-time">{{item.leaseTime}}</view>
 					<!-- <block>
 						<view v-if="index!=1" class="order-state">线下-待确认</view>
 						<view v-else class="order-state" style="color: #0FCB27;">微信-支付成功</view>
@@ -48,7 +48,7 @@
 					</view>
 					<view class="order-item-content ddflex">
 						<view class="order-item-content-label">门店名称</view>
-						<view class="order-item-content-data fflex tover">{{item.storeName}}</view>
+						<view class="order-item-content-data fflex tover">{{item.leaseStoreName}}</view>
 					</view>
 					<view class="order-item-content ddflex">
 						<view class="order-item-content-label">租借机柜</view>
@@ -121,7 +121,7 @@
 				showPop: false,
 				tempData: null,
 				
-				queryType: 1,
+				queryType: '',
 				
 				groupList: [],
 				page: 1,

+ 43 - 46
pages/orderDetail/orderDetail.vue

@@ -2,47 +2,54 @@
 	<view style="padding-bottom: 50rpx;">
 		<view class="money-box ddflex">
 			<view class="state">
-				<view>已归还</view>
-				<view class="act-color">已支付</view>
+				<view>{{info.refundStatus==0?'未归还':info.refundStatus==1?'已归还':info.refundStatus==2?'丢失':''}}</view>
+				<view class="act-color">{{info.status==0?'待支付':info.status==1?'已结算':info.status==2?'取消订单':info.status==3?'已支付':''}}</view>
 			</view>
 			<view class="money act-color ddflex">
 				<text class="symbol">¥</text>
-				<text>20</text>
+				<text>{{info.payMoney}}</text>
 			</view>
 		</view>
 		
 		<view class="info-box">
 			<view class="info-item ddflex">
 				<view class="info-item-label">使用时长</view>
-				<view class="info-item-data fflex tover">一次</view>
+				<view class="info-item-data fflex tover">{{info.type==2?'一次':info.lease.time}}</view>
 			</view>
 			<view class="info-item ddflex">
 				<view class="info-item-label">计费方式</view>
-				<view class="info-item-data fflex tover">按次计费</view>
+				<view class="info-item-data fflex tover">{{info.type==2?'按次计费':info.type==3?'按时计费':''}}</view>
 			</view>
 			<view class="info-item ddflex">
 				<view class="info-item-label">使用费用</view>
-				<view class="info-item-data fflex tover">¥15</view>
+				<view class="info-item-data fflex tover">¥{{info.realMoney}}</view>
 			</view>
 			<view class="info-item ddflex">
 				<view class="info-item-label">超时</view>
-				<view class="info-item-data fflex tover">2小时</view>
+				<view class="info-item-data fflex tover">{{info.timeoutTime?info.timeoutTime:0}}小时</view>
 			</view>
 			<view class="info-item ddflex">
 				<view class="info-item-label">超时费用</view>
-				<view class="info-item-data fflex tover">¥5</view>
+				<view class="info-item-data fflex tover">¥{{info.timeoutMoney?info.timeoutMoney:0}}</view>
 			</view>	
 			<view class="info-item ddflex">
 				<view class="info-item-label">订单总额</view>
-				<view class="info-item-data fflex tover act-color">¥20</view>
+				<view class="info-item-data fflex tover act-color">¥{{info.totalMoney}}</view>
 			</view>
 			<view class="info-item ddflex">
 				<view class="info-item-label">支付方式</view>
-				<view class="info-item-data fflex tover">钱包支付</view>
+				<view class="info-item-data fflex tover">{{info.payType==1?'钱包支付':'微信支付'}}</view>
 			</view>
 			<view class="info-item dflex">
 				<view class="info-item-label">收费标准</view>
-				<view class="info-item-data fflex">4元/小时,免费试用5分钟,不足60分钟按60分钟计费</view>
+				<view class="info-item-data fflex">
+					<block v-if="info.type==3">
+						{{info.battery.price}}元/小时,免费试用{{info.battery.freeTime}}分钟,不足60分钟按60分钟计费
+					</block>
+					<block v-if="info.type==2">
+						{{info.battery.oncePrice}}元/次,超时按{{info.battery.timeoutPrice}}元/小时计费
+					</block>
+				</view>
 			</view>
 		</view>
 		
@@ -51,61 +58,61 @@
 			<view class="info-item ddflex">
 				<view class="info-item-label">租赁合同</view>
 				<view class="ddflex">
-					<view class="info-item-data fflex tover">2346324325171424</view>
+					<view class="info-item-data fflex tover">{{info.contractId}}</view>
 					<view style="color: #2A82E4;margin-left: 10rpx;text-decoration: underline;">查看</view>
 				</view>
 			</view>
-			<view class="info-item ddflex">
+			<!-- <view class="info-item ddflex">
 				<view class="info-item-label">租借方式</view>
 				<view class="info-item-data fflex tover">微信支付分租借</view>
-			</view>
+			</view> -->
 			<view class="info-item ddflex">
 				<view class="info-item-label">租借时间</view>
-				<view class="info-item-data fflex tover">2022-11-25 00:55</view>
+				<view class="info-item-data fflex tover">{{info.lease.leaseTime}}</view>
 			</view>
 			<view class="info-item ddflex mag-b50">
 				<view class="info-item-label">归还时间</view>
-				<view class="info-item-data fflex tover">2022-11-25 00:58</view>
+				<view class="info-item-data fflex tover">{{info.lease.returnTime}}</view>
 			</view>
 			<view class="info-item ddflex">
 				<view class="info-item-label">电池ID</view>
-				<view class="info-item-data fflex tover">XCZX000100707</view>
+				<view class="info-item-data fflex tover">{{info.lease.batteryId}}</view>
 			</view>	
 			<view class="info-item ddflex">
 				<view class="info-item-label">电池型号</view>
-				<view class="info-item-data fflex tover">60V 30Ah</view>
+				<view class="info-item-data fflex tover">{{info.battery.model}}</view>
 			</view>
 			<view class="info-item ddflex">
 				<view class="info-item-label">租借机柜</view>
-				<view class="info-item-data fflex tover">ZXCCD12210250093</view>
+				<view class="info-item-data fflex tover">{{info.lease.leaseDevId}}</view>
 			</view>
 			<view class="info-item ddflex">
 				<view class="info-item-label">租借门店</view>
-				<view class="info-item-data fflex tover">白云科技</view>
+				<view class="info-item-data fflex tover">{{info.lease.leaseStoreName}}</view>
 			</view>
 			<view class="info-item dflex mag-b50">
 				<view class="info-item-label">租借地点</view>
-				<view class="info-item-data fflex">广东省惠州市惠城区下埔路23号广东省惠州市惠城区下埔路23号</view>
+				<view class="info-item-data fflex">{{info.lease.leaseStoreAddress}}</view>
 			</view>
 			<view class="info-item ddflex">
 				<view class="info-item-label">归还门店</view>
-				<view class="info-item-data fflex tover">白云科技</view>
+				<view class="info-item-data fflex tover">{{info.lease.returnStoreName}}</view>
 			</view>
 			<view class="info-item dflex">
 				<view class="info-item-label">归还地点</view>
-				<view class="info-item-data fflex">广东省惠州市惠城区下埔路23号广东省惠州市惠城区下埔路23号</view>
+				<view class="info-item-data fflex">{{info.lease.returnStoreAddress}}</view>
 			</view>
 			<view class="info-item ddflex mag-b50">
 				<view class="info-item-label">归还机柜</view>
-				<view class="info-item-data fflex tover">ZXCCD12210250093</view>
+				<view class="info-item-data fflex tover">{{info.lease.returnDevId}}</view>
 			</view>
-			<view class="info-item ddflex">
+			<!-- <view class="info-item ddflex">
 				<view class="info-item-label">用户手机号</view>
 				<view class="info-item-data fflex tover">15200809658</view>
-			</view>
+			</view> -->
 			<view class="info-item ddflex">
 				<view class="info-item-label">订单编号</view>
-				<view class="info-item-data fflex tover">159582346324325171424</view>
+				<view class="info-item-data fflex tover">{{info.orderNo}}</view>
 			</view>
 		</view>
 		
@@ -121,36 +128,26 @@
 		props: {},
 		data() {
 			return {
-				systems: {},
-				isTop:0,
+				id:null,
+				info:{}
 			}
 		},
 		onLoad(options) {
-
+			this.id = options.id
+			this.getData()
 		},
 		onShow() {
-			
 		},
 		methods: {
-			
+			getData(){
+				req.getRequest('/admin/v2/order/'+this.id,{},res=>{
+					this.info = res
+				})
+			}
 		},
 		mounted() {
-			const systemInfo = uni.getSystemInfoSync();
-			// px转换到rpx的比例
-			let pxToRpxScale = 750 / systemInfo.windowWidth;
-			let systems = {
-				ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
-				navigationHeight: 44 * pxToRpxScale // 导航栏的高度
-			};
-			systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
-			this.systems = systems;
 		},
 		onPageScroll: function(e) {
-			if (e.scrollTop > this.systems.barHeight) {
-				this.isTop = 1;
-			} else {
-				this.isTop = 0;
-			}
 		}
 	}
 </script>

+ 2 - 2
pages/user/user.css

@@ -109,8 +109,8 @@ page {background: #F0F0F0;}
 .yichang-item image{
 	position: absolute;
 	width: 120rpx;height: 120rpx;
-	bottom: 0;
-	right: 0;
+	bottom: 25rpx;
+	right: 23rpx;
 }
 .yichang-title{
 	line-height: 45rpx;

+ 1 - 0
pages/user/user.vue

@@ -130,6 +130,7 @@
 			if(this.userInfos){
 				this.isLogin = true
 				this.getUserInfo()
+				this.getWarningData()
 			}else{
 				this.isLogin = false
 			}

+ 22 - 23
warning/abnormalAlarm/abnormalAlarm.vue

@@ -6,10 +6,10 @@
 			</view>
 			<view class="fflex">
 				<view class="alarm-title">用户报障</view>
-				<view class="alarm-note">您有4条用户保障记录,请及时处理</view>
+				<view class="alarm-note">您有{{userAlarmCount}}条用户保障记录,请及时处理</view>
 			</view>
 			<image class="rico" src="../../static/pages/images/ssicon.png"></image>
-			<view class="dot"></view>
+			<view class="dot" v-if="userAlarmCount>0"></view>
 		</view>
 		
 		<view class="alarm-box ddflex" @click="jumpUrl('warning/machineAlarm/machineAlarm')">
@@ -18,10 +18,10 @@
 			</view>
 			<view class="fflex">
 				<view class="alarm-title">机柜报障</view>
-				<view class="alarm-note">您有4条机柜保障提醒,请及时处理</view>
+				<view class="alarm-note">您有{{cabAlarmCount}}条机柜保障提醒,请及时处理</view>
 			</view>
 			<image class="rico" src="../../static/pages/images/ssicon.png"></image>
-			<view class="dot"></view>
+			<view class="dot" v-if="cabAlarmCount>0"></view>
 		</view>
 		
 		<view class="alarm-box ddflex" @click="jumpUrl('warning/reconditionAlarm/reconditionAlarm')">
@@ -30,10 +30,10 @@
 			</view>
 			<view class="fflex">
 				<view class="alarm-title">检修提醒</view>
-				<view class="alarm-note">您有1条检修提醒,请及时处理</view>
+				<view class="alarm-note">您有{{reconditionCount}}条检修提醒,请及时处理</view>
 			</view>
 			<image class="rico" src="../../static/pages/images/ssicon.png"></image>
-			<view class="dot"></view>
+			<view class="dot" v-if="reconditionCount>0"></view>
 		</view>
 	</view>
 </template>
@@ -47,39 +47,38 @@
 		props: {},
 		data() {
 			return {
-				systems: {},
-				isTop:0,
+				userAlarmCount:0,
+				cabAlarmCount:0,
+				reconditionCount:0
+				
 			}
 		},
 		onLoad(options) {
 
 		},
 		onShow() {
-			
+			this.getCount()
 		},
 		methods: {
 			jumpUrl(url) {
 				if (!req.isLogin()) return false;
 				app.globalData.navigateTo(url);
 			},
+			getCount(){
+				req.getRequest('/admin/v2/alarm/userAlarmPage',{page:1,limit:1,type:0},res=>{
+					this.userAlarmCount = res.total
+				})
+				req.getRequest('/admin/v2/alarm/cabAlarmPage',{page:1,limit:1,type:1},res=>{
+					this.cabAlarmCount = res.total
+				})
+				req.getRequest('/admin/v2/alarm/reconditionPage',{page:1,limit:1,type:0},res=>{
+					this.reconditionCount = res.total
+				})
+			}
 		},
 		mounted() {
-			const systemInfo = uni.getSystemInfoSync();
-			// px转换到rpx的比例
-			let pxToRpxScale = 750 / systemInfo.windowWidth;
-			let systems = {
-				ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
-				navigationHeight: 44 * pxToRpxScale // 导航栏的高度
-			};
-			systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
-			this.systems = systems;
 		},
 		onPageScroll: function(e) {
-			if (e.scrollTop > this.systems.barHeight) {
-				this.isTop = 1;
-			} else {
-				this.isTop = 0;
-			}
 		}
 	}
 </script>

+ 61 - 25
warning/machineAlarm/machineAlarm.vue

@@ -1,29 +1,30 @@
 <template>
 	<view>
-		<view class="order-item" v-for="item,index in 10" @click="openPop(item)">
+		<!-- @click="openPop(item) -->
+		<view class="order-item" v-for="item,index in groupList">
 			<view class="ddflex order-item-header">
-				<view class="order-time">类型:整柜巡检</view>
+				<view class="order-time">类型:{{item.alarmFlag}}</view>
 				<block>
-					<view v-if="index!=1" class="order-state">待消除</view>
+					<view v-if="item.type==1" class="order-state">待消除</view>
 					<view v-else class="order-state" style="color: #0FCB27;border: 2rpx solid #0FCB27;">已消除</view>
 				</block>
 			</view>
 			<view class="order-item-body">
 				<view class="order-item-content ddflex">
 					<view class="order-item-content-label">机柜编号:</view>
-					<view class="order-item-content-data fflex tover">CHZD04TTCC200329109</view>
+					<view class="order-item-content-data fflex tover">{{item.devId}}</view>
 				</view>
 				<view class="order-item-content ddflex">
 					<view class="order-item-content-label">电池编号:</view>
-					<view class="order-item-content-data fflex tover">613880983244</view>
+					<view class="order-item-content-data fflex tover">{{item.batteryId}}</view>
 				</view>
 				<view class="order-item-content ddflex">
 					<view class="order-item-content-label">描述:</view>
-					<view class="order-item-content-data fflex tover">市电故障</view>
+					<view class="order-item-content-data fflex tover">{{item.alarmDesc}}</view>
 				</view>
 				<view class="order-item-content ddflex">
 					<view class="order-item-content-label">告警时间:</view>
-					<view class="order-item-content-data fflex tover">2022-12-31 17:16:37</view>
+					<view class="order-item-content-data fflex tover">{{item.alarmTime}}</view>
 				</view>
 			</view>
 		</view>
@@ -56,19 +57,30 @@
 		props: {},
 		data() {
 			return {
-				systems: {},
-				isTop:0,
-				
 				showPop: false,
 				tempData: null,
+				
+				id:null,
+				
+				groupList: [],
+				page: 1,
+				limit: 10,
+				searchValue:'',
+				isQuerying:false,//正在查询数据
 			}
 		},
 		onLoad(options) {
-
+			if(options.id){
+				this.id = options.id
+			}
+			this.getMachineList()
 		},
 		onShow() {
 			
 		},
+		onReachBottom() {
+			this.getMachineList(true)
+		},
 		methods: {
 			jumpUrl(url) {
 				if (!req.isLogin()) return false;
@@ -88,24 +100,48 @@
 			popSubmit() {
 				this.closePop()
 			},
+			
+			// 获取机柜列表
+			getMachineList(isPage){
+				if(this.isQuerying) return
+				else this.isQuerying = true
+				if (!isPage) {
+					this.page = 1
+				}
+				let queryParams = {
+					page: this.page,
+					limit: this.limit,
+				}
+				let api = '/admin/v2/cab/page'
+				if(this.id){
+					api = '/admin/v2/cab/alarm/page'
+					queryParams.devId = this.id
+				}
+				req.getRequest(
+					api,
+					queryParams,
+					data => {
+						if (data != null && data.list.length > 0) {
+							if (!isPage) {
+								this.groupList = data.list
+							} else {
+								this.groupList = this.groupList.concat(data.list)
+							}
+							this.page++
+						} else {
+							if (!isPage)
+								this.groupList = data.list
+							else {}
+						}
+						uni.hideLoading()
+						this.isQuerying = false
+					}
+				)
+			},
 		},
 		mounted() {
-			const systemInfo = uni.getSystemInfoSync();
-			// px转换到rpx的比例
-			let pxToRpxScale = 750 / systemInfo.windowWidth;
-			let systems = {
-				ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
-				navigationHeight: 44 * pxToRpxScale // 导航栏的高度
-			};
-			systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
-			this.systems = systems;
 		},
 		onPageScroll: function(e) {
-			if (e.scrollTop > this.systems.barHeight) {
-				this.isTop = 1;
-			} else {
-				this.isTop = 0;
-			}
 		}
 	}
 </script>

+ 61 - 33
warning/orderAlarm/orderAlarm.vue

@@ -3,12 +3,12 @@
 		<!-- tab -->
 		<view class="tab-box ddflex">
 			<view class="fflex ddflex">
-				<view :class="'tab-item fflex '+(queryType==1?'tab-item-active':'')" @click="queryTypeChange(1)">
-					<view>待确认</view>
+				<view :class="'tab-item fflex '+(queryType==''?'tab-item-active':'')" @click="queryTypeChange(0)">
+					<view>待处理</view>
 					<image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
 				</view>
-				<view :class="'tab-item fflex '+(queryType==2?'tab-item-active':'')" @click="queryTypeChange(2)">
-					<view>已完成</view>
+				<view :class="'tab-item fflex '+(queryType==1?'tab-item-active':'')" @click="queryTypeChange(1)">
+					<view>已处理</view>
 					<image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
 				</view>
 			</view>
@@ -17,41 +17,41 @@
 		
 		<!-- 订单 -->
 		<view>
-			<view class="order-item" v-for="item,index in 10" @click="jumpUrl('/pages/orderDetail/orderDetail?id='+item)">
+			<view class="order-item" v-for="item,index in groupList" @click="jumpUrl('/pages/orderDetail/orderDetail?id='+item)">
 				<view class="ddflex order-item-header">
-					<view class="order-time">类型:自动扣费失败</view>
+					<view class="order-time">类型:{{item.exceptionCause}}</view>
 					<block>
-						<view v-if="index!=1" class="order-state">待处理</view>
+						<view v-if="item.isException==0" class="order-state">待处理</view>
 						<view v-else class="order-state" style="color: #0FCB27;border: 2rpx solid #0FCB27;">已处理</view>
 					</block>
 				</view>
 				<view class="order-item-body">
 					<view class="order-item-content ddflex">
 						<view class="order-item-content-label">订单编号:</view>
-						<view class="order-item-content-data fflex tover">159582346324325171424</view>
+						<view class="order-item-content-data fflex tover">{{item.orderNo}}</view>
 					</view>
 					<view class="order-item-content ddflex">
 						<view class="order-item-content-label">订单状态:</view>
-						<view class="order-item-content-data fflex tover">未结束</view>
+						<view class="order-item-content-data fflex tover">{{item.finishStatus==0?'未结束':item.finishStatus==1?'自动结束':'人工结束'}}</view>
 					</view>
 					<view class="order-item-content ddflex">
 						<view class="order-item-content-label">机柜编号:</view>
-						<view class="order-item-content-data fflex tover">CHZD04TTCC200329109</view>
+						<view class="order-item-content-data fflex tover">{{item.leaseDevId}}</view>
 					</view>
 					<view class="order-item-content ddflex">
 						<view class="order-item-content-label">电池编号:</view>
-						<view class="order-item-content-data fflex tover">613880983244</view>
+						<view class="order-item-content-data fflex tover">{{item.batteryId}}</view>
 					</view>
 					<view class="order-item-content ddflex">
 						<view class="order-item-content-label">描述:</view>
-						<view class="order-item-content-data fflex tover">使用后未缴费</view>
+						<view class="order-item-content-data fflex tover">{{item.exceptionCause}}</view>
 					</view>
 				</view>
-				<view v-if="index!=1" class="order-btns ddflex">
+				<view v-if="item.isException!==0" class="order-btns ddflex">
 					<view class="order-btn-time">2022-12-31 17:16:37</view>
 					<view style="justify-content: flex-end;" class="ddflex">
-						<view class="order-btn" @click.stop="">结束订单</view>
-						<view class="order-btn" @click.stop="">禁用</view>
+						<view class="order-btn" v-if="item.status>1" @click.stop="">退款</view>
+						<view class="order-btn" v-else @click.stop="">结束订单</view>
 					</view>
 				</view>
 			</view>
@@ -69,18 +69,25 @@
 		props: {},
 		data() {
 			return {
-				systems: {},
-				isTop: 0,
 
-				queryType: 1,
+				queryType: 0,
+				
+				groupList: [],
+				page: 1,
+				limit: 10,
+				searchValue:'',
+				isQuerying:false,//正在查询数据
 			}
 		},
 		onLoad(options) {
-
+			this.getMachineList()
 		},
 		onShow() {
 
 		},
+		onReachBottom() {
+			this.getMachineList(true)
+		},
 		methods: {
 			jumpUrl(url) {
 				if (req.isLogins(true)) {
@@ -92,25 +99,46 @@
 			queryTypeChange(val) {
 				if (this.queryType == val) return false
 				this.queryType = val
+				this.getMachineList()
+			},
+			
+			// 获取机柜列表
+			getMachineList(isPage){
+				if(this.isQuerying) return
+				else this.isQuerying = true
+				if (!isPage) {
+					this.page = 1
+				}
+				let queryParams = {
+					page: this.page,
+					limit: this.limit,
+				}
+				queryParams.status = this.queryType
+				req.getRequest(
+					'/admin/v2/alarm/exceptionOrderPage',
+					queryParams,
+					data => {
+						if (data != null && data.list.length > 0) {
+							if (!isPage) {
+								this.groupList = data.list
+							} else {
+								this.groupList = this.groupList.concat(data.list)
+							}
+							this.page++
+						} else {
+							if (!isPage)
+								this.groupList = data.list
+							else {}
+						}
+						uni.hideLoading()
+						this.isQuerying = false
+					}
+				)
 			},
 		},
 		mounted() {
-			const systemInfo = uni.getSystemInfoSync();
-			// px转换到rpx的比例
-			let pxToRpxScale = 750 / systemInfo.windowWidth;
-			let systems = {
-				ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
-				navigationHeight: 44 * pxToRpxScale // 导航栏的高度
-			};
-			systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
-			this.systems = systems;
 		},
 		onPageScroll: function(e) {
-			if (e.scrollTop > this.systems.barHeight) {
-				this.isTop = 1;
-			} else {
-				this.isTop = 0;
-			}
 		}
 	}
 </script>

+ 51 - 25
warning/reconditionAlarm/reconditionAlarm.vue

@@ -1,29 +1,29 @@
 <template>
 	<view>
-		<view class="order-item" v-for="item,index in 10" @click="openPop(item)">
+		<view class="order-item" v-for="item,index in groupList" @click="openPop(item)">
 			<view class="ddflex order-item-header">
-				<view class="order-time">类型:整柜巡检</view>
+				<view class="order-time">类型:{{item.type}}</view>
 				<block>
-					<view v-if="index!=1" class="order-state">待处理</view>
+					<view v-if="item.status!=1" class="order-state">待处理</view>
 					<view v-else class="order-state" style="color: #0FCB27;border: 2rpx solid #0FCB27;">已处理</view>
 				</block>
 			</view>
 			<view class="order-item-body">
 				<view class="order-item-content ddflex">
 					<view class="order-item-content-label">机柜编号:</view>
-					<view class="order-item-content-data fflex tover">CHZD04TTCC200329109</view>
+					<view class="order-item-content-data fflex tover">{{item.devId}}</view>
 				</view>
 				<view class="order-item-content ddflex">
 					<view class="order-item-content-label">电池编号:</view>
-					<view class="order-item-content-data fflex tover">613880983244</view>
+					<view class="order-item-content-data fflex tover">{{item.batteryId}}</view>
 				</view>
 				<view class="order-item-content ddflex">
 					<view class="order-item-content-label">描述:</view>
-					<view class="order-item-content-data fflex tover">定期巡检提醒</view>
+					<view class="order-item-content-data fflex tover">{{item.content}}</view>
 				</view>
 				<view class="order-item-content ddflex">
 					<view class="order-item-content-label">提醒时间:</view>
-					<view class="order-item-content-data fflex tover">2022-12-31 17:16:37</view>
+					<view class="order-item-content-data fflex tover">{{item.createDate}}</view>
 				</view>
 			</view>
 		</view>
@@ -56,19 +56,25 @@
 		props: {},
 		data() {
 			return {
-				systems: {},
-				isTop:0,
-				
 				showPop: false,
 				tempData: null,
+				
+				groupList: [],
+				page: 1,
+				limit: 10,
+				searchValue:'',
+				isQuerying:false,//正在查询数据
 			}
 		},
 		onLoad(options) {
-
+			this.getMachineList()
 		},
 		onShow() {
 			
 		},
+		onReachBottom() {
+			this.getMachineList(true)
+		},
 		methods: {
 			jumpUrl(url) {
 				if (!req.isLogin()) return false;
@@ -88,24 +94,44 @@
 			popSubmit() {
 				this.closePop()
 			},
+			
+			// 获取机柜列表
+			getMachineList(isPage){
+				if(this.isQuerying) return
+				else this.isQuerying = true
+				if (!isPage) {
+					this.page = 1
+				}
+				let queryParams = {
+					page: this.page,
+					limit: this.limit,
+				}
+				req.getRequest(
+					'/admin/v2/alarm/reconditionPage',
+					queryParams,
+					data => {
+						if (data != null && data.list.length > 0) {
+							if (!isPage) {
+								this.groupList = data.list
+							} else {
+								this.groupList = this.groupList.concat(data.list)
+							}
+							this.page++
+						} else {
+							if (!isPage)
+								this.groupList = data.list
+							else {}
+						}
+						uni.hideLoading()
+						this.isQuerying = false
+					}
+				)
+			},
 		},
 		mounted() {
-			const systemInfo = uni.getSystemInfoSync();
-			// px转换到rpx的比例
-			let pxToRpxScale = 750 / systemInfo.windowWidth;
-			let systems = {
-				ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
-				navigationHeight: 44 * pxToRpxScale // 导航栏的高度
-			};
-			systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
-			this.systems = systems;
+			
 		},
 		onPageScroll: function(e) {
-			if (e.scrollTop > this.systems.barHeight) {
-				this.isTop = 1;
-			} else {
-				this.isTop = 0;
-			}
 		}
 	}
 </script>

+ 71 - 26
warning/userAlarm/userAlarm.vue

@@ -1,34 +1,40 @@
 <template>
 	<view>
-		<view class="order-item" v-for="item,index in 10" @click="openPop(item)">
+		<!-- @click="openPop(item)" -->
+		<view class="order-item" v-for="item,index in groupList" >
 			<view class="ddflex order-item-header">
-				<view class="order-time">2023-03-29 12:05:58</view>
+				<view class="order-time">{{item.createDate}}</view>
 				<block>
-					<view v-if="index!=1" class="order-state">待处理</view>
+					<view v-if="item.status!=1" class="order-state">待处理</view>
 					<view v-else class="order-state" style="color: #0FCB27;border: 2rpx solid #0FCB27;">已处理</view>
 				</block>
 			</view>
 			<view class="order-item-body">
 				<view class="order-item-content ddflex">
 					<view class="order-item-content-label">机柜编号</view>
-					<view class="order-item-content-data fflex tover">CHZD04TTCC200329109</view>
+					<view class="order-item-content-data fflex tover">{{item.devId}}</view>
 				</view>
 				<view class="order-item-content ddflex">
 					<view class="order-item-content-label">电池ID</view>
-					<view class="order-item-content-data fflex tover">613880983244</view>
+					<view class="order-item-content-data fflex tover">{{item.batteryId}}</view>
 				</view>
 				<view class="order-item-content ddflex">
 					<view class="order-item-content-label">报障问题</view>
-					<view class="order-item-content-data fflex tover">电池断电</view>
+					<view class="order-item-content-data fflex tover">{{item.type}}</view>
 				</view>
 			</view>
 			<view class="order-item-body2">
 				<view class="order-item-content-label">问题补充描述</view>
 				<view class="order-item-content ddflex" style="font-size: 24rpx;font-weight: 400;">
-					电池充不进去电,一开始可以充进去,不到5分钟就没电了,但是电量显示还有80%的电。
+					{{item.content}}
 				</view>
 				<view class="images-box ddflex">
-					<image class="images" v-for="item in 3"></image>
+					<image class="images" v-for="it in imageList" :src="it"></image>
+				</view>
+			</view>
+			<view v-if="item.status!=1" class="order-btns ddflex">
+				<view style="justify-content: flex-end;" class="ddflex">
+					<view class="order-btn" @click.stop="deal(item,index)">去处理</view>
 				</view>
 			</view>
 		</view>
@@ -61,18 +67,24 @@
 		props: {},
 		data() {
 			return {
-				systems: {},
-				isTop:0,
 				
 				showPop: false,
 				tempData: null,
+				
+				groupList: [],
+				page: 1,
+				limit: 10,
+				searchValue:'',
+				isQuerying:false,//正在查询数据
 			}
 		},
 		onLoad(options) {
-
+			this.getMachineList()
 		},
 		onShow() {
-			
+		},
+		onReachBottom() {
+			this.getMachineList(true)
 		},
 		methods: {
 			jumpUrl(url) {
@@ -93,24 +105,57 @@
 			popSubmit() {
 				this.closePop()
 			},
+			// 获取机柜列表
+			getMachineList(isPage){
+				if(this.isQuerying) return
+				else this.isQuerying = true
+				if (!isPage) {
+					this.page = 1
+				}
+				let queryParams = {
+					page: this.page,
+					limit: this.limit,
+				}
+				req.getRequest(
+					'/admin/v2/alarm/userAlarmPage',
+					queryParams,
+					data => {
+						if (data != null && data.list.length > 0) {
+							if (!isPage) {
+								this.groupList = data.list
+							} else {
+								this.groupList = this.groupList.concat(data.list)
+							}
+							this.page++
+						} else {
+							if (!isPage)
+								this.groupList = data.list
+							else {}
+						}
+						uni.hideLoading()
+						this.isQuerying = false
+					}
+				)
+			},
+			// 处理
+			deal(item,index){
+				uni.showModal({
+					title:'提示',
+					content:'请确认故障是否已解除',
+					success(res) {
+						if(res.confirm){
+							req.getRequest('/admin/v2/alarm/'+item.id,{},data=>{
+								req.msg('故障已解除')
+								item.status = 1
+							})
+						}
+					}
+				})
+			}
 		},
 		mounted() {
-			const systemInfo = uni.getSystemInfoSync();
-			// px转换到rpx的比例
-			let pxToRpxScale = 750 / systemInfo.windowWidth;
-			let systems = {
-				ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
-				navigationHeight: 44 * pxToRpxScale // 导航栏的高度
-			};
-			systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
-			this.systems = systems;
 		},
 		onPageScroll: function(e) {
-			if (e.scrollTop > this.systems.barHeight) {
-				this.isTop = 1;
-			} else {
-				this.isTop = 0;
-			}
 		}
 	}
 </script>