<template>
	<view class="main">
		<form>
			<view class="cu-form-group margin-top">
				<view class="title">头像</view>
				<image class="cu-avatar radius bg-gray" @click="ChooseImage" :src='imgList[0]' mode='aspectFill'>
				</image>
			</view>
			<view class="cu-form-group">
				<view class="title">就诊人姓名:</view>
				<input v-model="name" placeholder-style="text-align:right" placeholder="请填写手机号"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">就诊人性别:</view>
				<u-radio-group v-model="value" @change="radioGroupChange">
					<u-radio v-for="(item, index) in list" :key="index" :name="item.name" :disabled="item.disabled">
						{{item.name}}
					</u-radio>
				</u-radio-group>
			</view>
			<view class="cu-form-group">
				<view class="title">出身年月:</view>
				<picker mode="date" :value="date" @change="bindDateChange">
					<view class="picker">
						{{date}}
					</view>
				</picker>
			</view>
			<view class="cu-form-group" @click="show=!show">
				<view class="title">与就诊人关系:</view>
				<picker :value="guanxi" @change="confirm" :range="guanxilist" range-key="label">
					<view class="picker">
						{{guanxi}}
					</view>
				</picker>
			</view>
			<view class="cu-form-group margin-top">
				<view class="title">就诊信息(非必填)</view>
				<input v-model="jiuzheninfo" placeholder-style="text-align:right" placeholder="请输入"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">就诊人身份证:</view>
				<input v-model="idcrad" placeholder-style="text-align:right" placeholder="请输入就诊人身份证号"></input>
			</view>
			<view class="padding-sm bg-white" style="color: #C0C0C0;">
				注：就诊人信息用于平台审核和医疗业务使用，不会外传。请正却确填写就诊人信息，如需修改身份信息可电话联系客服修改（13330431369）
			</view>
		</form>
		<view class="cu-bar bg-white tabbar" style="position: fixed;bottom: 0;width: 100%;">
			<view class="submit" style="background-color: #0B73B9;color: white;" @click="addarchives">
				提交
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		onLoad(options) {

		},
		onShow() {

		},
		data() {
			return {
				imgList: '',
				name: "",
				list: [{
						name: '男',
						disabled: false
					},
					{
						name: '女',
						disabled: false
					},
				],
				value: '男',
				date: "请选择出生日期",
				show: false,
				guanxi: "请选择",
				guanxiindex: 0,
				guanxilist: [{
						value: '1',
						label: '父亲'
					},
					{
						value: '2',
						label: '母亲'
					},
					{
						value: '3',
						label: '祖父'
					},
					{
						value: '4',
						label: '祖母'
					},
					{
						value: '5',
						label: '外祖父'
					},
					{
						value: '6',
						label: '外祖母'
					},
					{
						value: '7',
						label: '叔侄'
					}
				],
				idcrad: ""
			}
		},
		methods: {
			ChooseImage() {
				uni.chooseImage({
					count: 1, //默认9
					sizeType: ['compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera'], //从相册选择
					success: (res) => {
						this.imgList = res.tempFilePaths
					}
				});
			},
			// 选中任一radio时，由radio-group触发
			radioGroupChange(e) {
				this.value = e
				console.log(this.value)
			},
			bindDateChange({
				detail
			}) {
				this.date = detail.value
				console.log(this.date)
			},
			confirm(e) {
				this.guanxiindex = e.detail.value
				this.guanxi = this.guanxilist[e.detail.value].label
			},
			addarchives: async function() {
				console.log(this.imgList[0])
				console.log(this.name)
				console.log(this.value)
				console.log(this.date)
				console.log(this.guanxiindex)
				console.log(this.idcrad)
			}
		}
	};
</script>

<style scoped lang="scss">
	.main {}
</style>
