Przeglądaj źródła

add memberships module

vbea 2 lat temu
rodzic
commit
abcfda21c0

+ 1 - 1
Strides-APP/app/components/Dropdown.js

@@ -211,7 +211,7 @@ const styles = StyleSheet.create({
     flexDirection: 'row'
   },
   valueText: {
-    color: '#000',
+    color: textPrimary,
     fontSize: 16
   },
   itemView: {

+ 4 - 2
Strides-APP/app/components/ThemesConfig.js

@@ -1,5 +1,6 @@
 import React from "react";
 import { View } from "react-native";
+import app from '../../app.json';
 
 export const MyRefreshProps = () => ({
   title: global.$t('common.pulldown2Refresh'),
@@ -9,8 +10,9 @@ export const MyRefreshProps = () => ({
 })
 
 export const UploadThemes = {
-  cropperStatusBarColor: colorPrimary,
-  cropperToolbarColor: colorPrimary,
+  cropperStatusBarColor: app.isWhitelabel ? "#CCCCCC" : colorPrimary,
+  cropperToolbarColor: app.isWhitelabel ? colorLight : colorPrimary,
+  //cropperTintColor: colorAccent,
   cropperActiveWidgetColor: colorAccent,
   cropperToolbarWidgetColor: pageTitleTint
 }

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

@@ -425,7 +425,7 @@ export default {
     statusApproved: "Approved",
     statusPending: "Pending",
     statusRejected: "Rejected",
-    labelUpload: "Upload\nMembership Card\n(Front)",
+    labelUpload: "Upload\nMembership\nCard (Front)",
     noData: "You not have any membership",
     errMembershipNo: "Please type Membership No",
     errUploadCard: "Please upload Membership Card"

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

@@ -423,7 +423,7 @@ export default {
     membershipNo: "会员卡号",
     status: "状态",
     statusApproved: "审核通过",
-    statusPending: "待审核",
+    statusPending: "待审核",
     statusRejected: "审核未通过",
     labelUpload: "请上传会员卡\n正面照片",
     noData: "你还没有申请任何会员",

+ 5 - 0
Strides-APP/app/pages/chargingV2/ChargingPage.js

@@ -162,6 +162,11 @@ export default class ChargingPage extends Component {
         }
         this.setState(state)
       }
+    }).catch(err => {
+      Dialog.showResultDialog("An error occurred:\n" + err, "Retry", () => {
+        this.getConnectorInfo();
+      })
+      //toastShort(err)
     })
   }
 

+ 18 - 1
Strides-APP/app/pages/member/ApplyMember.js

@@ -131,7 +131,8 @@ export default class ApplyMember extends Component {
           <View style={styles.formItem}>
             <Text style={styles.inputLabel}>{$t('members.membership')}</Text>
             <Dropdown
-              style={[styles.inputView, ui.flexc]}
+              style={styles.selectView}
+              textStyle={styles.selectText}
               title={$t('members.membership')}
               list={this.state.groupList}
               value={this.state.memberForm.groupPk}
@@ -221,6 +222,21 @@ const styles = StyleSheet.create({
     paddingBottom: 6,
     backgroundColor: '#F5F5F5'
   },
+  selectView: {
+    flex: 2,
+    borderRadius: 5,
+    minHeight: 40,
+    paddingLeft: 12,
+    paddingRight: 12,
+    alignItems: 'center',
+    flexDirection: 'row',
+    backgroundColor: '#F5F5F5'
+  },
+  selectText: {
+    flex: 1,
+    color: textPrimary,
+    fontSize: 14
+  },
   uploadGroup: {
     flex: 2,
     marginLeft: -16,
@@ -240,6 +256,7 @@ const styles = StyleSheet.create({
     padding: 16,
   },
   agreeText: {
+    flex: 1,
     color: textPrimary,
     fontSize: 14,
     paddingTop: 2,

+ 5 - 2
Strides-APP/app/pages/member/MembersList.js

@@ -44,6 +44,8 @@ export default class MembersList extends Component {
         return $t("members.statusPending");
       case "Approved":
         return $t("members.statusApproved");
+      case "Pass":
+        return $t("members.statusApproved");
       case "Rejected":
         return $t("members.statusRejected");
       default:
@@ -63,7 +65,6 @@ export default class MembersList extends Component {
           }}>
           <View style={styles.itemBackground}>
             <MaterialIcons
-              style={styles.icon}
               name="card-membership"
               color={colorAccent}
               size={56}/>
@@ -108,6 +109,7 @@ const styles = StyleSheet.create({
     fontWeight: 'bold'
   },
   textValue: {
+    flex: 1,
     color: textPrimary,
     fontSize: 14
   },
@@ -119,6 +121,7 @@ const styles = StyleSheet.create({
     fontWeight: 'bold'
   },
   textValue2: {
+    flex: 1,
     color: textPrimary,
     fontSize: 16,
     marginBottom: 2,
@@ -126,7 +129,7 @@ const styles = StyleSheet.create({
   itemBackground: {
     right: 0,
     bottom: 0,
-    opacity: 0.1,
+    opacity: 0.06,
     position: 'absolute'
   }
 })

+ 1 - 1
Strides-APP/app/pages/my/ProfileV2.js

@@ -138,7 +138,7 @@ export default class ProfileV2 extends Component {
             source={require('../../images/user/card-wallet.png')}/>
           <View style={styles.cardInfo}>
             <Text style={styles.cardLabel}>{$t('wallet.creditWalletLabel')}</Text>
-            <Text style={styles.cardPrimary}>{currency}{this.state.userInfo.creditStr}</Text>
+            <Text style={styles.cardPrimary}>{currency}{this.state.userInfo.credit}</Text>
           </View>
           <FontAwesome
             size={28}

+ 1 - 1
Strides-APP/app/pages/payment/PaymentConfig.js

@@ -13,7 +13,7 @@ export const PAYTYPE = {
  * @DEFAULT 控制默认的支付方式
  */
  export const PaymentDefault = {
-  is2c2p: true, //是否启用2C2P
+  is2c2p: false, //是否启用2C2P
   enablePayPerUse: false, //是否启用按次支付
   DEFAULT: {
     payType: PAYTYPE.CREDIT_WALLET,

+ 26 - 12
Strides-APP/app/pages/wallet/TopupNew.js

@@ -8,8 +8,9 @@ import apiWallet from '../../api/apiWallet';
 import BadgeSelectItem from '../../components/BadgeSelectItem';
 import Button, { ElevationObject } from '../../components/Button';
 import Dialog from '../../components/Dialog';
+import { PaymentDefault } from '../payment/PaymentConfig';
 import { PageList } from '../Router';
-import { Balance, PaymentDefault } from './Payment';
+import { Balance } from './Payment';
 import TopupPaythod from './TopupPaythod';
 
 export default class TopupNew extends Component {
@@ -37,7 +38,8 @@ export default class TopupNew extends Component {
 
   getTopupList() {
     Dialog.showProgressDialog();
-    apiWallet.getTopUpAmountList().then(res => {
+    // apiWallet.getTopUpAmountList()
+    apiWallet.getTopUpAmountListV2().then(res => {
       Dialog.dismissLoading();
       if (res.data.length > 0) {
         this.setState({
@@ -45,6 +47,11 @@ export default class TopupNew extends Component {
         });
       }
     }).catch(err => {
+      toastShort(err)
+      const data = apiWallet.getTempAmountListV2();
+      this.setState({
+        topupList: data
+      });
       Dialog.dismissLoading();
     })
   }
@@ -53,8 +60,10 @@ export default class TopupNew extends Component {
    * 2C2P充值
    */
   topup2() {
+    const topup = this.state.topupList[this.state.selectIndex]
     const params = {
-      payAmount: this.state.topupList[this.state.selectIndex]?.key,
+      currency: topup?.currency,
+      payAmount: topup?.amount
     }
     apiWallet.doPaymentV2(params).then(res => {
       Dialog.dismissLoading();
@@ -73,8 +82,10 @@ export default class TopupNew extends Component {
    * FOMO充值
    */
   topup() {
+    const topup = this.state.topupList[this.state.selectIndex]
     const params = {
-      payAmount: this.state.topupList[this.state.selectIndex]?.key,
+      currency: topup?.currency,
+      payAmount: topup?.amount,
       fomoPayType: this.state.payType.fomoPayType
     }
     //console.log('params',params);
@@ -108,11 +119,11 @@ export default class TopupNew extends Component {
     return (
       <View style={styles.container}>
         <View style={styles.headerView}>
-          <Balance balance={this.state.balance}/>
+          <Balance balanceText={this.state.balance}/>
         </View>
         <View style={styles.contentView}>
           <View style={styles.topupView}>
-            <WalletTitle>Choose Credit Value</WalletTitle>
+            <WalletTitle>{$t('wallet.titleChooseCreditValue')}</WalletTitle>
             <View style={styles.topupItems}>
               { this.state.topupList.map((item, index) => {
                   return (
@@ -125,8 +136,12 @@ export default class TopupNew extends Component {
                           selectIndex: index
                         })
                       }}>
-                      <Text style={[styles.topupText, index == this.state.selectIndex && {color: colorAccent}]}>{currency}{item.key}</Text>
+                      <Text style={[styles.topupText, index == this.state.selectIndex && {color: colorAccent}]}>
+                        {item.amount}
+                        <Text style={{fontSize: 16}}> {item.currency}</Text>
+                      </Text>
                     </BadgeSelectItem>
+
                   );
                 })
               }
@@ -134,7 +149,7 @@ export default class TopupNew extends Component {
           </View>
           { !PaymentDefault.is2c2p &&
             <View style={styles.topupView}>
-              <WalletTitle>Choose Payment Type</WalletTitle>
+              <WalletTitle>{$t('wallet.titleChoosePaymentType')}</WalletTitle>
               <TopupPaythod
                 onChange={type => {
                   this.setState({
@@ -147,7 +162,7 @@ export default class TopupNew extends Component {
         <View style={ui.flex1}></View>
         <View style={styles.buttonView}>
           <Button
-            text='Purchase'
+            text={$t('wallet.btnPurchase')}
             elevation={1.5}
             onClick={() => {
               PaymentDefault.is2c2p 
@@ -233,10 +248,9 @@ const styles = StyleSheet.create({
     ...ElevationObject(5)
   },
   topupText: {
-    height: 60,
     fontSize: 18,
-    lineHeight: 60,
-    color: textPrimary
+    color: textPrimary,
+    ...$padding(20, 0)
   },
   right: {
     marginLeft: 16

+ 22 - 11
Strides-APP/app/pages/wallet/Wallet.js

@@ -4,12 +4,12 @@
  */
 import React, { Component } from 'react';
 import { View, Text, StyleSheet, ScrollView, RefreshControl, Image, Pressable } from 'react-native';
-import Payment, { Balance, toTopupPage } from './Payment';
+import { Balance } from './Payment';
 import { PageList } from '../Router';
 import History from './History';
 import Overview from './Overview';
 import { MyRefreshProps } from '../../components/ThemesConfig';
-import Button, { ElevationObject } from '../../components/Button';
+import { ElevationObject } from '../../components/Button';
 
 export default class Wallet extends Component {
   constructor(props) {
@@ -20,6 +20,7 @@ export default class Wallet extends Component {
       refreshing: false,
       tabWidth: 0,
       tabHeight: 0,
+      balanceText: '',
       pageShown: false
     };
   }
@@ -30,6 +31,7 @@ export default class Wallet extends Component {
       getUserInfo(info => {
         this.setState({
           balance: info.credit,
+          balanceText: info.creditStr,
           pageShown: true
         })
       }, true)
@@ -42,7 +44,7 @@ export default class Wallet extends Component {
         }, () => {
           setTimeout(() => {
             goBack();
-          }, 300);
+          }, 100);
         });
       }
     });
@@ -99,11 +101,14 @@ export default class Wallet extends Component {
         </View> */}
         <Balance
           balance={this.state.balance}
-          action={"Purchase"/*"Top Up"*/}
+          balanceText={this.state.balanceText}
+          action={$t('wallet.purchaseCredits')/*"Top Up"*/}
           page={PageList.topupNew}
         />
         <View style={styles.contentView}>
-          <View style={styles.tabView} onLayout={props => this.tabLayout(props)}>
+          <View
+            style={styles.tabView}
+            onLayout={props => this.tabLayout(props)}>
             { this.state.tabIndex == 0
             ? <Image
                 style={[styles.tabBackgroundLeft, {width: this.state.tabWidth + 1, height: this.state.tabHeight}]}
@@ -121,9 +126,12 @@ export default class Wallet extends Component {
               onPress={() => this.changeTab(0)}>
               <Text
                 style={[
-                styles.tabText,
-                this.state.tabIndex == 0 && styles.active
-              ]}>Overview</Text>
+                  styles.tabText,
+                  this.state.tabIndex == 0 && styles.active
+                ]}
+                numberOfLines={1}>
+                {$t('wallet.tabOverview')}
+              </Text>
             </Pressable>
             <View style={{width: 16}}></View>
             <Pressable
@@ -131,9 +139,12 @@ export default class Wallet extends Component {
               onPress={() => this.changeTab(1)}>
               <Text
                 style={[
-                styles.tabText,
-                this.state.tabIndex == 1 && styles.active
-              ]}>History</Text>
+                  styles.tabText,
+                  this.state.tabIndex == 1 && styles.active
+                ]}
+                numberOfLines={1}>
+                {$t('wallet.tabHistory')}
+              </Text>
             </Pressable>
           </View>
           <Overview