<template>
  <div>
    <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="150px" class="order_form">
      <el-form-item label="审核类型" prop="F_State">
        <el-select
          v-model="ruleForm.F_State"
          class="form_select"
          filterable
          clearable
          placeholder="请选择审核类型"
        >
          <el-option label="审核通过" value="3"></el-option>
          <el-option label="审核不通过" value="2"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm()">提交</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { auditConsolidateOrderListCustomerService } from "@/api/customerServiceManagement/orderListCustomerService";
export default {
  props: {
    rowid: {
      type: String,
      default: "",
    },
    layerid: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      ruleForm: {
        F_Id: "", //订单编号
        F_State: "", //审核类型
      },
      rules: {
        F_State: [{
          required: true,
          trigger: 'change',
          message: '请选择审核类型',
        }],
      },
    };
  },
  created() {
    if (this.rowid) {
      this.ruleForm.F_Id = this.rowid;
    }
  },
  methods: {
    submitForm() {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          auditConsolidateOrderListCustomerService(this.ruleForm)
          .then((response) => {
            if (response.state.toLowerCase() === "success") {
              this.$parent.$layer.close(this.layerid);
              this.$parent.getList(); // 重新加载父级数据
              this.$message.success(response.message);
            }
          })
          .catch(() => {
            this.loading = false;
          });
        }
      })
    },
  },
};
</script>
<style lang="scss" scoped>
.form_select {
  width: 100%;
}
</style>