Commit ffb6f400 authored by yinjiacheng's avatar yinjiacheng

update 管理中心优化提示弹窗逻辑

parent a9147c04
......@@ -5,6 +5,7 @@ import android.os.Bundle
import android.view.Gravity
import android.view.View
import android.view.WindowManager
import androidx.annotation.ColorRes
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import com.yidian.bcommon.R
......@@ -22,8 +23,8 @@ class CommonHintDialog @JvmOverloads constructor(
val content: CharSequence,
val options: ArrayList<String>,
val callback: OnHintOptionCallback?,
private val leftBtnColor: Int = R.color.color_8F000000,
private val rightBtnColor: Int = R.color.color_1852F1,
@ColorRes private val leftBtnColor: Int? = R.color.color_8F000000,
@ColorRes private val rightBtnColor: Int? = R.color.color_1852F1,
) : BaseDialog<DialogCommonHintBinding>(context), View.OnClickListener {
override fun createViewBinding(): DialogCommonHintBinding {
......@@ -37,13 +38,13 @@ class CommonHintDialog @JvmOverloads constructor(
viewBinding.btnRight.text = options[0]
viewBinding.btnLeft.isVisible = false
viewBinding.viewVerticalDivider.isVisible = false
viewBinding.btnRight.setTextColor(ContextCompat.getColor(context, rightBtnColor))
viewBinding.btnRight.setTextColor(ContextCompat.getColor(context, rightBtnColor ?: R.color.color_1852F1))
}
2 -> {
viewBinding.btnLeft.text = options[0]
viewBinding.btnRight.text = options[1]
viewBinding.btnLeft.setTextColor(ContextCompat.getColor(context, leftBtnColor))
viewBinding.btnRight.setTextColor(ContextCompat.getColor(context, rightBtnColor))
viewBinding.btnLeft.setTextColor(ContextCompat.getColor(context, leftBtnColor ?: R.color.color_8F000000))
viewBinding.btnRight.setTextColor(ContextCompat.getColor(context, rightBtnColor ?: R.color.color_1852F1))
}
}
}
......
......@@ -10,7 +10,6 @@ import com.google.gson.Gson
import com.scwang.smart.refresh.layout.api.RefreshLayout
import com.scwang.smart.refresh.layout.listener.OnRefreshListener
import com.yidian.bcommon.base.BaseActivity
import com.yidian.bcommon.bean.HintOptionBean
import com.yidian.bcommon.bean.LifeAccountItemBean
import com.yidian.bcommon.constant.*
import com.yidian.bcommon.http.bean.GetCommonConfigBean
......@@ -19,7 +18,7 @@ import com.yidian.bcommon.sdk.JudgeClientUtils
import com.yidian.bcommon.services.ZapServiceActionConstants
import com.yidian.bcommon.services.ZapServiceNameConstants
import com.yidian.bcommon.utils.StorageUtil
import com.yidian.bcommon.widget.dialog.HintDialog
import com.yidian.bcommon.widget.CommonHintDialog
import com.yidian.shenghuoquan.bmanagercenter.R
import com.yidian.shenghuoquan.bmanagercenter.adapter.MerchantServiceFunctionAdapter
import com.yidian.shenghuoquan.bmanagercenter.adapter.MerchantServiceGroupAdapter
......@@ -56,10 +55,6 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me
IAuthMerchantCheckCallback, MerchantServiceFunctionAdapter.OnItemClickListener, CommonTopBarView.OnCommonTopBarActionCallback,
OnRefreshListener, DialogInterface.OnShowListener, DialogInterface.OnDismissListener {
companion object {
const val PARAMS_LIFE_ACCOUNT_ID = "life_account_id"
}
/**
* 当前生活号
*/
......@@ -248,19 +243,13 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me
}
override fun onUpgradeAuth() {
// 由未认证升级认证 跳转认证首页
XPageManager.push(
XRouterPathConstants.LIFE_ACCOUNT_AUTH,
hashMapOf(
Pair(IntentConstants.KEY_EXTRA_LIFE_ACCOUNT_AUTH_FROM, LifeAccountAuthActivity.FROM_B_MANAGER_CENTER),
Pair(IntentConstants.KEY_EXTRA_LIFE_ACCOUNT_ID, curLifeAccount?.life_account_id)
)
)
// 未认证进行认证
startAuth()
}
override fun onModifyEnterpriseAuth() {
// 修改企业认证 先请求企业认证信息
ApiService.authMerchantCheck(this, hashMapOf(Pair(PARAMS_LIFE_ACCOUNT_ID, curLifeAccount?.life_account_id)))
// 修改认证
modifyAuth()
}
override fun authMerchantCheckSuccess(result: AuthMerchantCheckBean.Response?) {
......@@ -295,75 +284,33 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me
when (LifeAccountManager.getLifeAccountTag(curLifeAccount?.tag?.tag_key)) {
LifeAccountManager.LifeAccountTag.LIFE_ACCOUNT_TAG_AUDIT_UNDER ->
// 审核中 提示加急审核
HintDialog(
this,
showHintDialog(
resources.getString(R.string.audit_urgent),
arrayListOf(HintOptionBean(resources.getString(R.string.close))), null
).setRightBtnColor(ContextCompat.getColor(this, R.color.color_FF1852F1)).show()
arrayListOf(resources.getString(R.string.close)),
null, null, null, null
)
LifeAccountManager.LifeAccountTag.LIFE_ACCOUNT_TAG_AUTH_REJECT ->
// 审核驳回 提示修改认证
HintDialog(
this,
showHintDialog(
resources.getString(R.string.auth_apply_reject),
arrayListOf(HintOptionBean(resources.getString(R.string.close)), HintOptionBean(resources.getString(R.string.modify_auth))),
object : HintDialog.OnHintOptionCallback {
override fun onLeftOption() {
}
override fun onRightOption() {
// 认证修改 请求商户认证检查
ApiService.authMerchantCheck(
this@MerchantCenterActivity,
hashMapOf(Pair(LifeAccountEnterpriseAuthActivity.EXTRA_LIFE_ACCOUNT_ID, curLifeAccount?.life_account_id))
arrayListOf(resources.getString(R.string.close), resources.getString(R.string.modify_auth)),
null, { modifyAuth() }, null, R.color.color_FF3A3A
)
}
}).setRightBtnColor(ContextCompat.getColor(this, R.color.color_FFFF3A3A)).show()
LifeAccountManager.LifeAccountTag.LIFE_ACCOUNT_TAG_NOT_AUTH ->
// 未认证 提示认证 此处企业审核中也满足此条件但前面审核状态判断已拦截
HintDialog(
this,
// 未认证 提示认证
showHintDialog(
resources.getString(R.string.auth_to_use_more_tool),
arrayListOf(HintOptionBean(resources.getString(R.string.close)), HintOptionBean(resources.getString(R.string.goto_auth))),
object : HintDialog.OnHintOptionCallback {
override fun onLeftOption() {
}
override fun onRightOption() {
// 进行认证
XPageManager.push(
XRouterPathConstants.LIFE_ACCOUNT_AUTH,
hashMapOf(
Pair(IntentConstants.KEY_EXTRA_LIFE_ACCOUNT_AUTH_FROM, LifeAccountAuthActivity.FROM_B_MANAGER_CENTER),
Pair(IntentConstants.KEY_EXTRA_LIFE_ACCOUNT_ID, curLifeAccount?.life_account_id)
arrayListOf(resources.getString(R.string.close), resources.getString(R.string.goto_auth)),
null, { startAuth() }, null, null
)
)
}
}).setRightBtnColor(ContextCompat.getColor(this, R.color.color_FF1852F1)).show()
LifeAccountManager.LifeAccountTag.LIFE_ACCOUNT_TAG_PERSONAL_AUTH ->
// 个人认证 提示认证升级
HintDialog(
this,
showHintDialog(
resources.getString(R.string.upgrade_to_use_more_tool),
arrayListOf(HintOptionBean(resources.getString(R.string.close)), HintOptionBean(resources.getString(R.string.goto_upgrade))),
object : HintDialog.OnHintOptionCallback {
override fun onLeftOption() {
}
override fun onRightOption() {
// 认证升级 请求商户认证检查
ApiService.authMerchantCheck(
this@MerchantCenterActivity,
hashMapOf(Pair(LifeAccountEnterpriseAuthActivity.EXTRA_LIFE_ACCOUNT_ID, curLifeAccount?.life_account_id))
arrayListOf(resources.getString(R.string.close), resources.getString(R.string.goto_upgrade)),
null, { upgradeAuth() }, null, null
)
}
}).setRightBtnColor(ContextCompat.getColor(this, R.color.color_FF1852F1)).show()
}
}
}
......@@ -477,4 +424,69 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me
}
}.ship()
}
/**
* 提示弹窗
* @param content 提示内容
* @param options 操作项
* @param leftOption 左操作项函数
* @param rightOption 右操作项函数
* @param leftBtnColor 左操作按钮文字颜色
* @param rightBtnColor 右操作按钮文字颜色
*/
private fun showHintDialog(
content: String, options: ArrayList<String>,
leftOption: (() -> Unit)?, rightOption: (() -> Unit)?,
leftBtnColor: Int?, rightBtnColor: Int?
) {
CommonHintDialog(
this,
content, options,
object : CommonHintDialog.OnHintOptionCallback {
override fun onLeftOption() {
leftOption?.invoke()
}
override fun onRightOption() {
rightOption?.invoke()
}
}, leftBtnColor, rightBtnColor
).show()
}
/**
* 未认证 跳转认证首页
*/
private fun startAuth() {
XPageManager.push(
XRouterPathConstants.LIFE_ACCOUNT_AUTH,
hashMapOf(
IntentConstants.KEY_EXTRA_LIFE_ACCOUNT_AUTH_FROM to LifeAccountAuthActivity.FROM_B_MANAGER_CENTER,
IntentConstants.KEY_EXTRA_LIFE_ACCOUNT_ID to curLifeAccount?.life_account_id
)
)
}
/**
* 认证修改 跳转企业认证修改
*/
private fun modifyAuth() {
// 请求商户认证检查
ApiService.authMerchantCheck(
this,
hashMapOf(LifeAccountEnterpriseAuthActivity.EXTRA_LIFE_ACCOUNT_ID to curLifeAccount?.life_account_id)
)
}
/**
* 认证升级 跳转企业认证修改
*/
private fun upgradeAuth() {
// 请求商户认证检查
ApiService.authMerchantCheck(
this,
hashMapOf(LifeAccountEnterpriseAuthActivity.EXTRA_LIFE_ACCOUNT_ID to curLifeAccount?.life_account_id)
)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment