public-io-order.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { publicPlGet, publicPlPost, publicPlUpload } from '@/utils/http/public-pl'
  2. export interface PublicIoOrderItem {
  3. id: string
  4. productNo?: string
  5. productName?: string
  6. specification?: string
  7. unit?: string
  8. planQty?: number
  9. actualQty?: number
  10. packageSpec?: string
  11. remark?: string
  12. }
  13. export interface PublicIoOrderPage {
  14. title?: string
  15. orderNo?: string
  16. status?: string
  17. businessType?: string
  18. partnerCompany?: string
  19. vehicleNo?: string
  20. planNo?: string
  21. planDate?: string
  22. planRemark?: string
  23. pickupAddress?: string
  24. pickupLng?: number | null
  25. pickupLat?: number | null
  26. pickupTime?: string
  27. pickupNotes?: string
  28. destinationName?: string
  29. destinationAddress?: string
  30. destinationLng?: number | null
  31. destinationLat?: number | null
  32. deliveryTime?: string
  33. destinationNotes?: string
  34. siteFeedbackRemark?: string
  35. siteFeedbackImages?: string[]
  36. siteFeedbackTime?: string
  37. voided: boolean
  38. items: PublicIoOrderItem[]
  39. }
  40. export function createPublicIoOrderApi(kind: 'inbound' | 'outbound') {
  41. const base = `/public/pl/${kind}`
  42. return {
  43. getPage: (token: string) => publicPlGet<PublicIoOrderPage>(`${base}/${token}`),
  44. saveFeedback: (
  45. token: string,
  46. data: {
  47. remark?: string
  48. images?: string[]
  49. items: { id: string; actualQty: number }[]
  50. }
  51. ) => publicPlPost<{ success: boolean }>(`${base}/${token}/feedback`, data),
  52. uploadAttachment: (token: string, file: File) =>
  53. publicPlUpload<{ fileUrl: string }>(`${base}/${token}/attachments`, file)
  54. }
  55. }
  56. export const publicInboundOrderApi = createPublicIoOrderApi('inbound')
  57. export const publicOutboundOrderApi = createPublicIoOrderApi('outbound')