|
|
@@ -28,11 +28,14 @@ import com.yihucha.hbyhc.base.WebViewTitleBaseActivity;
|
|
28
|
28
|
import com.yihucha.hbyhc.config.Constants;
|
|
29
|
29
|
import com.yihucha.hbyhc.databinding.ActivityImmediateWithdrawalBinding;
|
|
30
|
30
|
import com.yihucha.hbyhc.presentation.annuity.RealNameAuthenticationActivity;
|
|
|
31
|
+import com.yihucha.hbyhc.presentation.apply_channel.model.UserInvitationCodeBean;
|
|
31
|
32
|
import com.yihucha.hbyhc.presentation.invitation.model.BankCardBean;
|
|
32
|
33
|
import com.yihucha.hbyhc.presentation.invitation.model.SpreadInfoBean;
|
|
33
|
34
|
import com.yihucha.hbyhc.presentation.invitation.model.WithdrawalConfigurationBean;
|
|
34
|
35
|
import com.yihucha.hbyhc.presentation.invitation.model.WithdrawalServiceBean;
|
|
35
|
36
|
import com.yihucha.hbyhc.presentation.invitation.view_model.InviteViewModel;
|
|
|
37
|
+import com.yihucha.hbyhc.presentation.login.LoginActivity;
|
|
|
38
|
+import com.yihucha.hbyhc.presentation.login.view_model.LoginViewModel;
|
|
36
|
39
|
import com.yihucha.hbyhc.presentation.mine.model.BindingStateBean;
|
|
37
|
40
|
import com.yihucha.hbyhc.presentation.mine.model.UpdateAccountBean;
|
|
38
|
41
|
import com.yihucha.hbyhc.presentation.mine.model.UserAnnuityInfoBean;
|
|
|
@@ -42,9 +45,11 @@ import com.yihucha.hbyhc.presentation.mine.view_model.MineSpreadInfo;
|
|
42
|
45
|
import com.yihucha.hbyhc.presentation.mine.view_model.MineViewModel;
|
|
43
|
46
|
import com.yihucha.hbyhc.utils.EmptyCheckUtils;
|
|
44
|
47
|
import com.yihucha.hbyhc.utils.LogUtil;
|
|
|
48
|
+import com.yihucha.hbyhc.utils.MVUtils;
|
|
45
|
49
|
import com.yihucha.hbyhc.utils.StringsUtil;
|
|
46
|
50
|
import com.yihucha.hbyhc.view.MyToast;
|
|
47
|
51
|
import com.tencent.mm.opensdk.modelmsg.SendAuth;
|
|
|
52
|
+import com.yihucha.hbyhc.view.SmsCodeDialog;
|
|
48
|
53
|
|
|
49
|
54
|
import org.greenrobot.eventbus.EventBus;
|
|
50
|
55
|
import org.greenrobot.eventbus.Subscribe;
|
|
|
@@ -60,7 +65,7 @@ import java.util.Map;
|
|
60
|
65
|
* @date 2022/8/2
|
|
61
|
66
|
* note:立即提现
|
|
62
|
67
|
*/
|
|
63
|
|
-public class ImmediateWithdrawalActivity extends ViewBindingTitleBaseActivity<ActivityImmediateWithdrawalBinding> implements View.OnClickListener {
|
|
|
68
|
+public class ImmediateWithdrawalActivity extends ViewBindingTitleBaseActivity<ActivityImmediateWithdrawalBinding> implements View.OnClickListener, SmsCodeDialog.DialogCallBack {
|
|
64
|
69
|
private InviteViewModel mInviteViewModel;
|
|
65
|
70
|
private String is_certification;//是否实名认证:1是
|
|
66
|
71
|
private String mBrokeragePrice;//可提现
|
|
|
@@ -77,6 +82,7 @@ public class ImmediateWithdrawalActivity extends ViewBindingTitleBaseActivity<Ac
|
|
77
|
82
|
private BindingStateBViewModel mBindingStateBViewModel;
|
|
78
|
83
|
private MineViewModel mineViewModel;
|
|
79
|
84
|
private MineSpreadInfo mineSpreadInfo;//用户信息数据
|
|
|
85
|
+ private SmsCodeDialog smsCodeDialog;
|
|
80
|
86
|
@SuppressLint("HandlerLeak")
|
|
81
|
87
|
private Handler mHandler = new Handler() {
|
|
82
|
88
|
@SuppressWarnings("unused")
|
|
|
@@ -126,7 +132,7 @@ public class ImmediateWithdrawalActivity extends ViewBindingTitleBaseActivity<Ac
|
|
126
|
132
|
}
|
|
127
|
133
|
}
|
|
128
|
134
|
};
|
|
129
|
|
-
|
|
|
135
|
+ private LoginViewModel loginViewModel;
|
|
130
|
136
|
|
|
131
|
137
|
|
|
132
|
138
|
@Override
|
|
|
@@ -134,6 +140,7 @@ public class ImmediateWithdrawalActivity extends ViewBindingTitleBaseActivity<Ac
|
|
134
|
140
|
super.onCreate(savedInstanceState);
|
|
135
|
141
|
mInviteViewModel = new ViewModelProvider(this).get(InviteViewModel.class);
|
|
136
|
142
|
mineViewModel = new ViewModelProvider(this).get(MineViewModel.class);
|
|
|
143
|
+ loginViewModel = new ViewModelProvider(this).get(LoginViewModel.class);
|
|
137
|
144
|
mBindingStateBViewModel = new ViewModelProvider(this).get(BindingStateBViewModel.class);
|
|
138
|
145
|
Bundle data = getIntent().getBundleExtra("data");
|
|
139
|
146
|
//保持提现页面一致,暂时隐藏该部分
|
|
|
@@ -147,9 +154,12 @@ public class ImmediateWithdrawalActivity extends ViewBindingTitleBaseActivity<Ac
|
|
147
|
154
|
|
|
148
|
155
|
@SuppressLint("SetTextI18n")
|
|
149
|
156
|
private void initData() {
|
|
|
157
|
+ String phone = MVUtils.getString(Constants.PHONE);
|
|
|
158
|
+ smsCodeDialog = new SmsCodeDialog(ImmediateWithdrawalActivity.this,
|
|
|
159
|
+ phone, this);
|
|
|
160
|
+ loginViewModel.mPhone.postValue(phone);
|
|
150
|
161
|
//佣金信息
|
|
151
|
|
- mInviteViewModel.getSpreadInfo();
|
|
152
|
|
- mInviteViewModel.mSpreadInfoData.observe(this, spreadInfoBean -> {
|
|
|
162
|
+ /* mInviteViewModel.mSpreadInfoData.observe(this, spreadInfoBean -> {
|
|
153
|
163
|
mBrokeragePrice = spreadInfoBean.getBrokerage_price();
|
|
154
|
164
|
mViewBinding.tvBrokeragePrice.setText("可用余额:¥" + mBrokeragePrice);
|
|
155
|
165
|
mMemberBrokeragePrice = spreadInfoBean.getMember_brokerage_price();
|
|
|
@@ -166,7 +176,7 @@ public class ImmediateWithdrawalActivity extends ViewBindingTitleBaseActivity<Ac
|
|
166
|
176
|
} catch (Exception e) {
|
|
167
|
177
|
|
|
168
|
178
|
}
|
|
169
|
|
- });
|
|
|
179
|
+ });*/
|
|
170
|
180
|
mBindingStateBViewModel.getBindingState();
|
|
171
|
181
|
// mInviteViewModel.getBandAccountInfo(type, "");
|
|
172
|
182
|
mBindingStateBViewModel.mBindingStateBean.observe(this, bindingStateBeans -> {
|
|
|
@@ -240,18 +250,15 @@ public class ImmediateWithdrawalActivity extends ViewBindingTitleBaseActivity<Ac
|
|
240
|
250
|
});
|
|
241
|
251
|
//支付宝授权链接
|
|
242
|
252
|
mInviteViewModel.mAuthInfoSucceed.observe(this, s -> {
|
|
243
|
|
- Runnable authRunnable = new Runnable() {
|
|
244
|
|
- @Override
|
|
245
|
|
- public void run() {
|
|
246
|
|
- // 构造AuthTask 对象
|
|
247
|
|
- AuthTask authTask = new AuthTask(ImmediateWithdrawalActivity.this);
|
|
248
|
|
- // 调用授权接口,获取授权结果
|
|
249
|
|
- Map<String, String> result = authTask.authV2(s, true);
|
|
250
|
|
- Message msg = new Message();
|
|
251
|
|
- msg.what = SDK_AUTH_FLAG;
|
|
252
|
|
- msg.obj = result;
|
|
253
|
|
- mHandler.sendMessage(msg);
|
|
254
|
|
- }
|
|
|
253
|
+ Runnable authRunnable = () -> {
|
|
|
254
|
+ // 构造AuthTask 对象
|
|
|
255
|
+ AuthTask authTask = new AuthTask(ImmediateWithdrawalActivity.this);
|
|
|
256
|
+ // 调用授权接口,获取授权结果
|
|
|
257
|
+ Map<String, String> result = authTask.authV2(s, true);
|
|
|
258
|
+ Message msg = new Message();
|
|
|
259
|
+ msg.what = SDK_AUTH_FLAG;
|
|
|
260
|
+ msg.obj = result;
|
|
|
261
|
+ mHandler.sendMessage(msg);
|
|
255
|
262
|
};
|
|
256
|
263
|
|
|
257
|
264
|
// 必须异步调用
|
|
|
@@ -280,8 +287,25 @@ public class ImmediateWithdrawalActivity extends ViewBindingTitleBaseActivity<Ac
|
|
280
|
287
|
});
|
|
281
|
288
|
|
|
282
|
289
|
mineViewModel.getSpreadInfoYhc();
|
|
283
|
|
- mineViewModel.spreadInfo.observe(this,mineSpreadInfo -> {
|
|
|
290
|
+ mineViewModel.spreadInfo.observe(this, mineSpreadInfo -> {
|
|
284
|
291
|
this.mineSpreadInfo = mineSpreadInfo;
|
|
|
292
|
+ mMemberBrokeragePrice = mBrokeragePrice = mineSpreadInfo.getCurrentBalance();
|
|
|
293
|
+ mViewBinding.tvRedIntegral.setText("可提现金额:" + mMemberBrokeragePrice);
|
|
|
294
|
+ mViewBinding.tvRedIntegral.setVisibility(View.VISIBLE);
|
|
|
295
|
+ mViewBinding.tvIntegral.setVisibility(View.GONE);
|
|
|
296
|
+ mViewBinding.tvBrokeragePrice.setVisibility(View.GONE);
|
|
|
297
|
+ try {
|
|
|
298
|
+ if (mWithdrawal_money != null && !isShow) {
|
|
|
299
|
+ if ((Double.parseDouble(mBrokeragePrice) < Double.parseDouble(mWithdrawal_money))) {
|
|
|
300
|
+ Toast toast = Toast.makeText(context, "满" + mWithdrawal_money + "才可以提现~", Toast.LENGTH_SHORT);
|
|
|
301
|
+ toast.setGravity(Gravity.CENTER, 0, 0);
|
|
|
302
|
+ toast.show();
|
|
|
303
|
+ }
|
|
|
304
|
+ isShow = true;
|
|
|
305
|
+ }
|
|
|
306
|
+ } catch (Exception e) {
|
|
|
307
|
+
|
|
|
308
|
+ }
|
|
285
|
309
|
});
|
|
286
|
310
|
|
|
287
|
311
|
mInviteViewModel.failed.observe(this, s -> ToastUtils.showLong(s));
|
|
|
@@ -370,7 +394,7 @@ public class ImmediateWithdrawalActivity extends ViewBindingTitleBaseActivity<Ac
|
|
370
|
394
|
mViewBinding.etCashWithdrawalAmount.setText(mBrokeragePrice);
|
|
371
|
395
|
}
|
|
372
|
396
|
} else if (v == mViewBinding.tvImmediateWithdrawal) {
|
|
373
|
|
- if ("0".equals(mineSpreadInfo.getIdentity())){
|
|
|
397
|
+ if ("0".equals(mineSpreadInfo.getIdentity())) {
|
|
374
|
398
|
ToastUtils.showLong("需要您升级为合伙人");
|
|
375
|
399
|
return;
|
|
376
|
400
|
}
|
|
|
@@ -428,9 +452,14 @@ public class ImmediateWithdrawalActivity extends ViewBindingTitleBaseActivity<Ac
|
|
428
|
452
|
RealNameAuthenticationActivity.launch(context);
|
|
429
|
453
|
return;
|
|
430
|
454
|
}
|
|
431
|
|
- //TODO 这里如果是银行卡提现,需要弹窗获取验证码,然后输入验证码后进行提现此操作
|
|
432
|
|
- //立即提现
|
|
433
|
|
- mInviteViewModel.getApplicationWithdrawal(mViewBinding.etCashWithdrawalAmount.getText().toString(), type, isRed);
|
|
|
455
|
+ if ("1".equals(type)) {
|
|
|
456
|
+ //立即提现
|
|
|
457
|
+ mInviteViewModel.getApplicationWithdrawal(mViewBinding.etCashWithdrawalAmount.getText().toString(), type, isRed);
|
|
|
458
|
+ } else {
|
|
|
459
|
+// loginViewModel.getCode(ImmediateWithdrawalActivity.this);
|
|
|
460
|
+ smsCodeDialog.show();
|
|
|
461
|
+ }
|
|
|
462
|
+
|
|
434
|
463
|
} else if (v == mViewBinding.llWx) {
|
|
435
|
464
|
//微信
|
|
436
|
465
|
type = "1";
|
|
|
@@ -520,4 +549,16 @@ public class ImmediateWithdrawalActivity extends ViewBindingTitleBaseActivity<Ac
|
|
520
|
549
|
super.onDestroy();
|
|
521
|
550
|
EventBus.getDefault().unregister(this);
|
|
522
|
551
|
}
|
|
|
552
|
+
|
|
|
553
|
+ @Override
|
|
|
554
|
+ public void onConfirm(String code) {
|
|
|
555
|
+ //验证码确认
|
|
|
556
|
+ mInviteViewModel.getApplicationWithdrawal(mViewBinding.etCashWithdrawalAmount.getText().toString(), type, code);
|
|
|
557
|
+ }
|
|
|
558
|
+
|
|
|
559
|
+ @Override
|
|
|
560
|
+ public void onReGetCode() {
|
|
|
561
|
+ //重新获取验证码
|
|
|
562
|
+ loginViewModel.getCode(ImmediateWithdrawalActivity.this);
|
|
|
563
|
+ }
|
|
523
|
564
|
}
|