| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- // pages/voyages/uploadDischarge/uploadDischarge.js
- import {
- postApi
- } from "../../../apis/api"
- import {
- uploadImage
- } from "../../../utils/uploadImage"
- Page({
- data: {
- dischargeTime: '',
- dischargeTons: 0,
- dischargePieces: 0,
- fileList: [],
- },
- async uploadBill(e) {
- let {
- type
- } = e.currentTarget.dataset
- let postData = {
- type,
- voyageId: this.data.voyageId
- }
- let res = await uploadImage("/voyage/uploadVoyageWayBill", postData)
- let {
- id,
- viewUrl
- } = res.result
- this.data.fileList.push({
- id,
- viewUrl
- })
- this.setData({
- fileList: this.data.fileList
- })
- },
- async submit() {
- let {
- dischargeTime,
- dischargeTons,
- dischargePieces,
- fileList,
- portId,
- voyageId
- } = this.data
- let arr = []
- for (let i of fileList) {
- arr.push(i.id)
- }
- let postData = {
- loginAccountId: wx.getStorageSync('loginAccountId'),
- voyageId,
- portId,
- dischargeTons,
- dischargePieces,
- dischargeTime: dischargeTime.replaceAll('-', '/') + " 00:00:00",
- voyageFileIds: arr.join(',')
- }
- let res = await postApi("/voyage/addDischarge", postData)
- wx.navigateBack()
- },
- onLoad(options) {
- this.setData({
- voyageId: options.voyageId,
- portId: options.portId
- })
- },
- })
|