package com.yidian.shenghuoquan.bmanagercenter.ui.store.viewholder

import android.view.View
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.yidian.shenghuoquan.bmanagercenter.R
import com.yidian.shenghuoquan.bmanagercenter.adapter.StoreAdapter
import com.yidian.shenghuoquan.bmanagercenter.http.httpbean.GetShopListBean

/**
 * Author: sym
 * Date: 2021/6/22 3:23 PM
 * Describe:
 */
class StoreViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
  private lateinit var listener: StoreAdapter.HolderListener

  fun setData(data: GetShopListBean, pos: Int) {
    val title = itemView.findViewById<TextView>(R.id.store_name)
    val phone = itemView.findViewById<TextView>(R.id.store_phone)
    val address = itemView.findViewById<TextView>(R.id.store_address)
    title.text = data.shop_name
    phone.text = data.phone
    address.text = data.address
  }

  fun setOnListener(deleteListener: StoreAdapter.HolderListener) {
    listener = deleteListener
  }

  init {
    itemView.setOnClickListener {
      listener.jump()
    }
  }

}
