//采购单
import { httpInfo as httpPurchaseInfo } from "/@/api/purchase/porder";
import Purchase from "./../details/purchase.vue";

//对账单
import { httpInfo as httpReconciliationInfo } from "/@/api/purchase/orderRecord";
import Reconciliation from "./../details/reconciliation.vue";

//销售订单
import { httpDetail as httpSaleInfo } from "/@/api/InvoiceSales/sheetOrderPool";
import Sale from "./../details/sale.vue";

//对账付款(采购付款)
import { httpInfo as httpPaymentInfo } from "/@/api/purchase/orderPay";
import Payment from "../details/payment.vue";

//回票
import { httpInfo as httpTicketReturnInfo } from "/@/api/purchase/ticketReturn";
import TicketReturn from "../details/ticket-return.vue";

//资金认领
import { httpDetail as httpTradelogInfo } from "/@/api/InvoiceSales/capitalPool";
import Tradelog from "../details/tradelog.vue";

//资金
import { httpInfo as httpTradeInfo } from "/@/api/InvoiceSales/capitalClaim";
import Trade from "../details/trade.vue";

//退款
import { httpDetail as httpRefundInfo } from "/@/api/InvoiceSales/refund";
import Refund from "../details/refund.vue";

//退票申请
import { httpDetail as httpInvReturnInfo } from "/@/api/InvoiceSales/returnTicket";
import InvRerturn from "../details/inv-return.vue";

//开票申请
import { httpDetail as httpInvOpenInfo } from "/@/api/InvoiceSales/invoiceApply";
import InvOpen from "../details/inv-open.vue";
import Goods from "../details/goods.vue";

export const QUERY_MAP = {
  // good: {
  //   query: "商品信息",
  //   detail: "商品信息",
  //   requesetProp: "sequenceNo",
  //   responseKey: "cgdNo",
  //   component: Goods,
  //   api: httpPurchaseInfo
  // },
  cgdNo: {
    query: "采购单号",
    detail: "采购单",
    requesetProp: "sequenceNo",
    responseKey: "cgdNo",
    component: Purchase,
    api: httpPurchaseInfo
  },
  payNo: {
    query: "对账编码",
    detail: "对账申请",
    requesetProp: "payNo",
    responseKey: "payNo",
    component: Reconciliation,
    api: httpReconciliationInfo
  },
  dzNo: {
    query: "对账付款申请编码",
    detail: "对账付款申请",
    component: Payment,
    responseKey: "DzNo",
    requesetProp: "DzNo",
    api: httpPaymentInfo
  },
  hpNo: {
    query: "对账回票申请编码",
    detail: "对账回票申请",
    component: TicketReturn,
    responseKey: "hpNo",
    requesetProp: "hpNo",
    api: httpTicketReturnInfo
  },
  qrdNo: {
    query: "销售订单单号",
    detail: "销售订单",
    requesetProp: "sequenceNo",
    responseKey: "qrdNo",
    component: Sale,
    api: httpSaleInfo
  },
  invNo: {
    query: "开票申请编码",
    detail: "开票申请",
    component: InvOpen,
    responseKey: "invNo",
    requesetProp: "invNo",
    api: httpInvOpenInfo
  },

  tradNo: {
    query: "资金编码",
    detail: "资金",
    component: Trade,
    responseKey: "tradNo",
    requesetProp: "tradNo",
    api: httpTradeInfo
  },
  logNo: {
    query: "资金认领编码",
    detail: "资金认领",
    component: Tradelog,
    responseKey: "logNo",
    requesetProp: "logNo",
    api: httpTradelogInfo
  },
  returnTrad: {
    query: "退款申请编码",
    detail: "资金认领",
    responseKey: "returnTrad",
    requesetProp: "returnCode",
    component: Refund,
    api: httpRefundInfo
  },
  returnInv: {
    query: "退票申请编码",
    detail: "退票申请",
    component: InvRerturn,
    responseKey: "returnInv",
    requesetProp: "returnCode",
    api: httpInvReturnInfo
  }
};

//生成基础查询参数
export function generatorQuerySet() {
  const set = {};
  Object.keys(QUERY_MAP).forEach(key => (set[key] = ""));
  return set;
}

export const DEAFULT_QUERY_FORM = {
  page: 1,
  size: 15,
  ...generatorQuerySet()
};

export const DEFAULT_QUERY_PAGE = {
  total: 0,
  pageSize: 15,
  currentPage: 1,
  background: true
};
