<template>
	<view class="container">
		<cu-custom bgColor="bg-gradual-pink" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">客户满意度调查</block>
		</cu-custom>
		<view class="cu-form-group margin-top">
			<view class="title">调查时间:</view>
			<my-date style="padding: 0px;" v-model="pingJiaShiJian" placeholder="请选择" fields="day"
				label=""></my-date>
		</view>
		<view class="cu-form-group">
			<view class="title"  >被调查部门:</view>
			<app-select placeholder="请选择调查部门" v-model="buMenId"  :dict="buMenList" space ></app-select>
		</view>
		
		<uni-section title="您对检测人员的服务是否满意"  type="line" padding>
			<uni-rate size="18" :value="5" v-model="wenTiYiDaAn"/>
		</uni-section>
		<uni-section title="您对检验中心的检测效率是否满意"  type="line" padding>
			<uni-rate size="18" :value="5" v-model="wenTiErDaAn"/>
		</uni-section>
		<uni-section title="您对检验中心出具的检测报告结果是否满意"  type="line" padding>
			<uni-rate size="18" :value="5" v-model="wenTiSanDaAn"/>
		</uni-section>
		<uni-section title="对检测人员技术能力是否满意"  type="line" padding>
			<uni-rate size="18" :value="5" v-model="wenTiSiDaAn"/>
		</uni-section>
		<uni-section title="对检验部门的管理是否满意"  type="line" padding>
			<uni-rate size="18" :value="5" v-model="wenTiWuDaAn"/>
		</uni-section>
		<uni-section title="客户意见和建议" type="line" padding>
			<textarea maxlength="-1" v-model="qingNinTianXie" placeholder="意见和建议"></textarea>
		</uni-section>
		<view class="padding flex flex-direction">
			<button class="cu-btn bg-blue lg" @click="onSubmit">提交</button>
		</view>
	</view>
</template>
<script>
	import appSelect from '@/components/my-componets/appSelect.vue'
	import myDate from '@/components/my-componets/my-date.vue'
	
	export default {
		components: {
			myDate,
			appSelect
		},
		data() {
			return {
				buMenList:[],
				pingJiaShiJian:null,
				buMenId:'',
				wenTiYiDaAn:'',
				wenTiErDaAn:'',
				wenTiSanDaAn:'',
				wenTiSiDaAn:'',
				wenTiWuDaAn:'',
				qingNinTianXie:''
			}
		},
		onLoad() {
			let that = this
			this.$http.post("/ibps/business/v3/common/queryBuMenList", "466555896126767104").then(res => {
				if (res.data.state == 200 && res.data.data) {
					this.buMenList=[]
					for(let ind in res.data.data){
						this.buMenList.push({value:res.data.data[ind].id,text:res.data.data[ind].buMenMingChengs})
					}
				}
			});
		},
		methods: {
			onSubmit(){
				let para={
					pingJiaShiJian:this.pingJiaShiJian,
					buMenId:this.buMenId,
					wenTiYiDaAn:this.wenTiYiDaAn,
					wenTiErDaAn:this.wenTiErDaAn,
					wenTiSanDaAn:this.wenTiSanDaAn,
					wenTiSiDaAn:this.wenTiSiDaAn,
					wenTiWuDaAn:this.wenTiWuDaAn,
					qingNinTianXieBao:this.qingNinTianXieBao
				}	
				let that=this;
				this.$http.post("ibps/business/v3/sh/manyidu/add",para).then(res =>{
					if (res.data.state == 200) {
						this.$tip.success("提交成功!")
						this.$Router.replace({name:'index'})
					}else if (res.data.state == 400) {
						this.$tip.success("用户未登录!")
						this.$Router.replace({name:'login'})
					}else{
						this.$tip.error("请求错误: "+res.data.message)
					}			
				}).catch((err) => {
					  let msg = ((err.response || {}).data || {}).message || err.data.message || "请求出现错误，请稍后再试"
					  this.$tip.error(msg);
				}); 
			},
			onChange(e) {
				
			}
		}
	}
</script>
<style>
	.cu-form-group .title {
		min-width: calc(8em + 25px);
	}
</style>
