Commit 6f73ad44 authored by yinjiacheng's avatar yinjiacheng

fix SHQBD-237 生活号标签具体区分普通企业和个体工商户

parent bc88061e
...@@ -17,79 +17,80 @@ import com.yidian.shenghuoquan.newscontent.http.httpbean.LifeAccountItemBean ...@@ -17,79 +17,80 @@ import com.yidian.shenghuoquan.newscontent.http.httpbean.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>() {
private val data by lazy { private val data by lazy {
data?.let { data?.let {
ArrayList<LifeAccountItemBean.Response>(it) ArrayList<LifeAccountItemBean.Response>(it)
} ?: ArrayList() } ?: ArrayList()
} }
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MerchantSwitchViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MerchantSwitchViewHolder {
val viewBinding = ItemMerchantSwitchBinding.bind( val viewBinding = ItemMerchantSwitchBinding.bind(
LayoutInflater.from(parent.context) LayoutInflater.from(parent.context)
.inflate(R.layout.item_merchant_switch, parent, false) .inflate(R.layout.item_merchant_switch, parent, false)
) )
return MerchantSwitchViewHolder(viewBinding.root, viewBinding) return MerchantSwitchViewHolder(viewBinding.root, viewBinding)
} }
override fun onBindViewHolder(holder: MerchantSwitchViewHolder, position: Int) { override fun onBindViewHolder(holder: MerchantSwitchViewHolder, position: Int) {
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) { when (data.life_account_auth_status) {
Constant.STATUS_AUTH_NOT -> { Constant.STATUS_AUTH_NOT -> {
// 未认证 // 未认证
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) text = resources.getString(R.string.not_auth)
} }
Constant.STATUS_AUTH_FINISH -> { 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.life_account_type) { text = when (data.tag.tag_key) {
Constant.TYPE_LIFE_ACCOUNT_PERSONAL -> resources.getString(R.string.personal_auth) Constant.LIFE_ACCOUNT_TAG_COMMON_ENTERPRISE_AUTH -> resources.getString(R.string.common_enterprise)
Constant.TYPE_LIFE_ACCOUNT_ENTERPRISE -> resources.getString(R.string.enterprise_auth) Constant.LIFE_ACCOUNT_TAG_INDIVIDUAL_BUSINESS_AUTH -> resources.getString(R.string.individual_business)
else -> "" Constant.LIFE_ACCOUNT_TAG_PERSONAL_AUTH -> resources.getString(R.string.personal_auth)
} else -> ""
} }
} }
when (data.enterprise_audit_status) { }
Constant.STATUS_AUDIT_UNDER -> { when (data.enterprise_audit_status) {
// 审核中 Constant.STATUS_AUDIT_UNDER -> {
setBackgroundResource(R.drawable.shape_life_account_status_audit) // 审核中
setTextColor(ContextCompat.getColor(context, R.color.color_FFF26E3D)) setBackgroundResource(R.drawable.shape_life_account_status_audit)
text = resources.getString(R.string.under_audit) setTextColor(ContextCompat.getColor(context, R.color.color_FFF26E3D))
} text = resources.getString(R.string.under_audit)
Constant.STATUS_AUDIT_REJECT -> {
// 审核驳回
setBackgroundResource(R.drawable.shape_life_account_status_reject)
setTextColor(ContextCompat.getColor(context, R.color.color_FFFF3A3A))
text = resources.getString(R.string.auth_reject)
}
}
} }
// 当前选中的生活号 Constant.STATUS_AUDIT_REJECT -> {
holder.viewBinding.ivLifeAccountSelect.isVisible = data.life_account_id == curLifeAccountId // 审核驳回
holder.viewBinding.root.setOnClickListener { setBackgroundResource(R.drawable.shape_life_account_status_reject)
listener?.onItemClick(it, position, data) setTextColor(ContextCompat.getColor(context, R.color.color_FFFF3A3A))
text = resources.getString(R.string.auth_reject)
} }
}
} }
// 当前选中的生活号
override fun getItemCount(): Int { holder.viewBinding.ivLifeAccountSelect.isVisible = data.life_account_id == curLifeAccountId
return data.size holder.viewBinding.root.setOnClickListener {
listener?.onItemClick(it, position, data)
} }
}
interface OnItemClickListener { override fun getItemCount(): Int {
fun onItemClick(view: View, position: Int, data: LifeAccountItemBean.Response) return data.size
} }
interface OnItemClickListener {
fun onItemClick(view: View, position: Int, data: LifeAccountItemBean.Response)
}
class MerchantSwitchViewHolder(itemView: View, val viewBinding: ItemMerchantSwitchBinding) : class MerchantSwitchViewHolder(itemView: View, val viewBinding: ItemMerchantSwitchBinding) :
RecyclerView.ViewHolder(itemView) RecyclerView.ViewHolder(itemView)
} }
\ No newline at end of file
...@@ -194,7 +194,6 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(), ...@@ -194,7 +194,6 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
/** /**
* 对应生活号权限下的功能集 * 对应生活号权限下的功能集
* @param tagKey 生活号认证类型/状态
* todo 优化逻辑 * todo 优化逻辑
*/ */
private fun generateFunctionPermissionMap(data: List<GetConfigListBean.Item>) { private fun generateFunctionPermissionMap(data: List<GetConfigListBean.Item>) {
......
...@@ -60,9 +60,10 @@ class LifeAccountLabelView @JvmOverloads constructor( ...@@ -60,9 +60,10 @@ class LifeAccountLabelView @JvmOverloads constructor(
// 已认证 // 已认证
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.life_account_type) { text = when (data.tag.tag_key) {
Constant.TYPE_LIFE_ACCOUNT_PERSONAL -> resources.getString(R.string.personal_auth) Constant.LIFE_ACCOUNT_TAG_COMMON_ENTERPRISE_AUTH -> resources.getString(R.string.common_enterprise)
Constant.TYPE_LIFE_ACCOUNT_ENTERPRISE -> resources.getString(R.string.enterprise_auth) 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 -> "" else -> ""
} }
} }
......
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