package com.zj365.health.adapter

import android.annotation.SuppressLint
import android.text.TextUtils
import android.widget.ImageView
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xty.base.adapter.BaseAdapter
import com.xty.common.setRoundImage
import com.zj365.health.R
import com.xty.network.model.CancerGoodsBean

class OrderListAdapter : BaseAdapter<CancerGoodsBean>(R.layout.item_order_list) {

    @SuppressLint("UseCompatLoadingForDrawables", "SetTextI18n")
    override fun convert(holder: BaseViewHolder, item: CancerGoodsBean) {
        holder.getView<ImageView>(R.id.tvGoodsIms)
            .apply {
                if (!TextUtils.isEmpty(item.goodsImageUrl)) {
                    setRoundImage(context, item.goodsImageUrl)
                } else {
                    setRoundImage(context, "https://minioapi.auprty.com/anyu/app/xuefei.png")
                }
            }
        holder.setText(R.id.tvTitle, item.goodsName)
        holder.setText(R.id.tvPrice, "¥${item.price}")
        holder.setText(R.id.tvExchangeCode, "兑换码")
        val equals = item.payChannel.equals("EXCHANGE_CODE")
        holder.setGone(R.id.tvPrice, equals)
        holder.setGone(R.id.tvExchangeCode, !equals)
        holder.setText(R.id.tvTime, "成交时间: ${item.payTime}")
//        holder.setText(R.id.tvPriceAll,"￥${item.price}")
//        holder.setText(R.id.tvOrderNo,item.orderNo)
//        holder.setText(R.id.tvPayTime,item.payTime)
    }
}

