<template>
	<view class="check">
		<uni-forms ref="form" :model="datainfo">
			<view class="cbox">
				<view class="chtop flexc">
					<image :src="line"></image>
					<view>房屋信息</view>
				</view>
				<view class="chmain">
					<uni-forms-item label="房屋坐落" name="location">
						<view class="flexc">
							<uni-easyinput v-model="datainfo.location" :disabled="isdisabled" :inputBorder='false' placeholder="请输入房屋坐落" />
							<view class="rimg"></view>
						</view>
					</uni-forms-item>
					
					<uni-forms-item label="房屋所属" name="rightType">
						<view class="flexc">
							<uni-easyinput v-model="datainfo.rightType" :disabled="isdisabled" :inputBorder='false' placeholder="请输入房屋所属" />
							<view class="rimg"></view>
						</view>
					</uni-forms-item>
					<uni-forms-item label="建筑面积" name="area">
						<view class="flexc">
							<uni-easyinput v-model="datainfo.area" :disabled="isdisabled" :inputBorder='false' placeholder="请输入建筑面积" />
							<view class="tips">m²</view>
							<view class="rimg"></view>
						</view>
					</uni-forms-item>
					<!-- <uni-forms-item label="建筑面积" name="area">
						<picker range-key='dictLabel' :value="yglbidx" :range="yglbList"   @change='bindDateChange'>
							<view class="flexc">
								<view class="flex1 txr f13 co27" v-if="datainfo.staffCategory&&!yglb">{{statusFormats(datainfo.staffCategory,yglbList,'yglb')}}</view>
								<view class="flex1 txr f13" v-else :class="yglb?'co27':'coa'">{{yglb||"请选择员工类别"}}</view>
								<view class="rimg"><image :src="rimg"></image></view>
							</view>
						</picker>
					</uni-forms-item> -->
					<uni-forms-item label="房型" name="realName">
						<view class="flexjd">
							<picker range-key='dictLabel' :disabled="isdisabled" :value="syqxidx" :range="sexs"   @change='bindDateChange'>
								<view class="flexc ml10">
									<view class="flex1 txr f13" :class="datainfo.iszc?'co27':'coa'">{{datainfo.iszc?'是':'请选择'}}</view>
									<view class="tips">室</view>
								</view>
							</picker>
							<picker range-key='dictLabel' :disabled="isdisabled" :value="syqxidx" :range="sexs"   @change='bindDateChange'>
								<view class="flexc ml10">
									<view class="flex1 txr f13" :class="datainfo.iszc?'co27':'coa'">{{datainfo.iszc?'是':'请选择'}}</view>
									<view class="tips">厅</view>
								</view>
							</picker>
							<view class="rimg"></view>
						</view>
					</uni-forms-item>
					<uni-forms-item label="居住人口" name="realName">
						<picker range-key='dictLabel' :disabled="isdisabled" :value="syqxidx" :range="sexs"   @change='bindDateChange'>
							<view class="flexc">
								<view class="flex1 txr f13" :class="datainfo.iszc?'co27':'coa'">{{datainfo.iszc?'是':'请选择居住人口'}}</view>
								<view class="rimg"><image :src="rimg"></image></view>
							</view>
						</picker>
					</uni-forms-item>
					<uni-forms-item label="有无车位" name="hasParkingSpace">
						<picker range-key='dictLabel' :disabled="isdisabled" :value="syqxidx" :range="sexs"   @change='bindDateChange'>
							<view class="flexc">
								<view class="flex1 txr f13" :class="datainfo.hasParkingSpace?'co27':'coa'">{{datainfo.hasParkingSpace?'是':'请选择有/无'}}</view>
								<view class="rimg"><image :src="rimg"></image></view>
							</view>
						</picker>
					</uni-forms-item>
					<uni-forms-item label="车位号" name="phonenumber">
						<view class="flexc">
							<uni-easyinput :disabled="isdisabled" v-model="datainfo.phonenumber" :inputBorder='false' placeholder="请输入车位号" />
							<view class="rimg"></view>
						</view>
					</uni-forms-item>
				</view>
			</view>
		</uni-forms>
		<view class="pdlr12 mt55">
			<view class="rhbtn" @click="getNext">确定添加</view>
		</view>

		<loading></loading>
	</view>
</template>

<script>
	import config from '@/config'
	import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
	import {uploadIdentify} from '@/utils/common.js'
	import {houseInfoAdd,houseInfoPut,houseInfoDet} from "@/api/work/people.js"
	import {getDictionaryFn} from "@/api/system/user.js"
	import {selectValueKey} from "@/utils/common.js"
	export default {
		components: {},
		data() {
			return {
				line: require('@/car/static/car/line.png'),
				car: require('@/car/static/car/carico.png'),
				rimg: require('@/people/static/people/rimg.png'),
				aphoto: require('@/people/static/people/aphoto.png'),
				check: require('@/people/static/people/check.png'),
				ncheck: require('@/people/static/people/ncheck.png'),
				baseUrl: config.baseUrl,
				checkflag:true,
				datainfo: {
					// "houseId":"",//房屋信息主键
					 "ownerName":"",////权利人姓名
					 "location":"",//房屋坐落位置
					 "rightType":"",//权利类型，如所有权、使用权等
					 "area":"",//房屋面积，单位为平方米
					 "documentNumber":"",//房屋相关的字第号
					 "propertyUnitNumber":"",//不动产单元号
					 "coOwnership":"",//房屋的共有情况，如共有比例等
					 "usageType":"",//房屋用途，如住宅、商业等
					 "usagePeriod":"",//房屋使用期限
					 "registrationDate":"",//房屋登记日期
					 "coOwner":"",//共有人姓名，多个共有人可以用逗号分隔
					 "detailedAddress":"",//房屋的详细门牌号
					 "hasParkingSpace":"",//是否有车位，Y表示有，N表示无
					 "communityName":"",//房屋所在小区名称
					 "houseStatus":""//房屋状态：1-自住，2-出租，3-空闲，4-待售
				},
				cwlist:[{dictLabel:'有',dictValue:"Y"},{dictLabel:'无',dictValue:"N"}],
				id:'',
				fwztidx:'',
				fwztList:[],
				qllxList:[],
				fwytList:[],
				isdisabled:false,
			}
		},
		onLoad: function() {

		},
		methods: {
			checkPermi,
			checkRole,
			init(){
				// 房屋状态
				getDictionaryFn('house_status').then(res=>{
					if(res.code==200){
						this.fwztList = res.data.map(v => {
							return {
								dictLabel: v.dictLabel,
								dictValue: v.dictValue
							}
						})
					}
				})
				//权利类型
				getDictionaryFn('types_rights').then(res=>{
					if(res.code==200){
						this.qllxList = res.data.map(v => {
							return {
								dictLabel: v.dictLabel,
								dictValue: v.dictValue
							}
						})
					}
				})
				//房屋用途
				getDictionaryFn('use_remises').then(res=>{
					if(res.code==200){
						this.fwytList = res.data.map(v => {
							return {
								dictLabel: v.dictLabel,
								dictValue: v.dictValue
							}
						})
					}
				})
			},
			bindDateChange(e){
				var val=e.detail.value;
				// this.datainfo.applicationBank=this.sdyhlist[val].value;
				// this.applicationBank=this.sdyhlist[val].label;
			},
			getOcrIdCard(obj) {
				var params = {
					image: obj.url,
					idCardSide: obj.type
				}
				getOcrIdCard(params).then(res => {
					if (res.code == 200) {
						var datainfo = res.data;
						if (obj.type == 'front') {
							this.datainfo.realName = datainfo.realName;
							this.datainfo.idCard = datainfo.idCard;
							this.datainfo.address = datainfo.address;
						} else {
							this.datainfo.expirationDate = datainfo.expirationDate
						}
					}
				})
			}
		}
	}
</script>
<style>
	page{background: #F3F3F0;}
</style>
<style lang="scss" scoped>
.check /deep/ .uni-forms-item{min-height: 106rpx;box-sizing: border-box;display: flex;align-items: center;margin-bottom: 0;border-bottom: 2rpx solid #E6E6E6;padding:10rpx 0;}
.check .cbox /deep/ .uni-forms-item:last-child{border: none;}
.check /deep/ .uni-forms-item__label{font-weight: bold;font-size: 26rpx;color: #222327;flex: 0 0 auto;width: auto !important;}
.check /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 26rpx;color: #222327;}
.check /deep/ .uni-easyinput__content-textarea{min-height: 40rpx;font-size: 26rpx;}
.check /deep/ .uni-easyinput__placeholder-class{font-size: 26rpx;color: #AAAAAA;}
.check /deep/ .uni-input-input{font-size: 26rpx;}
.check /deep/ .uni-textarea-textarea{font-size: 26rpx;}
.check /deep/ .is-disabled{color: #222327;background-color: #ffffff !important;}
.check /deep/ .uni-data-checklist .checklist-group .checklist-box{margin:10rpx 8rpx 10rpx 16rpx;}
.check /deep/ .uni-forms-item__label text{width: 110rpx;text-align-last: justify;}
.check /deep/ .uni-data-checklist{flex: 0 0 auto;}
.check{min-height: 100vh;padding: 20rpx 18rpx 24rpx;box-sizing: border-box;}
.cbox{background: #FFFFFF;border-radius: 20rpx;flex: 1;margin-bottom: 24rpx;
	.chtop{padding-top: 32rpx;margin-bottom: 8rpx;
		image{width: 14rpx;height: 48rpx;margin-right: 20rpx;}
		view{font-weight: bold;font-size: 32rpx;color: #272727;}
	}
	.chmain{
		padding: 0 32rpx;
		.upbox{height: 224rpx;background: #EFF4FF;border-radius: 20rpx;display: flex;align-items: center;justify-content: center;flex-direction: column;margin-bottom: 8rpx;overflow: auto;
			.img{width: 100%;height: 100%;}
			.addimg{width: 70rpx;height: 70rpx;margin-bottom: 16rpx;}
			view{font-weight: bold;font-size: 26rpx;color: #4C6686;}
		}
		.rimg{width: 16rpx;height: 28rpx;flex: 0 0 auto;margin-left: 20rpx;
			image{width: 100%;height: 100%;}
		}
		.checkimg{width: 80rpx;height: 40rpx;margin-right: 8rpx;}
		.aphoto{padding: 0 24rpx;border-left: 2rpx solid #e6e6e6;margin-left: 26rpx;
			image{width: 40rpx;height: 38rpx;}
		}
	}
	
}
.tips{font-weight: bold;color: #272727;font-size: 26rpx;margin-left: 8rpx;}
</style>
