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
...@@ -17,9 +17,9 @@ import com.yidian.bcommon.bean.LifeAccountItemBean ...@@ -17,9 +17,9 @@ import com.yidian.bcommon.bean.LifeAccountItemBean
* description: 商户切换主体 * description: 商户切换主体
*/ */
class MerchantSwitchAdapter( class MerchantSwitchAdapter(
private val curLifeAccountId: String, private val curLifeAccountId: String,
data: List<LifeAccountItemBean.Response>? = null, data: List<LifeAccountItemBean.Response>? = null,
val listener: OnItemClickListener? = null val listener: OnItemClickListener? = null
) : ) :
RecyclerView.Adapter<MerchantSwitchAdapter.MerchantSwitchViewHolder>() { RecyclerView.Adapter<MerchantSwitchAdapter.MerchantSwitchViewHolder>() {
...@@ -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_auth)
setTextColor(ContextCompat.getColor(context, R.color.color_FF1852F1))
}
LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_NOT_AUTH -> {
// 未认证 // 未认证
setBackgroundResource(R.drawable.shape_life_account_status_unauth) setBackgroundResource(R.drawable.shape_life_account_status_unauth)
setTextColor(ContextCompat.getColor(context, R.color.color_333333)) 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)
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_AUDIT_UNDER -> {
when (data.enterprise_audit_status) {
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)
)
}
} }
} }
} }
...@@ -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,31 +120,28 @@ class MerchantInfoActivity : BaseActivity<ActivityMerchantInfoBinding>(), Mercha ...@@ -119,31 +120,28 @@ 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控制认证流程首页返回按钮显示
) { XPageManager.push(
// 未认证 进入认证流程首页 此处需要传参from控制认证流程首页返回按钮显示 XRouterPathConstants.LIFE_ACCOUNT_AUTH,
XPageManager.push( hashMapOf(
XRouterPathConstants.LIFE_ACCOUNT_AUTH, IntentConstants.KEY_EXTRA_LIFE_ACCOUNT_AUTH_FROM to LifeAccountAuthActivity.FROM_B_MANAGER_CENTER,
hashMapOf( IntentConstants.KEY_EXTRA_LIFE_ACCOUNT_ID to lifeAccountInfo.life_account_id
IntentConstants.KEY_EXTRA_LIFE_ACCOUNT_AUTH_FROM to LifeAccountAuthActivity.FROM_B_MANAGER_CENTER, )
IntentConstants.KEY_EXTRA_LIFE_ACCOUNT_ID to lifeAccountInfo.life_account_id )
LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUTH_REJECT ->
// 认证驳回 请求企业认证信息 此处为升级认证情况 需要传入生活号id
ApiService.authMerchantCheck(
this,
hashMapOf(PARAMS_LIFE_ACCOUNT_ID to lifeAccountInfo.life_account_id)
) )
)
} else if (lifeAccountInfo.audit_status == Constant.STATUS_AUDIT_REJECT) {
// 认证驳回 请求企业认证信息 此处为升级认证情况 需要传入生活号id
ApiService.authMerchantCheck(
this,
hashMapOf(PARAMS_LIFE_ACCOUNT_ID to lifeAccountInfo.life_account_id)
)
} }
} else if (from == viewBind.ivLifeAccountAuthUpgrade) { } else if (from == viewBind.ivLifeAccountAuthUpgrade) {
// 认证升级 请求企业认证信息 此处为升级认证情况 需要传入生活号id // 认证升级 请求企业认证信息 此处为升级认证情况 需要传入生活号id
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 LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_INDIVIDUAL_BUSINESS_AUTH -> {
} // 个体工商户认证
// 认证状态 viewBind.ivLifeAccountAuth.fillContent(resources.getString(R.string.individual_business))
if (lifeAccountInfo.life_account_auth_status == Constant.STATUS_AUTH_NOT && lifeAccountInfo.enterprise_auth_record_id == 0) { if (lifeAccountInfo.role_type != Constant.TYPE_ROLE_ORDINARY) {
// 个人未认证生活号 企业审核记录id为0 // 企业员工不允许查看认证信息
viewBind.ivLifeAccountAuth.fillContent(resources.getString(R.string.not_auth)) viewBind.ivLifeAccountAuth.showDetailEntry()
viewBind.ivLifeAccountAuth.showAuthEntry(MerchantInfoView.LifeAccountAuthStatus.NOT_AUTH) }
return }
} LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_PERSONAL_AUTH -> {
if (lifeAccountInfo.role_type != Constant.TYPE_ROLE_ORDINARY) {
// 企业员工不允许查看认证信息
viewBind.ivLifeAccountAuth.showDetailEntry()
}
// 认证类型
when (lifeAccountInfo.id_type) {
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)
} }
Constant.TYPE_AUTH_COMMON_ENTERPRISE -> { LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_AUDIT_UNDER -> {
// 普通企业认证 // 审核中
viewBind.ivLifeAccountAuth.fillContent(resources.getString(R.string.common_enterprise)) }
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)
}
} }
} }
} }
......
...@@ -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_auth)
setTextColor(ContextCompat.getColor(context, R.color.color_FF1852F1))
}
LifeAccountManager.LifeAccountType.LIFE_ACCOUNT_NOT_AUTH -> {
// 未认证 // 未认证
setBackgroundResource(R.drawable.shape_life_account_status_unauth) setBackgroundResource(R.drawable.shape_life_account_status_unauth)
setTextColor(ContextCompat.getColor(context, R.color.color_333333)) 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)
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_AUDIT_UNDER -> {
when (data.enterprise_audit_status) {
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