Commit 789188ba authored by yinjiacheng's avatar yinjiacheng

update 生活号类型判断统一使用tag

parent 0b2e4617
...@@ -6,10 +6,10 @@ import android.view.ViewGroup ...@@ -6,10 +6,10 @@ import android.view.ViewGroup
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.yidian.bcommon.bean.LifeAccountItemBean
import com.yidian.shenghuoquan.bmanagercenter.R import com.yidian.shenghuoquan.bmanagercenter.R
import com.yidian.shenghuoquan.bmanagercenter.constant.Constant
import com.yidian.shenghuoquan.bmanagercenter.databinding.ItemMerchantSwitchBinding import com.yidian.shenghuoquan.bmanagercenter.databinding.ItemMerchantSwitchBinding
import com.yidian.bcommon.bean.LifeAccountItemBean import com.yidian.shenghuoquan.bmanagercenter.manager.LifeAccountManager
/** /**
* author: yinjiacheng * author: yinjiacheng
...@@ -41,37 +41,31 @@ class MerchantSwitchAdapter( ...@@ -41,37 +41,31 @@ class MerchantSwitchAdapter(
val data = data[position] as LifeAccountItemBean.Response val data = data[position] as LifeAccountItemBean.Response
holder.viewBinding.tvLifeAccountName.text = data.life_account_name holder.viewBinding.tvLifeAccountName.text = data.life_account_name
holder.viewBinding.tvLifeAccountStatus.apply { holder.viewBinding.tvLifeAccountStatus.apply {
when (data.life_account_auth_status) { text = data.tag.tag_text
Constant.STATUS_AUTH_NOT -> { when (LifeAccountManager.getLifeAccountType(data.tag.tag_key)) {
// 未认证 LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_COMMON_ENTERPRISE_AUTH, LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_INDIVIDUAL_BUSINESS_AUTH, LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_PERSONAL_AUTH -> {
setBackgroundResource(R.drawable.shape_life_account_status_unauth) // 个体工商户、普通企业、个人
setTextColor(ContextCompat.getColor(context, R.color.color_333333))
text = resources.getString(R.string.not_auth)
}
Constant.STATUS_AUTH_FINISH -> {
// 已认证
setBackgroundResource(R.drawable.shape_life_account_status_auth) setBackgroundResource(R.drawable.shape_life_account_status_auth)
setTextColor(ContextCompat.getColor(context, R.color.color_FF1852F1)) setTextColor(ContextCompat.getColor(context, R.color.color_FF1852F1))
text = when (data.tag.tag_key) {
Constant.LIFE_ACCOUNT_TAG_COMMON_ENTERPRISE_AUTH -> resources.getString(R.string.common_enterprise)
Constant.LIFE_ACCOUNT_TAG_INDIVIDUAL_BUSINESS_AUTH -> resources.getString(R.string.individual_business)
Constant.LIFE_ACCOUNT_TAG_PERSONAL_AUTH -> resources.getString(R.string.personal_auth)
else -> ""
}
} }
LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_NOT_AUTH -> {
// 未认证
setBackgroundResource(R.drawable.shape_life_account_status_unauth)
setTextColor(ContextCompat.getColor(context, R.color.color_333333))
} }
when (data.enterprise_audit_status) { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUDIT_UNDER -> {
Constant.STATUS_AUDIT_UNDER -> {
// 审核中 // 审核中
setBackgroundResource(R.drawable.shape_life_account_status_audit) setBackgroundResource(R.drawable.shape_life_account_status_audit)
setTextColor(ContextCompat.getColor(context, R.color.color_FFF26E3D)) setTextColor(ContextCompat.getColor(context, R.color.color_FFF26E3D))
text = resources.getString(R.string.under_audit)
} }
Constant.STATUS_AUDIT_REJECT -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUTH_REJECT -> {
// 审核驳回 // 审核驳回
setBackgroundResource(R.drawable.shape_life_account_status_reject) setBackgroundResource(R.drawable.shape_life_account_status_reject)
setTextColor(ContextCompat.getColor(context, R.color.color_FFFF3A3A)) setTextColor(ContextCompat.getColor(context, R.color.color_FFFF3A3A))
text = resources.getString(R.string.auth_reject) }
else -> {
setBackgroundResource(R.drawable.shape_life_account_status_auth)
setTextColor(ContextCompat.getColor(context, R.color.color_FF1852F1))
} }
} }
} }
......
...@@ -6,7 +6,7 @@ import com.yidian.bcommon.constant.XBirdPageConstants ...@@ -6,7 +6,7 @@ import com.yidian.bcommon.constant.XBirdPageConstants
import com.yidian.bcommon.constant.XRouterPathConstants import com.yidian.bcommon.constant.XRouterPathConstants
import com.yidian.bcommon.http.bean.GetCommonConfigBean import com.yidian.bcommon.http.bean.GetCommonConfigBean
import com.yidian.bcommon.sdk.ClientType import com.yidian.bcommon.sdk.ClientType
import com.yidian.shenghuoquan.bmanagercenter.constant.Constant import com.yidian.shenghuoquan.bmanagercenter.manager.LifeAccountManager
import com.yidian.shenghuoquan.bmanagercenter.ui.center.MerchantAuthManagementActivity import com.yidian.shenghuoquan.bmanagercenter.ui.center.MerchantAuthManagementActivity
/** /**
...@@ -108,27 +108,16 @@ object ManagerCenterConfig { ...@@ -108,27 +108,16 @@ object ManagerCenterConfig {
* 对应生活号权限下的功能集 * 对应生活号权限下的功能集
* 不在功能集中即为仅展示 * 不在功能集中即为仅展示
*/ */
fun getFunctionPermissionMap(data: List<GetCommonConfigBean.Item>, lifeAccountLabel: Int, client: ClientType): ArrayList<Int>? { fun getFunctionPermissionMap(
data: List<GetCommonConfigBean.Item>,
lifeAccountType: LifeAccountManager.LifeAccountType,
client: ClientType
): ArrayList<Int>? {
if (data.isEmpty()) return null if (data.isEmpty()) return null
when (client) { when (client) {
ClientType.MERCHANT_B -> { ClientType.MERCHANT_B -> {
when (lifeAccountLabel) { when (lifeAccountType) {
Constant.LIFE_ACCOUNT_TAG_ENTERPRISE_AUTH -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_COMMON_ENTERPRISE_AUTH -> {
// 企业认证
// 所有服务都可用
return arrayListOf(
data[0].functions[0].functionId,
data[0].functions[1].functionId,
data[1].functions[0].functionId,
data[1].functions[1].functionId,
data[2].functions[0].functionId,
data[2].functions[1].functionId,
data[2].functions[2].functionId,
data[2].functions[3].functionId,
data[2].functions[4].functionId
)
}
Constant.LIFE_ACCOUNT_TAG_COMMON_ENTERPRISE_AUTH -> {
// 普通企业认证 // 普通企业认证
// 所有服务都可用 // 所有服务都可用
return arrayListOf( return arrayListOf(
...@@ -143,7 +132,7 @@ object ManagerCenterConfig { ...@@ -143,7 +132,7 @@ object ManagerCenterConfig {
data[2].functions[4].functionId data[2].functions[4].functionId
) )
} }
Constant.LIFE_ACCOUNT_TAG_INDIVIDUAL_BUSINESS_AUTH -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_INDIVIDUAL_BUSINESS_AUTH -> {
// 个体工商户认证 // 个体工商户认证
// 所有服务都可用 // 所有服务都可用
return arrayListOf( return arrayListOf(
...@@ -158,7 +147,7 @@ object ManagerCenterConfig { ...@@ -158,7 +147,7 @@ object ManagerCenterConfig {
data[2].functions[4].functionId data[2].functions[4].functionId
) )
} }
Constant.LIFE_ACCOUNT_TAG_PERSONAL_AUTH -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_PERSONAL_AUTH -> {
// 个人认证 // 个人认证
// 我要发布-招聘 其他服务-职位管理 其他服务-系统设置 其他服务-认证管理 // 我要发布-招聘 其他服务-职位管理 其他服务-系统设置 其他服务-认证管理
return arrayListOf( return arrayListOf(
...@@ -168,7 +157,7 @@ object ManagerCenterConfig { ...@@ -168,7 +157,7 @@ object ManagerCenterConfig {
data[2].functions[4].functionId data[2].functions[4].functionId
) )
} }
Constant.LIFE_ACCOUNT_TAG_NOT_AUTH -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_NOT_AUTH -> {
// 未认证 // 未认证
// 我要发布-招聘 其他服务-职位管理 其他服务-系统设置 其他服务-认证管理 // 我要发布-招聘 其他服务-职位管理 其他服务-系统设置 其他服务-认证管理
return arrayListOf( return arrayListOf(
...@@ -178,7 +167,7 @@ object ManagerCenterConfig { ...@@ -178,7 +167,7 @@ object ManagerCenterConfig {
data[2].functions[4].functionId data[2].functions[4].functionId
) )
} }
Constant.LIFE_ACCOUNT_TAG_AUDIT_UNDER -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUDIT_UNDER -> {
// 审核中 // 审核中
// 我要发布-招聘 其他服务-职位管理 其他服务-系统设置 其他服务-认证管理 // 我要发布-招聘 其他服务-职位管理 其他服务-系统设置 其他服务-认证管理
return arrayListOf( return arrayListOf(
...@@ -188,7 +177,7 @@ object ManagerCenterConfig { ...@@ -188,7 +177,7 @@ object ManagerCenterConfig {
data[2].functions[4].functionId data[2].functions[4].functionId
) )
} }
Constant.LIFE_ACCOUNT_TAG_AUTH_REJECT -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUTH_REJECT -> {
// 认证驳回 // 认证驳回
// 我要发布-招聘 其他服务-职位管理 其他服务-系统设置 其他服务-认证管理 // 我要发布-招聘 其他服务-职位管理 其他服务-系统设置 其他服务-认证管理
return arrayListOf( return arrayListOf(
...@@ -201,23 +190,8 @@ object ManagerCenterConfig { ...@@ -201,23 +190,8 @@ object ManagerCenterConfig {
} }
} }
ClientType.MERCHANT_C -> { ClientType.MERCHANT_C -> {
when (lifeAccountLabel) { when (lifeAccountType) {
Constant.LIFE_ACCOUNT_TAG_ENTERPRISE_AUTH -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_COMMON_ENTERPRISE_AUTH -> {
// 企业认证
// 所有服务都可用
return arrayListOf(
data[0].functions[0].functionId,
data[0].functions[1].functionId,
data[1].functions[0].functionId,
data[1].functions[1].functionId,
data[2].functions[0].functionId,
data[2].functions[1].functionId,
data[2].functions[2].functionId,
data[2].functions[3].functionId,
data[2].functions[4].functionId
)
}
Constant.LIFE_ACCOUNT_TAG_COMMON_ENTERPRISE_AUTH -> {
// 普通企业认证 // 普通企业认证
// 所有服务都可用 // 所有服务都可用
return arrayListOf( return arrayListOf(
...@@ -232,7 +206,7 @@ object ManagerCenterConfig { ...@@ -232,7 +206,7 @@ object ManagerCenterConfig {
data[2].functions[4].functionId data[2].functions[4].functionId
) )
} }
Constant.LIFE_ACCOUNT_TAG_INDIVIDUAL_BUSINESS_AUTH -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_INDIVIDUAL_BUSINESS_AUTH -> {
// 个体工商户认证 // 个体工商户认证
// 所有服务都可用 // 所有服务都可用
return arrayListOf( return arrayListOf(
...@@ -247,7 +221,7 @@ object ManagerCenterConfig { ...@@ -247,7 +221,7 @@ object ManagerCenterConfig {
data[2].functions[4].functionId data[2].functions[4].functionId
) )
} }
Constant.LIFE_ACCOUNT_TAG_PERSONAL_AUTH -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_PERSONAL_AUTH -> {
// 个人认证 // 个人认证
// 我要发布-招聘 其他服务-职位管理 其他服务-认证管理 // 我要发布-招聘 其他服务-职位管理 其他服务-认证管理
return arrayListOf( return arrayListOf(
...@@ -256,7 +230,7 @@ object ManagerCenterConfig { ...@@ -256,7 +230,7 @@ object ManagerCenterConfig {
data[2].functions[4].functionId data[2].functions[4].functionId
) )
} }
Constant.LIFE_ACCOUNT_TAG_NOT_AUTH -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_NOT_AUTH -> {
// 未认证 // 未认证
// 我要发布-招聘 其他服务-职位管理 其他服务-认证管理 // 我要发布-招聘 其他服务-职位管理 其他服务-认证管理
return arrayListOf( return arrayListOf(
...@@ -265,7 +239,7 @@ object ManagerCenterConfig { ...@@ -265,7 +239,7 @@ object ManagerCenterConfig {
data[2].functions[4].functionId data[2].functions[4].functionId
) )
} }
Constant.LIFE_ACCOUNT_TAG_AUDIT_UNDER -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUDIT_UNDER -> {
// 审核中 // 审核中
// 我要发布-招聘 其他服务-职位管理 其他服务-认证管理 // 我要发布-招聘 其他服务-职位管理 其他服务-认证管理
return arrayListOf( return arrayListOf(
...@@ -274,7 +248,7 @@ object ManagerCenterConfig { ...@@ -274,7 +248,7 @@ object ManagerCenterConfig {
data[2].functions[4].functionId data[2].functions[4].functionId
) )
} }
Constant.LIFE_ACCOUNT_TAG_AUTH_REJECT -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUTH_REJECT -> {
// 认证驳回 // 认证驳回
// 我要发布-招聘 其他服务-职位管理 其他服务-认证管理 // 我要发布-招聘 其他服务-职位管理 其他服务-认证管理
return arrayListOf( return arrayListOf(
......
package com.yidian.shenghuoquan.bmanagercenter.manager
import com.yidian.shenghuoquan.bmanagercenter.constant.Constant
/**
* author: yinjiacheng
* date: 8/5/21 6:40 PM
* description: 生活号管理
*/
object LifeAccountManager {
/**
* 获取生活号类型 by tag
* e.g. 未认证、个人认证、个体工商户认证、普通企业认证、认证审核、认证驳回
*/
fun getLifeAccountType(tagKey: Int?): LifeAccountType {
return when (tagKey) {
Constant.LIFE_ACCOUNT_TAG_COMMON_ENTERPRISE_AUTH -> LifeAccountType.LIFE_ACCOUNT_COMMON_ENTERPRISE_AUTH
Constant.LIFE_ACCOUNT_TAG_INDIVIDUAL_BUSINESS_AUTH -> LifeAccountType.LIFE_ACCOUNT_INDIVIDUAL_BUSINESS_AUTH
Constant.LIFE_ACCOUNT_TAG_PERSONAL_AUTH -> LifeAccountType.LIFE_ACCOUNT_PERSONAL_AUTH
Constant.LIFE_ACCOUNT_TAG_NOT_AUTH -> LifeAccountType.LIFE_ACCOUNT_NOT_AUTH
Constant.LIFE_ACCOUNT_TAG_AUDIT_UNDER -> LifeAccountType.LIFE_ACCOUNT_AUDIT_UNDER
Constant.LIFE_ACCOUNT_TAG_AUTH_REJECT -> LifeAccountType.LIFE_ACCOUNT_AUTH_REJECT
else -> LifeAccountType.LIFE_ACCOUNT_DEFAULT
}
}
/**
* 生活号类型
* @param tagKey 唯一标识
* @param tagText 名称
*/
enum class LifeAccountType(private val tagKey: Int, private val tagText: String) {
LIFE_ACCOUNT_DEFAULT(-1, ""),
LIFE_ACCOUNT_COMMON_ENTERPRISE_AUTH(1, "普通企业"),
LIFE_ACCOUNT_INDIVIDUAL_BUSINESS_AUTH(2, "个体工商户"),
LIFE_ACCOUNT_PERSONAL_AUTH(3, "个人认证"),
LIFE_ACCOUNT_NOT_AUTH(4, "未认证"),
LIFE_ACCOUNT_AUDIT_UNDER(5, "审核中"),
LIFE_ACCOUNT_AUTH_REJECT(6, "认证驳回")
}
}
...@@ -3,12 +3,12 @@ package com.yidian.shenghuoquan.bmanagercenter.ui.center ...@@ -3,12 +3,12 @@ package com.yidian.shenghuoquan.bmanagercenter.ui.center
import android.os.Bundle import android.os.Bundle
import androidx.core.view.isVisible import androidx.core.view.isVisible
import com.orhanobut.hawk.Hawk import com.orhanobut.hawk.Hawk
import com.yidian.bcommon.base.BaseActivity
import com.yidian.bcommon.constant.HawkConfig import com.yidian.bcommon.constant.HawkConfig
import com.yidian.bcommon.constant.XRouterPathConstants import com.yidian.bcommon.constant.XRouterPathConstants
import com.yidian.bcommon.base.BaseActivity
import com.yidian.shenghuoquan.bmanagercenter.constant.Constant
import com.yidian.shenghuoquan.bmanagercenter.databinding.ActivityMerchantAuthInfoBinding import com.yidian.shenghuoquan.bmanagercenter.databinding.ActivityMerchantAuthInfoBinding
import com.yidian.shenghuoquan.bmanagercenter.http.httpbean.GetLifeAccountInfoByIdBean import com.yidian.shenghuoquan.bmanagercenter.http.httpbean.GetLifeAccountInfoByIdBean
import com.yidian.shenghuoquan.bmanagercenter.manager.LifeAccountManager
/** /**
* author: yinjiacheng * author: yinjiacheng
...@@ -46,42 +46,42 @@ class MerchantAuthInfoActivity : BaseActivity<ActivityMerchantAuthInfoBinding>() ...@@ -46,42 +46,42 @@ class MerchantAuthInfoActivity : BaseActivity<ActivityMerchantAuthInfoBinding>()
} }
private fun initData() { private fun initData() {
when (lifeAccountInfo?.id_type) { when (LifeAccountManager.getLifeAccountType(lifeAccountInfo?.tag?.tag_key)) {
Constant.TYPE_AUTH_PERSONAL -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_COMMON_ENTERPRISE_AUTH -> {
// 个人认证 // 普通企业认证
viewBind.ivPersonAuthInfo.isVisible = true
viewBind.ivPersonAuthInfo.fillAuthInfo(
lifeAccountInfo?.life_account_name,
lifeAccountInfo?.occupation,
lifeAccountInfo?.legal_person,
lifeAccountInfo?.id_card,
Hawk.get(HawkConfig.Mobile)
)
}
Constant.TYPE_AUTH_INDIVIDUAL_BUSINESS -> {
// 个人工商户认证
viewBind.ivEnterpriseAuthInfo.isVisible = true viewBind.ivEnterpriseAuthInfo.isVisible = true
viewBind.ivEnterpriseAuthInfo.fillAuthInfo( viewBind.ivEnterpriseAuthInfo.fillAuthInfo(
lifeAccountInfo?.tag?.tag_key,
lifeAccountInfo?.id_type, lifeAccountInfo?.id_type,
lifeAccountInfo?.audit_status,
lifeAccountInfo?.name, lifeAccountInfo?.name,
lifeAccountInfo?.code, lifeAccountInfo?.code,
lifeAccountInfo?.legal_person, lifeAccountInfo?.legal_person,
lifeAccountInfo?.id_card lifeAccountInfo?.id_card
) )
} }
Constant.TYPE_AUTH_COMMON_ENTERPRISE -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_INDIVIDUAL_BUSINESS_AUTH -> {
// 普通企业认证 // 个人工商户认证
viewBind.ivEnterpriseAuthInfo.isVisible = true viewBind.ivEnterpriseAuthInfo.isVisible = true
viewBind.ivEnterpriseAuthInfo.fillAuthInfo( viewBind.ivEnterpriseAuthInfo.fillAuthInfo(
lifeAccountInfo?.tag?.tag_key,
lifeAccountInfo?.id_type, lifeAccountInfo?.id_type,
lifeAccountInfo?.audit_status,
lifeAccountInfo?.name, lifeAccountInfo?.name,
lifeAccountInfo?.code, lifeAccountInfo?.code,
lifeAccountInfo?.legal_person, lifeAccountInfo?.legal_person,
lifeAccountInfo?.id_card lifeAccountInfo?.id_card
) )
} }
LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_PERSONAL_AUTH -> {
// 个人认证
viewBind.ivPersonAuthInfo.isVisible = true
viewBind.ivPersonAuthInfo.fillAuthInfo(
lifeAccountInfo?.life_account_name,
lifeAccountInfo?.occupation,
lifeAccountInfo?.legal_person,
lifeAccountInfo?.id_card,
Hawk.get(HawkConfig.Mobile)
)
}
} }
} }
} }
...@@ -29,6 +29,7 @@ import com.yidian.shenghuoquan.bmanagercenter.databinding.ActivityMerchantCenter ...@@ -29,6 +29,7 @@ import com.yidian.shenghuoquan.bmanagercenter.databinding.ActivityMerchantCenter
import com.yidian.shenghuoquan.bmanagercenter.http.ApiService import com.yidian.shenghuoquan.bmanagercenter.http.ApiService
import com.yidian.shenghuoquan.bmanagercenter.http.callback.* import com.yidian.shenghuoquan.bmanagercenter.http.callback.*
import com.yidian.shenghuoquan.bmanagercenter.http.httpbean.AuthMerchantCheckBean import com.yidian.shenghuoquan.bmanagercenter.http.httpbean.AuthMerchantCheckBean
import com.yidian.shenghuoquan.bmanagercenter.manager.LifeAccountManager
import com.yidian.shenghuoquan.bmanagercenter.ui.auth.LifeAccountAuthActivity import com.yidian.shenghuoquan.bmanagercenter.ui.auth.LifeAccountAuthActivity
import com.yidian.shenghuoquan.bmanagercenter.ui.auth.LifeAccountEnterpriseAuthActivity import com.yidian.shenghuoquan.bmanagercenter.ui.auth.LifeAccountEnterpriseAuthActivity
import com.yidian.shenghuoquan.bmanagercenter.ui.dialog.MerchantCenterBottomHintDialog import com.yidian.shenghuoquan.bmanagercenter.ui.dialog.MerchantCenterBottomHintDialog
...@@ -168,7 +169,7 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me ...@@ -168,7 +169,7 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me
// 生成当前生活号状态下的功能集 // 生成当前生活号状态下的功能集
ManagerCenterConfig.getFunctionPermissionMap( ManagerCenterConfig.getFunctionPermissionMap(
configData.merchantManagerCenter.items, configData.merchantManagerCenter.items,
getCurLifeAccountLabel(), LifeAccountManager.getLifeAccountType(curLifeAccount?.tag?.tag_key),
JudgeClientUtils.judgeClient(packageName) JudgeClientUtils.judgeClient(packageName)
)?.let { functionPermissionList = it } )?.let { functionPermissionList = it }
// 过滤商户服务数据 // 过滤商户服务数据
...@@ -181,21 +182,24 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me ...@@ -181,21 +182,24 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me
* @param data 当前生活号数据 * @param data 当前生活号数据
*/ */
private fun showMerchantCenterBottomHint(data: LifeAccountItemBean.Response) { private fun showMerchantCenterBottomHint(data: LifeAccountItemBean.Response) {
if (data.life_account_auth_status == Constant.STATUS_AUTH_NOT && data.enterprise_auth_record_id == 0) { when (LifeAccountManager.getLifeAccountType(data.tag.tag_key)) {
LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_NOT_AUTH ->
// 当前是个人未认证生活号 提示认证升级 // 当前是个人未认证生活号 提示认证升级
MerchantCenterBottomHintDialog( MerchantCenterBottomHintDialog(
this, this,
MerchantCenterBottomHintDialog.TYPE_AUTH_UPGRADE, this MerchantCenterBottomHintDialog.TYPE_AUTH_UPGRADE, this
).show() ).show()
} LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUTH_REJECT ->
if (data.enterprise_audit_status == Constant.STATUS_AUDIT_REJECT && data.role_type != Constant.TYPE_ROLE_ORDINARY) {
// 当前企业认证驳回 提示修改 // 当前企业认证驳回 提示修改
if (data.role_type != Constant.TYPE_ROLE_ORDINARY) {
// 企业员工不显示
MerchantCenterBottomHintDialog( MerchantCenterBottomHintDialog(
this, this,
MerchantCenterBottomHintDialog.TYPE_AUTH_REJECT, this MerchantCenterBottomHintDialog.TYPE_AUTH_REJECT, this
).show() ).show()
} }
} }
}
/** /**
* 过滤商户服务数据 * 过滤商户服务数据
...@@ -208,7 +212,9 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me ...@@ -208,7 +212,9 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me
val group = next() val group = next()
if (group.groupId == Constant.MERCHANT_SERVICE_GROUP_MANAGEMENT) { if (group.groupId == Constant.MERCHANT_SERVICE_GROUP_MANAGEMENT) {
// 个人认证或企业员工不展示管理服务 // 个人认证或企业员工不展示管理服务
if (getCurLifeAccountLabel() == Constant.LIFE_ACCOUNT_TAG_PERSONAL_AUTH || curLifeAccount?.role_type == Constant.TYPE_ROLE_ORDINARY) { if (LifeAccountManager.getLifeAccountType(curLifeAccount?.tag?.tag_key) == LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_PERSONAL_AUTH
|| curLifeAccount?.role_type == Constant.TYPE_ROLE_ORDINARY
) {
remove() remove()
} }
} }
...@@ -230,26 +236,6 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me ...@@ -230,26 +236,6 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me
(viewBind.rvServiceGroup.adapter as MerchantServiceGroupAdapter).updateData(data) (viewBind.rvServiceGroup.adapter as MerchantServiceGroupAdapter).updateData(data)
} }
/**
* 获取当前生活号标签
* 目前不支持区分个体工商户和普通企业
*/
private fun getCurLifeAccountLabel(): Int {
when (curLifeAccount?.enterprise_audit_status) {
Constant.STATUS_AUDIT_UNDER -> return Constant.LIFE_ACCOUNT_TAG_AUDIT_UNDER // 审核中
Constant.STATUS_AUDIT_REJECT -> return Constant.LIFE_ACCOUNT_TAG_AUTH_REJECT // 认证驳回
}
when (curLifeAccount?.life_account_auth_status) {
Constant.STATUS_AUTH_FINISH -> {
when (curLifeAccount?.life_account_type) {
Constant.TYPE_LIFE_ACCOUNT_PERSONAL -> return Constant.LIFE_ACCOUNT_TAG_PERSONAL_AUTH // 个人已认证
Constant.TYPE_LIFE_ACCOUNT_ENTERPRISE -> return Constant.TYPE_LIFE_ACCOUNT_ENTERPRISE // 企业已认证
}
}
}
return Constant.LIFE_ACCOUNT_TAG_NOT_AUTH // 个人未认证
}
override fun onLifeAccountSelect(data: LifeAccountItemBean.Response) { override fun onLifeAccountSelect(data: LifeAccountItemBean.Response) {
// 用户切换主体 更新当前生活号信息 // 用户切换主体 更新当前生活号信息
curLifeAccount = data curLifeAccount = data
...@@ -289,7 +275,7 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me ...@@ -289,7 +275,7 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me
Pair(LifeAccountEnterpriseAuthActivity.EXTRA_AUTH_DATA, result), Pair(LifeAccountEnterpriseAuthActivity.EXTRA_AUTH_DATA, result),
Pair( Pair(
LifeAccountEnterpriseAuthActivity.EXTRA_IS_AUTH_MODIFY, LifeAccountEnterpriseAuthActivity.EXTRA_IS_AUTH_MODIFY,
curLifeAccount?.enterprise_audit_status == Constant.STATUS_AUDIT_REJECT LifeAccountManager.getLifeAccountType(curLifeAccount?.tag?.tag_key) == LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUTH_REJECT
) )
) )
) )
...@@ -306,16 +292,15 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me ...@@ -306,16 +292,15 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me
functionPageMap[data.functionId]?.let { XPageManager.push(it, functionParamsMap[data.functionId]) } functionPageMap[data.functionId]?.let { XPageManager.push(it, functionParamsMap[data.functionId]) }
} else { } else {
// 若当前功能无权限 根据生活号类型做弹窗提示 // 若当前功能无权限 根据生活号类型做弹窗提示
if (curLifeAccount?.enterprise_audit_status == Constant.STATUS_AUDIT_UNDER) { when (LifeAccountManager.getLifeAccountType(curLifeAccount?.tag?.tag_key)) {
LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUDIT_UNDER ->
// 审核中 提示加急审核 // 审核中 提示加急审核
HintDialog( HintDialog(
this, this,
resources.getString(R.string.audit_urgent), resources.getString(R.string.audit_urgent),
arrayListOf(HintOptionBean(resources.getString(R.string.close))), null arrayListOf(HintOptionBean(resources.getString(R.string.close))), null
).setRightBtnColor(ContextCompat.getColor(this, R.color.color_FF1852F1)).show() ).setRightBtnColor(ContextCompat.getColor(this, R.color.color_FF1852F1)).show()
return LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUTH_REJECT ->
}
if (curLifeAccount?.enterprise_audit_status == Constant.STATUS_AUDIT_REJECT) {
// 审核驳回 提示修改认证 // 审核驳回 提示修改认证
HintDialog( HintDialog(
this, this,
...@@ -335,9 +320,7 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me ...@@ -335,9 +320,7 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me
} }
}).setRightBtnColor(ContextCompat.getColor(this, R.color.color_FFFF3A3A)).show() }).setRightBtnColor(ContextCompat.getColor(this, R.color.color_FFFF3A3A)).show()
return LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_NOT_AUTH ->
}
if (curLifeAccount?.life_account_type == Constant.TYPE_LIFE_ACCOUNT_PERSONAL && curLifeAccount?.life_account_auth_status == Constant.STATUS_AUTH_NOT) {
// 未认证 提示认证 此处企业审核中也满足此条件但前面审核状态判断已拦截 // 未认证 提示认证 此处企业审核中也满足此条件但前面审核状态判断已拦截
HintDialog( HintDialog(
this, this,
...@@ -360,9 +343,7 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me ...@@ -360,9 +343,7 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), Me
} }
}).setRightBtnColor(ContextCompat.getColor(this, R.color.color_FF1852F1)).show() }).setRightBtnColor(ContextCompat.getColor(this, R.color.color_FF1852F1)).show()
return LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_PERSONAL_AUTH ->
}
if (curLifeAccount?.life_account_type == Constant.TYPE_LIFE_ACCOUNT_PERSONAL) {
// 个人认证 提示认证升级 // 个人认证 提示认证升级
HintDialog( HintDialog(
this, this,
......
...@@ -15,6 +15,7 @@ import com.yidian.shenghuoquan.bmanagercenter.http.callback.IAuthMerchantCheckCa ...@@ -15,6 +15,7 @@ import com.yidian.shenghuoquan.bmanagercenter.http.callback.IAuthMerchantCheckCa
import com.yidian.shenghuoquan.bmanagercenter.http.callback.IGetLifeAccountInfoByIdCallback import com.yidian.shenghuoquan.bmanagercenter.http.callback.IGetLifeAccountInfoByIdCallback
import com.yidian.shenghuoquan.bmanagercenter.http.httpbean.AuthMerchantCheckBean import com.yidian.shenghuoquan.bmanagercenter.http.httpbean.AuthMerchantCheckBean
import com.yidian.shenghuoquan.bmanagercenter.http.httpbean.GetLifeAccountInfoByIdBean import com.yidian.shenghuoquan.bmanagercenter.http.httpbean.GetLifeAccountInfoByIdBean
import com.yidian.shenghuoquan.bmanagercenter.manager.LifeAccountManager
import com.yidian.shenghuoquan.bmanagercenter.ui.auth.LifeAccountAuthActivity import com.yidian.shenghuoquan.bmanagercenter.ui.auth.LifeAccountAuthActivity
import com.yidian.shenghuoquan.bmanagercenter.ui.auth.LifeAccountEnterpriseAuthActivity import com.yidian.shenghuoquan.bmanagercenter.ui.auth.LifeAccountEnterpriseAuthActivity
import com.yidian.shenghuoquan.bmanagercenter.widget.MerchantInfoView import com.yidian.shenghuoquan.bmanagercenter.widget.MerchantInfoView
...@@ -119,10 +120,8 @@ class MerchantInfoActivity : BaseActivity<ActivityMerchantInfoBinding>(), Mercha ...@@ -119,10 +120,8 @@ class MerchantInfoActivity : BaseActivity<ActivityMerchantInfoBinding>(), Mercha
override fun onEnterAuth(from: MerchantInfoView) { override fun onEnterAuth(from: MerchantInfoView) {
// 认证或认证升级或修改认证 // 认证或认证升级或修改认证
if (from == viewBind.ivLifeAccountAuth) { if (from == viewBind.ivLifeAccountAuth) {
if (lifeAccountInfo.life_account_type == Constant.TYPE_LIFE_ACCOUNT_PERSONAL when (LifeAccountManager.getLifeAccountType(lifeAccountInfo.tag.tag_key)) {
&& lifeAccountInfo.life_account_auth_status == Constant.STATUS_AUTH_NOT LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_NOT_AUTH ->
&& lifeAccountInfo.audit_status == 0
) {
// 未认证 进入认证流程首页 此处需要传参from控制认证流程首页返回按钮显示 // 未认证 进入认证流程首页 此处需要传参from控制认证流程首页返回按钮显示
XPageManager.push( XPageManager.push(
XRouterPathConstants.LIFE_ACCOUNT_AUTH, XRouterPathConstants.LIFE_ACCOUNT_AUTH,
...@@ -131,7 +130,7 @@ class MerchantInfoActivity : BaseActivity<ActivityMerchantInfoBinding>(), Mercha ...@@ -131,7 +130,7 @@ class MerchantInfoActivity : BaseActivity<ActivityMerchantInfoBinding>(), Mercha
IntentConstants.KEY_EXTRA_LIFE_ACCOUNT_ID to lifeAccountInfo.life_account_id IntentConstants.KEY_EXTRA_LIFE_ACCOUNT_ID to lifeAccountInfo.life_account_id
) )
) )
} else if (lifeAccountInfo.audit_status == Constant.STATUS_AUDIT_REJECT) { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUTH_REJECT ->
// 认证驳回 请求企业认证信息 此处为升级认证情况 需要传入生活号id // 认证驳回 请求企业认证信息 此处为升级认证情况 需要传入生活号id
ApiService.authMerchantCheck( ApiService.authMerchantCheck(
this, this,
...@@ -143,7 +142,6 @@ class MerchantInfoActivity : BaseActivity<ActivityMerchantInfoBinding>(), Mercha ...@@ -143,7 +142,6 @@ class MerchantInfoActivity : BaseActivity<ActivityMerchantInfoBinding>(), Mercha
ApiService.authMerchantCheck( ApiService.authMerchantCheck(
this, hashMapOf(PARAMS_LIFE_ACCOUNT_ID to lifeAccountInfo.life_account_id) this, hashMapOf(PARAMS_LIFE_ACCOUNT_ID to lifeAccountInfo.life_account_id)
) )
} }
} }
...@@ -154,7 +152,7 @@ class MerchantInfoActivity : BaseActivity<ActivityMerchantInfoBinding>(), Mercha ...@@ -154,7 +152,7 @@ class MerchantInfoActivity : BaseActivity<ActivityMerchantInfoBinding>(), Mercha
hashMapOf( hashMapOf(
LifeAccountEnterpriseAuthActivity.EXTRA_LIFE_ACCOUNT_ID to lifeAccountInfo.life_account_id, LifeAccountEnterpriseAuthActivity.EXTRA_LIFE_ACCOUNT_ID to lifeAccountInfo.life_account_id,
LifeAccountEnterpriseAuthActivity.EXTRA_AUTH_DATA to result, LifeAccountEnterpriseAuthActivity.EXTRA_AUTH_DATA to result,
LifeAccountEnterpriseAuthActivity.EXTRA_IS_AUTH_MODIFY to (lifeAccountInfo.audit_status == Constant.STATUS_AUDIT_REJECT) LifeAccountEnterpriseAuthActivity.EXTRA_IS_AUTH_MODIFY to (LifeAccountManager.getLifeAccountType(lifeAccountInfo.tag.tag_key) == LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUTH_REJECT)
) )
) )
} }
...@@ -169,47 +167,51 @@ class MerchantInfoActivity : BaseActivity<ActivityMerchantInfoBinding>(), Mercha ...@@ -169,47 +167,51 @@ class MerchantInfoActivity : BaseActivity<ActivityMerchantInfoBinding>(), Mercha
// 更新UI // 更新UI
// 生活号名称 // 生活号名称
viewBind.ivLifeAccountName.fillContent(lifeAccountInfo.life_account_name) viewBind.ivLifeAccountName.fillContent(lifeAccountInfo.life_account_name)
if (lifeAccountInfo.audit_status != Constant.STATUS_AUDIT_UNDER && lifeAccountInfo.role_type != Constant.TYPE_ROLE_ORDINARY) { if (LifeAccountManager.getLifeAccountType(lifeAccountInfo.tag.tag_key) != LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUDIT_UNDER
&& lifeAccountInfo.role_type != Constant.TYPE_ROLE_ORDINARY
) {
// 审核中和企业员工不允许修改生活号名称 // 审核中和企业员工不允许修改生活号名称
viewBind.ivLifeAccountName.showDetailEntry() viewBind.ivLifeAccountName.showDetailEntry()
} }
// 生活号认证信息 // 认证信息
// 审核状态 when (LifeAccountManager.getLifeAccountType(lifeAccountInfo.tag.tag_key)) {
if (lifeAccountInfo.audit_status == Constant.STATUS_AUDIT_REJECT) { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_COMMON_ENTERPRISE_AUTH -> {
// 认证驳回 // 普通企业认证
viewBind.ivLifeAccountAuth.fillContent(resources.getString(R.string.auth_reject)) viewBind.ivLifeAccountAuth.fillContent(resources.getString(R.string.common_enterprise))
if (lifeAccountInfo.role_type != Constant.TYPE_ROLE_ORDINARY) { if (lifeAccountInfo.role_type != Constant.TYPE_ROLE_ORDINARY) {
// 企业员工不允许修改认证信息 // 企业员工不允许查看认证信息
viewBind.ivLifeAccountAuth.showAuthEntry(MerchantInfoView.LifeAccountAuthStatus.MODIFY_AUTH) viewBind.ivLifeAccountAuth.showDetailEntry()
} }
return
}
// 认证状态
if (lifeAccountInfo.life_account_auth_status == Constant.STATUS_AUTH_NOT && lifeAccountInfo.enterprise_auth_record_id == 0) {
// 个人未认证生活号 企业审核记录id为0
viewBind.ivLifeAccountAuth.fillContent(resources.getString(R.string.not_auth))
viewBind.ivLifeAccountAuth.showAuthEntry(MerchantInfoView.LifeAccountAuthStatus.NOT_AUTH)
return
} }
LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_INDIVIDUAL_BUSINESS_AUTH -> {
// 个体工商户认证
viewBind.ivLifeAccountAuth.fillContent(resources.getString(R.string.individual_business))
if (lifeAccountInfo.role_type != Constant.TYPE_ROLE_ORDINARY) { if (lifeAccountInfo.role_type != Constant.TYPE_ROLE_ORDINARY) {
// 企业员工不允许查看认证信息 // 企业员工不允许查看认证信息
viewBind.ivLifeAccountAuth.showDetailEntry() viewBind.ivLifeAccountAuth.showDetailEntry()
} }
// 认证类型 }
when (lifeAccountInfo.id_type) { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_PERSONAL_AUTH -> {
Constant.TYPE_AUTH_PERSONAL -> {
// 个人认证 // 个人认证
viewBind.ivLifeAccountAuth.fillContent(resources.getString(R.string.personal_auth)) viewBind.ivLifeAccountAuth.fillContent(resources.getString(R.string.personal_auth))
viewBind.ivLifeAccountAuthUpgrade.isVisible = true viewBind.ivLifeAccountAuthUpgrade.isVisible = true
viewBind.ivLifeAccountAuthUpgrade.showAuthEntry(MerchantInfoView.LifeAccountAuthStatus.UPGRADE_AUTH) viewBind.ivLifeAccountAuthUpgrade.showAuthEntry(MerchantInfoView.LifeAccountAuthStatus.UPGRADE_AUTH)
} }
Constant.TYPE_AUTH_INDIVIDUAL_BUSINESS -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_NOT_AUTH -> {
// 个体工商户认证 // 未认证
viewBind.ivLifeAccountAuth.fillContent(resources.getString(R.string.individual_business)) viewBind.ivLifeAccountAuth.fillContent(resources.getString(R.string.not_auth))
viewBind.ivLifeAccountAuth.showAuthEntry(MerchantInfoView.LifeAccountAuthStatus.NOT_AUTH)
}
LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUDIT_UNDER -> {
// 审核中
}
LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUTH_REJECT -> {
// 认证驳回
viewBind.ivLifeAccountAuth.fillContent(resources.getString(R.string.auth_reject))
if (lifeAccountInfo.role_type != Constant.TYPE_ROLE_ORDINARY) {
// 企业员工不允许修改认证信息
viewBind.ivLifeAccountAuth.showAuthEntry(MerchantInfoView.LifeAccountAuthStatus.MODIFY_AUTH)
} }
Constant.TYPE_AUTH_COMMON_ENTERPRISE -> {
// 普通企业认证
viewBind.ivLifeAccountAuth.fillContent(resources.getString(R.string.common_enterprise))
} }
} }
} }
......
...@@ -5,10 +5,11 @@ import android.util.AttributeSet ...@@ -5,10 +5,11 @@ import android.util.AttributeSet
import android.view.View import android.view.View
import androidx.cardview.widget.CardView import androidx.cardview.widget.CardView
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import com.yidian.bcommon.utils.SensitiveInfoUtil
import com.yidian.shenghuoquan.bmanagercenter.R import com.yidian.shenghuoquan.bmanagercenter.R
import com.yidian.shenghuoquan.bmanagercenter.constant.Constant import com.yidian.shenghuoquan.bmanagercenter.constant.Constant
import com.yidian.shenghuoquan.bmanagercenter.databinding.ViewLifeAccountEnterpriseAuthInfoBinding import com.yidian.shenghuoquan.bmanagercenter.databinding.ViewLifeAccountEnterpriseAuthInfoBinding
import com.yidian.bcommon.utils.SensitiveInfoUtil import com.yidian.shenghuoquan.bmanagercenter.manager.LifeAccountManager
/** /**
* author: yinjiacheng * author: yinjiacheng
...@@ -33,16 +34,16 @@ class LifeAccountEnterpriseAuthInfoView @JvmOverloads constructor( ...@@ -33,16 +34,16 @@ class LifeAccountEnterpriseAuthInfoView @JvmOverloads constructor(
/** /**
* 填充认证信息 * 填充认证信息
* @param authType 认证类型 * @param tagKey 生活号tag
* @param auditStatus 审核状态 * @param authType 认证类型 e.g. 个体工商户、普通企业
* @param registrationName 公司名称 * @param registrationName 公司名称
* @param registrationCode 统一社会信用代码 * @param registrationCode 统一社会信用代码
* @param realName 经营者姓名或法人姓名 * @param realName 经营者姓名或法人姓名
* @param idCardNo 经营者身份证号或法人身份证号 * @param idCardNo 经营者身份证号或法人身份证号
*/ */
fun fillAuthInfo( fun fillAuthInfo(
tagKey: Int?,
authType: Int?, authType: Int?,
auditStatus: Int?,
registrationName: String?, registrationName: String?,
registrationCode: String?, registrationCode: String?,
realName: String?, realName: String?,
...@@ -69,14 +70,14 @@ class LifeAccountEnterpriseAuthInfoView @JvmOverloads constructor( ...@@ -69,14 +70,14 @@ class LifeAccountEnterpriseAuthInfoView @JvmOverloads constructor(
viewBinding.tvTitleManagerInfo.text = resources.getText(R.string.legal_person_info) viewBinding.tvTitleManagerInfo.text = resources.getText(R.string.legal_person_info)
} }
else -> { else -> {
// 不区分 // 企业认证提交后
viewBinding.tvAuthType.text = resources.getText(R.string.enterprise_auth) viewBinding.tvAuthType.text = resources.getText(R.string.enterprise_auth)
viewBinding.tvTitleManagerInfo.text = viewBinding.tvTitleManagerInfo.text =
resources.getText(R.string.operator_information) resources.getText(R.string.operator_information)
} }
} }
when (auditStatus) { when (LifeAccountManager.getLifeAccountType(tagKey)) {
Constant.STATUS_AUDIT_UNDER -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUDIT_UNDER -> {
// 审核中 // 审核中
viewBinding.tvAuditStatus.text = resources.getText(R.string.under_audit) viewBinding.tvAuditStatus.text = resources.getText(R.string.under_audit)
viewBinding.tvAuditStatus.setBackgroundResource(R.drawable.shape_life_account_status_audit) viewBinding.tvAuditStatus.setBackgroundResource(R.drawable.shape_life_account_status_audit)
...@@ -87,8 +88,8 @@ class LifeAccountEnterpriseAuthInfoView @JvmOverloads constructor( ...@@ -87,8 +88,8 @@ class LifeAccountEnterpriseAuthInfoView @JvmOverloads constructor(
) )
) )
} }
Constant.STATUS_AUDIT_PASS -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_COMMON_ENTERPRISE_AUTH, LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_INDIVIDUAL_BUSINESS_AUTH -> {
// 审核通过(已开通) // 个体工商户、普通企业
viewBinding.tvAuditStatus.text = resources.getText(R.string.audit_pass) viewBinding.tvAuditStatus.text = resources.getText(R.string.audit_pass)
viewBinding.tvAuditStatus.setBackgroundResource(R.drawable.shape_life_account_status_open) viewBinding.tvAuditStatus.setBackgroundResource(R.drawable.shape_life_account_status_open)
viewBinding.tvAuditStatus.setTextColor( viewBinding.tvAuditStatus.setTextColor(
...@@ -98,7 +99,7 @@ class LifeAccountEnterpriseAuthInfoView @JvmOverloads constructor( ...@@ -98,7 +99,7 @@ class LifeAccountEnterpriseAuthInfoView @JvmOverloads constructor(
) )
) )
} }
Constant.STATUS_AUDIT_REJECT -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUTH_REJECT -> {
// 审核驳回 // 审核驳回
viewBinding.tvAuditStatus.text = resources.getText(R.string.audit_reject) viewBinding.tvAuditStatus.text = resources.getText(R.string.audit_reject)
viewBinding.tvAuditStatus.setBackgroundResource(R.drawable.shape_life_account_status_reject) viewBinding.tvAuditStatus.setBackgroundResource(R.drawable.shape_life_account_status_reject)
......
...@@ -5,10 +5,10 @@ import android.util.AttributeSet ...@@ -5,10 +5,10 @@ import android.util.AttributeSet
import android.view.View import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import com.yidian.bcommon.bean.LifeAccountItemBean
import com.yidian.shenghuoquan.bmanagercenter.R import com.yidian.shenghuoquan.bmanagercenter.R
import com.yidian.shenghuoquan.bmanagercenter.constant.Constant
import com.yidian.shenghuoquan.bmanagercenter.databinding.ViewLifeAccountLabelBinding import com.yidian.shenghuoquan.bmanagercenter.databinding.ViewLifeAccountLabelBinding
import com.yidian.bcommon.bean.LifeAccountItemBean import com.yidian.shenghuoquan.bmanagercenter.manager.LifeAccountManager
/** /**
* author: yinjiacheng * author: yinjiacheng
...@@ -42,44 +42,37 @@ class LifeAccountLabelView @JvmOverloads constructor( ...@@ -42,44 +42,37 @@ class LifeAccountLabelView @JvmOverloads constructor(
/** /**
* 设置生活号信息 * 设置生活号信息
* 先判断认证状态 再判断审核状态 即审核中和审核驳回状态可覆盖认证状态
* @param data 生活号详情 * @param data 生活号详情
*/ */
fun setLifeAccountData(data: LifeAccountItemBean.Response) { fun setLifeAccountData(data: LifeAccountItemBean.Response) {
curLifeAccount = data curLifeAccount = data
viewBinding.tvLifeAccountName.text = data.life_account_name viewBinding.tvLifeAccountName.text = data.life_account_name
viewBinding.tvLifeAccountStatus.apply { viewBinding.tvLifeAccountStatus.apply {
when (data.life_account_auth_status) { text = data.tag.tag_text
Constant.STATUS_AUTH_NOT -> { when (LifeAccountManager.getLifeAccountType(data.tag.tag_key)) {
// 未认证 LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_COMMON_ENTERPRISE_AUTH, LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_INDIVIDUAL_BUSINESS_AUTH, LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_PERSONAL_AUTH -> {
setBackgroundResource(R.drawable.shape_life_account_status_unauth) // 个体工商户、普通企业、个人
setTextColor(ContextCompat.getColor(context, R.color.color_333333))
text = resources.getString(R.string.not_auth)
}
Constant.STATUS_AUTH_FINISH -> {
// 已认证
setBackgroundResource(R.drawable.shape_life_account_status_auth) setBackgroundResource(R.drawable.shape_life_account_status_auth)
setTextColor(ContextCompat.getColor(context, R.color.color_FF1852F1)) setTextColor(ContextCompat.getColor(context, R.color.color_FF1852F1))
text = when (data.tag.tag_key) {
Constant.LIFE_ACCOUNT_TAG_COMMON_ENTERPRISE_AUTH -> resources.getString(R.string.common_enterprise)
Constant.LIFE_ACCOUNT_TAG_INDIVIDUAL_BUSINESS_AUTH -> resources.getString(R.string.individual_business)
Constant.LIFE_ACCOUNT_TAG_PERSONAL_AUTH -> resources.getString(R.string.personal_auth)
else -> ""
}
} }
LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_NOT_AUTH -> {
// 未认证
setBackgroundResource(R.drawable.shape_life_account_status_unauth)
setTextColor(ContextCompat.getColor(context, R.color.color_333333))
} }
when (data.enterprise_audit_status) { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUDIT_UNDER -> {
Constant.STATUS_AUDIT_UNDER -> {
// 审核中 // 审核中
setBackgroundResource(R.drawable.shape_life_account_status_audit) setBackgroundResource(R.drawable.shape_life_account_status_audit)
setTextColor(ContextCompat.getColor(context, R.color.color_FFF26E3D)) setTextColor(ContextCompat.getColor(context, R.color.color_FFF26E3D))
text = resources.getString(R.string.under_audit)
} }
Constant.STATUS_AUDIT_REJECT -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUTH_REJECT -> {
// 审核驳回 // 审核驳回
setBackgroundResource(R.drawable.shape_life_account_status_reject) setBackgroundResource(R.drawable.shape_life_account_status_reject)
setTextColor(ContextCompat.getColor(context, R.color.color_FFFF3A3A)) setTextColor(ContextCompat.getColor(context, R.color.color_FFFF3A3A))
text = resources.getString(R.string.auth_reject) }
else -> {
setBackgroundResource(R.drawable.shape_life_account_status_auth)
setTextColor(ContextCompat.getColor(context, R.color.color_FF1852F1))
} }
} }
} }
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="@dimen/dp19" android:paddingStart="@dimen/dp19"
...@@ -21,7 +22,8 @@ ...@@ -21,7 +22,8 @@
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
tools:text="生活号名称" />
<TextView <TextView
android:id="@+id/tv_life_account_status" android:id="@+id/tv_life_account_status"
...@@ -39,7 +41,10 @@ ...@@ -39,7 +41,10 @@
android:textSize="@dimen/sp12" android:textSize="@dimen/sp12"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/tv_life_account_name" app:layout_constraintStart_toEndOf="@id/tv_life_account_name"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent"
tools:background="@drawable/shape_life_account_status_auth"
tools:text="个体工商户"
tools:textColor="@color/color_1852F1" />
<ImageView <ImageView
android:id="@+id/iv_life_account_detail" android:id="@+id/iv_life_account_detail"
......
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