<template>
	<view class="se-p-40 se-bgc-white">
		<uv-form labelPosition="left" :model="form" :rules="rules" ref="form" labelWidth="60" labelStyle="font-size:26rpx;">
			<uv-form-item label="标题" prop="title" >
				<uv-input v-model="form.title" type="text" placeholder="请输入标题" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="价格" prop="price">
				<uv-input v-model="form.price" type="text" placeholder="请输入价格" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="户主年龄" prop="homeAge">
				<uv-input v-model="form.homeAge" type="text" placeholder="请输入户主年龄" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="户型" prop="house">
				<uv-input v-model="form.house" type="text" placeholder="请输入户型" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="房屋面积" prop="proportion">
				<uv-input v-model="form.proportion" type="text" placeholder="请输入房屋面积" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="房屋结构" prop="homeJg">
				<uv-input v-model="form.homeJg" type="text" placeholder="请输入房屋结构" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="交通" prop="homeJt">
				<uv-input v-model="form.homeJt" type="text" placeholder="请输入交通" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="面积" prop="homeMi">
				<uv-input v-model="form.homeMi" type="text" placeholder="请输入面积" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="所属位置" prop="address" @click="handleAreaChange()">
				<uv-input v-model="form.address" @click="handleAreaChange()" disabled disabledColor="#ffffff" placeholder="选择所在位置" border="none">
				</uv-input>
				<template v-slot:right>
					<uv-icon name="arrow-right"></uv-icon>
				</template>
			</uv-form-item>
			<uv-form-item label="分类标识" prop="classId" @click="handleClass()">
				<uv-input v-model="form.className" @click="handleClass()" disabled disabledColor="#ffffff" placeholder="选择分类标识" border="none">
				</uv-input>
				<template v-slot:right>
					<uv-icon name="arrow-right"></uv-icon>
				</template>
			</uv-form-item>
			
			<uv-form-item label="所属分类" prop="commonId" @click="handleCommon()">
				<uv-input v-model="form.commonName" @click="handleCommon()" disabled disabledColor="#ffffff" placeholder="选择所属分类" border="none">
				</uv-input>
				<template v-slot:right>
					<uv-icon name="arrow-right"></uv-icon>
				</template>
			</uv-form-item>
			<uv-form-item label="编号" prop="number">
				<uv-input v-model="form.number" type="text" placeholder="请输入编号" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="房屋周边" prop="perimeter">
				<uv-input v-model="form.perimeter" type="text" placeholder="请输入房屋周边" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="房屋朝向及海拔" prop="homeHb">
				<uv-input v-model="form.homeHb" type="text" placeholder="请输入房屋朝向及海拔" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="距离场镇距离" prop="homeJl">
				<uv-input v-model="form.homeJl" type="text" placeholder="请输入距离场镇距离" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="户主家庭职业" prop="homeJtzy">
				<uv-input v-model="form.homeJtzy" type="text" placeholder="请输入户主家庭职业" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			
			<uv-form-item label="标签" prop="iconTitle">
				<uv-input v-model="form.iconTitle" type="text" placeholder="请输入标签用逗号隔开" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="房间数量" prop="housesNumber">
				<uv-number-box v-model="form.housesNumber" :min="1" :max="10"></uv-number-box>
			</uv-form-item>
			<uv-form-item label="房屋主体是否改造"  prop="revamp">
				<uv-radio-group v-model="form.revamp" placement="row">
					<uv-radio name="1" label="是"></uv-radio>
					<uv-radio name="0" customStyle="margin-left:30rpx;" label="否"></uv-radio>
				</uv-radio-group>
			</uv-form-item>
			<uv-form-item label="是否经过安置"  prop="resettle">
				<uv-radio-group v-model="form.resettle" placement="row">
					<uv-radio name="1" label="是"></uv-radio>
					<uv-radio name="0" customStyle="margin-left:30rpx;" label="否"></uv-radio>
				</uv-radio-group>
			</uv-form-item>
			<uv-form-item label="院子总面积"   prop="yardProportion">
				<uv-input v-model="form.yardProportion" type="text" placeholder="请输入院子总面积" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="坟包及电塔工厂噪音"  prop="noise">
				<uv-input v-model="form.noise" type="text" placeholder="请输入坟包及电塔工厂噪音" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			
			<uv-form-item label="菜地" prop="homeCai">
				<uv-input v-model="form.homeCai" type="text" placeholder="请输入菜地" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="水电气网" prop="net">
				<uv-input v-model="form.net" type="text" placeholder="请输入水电气网" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="距离成都西三环" prop="homeShjl">
				<uv-input v-model="form.homeShjl" type="text" placeholder="请输入距离成都西三环" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			
			<uv-form-item label="停车" prop="park">
				<uv-input v-model="form.park" type="text" placeholder="请输入停车" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="付款方式及押金" prop="deposit">
				<uv-input v-model="form.deposit" type="text" placeholder="请输入押金" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="天府市民云房屋信息档案查询" prop="archival">
				<uv-input v-model="form.archival" type="text" placeholder="请输入天府市民云房屋信息档案查询" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="租期" prop="tenancy">
				<uv-input v-model="form.tenancy" type="text" placeholder="请输入租期" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="邻居对房东的评价" prop="evaluate">
				<uv-input v-model="form.evaluate" type="text" placeholder="请输入邻居对房东的评价" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="非正常死亡" prop="death">
				<uv-input v-model="form.death" type="text" placeholder="请输入非正常死亡" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="钥匙" prop="key">
				<uv-radio-group v-model="form.key" placement="row">
					<uv-radio name="1" label="有"></uv-radio>
					<uv-radio name="0" customStyle="margin-left:30rpx;" label="无"></uv-radio>
				</uv-radio-group>
				<!-- <uv-input v-model="form.key" type="text" placeholder="请输入钥匙" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input> -->
			</uv-form-item>
			<uv-form-item label="佣金" prop="commission">
				<uv-input v-model="form.commission" type="text" placeholder="请输入佣金" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="年限" prop="timeGo">
				<uv-input v-model="form.timeGo" type="text" placeholder="请输入年限" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="浏览量" prop="num">
				<uv-input v-model="form.num" type="text" placeholder="请输入浏览量" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="单位" prop="unit">
				<uv-input v-model="form.unit" type="text" placeholder="请输入单位" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="报建手续" prop="procedures">
				<uv-input v-model="form.procedures" type="text" placeholder="请输入报建手续" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item label="产权证照片" labelWidth="250" prop="isOwnershipList" labelPosition="top">
				<uv-upload customStyle="margin-top:20rpx;" :fileList="form.ownershipList" @afterRead="afterOwnershipRead" @delete="deleteOwnershipPic" name="1"
					multiple :maxCount="10"></uv-upload>
			</uv-form-item>
			<uv-form-item label="房屋照片" labelWidth="250" prop="isHouseList" labelPosition="top">
				<uv-upload customStyle="margin-top:20rpx;" :fileList="form.houseList" @afterRead="afterHouseRead" @delete="deleteHousePic" name="1"
					multiple :maxCount="10"></uv-upload>
			</uv-form-item>
			<uv-form-item label="视频" labelWidth="250" prop="isMp4List" labelPosition="top">
				<uv-upload customStyle="margin-top:20rpx;" accept="media" :fileList="form.mp4List" @afterRead="aftermp4Read" @delete="deletemp4Pic" name="1"
					multiple :maxCount="1"></uv-upload>
			</uv-form-item>
			<uv-form-item label="备注" prop="remark" labelPosition="top">
				<uv-input v-model="form.remark" type="text" placeholder="请输入备注" customStyle="border-radius: 5px;margin-top:5px;background-color: #f5f5f5;padding:5px 10px;"></uv-input>
			</uv-form-item>
			<uv-form-item>
				<uv-button type="primary" text="确认发布" customStyle="margin-top: 30px;background-color: #1EC77A;border-radius: 30px;" @click="submit"></uv-button>
			</uv-form-item>
		</uv-form>
		<!-- 地址 -->
		<citySelect ref="citySelectRef" :zIndex="0" @city-change="handleCityChange"></citySelect>
		<!-- 选择分类 -->
		<uv-picker ref="picker" :columns="columns" @confirm="confirm"></uv-picker>
		<uv-picker ref="pickerCommon" :columns="commonColumns" @confirm="commonConfirm"></uv-picker>
	</view>
