ソースを参照

#13918 Enhancement pay per use payment to charging's process

vbea 2 年 前
コミット
30997305b8

+ 1 - 0
Strides-APP/app/i18n/locales/en.js

@@ -254,6 +254,7 @@ export default {
     errNotConnected: "Your vehicle is not connected to the charging station. Please check the connector.",
     errUnable2Charge: "The charging station is unable to charge your vehicle.Please reauthenticate.",
     errUnable2Reserved: "The charging station is reserved and unable to charge your vehicle.",
+    errPayperusePayment: "Pay Per Use payment failed, payment status is: ",
     free: "Free",
     hintExampleStationId: "e.g: LEMOC0002-1",
     labelAvailableTotal: "Available/Total",

+ 1 - 0
Strides-APP/app/i18n/locales/zh-TW.js

@@ -254,6 +254,7 @@ export default {
     errNotConnected: "您的車輛未連結到充電樁,請檢查連結器",
     errUnable2Charge: "充電樁無法爲您的車輛充電,請重新驗證",
     errUnable2Reserved: "該充電樁已被預定,無法爲您的車輛充電",
+    errPayperusePayment: "按次使用支付失敗,當前支付狀態為:",
     free: "免費",
     hintExampleStationId: "例:LEMOC0002-1",
     labelAvailableTotal: "可使用/總計",

+ 1 - 0
Strides-APP/app/i18n/locales/zh.js

@@ -254,6 +254,7 @@ export default {
     errNotConnected: "您的车辆未连接到充电桩,请检查连接器",
     errUnable2Charge: "充电桩无法为您的车辆充电,请重新验证",
     errUnable2Reserved: "该充电桩已被预定,无法为您的车辆充电",
+    errPayperusePayment: "按次使用支付失败,当前支付状态为: ",
     free: "免费",
     hintExampleStationId: "例:LEMOC0002-1",
     labelAvailableTotal: "可使用/总计",

+ 34 - 3
Strides-APP/app/pages/chargingV2/ChargingPage.js

@@ -101,7 +101,14 @@ export default class ChargingPage extends Component {
   getConnectorInfo() {
     if (!this.isPageShow) return;
     //this.init();
-    apiCharge.getConnectorDetail(this.state.stationInfo).then(res => {
+    const params = {
+      sitePk: this.state.stationInfo.id,
+      chargeBoxId: this.state.stationInfo.chargeBoxId,
+      connectorId: this.state.stationInfo.connectorId,
+      paymentOption: this.state.currentPayment
+    }
+    console.log("参数", params);
+    apiCharge.getConnectorDetail(params).then(res => {
       if (res.data.status && !this.state.isStoping) {
         const state = {
           isStoping: false,
@@ -127,7 +134,19 @@ export default class ChargingPage extends Component {
             this.waitAuthentic = false;
             if (this.waitStartCharging) {
               state.isCharging = true;
-              this.refreshChargeData(3000);
+              if (res.data.payPerUsePaymentStatus) {
+                //等待PayPerUse支付-初始化充电
+                if (res.data.payPerUsePaymentStatus == "PENDING" || res.data.payPerUsePaymentStatus == "PAID") {
+                  this.refreshChargeData(3000);
+                } else {
+                  this.showErrorDialog('A4', $t('charging.errPayperusePayment') + res.data.payPerUsePaymentStatus);
+                  state.isCharging = false;
+                  state.isAuthentic = true;
+                }
+              } else {
+                //普通充电-初始化充电
+                this.refreshChargeData(3000);
+              }
             } else {
               state.isAuthentic = true;
               //this.checkIsCharge();
@@ -140,7 +159,19 @@ export default class ChargingPage extends Component {
             break;
           case 'Initiating': //充电确认中
             state.isCharging = true;
-            this.refreshChargeData();
+            if (res.data.payPerUsePaymentStatus) {
+              //等待PayPerUse支付-初始化充电
+              if (res.data.payPerUsePaymentStatus == "PENDING" || res.data.payPerUsePaymentStatus == "PAID") {
+                this.refreshChargeData();
+              } else {
+                this.showErrorDialog('A4', $t('charging.errPayperusePayment') + res.data.payPerUsePaymentStatus);
+                state.isCharging = false;
+                state.isAuthentic = false;
+              }
+            } else {
+              //普通充电-初始化充电
+              this.refreshChargeData();
+            }
             break;
           case 'SuspendedEVSE':
             this.showErrorDialog('A5', $t('charging.errUnable2Charge'));