const http = uni.$u.http

/**
 * 创建订单
 * @param {
	 groundId: "场地ID",
	 orderDate: "订单日期",
	 hourList: {
		 startHour: "",
		 endHour: ""
	 }
 }
 *@@return {
	 orderId: "订单id",
	 orderNo: "订单编号",
	 belongGym: "所属球馆",
	 groundNum: "场地号",
	 orderTime: "下单时间",
	 appointmentStartTime: "预约开始时间",
	 appointmentEndTime	: "预约结束时间",
	 payAmount: "支付金额",
	 peopleNum: "参与人数",
	 serviceCharge: "手续费",
	 commission: "抽佣",
	 orderType: "0整租1约球",
	 state: "0待确定1已确定2取消3不满足开场条件取消",
	 businessId: "商家id",
	 clientId: "客户id"
 }
 */
export const createOrde = (data, config= {}) => http.post('/ground-business/ground/createOrder', data, {custom: {auth: true}})

/**
 * 确定订单
 * @param {
	 orderId: "订单ID"
 }
*/
export const confirmOrder = (data) => http.get('/ground-business/ground/confirmOrder', { params: data, custom: {auth: true}})

/**
 * 商户取消订单
 * @param {
	 orderId: "订单ID",
	 type: "0取消订单1不满足开场条件取消"
 }
*/
export const cancelOrder = (data) => http.post('/ground-business/ground/businessCancelOrder', data, {custom: {auth: true}})

/**
 * 查询实时订单列表
 * @return {
	 orderId: "订单ID",
	 orderNo: "",
	 belongGym: "附属球馆",
	 groundNum: "场地号",
	 orderTime: "下单时间",
	 appointmentStartTime: "预约开始时间",
	 appointmentEndTime	: "预约结束时间",
	 payAmount: "支付金额",
	 peopleNum: "参与人数",
	 serviceCharge: "手续费",
	 commission: "抽佣",
	 orderType: "0整租1约球",
	 state: "0待确定1已确定2取消3不满足开场条件取消",
	 businessId: "商家id",
	 clientId: "客户id"
	}
*/
export const getOrderList = (data) => http.get('/ground-order/order/list', {params: data, custom: {auth: true}})

/**
 * 商家查询退款订单列表
 * @param {
	 businessId: "商家ID",
	 pageNum: "页码",
	 pageSize: "页数"
 }
*/
export const getAftersalesOrder = (data) => http.get('/ground-order/aftersales/list', { params: data, custom: {auth: true}})

/**
 * 商家查询订单评价列表
 * @param {
	 businessId: "商家ID",
	 pageNum: "页码",
	 pageSize: "页数"
 }
*/
export const getCommentOrder = (data) => http.get('/ground-order/comment/list', { params: data, custom: {auth: true}})


/**
 * 获取订单状态
*/
export const getOrderState = (data) => http.get('/system/dict/data/type/order_state', { params: data, custom: {auth: true}})

/**
 * 获取退货订单状态
*/
export const getRefundState = (data) => http.get('/system/dict/data/type/aftersales_state', { params: data, custom: {auth: true}})

/**
 * 获取订单评价状态
*/
export const getCommentState = (data) => http.get('/system/dict/data/type/order_comment_state', { params: data, custom: {auth: true}})

/**
 * 商家审核申请退款
 * @param {
	 salesId: "售后ID",
	 state: "0拒绝退款1退全款2发起人退50%其余退全款"
 }
*/
export const businessLookRefund = (data) => http.post('/ground-order/myOrder/approveAfterSale', data, { custom: {auth: true}})

/**
 * 商家回复评价
 * @param {
	 commentId: "评论ID",
	 reply: "回复内容"
 }
*/
export const businessReply = (data) => http.post('/ground-order/comment/replyComment', data, { custom: {auth: true}})

/**
 * 商家申诉恶意评价
 * @param {
	 commentId: "评论ID",
	 appealReason: "申诉原因"
 }
*/
export const businessAppealReason = (data) => http.post('/ground-order/comment/appealComment', data, { custom: {auth: true}})