import request from '@/config/axios'

// 每日账单 VO
export interface DailyBillVO {
  // 账单编号
  id: number
  // 金额，单位：分
  price: number
  // 确收金额，单位：分
  receivedPrice: number
  // 订单数，默认为0
  orderCount: number
  // 店铺ID
  shopId: number
  // 商户ID
  merchantId: number
  // 订单ID列表，文本类型
  orderIds: string
  // 退款金额, 单位: 分
  refundPrice: number
  // 佣金
  integral: number
  // 确收佣金
  receivedIntegral: number
  // 退款佣金
  refundIntegral: number
  // 订单所属日期
  orderCalcTime: Date
}

// 每日账单 API
export const DailyBillApi = {
  // 查询每日账单分页
  getDailyBillPage: async (params: any) => {
    return await request.get({ url: `/distri/daily-bill/page`, params })
  },

  // 查询每日账单详情
  getDailyBill: async (id: number) => {
    return await request.get({ url: `/distri/daily-bill/get?id=` + id })
  },

  // 新增每日账单
  createDailyBill: async (data: DailyBillVO) => {
    return await request.post({ url: `/distri/daily-bill/create`, data })
  },

  // 修改每日账单
  updateDailyBill: async (data: DailyBillVO) => {
    return await request.put({ url: `/distri/daily-bill/update`, data })
  },

  // 删除每日账单
  deleteDailyBill: async (id: number) => {
    return await request.delete({ url: `/distri/daily-bill/delete?id=` + id })
  },

  // 导出每日账单 Excel
  exportDailyBill: async (params) => {
    return await request.download({ url: `/distri/daily-bill/export-excel`, params })
  },
  // 导出每日账单 Excel
  exportDailyBillByRow: async (params) => {
    return await request.download({ url: `/trade/order/export-excel/dailyBill`, params })
  }
}