| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- // pages/voyages/uploadDischarge/uploadDischarge.js
- import {
- postApi
- } from "../../../apis/api"
- import {
- uploadImage
- } from "../../../utils/uploadImage"
- Page({
- data: {
- weighTime: '',
- carNum: '',
- receivingUnit: '',
- grossWeight: 0,
- tare: 0,
- netWeight: 0,
- fileObj: {}
- },
- async uploadBill(e) {
- let {
- type
- } = e.currentTarget.dataset
- let postData = {
- type,
- voyageId: this.data.voyageId
- }
- let res = await uploadImage("/voyage/uploadVoyageWayBill", postData)
- let {
- fileKey,
- viewUrl,
- downloadUrl
- } = res.result
- this.setData({
- fileKey,
- viewUrl,
- downloadUrl
- })
- },
- preview(e) {
- wx.previewImage({
- urls: [e.currentTarget.dataset.src],
- })
- },
- reupload(e) {
- wx.showModal({
- content: "是否重新上传?",
- confirmText: "确定",
- cancelText: "取消",
- success: res => {
- if (res.confirm) {
- this.uploadBill(e)
- }
- }
- })
- },
- async submit() {
- let {
- weighTime,
- carNum,
- receivingUnit,
- grossWeight,
- tare,
- netWeight,
- portId,
- voyageId,
- fileKey,
- viewUrl,
- downloadUrl
- } = this.data
- let postData = {
- loginAccountId: wx.getStorageSync('loginAccountId'),
- voyageId,
- portId,
- carNum,
- receivingUnit,
- grossWeight,
- tare,
- netWeight,
- weighTime: weighTime.replaceAll('-', '/') + " 00:00:00",
- fileKey,
- viewUrl,
- downloadUrl
- }
- let res = await postApi("/voyage/addCarLoadRecord", postData)
- wx.setStorageSync('addStatus', 'success')
- wx.navigateBack()
- },
- onLoad(options) {
- this.setData({
- voyageId: options.voyageId,
- portId: options.portId
- })
- },
- })
|