order.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import request from '../utils/request.js'
  2. class order extends request {
  3. static async getOrderList(page = 1, pageSize = 10, orderStatus, writeOffStatus,foodOrder=2) {
  4. const res = await this.getRequest(`${this.BASE_URL}Order/index?page=${page}&pageSize=${pageSize}&orderStatus=${orderStatus}&writeOffStatus=${writeOffStatus}&foodOrder=${foodOrder}`)
  5. return res.data
  6. }
  7. static async getDiscussOffOrderList(page = 1, pageSize = 10, orderStatus, writeOffStatus) {
  8. const res = await this.getRequest(`${this.BASE_URL}Order/index?page=${page}&pageSize=${pageSize}&orderStatus=${orderStatus}&writeOffStatus=${writeOffStatus}&discussStatus=1`)
  9. return res.data
  10. }
  11. static async getAllOrderList(page = 1, pageSize = 10) {
  12. const res = await this.getRequest(`${this.BASE_URL}Order/index?page=${page}&pageSize=${pageSize}`)
  13. return res.data
  14. }
  15. static async getOrderById(id) {
  16. const res = await this.getRequest(`${this.BASE_URL}Order/read?id=${id}`)
  17. return res.data
  18. }
  19. static async payOrderAgain(data) {
  20. const res = await this.postRequest(`${this.BASE_URL}Order/payOrderAgain`,data)
  21. return res.data
  22. }
  23. static async refreshCode(data) {
  24. const res = await this.postRequest(`${this.BASE_URL}Order/changeCode`,data)
  25. return res.data
  26. }
  27. static async createOrder(data) {
  28. const res = await this.postRequest(`${this.BASE_URL}Order/createOrder`,data)
  29. return res.data
  30. }
  31. static async deleteOrder(id) {
  32. const res = await this.postRequest(`${this.BASE_URL}Order/deleteOrder?orderId=${id}`)
  33. return res.data
  34. }
  35. static async closeOrder(id) {
  36. const res = await this.postRequest(`${this.BASE_URL}Order/closeOrder?orderId=${id}`)
  37. return res
  38. }
  39. static async createFoodOrder(data) {
  40. const res = await this.postRequest(`${this.BASE_URL}Order/createFoodOrder`,data)
  41. return res.data
  42. }
  43. }
  44. export default order