import request from '../http'

// ===================== 快递归还相关接口 =====================

// 1) 申请快递归还
export const applyExpressReturn = (data) => {
    // data: { orderId: number, logisticsTrackingNumber?: string, remark?: string }
    return request({
        url: '/app/express-return/apply',
        method: 'post',
        data
    })
}

// 2) 补填快递单号
export const fillExpressTrackingNumber = (data) => {
    // data: { id: number, logisticsTrackingNumber: string }
    return request({
        url: '/app/express-return/fill-tracking-number',
        method: 'post',
        data
    })
}

// 3) 查询快递归还记录列表
export const getExpressReturnList = (params) => {
    // params: { orderId?: number, status?: number, logisticsTrackingNumber?: string, pageNum?: number, pageSize?: number }
    return request({
        url: '/app/express-return/list',
        method: 'get',
        data: params,
        hideLoading: true
    })
}

// 4) 根据订单ID查询快递归还记录
export const getExpressReturnByOrder = (orderId) => {
    return request({
        url: `/app/express-return/by-order/${orderId}`,
        method: 'get',
        hideLoading: true
    })
}

// 5) 获取快递归还记录详情
export const getExpressReturnDetail = (id) => {
    return request({
        url: `/app/express-return/${id}`,
        method: 'get',
        hideLoading: true
    })
}

// 6) 取消快递归还申请
export const cancelExpressReturn = (id) => {
    return request({
        url: `/app/express-return/cancel/${id}`,
        method: 'post'
    })
}

