Browse Source

修改老师端结算流程

Pq 1 year ago
parent
commit
865863f156

+ 6 - 0
BaseLibrary/src/main/java/com/cooleshow/base/widgets/dialog/CommonDialog.java

@@ -70,6 +70,12 @@ public class CommonDialog extends Dialog {
         }
     }
 
+    public void setConfirmText(String text){
+        if (mBtnCommit != null) {
+            mBtnCommit.setText(text);
+        }
+    }
+
     public TextView getConfirmText() {
         if (mBtnCommit != null) {
             return mBtnCommit;

+ 2 - 2
teacher/src/main/java/com/cooleshow/teacher/api/APIService.java

@@ -579,8 +579,8 @@ public interface APIService {
      *
      * @return
      */
-    @GET(TEACHER_GROUP + "sysUserContractRecord/checkContractSign")
-    Observable<BaseResponse<Boolean>> checkContractSign(@Query("contractType") String contractType);
+    @GET(TEACHER_GROUP + "sysUserContractRecord/checkContractSignV2")
+    Observable<BaseResponse<String>> checkContractSign(@Query("contractType") String contractType);
 
     /**
      * 发起结算

+ 3 - 0
teacher/src/main/java/com/cooleshow/teacher/constants/TeacherInfoConstants.java

@@ -13,6 +13,9 @@ public class TeacherInfoConstants {
     public static final String MUSICIAN_STATUS_DOING = "DOING";//音乐人认证状态->申请中
     public static final String MUSICIAN_STATUS_PASS = "PASS";//音乐人认证状态->申请通过
     public static final String MUSICIAN_STATUS_UNPASS = "UNPASS";//音乐人认证状态->申请未通过
+    public static final String WITHDRAW_PROTOCOL_NOT_SIGN = "NOT_SIGN";//提现协议未签署
+    public static final String WITHDRAW_PROTOCOL_DOING = "DOING";//提现协议签署中
+    public static final String WITHDRAW_PROTOCOL_SUCCESS = "SUCCESS";//提现协议签署成功
 
 
 }

+ 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(boolean result);
+        void checkContractSignResult(String result);
     }
 
     interface Presenter {

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

@@ -69,9 +69,9 @@ public class WithdrawalPresenter extends BasePresenter<WithdrawalContract.Withdr
             getView().showLoading();
         }
         String contractType = "WITHDRAW";
-        addSubscribe(create(APIService.class).checkContractSign(contractType), new BaseObserver<Boolean>(getView()) {
+        addSubscribe(create(APIService.class).checkContractSign(contractType), new BaseObserver<String>(getView()) {
             @Override
-            protected void onSuccess(Boolean data) {
+            protected void onSuccess(String data) {
                 if (getView() != null) {
                     getView().checkContractSignResult(data);
                 }

+ 89 - 59
teacher/src/main/java/com/cooleshow/teacher/ui/income/WithdrawalActivity.java

@@ -19,6 +19,7 @@ import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.base.widgets.dialog.CommonDialog;
 import com.cooleshow.teacher.R;
 import com.cooleshow.teacher.bean.WithdrawalInfoBean;
+import com.cooleshow.teacher.constants.TeacherInfoConstants;
 import com.cooleshow.teacher.contract.WithdrawalContract;
 import com.cooleshow.teacher.databinding.ActivityWithdrawalBinding;
 import com.cooleshow.teacher.presenter.income.WithdrawalPresenter;
@@ -35,41 +36,47 @@ import java.text.DecimalFormat;
 @Route(path = RouterPath.IncomeCenter.TEACHER_MINE_WITHDRAWAL)
 public class WithdrawalActivity extends BaseMVPActivity<ActivityWithdrawalBinding, WithdrawalPresenter> implements WithdrawalContract.WithdrawalView, View.OnClickListener {
 
-    private CommonDialog mCommonDialog;
     private CommonDialog mProtocolTipDialog;
+    private CommonDialog bindcardTipDialog;
+
+    private String signStatus = TeacherInfoConstants.WITHDRAW_PROTOCOL_NOT_SIGN;
 
     @Override
     public void onClick(View view) {
-        switch (view.getId()) {
-            case com.cooleshow.base.R.id.tv_right_text:
-                ARouter.getInstance().build(RouterPath.IncomeCenter.TEACHER_MINE_WITHDRAWAL_RECORD)
-                        .navigation();
-                break;
-            case R.id.tv_withdrawal_all:
-                viewBinding.etPrice.setText(mWithdrawalInfo.amountWithdrawal + "");
-                break;
-            case R.id.tv_confirm_withdrawal:
-                if (mWithdrawalInfo == null) {
-                    return;
-                }
-                String amountWithdrawal = viewBinding.etPrice.getText().toString().trim();
-                if (TextUtils.isEmpty(amountWithdrawal)) {
-                    return;
-                }
-                if (Double.parseDouble(amountWithdrawal) <= mWithdrawalInfo.withdrawalServiceFee) {
-                    ToastUtil.getInstance().showShort("结算金额需要大于手续费");
-                    break;
-                }
-                if (null == mWithdrawalInfo.userBankCard) {
-                    ToastUtil.getInstance().showShort("请先绑定银行卡");
-                    ARouter.getInstance().build(RouterPath.MineCenter.MINE_MY_BANKCARD)
-                            .navigation();
-                    break;
-                }
-
+        int id = view.getId();
+        if (id == com.cooleshow.base.R.id.tv_right_text) {
+            ARouter.getInstance().build(RouterPath.IncomeCenter.TEACHER_MINE_WITHDRAWAL_RECORD)
+                    .navigation();
+        } else if (id == R.id.tv_withdrawal_all) {
+            viewBinding.etPrice.setText(mWithdrawalInfo.amountWithdrawal + "");
+        } else if (id == R.id.tv_confirm_withdrawal) {
+            if (mWithdrawalInfo == null) {
+                return;
+            }
+            if (signStatus != TeacherInfoConstants.WITHDRAW_PROTOCOL_SUCCESS) {
+                showProtocolTipDialog();
+                return;
+            }
+            if (null == mWithdrawalInfo.userBankCard) {
+                showBindCardTipDialog();
+                return;
+            }
 
-                presenter.userAccountPage(amountWithdrawal, mWithdrawalInfo.userBankCard.id + "");
-                break;
+            String amountWithdrawal = viewBinding.etPrice.getText().toString().trim();
+            if (TextUtils.isEmpty(amountWithdrawal)) {
+                return;
+            }
+            if (Double.parseDouble(amountWithdrawal) <= mWithdrawalInfo.withdrawalServiceFee) {
+                ToastUtil.getInstance().showShort("结算金额需要大于手续费");
+                return;
+            }
+            presenter.userAccountPage(amountWithdrawal, mWithdrawalInfo.userBankCard.id + "");
+        } else if (id == R.id.fl_protocol) {
+            goSignProtocol();
+            return;
+        } else if (id == R.id.tv_go_bind_bankcard) {
+            goBindCard();
+            return;
         }
     }
 
@@ -88,6 +95,8 @@ public class WithdrawalActivity extends BaseMVPActivity<ActivityWithdrawalBindin
         viewBinding.toolbarInclude.tvRightText.setOnClickListener(this);
         viewBinding.tvWithdrawalAll.setOnClickListener(this);
         viewBinding.tvConfirmWithdrawal.setOnClickListener(this);
+        viewBinding.flProtocol.setOnClickListener(this);
+        viewBinding.tvGoBindBankcard.setOnClickListener(this);
 
         viewBinding.etPrice.addTextChangedListener(new TextWatcher() {
             @Override
@@ -181,62 +190,70 @@ public class WithdrawalActivity extends BaseMVPActivity<ActivityWithdrawalBindin
             return;
         }
         mWithdrawalInfo = data;
-        viewBinding.tvAvailablePrice.setText("可结算余额 " + getTwoDecimal(data.amountWithdrawal));
+        viewBinding.tvAvailablePrice.setText("可结算余额 ¥" + getTwoDecimal(data.amountWithdrawal));
         viewBinding.tvServiceFee.setText("单次收入结算时,平台将收取" + getTwoDecimal(data.withdrawalServiceFee) + "元手续费");
         if (null != data.userBankCard) {
             viewBinding.tvBankName.setText(data.userBankCard.bankName + getBankNum(data.userBankCard.bankCard));
             viewBinding.tvTip.setVisibility(View.VISIBLE);
+            viewBinding.tvGoBindBankcard.setText("去换绑");
         } else {
             viewBinding.tvBankName.setText("您未绑定银行卡");
-            viewBinding.tvTip.setVisibility(View.INVISIBLE);
-            showNotBindBankCardTip();
+            viewBinding.tvTip.setVisibility(View.GONE);
+            viewBinding.tvGoBindBankcard.setText("去绑卡");
         }
     }
 
-    private void showNotBindBankCardTip() {
-        if (mCommonDialog == null) {
-            mCommonDialog = new CommonDialog(this);
+    private void showBindCardTipDialog() {
+        if (bindcardTipDialog == null) {
+            bindcardTipDialog = new CommonDialog(this);
         }
-        if (!mCommonDialog.isShowing()) {
-            mCommonDialog.show();
+        if (!bindcardTipDialog.isShowing()) {
+            bindcardTipDialog.show();
         }
-        mCommonDialog.setTitle("绑定银行卡");
-        mCommonDialog.setContent("您需要先绑定银行卡后才能结算");
-        mCommonDialog.setOnConfirmClickListener(new View.OnClickListener() {
+        bindcardTipDialog.setTitle("绑定银行卡");
+        bindcardTipDialog.setContent("您暂未绑定银行卡,请绑定后结算");
+        bindcardTipDialog.setConfirmText("去绑定");
+        bindcardTipDialog.setOnConfirmClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                ARouter.getInstance().build(RouterPath.MineCenter.MINE_MY_BANKCARD)
-                        .navigation();
+                goBindCard();
             }
         });
-        mCommonDialog.setOnCancelClickListener(new View.OnClickListener() {
+        bindcardTipDialog.setOnCancelClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                if (mCommonDialog != null) {
-                    mCommonDialog.dismiss();
+                if (bindcardTipDialog != null) {
+                    bindcardTipDialog.dismiss();
                 }
             }
         });
+
+    }
+
+    private void goBindCard() {
+        ARouter.getInstance().build(RouterPath.MineCenter.MINE_MY_BANKCARD)
+                .navigation();
     }
 
     private void showProtocolTipDialog() {
         if (mProtocolTipDialog == null) {
             mProtocolTipDialog = new CommonDialog(this);
-            mProtocolTipDialog.setCanceledOnTouchOutside(false);
-            mProtocolTipDialog.setCancelable(false);
+//            mProtocolTipDialog.setCanceledOnTouchOutside(false);
+//            mProtocolTipDialog.setCancelable(false);
         }
         if (!mProtocolTipDialog.isShowing()) {
             mProtocolTipDialog.show();
         }
         mProtocolTipDialog.setTitle("协议签署");
         mProtocolTipDialog.setContent("您需要先签署协议才能结算");
+        mProtocolTipDialog.setConfirmText("去签署");
         mProtocolTipDialog.setOnConfirmClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                mProtocolTipDialog.dismiss();
-                ARouter.getInstance().build(RouterPath.WebCenter.ACTIVITY_HTML)
-                        .withString(WebConstants.WEB_URL, WebConstants.PROTOCOL_SIGN_BY_TEACHER_WIYHDRAW)
-                        .navigation();
+                if (mProtocolTipDialog != null) {
+                    mProtocolTipDialog.dismiss();
+                }
+                goSignProtocol();
             }
         });
         mProtocolTipDialog.setOnCancelClickListener(new View.OnClickListener() {
@@ -245,16 +262,20 @@ public class WithdrawalActivity extends BaseMVPActivity<ActivityWithdrawalBindin
                 if (mProtocolTipDialog != null) {
                     mProtocolTipDialog.dismiss();
                 }
-                finish();
             }
         });
     }
 
+    private void goSignProtocol() {
+        ARouter.getInstance().build(RouterPath.WebCenter.ACTIVITY_HTML)
+                .withString(WebConstants.WEB_URL, WebConstants.PROTOCOL_SIGN_BY_TEACHER_WIYHDRAW)
+                .navigation();
+    }
+
     private String getTwoDecimal(double num) {
         DecimalFormat df = new DecimalFormat("#,##0.00");
         String str = df.format(num);
         return str;
-
     }
 
     @Override
@@ -265,15 +286,24 @@ public class WithdrawalActivity extends BaseMVPActivity<ActivityWithdrawalBindin
     }
 
     @Override
-    public void checkContractSignResult(boolean result) {
+    public void checkContractSignResult(String result) {
         if (!checkActivityExist()) {
             return;
         }
-        if (result) {
-            presenter.getWithdrawalInfo();
-        } else {
-            showProtocolTipDialog();
+        this.signStatus = result;
+        int textColor = getResources().getColor(com.cooleshow.base.R.color.color_666666);
+        String text = "";
+        if (TextUtils.equals(result, TeacherInfoConstants.WITHDRAW_PROTOCOL_NOT_SIGN)) {
+            text = "待签署";
+        } else if (TextUtils.equals(result, TeacherInfoConstants.WITHDRAW_PROTOCOL_DOING)) {
+            text = "签署中";
+        } 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 String getBankNum(String num) {

BIN
teacher/src/main/res/drawable-xhdpi/icon_protocol_tip_tag.png


BIN
teacher/src/main/res/drawable-xxhdpi/icon_protocol_tip_tag.png


+ 81 - 5
teacher/src/main/res/layout/activity_withdrawal.xml

@@ -4,18 +4,76 @@
     xmlns:tool="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    xmlns:tools="http://schemas.android.com/tools"
     android:orientation="vertical">
 
     <include
         android:id="@+id/toolbar_include"
         layout="@layout/common_toolbar_layout" />
 
+    <LinearLayout
+        android:layout_marginStart="14dp"
+        android:layout_marginTop="13dp"
+        android:layout_marginEnd="14dp"
+        android:background="@drawable/bg_white_10dp"
+        android:id="@+id/ll_tip"
+        android:minHeight="36dp"
+        android:paddingStart="12dp"
+        android:paddingEnd="12dp"
+        android:gravity="center_vertical"
+        android:orientation="horizontal"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+        <ImageView
+            android:src="@drawable/icon_protocol_tip_tag"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+
+        <TextView
+            android:layout_marginStart="6dp"
+            android:textColor="@color/color_ff9e5a"
+            android:textSize="@dimen/sp_14"
+            android:text="@string/withdraw_protocol_tip"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+    </LinearLayout>
+
+    <FrameLayout
+        android:id="@+id/fl_protocol"
+        android:paddingEnd="12dp"
+        android:paddingStart="12dp"
+        android:layout_marginStart="14dp"
+        android:layout_marginTop="12dp"
+        android:layout_marginEnd="14dp"
+        android:background="@drawable/bg_white_10dp"
+        android:layout_width="match_parent"
+        android:layout_height="46dp">
+        <TextView
+            android:layout_gravity="center_vertical"
+            android:textColor="@color/color_777777"
+            android:textSize="@dimen/sp_16"
+            android:text="结算协议"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+
+        <TextView
+            android:textStyle="bold"
+            android:id="@+id/tv_sign_status"
+            android:layout_gravity="center_vertical|end"
+            android:textColor="@color/color_777777"
+            android:textSize="@dimen/sp_16"
+            tools:text="待签署"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+    </FrameLayout>
+
     <androidx.constraintlayout.widget.ConstraintLayout
         android:layout_width="match_parent"
-        android:layout_height="@dimen/dp_117"
+        android:layout_height="wrap_content"
         android:layout_marginStart="14dp"
-        android:layout_marginTop="15dp"
+        android:layout_marginTop="12dp"
         android:layout_marginEnd="14dp"
+        android:paddingBottom="20dp"
         android:background="@drawable/bg_white_10dp">
 
         <TextView
@@ -30,6 +88,7 @@
             app:layout_constraintTop_toTopOf="parent" />
 
         <ImageView
+            android:id="@+id/iv_bankcard_tag"
             android:layout_width="@dimen/dp_30"
             android:layout_height="@dimen/dp_30"
             android:layout_marginLeft="10dp"
@@ -39,19 +98,21 @@
             app:layout_constraintTop_toTopOf="parent" />
 
         <TextView
+            app:layout_constraintRight_toLeftOf="@+id/tv_go_bind_bankcard"
             android:id="@+id/tv_bank_name"
-            android:layout_width="wrap_content"
+            android:layout_width="0dp"
             android:layout_height="wrap_content"
             android:layout_marginLeft="47dp"
-            android:layout_marginTop="51dp"
             android:text="银行卡号"
             android:textColor="@color/black"
             android:textSize="@dimen/sp_16"
+            app:layout_constraintBottom_toBottomOf="@+id/iv_bankcard_tag"
             app:layout_constraintLeft_toLeftOf="parent"
-            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintTop_toTopOf="@+id/iv_bankcard_tag"
             tool:text="中国工商银行储蓄卡(****1917)" />
 
         <TextView
+            android:visibility="gone"
             android:id="@+id/tv_tip"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -61,6 +122,20 @@
             android:textSize="@dimen/sp_14"
             app:layout_constraintLeft_toLeftOf="@+id/tv_bank_name"
             app:layout_constraintTop_toBottomOf="@+id/tv_bank_name" />
+        
+        
+        <TextView
+            android:id="@+id/tv_go_bind_bankcard"
+            android:layout_marginEnd="12dp"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintBottom_toBottomOf="@+id/iv_bankcard_tag"
+            app:layout_constraintTop_toTopOf="@+id/iv_bankcard_tag"
+            android:background="@drawable/shape_2dc7aa_14dp"
+            android:gravity="center"
+            android:textColor="@color/white"
+            android:text="去绑卡"
+            android:layout_width="64dp"
+            android:layout_height="28dp"/>
 
     </androidx.constraintlayout.widget.ConstraintLayout>
 
@@ -139,6 +214,7 @@
             tool:text="可结算余额 ¥400.00" />
 
         <TextView
+            android:textStyle="bold"
             android:id="@+id/tv_withdrawal_all"
             android:layout_width="wrap_content"
             android:layout_height="@dimen/dp_43"

+ 1 - 0
teacher/src/main/res/values/strings.xml

@@ -50,5 +50,6 @@
     <string name="no_bind_bank_card_tip">未绑定</string>
     <string name="home_page_empty_tip">还没有内容,请「编辑」</string>
     <string name="custom_service_tip">或通过以下方式联系我们:\n客服电话:%s\n邮箱:%s</string>
+    <string name="withdraw_protocol_tip">结算前需签署《结算协议》和绑定银行卡</string>
 
 </resources>