 /*
  * 手太欠
  * 愿这世界都如故事里一样 美好而动人~
*/

import { req } from "../request"

// 售后服务
const list = data => req({
    url : "mall/refunds",
    data
})

// 用户退货
const deliver = (refund, data) => req({
    url: "mall/refunds/" + refund + "/deliver",
    method: "POST",
    data
})

// 退货详情
const info = refund => req({
    url: "mall/refunds/" + refund
})

// 退货日志
const log = refund => req({
    url: "mall/refunds/" + refund + "/logs"
})

// 申请售后前置
const refundPreposition = id => req({
    url: "mall/orders/" + id + "/refund"
})

// 提交退货
const submitRefund = (id, data) => req({
    url     : "mall/orders/" + id + "/refund",
    method  : "POST",
    data
})

// 取消退货
const refundsCancel = id => req({
    url     : "mall/refunds/" + id + "/cancel",
    method  : "POST",
})

// 退货前置
const deliverInit = id => req({
    url     : "mall/refunds/" + id + "/deliver_init"
})

export default ({
    list,
    deliver,
    info,
    log,
    refundPreposition,
    submitRefund,
    refundsCancel,
    deliverInit
})