orderAPI.dart 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import 'package:dio/dio.dart';
  2. import 'package:farmer_client/utils/Request.dart';
  3. import 'showError.dart';
  4. /**
  5. * 订单列表
  6. * @param {*} data
  7. * @returns
  8. */
  9. Future getOrderList(params) async {
  10. return request('/order',
  11. options: Options(method: 'GET'), queryParameters: params)
  12. .catchError(showError);
  13. }
  14. /**
  15. * 订单详情
  16. * @param {*} data
  17. * @returns
  18. */
  19. Future orderInfo(String id) async {
  20. return request(
  21. '/order/$id',
  22. options: Options(method: 'GET'),
  23. ).catchError(showError);
  24. }
  25. /**
  26. * 生成订单
  27. * @param {*} data
  28. * @returns
  29. */
  30. Future generateOrder(item) async {
  31. return request('/order', options: Options(method: 'POST'), data: item)
  32. .catchError(showError);
  33. }
  34. /**
  35. * 删除订单
  36. * @param {*} data
  37. * @returns
  38. */
  39. Future orderDelete(String id) async {
  40. return request('/order/$id', options: Options(method: 'DELETE'))
  41. .catchError(showError);
  42. }
  43. /**
  44. * --------------订单退款-----------------
  45. * @param {*} data
  46. * @returns
  47. */
  48. Future orderRefund(String id) async {
  49. return request('/order/$id/refund', options: Options(method: 'PUT'))
  50. .catchError(showError);
  51. }
  52. /**
  53. * 评价订单
  54. * @param {*} data
  55. * @returns
  56. */
  57. Future orderEvaluation(String orderId, num score, String content) async {
  58. return request('/evaluation',
  59. options: Options(method: 'POST'),
  60. data: {'orderId': orderId, 'score': score, 'content': content})
  61. .catchError(showError);
  62. }