|
@@ -56,6 +56,8 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
|
|
|
TextView weixin_name_tv;
|
|
TextView weixin_name_tv;
|
|
|
@BindView(R.id.withdrawal_click_bindname_tv)
|
|
@BindView(R.id.withdrawal_click_bindname_tv)
|
|
|
TextView withdrawal_click_bindname_tv;
|
|
TextView withdrawal_click_bindname_tv;
|
|
|
|
|
+ @BindView(R.id.withdrawal_service_charge_tv)
|
|
|
|
|
+ TextView withdrawal_service_charge_tv;
|
|
|
|
|
|
|
|
Activity activity;
|
|
Activity activity;
|
|
|
@Inject
|
|
@Inject
|
|
@@ -66,9 +68,11 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
|
|
|
private WithdrawalAdapter adapter;
|
|
private WithdrawalAdapter adapter;
|
|
|
private int select;
|
|
private int select;
|
|
|
private String amount;
|
|
private String amount;
|
|
|
|
|
+ private int withdrawCount;
|
|
|
private float balanceAmount;//余额
|
|
private float balanceAmount;//余额
|
|
|
|
|
|
|
|
- private UserEntity userEntity;
|
|
|
|
|
|
|
+ private UserEntity userEntity;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
protected int getLayoutId() {
|
|
protected int getLayoutId() {
|
|
|
return R.layout.withdrawal_layout;
|
|
return R.layout.withdrawal_layout;
|
|
@@ -80,6 +84,7 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
|
|
|
TitleBarUtils
|
|
TitleBarUtils
|
|
|
.getInstance()
|
|
.getInstance()
|
|
|
.setShowOrHide(this, true)
|
|
.setShowOrHide(this, true)
|
|
|
|
|
+ .setTitleBackgroud(this, R.color.bg_color)
|
|
|
.setTitle(activity, "提现")
|
|
.setTitle(activity, "提现")
|
|
|
.setTitleFinish(activity);
|
|
.setTitleFinish(activity);
|
|
|
DaggerWithdrawalComponent.builder()
|
|
DaggerWithdrawalComponent.builder()
|
|
@@ -95,15 +100,16 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
|
|
|
@Override
|
|
@Override
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
select = position;
|
|
select = position;
|
|
|
- for(int i=0;i<wlLists.size();i++){
|
|
|
|
|
- if(position == i){
|
|
|
|
|
|
|
+ for (int i = 0; i < wlLists.size(); i++) {
|
|
|
|
|
+ if (position == i) {
|
|
|
wlLists.get(i).getGridViewEntity().setSelectState(true);
|
|
wlLists.get(i).getGridViewEntity().setSelectState(true);
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
wlLists.get(i).getGridViewEntity().setSelectState(false);
|
|
wlLists.get(i).getGridViewEntity().setSelectState(false);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
adapter.notifyDataSetChanged();
|
|
adapter.notifyDataSetChanged();
|
|
|
}
|
|
}
|
|
|
|
|
+ showWithdrawServiceCharge();
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
showProgress();
|
|
showProgress();
|
|
@@ -112,9 +118,9 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void onNewIntent(Intent intent){
|
|
|
|
|
|
|
+ public void onNewIntent(Intent intent) {
|
|
|
super.onNewIntent(intent);
|
|
super.onNewIntent(intent);
|
|
|
- if("FINISH".equals(intent.getStringExtra("INTENT_ACTION"))) {
|
|
|
|
|
|
|
+ if ("FINISH".equals(intent.getStringExtra("INTENT_ACTION"))) {
|
|
|
finish();
|
|
finish();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -136,7 +142,7 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
|
|
|
|
|
|
|
|
public void mInitData() {
|
|
public void mInitData() {
|
|
|
userEntity = DataUtil.getInstance().getUserEntity();
|
|
userEntity = DataUtil.getInstance().getUserEntity();
|
|
|
- if(userEntity != null){
|
|
|
|
|
|
|
+ if (userEntity != null) {
|
|
|
ViewUtil.setText(weixin_name_tv, userEntity.getWx_nickname());
|
|
ViewUtil.setText(weixin_name_tv, userEntity.getWx_nickname());
|
|
|
}
|
|
}
|
|
|
setBalanceAmount();
|
|
setBalanceAmount();
|
|
@@ -154,7 +160,7 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
|
|
|
//执行充值
|
|
//执行充值
|
|
|
private void doWithdrawal() {
|
|
private void doWithdrawal() {
|
|
|
UMConfigUtils.Event.SHEEP_TIXIAN_COMMIT.onEvent();
|
|
UMConfigUtils.Event.SHEEP_TIXIAN_COMMIT.onEvent();
|
|
|
- if(ListUtil.hasIndex(wlLists, select)) {
|
|
|
|
|
|
|
+ if (ListUtil.hasIndex(wlLists, select)) {
|
|
|
amount = wlLists.get(select).getGridViewEntity().getValue();
|
|
amount = wlLists.get(select).getGridViewEntity().getValue();
|
|
|
if (TextUtils.isEmpty(amount)) {
|
|
if (TextUtils.isEmpty(amount)) {
|
|
|
G.showToast("请选择金额");
|
|
G.showToast("请选择金额");
|
|
@@ -175,7 +181,7 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
|
|
|
@Override
|
|
@Override
|
|
|
public void failData(Object o) {
|
|
public void failData(Object o) {
|
|
|
hideProgress();
|
|
hideProgress();
|
|
|
- if(o instanceof BaseMessage)
|
|
|
|
|
|
|
+ if (o instanceof BaseMessage)
|
|
|
G.showToast((BaseMessage) o);
|
|
G.showToast((BaseMessage) o);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -191,20 +197,39 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
|
|
|
@Override
|
|
@Override
|
|
|
public void failBalanceData(BaseMessage o) {
|
|
public void failBalanceData(BaseMessage o) {
|
|
|
hideProgress();
|
|
hideProgress();
|
|
|
- G.showToast(o.getMsg()+"");
|
|
|
|
|
|
|
+ G.showToast(o.getMsg() + "");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//服务端返回可以提现金额
|
|
//服务端返回可以提现金额
|
|
|
@Override
|
|
@Override
|
|
|
public void updateBalanceView(BaseMessage baseMessage) {
|
|
public void updateBalanceView(BaseMessage baseMessage) {
|
|
|
-
|
|
|
|
|
hideProgress();
|
|
hideProgress();
|
|
|
- balanceAmount = baseMessage.getData(Float.class);
|
|
|
|
|
|
|
+ WithdrawAmountCountEntity entity = baseMessage.getData(WithdrawAmountCountEntity.class);
|
|
|
|
|
+ balanceAmount = entity.amount;
|
|
|
|
|
+ withdrawCount = entity.count;
|
|
|
setBalanceAmount();
|
|
setBalanceAmount();
|
|
|
|
|
+ showWithdrawServiceCharge();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void showWithdrawServiceCharge() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ float money = Float.parseFloat(wlLists.get(select).getGridViewEntity().getValue());
|
|
|
|
|
+ if (withdrawCount < 2) {
|
|
|
|
|
+ if (money >= 50) {
|
|
|
|
|
+ withdrawal_service_charge_tv.setText("提现手续费:" + (money * 15 / 1000));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ withdrawal_service_charge_tv.setText("新人免手续费");
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ withdrawal_service_charge_tv.setText("提现手续费:" + (money * 15 / 1000));
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//显示可以提现金额
|
|
//显示可以提现金额
|
|
|
- private void setBalanceAmount(){
|
|
|
|
|
|
|
+ private void setBalanceAmount() {
|
|
|
|
|
|
|
|
String sr = "可提现金额 <font color='#ff2d4b'><big>" + NumberFormatUtils.retainMost2(balanceAmount) + "</big></font> 元";
|
|
String sr = "可提现金额 <font color='#ff2d4b'><big>" + NumberFormatUtils.retainMost2(balanceAmount) + "</big></font> 元";
|
|
|
withdrawal_click_bindname_tv.setText(Html.fromHtml(sr));
|
|
withdrawal_click_bindname_tv.setText(Html.fromHtml(sr));
|
|
@@ -212,34 +237,40 @@ public class WithdrawalAct extends BaseActivity implements WithdrawalContract.Vi
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void failWithdrawAmountOptionData(BaseMessage o) {
|
|
public void failWithdrawAmountOptionData(BaseMessage o) {
|
|
|
- G.showToast(o.getMsg()+"");
|
|
|
|
|
|
|
+ G.showToast(o.getMsg() + "");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//服务端返回可提现金额选项
|
|
//服务端返回可提现金额选项
|
|
|
@Override
|
|
@Override
|
|
|
public void updateWithdrawAmountOptionView(BaseMessage o) {
|
|
public void updateWithdrawAmountOptionView(BaseMessage o) {
|
|
|
- try{
|
|
|
|
|
|
|
+ try {
|
|
|
List<WithdrawalList> withdrawalLists = JSONArray.parseArray(JSONArray.toJSONString(o.getData()), WithdrawalList.class);
|
|
List<WithdrawalList> withdrawalLists = JSONArray.parseArray(JSONArray.toJSONString(o.getData()), WithdrawalList.class);
|
|
|
wlLists.clear();
|
|
wlLists.clear();
|
|
|
- for(int i=0;i< withdrawalLists.size(); i++){
|
|
|
|
|
|
|
+ for (int i = 0; i < withdrawalLists.size(); i++) {
|
|
|
WithdrawalList withdrawalList = withdrawalLists.get(i);
|
|
WithdrawalList withdrawalList = withdrawalLists.get(i);
|
|
|
- if(withdrawalList.getType() != 2){
|
|
|
|
|
|
|
+ if (withdrawalList.getType() != 2) {
|
|
|
GridViewEntity gridViewEntity = new GridViewEntity();
|
|
GridViewEntity gridViewEntity = new GridViewEntity();
|
|
|
- if(i == 0){
|
|
|
|
|
|
|
+ if (i == 0) {
|
|
|
gridViewEntity.setSelectState(true);
|
|
gridViewEntity.setSelectState(true);
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
gridViewEntity.setSelectState(false);
|
|
gridViewEntity.setSelectState(false);
|
|
|
}
|
|
}
|
|
|
- gridViewEntity.setValue(withdrawalList.getAmount()+"");
|
|
|
|
|
|
|
+ gridViewEntity.setValue(withdrawalList.getAmount() + "");
|
|
|
withdrawalList.setGridViewEntity(gridViewEntity);
|
|
withdrawalList.setGridViewEntity(gridViewEntity);
|
|
|
|
|
|
|
|
wlLists.add(withdrawalList);
|
|
wlLists.add(withdrawalList);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
adapter.notifyDataSetChanged();
|
|
adapter.notifyDataSetChanged();
|
|
|
- }catch (Exception e){
|
|
|
|
|
|
|
+ showWithdrawServiceCharge();
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static class WithdrawAmountCountEntity {
|
|
|
|
|
+ public float amount = 0f;
|
|
|
|
|
+ public int count = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|