import request from '@/utils/request'
import { URL } from '@/config'

export function getList(params) {
  return request({
    url: URL.shop.order.return.getList,
    method: 'get',
    params,
  })
}

export function get(params) {
  return request({
    url: URL.shop.order.return.get,
    method: 'get',
    params,
  })
}

export function review(data) {
  return request({
    url: URL.shop.order.return.review,
    method: 'post',
    data,
  })
}

export function refused(data) {
  return request({
    url: URL.shop.order.return.refused,
    method: 'post',
    data,
  })
}
export function returnlogistics(data) {
  return request({
    url: URL.shop.order.return.returnlogistics,
    method: 'post',
    data,
  })
}

export function receive(data) {
  return request({
    url: URL.shop.order.return.receive,
    method: 'post',
    data,
  })
}

export function refund(data) {
  return request({
    url: URL.shop.order.return.refund,
    method: 'post',
    data,
  })
}

/**
 * @name 商家端-订单返回静止状态
 * @api api_url + '/admin/shop/shop-order-return/statisticState',
 * @param { days } params 
 * @returns {
 *  "3105": 1,
 *  "3125": 2,
 *  "total": 3
}
 */

export function statisticState(params) {
  return request({
    url: URL.shop.order.return.statisticState,
    method: 'get',
    params,
  })
}

/**
 * @name 退单销售趋势图
 * @api api_url + '/admin/shop/shop-order-return/statisticCount'
 * @param  days  日期数 7 30  90 180 
 * @returns  {
 *      "record_count": 0,      记录数量
 *      "curr_date": "10/07"    当前数据
 * }
 */

export function statisticCount(params) {
  return request({
    url: URL.shop.order.return.statisticCount,
    method: 'get',
    params,
  })
}

export function getItems(params) {
  return request({
    url: URL.shop.order.return.item.getItems,
    method: 'get',
    params,
  })
}

export function exportFile(params) {
  return request({
    url: URL.shop.order.return.exportFile,
    method: 'get',
    params,
  })
}

export function exportFileByIds(params) {
  return request({
    url: URL.shop.order.return.exportFileByIds,
    method: 'get',
    params,
  })
}

export function doForceRefund(data) {
  return request({
    url: URL.shop.order.return.doForceRefund,
    method: 'post',
    data,
  })
}

export function editRefund(data) {
  return request({
    url: URL.shop.order.return.editRefund,
    method: 'post',
    data,
  })
}

export function doUpdateReturns(data) {
  return request({
    url: URL.shop.order.return.doUpdateReturns,
    method: 'post',
    data,
  })
}

export function transferToSupplier(data) {
  return request({
    url: URL.shop.order.return.transferToSupplier,
    method: 'post',
    data,
  })
}
