|
|
@@ -200,29 +200,29 @@ const WalletPageComponent = () => {
|
|
|
const appState = useRef(AppState.currentState);
|
|
|
const paymentInitiatedTime = useRef(null);
|
|
|
// 优惠券注释
|
|
|
- // useEffect(() => {
|
|
|
- // const fetchData = async () => {
|
|
|
- // try {
|
|
|
- // setLoading(true);
|
|
|
- // const info = await walletService.getCustomerInfo();
|
|
|
- // const coupon = await walletService.getCouponForSpecificUser(info.id);
|
|
|
- // const useableConpon = coupon.filter((couponObj: any) => {
|
|
|
- // const today = new Date();
|
|
|
- // if (couponObj.expire_date === null) {
|
|
|
- // return couponObj.is_consumed === false;
|
|
|
- // }
|
|
|
- // const expireDate = new Date(couponObj.expire_date);
|
|
|
- // return expireDate > today && couponObj.is_consumed === false;
|
|
|
- // });
|
|
|
-
|
|
|
- // setCoupons(useableConpon);
|
|
|
- // } catch (error) {
|
|
|
- // } finally {
|
|
|
- // setLoading(false);
|
|
|
- // }
|
|
|
- // };
|
|
|
- // fetchData();
|
|
|
- // }, []);
|
|
|
+ useEffect(() => {
|
|
|
+ const fetchData = async () => {
|
|
|
+ try {
|
|
|
+ setLoading(true);
|
|
|
+ const info = await walletService.getCustomerInfo();
|
|
|
+ const coupon = await walletService.getCouponForSpecificUser(info.id);
|
|
|
+ const useableConpon = coupon.filter((couponObj: any) => {
|
|
|
+ const today = new Date();
|
|
|
+ if (couponObj.expire_date === null) {
|
|
|
+ return couponObj.is_consumed === false;
|
|
|
+ }
|
|
|
+ const expireDate = new Date(couponObj.expire_date);
|
|
|
+ return expireDate > today && couponObj.is_consumed === false;
|
|
|
+ });
|
|
|
+
|
|
|
+ setCoupons(useableConpon);
|
|
|
+ } catch (error) {
|
|
|
+ } finally {
|
|
|
+ setLoading(false);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ fetchData();
|
|
|
+ }, []);
|
|
|
//monitor app state
|
|
|
useEffect(() => {
|
|
|
const subscription = AppState.addEventListener('change', (nextAppState) => {
|
|
|
@@ -520,9 +520,9 @@ const WalletPageComponent = () => {
|
|
|
|
|
|
<View className="flex-row justify-between mx-[5%] pt-6 pb-3">
|
|
|
<Text className="text-xl">優惠券</Text>
|
|
|
- {/* <Pressable onPress={() => router.push('couponPage')}>
|
|
|
+ <Pressable onPress={() => router.push('couponPage')}>
|
|
|
<Text className="text-xl text-[#888888]">顯示所有</Text>
|
|
|
- </Pressable> */}
|
|
|
+ </Pressable>
|
|
|
</View>
|
|
|
|
|
|
<View className="flex-1 flex-col mx-[5%]">
|