diff --git a/pages/index/invoice_detail.vue b/pages/index/invoice_detail.vue
index b82a0d2..d3aba68 100644
--- a/pages/index/invoice_detail.vue
+++ b/pages/index/invoice_detail.vue
@@ -39,7 +39,7 @@
船舶信息
船舶苏航666
编号ZJ12345
- 载重500吨
+ 载重吨位500吨
类型货船
总长度45米
型宽8米
diff --git a/pages/index/invoice_issue.vue b/pages/index/invoice_issue.vue
index 5b86c9e..6855059 100644
--- a/pages/index/invoice_issue.vue
+++ b/pages/index/invoice_issue.vue
@@ -39,7 +39,7 @@
船舶信息
船舶苏航666
编号ZJ12345
- 载重500吨
+ 载重吨位500吨
类型货船
总长度45米
型宽8米
diff --git a/pages/index/ship_add.vue b/pages/index/ship_add.vue
index 5826f67..de8bce5 100644
--- a/pages/index/ship_add.vue
+++ b/pages/index/ship_add.vue
@@ -5,19 +5,7 @@
-
-
- 计算单价:
- {{ unitPrice }}元
-
-
- 计算规则:
- {{ calculationDescription }}
-
-
+
@@ -110,6 +98,10 @@
/>
吨
+
+ 单次过闸收费
+ {{ totalPriceText() }}
+
总长度
@@ -506,6 +498,14 @@ export default {
this.calculationDescription = data.calculation_description || "";
}
},
+ // 计算单次过闸收费
+ totalPriceText() {
+ const unit = Number(this.unitPrice);
+ const ton = Number(this.form?.ton);
+ if (isNaN(unit) || isNaN(ton)) return "-";
+ const total = (unit * ton).toFixed(2);
+ return `${total}元(单价${unit} * 载重${ton}吨)`;
+ },
async fetchShipInspectionExample() {
const token = uni.getStorageSync("token");
if (!token) {
diff --git a/pages/index/ship_detail.vue b/pages/index/ship_detail.vue
index a1527e4..e3ac6e2 100644
--- a/pages/index/ship_detail.vue
+++ b/pages/index/ship_detail.vue
@@ -4,17 +4,6 @@
-
-
-
- 计算单价:
- {{ unitPrice }}元
-
-
- 计算规则:
- {{ calculationDescription }}
-
-
基本信息
船舶所有人{{ ship.owner_name }}
@@ -25,6 +14,7 @@
船舶参数
载重吨位{{ ship.total_tonnage }}
+ 单次过闸收费{{ totalPriceText() }}
总长度{{ ship.total_length }}
总宽{{ ship.total_width }}
型深{{ ship.molded_depth }}
@@ -123,6 +113,14 @@ export default {
this.calculationDescription = data.calculation_description || '';
}
},
+ // 计算单次过闸收费
+ totalPriceText() {
+ const unit = Number(this.unitPrice);
+ const ton = Number(this.ship?.total_tonnage);
+ if (isNaN(unit) || isNaN(ton)) return '-';
+ const total = (unit * ton).toFixed(2);
+ return `${total}元(单价${unit} * 载重${ton}吨)`;
+ },
getShipTypeName(type) {
if (!Array.isArray(this.shipTypeEnum)) return type;
const found = this.shipTypeEnum.find(item => item.value === type?.toString());
diff --git a/pages/order/pay_order.vue b/pages/order/pay_order.vue
index df035d5..4e18c71 100644
--- a/pages/order/pay_order.vue
+++ b/pages/order/pay_order.vue
@@ -22,7 +22,7 @@
总长度{{ item.ship.total_length }}米
型宽{{ item.ship.total_width }}米
型深{{ item.ship.molded_depth }}米
- 载重{{ item.ship.total_tonnage }}吨
+ 载重吨位{{ item.ship.total_tonnage }}吨
类型{{ item.ship && item.ship.ship_type ? getShipTypeName(item.ship.ship_type) : '' }}
diff --git a/pages/order/pay_order_detail.vue b/pages/order/pay_order_detail.vue
index c990c9c..eb33721 100644
--- a/pages/order/pay_order_detail.vue
+++ b/pages/order/pay_order_detail.vue
@@ -63,8 +63,12 @@
>型深{{ item.ship.molded_depth }}米
载重{{ item.ship.total_tonnage }}吨载重吨位{{ item.ship.total_tonnage }}吨
+
+ 单次过闸收费
+ {{ totalPriceText() }}
+
类型{{
@@ -168,8 +172,7 @@ export default {
shipTypeEnum: [],
reservationStatusEnum: [],
qrContent: "",
- unitPrice: '', // 单价
- calculationDescription: '', // 计算规则
+ unitPrice: "", // 单价
};
},
onLoad(options) {
@@ -199,26 +202,33 @@ export default {
},
methods: {
formatChinaDate: base.formatChinaDate,
- // 获取单价和计算规则
+ // 获取单价
async fetchUnitPrice() {
- const token = uni.getStorageSync('token')
+ const token = uni.getStorageSync("token");
if (!token) {
- return
+ return;
}
const res = await new Promise((resolve, reject) => {
uni.request({
url: `${API.GET_UNIT_PRICE}?token=${token}`,
- method: 'get',
+ method: "get",
success: resolve,
- fail: reject
- })
- })
+ fail: reject,
+ });
+ });
if (res.data && res.data.errcode === 0) {
const data = res.data.data;
- this.unitPrice = data.unit_price || '';
- this.calculationDescription = data.calculation_description || '';
+ this.unitPrice = data.unit_price || "";
}
},
+ // 计算单次过闸收费
+ totalPriceText() {
+ const unit = Number(this.unitPrice);
+ const ton = Number(this.item?.ship?.total_tonnage);
+ if (isNaN(unit) || isNaN(ton)) return "-";
+ const total = (unit * ton).toFixed(2);
+ return `${total}元(单价${unit} * 载重${ton}吨)`;
+ },
async fetchQrcode(id) {
const token = uni.getStorageSync("token");
if (!token || !id) return;
diff --git a/pages/reservation/index.vue b/pages/reservation/index.vue
index 37e9c38..ca6a654 100644
--- a/pages/reservation/index.vue
+++ b/pages/reservation/index.vue
@@ -4,17 +4,6 @@
-
-
-
- 计算单价:
- {{ unitPrice }}元
-
-
- 计算规则:
- {{ calculationDescription }}
-
-
船舶信息
@@ -37,9 +26,13 @@
- 载重
+ 载重吨位
{{ currentShip.total_tonnage }}吨 ›
+
+ 单次过闸收费
+ {{ totalPriceText() }}
+
类型
{{ getShipTypeName(currentShip.ship_type) }} ›
@@ -193,6 +186,16 @@ export default {
this.calculationDescription = data.calculation_description || '';
}
},
+ // 计算单次过闸费用
+ totalPriceText() {
+ const unit = Number(this.unitPrice);
+ const ton = Number(this.currentShip?.total_tonnage);
+ if (isNaN(unit) || isNaN(ton)) {
+ return '-';
+ }
+ const total = (unit * ton).toFixed(2);
+ return `${total}元(单价${unit} * 载重${ton}吨)`;
+ },
// 获取用户位置
getUserLocation() {
// #ifdef H5