import api from './api'

/**
 * 订单确认
 */
export function orderConfirm(data) {
    return api.post('/order/confirm', data, {login: false})
}

/**
 * 订单创建
 */
export function orderCreate(data) {
    return api.post(`/order/create/${ data.key }`, data, {login: false})
}

/**
 * 个人中心订单统计
 */
export function orderUserCount(data) {
    return api.post(`/order/user_count`, data, {login: false})
}

/**
 * 订单列表
 */
export function orderList(data) {
    return api.get(`/order/list`, data, {login: false})
}

/**
 * 计算订单金额
 */
export function orderComputed(data) {
    return api.post(`/order/computed/${ data.key }`, data, {login: false})
}

/**
 * 计算详情
 */
export function orderInfo(data) {
    return api.get(`/order/detail/${ data.key }`, data, {login: false})
}

/**
 * 取消订单
 */
export function orderCancel(data) {
    return api.post(`/order/cancel`, data, {login: false})
}

/**
 * 订单收货
 */
export function orderTake(data) {
    return api.post(`/order/take`, data, {login: false})
}

/**
 * 订单评价
 */
export function orderComments(data) {
    return api.post(`/order/comments`, data, {login: false})
}

/**
 * 订单删除
 */
export function orderDelete(data) {
    return api.post(`/order/del`, data, {login: false})
}

/**
 * 申请售后
 */
export function applyForAfterSales(data) {
    return api.post(`/after/applyForAfterSales`, data, {login: false})
}

/**
 * 售后产品列表
 */
export function applyForAfterSalesInfo(data) {
    return api.get(`/after/applyForAfterSales/${ data.key }`, data, {login: false})
}

/**
 * 售后列表
 */
export function storeAfterSalesList(data) {
    return api.get(`/after/storeAfterSales/list`, data, {login: false})
}

/**
 * 售后订单详情
 */
export function checkForAfterSalesInfo(data) {
    return api.get(`/after/checkForAfterSales/${ data.key }`, data, {login: false})
}

/**
 * 撤销申请
 */
export function afterSalesOrderRevoke(data) {
    return api.get(`/after/revoke/${ data.key }/${ data.id }`, {}, {login: false})
}

/**
 * 删除记录
 */
export function afterSalesOrderDelete(data) {
    return api.delete(`/after/deleteAfterSalesOrder`, data, {login: false})
}

/**
 * 添加物流信息
 */
export function addLogisticsInformation(data) {
    return api.post(`/after/addLogisticsInformation`, data, {login: false})
}

/**
 * 获取快递列表
 */
export function getExpress() {
    return api.get('order/express/list', {}, {login: false})
}

/**
 * 订单支付
 */
export function orderPay(data) {
    return api.post(`/order/pay`, data, {login: false})
}

/**
 * 物流信息
 */
export function orderExpress(data) {
    return api.post(`/order/order/express`, data, {login: false})
}

// ===================== 👇 by kahu ==========================
/**
 * 微信支付
 * @param data
 * @returns {*}
 */
export const wechatPay = (data) => api.post(`/order/pay`, data)

/**
 * 检查支付
 * @param data
 * @returns {*}
 */
export const checkPay = (data) => api.post(`/order/pay/orderQuery`, data)
