<template>
	<el-dialog  v-dialogDrag width="50%" title="阳光E结算退回" v-if="isEjsVisible" :visible.sync="isEjsVisible" >
			<div  style="height: 30%;">
      <el-form ref="ejsForm" :model="formData" :rules="ruleConfirm" label-width="100px" style="height: 200px;overflow-y: auto;overflow-x: hidden;">
				<el-row>
				<c-col :span="24">
						<el-form-item  label="退回原因" prop="ejsntf" style="width: 100%">
							<c-input v-model="formData.ejsntf" show-word-limit type="textarea" :rows="2" maxlength="60" placeholder="请输入退回原因"></c-input>
						</el-form-item>
					</c-col>
					</el-row> 
					<el-row > 
					<div align="center">
						<el-button type="primary" size="small" @click="submit" >{{ $t('buttons.提交') }}</el-button>
						<el-button size="small" @click="closeDialog">{{ $t('buttons.退出') }}</el-button>
					</div>
				</el-row> 
      </el-form>
			</div>
		</el-dialog>
</template>
<script>
import commonDepend from "~/mixin/commonDepend.js";
import { cloneDeep } from "lodash";
import Api from '~/service/Api';
export default {
  mixins: [commonDepend],
  props: {
	  modelInfo: {
      type: Object,
      default: () => {}
    }
	},
  data() {
    return {
      isEjsVisible : false,
      queinr:"",
      formData: {
          ejsntf:""
      },
      ruleConfirm: {
          ejsntf: [{ required: true, message: "必填", trigger: "blur" }],
      },
    };
  },
  watch: {
  },
  methods: {
		closeDialog() {
			this.isEjsVisible=false;
    },

    async submit() {
      	this.$refs.ejsForm.validate((valid) => {
            if (valid) {
              this.$confirm('您确定退回该笔交易?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
              }).then(async () => {
                  let params = {
                    queinr: this.queinr,
                    reason: this.formData.ejsntf
                  }
                  let res = await Api.post("/public/quesel/ejsRepair", params);
                  if (res.respCode == SUCCESS) {
                    this.$notify({
                      title: '成功',
                      message: '退回成功',
                      type: 'success',
                    });
                    this.isEjsVisible = false;
                    this.$parent.handleSearch();
                  }
              })
            }
          })
        },
    }
}
</script>
<style scoped lang="less">
.block {
	.txt {
		font-weight: bold;
	}
}
</style>