import { REFER } from "@/components/popover-select/api";

// 币种
export const currency = async (prop) => {
  try {
    // try
    const { code, rows } = await REFER({
      search: prop,
      type: "CURRENCY_PARAM",
    });
    if (code === 200) {
      return rows[0] || {};
    }
  } catch (err) {
    // catch
    console.error(err);
  } finally {
    // finally
  }
};
// 税率
export const tax = async (prop) => {
  try {
    // try
    const { code, rows } = await REFER({
      search: prop,
      type: "TAX_RATE_PARAM",
    });
    if (code === 200) {
      return rows[0] || {};
    }
  } catch (err) {
    // catch
    console.error(err);
  } finally {
    // finally
  }
};
// 单位
export const unit = async (prop) => {
  try {
    // try
    const { code, rows } = await REFER({
      search: prop,
      type: "UNIT_PARAM",
    });
    if (code === 200) {
      return rows[0] || {};
    }
  } catch (err) {
    // catch
    console.error(err);
  } finally {
    // finally
  }
};