import request from '../utils/request.js'

import config from '../utils/config'


// 用户创建订单(直接购买)
export const createOrder = data => {
	return request.post('/wechat/auth.order/add', data)
}

// 订单详情
export const orderDetail = data => {
	return request.post('/wechat/auth.order/read', data)
}
// 店内消费详情
export const expenseDetail = (query)=> {
	return request.post('/wechat/auth.expense/read?order_no='+query)
}
export const expensePay = (data)=> {
	return request.post('/wechat/auth.expense/pay?order_no='+data.order_no+"&pay_pswd="+data.pay_pswd)
}
export const expenseList = (data)=> {
	return request.post('/wechat/auth.expense/index', data)
}





// 根据订单获取用户可用优惠券
export const getCouponByOrder = data => {
	return request.post('/wechat/auth.order/getCoupons', data)
}

// 订单信息确认，选择地址
export const submitOrderByAdress = data => {
	return request.post('/wechat/auth.order/perfectByAddr', data)
}

// 订单信息确认，选择优惠券
export const submitOrderByCoupon = data => {
	return request.post('/wechat/auth.order/perfectByCoupon', data)
}

//获取订单支付参数
export const getOrderPayData = data => {
	return request.post('/wechat/auth.order/payment', data)
}

// 获取订单列表
export const getOrderList = data => {
	return request.post('/wechat/auth.order/index', data)
}

// 用户主动取消未支付的订单
export const cancelOrder = data => {
	return request.post('/wechat/auth.order/cancel', data)
}

// 用户主动删除已取消的订单
export const deleteOrder = data => {
	return request.post('/wechat/auth.order/delete', data)
}

// 已发货订单用户确认收货
export const confirmOrder = data => {
	return request.post('/wechat/auth.order/confirm', data)
}

// 获取订单统计数据
export const getOrderStatics = data => {
	return request.post('/wechat/auth.index/order_num', data)
}

//订单使用积分
export const orderUserPoints = data => {
	return request.post('/wechat/auth.order/perfectByIntegral', data)
}

//申请售后
export const applyAfterSales = data => {
	return request.post('/wechat/auth.refund/refund', data)
}

// 获取售后列表
export const getAfterSalesList = data => {
	return request.post('/wechat/auth.order/refunds', data)
}

// 取消售后
export const cancelAfterSales = data => {
	return request.post('/wechat/auth.refund/cancel', data)
}

