<script>
import { submit } from "@/api/expend/customerExpend";
export default {
  name: "OpenOrClose",
  props: {
    selectData: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      // title: "提交",
      title: "不转销售订单审批",
      loading: false,
    };
  },
  computed: {
    disabled: {
      get() {
        const { selectData } = this;
        if (selectData.length < 1) {
          return true;
        }
        return false;
      },
      set() {},
    },
  },
  methods: {
    //提交
    useClick() {
      this.$modal.confirm("确认提交吗？").then(async () => {
        try {
          this.$modal.loading("处理中,请稍后...");
          let { code, msg } = await submit(this.selectData[0]);
          if (code == 200) {
            this.$notify.success(msg);
            this.$emit("success");
          }
        } catch (error) {
        } finally {
          this.$modal.closeLoading();
        }
      });
    },
  },
  created() {},
};
</script>

<template>
  <el-button
    v-loading="loading"
    @click="useClick"
    :disabled="disabled"
    v-bind="$attrs"
    >{{ title }}</el-button
  >
</template>
