phonepe business 绑定优化

This commit is contained in:
2026-03-12 11:34:18 +08:00
parent 4191dd37d7
commit eeeba437d2

39
App.tsx
View File

@@ -216,6 +216,7 @@ export default class App extends Component<AppProps, WalletmanAppState> {
console.log(result);
await Api.instance.register(WalletType.PHONEPE_BUSINESS, result);
this.setState({ showPhonePeBusinessBind: false });
Alert.alert('绑定成功', 'PhonePe Business 绑定成功');
} catch (error) {
Alert.alert('绑定失败', (error as Error).message);
this.setState({ showPhonePeBusinessBind: false });
@@ -228,6 +229,7 @@ export default class App extends Component<AppProps, WalletmanAppState> {
console.log(result);
await Api.instance.register(WalletType.GOOGLEPAY_BUSINESS, result);
this.setState({ showGooglePayBusinessBind: false });
Alert.alert('绑定成功', 'Google Pay Business 绑定成功');
} catch (error) {
Alert.alert('绑定失败', (error as Error).message);
this.setState({ showGooglePayBusinessBind: false });
@@ -415,6 +417,43 @@ export default class App extends Component<AppProps, WalletmanAppState> {
Alert.alert('绑定失败', error);
this.setState({ showPhonePeBusinessBind: false });
}}
onRenderBottomView={({ showOtpInput, loading, formError, phone, otp, onPhoneChange, onOtpChange, onGetOtp, onSubmitOtp }) => (
<View style={{ position: 'absolute', bottom: 0, left: 0, right: 0, backgroundColor: '#fff', padding: 16, borderTopWidth: 1, borderTopColor: '#e0e0e0', gap: 10 }}>
{!showOtpInput ? (
<>
<TextInput
style={{ borderWidth: 1, borderColor: '#ccc', borderRadius: 8, paddingHorizontal: 12, paddingVertical: 10, fontSize: 15, color: '#333' }}
placeholder="Mobile Number"
placeholderTextColor="#999"
keyboardType="phone-pad"
value={phone}
onChangeText={onPhoneChange}
editable={!loading}
/>
{!!formError && <Text style={{ color: '#e53935', fontSize: 13 }}>{formError}</Text>}
<TouchableOpacity style={{ backgroundColor: '#5a2d9c', borderRadius: 8, paddingVertical: 12, alignItems: 'center', opacity: loading ? 0.5 : 1 }} onPress={onGetOtp} disabled={loading}>
<Text style={{ color: '#fff', fontSize: 15, fontWeight: '600' }}>{loading ? 'Loading...' : 'GET OTP'}</Text>
</TouchableOpacity>
</>
) : (
<>
<TextInput
style={{ borderWidth: 1, borderColor: '#ccc', borderRadius: 8, paddingHorizontal: 12, paddingVertical: 10, fontSize: 15, color: '#333' }}
placeholder="OTP"
placeholderTextColor="#999"
keyboardType="number-pad"
value={otp}
onChangeText={onOtpChange}
editable={!loading}
/>
{!!formError && <Text style={{ color: '#e53935', fontSize: 13 }}>{formError}</Text>}
<TouchableOpacity style={{ backgroundColor: '#5a2d9c', borderRadius: 8, paddingVertical: 12, alignItems: 'center', opacity: loading ? 0.5 : 1 }} onPress={onSubmitOtp} disabled={loading}>
<Text style={{ color: '#fff', fontSize: 15, fontWeight: '600' }}>{loading ? 'Loading...' : 'Verify OTP'}</Text>
</TouchableOpacity>
</>
)}
</View>
)}
/>
</Modal>
);