import { httpRequest } from '@/services/http'
import { loginStore } from '@/stores'

const { userId, firstAccountId } = loginStore.$mapGetters()

/**
 * 查询仓单成交明细
 */
export function queryWrTradeDetail(params: Partial<Model.WrTradeDetailReq>) {
    params.userid = userId.value
    return httpRequest<Model.WrTradeDetailRsp[]>('/WrTrade2/QueryWrTradeDetail', 'get', params);
}

/**
 * 查询仓单委托单
 */
export function queryWrOrderDetail(params: Partial<Model.WrOrderDetailReq>) {
    params.userid = userId.value
    return httpRequest<Model.WrOrderDetailRsp[]>('/WrTrade2/QueryWrOrderDetail', 'get', params);
}

/**
 * 查询我的订单-采购订单
 */
export function queryTHJPurchaseTradeDetail(params: Model.THJPurchaseTradeDetailReq) {
    params.userid = userId.value
    return httpRequest<Model.THJPurchaseTradeDetailRsp[]>('/Ferroalloy/QueryTHJPurchaseTradeDetail', 'get', params);
}

/**
 * 查询仓单持有记录
 */
export function queryHoldLB(params: Model.HoldLBReq) {
    params.accountid = firstAccountId.value
    return httpRequest<Model.HoldLBRsp[]>('/WrTrade2/QueryHoldLB', 'get', params);
}

/**
 * 查询提货申请
 */
export function queryWrOutInApply(params: Model.WrOutInApplyReq) {
    params.userid = userId.value
    return httpRequest<Model.WrOutInApplyRsp[]>('/WrTrade2/QueryWrOutInApply', 'get', params);
}

/**
 * 查询我的推广-推广收益
 */
export function queryTHJPromotionIncome(params: Model.THJPromotionIncomeReq) {
    params.userid = userId.value
    return httpRequest<Model.THJPromotionIncomeRsp[]>('/Ferroalloy/QueryTHJPromotionIncome', 'get', params);
}

/**
 * 查询我的推广-推广收益-明细
 */
export function queryTHJPromotionIncomeDetail(params: Model.THJPromotionIncomeDetailReq) {
    params.userid = userId.value
    return httpRequest<Model.THJPromotionIncomeDetailRsp[]>('/Ferroalloy/QueryTHJPromotionIncomeDetail', 'get', params);
}

/**
 * 查询我的订单-转让/受让订单
 */
export function queryTHJPurchaseTransferOrder(params: Model.THJPurchaseTransferOrderReq) {
    params.userid = userId.value
    return httpRequest<Model.THJPurchaseTransferOrderRsp[]>('/Ferroalloy/QueryTHJPurchaseTransferOrder', 'get', params);
}

/**
 * 查询我的订单-转让/受让订单-详情
 */
export function queryTHJPurchaseTransferOrderDetail(params: Model.THJPurchaseTransferOrderDetailReq) {
    return httpRequest<Model.THJPurchaseTransferOrderDetailRsp[]>('/Ferroalloy/QueryTHJPurchaseTransferOrderDetail', 'get', params);
}