vbea 2 лет назад
Родитель
Сommit
49b458c825

+ 9 - 2
Strides-APP/app/pages/chargeV2/ChargeAdapter.js

@@ -169,14 +169,21 @@ export default class ChargeAdapter extends Component {
       if (res.data.sitePk) {
       if (res.data.sitePk) {
         var info = utils.getSiteInfo(res.data);
         var info = utils.getSiteInfo(res.data);
         PagerUtil.setStationInfo(info);
         PagerUtil.setStationInfo(info);
-        PagerUtil.setRefreshing(getFocusedRouteNameFromRoute(this.props.route));
+        PagerUtil.setRefreshing();
+        //PagerUtil.setRefreshing(getFocusedRouteNameFromRoute(this.props.route));
         this.setState({
         this.setState({
           refreshing: false,
           refreshing: false,
           stationInfo: info
           stationInfo: info
         }, () => {
         }, () => {
           this.setPageTitle();
           this.setPageTitle();
         });
         });
-        if (!PagerUtil.ENABLE_NEW_UI && this.action == 'qr') {
+        if (PagerUtil.isInnerScanQR()) {
+          if (QRResult.haveResult()) {
+            this.changeTab(1);
+            //PagerUtil.setRefreshing("Charge");
+          }
+          PagerUtil.ofInnerScanQR();
+        } else if (!PagerUtil.ENABLE_NEW_UI && this.action == 'qr') {
           setTimeout(() => {
           setTimeout(() => {
             this.changeTab(1)
             this.changeTab(1)
           }, 300);
           }, 300);

+ 18 - 7
Strides-APP/app/pages/chargeV2/PagerUtil.js

@@ -57,17 +57,28 @@ export default PagerUtil = {
       console.log("[PagerUtil]", "onReserve-skip");
       console.log("[PagerUtil]", "onReserve-skip");
     }
     }
   },
   },
-  onEnterStation: (props) => {
-    const isFocused = props?.navigation?.isFocused();
-    if (!isFocused) {
+  onInnerScanQR() {
+    global.chargeV3InnerScanQR = true;
+    if (this.ENABLE_NEW_UI) {
       if (DEBUG) {
       if (DEBUG) {
-        console.log("[PagerUtil]", "onEnterStation");
+        console.log("[PagerUtil]", "激活自动进入新充电页面的开关");
       }
       }
-      startPage(PagerList.tabCharge);
-    } else if (DEBUG) {
-      console.log("[PagerUtil]", "onEnterStation-skip");
+      refreshListener.map((item, index) => {
+        if (item.activeNewUIPage)
+          item.activeNewUIPage();
+      });
     }
     }
   },
   },
+  isInnerScanQR: () => {
+    return global.chargeV3InnerScanQR;
+  },
+  ofInnerScanQR: () => {
+    global.chargeV3InnerScanQR = false;
+  },
+  onEnterStation: (props) => {
+    //const isFocused = props?.navigation?.isFocused();
+    startPage(PagerList.tabCharge);
+  },
   onDestory: () => {
   onDestory: () => {
     chargeInfoState = {};
     chargeInfoState = {};
     refreshListener = [];
     refreshListener = [];

+ 19 - 8
Strides-APP/app/pages/chargeV2/TabCharge.js

@@ -132,6 +132,13 @@ export default class TabCharge extends Component {
     }
     }
   }
   }
 
 
+  /**
+   * 激活自动进入新充电页面的开关
+   */
+  activeNewUIPage() {
+    this.autoIntoCharging = true;
+  }
+
   toChargingPage() {
   toChargingPage() {
     this.autoIntoCharging = false;
     this.autoIntoCharging = false;
     startPage(PageList.chargingPage, {
     startPage(PageList.chargingPage, {
@@ -145,14 +152,18 @@ export default class TabCharge extends Component {
 
 
   enterStatioinId() {
   enterStatioinId() {
     if (QRResult.haveResult()) {
     if (QRResult.haveResult()) {
-      const info = QRResult.getResult()
-      console.log('EnterResult', info);
-      this.setState({
-        isAuthentic: true,
-        connectorInfo: info
-        //soc: info.chargeType == 'AC' ? 0 : 'In Charging'
-      });
-      this.checkChargeStatus();
+      if (PagerUtil.ENABLE_NEW_UI) {
+        this.onRefresh();
+      } else {
+        const info = QRResult.getResult()
+        console.log('EnterResult', info);
+        this.setState({
+          isAuthentic: true,
+          connectorInfo: info
+          //soc: info.chargeType == 'AC' ? 0 : 'In Charging'
+        });
+        this.checkChargeStatus();
+      }
     }
     }
   }
   }
 
 

+ 9 - 1
Strides-APP/app/pages/chargeV2/TabReserve.js

@@ -14,6 +14,8 @@ import PagerUtil from './PagerUtil';
 import BadgeSelectItem from '../../components/BadgeSelectItem';
 import BadgeSelectItem from '../../components/BadgeSelectItem';
 import TextView from '../../components/TextView';
 import TextView from '../../components/TextView';
 import { MyRefreshProps } from '../../components/ThemesConfig';
 import { MyRefreshProps } from '../../components/ThemesConfig';
+import { QRResult } from '../charge/QRScan';
+import { PagerList } from './ChargeAdapter';
 
 
 export default class TabReserve extends Component {
 export default class TabReserve extends Component {
   constructor(props) {
   constructor(props) {
@@ -185,7 +187,9 @@ export default class TabReserve extends Component {
 
 
   startCountdown() {
   startCountdown() {
     if (this.state.userReserve.reserveEndTimeTimestamp > 0) {
     if (this.state.userReserve.reserveEndTimeTimestamp > 0) {
-      PagerUtil.onReserve(this.props);
+      if (!QRResult.haveResult()) {
+        PagerUtil.onReserve(this.props);
+      }
       const leftId = this.state.leftId;
       const leftId = this.state.leftId;
       this.countdown(leftId);
       this.countdown(leftId);
     } else {
     } else {
@@ -253,6 +257,9 @@ export default class TabReserve extends Component {
 
 
   enterStatioinId() {
   enterStatioinId() {
     PagerUtil.onEnterStation(this.props);
     PagerUtil.onEnterStation(this.props);
+    setTimeout(() => {
+      PagerUtil.setRefreshing(PagerList.tabCharge)
+    }, 300);
   }
   }
 
 
   render() {
   render() {
@@ -456,6 +463,7 @@ export default class TabReserve extends Component {
             text={$t('charging.scanQR')}
             text={$t('charging.scanQR')}
             disabled={this.state.available}
             disabled={this.state.available}
             onClick={() => {
             onClick={() => {
+              PagerUtil.onInnerScanQR();
               startPage(PageList.scanqr, {actionDetail: false, id: this.state.stationInfo.id});
               startPage(PageList.scanqr, {actionDetail: false, id: this.state.stationInfo.id});
             }}/>
             }}/>
           <Button
           <Button

+ 1 - 0
Strides-APP/app/pages/charging/StepStartView.js

@@ -113,6 +113,7 @@ export default StepStartView = ({
           text={$t('charging.scanQR')}
           text={$t('charging.scanQR')}
           //disabled={available}
           //disabled={available}
           onClick={() => {
           onClick={() => {
+            PagerUtil.onInnerScanQR();
             startPage(PageList.scanqr, {actionDetail: false, id: stationInfo?.id});
             startPage(PageList.scanqr, {actionDetail: false, id: stationInfo?.id});
           }}/>
           }}/>
         <Button
         <Button

+ 14 - 2
Strides-APP/app/pages/wallet/History.js

@@ -72,6 +72,18 @@ export default class History extends Component {
     }
     }
   }
   }
 
 
+  getTransTitle(item) {
+    let title =  item.createTime;
+    if (item.remarks) {
+      title += ': ' + item.remarks;
+    } else if (item.amountSymbol == 'M') {
+      title += ': ' + (item.siteName || "Charging");
+    } else {
+      title += ': ' + $t('wallet.topUp');
+    }
+    return title;
+  }
+
   render() {
   render() {
     return (
     return (
       <View style={this.props.shown ? ui.flex1 : styles.hide}>
       <View style={this.props.shown ? ui.flex1 : styles.hide}>
@@ -96,10 +108,10 @@ export default class History extends Component {
                   <Image
                   <Image
                     style={styles.iconType}
                     style={styles.iconType}
                     resizeMode="contain"
                     resizeMode="contain"
-                    source={item.amountSymbol == 'M' ? IconCharge : IconPayment}/>
+                    source={(item.amountSymbol == 'P' || item.remarks) ? IconPayment : IconCharge}/>
                   <View style={[styles.itemContent, index > 0 && styles.divide]}>
                   <View style={[styles.itemContent, index > 0 && styles.divide]}>
                     <View style={ui.flex1}>
                     <View style={ui.flex1}>
-                      <TextView style={styles.issueName}>{item.createTime + ': ' + (item.amountSymbol == 'M' ? item.siteName : $t('wallet.topUp') + ' ' + item.amount)}</TextView>
+                      <TextView style={styles.issueName}>{this.getTransTitle(item)}</TextView>
                       <TextView style={styles.issueDesc}>{$t('wallet.labelTransactionId') + item.creditRecordPk}</TextView>
                       <TextView style={styles.issueDesc}>{$t('wallet.labelTransactionId') + item.creditRecordPk}</TextView>
                     </View>
                     </View>
                     { item.amountSymbol == 'M'
                     { item.amountSymbol == 'M'