index.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. import type { OrdersEntity, PageConfig } from '@vben/types';
  2. import { parseQueryValues } from '@vben/utils';
  3. import dayjs from 'dayjs';
  4. import { requestClient } from '#/api/request';
  5. interface OrdersPartialEntity
  6. extends Partial<Omit<OrdersEntity, 'ordersnumber'>> {
  7. ordersnumber?: string;
  8. }
  9. export interface OrdersQueryParams extends OrdersPartialEntity, PageConfig {}
  10. /**
  11. * 订单信息_列表
  12. */
  13. export async function getOrdersListApi(params: any) {
  14. const {
  15. ordersnumber,
  16. ordersproductname,
  17. ordersuserid1,
  18. ordersorderdate,
  19. pageindex,
  20. rows,
  21. } = params;
  22. const queryParams = {
  23. pageindex,
  24. rows,
  25. } as any;
  26. if (ordersnumber) {
  27. queryParams['ordersnumber.value'] = ordersnumber;
  28. }
  29. if (ordersproductname) {
  30. queryParams['ordersproductname.like'] = ordersproductname;
  31. }
  32. if (ordersuserid1) {
  33. queryParams['ordersuserid1.value'] = ordersuserid1;
  34. }
  35. if (ordersorderdate && ordersorderdate.length > 0) {
  36. queryParams['ordersorderdate.start'] = dayjs(ordersorderdate[0])
  37. .startOf('day')
  38. .format('YYYY-MM-DD HH:mm:ss');
  39. queryParams['ordersorderdate.end'] = dayjs(ordersorderdate[1])
  40. .endOf('day')
  41. .format('YYYY-MM-DD HH:mm:ss');
  42. }
  43. queryParams['ordersorderdate.sort'] = 1;
  44. return requestClient.post<any>('/api/query/list?pagevalue=101', queryParams);
  45. }
  46. /**
  47. * 订单信息_详情
  48. */
  49. export async function getOrdersDetailApi(data: { ordersid: string }) {
  50. return requestClient.post<any>(
  51. '/api/query/view?pagevalue=102',
  52. {
  53. ...parseQueryValues(data),
  54. },
  55. { formatData: true }, // 格式化返回数据
  56. );
  57. }
  58. /**
  59. * 订单信息_新增
  60. */
  61. export async function addOrdersApi(data: OrdersEntity) {
  62. return requestClient.post<any>('/api/add?pagevalue=53', { ...data });
  63. }
  64. /**
  65. * 客户信息_编辑
  66. */
  67. export async function editOrdersApi(data: OrdersEntity) {
  68. return requestClient.post<any>('/api/up?pagevalue=54', { ...data });
  69. }
  70. /**
  71. * 订单信息_删除
  72. */
  73. export async function deleteOrdersApi(data: { 'ordersid.value': string }) {
  74. return requestClient.post<any>('/api/del?pagevalue=55', { ...data });
  75. }
  76. /**
  77. * 订单信息_审核
  78. */
  79. export async function auditOrdersApi(data: {
  80. 'ordersid.value': string;
  81. ordersshbz?: string;
  82. ordsesshzt: number;
  83. }) {
  84. return requestClient.post<any>('/api/up?pagevalue=114', { ...data });
  85. }