import request from '@/utils/request'
import {upFilse} from '@/utils/request'
// 订单确认
export function confirm(data) {
	return request({
		url: '/api/order/confirm',
		method: 'post',
		data
	});
}
//获取可使用优惠券
export function couponsOrder(data,price) {
	return request({
		url: '/api/coupons/order/'+price,
		method: 'get',
		data
	});
}
//获取优惠券列表
export function getCouponsList(data,types) {
	//优惠券状态 0全部 1未使用 2已使用
	return request({
		url: '/api/coupons/user/'+types,
		method: 'get',
		data
	});
}
//提交评论
export function order_comment(data) {
	return request({
		url: '/api/order/comment',
		method: 'post',
		data
	});
}
//订单产品信息
export function product(data) {
	return request({
		url: '/api/order/product',
		method: 'post',
		data
	});
}
// 快递查询
export function express_query(data) {
	return request({
		url: '/api/order/express_query',
		method: 'get',
		data
	});
}
//上传图片
export function upload(data) {
	return upFilse({
		url: '/api/upload/image',
		method: 'post',
		data
	});
}
// 订单列表
export function orderList(data) {
	return request({
		url: '/api/order/list',
		method: 'get',
		data
	});
}
// 订单详细
export function orderDetail(data,orderid) {
	return request({
		url: '/api/order/detail/'+orderid,
		method: 'get',
		data
	});
}

// 订单详细
export function orderAdminDetail(data,orderid) {
	return request({
		url: '/api/admin/order/detail/'+orderid,
		method: 'get',
		data
	});
}

// 取消订单
export function orderCancel(data) {
	return request({
		url: '/api/order/cancel',
		method: 'post',
		data
	});
}

// 删除订单
export function orderDel(data) {
	return request({
		url: '/api/order/del',
		method: 'get',
		data
	});
}
// 申请退款
export function refund(data) {
	return request({
		url: '/api/order/refund/verify',
		method: 'post',
		data
	});
}
// 退款理由列表
export function refundReason(data) {
	return request({
		url: '/api/order/refund/reason',
		method: 'get',
		data
	});
}

// 确认收货
export function orderTake(data) {
	return request({
		url: '/api/order/take',
		method: 'post',
		data
	});
}

// 订单支付
export function orderPay(data) {
	return request({
		url: '/api/order/pay',
		method: 'post',
		data
	});
}

// 创建订单
export function createOrderkey(data,key) {
	return request({
		url: '/api/order/create/'+key,
		method: 'post',
		data
	});
}

// 统计订单金额
export function computedOrderkey(data) {
	return request({
		url: '/api/order/computed/'+data.orderkey,
		method: 'post',
		data
	});
}

//管理orderList
export function GetAdminOrderList(data) {
	return request({
		url: '/api/admin/order/list',
		method: 'get',
		data
	});
}
//同意退款
export function aOrderRefund(data) {
	return request({
		url: '/api/admin/order/refund',
		method: 'post',
		data
	});
}

//退换押金
export function backDeposit(data) {
	return request({
		url: '/api/admin/order/back_deposit',
		method: 'post',
		data
	});
}

export function orderData(data) {
	return request({
		url: '/api/order/data',
		method: 'get',
		data
	});
}
//order/give/:uni 赠送订单
export function orderGive(data,uni) {
	return request({
		url: '/api/order/give/' + uni,
		method: 'post',
		data
	});
}


export function getUserList(data) {
	return request({
		url: '/api/user_list',
		method: 'get',
		data
	});
}

// 发货
export function delivery(data) {
	return request({
		url:'/api/admin/order/delivery/keep',
		method: 'post',
		data
	})
}

// 获取我的兑换券列表
export function getMyexchange(data) {
	return request({
		url:'/api/exchange/order_list',
		method: 'get',
		data
	})
}

//领取兑换券
export function getGift(data,id) {
	return request({
		url:'/api/exchange_order/give/' + id,
		method: 'post',
		data
	})
}
// 获取admin/exchange
export function getAdminExchangeList(data) {
	return request({
		url:'/api/admin/exchange_order/list',
		method: 'get',
		data
	})
}
// 退还兑换券押金
export function backExchangeDeposit(data) {
	return request({
		url:'/api/admin/exchange_order/back_deposit',
		method: 'post',
		data
	})
}