</template>

<script>
	import { saveOrUpdateHouse,houseDetail,houseType,commonIndexIndexIcon } from "@/common/api.js"
	import citySelect from "@/components/cityselect/index.vue"
	import QQMapWX from "@/util/qqmap-wx-jssdk.min.js"
	export default{
		components:{
			citySelect
		},
		data(){
			return{
				id:"",
				houseTypeList:[],
				columns:[],
				commonColumns:[],
				form:{
					// title:"这是标题",//标题
					// price:"32.34",//价格
					// house:"这是户型",//户型
					// proportion:"89",//面积
					// address:"湖南长沙岳麓区",//所属位置
					// number:"2006",//编号
					// perimeter:"商场,地铁",//房屋周边
					// iconTitle:"商场,地铁,学校",//标签
					// housesNumber:1,//房间数量
					// revamp:0,//房屋主体是否改造
					// resettle:0,//是否经过安置
					// yardProportion:"无",//院子总面积
					// noise:"大",//噪音
					// net:"有",//水电气网
					// park:"有一个停车位",//停车
					// deposit:"1200",//押金
					// archival:"档案查询",//档案查询
					// tenancy:"租期",//租期
					// evaluate:"评价",//评价
					// death:"非正常死亡",//非正常死亡
					// key:"1",//钥匙
					// commission:"230",//佣金
					// timeGo:"",//年限
					// procedures:"20",//手续
					// isOwnershipList:"1",
					// ownershipList:[
					// 	{
					// 		url:"https://tennis-oss.xzaiyp.top/2024-12-04/61d46ae3-bf72-430f-8046-698b92b18f81.jpg"
					// 	},
					// 	{
					// 		url:"https://tennis-oss.xzaiyp.top/2024-12-04/3987c047-1c50-43e4-940d-9ce96cd06225.jpg"
					// 	}
					// ],
					// isHouseList:"1",
					// houseList:[
					// 	{
					// 		url:"https://tennis-oss.xzaiyp.top/2024-12-04/61d46ae3-bf72-430f-8046-698b92b18f81.jpg"
					// 	},
					// 	{
					// 		url:"https://tennis-oss.xzaiyp.top/2024-12-04/3987c047-1c50-43e4-940d-9ce96cd06225.jpg"
					// 	}
					// ],
					// isMp4List:"1",
					// mp4List:[],
					// remark:""
					
					title:"",//标题
					classId:"",//分类
					className:"",//分类名称
					commonId:"",//
					commonName:"",//
					price:"",//价格
					house:"",//户型
					proportion:"",//面积
					homeJg:"",//房屋结构
					address:"",//所属位置
					number:"",//编号
					perimeter:"",//房屋周边
					homeCai:"",//菜地
					homeHb:"",//房屋朝向及海拔
					homeJl:"",//距离场镇距离
					iconTitle:"",//标签
					housesNumber:1,//房间数量
					revamp:0,//房屋主体是否改造
					resettle:0,//是否经过安置
					yardProportion:"",//院子总面积
					noise:"",//噪音
					net:"",//水电气网
					homeJt:"",//交通
					park:"",//停车
					deposit:"",//押金
					archival:"",//档案查询
					tenancy:"",//租期
					evaluate:"",//评价
					unit:"",//单位
					death:"",//非正常死亡
					key:"1",//钥匙
					commission:"",//佣金
					timeGo:"",//年限
					procedures:"",//手续
					isOwnershipList:"",
					ownershipList:[],
					isHouseList:"",
					houseList:[],
					isMp4List:"",
					mp4List:[],
					remark:"",
					num:"",
					longitude:"",//经度
					latitude:"",//纬度
				},
				rules:{
					title:[
						{
							type: 'string',
							required: true,
							message: '请输入账号',
							trigger: ['blur', 'change']
						}
					],
					classId:[
						{
							type: 'string',
							required: true,
							message: '请选择分类',
							trigger: ['blur', 'change']
						}
					],
					commonId:[
						{
							type: 'string',
							required: true,
							message: '请选择所属分类',
							trigger: ['blur', 'change']
						}
					],
					homeAge:[
						{
							type: 'string',
							required: true,
							message: '请输入户主年龄',
							trigger: ['blur', 'change']
						}
					],
					price:[
						{
							type: 'string',
							required: true,
							message: '请输入价格',
							trigger: ['blur', 'change']
						}
					],
					house:[
						{
							type: 'string',
							required: true,
							message: '请输入户型',
							trigger: ['blur', 'change']
						}
					],
					unit:[
						{
							type: 'string',
							required: true,
							message: '请输入单位',
							trigger: ['blur', 'change']
						}
					],
					homeCai:[
						{
							type: 'string',
							required: true,
							message: '请输入菜地',
							trigger: ['blur', 'change']
						}
					],
					proportion:[
						{
							type: 'string',
							required: true,
							message: '请输入面积',
							trigger: ['blur', 'change']
						}
					],
					homeJg:[
						{
							type: 'string',
							required: true,
							message: '请输入房屋结构',
							trigger: ['blur', 'change']
						}
					],
					number:[
						{
							type: 'string',
							required: true,
							message: '请输入编号',
							trigger: ['blur', 'change']
						}
					],
					perimeter:[
						{
							type: 'string',
							required: true,
							message: '请输入房屋周边',
							trigger: ['blur', 'change']
						}
					],
					homeJl:[
						{
							type: 'string',
							required: true,
							message: '请输入距离场镇距离',
							trigger: ['blur', 'change']
						}
					],
					iconTitle:[
						{
							type: 'string',
							required: true,
							message: '请输入标签用，隔开',
							trigger: ['blur', 'change']
						}
					],
					yardProportion:[
						{
							type: 'string',
							required: true,
							message: '请输入院子总面积',
							trigger: ['blur', 'change']
						}
					],
					noise:[
						{
							type: 'string',
							required: true,
							message: '请输入坟包及电塔工厂噪音',
							trigger: ['blur', 'change']
						}
					],
					net:[
						{
							type: 'string',
							required: true,
							message: '请输入水电气网',
							trigger: ['blur', 'change']
						}
					],
					homeHb:[
						{
							type: 'string',
							required: true,
							message: '请输入房屋朝向及海拔',
							trigger: ['blur', 'change']
						}
					],
					num:[
						{
							type: 'string',
							required: true,
							message: '请输入浏览量',
							trigger: ['blur', 'change']
						}
					],
					homeJt:[
						{
							type: 'string',
							required: true,
							message: '请输入交通',
							trigger: ['blur', 'change']
						}
					],
					homeJtzy:[
						{
							type: 'string',
							required: true,
							message: '请输入户主家庭职业',
							trigger: ['blur', 'change']
						}
					],
					park:[
						{
							type: 'string',
							required: true,
							message: '请输入停车',
							trigger: ['blur', 'change']
						}
					],
					deposit:[
						{
							type: 'string',
							required: true,
							message: '请输入押金',
							trigger: ['blur', 'change']
						}
					],
					homeShjl:[
						{
							type: 'string',
							required: true,
							message: '请输入距离成都西三环',
							trigger: ['blur', 'change']
						}
					],
					archival:[
						{
							type: 'string',
							required: true,
							message: '请输入天府市民云房屋信息档案查询',
							trigger: ['blur', 'change']
						}
					],
					tenancy:[
						{
							type: 'string',
							required: true,
							message: '请输入租期',
							trigger: ['blur', 'change']
						}
					],
					evaluate:[
						{
							type: 'string',
							required: true,
							message: '请输入邻居对房东的评价',
							trigger: ['blur', 'change']
						}
					],
					death:[
						{
							type: 'string',
							required: true,
							message: '请输入非正常死亡',
							trigger: ['blur', 'change']
						}
					],
					num:[
						{
							type: 'string',
							required: true,
							message: '请输入浏览量',
							trigger: ['blur', 'change']
						}
					],
					key:[
						{
							type: 'string',
							required: true,
							message: '请输入钥匙',
							trigger: ['blur', 'change']
						}
					],
					commission:[
						{
							type: 'string',
							required: true,
							message: '请输入佣金',
							trigger: ['blur', 'change']
						}
					],
					timeGo:[
						{
							type: 'string',
							required: true,
							message: '请输入年限',
							trigger: ['blur', 'change']
						}
					],
					procedures:[
						{
							type: 'string',
							required: true,
							message: '请输入报建手续',
							trigger: ['blur', 'change']
						}
					],
				}
			}
		},
		watch: {
			'form.ownershipList'(newValue, oldValue) {
			    if (newValue.length > 0) {
			    	this.form.isOwnershipList = '有'
			    } else {
			    	this.form.isOwnershipList = ''
			    }
			},
			'form.houseList'(newValue, oldValue) {
			    if (newValue.length > 0) {
			    	this.form.isHouseList = '有'
			    } else {
			    	this.form.isHouseList = ''
			    }
			},
			'form.mp4List'(newValue, oldValue) {
			    if (newValue.length > 0) {
			    	this.form.isMp4List = '有'
			    } else {
			    	this.form.isMp4List = ''
			    }
			}
		},
		onReady() {
			this.$refs.form.setRules(this.rules)
		},
		onLoad(options) {
			let that = this
			that.id = options.id
			that.onHouseType()
			that.onCommonIndexIndexIcon()
			if(options.id){
				houseDetail({houseId:options.id}).then(response=>{
					let form = response.result
					
					console.info('responseform',form)
					that.form={
						userId: uni.getStorageSync('userInfo').id,
						id:form.id,
						classId:form.classId,//分类标识
						className:"",//分类标识名称
						commonClass:form.commonId,//
						commonName:"",//
						
						// commonClass:"",//所属分类
						address:form.address,//地址
						homeAge:form.homeAge,//户主年龄
						resettle:form.homeAz,//是否经过安置
						perimeter:form.homeBian,//房屋周边
						procedures:form.homeBjsx,//报建手续
						homeCai:form.homeCai,//菜地
						park:form.homeCat,//停车
						revamp:form.homeGz,//房屋主体是否改造
						homeHb:form.homeHb,//房屋朝向及海拔
						remark:form.homeBz,//备注
						homeJg:form.homeJg,//房屋结构
						homeJl:form.homeJl,//距离场镇距离
						homeJt:form.homeJt,//交通
						homeJtzy:form.homeJtzy,//户主家庭职业
						homeMi:form.homeMi,//面积
						proportion:form.homeMj,//房屋面积
						commission:String(form.homeMoney),//佣金
						number:String(form.homeNo),//房屋编号
						housesNumber:String(form.homeNum),//房间数量
						deposit:String(form.homePay),//付款方式及押金
						evaluate:form.homePj,//邻居对房东评价
						net:form.homeSd,//水电气网
						homeShjl:form.homeShjl,//距离成都西三环
						death:form.homeSw,//非正常死亡
						archival:form.homeTf,//府市民云房屋信息档案查询
						tenancy:form.homeTime,//租期
						house:form.homeType,//户型
						key:String(form.homeYs),//钥匙
						yardProportion:form.homeYzmj,//院子总面积
						noise:form.homeZy,//坟包及电塔 工厂噪音
						// iconName:"",//热点名称
						iconTitle:form.iconTitle,//标签
						num:form.num,//浏览量
						price:String(form.price) ,//价格
						timeGo:String(form.timeGo),//年限
						title:form.title,//标题
						unit:form.unit,//单位
						latitude:form.latitude,
						longitude:form.longitude,
						ownershipList:that.stringToKeyValueArray(form.image),//图片
						// iconImage:"",//左上角图标
						houseList:that.stringToKeyValueArray(form.homeImage),//产权证照片
						homeMp4:"",//视频
					}
					that.onHouseType()
					that.onCommonIndexIndexIcon()
				}).catch(error=>{
					
				})
			}
		},
		mounted() {
			
		},
		methods:{
			onHouseType(){
				let that = this
				houseType({}).then(response=>{
					let arr=[]
					that.houseTypeList = response.result
					response.result.forEach(items=>{
						arr.push(items.title)
						if(items.id==that.form.commonClass){
							that.form.commonName = items.title
						}
					})
					that.columns[0]=arr
				}).catch(error=>{
					
				})
			},
			onCommonIndexIndexIcon(){
				let that = this
				commonIndexIndexIcon({}).then(response=>{
					let arr=[]
					that.commonIconList = response.result
					response.result.forEach(items=>{
						arr.push(items.title)
						if(items.id==that.form.classId){
							that.form.className = items.title
						}
					})
					that.commonColumns[0]=arr
				}).catch(error=>{
					
				})
			},
			stringToKeyValueArray(str, delimiter1 = ',') {
				console.info(str)
				if(str){
					let arro = str.split(delimiter1);
					console.info('arro',arro)
					let arr = [];
					arro.forEach(items=>{
						let obj = {};
						obj["url"] = items
						arr.push(obj)
					})
					console.info(arr)
					return arr
				}else{
					return []
				}
				
			},
			deleteHousePic(event) {
				this.form.houseList.splice(event.index, 1)
			},
			async afterHouseRead(e) {
				let self = this
				e.file.forEach(file => {
					self.$Oss.ossUpload(file.url).then(url => {
						self.form.houseList.push({
							url
						})
					})
				})
			},
			deleteOwnershipPic(event) {
				this.form.ownershipList.splice(event.index, 1)
			},
			async afterOwnershipRead(e) {
				let self = this
				e.file.forEach(file => {
					self.$Oss.ossUpload(file.url).then(url => {
						self.form.ownershipList.push({
							url
						})
					})
				})
			},
			deletemp4Pic(event) {
				this.form.mp4List.splice(event.index, 1)
			},
			async aftermp4Read(e) {
				let self = this
				e.file.forEach(file => {
					self.$Oss.ossUpload(file.url).then(url => {
						self.form.mp4List.push({
							url
						})
					})
				})
			},
			handleClass(){
				this.$refs.picker.open();
			},

			confirm(e) {
				let that = this
				let {indexs,value,values} = e
				that.form.classId = that.houseTypeList[indexs[0]].id;
				that.form.className = that.houseTypeList[indexs[0]].title;
			},
			handleCommon(){
				this.$refs.pickerCommon.open();
			},
			commonConfirm(e){
				let that = this
				let {indexs,value,values} = e
				that.form.commonId = that.commonIconList[indexs[0]].id;
				that.form.commonName = that.commonIconList[indexs[0]].title;
			},
			handleAreaChange(){
				const that = this;
				wx.chooseLocation({
					// type: 'wgs84',
					success: function (res) {
						
						console.log('当前位置的经度：', res);
						console.log('当前位置的纬度：' + res.latitude);
						
						
						that.form.longitude = res.longitude
						that.form.latitude = res.latitude
						that.form.address = res.address
						
						// const qqmapsdk = new QQMapWX({
						// 	key: 'TT7BZ-Z3LW4-KOAUB-KWHOA-SBJJ6-Y5B6R' // 必填
						// });
						// uni.showLoading({
						// 	title:"获取中...."
						// })
						// qqmapsdk.reverseGeocoder({
						// 	location: {
						// 		latitude: res.latitude,
						// 		longitude: res.longitude
						// 	},
						// 	success: function(response) {
						// 		console.log('逆地理编码结果：', response);
						// 		uni.hideLoading()
						// 		that.form.longitude = response.result.location.lng
						// 		that.form.latitude = response.result.location.lat
						// 		that.form.address = response.result.address
						// 	},
						// 	fail: function(error) {
						// 		uni.hideLoading()
						// 		console.error('逆地理编码失败：', error);
						// 	}
						// });
					}
				})
				// this.$refs.citySelectRef.open()
			},
			handleCityChange(e) {
				this.form.address = e.province.label + '-' + e.city.label + '-' + e.area.label;
			},
			submit() {
				
				// price:"",//价格
				// house:"",//户型
				// proportion:"",//面积
				// address:"",//所属位置
				// number:"",//编号
				// perimeter:"",//房屋周边
				// housesNumber:1,//房间数量
				// revamp:0,//房屋主体是否改造
				// resettle:0,//是否经过安置
				// yardProportion:"",//院子总面积
				// noise:"",//噪音
				// net:"",//水电气网
				// park:"",//停车
				// deposit:"",//押金
				// archival:"",//档案查询
				// tenancy:"",//租期
				// evaluate:"",//评价
				// death:"",//非正常死亡
				// key:"",//钥匙
				// commission:"",//佣金
				// procedures:"",//手续
				// isOwnershipList:"",
				// ownershipList:[],
				// isHouseList:"",
				// houseList:[],
				// remark:""
				let that = this
				that.$refs.form.validate().then(res => {
					
					let params={
						userId:"",
						id:that.form.id,
						classId:that.form.classId,//分类标识
						commonClass:that.form.commonId,//所属分类
						address:that.form.address,//地址
						homeAge:that.form.homeAge,//户主年龄
						homeAz:that.form.resettle,//是否经过安置
						homeBian:that.form.perimeter,//房屋周边
						homeBjsx:that.form.procedures,//报建手续
						homeCai:that.form.homeCai,//菜地
						homeCat:that.form.park,//停车
						homeGz:that.form.revamp,//房屋主体是否改造
						homeHb:that.form.homeHb,//房屋朝向及海拔
						homeBz:that.form.remark,//备注
						homeJg:that.form.homeJg,//房屋结构
						homeJl:that.form.homeJl,//距离场镇距离
						homeJt:that.form.homeJt,//交通
						homeJtzy:that.form.homeJtzy,//户主家庭职业
						homeMi:that.form.homeMi,//面积
						homeMj:that.form.proportion,//房屋面积
						homeMoney:that.form.commission,//佣金
						homeNo:that.form.number,//房屋编号
						homeNum:that.form.housesNumber,//房间数量
						homePay:that.form.deposit,//付款方式及押金
						homePj:that.form.evaluate,//邻居对房东评价
						homeSd:that.form.net,//水电气网
						homeShjl:that.form.homeShjl,//距离成都西三环
						homeSw:that.form.death,//非正常死亡
						homeTf:that.form.archival,//府市民云房屋信息档案查询
						homeTime:that.form.tenancy,//租期
						homeType:that.form.house,//户型
						homeYs:that.form.key,//钥匙
						homeYzmj:that.form.yardProportion,//院子总面积
						homeZy:that.form.noise,//坟包及电塔 工厂噪音
						iconName:"",//热点名称
						iconTitle:that.form.iconTitle,//标签
						num:that.form.num,//浏览量
						price:that.form.price,//价格
						timeGo:that.form.timeGo,//年限
						title:that.form.title,//标题
						unit:that.form.unit,//单位
						image:that.form.ownershipList.map(item => item.url).join(','),//图片
						iconImage:"",//左上角图标
						homeImage:that.form.houseList.map(item => item.url).join(','),//产权证照片
						homeMp4:that.form.mp4List.map(item => item.url).join(','),//视频
						latitude:that.form.latitude,
						longitude:that.form.longitude
					}
					
					
						
					if(this.$utils.verificationAll(params, {
						image : '请上传房屋照片',
						homeImage : '产权证照片',
						address : '请选择房屋位置',
					})){
						return
					}
					
					// console.info(JSON.stringify(params))
					// params = {"userId":"","classId":"1860389382874828802","commonClass":"1860387853019222017","address":"湖南省岳阳市湘阴县芙蓉北路","homeAge":"66666","homeAz":"1","homeBian":"11","homeBjsx":"11","homeCai":"11","homeCat":"11","homeGz":"1","homeHb":"11","homeBz":"aaaa","homeJg":"22","homeJl":"11","homeJt":"22","homeJtzy":"11","homeMi":"22","homeMj":"22","homeMoney":"11","homeNo":"11","homeNum":2,"homePay":"11","homePj":"11","homeSd":"11","homeShjl":"11","homeSw":"11","homeTf":"11","homeTime":"11","homeType":"666666","homeYs":"1","homeYzmj":"11","homeZy":"11","iconName":"","iconTitle":"11","num":"11","price":"6666","timeGo":"11","title":"66666","unit":"11","image":"https://tennis-oss.xzaiyp.top/2024-12-07/950752cc-2a22-4296-a8fa-f3c5718a60a1.png,https://tennis-oss.xzaiyp.top/2024-12-07/803308f0-06e1-482a-836c-2b500c281fdc.png","iconImage":"","homeImage":"https://tennis-oss.xzaiyp.top/2024-12-07/8e7e321d-8bf5-43d9-a9ff-de849d4d60fd.png,https://tennis-oss.xzaiyp.top/2024-12-07/024dbfc1-29ba-4dbe-8554-1d19feff220b.png","homeMp4":"https://tennis-oss.xzaiyp.top/2024-12-07/b9ebc286-b293-4ec0-8e1c-205cd1ea94b5.mp4","latitude":28.689608,"longitude":112.911421}
					saveOrUpdateHouse(params).then(response=>{
						console.info('response',response)
						uni.showToast({
							title: response.message,
							mask: false,
							icon: 'none',
							duration: 2000
						})
						setTimeout(()=>{
							uni.redirectTo({
								url:"/pages_subpack/successful-apply/index"
							})
						},2000)
						
					}).catch(error=>{
						
					})
				}).catch(errors => {
					console.info('errors',errors)
				})
			}
		}
	}
</script>

<style>
	page{
		background-color: #f5f5f5;
		
	}
</style>