<template>
	<view>
		<hsInput label="姓名" v-model="form.userName" :disabled="true" />
		<hsInput label="工会会员卡卡号" labelSize="8" inputSpan="16" v-model="form.clubNo" />
		<view v-if="type === '1'">
			<hsInput label="出院小结" v-model="form.cyxj" />
			<hsInput label="疾病名称" v-model="form.jbmc" />
			<hsInput label="住院日期" v-model="form.zhuyuanDate" model="date" />
			<hsInput label="出院日期" v-model="form.chuyuanDate" model="date" />
			<hsPhoto label="添加出院小结照片，工会会员卡照片" limit="5" v-model="form.fjtp"></hsPhoto>
		</view>
		<view v-if="type === '2'">
			<hsInput label="出院小结" v-model="form.cyxj" />
			<hsInput label="疾病名称" v-model="form.jbmc" />
			<hsInput label="住院日期" v-model="form.zhuyuanDate" model="date" />
			<hsInput label="出院日期" v-model="form.chuyuanDate" model="date" />
			<hsPhoto label="请添加疾病病理报告，出院小结照片，工会会员卡照片" limit="5" v-model="form.fjtp"></hsPhoto>
		</view>
		<view v-if="type === '3'">
			<view class="desc">
				<hsDictSelect label="申请事项" dictKey="condole_renshenshanghai_type" v-model="form.remark" />
			</view>

			<hsInput label="案情简介" v-model="form.cyxj" model="textarea" />
			<hsInput label="伤害时间" v-model="form.shanghaiDate" model="date" />
			<hsInput label="具体工作场所" labelSize="8" v-model="form.jtgzcs" model="textarea" />
			<hsInput label="双方关系" v-model="form.sfgx" model="textarea" />
			<hsPhoto label="附件" limit="5" v-model="form.fjtp"></hsPhoto>
		</view>
		<view style="padding: 200px 0;"></view>
		<view class="bottim_view">
			<view>
				<u-row>
					<u-col span="11">
						<u-button :disabled="isDisabled" class="btnDoPay" shape="circle" @click="submit"
							color="rgb(55,186,189)" text="提交">
						</u-button>
					</u-col>
				</u-row>
			</view>
		</view>
	</view>
</template>

<script>
	import hsDictSelect from "../components/dictSelect.vue"
	import hsInput from "../components/input.vue"
	import hsPhoto from "../components/photo.vue"
	export default {
		components: {
			hsDictSelect,
			hsInput,
			hsPhoto
		},
		data() {
			return {
				type: null,
				isDisabled: false,
				form: {
					nickName: '',
					clubNo: '',
					fjtp: '',
					zhuyuanDate: '',
					chuyuanDate: ''
				}
			}
		},
		mounted() {
			this.type = this.$root.$mp.query.type
			this.form.wwlx = this.$root.$mp.query.type
			this.form.userName = uni.getStorageSync("userInfo").nickName
		},
		methods: {
			submit() {
				if (!this.form.clubNo) {
					this.$showModal("请填写工会会员卡号")
					return
				}
				
				let that = this
				uni.showModal({
					title: "提醒",
					content: " 请确保填写会员卡【" + this.form.clubNo +
						"】内容准确无误，以免申请异常，确认无误后点击【确定】",
					success(res) {
						if (res.confirm) {
							that.$httpRequest({
								url: '/app/condoleRecord',
								method: 'post',
								data: that.form,
								urlType: that.$getUrlType()
							}).then(res => {
								if (res.data.code === 200) {
									uni.navigateBack()
								} else {
									that.$showModal(res.msg)
								}
							})
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.desc {
		padding: 10rpx 15rpx 0 15rpx;
		color: #818181;
		font-size: 20rpx;
	}

	.bottim_view {
		padding: 5px 20px 30px;
		position: fixed;
		left: 0px;
		bottom: 0px;
		width: 100%;
		height: 40px;
		background-color: #ffffff;
	}
</style>
