import request from '@/utils/request'

/***************************************************** 订单列表 ****************************************************/
/**
 * 获取订单设置
 */
export function getShopOrderConfig() {
    return request.get(`shop/order/config`)
}

/**
 * 获取订单状态列表
 */
export function getShopOrderStatus() {
    return request.get(`shop/order/status`)
}

/**
 * 获取订单列表
 */
export function getShopOrder(params: Record<string, any>) {
    return request.get(`order/miniOrder/list`, params)
}

/**
 * 获取订单列表商品
 */
export function getproducts(params: any) {
    return request.get(`order/miniOrder/products`, params)
}

/**
 * 获取订单角标数据
 */
export function getShopOrderNum() {
    return request.get(`shop/order/num`)
}

/**
 * 获取订单详情
 */
export function getShopOrderDetail(order_id: any) {
    return request.get(`order/miniOrder/${ order_id }`)
}

/**
 * 查询当前订单的流程节点列表
 */
export function getOrderFlowNodes(order_id: any) {
    return request.get(`/order/miniOrder/getOrderFlowNodes/${ order_id }`)
}

/**
 * 根据订单id查询发货订单
 */
export function selectOrderDeliverByOrderId(params: any) {
    return request.get(`order/miniOrder/selectOrderDeliverByOrderId`,params)
}

/**
 * 关闭订单
 */
export function orderClose(params: any) {
    return request.put(`order/miniOrder/cancel`,params)
}

/**
 * 订单完成
 */
export function orderFinish(params: any) {
    return request.get(`order/miniOrder/batchConfirmation`,params)
}

/**
 * 订单创建计算
 */
export function orderCreateCalculate(params: Record<string, any>) {
    return request.get('shop/order_create/calculate', params)
}

/**
 * 订单创建
 */
export function orderCreate(params: Record<string, any>) {
    return request.post('order/miniOrder/submit', params)
}

/**
 * 查询订单可用优惠券
 */
export function orderCoupon(params: Record<string, any>) {
    return request.get('shop/order_create/coupon', params)
}

/**
 * 查询自提点
 */
export function getStoreList(params: Record<string, any>) {
    return request.get('shop/order_create/store', params)
}

/**
 * 查询物流信息
 */
export function getMaterialflowList(params: Record<string, any>) {
    return request.get('order/miniOrder/queryTrack', params)
}

/**
 * 查询同城配送预约配置
 */
export function getLocal() {
    return request.get('shop/order_create/local')
}


/**
 * 获取会员收货地址详情
 * @param id 会员收货地址id
 * @returns
 */
export function getAddressInfo(id: number) {
    return request.get(`customer/miniAddress/${ id }`);
}