<script>
import { toSaleOrder } from "@/api/expend/customerExpend";
export default {
  name: "ResaleOrder",
  props: {
    selectData: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      title: "转销售订单",
      loading: false,
    };
  },
  computed: {
    disabled: {
      get() {
        const { selectData } = this;
        if (selectData.length < 1) {
          return true;
        }
        return false;
      },
      set() {},
    },
  },
  methods: {
    //转销售订单
    useClick() {
      let that = this;
      this.$modal.confirm('确认转销售订单吗？').then(async function() {
        that.loading = true;
        return await toSaleOrder(that.selectData);
      }).then(() => {
        that.$modal.msgSuccess("成功");
        that.loading = false;
      }).catch(() => {
        that.loading = false;
      });
    },
  },
  created() {},
};
</script>

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