<template>
	<div>
		<avue-form
			ref="formData"
			:option="option"
			v-model="formData"
		>
			<template #menu-form>
				<el-button icon="el-icon-circle-plus" type="primary" @click="submitForm">保 存</el-button>
				<el-button icon="el-icon-circle-close" @click="cancel">取消</el-button>
			</template>
		</avue-form>
	</div>
</template>

<script>
	import {addOrderCllBack} from "@/api/order/order";
	export default {
		props:{
			obj:{
				type:Object,
				default:{}
			}
		},
		data (){
			return {
				formData:{},
				option:{
					labelWidth:100,
					menuPosition:'right',
					gutter:10,
					submitBtn:false,
					emptyBtn:false,
					menuBtn:true,
					column:[
						{
							label:'服务态度',
							prop: 'serviceAttitude',
							span:24,
							type: 'select',
							dicUrl: '/blade-system/dict/dictionary?code=service_attitude',
							props: {
								label: 'dictValue',
								value: 'dictKey',
							},
						},
						{
							label:'回访内容',
							prop: 'remarks',
							span:24,
							type: 'textarea',
						}
					]
				}
			}
		},
		methods:{
			cancel(){
				this.$emit('childSubmit','cancel');
			},
			submitForm(){
				let operationOrderCallback = {
					orderId:this.obj.id,
					"serviceAttitude": this.formData.serviceAttitude,
					"remarks": this.formData.remarks
				}
				// console.log("operationOrderCallback",operationOrderCallback);
				// return
				this.$refs['formData'].validate((valid,done) => {
					if (valid) {
						addOrderCllBack(operationOrderCallback).then(res=>{
							this.$message({
								type: 'success',
								message: '操作成功!',
							});
							this.$emit('childSubmit');
						});
						done()
					} else {
						console.log('error submit!!');
						return false;
					}
				})
			},
		}
	}
</script>

<style>
</style>