/** ================================= 业务审核 ================================**/
import { getUserId } from '@/services/bus/account';
import {getAreaUserId, getUserAccountType} from '@/services/bus/user';
import { commonSearch_go } from "@/services/go";
import {
    ErmcpTradeConfigTMP,
    QryBusinessDjRsp,
    QryBussinessJsRsp,
    QueryBusinessDjReq,
    QueryBusinessJsReq
} from "@/services/go/ermcp/business-review/interface";

/**
 * 查询业务管理(结算)(对应菜单:业务管理/交收) /Ermcp/QueryBusinessJs
 * @param QueryBusinessJsReq 
 * @constructor
 */
export function QueryBusinessJs(req: QueryBusinessJsReq): Promise<QryBussinessJsRsp[]> {
    const param = {
        UserId: getUserId(),
        usertype: getUserAccountType()
    }
    Object.assign(param, req)
    return commonSearch_go('/Ermcp/QueryBusinessJs', param).catch((err) => {
        throw new Error(`业务管理 - 交收: ${err}`);
    });
}

/**
 * 查询业务管理(点价)(对应菜单:业务管理/点价) /Ermcp/QueryBusinessDj
 * @param QueryBusinessDjReq
 * @constructor
 */
export function QueryBusinessDj(req: QueryBusinessDjReq): Promise<QryBusinessDjRsp[]> {
    const param = {
        UserId: getUserId(),
        usertype: getUserAccountType()
    }
    Object.assign(param, req)
    return commonSearch_go('/Ermcp/QueryBusinessDj', param).catch((err) => {
        throw new Error(`业务管理 - 点价: ${err}`);
    });
}

/**
 * 查询交易模板配置 /Ermcp/QueryTradeConfigTMP
 */
export function QueryTradeConfigTMP(): Promise<ErmcpTradeConfigTMP[]> {
    const param = {
        areauserid: getAreaUserId(), // 所属机构id
    }
    return commonSearch_go('/Ermcp/QueryTradeConfigTMP', param).catch((err) => {
        throw new Error(`查询交易模板配置: ${err}`);
    });
}

