import {
    myRequest
} from './request.js'
import {
    myRequestPhp
} from './requestPhp.js'
// 正向订单状态数
export function getOrderStstusAmount(data) {
    return myRequest({
        url: 'order_service/orderService/getOrderStstusAmount',
        method: 'post',
        data
    })
}
// 正向订单列表
export function orderList(data) {
    return myRequest({
        url: 'order_service/orderService/orderList',
        method: 'post',
        data
    })
}
// 订单详情页面
export function getOrderDetails(data) {
    return myRequest({
        url: 'order_service/orderService/getOrderDetails',
        method: 'post',
        data
    })
}
const pre = ""
const apiType = "php"
// 订单状态数
export function getOrderStatusNumber(data) {
    return myRequestPhp({
        url: `${pre}mer/store/order/chart`,
        method: 'GET',
        data,
        apiType
    })
}

// 订单列表
export function getOrderList(data) {
    return myRequestPhp({
        url: `${pre}mer/store/order/lst`,
        method: 'GET',
        data,
        apiType
    })
}
// 订单列表产品
export function getOrderListProduct(order_sn) {
    const data = {
        order_sn: order_sn,
        order_type: -1,
        distribution_mode: -1,
        keywords: order_sn,
        status: "",
        date: "",
        page: 1,
        limit: 20,
        type: 1,
        username: "",
        pay_type: -1,
        ylj_status: "",
        paid: "",
    }
    return myRequestPhp({
        url: `${pre}mer/store/order/lst`,
        method: 'GET',
        data,
        apiType
    })
}
// filtter
export function getOrderListFiltter(data) {
    return myRequestPhp({
        url: `${pre}mer/store/order/filtter`,
        method: 'GET',
        data,
        apiType
    })
}

/**
 * @description 订单 -- 发货规则
 */

export function orderDeliveryRuleApi(id) {
    return myRequestPhp({
        url: `${pre}mer/store/order/delivery/${id}/form`,
        method: 'GET',
        apiType
    })
}
/**
 * @description 订单 -- 发货
 */

export function orderDeliveryApi(id, data) {
    return myRequestPhp({
        url: `${pre}/mer/store/order/delivery/${id}.html`,
        method: 'POST',
        data,
        apiType
    })
}


/**
 * @description 订单 -- 详情
 */

export function orderDetailApi(id) {
    return myRequestPhp({
        url: `${pre}mer/store/order/detail/${id}`,
        method: 'GET',
        apiType
    })
}
/**
 * @description 获取物流信息
 */
export function getExpress(id) {
    return myRequestPhp({
        url: `${pre}mer/store/order/express/${id}`,
        method: 'GET',
        apiType
    })
}

/**售后列表 */

export function getAfterSaleList(data) {
    return myRequestPhp({
        url: `${pre}mer/store/refundorder/lst`,
        method: 'GET',
        data,
        apiType
    })
}
/**
 * @description 退款单获取物流信息
 */
export function refundorderExpressApi(id) {
    return myRequestPhp({
        url: `${pre}mer/store/refundorder/express/${id}`,
        method: 'GET',
        apiType
    })
}
/**
 * @description 自提
 */
export function takeProductApi(id, data) {
    return myRequestPhp({
        url: `${pre}mer/store/order/carry/${id}`,
        method: 'GET',
        data,
        apiType
    })
}

/**
 * @description 退款订单 -- 详情
 */
export function refundorderDetailApi(id) {
    return myRequestPhp({
        url: `${pre}mer/store/refundorder/detail/${id}`,
        method: 'GET',
        apiType
    })
}

/**
 * @description 退款订单
 */
export function confirmRefundOrderApi(id, data) {
     return myRequestPhp({
         url: `${pre}mer/store/refundorder/status/${id}`,
         data,
         method: 'POST',
         apiType
     })
}
/**
 * @description 退款订单 -- 确认收货
 */
export function confirmReceiptApi(id, data) {
     return myRequestPhp({
         url: `${pre}mer/store/refundorder/refund/${id}`,
         data,
         method: 'POST',
         apiType
     })
}

/**
 * PHP获取token接口
 **/
/**
 * merId
 * @param {*} data 
 * @returns 
 */
export function getPhpGlobalToken(data, merId) {
    return myRequestPhp({
        url: `${pre}mer/getPhpToken?${merId}`,
        method: 'POST',
        data,
        apiType
    })
}