<template>
	<uni-collapse class="sfht-collapse-box">
		<uni-collapse-item title="客户信息" :open="true">
			<view class="sfht-add-row">
				<view class="sfht-title-add-btn" @click="handleSelct">客户选择<icon></icon>
				</view>
			</view>
			<view class="form-label-input">
				<view class="phone-form-label"><text class="form-label-require">*</text>姓名</view>
				<uni-easyinput v-model="data.hetong.khName" placeholder="请输入姓名" />
			</view>
			<view class="form-label-input">
				<view class="phone-form-label"><text class="form-label-require">*</text>电话</view>
				<uni-easyinput v-model="data.hetong.khUserName" placeholder="请输入电话" />
			</view>
			<view class="form-label-input">
				<view class="phone-form-label"><text class="form-label-require">*</text>证件号</view>
				<uni-easyinput v-model="data.hetong.idcard" placeholder="请输入证件号" />
			</view>
			<view class="form-label-input">
				<view class="phone-form-label"><text class="form-label-require"></text>具体地址</view>
				<uni-easyinput v-model="data.hetong.dizhi" placeholder="请输入具体地址" />
			</view>
		</uni-collapse-item>
	</uni-collapse>

	<!-- 客户 -->
	<selectKh ref="khRef" @select="onKhSelect"></selectKh>
</template>

<script setup>
	import {
		ref,
		reactive,
		nextTick
	} from "vue";
	import selectKh from "./selectKh.vue"
	import {
		useHetong
	} from "../useHetong.js"
	
	const {
		injectHetong
	} = useHetong();

	const data = injectHetong()
	
	const emits = defineEmits(['select-kehu'])

	const khRef = ref(null)

	function handleSelct() {
		khRef.value.handleShow();
	}
	
	function onKhSelect(da) {
		console.log('cccc',da)
		data.kehu.khId = da.khId;
		data.kehu.khIdcard = da.khIdcard;
		data.kehu.khName = da.khName;
		data.kehu.khUserName = da.khUserName;
		data.kehu.dizhi = da.dizhi;
	}
</script>

<style>
</style>