totalPayment.tsx 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. import { router, useFocusEffect, useNavigation } from 'expo-router';
  2. import {
  3. View,
  4. Text,
  5. ScrollView,
  6. Pressable,
  7. StyleSheet,
  8. Image,
  9. BackHandler,
  10. Alert,
  11. Linking,
  12. AppState,
  13. Modal,
  14. ActivityIndicator
  15. } from 'react-native';
  16. import { SafeAreaView } from 'react-native-safe-area-context';
  17. import NormalButton from '../../../../component/global/normal_button';
  18. import { PreviousPageBlackSvg } from '../../../../component/global/SVG';
  19. import { useChargingStore } from '../../../../providers/scan_qr_payload_store';
  20. import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
  21. import useUserInfoStore from '../../../../providers/userinfo_store';
  22. import { chargeStationService } from '../../../../service/chargeStationService';
  23. import { authenticationService } from '../../../../service/authService';
  24. import axios from 'axios';
  25. import sha256 from 'crypto-js/sha256';
  26. import { walletService } from '../../../../service/walletService';
  27. import AsyncStorage from '@react-native-async-storage/async-storage';
  28. const TotalPayment = () => {
  29. const {
  30. promotion_code,
  31. stationID,
  32. sum_of_coupon,
  33. scanned_qr_code,
  34. coupon_detail,
  35. total_power,
  36. processed_coupon_store,
  37. setPromotionCode,
  38. setCouponDetail,
  39. setTotalPower,
  40. setProcessedCouponStore,
  41. setSumOfCoupon,
  42. setCurrentPriceStore
  43. } = useChargingStore();
  44. const [currentPriceTotalPayment, setCurrentPriceTotalPayment] = useState<number | null>(null);
  45. const [walletBalance, setWalletBalance] = useState<number | null>(null);
  46. const [loading, setLoading] = useState(false);
  47. const [outTradeNo, setOutTradeNo] = useState('');
  48. const [isExpectingPayment, setIsExpectingPayment] = useState(false);
  49. const paymentInitiatedTime = useRef(null);
  50. const PAYMENT_CHECK_TIMEOUT = 5 * 60 * 1000; // 5 minutes in milliseconds
  51. const appState = useRef(AppState.currentState);
  52. const [totalPrice, setTotalPrice] = useState<number | null>(null);
  53. const [paymentStatus, setPaymentStatus] = useState(null);
  54. const [loadingModalVisible, setLoadingModalVisible] = useState(false);
  55. //fetch current price based on using coupon or not. use coupon = $3.5
  56. useEffect(() => {
  57. const fetchCurrentPrice = async () => {
  58. try {
  59. //if promotion_code.length > 0, fetch original price, otherwise fetch current price
  60. //then calculate total price for display purpose
  61. if (promotion_code.length > 0) {
  62. const response = await chargeStationService.getOriginalPriceInPay(stationID);
  63. setCurrentPriceTotalPayment(response);
  64. let totalPrice = Number(total_power) * Number(response) - Number(sum_of_coupon);
  65. if (totalPrice < 0) {
  66. totalPrice = 0;
  67. } else {
  68. totalPrice = totalPrice;
  69. }
  70. setTotalPrice(totalPrice);
  71. } else {
  72. const response = await chargeStationService.getCurrentPriceInPay(stationID);
  73. setCurrentPriceTotalPayment(response);
  74. let totalPrice = Number(total_power) * Number(response);
  75. setTotalPrice(totalPrice);
  76. }
  77. } catch (error) {
  78. // More specific error handling
  79. if (axios.isAxiosError(error)) {
  80. const errorMessage = error.response?.data?.message || 'Network error occurred';
  81. Alert.alert('Error', `Unable to fetch price: ${errorMessage}`, [
  82. {
  83. text: 'OK',
  84. onPress: () => {
  85. cleanupData();
  86. router.push('/mainPage');
  87. }
  88. }
  89. ]);
  90. } else {
  91. Alert.alert('Error', 'An unexpected error occurred while fetching the price', [
  92. {
  93. text: 'OK',
  94. onPress: () => {
  95. cleanupData();
  96. router.push('/mainPage');
  97. }
  98. }
  99. ]);
  100. }
  101. }
  102. };
  103. fetchCurrentPrice();
  104. }, []);
  105. // Add this effect to handle Android back button
  106. useFocusEffect(
  107. useCallback(() => {
  108. const onBackPress = () => {
  109. cleanupData();
  110. if (router.canGoBack()) {
  111. router.back();
  112. } else {
  113. router.replace('/scanQrPage');
  114. }
  115. return true;
  116. };
  117. const subscription = BackHandler.addEventListener('hardwareBackPress', onBackPress);
  118. return () => subscription.remove()
  119. // return () => BackHandler.removeEventListener('hardwareBackPress', onBackPress);
  120. }, [])
  121. );
  122. //check payment status
  123. useEffect(() => {
  124. const subscription = AppState.addEventListener('change', (nextAppState: any) => {
  125. if (
  126. appState.current.match(/inactive|background/) &&
  127. nextAppState === 'active' &&
  128. isExpectingPayment &&
  129. // outTradeNo &&
  130. paymentInitiatedTime.current
  131. ) {
  132. const currentTime = new Date().getTime();
  133. if (currentTime - paymentInitiatedTime.current < PAYMENT_CHECK_TIMEOUT) {
  134. checkPaymentStatus();
  135. } else {
  136. // Payment check timeout reached
  137. setIsExpectingPayment(false);
  138. setOutTradeNo('');
  139. paymentInitiatedTime.current = null;
  140. Alert.alert(
  141. 'Payment Timeout',
  142. 'The payment status check has timed out. Please check your payment history.'
  143. );
  144. }
  145. }
  146. appState.current = nextAppState;
  147. });
  148. return () => {
  149. subscription.remove();
  150. };
  151. }, [outTradeNo, isExpectingPayment]);
  152. const navigation = useNavigation();
  153. useLayoutEffect(() => {
  154. navigation.setOptions({
  155. gestureEnabled: false
  156. });
  157. }, [navigation]);
  158. const checkPaymentStatus = async () => {
  159. try {
  160. // console.log('outTradeNo in scanQR Page checkpaymentstatus ', outTradeNo);
  161. const result = await walletService.checkPaymentStatus(outTradeNo);
  162. setPaymentStatus(result);
  163. // console.log('checkPaymentStatus from scan QR checkpaymentStatus', result);
  164. if (result && !result.some((item) => item.errmsg?.includes('處理中'))) {
  165. // Payment successful
  166. // console.log('totalFee', totalFee);
  167. Alert.alert('付款已成功', `你已成功增值。請重新掃描去啟動充電槍。`, [
  168. {
  169. text: '確認',
  170. onPress: async () => {
  171. cleanupData();
  172. router.push('/mainPage');
  173. }
  174. }
  175. ]);
  176. } else {
  177. Alert.alert('付款失敗', '請再試一次。', [
  178. {
  179. text: '確定',
  180. onPress: () => {
  181. cleanupData();
  182. router.push('/mainPage');
  183. }
  184. }
  185. ]);
  186. }
  187. setIsExpectingPayment(false);
  188. setOutTradeNo('');
  189. paymentInitiatedTime.current = null;
  190. } catch (error) {
  191. console.error('Failed to check payment status:', error);
  192. Alert.alert('Error', 'Failed to check payment status. Please check your payment history.');
  193. }
  194. };
  195. const showLoadingAndNavigate = async () => {
  196. setLoadingModalVisible(true);
  197. // Wait for 2 seconds
  198. await new Promise((resolve) => setTimeout(resolve, 2000));
  199. cleanupData();
  200. setLoadingModalVisible(false);
  201. router.navigate('(auth)/(tabs)/(home)/mainPage');
  202. router.push('(auth)/(tabs)/(charging)/chargingPage');
  203. };
  204. const cleanupData = () => {
  205. setPromotionCode([]);
  206. setCouponDetail([]);
  207. setProcessedCouponStore([]);
  208. setSumOfCoupon(0);
  209. setTotalPower(null);
  210. };
  211. const handlePay = async () => {
  212. try {
  213. let car, user_id, walletBalance, price_for_pay;
  214. setLoading(true);
  215. if (currentPriceTotalPayment === null) {
  216. Alert.alert('Please wait', 'Still loading price information...');
  217. return;
  218. }
  219. //fetch car with proper try catch
  220. try {
  221. car = await chargeStationService.getUserDefaultCars();
  222. if (!car?.data?.id) {
  223. Alert.alert('Failed to fetch UDCC', 'Please try again later');
  224. return;
  225. }
  226. } catch (error) {
  227. console.error('Failed to fetch user default car:', error);
  228. Alert.alert('Failed to fetch UDC', 'Please try again later');
  229. return;
  230. }
  231. //fetch user id with proper try catch
  232. try {
  233. user_id = await authenticationService.getUserInfo();
  234. if (!user_id?.data?.id) {
  235. Alert.alert('Failed to fetch userID', 'Please try again later');
  236. return;
  237. }
  238. } catch (error) {
  239. console.error('Failed to fetch user ID:', error);
  240. Alert.alert('Failed to fetch user ID', 'Please try again later');
  241. return;
  242. }
  243. // fetch user wallet with proper try catch
  244. try {
  245. walletBalance = await walletService.getWalletBalance();
  246. } catch (error) {
  247. console.error('Failed to fetch user wallet:', error);
  248. Alert.alert('Failed to fetch user wallet', 'Please try again later');
  249. return;
  250. }
  251. //now i have all information ready, i check penalty reservation
  252. //by first fetching all history, then check if penalty_fee > 0 and penalty_paid_status is false
  253. //if there is any, i will show an alert to the user, and once click the alert it will takes them to a page that show the detail of the reservation.
  254. try {
  255. const reservationHistories = await chargeStationService.fetchReservationHistories();
  256. // console.log('reservationHistories', reservationHistories);
  257. //here if i successfully fetch the reservationHistories, i will check if there are penalty, if i cannot fetch, i will simply continue the payment flow
  258. if (reservationHistories || Array.isArray(reservationHistories)) {
  259. const unpaidPenalties = reservationHistories.filter(
  260. (reservation: any) => reservation.penalty_fee > 0 && reservation.penalty_paid_status === false
  261. );
  262. const mostRecentUnpaidReservation = unpaidPenalties.reduce((mostRecent: any, current: any) => {
  263. return new Date(mostRecent.created_at) > new Date(current.created_at) ? mostRecent : current;
  264. }, unpaidPenalties[0]);
  265. if (unpaidPenalties.length > 0) {
  266. Alert.alert(
  267. '未付罰款',
  268. '您有未支付的罰款。請先支付罰款後再重新掃描充電。',
  269. [
  270. {
  271. text: '查看詳情',
  272. onPress: () => {
  273. // Navigate to a page showing penalty details
  274. cleanupData();
  275. router.push({
  276. pathname: '(auth)/(tabs)/(home)/penaltyPaymentPage',
  277. params: {
  278. book_time: mostRecentUnpaidReservation.book_time,
  279. end_time: mostRecentUnpaidReservation.end_time,
  280. actual_end_time: mostRecentUnpaidReservation.actual_end_time,
  281. penalty_fee: mostRecentUnpaidReservation.penalty_fee,
  282. format_order_id: mostRecentUnpaidReservation.format_order_id,
  283. id: mostRecentUnpaidReservation.id
  284. }
  285. });
  286. }
  287. },
  288. {
  289. text: '返回',
  290. onPress: () => {
  291. cleanupData();
  292. if (router.canGoBack()) {
  293. router.push('/mainPage');
  294. } else {
  295. router.push('/mainPage');
  296. }
  297. }
  298. }
  299. ],
  300. { cancelable: false }
  301. );
  302. return;
  303. }
  304. }
  305. } catch (error) {
  306. Alert.alert('Error', 'Failed to fetch reservation histories for penalty checking purpose');
  307. }
  308. const now = new Date();
  309. const end_time_map: {
  310. [key: number]: number;
  311. } = {
  312. 20: 25,
  313. 25: 30,
  314. 30: 40,
  315. 40: 45,
  316. 80: 120
  317. };
  318. const end_time = new Date(now.getTime() + end_time_map[total_power] * 60000);
  319. const payloadForPay = {
  320. stationID: stationID,
  321. connector: scanned_qr_code,
  322. user: user_id.data.id,
  323. book_time: now.toISOString(),
  324. end_time: end_time.toISOString(),
  325. total_power: total_power,
  326. total_fee: total_power * currentPriceTotalPayment,
  327. promotion_code: promotion_code,
  328. with_coupon: promotion_code.length > 0 ? true : false,
  329. car: car.data.id,
  330. type: 'walking',
  331. is_ic_call: false
  332. };
  333. // check if user has enough wallet, if not, link to qf pay page
  334. if (totalPrice === null) {
  335. Alert.alert('Error', 'Unable to fetch totalPrice', [
  336. {
  337. text: 'OK',
  338. onPress: () => {
  339. cleanupData();
  340. router.push('/mainPage');
  341. }
  342. }
  343. ]);
  344. return;
  345. }
  346. if (walletBalance < totalPrice) {
  347. const needToPay = totalPrice - walletBalance;
  348. oneTimeCharging(needToPay);
  349. return;
  350. } else {
  351. // if user has enough wallet, proceed to payment
  352. try {
  353. const response = await walletService.newSubmitPayment(
  354. payloadForPay.stationID,
  355. payloadForPay.connector,
  356. payloadForPay.user,
  357. payloadForPay.book_time,
  358. payloadForPay.end_time,
  359. payloadForPay.total_power,
  360. payloadForPay.total_fee,
  361. payloadForPay.promotion_code,
  362. payloadForPay.with_coupon,
  363. payloadForPay.car,
  364. payloadForPay.type,
  365. payloadForPay.is_ic_call
  366. );
  367. if (response.error) {
  368. console.log('Error1', response.error);
  369. // Handle error response from the service
  370. Alert.alert('掃描失敗 請稍後再試。', response.message || '未知錯誤', [
  371. {
  372. text: '返回主頁',
  373. onPress: () => {
  374. cleanupData();
  375. router.push('/mainPage');
  376. }
  377. }
  378. ]);
  379. return;
  380. }
  381. if (response === 200 || response === 201) {
  382. Alert.alert('啟動成功', '請按下確認並等待頁面稍後自動跳轉至充電介面', [
  383. {
  384. text: '確認',
  385. onPress: showLoadingAndNavigate
  386. }
  387. ]);
  388. } else {
  389. console.log('Error111', response, payloadForPay.connector);
  390. Alert.alert('掃描失敗 請稍後再試。', response.error_msg || '未知錯誤', [
  391. {
  392. text: '返回主頁',
  393. onPress: () => {
  394. cleanupData();
  395. router.push('/mainPage');
  396. }
  397. }
  398. ]);
  399. }
  400. } catch (error) {
  401. console.error('Payment submission failed:', error);
  402. Alert.alert('錯誤', '付款提交失敗,請稍後再試。', [
  403. {
  404. text: 'OK',
  405. onPress: () => {
  406. cleanupData();
  407. router.push('/mainPage');
  408. }
  409. }
  410. ]);
  411. }
  412. }
  413. } catch (error) {
  414. } finally {
  415. setLoading(false);
  416. }
  417. };
  418. function formatTime(utcTimeString: any) {
  419. // Parse the UTC time string
  420. const date = new Date(utcTimeString);
  421. // Add 8 hours
  422. date.setHours(date.getHours());
  423. // Format the date
  424. const year = date.getFullYear();
  425. const month = String(date.getMonth() + 1).padStart(2, '0');
  426. const day = String(date.getDate()).padStart(2, '0');
  427. const hours = String(date.getHours()).padStart(2, '0');
  428. const minutes = String(date.getMinutes()).padStart(2, '0');
  429. const seconds = String(date.getSeconds()).padStart(2, '0');
  430. // Return the formatted string
  431. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  432. }
  433. const oneTimeCharging = async (inputAmount: number) => {
  434. try {
  435. const response = await walletService.getOutTradeNo();
  436. if (response) {
  437. setOutTradeNo(response);
  438. setIsExpectingPayment(true);
  439. paymentInitiatedTime.current = new Date().getTime();
  440. const now = new Date();
  441. const formattedTime = formatTime(now);
  442. let amount = inputAmount * 100;
  443. const origin = 'https://openapi-hk.qfapi.com/checkstand/#/?';
  444. const obj = {
  445. // appcode: '6937EF25DF6D4FA78BB2285441BC05E9',
  446. appcode: '636E234FB30D43598FC8F0140A1A7282',
  447. goods_name: 'Crazy Charge 錢包增值',
  448. out_trade_no: response,
  449. paysource: 'crazycharge_checkout',
  450. return_url: 'https://crazycharge.com.hk/completed',
  451. failed_url: 'https://crazycharge.com.hk/failed',
  452. notify_url: 'https://api.crazycharge.com.hk/api/v1/clients/qfpay/webhook',
  453. sign_type: 'sha256',
  454. txamt: amount,
  455. txcurrcd: 'HKD',
  456. txdtm: formattedTime
  457. };
  458. const paramStringify = (json, flag?) => {
  459. let str = '';
  460. let keysArr = Object.keys(json);
  461. keysArr.sort().forEach((val) => {
  462. if (!json[val]) return;
  463. str += `${val}=${flag ? encodeURIComponent(json[val]) : json[val]}&`;
  464. });
  465. return str.slice(0, -1);
  466. };
  467. // const api_key = '8F59E31F6ADF4D2894365F2BB6D2FF2C';
  468. const api_key = '3E2727FBA2DA403EA325E73F36B07824';
  469. const params = paramStringify(obj);
  470. const sign = sha256(`${params}${api_key}`).toString();
  471. const url = `${origin}${paramStringify(obj, true)}&sign=${sign}`;
  472. try {
  473. const supported = await Linking.canOpenURL(url);
  474. if (supported) {
  475. Alert.alert('', '偵測到您錢包餘額不足,現在為您跳轉到充值頁面', [
  476. {
  477. text: '確定',
  478. onPress: async () => {
  479. await Linking.openURL(url);
  480. }
  481. }
  482. ]);
  483. } else {
  484. Alert.alert('錯誤', '請稍後再試');
  485. }
  486. } catch (error) {
  487. console.error('Top-up failed:', error);
  488. Alert.alert('Error', '一次性付款失敗,請稍後再試');
  489. }
  490. } else {
  491. Alert.alert('Error', 'failed to fetch outTradeNo.');
  492. }
  493. } catch (error) {
  494. Alert.alert('錯誤', '一次性付款失敗,請稍後再試');
  495. }
  496. };
  497. return (
  498. <SafeAreaView className="flex-1 bg-white" edges={['top', 'left', 'right']}>
  499. <Modal transparent={true} visible={loadingModalVisible} animationType="fade">
  500. <View className="flex-1 justify-center items-center bg-black/50">
  501. <View className="bg-white p-6 rounded-lg items-center">
  502. <ActivityIndicator size="large" color="#02677D" />
  503. <Text className="mt-3">請稍候...</Text>
  504. </View>
  505. </View>
  506. </Modal>
  507. <ScrollView className="flex-1 mx-[5%]" showsVerticalScrollIndicator={false}>
  508. <View style={{ marginTop: 25 }}>
  509. <Pressable
  510. onPress={() => {
  511. if (router.canGoBack()) {
  512. router.back();
  513. } else {
  514. cleanupData();
  515. router.replace('/scanQrPage');
  516. }
  517. }}
  518. >
  519. <PreviousPageBlackSvg />
  520. </Pressable>
  521. </View>
  522. <View style={{ marginTop: 25 }}>
  523. <Text style={{ fontSize: 45, paddingBottom: 12 }}>付款概要</Text>
  524. <View>
  525. <View className="flex-row justify-between">
  526. <Text className="text-base lg:text-lg ">充電費用</Text>
  527. <Text className="text-base lg:text-lg">
  528. HK $ {currentPriceTotalPayment ? currentPriceTotalPayment * total_power : 'Loading...'}
  529. </Text>
  530. </View>
  531. <Text style={styles.grayColor} className="text-sm lg:text-base mt-4">
  532. 結算電度數 : {total_power == 80 ? '充滿停機' : `${total_power} KWh`}
  533. </Text>
  534. <Text style={styles.grayColor} className="text-sm lg:text-base mt-4">
  535. 每度電價錢 : $ {currentPriceTotalPayment ? currentPriceTotalPayment : 'Loading...'}
  536. </Text>
  537. <View className="h-0.5 my-3 bg-[#f4f4f4]" />
  538. {processed_coupon_store && processed_coupon_store.length > 0 && (
  539. <Text className="text-base lg:text-lg mb-4 lg:mb-6">優惠劵</Text>
  540. )}
  541. {processed_coupon_store &&
  542. processed_coupon_store?.map((couponObj: any) => (
  543. <View
  544. key={`${couponObj.coupon_detail.amount}-${couponObj.coupon_detail.expire_date}`}
  545. className="flex flex-row items-center justify-between"
  546. >
  547. <View className="flex flex-row items-start ">
  548. <Image
  549. className="w-6 lg:w-8 xl:w-10 h-6 lg:h-8 xl:h-10"
  550. source={require('../../../../assets/couponlogo.png')}
  551. />
  552. <View key={couponObj.coupon_detail.id} className="flex flex-col ml-2 lg:ml-4 ">
  553. <Text className="text-base lg:text-xl text-[#888888] ">
  554. ${couponObj.coupon_detail.amount} 現金劵
  555. </Text>
  556. <Text className=" text-sm lg:text-base my-1 lg:mt-2 lg:mb-4 text-[#888888]">
  557. 有效期{' '}
  558. <Text className="font-[500] text-[#02677D]">
  559. 至 {couponObj.coupon_detail.expire_date.slice(0, 10)}
  560. </Text>
  561. </Text>
  562. </View>
  563. </View>
  564. {/* x 1 */}
  565. <View className="flex flex-row items-center">
  566. <Text className="text-sm lg:text-base">X {' '}</Text>
  567. <View className="w-8 h-8 rounded-full bg-[#02677D] flex items-center justify-center">
  568. <Text className="text-white text-center text-lg">
  569. {couponObj.frequency}
  570. </Text>
  571. </View>
  572. </View>
  573. </View>
  574. ))}
  575. {processed_coupon_store && processed_coupon_store.length > 0 && (
  576. <View className="h-0.5 my-3 bg-[#f4f4f4]" />
  577. )}
  578. <View className="flex-row justify-between ">
  579. <Text className="text-xl">總計</Text>
  580. <Text className="text-3xl">HK$ {totalPrice !== null ? totalPrice : 'Loading...'}</Text>
  581. </View>
  582. <View className="mt-4 ">
  583. <NormalButton
  584. title={
  585. <Text
  586. style={{
  587. color: 'white',
  588. fontSize: 16,
  589. fontWeight: '800'
  590. }}
  591. >
  592. {loading ? '處理中...' : '付款確認'}
  593. </Text>
  594. }
  595. onPress={handlePay}
  596. extendedStyle={{ padding: 24 }}
  597. />
  598. </View>
  599. <View className="h-8" />
  600. </View>
  601. </View>
  602. </ScrollView>
  603. </SafeAreaView>
  604. );
  605. };
  606. export default TotalPayment;
  607. const styles = StyleSheet.create({
  608. grayColor: {
  609. color: '#888888'
  610. },
  611. greenColor: {
  612. color: '#02677D'
  613. }
  614. });