package com.zswc.creativity.vmodel

import android.app.Activity
import android.app.Application
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.zswc.creativity.activity.LoginActivity
import com.tencent.mmkv.MMKV
import com.ysnows.base.base.BRepository
import com.ysnows.base.base.BViewModel
import com.ysnows.base.utils.UiSwitch
import com.zswc.creativity.model.MyOrderListDetail
import com.zswc.creativity.utils.net.NetEngine
import kotlinx.coroutines.launch

class GiftOrderVModel(application: Application) : BViewModel<BRepository>(application)  {


    var bean = MutableLiveData<MyOrderListDetail>()


    fun toBack(){
        (repository().context as Activity).finish()
    }


    fun setShowTips(pay_type:String?):String{

        if(pay_type == "qb"){
            return "余额支付"
        }
        return ""
    }


    fun getOrderDetals(orderid:String?){
        viewModelScope.launch {
            var it= repository().lreq { NetEngine.service.getMySendListDetail(orderid) }
            if(it.ok()){
                bean.value=it.data
            }

        }
    }





}
