package com.zswc.creativity.vmodel

import android.app.Application
import android.graphics.Color
import android.view.View
import com.ysnows.base.base.BRRepository
import com.ysnows.base.base.BRViewModel
import com.ysnows.base.net.IResp
import com.zswc.creativity.fragment.OrderListFragment
import com.zswc.creativity.fragment.SaleListFragment
import com.zswc.creativity.utils.net.NetEngine

class SaleListFragmentVModel(application: Application) : BRViewModel<BRRepository>(application) {


//    var bean =MutableLiveData<List<FishpondBean>>()
    var state:String?=""

    var fragment: SaleListFragment?=null

   // state //   0:待付款  1待开始 2进行中 3待评论  4已完成 9:已取消
    fun toShowTips(state:Int?):String{
        if(state==0){
            return "共计"
        }
       if(state==9){
           return "退款金额"
       }
       return "共计"
    }

    fun  getMoneyColor(state:Int?):Int{


        if(state==0){
            return Color.parseColor("#FF0000")
        }
        if(state==1){
            return Color.parseColor("#FF0000")
        }
        return Color.parseColor("#333333")

    }
    fun  getMoneyTips(state:Int?,total_fee:String?,refund_fee:String?):String{
        if(state==9){
            return ""+refund_fee
        }

        return ""+total_fee

    }

    fun getShowCancel(state:Int?):Int{
        if(state==0||state==1){
            return View.VISIBLE
        }
        return View.GONE
    }


//
//    fun  toReceOrder(id: String){
//
//        UiSwitch.bundleRes(fragment!!, OrderDetailActivity::class.java, Bundle().apply {
//            putString("order_id", id)},MIntentAction.REQUEST_CODE_ONE)
//
//    }



    override fun apiFunc(): suspend () -> IResp<*> {
        return {
            NetEngine.service.getMyOrderList(state,10,repository().page)
        }
    }


}
