Browse Source

增加结算页面部分流程

Pq 1 year ago
parent
commit
d81204c1b6

+ 1 - 1
teacher/src/main/java/com/cooleshow/teacher/contract/WithdrawalContract.java

@@ -15,7 +15,7 @@ public interface WithdrawalContract {
 
         void doWithdrawalSuccess(Object o);
 
-        void checkContractSignResult(String result);
+        void checkContractSignResult(String result,boolean refreshFlag);
     }
 
     interface Presenter {

+ 2 - 9
teacher/src/main/java/com/cooleshow/teacher/presenter/income/WithdrawalPresenter.java

@@ -51,20 +51,13 @@ public class WithdrawalPresenter extends BasePresenter<WithdrawalContract.Withdr
                     getView().doWithdrawalSuccess(data);
                 }
             }
-
-            @Override
-            public void onComplete() {
-                super.onComplete();
-                getView().hideLoading();
-            }
-
         });
     }
 
     /**
      * 检查是否签署过提现协议
      */
-    public void checkContractSign() {
+    public void checkContractSign(boolean refreshFlag) {
         if (getView() != null) {
             getView().showLoading();
         }
@@ -73,7 +66,7 @@ public class WithdrawalPresenter extends BasePresenter<WithdrawalContract.Withdr
             @Override
             protected void onSuccess(String data) {
                 if (getView() != null) {
-                    getView().checkContractSignResult(data);
+                    getView().checkContractSignResult(data,refreshFlag);
                 }
             }
 

+ 32 - 4
teacher/src/main/java/com/cooleshow/teacher/ui/income/WithdrawalActivity.java

@@ -13,6 +13,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
 import com.cooleshow.base.common.WebConstants;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
+import com.cooleshow.base.utils.ThreadUtils;
 import com.cooleshow.base.utils.ToastUtil;
 import com.cooleshow.base.utils.ToastUtils;
 import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
@@ -35,12 +36,21 @@ import java.text.DecimalFormat;
  */
 @Route(path = RouterPath.IncomeCenter.TEACHER_MINE_WITHDRAWAL)
 public class WithdrawalActivity extends BaseMVPActivity<ActivityWithdrawalBinding, WithdrawalPresenter> implements WithdrawalContract.WithdrawalView, View.OnClickListener {
-
+    public static final int REFRESH_TIME = 5000;
     private CommonDialog mProtocolTipDialog;
     private CommonDialog bindcardTipDialog;
 
     private String signStatus = TeacherInfoConstants.WITHDRAW_PROTOCOL_NOT_SIGN;
 
+    private Runnable mRunnable = new Runnable() {
+        @Override
+        public void run() {
+            if (presenter != null) {
+                presenter.checkContractSign(false);
+            }
+        }
+    };
+
     @Override
     public void onClick(View view) {
         int id = view.getId();
@@ -178,7 +188,7 @@ public class WithdrawalActivity extends BaseMVPActivity<ActivityWithdrawalBindin
     protected void onResume() {
         super.onResume();
         if (presenter != null) {
-            presenter.checkContractSign();
+            presenter.checkContractSign(true);
         }
     }
 
@@ -286,24 +296,36 @@ public class WithdrawalActivity extends BaseMVPActivity<ActivityWithdrawalBindin
     }
 
     @Override
-    public void checkContractSignResult(String result) {
+    public void checkContractSignResult(String result, boolean refreshFlag) {
         if (!checkActivityExist()) {
             return;
         }
+        setSignStatus(result);
+        if (refreshFlag) {
+            presenter.getWithdrawalInfo();
+        }
+    }
+
+    private void setSignStatus(String result) {
         this.signStatus = result;
         int textColor = getResources().getColor(com.cooleshow.base.R.color.color_666666);
         String text = "";
+        removeCallBack();
         if (TextUtils.equals(result, TeacherInfoConstants.WITHDRAW_PROTOCOL_NOT_SIGN)) {
             text = "待签署";
         } else if (TextUtils.equals(result, TeacherInfoConstants.WITHDRAW_PROTOCOL_DOING)) {
             text = "签署中";
+            ThreadUtils.getMainHandler().postDelayed(mRunnable, REFRESH_TIME);
         } else if (TextUtils.equals(result, TeacherInfoConstants.WITHDRAW_PROTOCOL_SUCCESS)) {
             text = "已签署";
             textColor = getResources().getColor(com.cooleshow.base.R.color.color_2dc7aa);
         }
         viewBinding.tvSignStatus.setText(text);
         viewBinding.tvSignStatus.setTextColor(textColor);
-        presenter.getWithdrawalInfo();
+    }
+
+    private void removeCallBack() {
+        ThreadUtils.getMainHandler().removeCallbacks(mRunnable);
     }
 
     private String getBankNum(String num) {
@@ -318,4 +340,10 @@ public class WithdrawalActivity extends BaseMVPActivity<ActivityWithdrawalBindin
         }
         return "";
     }
+
+    @Override
+    public void onDestroy() {
+        removeCallBack();
+        super.onDestroy();
+    }
 }