zhengkaixin 1 rok temu
rodzic
commit
cefc15a0ed

+ 1 - 1
apis/pagejs/managementList.js

@@ -4,7 +4,7 @@ import requestWhite from '@/apis/utils/requestWhite'
 
 export function information(data) {
 	var url='/mobile/authorization/information';
-	return request({
+	return requestWhite({
 		method: 'post',
 		data: data,
 		url: url

+ 3 - 3
config/.env.dev.js

@@ -3,20 +3,20 @@ const UNI_APP = {
 	//BASE_URL: 'http://36.134.122.108/railroad-server/',
 
 	BASE_URL: 'https://charging.xiaoxinda.com/electric-manager-api/', //test
-	BASE_URL: 'https://dgj.hbjp.com.cn/electric-manager-api/',
+	//BASE_URL: 'https://dgj.hbjp.com.cn/electric-manager-api/',
 	
 	BASE_URL:'http://192.168.77.162:8081/electric-manager-api/', //sz
 	
 	NODE_ENV :"dev",
 	SIMPLE_RUN:true,// 无视权限控制跳转页面   , 用于样式人员快速访问各种功能 ,快速测试等
-	 openId:"1234",//开发人员2
+	 openId:"1235",//开发人员2
 	// openId:"55555",//测试人员 开发环境
 	// openId:"oLowyuNkSxqovYoobKbeHB1nSkm0", //sz
 	//openId:"oK9Wr57rAcNzihDN2PEdptprT0As", 
 	// openId:"oK9Wr54VbEh3xvWYmD_zT5NbH4AY",
 	//openId:"oLowyuOJvTszgk96C0f8j0XfcEXg",//zkx
 	
-	// openId:"oLowyuAJ1Ld0ivnLj4qp1k5Vy_l4", //老板
+	//openId:"oLowyuAJ1Ld0ivnLj4qp1k5Vy_l4", //老板
 	//openId:"oLowyuFTU3SzpvU4pGNzWk7NC9y0", //me
 	//openId:"oLowyuMMjIkA_bLA4MXzRQ3KJB2E",
 	//openId:"oLowyuHCGgMomNBQEXZSbb5SJxfQ",//杨所

+ 38 - 3
pages/managementList/applicantsList.vue

@@ -4,7 +4,9 @@
 			
 		</u-navbar>
 		<view class="search-box">
-			<u-search placeholder="搜索授权用户" bg-color="#f2f4f6" height="80" :show-action="true" v-model="keyword">
+			<u-search  @custom="getApprovalList(true)"
+			 
+			 placeholder="搜索授权用户" bg-color="#f2f4f6" height="80" :show-action="true" v-model="keyword">
 		
 		
 			</u-search>
@@ -27,10 +29,10 @@
 				
 				<!-- 通过 -->
 				<view class="infos2" v-if="item.status==0">
-					<view class="pass" @click="pass=true" v-if="pass==false" >
+					<view class="pass" @click="switchBtnApi(item,1)"  >
 						通过
 					</view>
-					<view class="passNo" @click="pass=true" v-if="pass==false" >
+					<view class="passNo" @click="switchBtnApi(item,2)"  >
 						拒绝
 					</view>
 				</view>
@@ -77,6 +79,39 @@
 		},
 		
 		methods: {
+			switchBtnApiMethod(node,key){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				API.approvalNext({
+					id:node.id,
+					status:key
+				}).then((res) => {
+					uni.hideLoading();
+					this.getApprovalList(true)
+				}).catch(error => {
+					
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			switchBtnApi(node,key){
+				uni.showModal({
+					confirmColor:`${key==1?'#3CC51F':'red'}`,
+					confirmText:`${key==1?'通过':'拒绝'}`,
+					content: `确认是否要"${key==1?'通过':'拒绝'}"${node.createByName}`,
+					title: "提示",
+					success:res=> {
+						if(res.confirm){
+							this.switchBtnApiMethod(node,key);
+						}
+					}
+				})
+				console.log(node,key)
+			},
 			myLoadmore() {
 				this.pageIndex += 1;
 				this.getApprovalList();

+ 180 - 24
pages/managementList/applyAuthorisation.vue

@@ -1,35 +1,71 @@
 <template>
 	<view>
-		<u-navbar title="填写申请人信息" title-color="#101010">
-			
-		</u-navbar>
-		
-		<view class="main">
-			
-			
-			<view class="item">
-				<view class="title">
-					<span>*</span>姓名
-				</view>
-				<view class="value">
-					<input type="text" v-model="name" placeholder="请填写姓名" />
+		<view v-if="step">
+			<u-navbar :title="title" title-color="#101010" :is-back="false" >
+				
+			</u-navbar>
+			<view class="main2">
+				<view class="item" v-for="(item,i) in meterList"  :key="i" >
+					 <view class="item1">
+						 <view class="item11">{{item.name}}</view>
+						  <view class="item12">电源状态:<span>{{item.switchStatus?'开':'关'}}</span></view>
+					 </view>
+					 
+					 <view class="item2" >
+					 		<span>关</span>
+					 		<u-switch size="32" @change="switchBtnApi(item,$event)"  
+					 		 v-model="item.switchStatus"   inactive-color="#ff9900" ></u-switch >
+					 		<span>开</span>
+					 </view>
+					 
 				</view>
+			</view>	
+		</view>	
+		<view v-if="!step">
+			<u-navbar title="填写申请人信息" title-color="#101010" :is-back="false" >
 				
-			</view>
-			
-			<view class="item">
-				<view class="title">
-					<span>*</span>联系电话
+			</u-navbar>
+			<view class="main">
+				
+				<view class="item">
+					<view class="title">
+						二维码
+					</view>
+					<view class="value">
+						{{title}}
+					</view>
+					
+				</view>
+				<view class="item">
+					<view class="title">
+						<span>*</span>姓名
+					</view>
+					<view class="value">
+						<input type="text" v-model="name" placeholder="请填写姓名" />
+					</view>
+					
 				</view>
-				<view class="value">
-					<input type="text" v-model="phone"  placeholder="请填写手机号码" />
+				
+				<view class="item">
+					<view class="title">
+						<span>*</span>联系电话
+					</view>
+					<view class="value">
+						<input type="text" v-model="phone"  placeholder="请填写手机号码" />
+					</view>
+					
 				</view>
 				
 			</view>
 			
+			
+			<!-- 提交 -->
+			<button class="submit" @click="submit" >提交</button>
+			
 		</view>
-		<!-- 提交 -->
-		<button class="submit" @click="submit" >提交</button>
+		
+		
+	
 		<!-- 提交反馈 -->
 		<u-modal v-model="show" :show-title="false" :show-cancel-button="true" cancel-text="关闭" :show-confirm-button="false" >
 			<view class="modal">
@@ -51,6 +87,8 @@
 </template>
 
 <script>
+	import * as API_energyManage from '@/apis/pagejs/energyManage.js'
+	
 		import * as API from '@/apis/pagejs/managementList.js'
 	import {
 		checkPhone
@@ -60,14 +98,97 @@
 			return {
 				show:false,
 				meterId:"",
+				id:"",
 				name:"",
 				phone:"",
+				title:"",
+				step:false,
+				meterList:[],
 			}
 		},
 		onLoad(op) {
-			this.meterId=op.id
+			this.id=op.id
+			
+			this.getInformation()
 		},
 		methods: {
+			switchBtnApiMethod(node,key){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				API_energyManage.remoteSwitch({
+					meterId:node.id,
+					enabled:key
+				}).then((res) => {
+					uni.hideLoading();
+					node.switchStatus=key
+					
+				}).catch(error => {
+					
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			switchBtnApi(node,key){
+				uni.showModal({
+					confirmColor:`${key?'#3CC51F':'red'}`,
+					confirmText:`${key?'开启':'关闭'}`,
+					content: `确认是否要"${key?'开启':'关闭'}"${node.name}`,
+					title: "提示",
+					success:res=> {
+						if(res.confirm){
+							//this.switchBtnApiMethod(node,key);
+						}else{
+							node.switchStatus=!key
+						}
+					}
+				})
+				console.log(node,key)
+			},
+			getInformation(){
+				if(!this.carhelp.getOpenId()){
+					uni.showToast({
+						icon: "none",
+						title: "未获取到OpenId,请使用微信扫码"
+					})
+					return
+				}
+				
+				
+				
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				API.information({
+					id:this.id,
+					openId:this.carhelp.getOpenId(),
+				}).then((res) => {
+					this.title=res.data.information.title
+					uni.hideLoading();
+					//this.show=true
+					var info=res.data.applicationInfo;
+					
+					if(info&&info.status==1){
+						this.step=true
+						this.meterList=res.data.meterList
+						var  img=require('@/assets/img/controlCover.png')
+						var s='background:url('+img+') center  fixed;background-size:cover;';
+						console.log(s)
+						document.getElementsByTagName("uni-page")[0].style=s
+						
+					}
+					
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
 			submit(){
 				if(!this.carhelp.getOpenId()){
 					uni.showToast({
@@ -103,7 +224,7 @@
 					mask: true,
 				})
 				API.apply({
-					meterId:this.meterId,
+					id:this.id,
 					name:this.name,
 					phone:this.phone,
 					openId:this.carhelp.getOpenId(),
@@ -125,6 +246,41 @@
 </script>
 
 <style lang="scss" scoped>
+	page{
+		//background: url('@/assets/img/controlCover.png') center  fixed ;
+		//background-size:cover;
+	}
+	.main2{
+		margin: 24rpx 0;
+		.item{
+			margin: 32rpx ;
+			padding: 32rpx ; 
+			background-color: #fff;
+			border-radius: 15px;
+			
+			    display: flex;
+			    align-items: center;
+			    justify-content: space-between;
+				.item11{
+					font-size: 32rpx;
+					color: rgba(51,51,51,1);
+					font-weight: bold;
+
+				}
+				.item12{
+					font-size: 24rpx;
+
+					color:#777777 ;
+					span{
+						font-weight: bold;
+						color: rgba(51,51,51,1);
+					}
+				}
+				.item2{
+					display: flex;     align-items: center;
+				}
+		}
+	}
 	.main{
 		margin: 24rpx 0;
 		background-color: #fff;

+ 102 - 14
pages/managementList/managementList.vue

@@ -23,19 +23,19 @@
 		<!-- 列表 -->
 		<view class="member-list">
 			<view class="item" v-for="(item,i)  in list" :key="i" >
-				<view class="photo">
+				<!-- <view class="photo">
 					<img src="@/assets/img/PEokWS2@3x.png" alt="" />
-				</view>
+				</view> -->
 				<view class="infos">
 					<view class="name">
-						杨静云
+						{{item.name}}
 					</view>
 					<view class="tel">
-						19729922849
+						{{item.phone}}
 					</view>
 				</view>
 				
-				<view class="button" @click="show=true" v-if="!deleteShow">
+				<view class="button" @click="getAuthorizedUserDetails(item.id),userName=item.name" v-if="!deleteShow">
 					权限管理
 				</view>
 				<!-- 单选框 -->
@@ -99,29 +99,46 @@
 		
 		<!-- 人员权限管理 -->
 		<view>
-				<u-popup v-model="show" mode="bottom">
+				<u-popup v-model="show"  mode="bottom">
 					<view class="popup2" >
 						<view class="title">
-							杨静云-权限管理
+							{{userName}}-权限管理
 						</view>
+						<scroll-view scroll-y="true" style="height: 600rpx;" >
+							
 						
+						<u-checkbox-group style="    width: 100%;" @change="checkboxGroupChange">
 						<view class="content">
-							<view class="item" v-for="item in 3" >
+							
+							<view class="item" v-for="(item,i) in meterList"  >
 								<view class="item-title">
-									荆鹏A栋9楼总电表
+									{{item.name}}
 								</view>
 								<view class="item-radio">
-									<label class="radio">
+								<!-- 	<label class="radio">
 										<radio value="" /><text></text>
-									</label>
+									</label> -->
+									
+									<u-checkbox 
+												
+													v-model="item.checked" 
+												
+													:name="item.id"
+												></u-checkbox>
 								</view>
 							</view>
+							
+
 						</view>
+						</u-checkbox-group>
+						<u-divider border-color="#CFD2D5">
+							已经到底了</u-divider>
+						</scroll-view>
 						<view class="popup-bottom">
-							<view class="button cancel">
+							<view class="button cancel" @click="show=false">
 								取消
 							</view>
-							<view class="button save">
+							<view class="button save"  @click="submitBtn()" >
 								保存
 							</view>
 						</view>
@@ -148,7 +165,11 @@
 				
 				show:false,
 				list:[],
-				approvalListNum:0
+				approvalListNum:0,
+				meterList:[],
+				meterListIn:[],
+				userId:"",
+				userName:""
 			}
 		},
 		onReady() {
@@ -164,6 +185,72 @@
 			}
 		},
 		methods: {
+			submitBtn(){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				var meterIds="";
+				if(this.meterListIn.length){
+					meterIds=this.meterListIn.join()
+				}
+				
+				API.authorizedUserSave({
+					userId:this.userId,
+					meterIds:meterIds,
+				}).then((res) => {
+					//this.userId=id;
+					uni.hideLoading();
+					//this.meterList=res.data.meterList;
+					this.show=false
+					uni.showModal({
+						title:"提示",
+						content:"设置成功",
+						showCancel:false,
+					})
+					
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			
+			checkboxGroupChange(e){
+				console.log(e)
+				this.meterListIn=e
+			},
+			getAuthorizedUserDetails(id) {
+			
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				API.authorizedUserDetails({
+					userId:id,
+					
+				}).then((res) => {
+					this.userId=id;
+					uni.hideLoading();
+					this.meterList=res.data.meterList;
+					this.show=true
+					this.meterListIn=[]
+					for(var i in this.meterList){
+						var obj=this.meterList[i]
+						if(obj.checked){
+							this.meterListIn.push(obj)
+						}
+					}
+					
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
 			myLoadmore() {
 				this.pageIndex += 1;
 				this.getAuthorizedUserList();
@@ -442,6 +529,7 @@
 		  text-align: center;
 	  }
 	  .content{
+		  width: 100%;
 		  margin-bottom: 24rpx;
 		  .item{
 			  display: flex;