package com.zj365.health.adapter

import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xty.base.adapter.BaseAdapter
import com.xty.common.Dateutils
import com.xty.common.LogUtils
import com.xty.network.model.GoodsLogisticsBean
import com.zj365.health.R

class GoodsLogisticsAdapter : BaseAdapter<GoodsLogisticsBean.LogisticsBean>(R.layout.item_goods_logistics) {
    override fun convert(holder: BaseViewHolder, item: GoodsLogisticsBean.LogisticsBean) {
        var statusDesc = ""
        when(item.status){
            101->{
                statusDesc = "已揽件"
            }
            102->{
                statusDesc = "在途中"
            }
            103->{
                statusDesc = "派送中"
            }
            104 ->{
                statusDesc = "已签收"
            }

            105->{
                statusDesc = "用户拒签"
            }
            106->{
                statusDesc = "疑难件"
            }
            107->{
                statusDesc = "无效单"
            }
            108->{
                statusDesc = "超时单"
            }
            109->{
                statusDesc = "签收失败"
            }
            110->{
                statusDesc = "退回"
            }
            111->{
                statusDesc = "转投"
            }

            112->{
                statusDesc = "待签"
            }
        }
        holder.setText(R.id.tv_status_time,"${statusDesc}  ${Dateutils.getDateToString(item.time)}")
        holder.setText(R.id.tv_desc,item.context)

        LogUtils.e("GoodsLogisticsAdapter","size:${data.size} position:${holder.layoutPosition}")
        if (data.size -1  == holder.layoutPosition){
            holder.setGone(R.id.line,true)
        }else{
            holder.setGone(R.id.line,false)
        }
    }
}