<template>
	<view class="content">
			<form >
				<view class="body user-insert-line">服务器IP：{{equipmentApply.managerId}}</view>
				<view class="body user-insert-line">设备编号：{{equipmentApply.clientId}}</view>
				<view class="body user-insert-line">归属者：{{equipmentApply.adminUserName}}</view>
				<view class="body user-insert-line">归属商家级别：{{equipmentApply.adminLevel}}</view>
				<!-- //提交按钮 -->
				<view class="tr">
					<button  type="primary" formType="submit" @click="agree(equipmentApply.id)"
						class="button">
						<p class="p1">通过</p>
					</button>
					<button  type="warn" formType="submit" @click="unagree(equipmentApply.id)" class="button">
						<p class="p1">拒绝</p>
					</button>
				</view>
			</form>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				equipmentApply:{},
			}
		},
		onLoad: function(option) {
			const equipmentApply = JSON.parse(decodeURIComponent(option.equipmentApply));
			//idCardNo
			this.equipmentApply = equipmentApply;
		},
		onShow() {
		},
		methods: {
			agree(id){
				var that = this;
				uni.showModal({
					title: '提示',
					content: '是否通过？',
					success: function(res) {
						if (res.confirm) {
							var token = uni.getStorageSync("token");
							uni.request({
								url: that.serverurl + '/TEquipmentApply/agree',
								header: {
									'token': token
								},
								data:{
									"id":id
								},
								method: "POST",
								success: (res) => {
									uni.showToast({
										title: res.data.message,
										duration: 2000
									});
								},
							});
						} else if (res.cancel) {}
					}
				});
			},
			unagree(id){
				var that = this;
				uni.showModal({
					title: '提示',
					content: '是否拒绝？',
					success: function(res) {
						if (res.confirm) {
							var token = uni.getStorageSync("token");
							var eid = id;
							uni.request({
								url: that.serverurl + '/TEquipmentApply/unagree',
								data:{
									"id":eid
								},
								header: {
									'token': token
								},
								
								method: "POST",
								success: (res) => {
									uni.showToast({
										title: res.data.message,
										duration: 2000
									});
								},
							});
						} else if (res.cancel) {}
					}
				});
			},
		}
	}
	
</script>

<style>
	.content{
			padding-top:20upx;
			margin-left:20upx;
	}
	.body {
		background-color: #FFFFFF;
		padding: 10upx 20upx 10upx 20upx;
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
	}

	.input {
		/* padding: 10upx 20upx 10upx 0upx; */
		padding-left: 20upx;
		padding-top: 10upx;
		background-color: #FFFFFF;
		width: 500upx;
		height: 50upx;
		box-shadow: 0upx 0upx 20upx #D3D3D3;
		border-radius: 5upx;
	}

/* 	.button {
		margin: 0 auto;
		display: inline-block;
	}

	button[type=primary] {
	    background-color: #007aff;
	    color: #fff;
		display: inline-block;
	}	 */
	.btn-area{
		padding-top:60upx;
		margin: 0 auto;
		width: 50%;
	}
	.user-insert-line {
	  width: 600upx;
	  height: 23px;
	  border-bottom:solid black 1px;
	  margin: 0 auto;
	}
	.user-insert{
		width: 400upx;
		margin: 0 auto;
	}
	.tr {
		padding-top: 15upx;
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		font-size: 48upx;
		font-family: "PingFang-SC-Bold";
		position: fixed;
		bottom: 100upx;
		width: 95%;
	}
	
	.button {
		margin: auto;
		width: 50%;
		height: 100upx;
	}
	
	.p1 {
		font-size: 48upx;
	}
	view{
		font-size: 30rpx;
	}
</style>
