package com.yidian.shenghuoquan.bmanagercenter.wallet.ui

import android.os.Bundle
import com.yidian.bcommon.constant.AppConfig
import com.yidian.bcommon.constant.XRouterPathConstants
import com.yidian.bcommon.base.BaseActivity
import com.yidian.bcommon.extensions.clickAntiShake
import com.yidian.bcommon.extensions.hide
import com.yidian.bcommon.extensions.show
import com.yidian.bcommon.webview.PublicWebViewActivity
import com.yidian.shenghuoquan.bmanagercenter.R
import com.yidian.shenghuoquan.bmanagercenter.databinding.ActivityMyWalletBinding
import com.yidian.xpage.XPageManager


/**
 * 我的钱包
 */
class MyWalletActivity : BaseActivity<ActivityMyWalletBinding>() {

  override fun createViewBinding(): ActivityMyWalletBinding {
    return ActivityMyWalletBinding.inflate(layoutInflater)
  }

  override fun getXPageName(): String {
    return XRouterPathConstants.MY_WALLET
  }

  override fun init(savedInstanceState: Bundle?) {
    super.init(savedInstanceState)
    initTitle()
    initClick()
  }

  private fun initClick() {
    // 交易明细
    viewBind.tvTransactionDetails.clickAntiShake {
      XPageManager.push(XRouterPathConstants.TRANSACTION_LIST, null)
    }
    // todo 提现(仅管理员可以发起提现)
    viewBind.tvWithdraw.clickAntiShake {
//      XPageManager.push(XRouterPathConstants.VERIFY_IDENTITY, null)
      // todo 测试代码
      XPageManager.push(XRouterPathConstants.WECHAT_AUTH, null)
    }
  }

  private fun initTitle() {
    viewBind.include.tvTitle.text = "我的钱包"
    viewBind.include.ivBack.setOnClickListener {
      XPageManager.pop(null)
    }
    viewBind.include.tvMenu.hide()
    viewBind.include.ivMenu.show()
    viewBind.include.ivMenu.setImageResource(R.drawable.icon_faq)
    viewBind.include.ivMenu.setOnClickListener {
      PublicWebViewActivity.startWebViewActivity(this, AppConfig.commonProblem)
    }
  }
}
