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