import request from '../utils/request.js' class order extends request { static async getOrderList(page = 1, pageSize = 10, orderStatus, writeOffStatus,foodOrder=2) { const res = await this.getRequest(`${this.BASE_URL}Order/index?page=${page}&pageSize=${pageSize}&orderStatus=${orderStatus}&pay=${writeOffStatus}&foodOrder=${foodOrder}`) return res.data } static async getDiscussOffOrderList(page = 1, pageSize = 10, orderStatus, writeOffStatus) { const res = await this.getRequest(`${this.BASE_URL}Order/index?page=${page}&pageSize=${pageSize}&orderStatus=${orderStatus}&pay=${writeOffStatus}`) return res.data } static async getAllOrderList(page = 1, pageSize = 10) { const res = await this.getRequest(`${this.BASE_URL}Order/index?page=${page}&pageSize=${pageSize}`) return res.data } static async getOrderById(id) { const res = await this.getRequest(`${this.BASE_URL}Order/read?id=${id}`) return res.data } static async payOrderAgain(data) { const res = await this.postRequest(`${this.BASE_URL}Order/payOrderAgain`,data) return res.data } static async refreshCode(data) { const res = await this.postRequest(`${this.BASE_URL}Order/changeCode`,data) return res.data } static async createOrder(data) { const res = await this.postRequest(`${this.BASE_URL}Order/createOrder`,data) return res.data } static async deleteOrder(id) { const res = await this.postRequest(`${this.BASE_URL}Order/deleteOrder?orderId=${id}`) return res.data } static async closeOrder(id) { const res = await this.postRequest(`${this.BASE_URL}Order/closeOrder?orderId=${id}`) return res } static async createFoodOrder(data) { const res = await this.postRequest(`${this.BASE_URL}Order/createFoodOrder`,data) return res.data } static async startServer(orderId) { const res = await this.postRequest(`${this.BASE_URL}Order/serverStart`,{orderId:orderId}) return res.data } static async endServer(orderId) { const res = await this.postRequest(`${this.BASE_URL}Order/serverComplete`,{orderId:orderId}) return res.data } static async payOrder(orderIdList){ const res = await this.postRequest(`${this.BASE_URL}Order/xcxPay`,{orderIds:orderIdList}) return res.data } static async createMasterOrder(data) { const res = await this.postRequest(`${this.BASE_URL}Order/payMasterOrder`,data) return res.data } } export default order