|
@@ -1,14 +1,10 @@
|
|
|
// pages/voyages/detail/detail.js
|
|
// pages/voyages/detail/detail.js
|
|
|
-import {
|
|
|
|
|
- postApi
|
|
|
|
|
-} from "../../../apis/api"
|
|
|
|
|
|
|
+import { postApi } from "../../../apis/api";
|
|
|
|
|
|
|
|
-import {
|
|
|
|
|
- uploadImage
|
|
|
|
|
-} from "../../../utils/uploadImage"
|
|
|
|
|
|
|
+import { uploadImage } from "../../../utils/uploadImage";
|
|
|
Page({
|
|
Page({
|
|
|
data: {
|
|
data: {
|
|
|
- id: '',
|
|
|
|
|
|
|
+ id: "",
|
|
|
tab: 1,
|
|
tab: 1,
|
|
|
shipDischargeCurrentPage: 1,
|
|
shipDischargeCurrentPage: 1,
|
|
|
truckLoadCurrentPage: 1,
|
|
truckLoadCurrentPage: 1,
|
|
@@ -17,17 +13,19 @@ Page({
|
|
|
policys: [],
|
|
policys: [],
|
|
|
voyage: {},
|
|
voyage: {},
|
|
|
waybills: [],
|
|
waybills: [],
|
|
|
- infoType: 'ship',
|
|
|
|
|
|
|
+ infoType: "ship",
|
|
|
shipDischargeList: [],
|
|
shipDischargeList: [],
|
|
|
truckLoadList: [],
|
|
truckLoadList: [],
|
|
|
shipDischargeTotal: 0,
|
|
shipDischargeTotal: 0,
|
|
|
truckLoadTotal: 0,
|
|
truckLoadTotal: 0,
|
|
|
- polyline: [{
|
|
|
|
|
- points: [],
|
|
|
|
|
- width: 2,
|
|
|
|
|
- dottedLine: true,
|
|
|
|
|
- color: "#eb2f06"
|
|
|
|
|
- }],
|
|
|
|
|
|
|
+ polyline: [
|
|
|
|
|
+ {
|
|
|
|
|
+ points: [],
|
|
|
|
|
+ width: 2,
|
|
|
|
|
+ dottedLine: true,
|
|
|
|
|
+ color: "#eb2f06",
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
markers: [],
|
|
markers: [],
|
|
|
points: [],
|
|
points: [],
|
|
|
pageSize: 30,
|
|
pageSize: 30,
|
|
@@ -35,62 +33,52 @@ Page({
|
|
|
longitude: 120.551369,
|
|
longitude: 120.551369,
|
|
|
currentPortId: 0,
|
|
currentPortId: 0,
|
|
|
dischargeModal: false,
|
|
dischargeModal: false,
|
|
|
- currentDischargePortId: '',
|
|
|
|
|
- currentDischargePort: '',
|
|
|
|
|
|
|
+ currentDischargePortId: "",
|
|
|
|
|
+ currentDischargePort: "",
|
|
|
tab2disabled: false,
|
|
tab2disabled: false,
|
|
|
currentDischargeIndex: 0,
|
|
currentDischargeIndex: 0,
|
|
|
tab3CurrentDischargeIndex: 0,
|
|
tab3CurrentDischargeIndex: 0,
|
|
|
uploadBillVisable: true,
|
|
uploadBillVisable: true,
|
|
|
currentBeforePortIndex: 0,
|
|
currentBeforePortIndex: 0,
|
|
|
- beforePorts: []
|
|
|
|
|
|
|
+ beforePorts: [],
|
|
|
},
|
|
},
|
|
|
changeTab(e) {
|
|
changeTab(e) {
|
|
|
- let {
|
|
|
|
|
- tab
|
|
|
|
|
- } = e.currentTarget.dataset
|
|
|
|
|
|
|
+ let { tab } = e.currentTarget.dataset;
|
|
|
this.setData({
|
|
this.setData({
|
|
|
- tab
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ tab,
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
async getVoyageDetail() {
|
|
async getVoyageDetail() {
|
|
|
let res = await postApi("/voyage/detail", {
|
|
let res = await postApi("/voyage/detail", {
|
|
|
voyageId: this.data.id,
|
|
voyageId: this.data.id,
|
|
|
- loginAccountId: wx.getStorageSync('loginAccountId'),
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ loginAccountId: wx.getStorageSync("loginAccountId"),
|
|
|
|
|
+ });
|
|
|
if (res.data.status == 0) {
|
|
if (res.data.status == 0) {
|
|
|
- let {
|
|
|
|
|
- coordinates,
|
|
|
|
|
- medias,
|
|
|
|
|
- policys,
|
|
|
|
|
- voyage,
|
|
|
|
|
- waybills
|
|
|
|
|
- } = res.data.result
|
|
|
|
|
|
|
+ let { coordinates, medias, policys, voyage, waybills } = res.data.result;
|
|
|
if (coordinates.length) {
|
|
if (coordinates.length) {
|
|
|
- let points = []
|
|
|
|
|
|
|
+ let points = [];
|
|
|
for (let i of coordinates) {
|
|
for (let i of coordinates) {
|
|
|
points.push({
|
|
points.push({
|
|
|
latitude: i.latitude,
|
|
latitude: i.latitude,
|
|
|
- longitude: i.longitude
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ longitude: i.longitude,
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- let {
|
|
|
|
|
- latitude,
|
|
|
|
|
- longitude
|
|
|
|
|
- } = points[points.length - 1]
|
|
|
|
|
- this.data.latitude = latitude
|
|
|
|
|
- this.data.longitude = longitude
|
|
|
|
|
- this.data.polyline[0].points = points
|
|
|
|
|
- let id = 1
|
|
|
|
|
|
|
+ let { latitude, longitude } = points[points.length - 1];
|
|
|
|
|
+ this.data.latitude = latitude;
|
|
|
|
|
+ this.data.longitude = longitude;
|
|
|
|
|
+ this.data.polyline[0].points = points;
|
|
|
|
|
+ let id = 1;
|
|
|
for (let i of points) {
|
|
for (let i of points) {
|
|
|
this.data.markers.push({
|
|
this.data.markers.push({
|
|
|
id: id + 1,
|
|
id: id + 1,
|
|
|
latitude: i.latitude,
|
|
latitude: i.latitude,
|
|
|
longitude: i.longitude,
|
|
longitude: i.longitude,
|
|
|
- iconPath: "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/red-circle.png?sign=6d208881376358fb4111aa6d7f1a7846&t=1647934972",
|
|
|
|
|
|
|
+ iconPath:
|
|
|
|
|
+ "https://frontend-1255802371.cos.ap-shanghai.myqcloud.com/miniapp-static/red-circle.png?sign=6d208881376358fb4111aa6d7f1a7846&t=1647934972",
|
|
|
height: 20,
|
|
height: 20,
|
|
|
- width: 20
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ width: 20,
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
this.setData({
|
|
this.setData({
|
|
@@ -98,26 +86,24 @@ Page({
|
|
|
markers: this.data.markers,
|
|
markers: this.data.markers,
|
|
|
latitude: this.data.latitude,
|
|
latitude: this.data.latitude,
|
|
|
longitude: this.data.longitude,
|
|
longitude: this.data.longitude,
|
|
|
- points
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
|
|
+ points,
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
// voyage.arrivalLoadPortTime = this.subTimeStr(voyage.arrivalLoadPortTime)
|
|
// voyage.arrivalLoadPortTime = this.subTimeStr(voyage.arrivalLoadPortTime)
|
|
|
// voyage.loadStartTime = this.subTimeStr(voyage.loadStartTime)
|
|
// voyage.loadStartTime = this.subTimeStr(voyage.loadStartTime)
|
|
|
// voyage.loadEndTime = this.subTimeStr(voyage.loadEndTime)
|
|
// voyage.loadEndTime = this.subTimeStr(voyage.loadEndTime)
|
|
|
// voyage.setSailTime = this.subTimeStr(voyage.setSailTime)
|
|
// voyage.setSailTime = this.subTimeStr(voyage.setSailTime)
|
|
|
// voyage.expectedArrivalTime = this.subTimeStr(voyage.expectedArrivalTime)
|
|
// voyage.expectedArrivalTime = this.subTimeStr(voyage.expectedArrivalTime)
|
|
|
- let dischargePortIds = voyage.dischargePortIds.split(',')
|
|
|
|
|
- let dischargePorts = voyage.dischargePorts.split(',')
|
|
|
|
|
- let discLength = dischargePortIds.length
|
|
|
|
|
|
|
+ let dischargePortIds = voyage.dischargePortIds.split(",");
|
|
|
|
|
+ let dischargePorts = voyage.dischargePorts.split(",");
|
|
|
|
|
+ let discLength = dischargePortIds.length;
|
|
|
|
|
|
|
|
for (let item of voyage.voyageDetails) {
|
|
for (let item of voyage.voyageDetails) {
|
|
|
-
|
|
|
|
|
- item.setSailTime = this.subTimeStr(item.setSailTime)
|
|
|
|
|
- item.expectedArrivalTime = this.subTimeStr(item.expectedArrivalTime)
|
|
|
|
|
- item.actualArrivalTime = this.subTimeStr(item.actualArrivalTime)
|
|
|
|
|
- item.dischargeStartTime = this.subTimeStr(item.dischargeStartTime)
|
|
|
|
|
- item.dischargeEndTime = this.subTimeStr(item.dischargeEndTime)
|
|
|
|
|
|
|
+ item.setSailTime = this.subTimeStr(item.setSailTime);
|
|
|
|
|
+ item.expectedArrivalTime = this.subTimeStr(item.expectedArrivalTime);
|
|
|
|
|
+ item.actualArrivalTime = this.subTimeStr(item.actualArrivalTime);
|
|
|
|
|
+ item.dischargeStartTime = this.subTimeStr(item.dischargeStartTime);
|
|
|
|
|
+ item.dischargeEndTime = this.subTimeStr(item.dischargeEndTime);
|
|
|
}
|
|
}
|
|
|
this.setData({
|
|
this.setData({
|
|
|
coordinates,
|
|
coordinates,
|
|
@@ -129,15 +115,15 @@ Page({
|
|
|
dischargePortIds,
|
|
dischargePortIds,
|
|
|
dischargePorts,
|
|
dischargePorts,
|
|
|
discLength,
|
|
discLength,
|
|
|
- tab2disabled: voyage.voyageStatus == 2
|
|
|
|
|
- })
|
|
|
|
|
- this.getCarLoadRecordList()
|
|
|
|
|
- this.getDischargeList()
|
|
|
|
|
|
|
+ tab2disabled: voyage.voyageStatus == 2,
|
|
|
|
|
+ });
|
|
|
|
|
+ this.getCarLoadRecordList();
|
|
|
|
|
+ this.getDischargeList();
|
|
|
} else {
|
|
} else {
|
|
|
wx.showToast({
|
|
wx.showToast({
|
|
|
- title: '获取详情失败!',
|
|
|
|
|
- icon: "error"
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ title: "获取详情失败!",
|
|
|
|
|
+ icon: "error",
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
subTimeStr(str) {
|
|
subTimeStr(str) {
|
|
@@ -148,41 +134,41 @@ Page({
|
|
|
|
|
|
|
|
async getCarLoadRecordList(isScroll) {
|
|
async getCarLoadRecordList(isScroll) {
|
|
|
if (isScroll) {
|
|
if (isScroll) {
|
|
|
- this.data.truckLoadCurrentPage += 1
|
|
|
|
|
|
|
+ this.data.truckLoadCurrentPage += 1;
|
|
|
} else {
|
|
} else {
|
|
|
- this.data.truckLoadCurrentPage = 1
|
|
|
|
|
|
|
+ this.data.truckLoadCurrentPage = 1;
|
|
|
}
|
|
}
|
|
|
let res = await postApi("/voyage/getCarLoadRecordList", {
|
|
let res = await postApi("/voyage/getCarLoadRecordList", {
|
|
|
portId: this.data.currentPortId,
|
|
portId: this.data.currentPortId,
|
|
|
voyageId: this.data.id,
|
|
voyageId: this.data.id,
|
|
|
size: this.data.pageSize,
|
|
size: this.data.pageSize,
|
|
|
currentPage: this.data.truckLoadCurrentPage,
|
|
currentPage: this.data.truckLoadCurrentPage,
|
|
|
- loginAccountId: wx.getStorageSync('loginAccountId')
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ loginAccountId: wx.getStorageSync("loginAccountId"),
|
|
|
|
|
+ });
|
|
|
this.setData({
|
|
this.setData({
|
|
|
truckLoadCurrentPage: this.data.truckLoadCurrentPage,
|
|
truckLoadCurrentPage: this.data.truckLoadCurrentPage,
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
if (0 == res.data.status) {
|
|
if (0 == res.data.status) {
|
|
|
if (isScroll) {
|
|
if (isScroll) {
|
|
|
- let truckLoadList = [...this.data.truckLoadList, ...res.data.result]
|
|
|
|
|
|
|
+ let truckLoadList = [...this.data.truckLoadList, ...res.data.result];
|
|
|
for (let i of truckLoadList) {
|
|
for (let i of truckLoadList) {
|
|
|
- i.weighTime = this.cutTimeString(i.weighTime)
|
|
|
|
|
|
|
+ i.weighTime = this.cutTimeString(i.weighTime);
|
|
|
}
|
|
}
|
|
|
this.setData({
|
|
this.setData({
|
|
|
truckLoadList,
|
|
truckLoadList,
|
|
|
- truckLoadTotal: res.data.total
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ truckLoadTotal: res.data.total,
|
|
|
|
|
+ });
|
|
|
} else {
|
|
} else {
|
|
|
- let truckLoadList = res.data.result
|
|
|
|
|
|
|
+ let truckLoadList = res.data.result;
|
|
|
|
|
|
|
|
for (let i of truckLoadList) {
|
|
for (let i of truckLoadList) {
|
|
|
- i.weighTime = this.cutTimeString(i.weighTime)
|
|
|
|
|
|
|
+ i.weighTime = this.cutTimeString(i.weighTime);
|
|
|
}
|
|
}
|
|
|
this.setData({
|
|
this.setData({
|
|
|
truckLoadList,
|
|
truckLoadList,
|
|
|
- truckLoadTotal: res.data.total
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ truckLoadTotal: res.data.total,
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
// wx.showToast({
|
|
// wx.showToast({
|
|
@@ -194,39 +180,42 @@ Page({
|
|
|
|
|
|
|
|
async getDischargeList(isScroll) {
|
|
async getDischargeList(isScroll) {
|
|
|
if (isScroll) {
|
|
if (isScroll) {
|
|
|
- this.data.shipDischargeCurrentPage += 1
|
|
|
|
|
|
|
+ this.data.shipDischargeCurrentPage += 1;
|
|
|
} else {
|
|
} else {
|
|
|
- this.data.shipDischargeCurrentPage = 1
|
|
|
|
|
|
|
+ this.data.shipDischargeCurrentPage = 1;
|
|
|
}
|
|
}
|
|
|
let res = await postApi("/voyage/getDischargeList", {
|
|
let res = await postApi("/voyage/getDischargeList", {
|
|
|
portId: this.data.currentPortId,
|
|
portId: this.data.currentPortId,
|
|
|
voyageId: this.data.id,
|
|
voyageId: this.data.id,
|
|
|
size: this.data.pageSize,
|
|
size: this.data.pageSize,
|
|
|
currentPage: this.data.shipDischargeCurrentPage,
|
|
currentPage: this.data.shipDischargeCurrentPage,
|
|
|
- loginAccountId: wx.getStorageSync('loginAccountId')
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ loginAccountId: wx.getStorageSync("loginAccountId"),
|
|
|
|
|
+ });
|
|
|
this.setData({
|
|
this.setData({
|
|
|
shipDischargeCurrentPage: this.data.shipDischargeCurrentPage,
|
|
shipDischargeCurrentPage: this.data.shipDischargeCurrentPage,
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
if (0 == res.data.status) {
|
|
if (0 == res.data.status) {
|
|
|
if (isScroll) {
|
|
if (isScroll) {
|
|
|
- let shipDischargeList = [...this.data.shipDischargeList, ...res.data.result]
|
|
|
|
|
|
|
+ let shipDischargeList = [
|
|
|
|
|
+ ...this.data.shipDischargeList,
|
|
|
|
|
+ ...res.data.result,
|
|
|
|
|
+ ];
|
|
|
for (let i of shipDischargeList) {
|
|
for (let i of shipDischargeList) {
|
|
|
- i.dischargeTime = this.cutTimeString(i.dischargeTime)
|
|
|
|
|
|
|
+ i.dischargeTime = this.cutTimeString(i.dischargeTime);
|
|
|
}
|
|
}
|
|
|
this.setData({
|
|
this.setData({
|
|
|
shipDischargeList,
|
|
shipDischargeList,
|
|
|
- shipDischargeTotal: res.data.total
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ shipDischargeTotal: res.data.total,
|
|
|
|
|
+ });
|
|
|
} else {
|
|
} else {
|
|
|
- let shipDischargeList = res.data.result
|
|
|
|
|
|
|
+ let shipDischargeList = res.data.result;
|
|
|
for (let i of shipDischargeList) {
|
|
for (let i of shipDischargeList) {
|
|
|
- i.dischargeTime = this.cutTimeString(i.dischargeTime)
|
|
|
|
|
|
|
+ i.dischargeTime = this.cutTimeString(i.dischargeTime);
|
|
|
}
|
|
}
|
|
|
this.setData({
|
|
this.setData({
|
|
|
shipDischargeList,
|
|
shipDischargeList,
|
|
|
- shipDischargeTotal: res.data.total
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ shipDischargeTotal: res.data.total,
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
// wx.showToast({
|
|
// wx.showToast({
|
|
@@ -234,32 +223,26 @@ Page({
|
|
|
// title: res.data.msg,
|
|
// title: res.data.msg,
|
|
|
// })
|
|
// })
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
previewImage(e) {
|
|
previewImage(e) {
|
|
|
- let {
|
|
|
|
|
- src,
|
|
|
|
|
- files
|
|
|
|
|
- } = e.currentTarget.dataset
|
|
|
|
|
- let urls = []
|
|
|
|
|
|
|
+ let { src, files } = e.currentTarget.dataset;
|
|
|
|
|
+ let urls = [];
|
|
|
if (this.data.infoType == "ship" && this.data.tab == 3) {
|
|
if (this.data.infoType == "ship" && this.data.tab == 3) {
|
|
|
- urls = files.map(item => {
|
|
|
|
|
- return item.viewUrl
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ urls = files.map((item) => {
|
|
|
|
|
+ return item.viewUrl;
|
|
|
|
|
+ });
|
|
|
} else {
|
|
} else {
|
|
|
- urls = [src]
|
|
|
|
|
|
|
+ urls = [src];
|
|
|
}
|
|
}
|
|
|
wx.previewImage({
|
|
wx.previewImage({
|
|
|
current: src, // 当前显示图片的http链接
|
|
current: src, // 当前显示图片的http链接
|
|
|
- urls // 需要预览的图片http链接列表
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ urls, // 需要预览的图片http链接列表
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
changeInfoType(e) {
|
|
changeInfoType(e) {
|
|
|
- let {
|
|
|
|
|
- type
|
|
|
|
|
- } = e.currentTarget.dataset
|
|
|
|
|
|
|
+ let { type } = e.currentTarget.dataset;
|
|
|
this.setData({
|
|
this.setData({
|
|
|
infoType: type,
|
|
infoType: type,
|
|
|
truckLoadCurrentPage: 1,
|
|
truckLoadCurrentPage: 1,
|
|
@@ -268,120 +251,126 @@ Page({
|
|
|
truckLoadList: [],
|
|
truckLoadList: [],
|
|
|
shipDischargeTotal: 0,
|
|
shipDischargeTotal: 0,
|
|
|
truckLoadTotal: 0,
|
|
truckLoadTotal: 0,
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
if (type == "ship") {
|
|
if (type == "ship") {
|
|
|
- this.getDischargeList()
|
|
|
|
|
|
|
+ this.getDischargeList();
|
|
|
} else {
|
|
} else {
|
|
|
- this.getCarLoadRecordList()
|
|
|
|
|
|
|
+ this.getCarLoadRecordList();
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
cutTimeString(str) {
|
|
cutTimeString(str) {
|
|
|
- let index = str.indexOf(' ')
|
|
|
|
|
- return index == -1 ? str : str.substring(0, index)
|
|
|
|
|
|
|
+ let index = str.indexOf(" ");
|
|
|
|
|
+ return index == -1 ? str : str.substring(0, index);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
changeBottomPage() {
|
|
changeBottomPage() {
|
|
|
if (this.data.infoType == "ship") {
|
|
if (this.data.infoType == "ship") {
|
|
|
- this.getDischargeList(true)
|
|
|
|
|
|
|
+ this.getDischargeList(true);
|
|
|
} else {
|
|
} else {
|
|
|
- this.getCarLoadRecordList(true)
|
|
|
|
|
|
|
+ this.getCarLoadRecordList(true);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
scrollShip() {
|
|
scrollShip() {
|
|
|
- if (this.data.shipDischargeTotal == 0 || this.data.shipDischargeTotal <= this.data.pageSize * this.data.shipDischargeCurrentPage) return
|
|
|
|
|
- this.getDischargeList(true)
|
|
|
|
|
|
|
+ if (
|
|
|
|
|
+ this.data.shipDischargeTotal == 0 ||
|
|
|
|
|
+ this.data.shipDischargeTotal <=
|
|
|
|
|
+ this.data.pageSize * this.data.shipDischargeCurrentPage
|
|
|
|
|
+ )
|
|
|
|
|
+ return;
|
|
|
|
|
+ this.getDischargeList(true);
|
|
|
},
|
|
},
|
|
|
scrollTruck() {
|
|
scrollTruck() {
|
|
|
- if (this.data.truckLoadTotal == 0 || this.data.truckLoadTotal <= this.data.pageSize * this.data.truckLoadCurrentPage) return
|
|
|
|
|
- this.getCarLoadRecordList(true)
|
|
|
|
|
|
|
+ if (
|
|
|
|
|
+ this.data.truckLoadTotal == 0 ||
|
|
|
|
|
+ this.data.truckLoadTotal <=
|
|
|
|
|
+ this.data.pageSize * this.data.truckLoadCurrentPage
|
|
|
|
|
+ )
|
|
|
|
|
+ return;
|
|
|
|
|
+ this.getCarLoadRecordList(true);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
changePort(e) {
|
|
changePort(e) {
|
|
|
- let tab3CurrentDischargeIndex = e.detail
|
|
|
|
|
|
|
+ let tab3CurrentDischargeIndex = e.detail;
|
|
|
this.setData({
|
|
this.setData({
|
|
|
tab3CurrentDischargeIndex,
|
|
tab3CurrentDischargeIndex,
|
|
|
currentPortId: this.data.voyageDetails[tab3CurrentDischargeIndex].portId,
|
|
currentPortId: this.data.voyageDetails[tab3CurrentDischargeIndex].portId,
|
|
|
shipDischargeList: [],
|
|
shipDischargeList: [],
|
|
|
truckLoadList: [],
|
|
truckLoadList: [],
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
if (this.data.infoType == "ship") {
|
|
if (this.data.infoType == "ship") {
|
|
|
- this.getDischargeList()
|
|
|
|
|
|
|
+ this.getDischargeList();
|
|
|
} else {
|
|
} else {
|
|
|
- this.getCarLoadRecordList()
|
|
|
|
|
|
|
+ this.getCarLoadRecordList();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
},
|
|
},
|
|
|
showAddDischargePortModal() {
|
|
showAddDischargePortModal() {
|
|
|
- let beforePorts = [{
|
|
|
|
|
- portName: this.data.loadPort,
|
|
|
|
|
- portId: 0
|
|
|
|
|
- }]
|
|
|
|
|
|
|
+ let beforePorts = [
|
|
|
|
|
+ {
|
|
|
|
|
+ portName: this.data.loadPort,
|
|
|
|
|
+ portId: 0,
|
|
|
|
|
+ },
|
|
|
|
|
+ ];
|
|
|
for (let i in this.data.dischargePorts) {
|
|
for (let i in this.data.dischargePorts) {
|
|
|
beforePorts.push({
|
|
beforePorts.push({
|
|
|
portName: this.data.dischargePorts[i],
|
|
portName: this.data.dischargePorts[i],
|
|
|
- portId: this.data.dischargePortIds[i]
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ portId: this.data.dischargePortIds[i],
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
this.setData({
|
|
this.setData({
|
|
|
dischargeModal: true,
|
|
dischargeModal: true,
|
|
|
- beforePorts
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ beforePorts,
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
onShareAppMessage() {
|
|
onShareAppMessage() {
|
|
|
- let id = wx.getStorageSync('voyageDetailId')
|
|
|
|
|
|
|
+ let id = wx.getStorageSync("voyageDetailId");
|
|
|
return {
|
|
return {
|
|
|
- title: '真实 实时 精准',
|
|
|
|
|
- path: `/pages/sharePage/sharePage?id=${id}`
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ title: "真实 实时 精准",
|
|
|
|
|
+ path: `/pages/sharePage/sharePage?id=${id}`,
|
|
|
|
|
+ };
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- doNothing() {
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ doNothing() {},
|
|
|
|
|
|
|
|
cancelAddDischargePort() {
|
|
cancelAddDischargePort() {
|
|
|
this.setData({
|
|
this.setData({
|
|
|
dischargeModal: false,
|
|
dischargeModal: false,
|
|
|
- currentDischargePortId: '',
|
|
|
|
|
- currentDischargePort: '',
|
|
|
|
|
|
|
+ currentDischargePortId: "",
|
|
|
|
|
+ currentDischargePort: "",
|
|
|
currentBeforePortIndex: 0,
|
|
currentBeforePortIndex: 0,
|
|
|
- beforePorts: []
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ beforePorts: [],
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
selectDischargePort(e) {
|
|
selectDischargePort(e) {
|
|
|
- if (this.checkPort(e.detail.label, this.data.beforePorts, 'portName')) return
|
|
|
|
|
|
|
+ if (this.checkPort(e.detail.label, this.data.beforePorts, "portName"))
|
|
|
|
|
+ return;
|
|
|
this.setData({
|
|
this.setData({
|
|
|
currentDischargePortId: e.detail.value,
|
|
currentDischargePortId: e.detail.value,
|
|
|
- currentDischargePort: e.detail.label
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ currentDischargePort: e.detail.label,
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
deleteDischargePort(e) {
|
|
deleteDischargePort(e) {
|
|
|
- let {
|
|
|
|
|
- index
|
|
|
|
|
- } = e.currentTarget.dataset
|
|
|
|
|
|
|
+ let { index } = e.currentTarget.dataset;
|
|
|
wx.showModal({
|
|
wx.showModal({
|
|
|
title: `确认删除: ${this.data.dischargePorts[index]}?`,
|
|
title: `确认删除: ${this.data.dischargePorts[index]}?`,
|
|
|
content: `此操作会同时删除当前港口下的记录`,
|
|
content: `此操作会同时删除当前港口下的记录`,
|
|
|
success: async (res) => {
|
|
success: async (res) => {
|
|
|
if (res.confirm) {
|
|
if (res.confirm) {
|
|
|
- let {
|
|
|
|
|
- data
|
|
|
|
|
- } = await postApi('/voyage/deletePort', {
|
|
|
|
|
|
|
+ let { data } = await postApi("/voyage/deletePort", {
|
|
|
voyageId: this.data.id,
|
|
voyageId: this.data.id,
|
|
|
- portId: this.data.dischargePortIds[index]
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ portId: this.data.dischargePortIds[index],
|
|
|
|
|
+ });
|
|
|
if (data.status == 0) {
|
|
if (data.status == 0) {
|
|
|
wx.showToast({
|
|
wx.showToast({
|
|
|
- title: '删除成功',
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ title: "删除成功",
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- this.getVoyageDetail()
|
|
|
|
|
|
|
+ this.getVoyageDetail();
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
checkPort(portName = -1, ports = [], attr) {
|
|
checkPort(portName = -1, ports = [], attr) {
|
|
@@ -390,179 +379,170 @@ Page({
|
|
|
});
|
|
});
|
|
|
if (b) {
|
|
if (b) {
|
|
|
wx.showToast({
|
|
wx.showToast({
|
|
|
- title: '港口已存在',
|
|
|
|
|
- icon: "error"
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ title: "港口已存在",
|
|
|
|
|
+ icon: "error",
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
return b;
|
|
return b;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
-
|
|
|
|
|
async addDischargePort() {
|
|
async addDischargePort() {
|
|
|
- let {
|
|
|
|
|
- currentDischargePortId,
|
|
|
|
|
- currentDischargePort
|
|
|
|
|
- } = this.data
|
|
|
|
|
|
|
+ let { currentDischargePortId, currentDischargePort } = this.data;
|
|
|
if (!currentDischargePortId || !currentDischargePort) {
|
|
if (!currentDischargePortId || !currentDischargePort) {
|
|
|
wx.showToast({
|
|
wx.showToast({
|
|
|
- title: '请选择港口',
|
|
|
|
|
- icon: "error"
|
|
|
|
|
- })
|
|
|
|
|
- return
|
|
|
|
|
|
|
+ title: "请选择港口",
|
|
|
|
|
+ icon: "error",
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
let res = await postApi("/voyage/addNewPort", {
|
|
let res = await postApi("/voyage/addNewPort", {
|
|
|
- loginAccountId: wx.getStorageSync('loginAccountId'),
|
|
|
|
|
|
|
+ loginAccountId: wx.getStorageSync("loginAccountId"),
|
|
|
voyageId: this.data.id,
|
|
voyageId: this.data.id,
|
|
|
- previousPortId: this.data.beforePorts[this.data.currentBeforePortIndex].portId,
|
|
|
|
|
- portId: this.data.currentDischargePortId
|
|
|
|
|
- })
|
|
|
|
|
- this.getVoyageDetail()
|
|
|
|
|
- this.cancelAddDischargePort()
|
|
|
|
|
-
|
|
|
|
|
|
|
+ previousPortId: this.data.beforePorts[this.data.currentBeforePortIndex]
|
|
|
|
|
+ .portId,
|
|
|
|
|
+ portId: this.data.currentDischargePortId,
|
|
|
|
|
+ });
|
|
|
|
|
+ this.getVoyageDetail();
|
|
|
|
|
+ this.cancelAddDischargePort();
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
bindDischargePortChange(e) {
|
|
bindDischargePortChange(e) {
|
|
|
- let {
|
|
|
|
|
- index,
|
|
|
|
|
- param
|
|
|
|
|
- } = e.currentTarget.dataset
|
|
|
|
|
- this.data.voyageDetails[index][param] = e.detail.value
|
|
|
|
|
|
|
+ let { index, param } = e.currentTarget.dataset;
|
|
|
|
|
+ this.data.voyageDetails[index][param] = e.detail.value;
|
|
|
this.setData({
|
|
this.setData({
|
|
|
- voyageDetails: this.data.voyageDetails
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ voyageDetails: this.data.voyageDetails,
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
changeDischargeTab(e) {
|
|
changeDischargeTab(e) {
|
|
|
- let {
|
|
|
|
|
- detail: currentDischargeIndex
|
|
|
|
|
- } = e
|
|
|
|
|
|
|
+ let { detail: currentDischargeIndex } = e;
|
|
|
this.setData({
|
|
this.setData({
|
|
|
- currentDischargeIndex
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ currentDischargeIndex,
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
async updateVoyage() {
|
|
async updateVoyage() {
|
|
|
for (let i of this.data.voyageDetails) {
|
|
for (let i of this.data.voyageDetails) {
|
|
|
Object.keys(i).forEach(function (key) {
|
|
Object.keys(i).forEach(function (key) {
|
|
|
- if ((typeof i[key]) == 'string') {
|
|
|
|
|
- i[key] = i[key].replaceAll('-', '/')
|
|
|
|
|
- if (i[key].length == 10) i[key] = i[key] + " 00:00:00"
|
|
|
|
|
|
|
+ if (typeof i[key] == "string") {
|
|
|
|
|
+ i[key] = i[key].replaceAll("-", "/");
|
|
|
|
|
+ if (i[key].length == 10) i[key] = i[key] + " 00:00:00";
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- if (this.data.arrivalLoadPortTime && this.data.arrivalLoadPortTime.length == 10) this.data.arrivalLoadPortTime = this.data.arrivalLoadPortTime + " 00:00:00"
|
|
|
|
|
- if (this.data.actualLoadTons && this.data.actualLoadTons.length == 10) this.data.actualLoadTons = this.data.actualLoadTons + " 00:00:00"
|
|
|
|
|
- if (this.data.actualLoadPieces && this.data.actualLoadPieces.length == 10) this.data.actualLoadPieces = this.data.actualLoadPieces + " 00:00:00"
|
|
|
|
|
- if (this.data.loadStartTime && this.data.loadStartTime.length == 10) this.data.loadStartTime = this.data.loadStartTime + " 00:00:00"
|
|
|
|
|
- if (this.data.loadEndTime && this.data.loadEndTime.length == 10) this.data.loadEndTime = this.data.loadEndTime + " 00:00:00"
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if (
|
|
|
|
|
+ this.data.arrivalLoadPortTime &&
|
|
|
|
|
+ this.data.arrivalLoadPortTime.length == 10
|
|
|
|
|
+ )
|
|
|
|
|
+ this.data.arrivalLoadPortTime =
|
|
|
|
|
+ this.data.arrivalLoadPortTime + " 00:00:00";
|
|
|
|
|
+ if (this.data.actualLoadTons && this.data.actualLoadTons.length == 10)
|
|
|
|
|
+ this.data.actualLoadTons = this.data.actualLoadTons + " 00:00:00";
|
|
|
|
|
+ if (this.data.actualLoadPieces && this.data.actualLoadPieces.length == 10)
|
|
|
|
|
+ this.data.actualLoadPieces = this.data.actualLoadPieces + " 00:00:00";
|
|
|
|
|
+ if (this.data.loadStartTime && this.data.loadStartTime.length == 10)
|
|
|
|
|
+ this.data.loadStartTime = this.data.loadStartTime + " 00:00:00";
|
|
|
|
|
+ if (this.data.loadEndTime && this.data.loadEndTime.length == 10)
|
|
|
|
|
+ this.data.loadEndTime = this.data.loadEndTime + " 00:00:00";
|
|
|
|
|
|
|
|
let res = await postApi("/voyage/update", {
|
|
let res = await postApi("/voyage/update", {
|
|
|
...this.data,
|
|
...this.data,
|
|
|
- loginAccountId: wx.getStorageSync('loginAccountId')
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ loginAccountId: wx.getStorageSync("loginAccountId"),
|
|
|
|
|
+ });
|
|
|
if (res.data.status == 0) {
|
|
if (res.data.status == 0) {
|
|
|
wx.showToast({
|
|
wx.showToast({
|
|
|
title: res.data.msg,
|
|
title: res.data.msg,
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
- this.getVoyageDetail()
|
|
|
|
|
|
|
+ this.getVoyageDetail();
|
|
|
},
|
|
},
|
|
|
async uploadBill(e) {
|
|
async uploadBill(e) {
|
|
|
- let {
|
|
|
|
|
- type
|
|
|
|
|
- } = e.currentTarget.dataset
|
|
|
|
|
|
|
+ let { type } = e.currentTarget.dataset;
|
|
|
let postData = {
|
|
let postData = {
|
|
|
type,
|
|
type,
|
|
|
- voyageId: this.data.id
|
|
|
|
|
- }
|
|
|
|
|
- let res = await uploadImage("/voyage/uploadVoyageWayBill", postData)
|
|
|
|
|
- this.getVoyageDetail()
|
|
|
|
|
|
|
+ voyageId: this.data.id,
|
|
|
|
|
+ };
|
|
|
|
|
+ let res = await uploadImage("/voyage/uploadVoyageWayBill", postData);
|
|
|
|
|
+ this.getVoyageDetail();
|
|
|
},
|
|
},
|
|
|
async completeVoyage() {
|
|
async completeVoyage() {
|
|
|
wx.showModal({
|
|
wx.showModal({
|
|
|
title: "确认完成航次?",
|
|
title: "确认完成航次?",
|
|
|
- success: async e => {
|
|
|
|
|
|
|
+ success: async (e) => {
|
|
|
if (e.confirm) {
|
|
if (e.confirm) {
|
|
|
let res = await postApi("/voyage/finish", {
|
|
let res = await postApi("/voyage/finish", {
|
|
|
- loginAccountId: wx.getStorageSync('loginAccountId'),
|
|
|
|
|
- voyageId: this.data.id
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ loginAccountId: wx.getStorageSync("loginAccountId"),
|
|
|
|
|
+ voyageId: this.data.id,
|
|
|
|
|
+ });
|
|
|
if (res.data.status == 0) {
|
|
if (res.data.status == 0) {
|
|
|
wx.showToast({
|
|
wx.showToast({
|
|
|
- title: '成功!',
|
|
|
|
|
- })
|
|
|
|
|
- this.getVoyageDetail()
|
|
|
|
|
|
|
+ title: "成功!",
|
|
|
|
|
+ });
|
|
|
|
|
+ this.getVoyageDetail();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
async cancelVoyage() {
|
|
async cancelVoyage() {
|
|
|
wx.showModal({
|
|
wx.showModal({
|
|
|
title: "确认取消航次?",
|
|
title: "确认取消航次?",
|
|
|
- success: async e => {
|
|
|
|
|
|
|
+ success: async (e) => {
|
|
|
if (e.confirm) {
|
|
if (e.confirm) {
|
|
|
let res = await postApi("/voyage/cancel", {
|
|
let res = await postApi("/voyage/cancel", {
|
|
|
- loginAccountId: wx.getStorageSync('loginAccountId'),
|
|
|
|
|
- id: this.data.id
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ loginAccountId: wx.getStorageSync("loginAccountId"),
|
|
|
|
|
+ id: this.data.id,
|
|
|
|
|
+ });
|
|
|
if (res.data.status == 0) {
|
|
if (res.data.status == 0) {
|
|
|
wx.showToast({
|
|
wx.showToast({
|
|
|
- title: '取消成功!',
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ title: "取消成功!",
|
|
|
|
|
+ });
|
|
|
wx.switchTab({
|
|
wx.switchTab({
|
|
|
- url: '/pages/voyageManage/voyageManage',
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ url: "/pages/voyageManage/voyageManage",
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
goTo(e) {
|
|
goTo(e) {
|
|
|
- let {
|
|
|
|
|
- url
|
|
|
|
|
- } = e.currentTarget.dataset
|
|
|
|
|
- let {
|
|
|
|
|
- id,
|
|
|
|
|
- currentPortId
|
|
|
|
|
- } = this.data
|
|
|
|
|
|
|
+ let { url } = e.currentTarget.dataset;
|
|
|
|
|
+ let { id, currentPortId } = this.data;
|
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
|
url: `${url}?voyageId=${id}&portId=${currentPortId}`,
|
|
url: `${url}?voyageId=${id}&portId=${currentPortId}`,
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
uploadBillCanvas() {
|
|
uploadBillCanvas() {
|
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
|
url: `/pages/voyageManage/takeBill/takeBill?type=1&voyageId=${this.data.id}`,
|
|
url: `/pages/voyageManage/takeBill/takeBill?type=1&voyageId=${this.data.id}`,
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
loadEndTimeChange(e) {
|
|
loadEndTimeChange(e) {
|
|
|
- if (!this.data.voyageDetails[0].setSailTime) this.data.voyageDetails[0].setSailTime = e.detail.value
|
|
|
|
|
|
|
+ if (!this.data.voyageDetails[0].setSailTime)
|
|
|
|
|
+ this.data.voyageDetails[0].setSailTime = e.detail.value;
|
|
|
this.setData({
|
|
this.setData({
|
|
|
- voyageDetails: this.data.voyageDetails
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ voyageDetails: this.data.voyageDetails,
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
bindBeforePortChange(e) {
|
|
bindBeforePortChange(e) {
|
|
|
this.setData({
|
|
this.setData({
|
|
|
- currentBeforePortIndex: e.detail.value
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ currentBeforePortIndex: e.detail.value,
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
|
- let {
|
|
|
|
|
- id
|
|
|
|
|
- } = options
|
|
|
|
|
- wx.setStorageSync('voyageDetailId', id)
|
|
|
|
|
|
|
+ let { id } = options;
|
|
|
|
|
+ wx.setStorageSync("voyageDetailId", id);
|
|
|
this.setData({
|
|
this.setData({
|
|
|
- id
|
|
|
|
|
- })
|
|
|
|
|
- this.getVoyageDetail()
|
|
|
|
|
|
|
+ id,
|
|
|
|
|
+ });
|
|
|
|
|
+ this.getVoyageDetail();
|
|
|
},
|
|
},
|
|
|
onShow() {
|
|
onShow() {
|
|
|
- if (wx.getStorageSync('addStatus') == "success") {
|
|
|
|
|
- this.getVoyageDetail()
|
|
|
|
|
- wx.removeStorageSync('addStatus')
|
|
|
|
|
|
|
+ if (wx.getStorageSync("addStatus") == "success") {
|
|
|
|
|
+ this.getVoyageDetail();
|
|
|
|
|
+ wx.removeStorageSync("addStatus");
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
-})
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+});
|