InvoiceVModel.kt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package com.quansu.heifengwuliu.vmodel
  2. import android.app.Application
  3. import android.graphics.Color
  4. import com.quansu.heifengwuliu.utils.net.NetEngine
  5. import com.ysnows.base.base.BRRepository
  6. import com.ysnows.base.base.BRViewModel
  7. import com.ysnows.base.net.IResp
  8. import io.reactivex.Observable
  9. class InvoiceVModel(application: Application) : BRViewModel<BRRepository>(application) {
  10. //state:1:开票中 2通过(已邮寄) 3系统拒绝 9取消
  11. fun getInvoiceStatus(status: Int): String {
  12. return when (status) {
  13. 1 -> "开票中"
  14. 2 -> "发票已邮寄"
  15. 3 -> "系统拒绝"
  16. 9 -> "已取消申请"
  17. else -> ""
  18. }
  19. }
  20. fun getInvoiceColor(status: Int): Int {
  21. return when (status) {
  22. 1 -> Color.parseColor("#FFBC00")
  23. 2 -> Color.parseColor("#FF6029")
  24. 3 -> Color.parseColor("#979899")
  25. 9 ->Color.parseColor("#979899")
  26. else -> Color.parseColor("#979899")
  27. }
  28. }
  29. override fun apiFunc(): suspend () -> IResp<*> {
  30. return {NetEngine.service.invoiceList(repository().page)}
  31. }
  32. fun goInvoice(){
  33. //申请开票
  34. }
  35. }