import request from '@/config/axios'

// 订单结算信息表，记录店铺的结算信息 VO
export interface ShopSettlementVO {
  // 结算id
  id: number
  // 平台代收金额
  platformCollectionAmount: number
  // 店铺应得金额
  shopAmount: number
  // 平台确认转帐完成时间
  platformTransferConfirmTime: Date
  // 店铺确认转帐完成时间
  shopTransferConfirmTime: Date
  // 转账凭证附件
  attachment: string
  // 店铺id
  shopId: number
  // 高精度成本价格
  shopHighAmount: number
  // 共计成本价格(高精度的)
  shopTotalHighAmount: number
}

// 订单结算信息表，记录店铺的结算信息 API
export const ShopSettlementApi = {
  // 查询订单结算信息表，记录店铺的结算信息分页
  getShopSettlementPage: async (params: any) => {
    return await request.get({ url: `/distri/shop-settlement/page`, params })
  },

  // 查询订单结算信息表，记录店铺的结算信息详情
  getShopSettlement: async (id: number) => {
    return await request.get({ url: `/distri/shop-settlement/get?id=` + id })
  },

  // 新增订单结算信息表，记录店铺的结算信息
  createShopSettlement: async (data: ShopSettlementVO) => {
    return await request.post({ url: `/distri/shop-settlement/create`, data })
  },

  // 修改订单结算信息表，记录店铺的结算信息
  updateShopSettlement: async (data: ShopSettlementVO) => {
    return await request.put({ url: `/distri/shop-settlement/update`, data })
  },

  // 删除订单结算信息表，记录店铺的结算信息
  deleteShopSettlement: async (id: number) => {
    return await request.delete({ url: `/distri/shop-settlement/delete?id=` + id })
  },

  // 导出订单结算信息表，记录店铺的结算信息 Excel
  exportShopSettlement: async (params) => {
    return await request.download({ url: `/distri/shop-settlement/export-excel`, params })
  },

  // 导出店铺订单结算信息表 Excel
  exportShopOrder: async (params) => {
    return await request.download({ url: `/trade/order/export-excel/shopSettlement`, params })
  }
}