<template>
  <div>
    <el-form ref="ruleForm" :model="ruleForm" label-width="80px">
      <el-form-item label="退回原因">
        <el-input v-model="ruleForm.remark" type="textarea" placeholder="退回原因"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm()">提交</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { checkOrderCustomerService } from "@/api/customerServiceManagement/orderListCustomerService";
export default {
  props: {
    rowid: {
      type: String,
      default: "",
    },
    layerid: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      ruleForm: {
        orderid: "", //订单编号
        state: 2, //订单状态 —— 2 退回
        remark: "", //备注
      },
    };
  },
  created() {
    if (this.rowid) {
      this.ruleForm.orderid = this.rowid;
    }
  },
  methods: {
    submitForm() {
      checkOrderCustomerService(this.ruleForm)
        .then((response) => {
          if (response.state.toLowerCase() === "success") {
            this.$parent.$layer.close(this.layerid);
            this.$parent.getList(); // 重新加载父级数据
            this.$message.success("恭喜你，工单信息审核成功!");
          }
        })
        .catch(() => {
          this.loading = false;
        });
    },
  },
};
</script>
<style lang="scss" scoped>
</style>