uploadCarLoadRecord.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // pages/voyages/uploadDischarge/uploadDischarge.js
  2. import {
  3. postApi
  4. } from "../../../apis/api"
  5. import {
  6. uploadImage
  7. } from "../../../utils/uploadImage"
  8. Page({
  9. data: {
  10. weighTime: '',
  11. carNum: '',
  12. receivingUnit: '',
  13. grossWeight: 0,
  14. tare: 0,
  15. netWeight: 0,
  16. fileObj: {}
  17. },
  18. async uploadBill(e) {
  19. let {
  20. type
  21. } = e.currentTarget.dataset
  22. let postData = {
  23. type,
  24. voyageId: this.data.voyageId
  25. }
  26. let res = await uploadImage("/voyage/uploadVoyageWayBill", postData)
  27. let {
  28. fileKey,
  29. viewUrl,
  30. downloadUrl
  31. } = res.result
  32. this.setData({
  33. fileKey,
  34. viewUrl,
  35. downloadUrl
  36. })
  37. },
  38. async submit() {
  39. let {
  40. weighTime,
  41. carNum,
  42. receivingUnit,
  43. grossWeight,
  44. tare,
  45. netWeight,
  46. portId,
  47. voyageId,
  48. fileKey,
  49. viewUrl,
  50. downloadUrl
  51. } = this.data
  52. let postData = {
  53. loginAccountId: wx.getStorageSync('loginAccountId'),
  54. voyageId,
  55. portId,
  56. carNum,
  57. receivingUnit,
  58. grossWeight,
  59. tare,
  60. netWeight,
  61. weighTime: weighTime.replaceAll('-', '/') + " 00:00:00",
  62. fileKey,
  63. viewUrl,
  64. downloadUrl
  65. }
  66. let res = await postApi("/voyage/addCarLoadRecord", postData)
  67. wx.setStorageSync('addStatus', 'success')
  68. wx.navigateBack()
  69. },
  70. onLoad(options) {
  71. this.setData({
  72. voyageId: options.voyageId,
  73. portId: options.portId
  74. })
  75. },
  76. })