// 财务审核
import {ContractOperateApplyReq} from "@/services/proto/contract/interface";
import {Ref} from "vue";
import {commonResultInfo, getRequestResultInfo} from "@/common/methods/request";
import {contractOperateApply} from "@/services/proto/contract";
import {financeSign} from "@/views/manage/finance-review/setup";

/**
 * 管理 - 财务审核 - 发票 && 款项
 * @param req.OperateApplyID  合同id
 * @param req.OperateType  2:确认3：拒绝4：撤销
 * @param loading
 */
export function financeControl(req: ContractOperateApplyReq, loading: Ref<boolean>): Promise<string> {
    loading.value = true;
    const sign = getRequestResultInfo(financeSign, req.OperateType)  // 接口请求后的返回提示 这里统一进行管理
    // 接口调用
    const result = contractOperateApply(req)
    // 接口调用结果处理，提示成功或者失败信息，并关闭loading效果
    return commonResultInfo(result, sign, loading)
}