Quellcode durchsuchen

1. add coroutines net req

咸光金 vor 4 Jahren
Ursprung
Commit
7bbd92952b

+ 2 - 2
app/src/main/java/com/quansu/heifengwuliu/activity/EachOtherActivity.kt

@@ -14,8 +14,8 @@ import com.quansu.heifengwuliu.vmodel.EachOtherVModel
 class EachOtherActivity: MBRActivity<EachOtherVModel, EachOtherAdapter, ActivityEachOtherBinding>() {
 
 
-    override fun initCreate(savedInstanceState: Bundle?) {
-        super.initCreate(savedInstanceState)
+    override fun init(savedInstanceState: Bundle?) {
+        super.init(savedInstanceState)
         vm.order_id= intent?.extras?.getString("order_id", "")!!
 
     }

+ 2 - 2
app/src/main/java/com/quansu/heifengwuliu/activity/EvaluateActivity.kt

@@ -12,8 +12,8 @@ import com.quansu.heifengwuliu.vmodel.EvaluateVModel
 class EvaluateActivity: MBActivity<EvaluateVModel, ActivityEvaluateBinding>(){
 
 
-    override fun initCreate(savedInstanceState: Bundle?) {
-        super.initCreate(savedInstanceState)
+    override fun init(savedInstanceState: Bundle?) {
+        super.init(savedInstanceState)
         vm.order_id= intent?.extras?.getString("order_id", "")!!
         vm.url.value= intent?.extras?.getString("url", "")!!
         vm.sn.value= intent?.extras?.getString("sn", "")!!

+ 15 - 18
app/src/main/java/com/quansu/heifengwuliu/activity/WaybillDetailsActivity.kt

@@ -14,7 +14,7 @@ import com.quansu.heifengwuliu.inte.OnUploadCallback
 import com.quansu.heifengwuliu.model.WaybillDetails
 import com.quansu.heifengwuliu.utils.OssUtils
 import com.quansu.heifengwuliu.vmodel.WaybillDetailsVModel
-import java.util.ArrayList
+import java.util.*
 
 /**
  * 司机/货主 运单详情
@@ -30,11 +30,11 @@ class WaybillDetailsActivity : MBActivity<WaybillDetailsVModel, ActivityWaybilld
 
     }
 
-    override fun initCreate(savedInstanceState: Bundle?) {
-        super.initCreate(savedInstanceState)
-        vm.ll=binding.ll
+    override fun init(savedInstanceState: Bundle?) {
+        super.init(savedInstanceState)
+        vm.ll = binding.ll
 
-        vm.type.value=type
+        vm.type.value = type
         var order_id = intent?.extras?.getString("order_id", "")
 
         vm.getInfo(order_id!!)
@@ -48,15 +48,15 @@ class WaybillDetailsActivity : MBActivity<WaybillDetailsVModel, ActivityWaybilld
 
     }
 
-    private fun initViewPager(bean: WaybillDetails){
-        var  adapterOut= OrderInfoadapter()
-        binding.recyclerViewOut.adapter=adapterOut
-        var  outList = bean.info.send
+    private fun initViewPager(bean: WaybillDetails) {
+        var adapterOut = OrderInfoadapter()
+        binding.recyclerViewOut.adapter = adapterOut
+        var outList = bean.info.send
         adapterOut!!.addData(outList)
         //入
-        var adapterIn= OrderInfoInadapter()
-        binding.recyclerViewIn.adapter=adapterIn
-        var  inList = bean.info.receive
+        var adapterIn = OrderInfoInadapter()
+        binding.recyclerViewIn.adapter = adapterIn
+        var inList = bean.info.receive
         adapterIn!!.addData(inList)
 
     }
@@ -75,7 +75,7 @@ class WaybillDetailsActivity : MBActivity<WaybillDetailsVModel, ActivityWaybilld
 
     override fun onUploadSuccess(t: String) {
         val ss: Array<String> = t.split(",".toRegex()).toTypedArray()
-        vm.img.value=ss[1]
+        vm.img.value = ss[1]
 
     }
 
@@ -97,7 +97,7 @@ class WaybillDetailsActivity : MBActivity<WaybillDetailsVModel, ActivityWaybilld
                     list.add(path.path)
                 }
 
-                OssUtils(this)
+                OssUtils(this, vm)
                         .setUpLoad("order", list, this)
 
             }
@@ -110,7 +110,7 @@ class WaybillDetailsActivity : MBActivity<WaybillDetailsVModel, ActivityWaybilld
             val selectList = PictureSelector.obtainMultipleResult(data) ?: return
             val list = ArrayList<String>()
             list.add(selectList[0].path)
-            OssUtils(this)
+            OssUtils(this, vm)
                     .setUpLoad("order", list, this)
 
             return
@@ -122,9 +122,6 @@ class WaybillDetailsActivity : MBActivity<WaybillDetailsVModel, ActivityWaybilld
         }
 
 
-
-
-
     }
 
 

+ 1 - 1
app/src/main/java/com/quansu/heifengwuliu/fragment/OwnerSingleFragment.kt

@@ -574,7 +574,7 @@ class OwnerSingleFragment : MBFragment<OwnerSingleVModel, FragmentOwnersingleBin
 
     private fun choseMap() {
 
-        AndPermission.with(repository().context)
+        AndPermission.with(context)
                 .runtime()
                 .permission(Permission.ACCESS_COARSE_LOCATION,
                         Permission.ACCESS_FINE_LOCATION,

+ 3 - 3
app/src/main/java/com/quansu/heifengwuliu/utils/net/ApiService.kt

@@ -530,7 +530,7 @@ interface ApiService {
      */
     @POST("api/info/carPay")
     @FormUrlEncoded
-    fun carPay(@Field("money") money: String?,@Field("order_id") order_id: String?, @Field("pay_pwd") pay_pwd: String?): Observable<Response<Any>>
+    fun carPay(@Field("money") money: String?,@Field("order_id") order_id: String?, @Field("pay_pwd") pay_pwd: String?): Observable<Resp<Any>>
 
 
 
@@ -542,7 +542,7 @@ interface ApiService {
     @FormUrlEncoded
     fun eva(@Field("order_id") order_id: String?, @Field("score") score: String?,
                     @Field("content") content: String?
-    ): Observable<Response<Any>>
+    ): Observable<Resp<Any>>
 
 
 
@@ -551,7 +551,7 @@ interface ApiService {
      * @return
      */
     @GET("api/info/orderEva")
-    fun orderEva(@Query("order_id") order_id: String?,@Query("p") p: Int): Observable<Response<List<OrderEva>>>
+    suspend fun orderEva(@Query("order_id") order_id: String?,@Query("p") p: Int): Resp<List<OrderEva>>
 
 
 

+ 10 - 10
app/src/main/java/com/quansu/heifengwuliu/vmodel/EachOtherVModel.kt

@@ -1,29 +1,29 @@
 package com.quansu.heifengwuliu.vmodel
 
+import android.app.Application
 import com.quansu.heifengwuliu.model.User
 import com.quansu.heifengwuliu.utils.net.NetEngine
 import com.ysnows.base.base.BRRepository
 import com.ysnows.base.base.BRViewModel
-import com.ysnows.base.net.IResponse
-import io.reactivex.Observable
+import com.ysnows.base.net.IResp
 
 /**
  *Created by shihuiyun
  *on 2020/9/22
  */
-class EachOtherVModel: BRViewModel<BRRepository>() {
+class EachOtherVModel(application: Application) : BRViewModel<BRRepository>(application) {
 
-    var order_id=""
-    var user=User.get()
-
-    override fun api(): Observable<out IResponse<*>> {
-        return NetEngine.service.orderEva(order_id,repository().autoPage())
-    }
+    var order_id = ""
+    var user = User.get()
 
 
-    fun isSelf(uid:String):Boolean{//是自己的
+    fun isSelf(uid: String): Boolean {//是自己的
         return uid == user!!.uid
 
     }
 
+    override fun apiFunc(): suspend () -> IResp<*> {
+        return { NetEngine.service.orderEva(order_id, repository().page) }
+    }
+
 }

+ 45 - 49
app/src/main/java/com/quansu/heifengwuliu/vmodel/EvaluateVModel.kt

@@ -1,9 +1,9 @@
 package com.quansu.heifengwuliu.vmodel
 
 import android.app.Activity
+import android.app.Application
 import android.content.Intent
 import android.text.TextUtils
-import android.widget.Toast
 import androidx.databinding.Bindable
 import androidx.lifecycle.MutableLiveData
 import com.quansu.heifengwuliu.BR
@@ -15,7 +15,7 @@ import com.ysnows.base.base.BViewModel
  *Created by shihuiyun
  *on 2020/9/22
  */
-class EvaluateVModel: BViewModel<BRepository>() {
+class EvaluateVModel(application: Application) : BViewModel<BRepository>(application) {
 
     var isShow: MutableLiveData<Boolean> = MutableLiveData(true)
 
@@ -23,15 +23,15 @@ class EvaluateVModel: BViewModel<BRepository>() {
     var sn: MutableLiveData<String> = MutableLiveData()
     var time: MutableLiveData<String> = MutableLiveData()
 
-    var branch : MutableLiveData<Int> = MutableLiveData(0)//0-5
+    var branch: MutableLiveData<Int> = MutableLiveData(0)//0-5
 
 
-    var order_id=""
-    var choseOn1=MutableLiveData(false)
-    var choseOn2=MutableLiveData(false)
-    var choseOn3=MutableLiveData(false)
-    var choseOn4=MutableLiveData(false)
-    var choseOn5=MutableLiveData(false)
+    var order_id = ""
+    var choseOn1 = MutableLiveData(false)
+    var choseOn2 = MutableLiveData(false)
+    var choseOn3 = MutableLiveData(false)
+    var choseOn4 = MutableLiveData(false)
+    var choseOn5 = MutableLiveData(false)
 
     @Bindable
     var name: String? = null
@@ -41,21 +41,21 @@ class EvaluateVModel: BViewModel<BRepository>() {
         }
 
 
-    fun toSubmit(){
+    fun toSubmit() {
         //发布
 
-        if(TextUtils.isEmpty(name)){
+        if (TextUtils.isEmpty(name)) {
             toast("请输入评论")
             return
 
         }
 
-        if(branch.value==0){
+        if (branch.value == 0) {
             toast("请给对方打星,至少一星")
             return
         }
 
-        repository().lreq(NetEngine.service.eva(order_id,branch.value.toString(),name))
+        repository().rxLreq(NetEngine.service.eva(order_id, branch.value.toString(), name))
                 .doOnNext {
                     if (it.ok(true)) {
 
@@ -70,56 +70,52 @@ class EvaluateVModel: BViewModel<BRepository>() {
 
     }
 
-    fun toStars(type:Int){
-        when(type){
-            1->{
-                if(!choseOn1.value!!){
-                    branch.value= branch.value!! +1
-                }else{
-                    branch.value= branch.value!! -1
+    fun toStars(type: Int) {
+        when (type) {
+            1 -> {
+                if (!choseOn1.value!!) {
+                    branch.value = branch.value!! + 1
+                } else {
+                    branch.value = branch.value!! - 1
                 }
-                choseOn1.value=!choseOn1.value!!
+                choseOn1.value = !choseOn1.value!!
             }
-            2->{
-                if(!choseOn2.value!!){
-                    branch.value= branch.value!! +1
-                }else{
-                    branch.value= branch.value!! -1
+            2 -> {
+                if (!choseOn2.value!!) {
+                    branch.value = branch.value!! + 1
+                } else {
+                    branch.value = branch.value!! - 1
                 }
-                choseOn2.value=!choseOn2.value!!
+                choseOn2.value = !choseOn2.value!!
 
             }
-            3->{
-                if(!choseOn3.value!!){
-                    branch.value= branch.value!! +1
-                }else{
-                    branch.value= branch.value!! -1
+            3 -> {
+                if (!choseOn3.value!!) {
+                    branch.value = branch.value!! + 1
+                } else {
+                    branch.value = branch.value!! - 1
                 }
-                choseOn3.value=!choseOn3.value!!
+                choseOn3.value = !choseOn3.value!!
             }
-            4->{
-                if(!choseOn4.value!!){
-                    branch.value= branch.value!! +1
-                }else{
-                    branch.value= branch.value!! -1
+            4 -> {
+                if (!choseOn4.value!!) {
+                    branch.value = branch.value!! + 1
+                } else {
+                    branch.value = branch.value!! - 1
                 }
-                choseOn4.value=!choseOn4.value!!
+                choseOn4.value = !choseOn4.value!!
             }
-            5->{
-                if(!choseOn5.value!!){
-                    branch.value= branch.value!! +1
-                }else{
-                    branch.value= branch.value!! -1
+            5 -> {
+                if (!choseOn5.value!!) {
+                    branch.value = branch.value!! + 1
+                } else {
+                    branch.value = branch.value!! - 1
                 }
-                choseOn5.value=!choseOn5.value!!
+                choseOn5.value = !choseOn5.value!!
             }
         }
 
     }
 
 
-
-
-
-
 }

+ 98 - 105
app/src/main/java/com/quansu/heifengwuliu/vmodel/WaybillDetailsVModel.kt

@@ -3,12 +3,12 @@ package com.quansu.heifengwuliu.vmodel
 import android.Manifest
 import android.annotation.SuppressLint
 import android.app.Activity
+import android.app.Application
 import android.content.Context
 import android.content.Intent
 import android.net.Uri
 import android.os.Bundle
 import android.text.TextUtils
-import android.text.TextWatcher
 import android.view.LayoutInflater
 import android.widget.EditText
 import android.widget.FrameLayout
@@ -16,8 +16,6 @@ import android.widget.ImageView
 import android.widget.LinearLayout
 import androidx.databinding.Bindable
 import androidx.lifecycle.MutableLiveData
-import com.google.gson.Gson
-import com.hwangjr.rxbus.RxBus
 import com.qmuiteam.qmui.layout.QMUIFrameLayout
 import com.qmuiteam.qmui.skin.QMUISkinValueBuilder
 import com.qmuiteam.qmui.util.QMUIDisplayHelper
@@ -40,8 +38,6 @@ import com.yanzhenjie.permission.AndPermission
 import com.ysnows.base.base.BRepository
 import com.ysnows.base.base.BViewModel
 import com.ysnows.base.utils.UiSwitch
-import com.ysnows.base.utils.UiUtils
-import com.ysnows.base.view.BView
 import java.util.*
 
 
@@ -49,24 +45,24 @@ import java.util.*
 *
 *   订单状态 order_state:0->全部 10->待取货 20->运输中 30->待结算 40->待评价 50->已完成
 */
-open class WaybillDetailsVModel : BViewModel<BRepository>() {
+open class WaybillDetailsVModel(application: Application) : BViewModel<BRepository>(application) {
 
     val info: MutableLiveData<WaybillDetails> = MutableLiveData<WaybillDetails>()
+
     //0货主端  2司机端
     val type: MutableLiveData<Int> = MutableLiveData<Int>()
 
     val tvTitle: MutableLiveData<String> = MutableLiveData<String>()
 
 
-    var order_state:Int=0
+    var order_state: Int = 0
 
     var img: MutableLiveData<String> = MutableLiveData("")//司机端
     val isDialogShow: MutableLiveData<Boolean> = MutableLiveData<Boolean>(false)//司机端
 
     val isButShow: MutableLiveData<Boolean> = MutableLiveData<Boolean>(true)
 
-    var ll: LinearLayout? =null
-
+    var ll: LinearLayout? = null
 
 
     @Bindable
@@ -79,55 +75,55 @@ open class WaybillDetailsVModel : BViewModel<BRepository>() {
 
     fun getInfo(order_id: String) {
 
-        if(type.value==0){//货主端-运单详情
+        if (type.value == 0) {//货主端-运单详情
 
-            repository().preq(NetEngine.service.orderGet(order_id))
+            repository().rxPreq(NetEngine.service.orderGet(order_id))
                     .doOnNext() {
                         if (it.ok()) {
 
                             info.value = it.data() as WaybillDetails
-                            order_state= info.value!!.order.order_state
-                            when(info.value!!.order.order_state){
-                                10->tvTitle.value="运输轨迹"
-                                20->tvTitle.value="运输轨迹"
-                                30->tvTitle.value="去结算"
-                                40->{
-                                    if(null!=info.value!!.eva.my_eva){
-                                        order_state=50
+                            order_state = info.value!!.order.order_state
+                            when (info.value!!.order.order_state) {
+                                10 -> tvTitle.value = "运输轨迹"
+                                20 -> tvTitle.value = "运输轨迹"
+                                30 -> tvTitle.value = "去结算"
+                                40 -> {
+                                    if (null != info.value!!.eva.my_eva) {
+                                        order_state = 50
                                         tvTitle.value = "查看评价"
-                                    }else {
+                                    } else {
                                         tvTitle.value = "待评价"
                                     }
                                 }
-                                50->tvTitle.value="查看评价"
+                                50 -> tvTitle.value = "查看评价"
                             }
 
                         }
                     }
                     .subscribe()
 
-        }else{ //司机端-货主详情
+        } else { //司机端-货主详情
 
-            repository().preq(NetEngine.service.orderGetDriver(order_id))
+            repository().rxPreq(NetEngine.service.orderGetDriver(order_id))
                     .doOnNext() {
                         if (it.ok()) {
 
-                            info.value = it.data()as WaybillDetails
-                            order_state= info.value!!.order.order_state
-                            isButShow.value = order_state==10||order_state==20||order_state==40||order_state==50
-
-                            when(info.value!!.order.order_state){
-                                10->tvTitle.value="开始送货"
-                                20->tvTitle.value="已送达"
-                                40->{
-                                    if(null!=info.value!!.eva.my_eva){
-                                        order_state=50
+                            info.value = it.data() as WaybillDetails
+                            order_state = info.value!!.order.order_state
+                            isButShow.value = order_state == 10 || order_state == 20 || order_state == 40 || order_state == 50
+
+                            when (info.value!!.order.order_state) {
+                                10 -> tvTitle.value = "开始送货"
+                                20 -> tvTitle.value = "已送达"
+                                40 -> {
+                                    if (null != info.value!!.eva.my_eva) {
+                                        order_state = 50
                                         tvTitle.value = "查看评价"
-                                    }else {
+                                    } else {
                                         tvTitle.value = "待评价"
                                     }
                                 }
-                                50->tvTitle.value="查看评价"
+                                50 -> tvTitle.value = "查看评价"
                             }
 
                         }
@@ -136,14 +132,12 @@ open class WaybillDetailsVModel : BViewModel<BRepository>() {
         }
 
 
-
-
     }
 
 
-    fun toStartShip(order_id:String){
+    fun toStartShip(order_id: String) {
 
-        if(type.value==0) {//货主端
+        if (type.value == 0) {//货主端
             //0->全部 10->待取货 20->运输中 30->待结算 40->待评价 50->已完成
 //        10->tvTitle.value="运输轨迹"
 //        20->tvTitle.value="运输轨迹"
@@ -171,7 +165,7 @@ open class WaybillDetailsVModel : BViewModel<BRepository>() {
                 //货主给司机评价
 
                 UiSwitch.bundleRes(repository().context as Activity, EvaluateActivity::class.java, Bundle().apply {
-                    putString("order_id",order_id)
+                    putString("order_id", order_id)
                     putString("url", info.value!!.driver.avatar)
                     putString("sn", info.value!!.order.order_sn)
                     putString("time", info.value!!.order.create_time)
@@ -183,19 +177,19 @@ open class WaybillDetailsVModel : BViewModel<BRepository>() {
             }
             if (order_state == 50) {
                 //查看评价
-               UiSwitch.bundle(repository().context, EachOtherActivity::class.java,
-                Bundle().apply {
-                    putString("order_id",order_id)
+                UiSwitch.bundle(repository().context, EachOtherActivity::class.java,
+                        Bundle().apply {
+                            putString("order_id", order_id)
 
-                  }
+                        }
                 )
 
                 return
             }
 
-        }else{//司机端
+        } else {//司机端
 
-            if(order_state==10) {
+            if (order_state == 10) {
                 QMUIDialog.MessageDialogBuilder(repository().context)
                         .setTitle("提示")
                         .setMessage("确定要开始送货么")
@@ -209,28 +203,28 @@ open class WaybillDetailsVModel : BViewModel<BRepository>() {
                         .show()
                 return
             }
-            if(order_state==20){//已完成
+            if (order_state == 20) {//已完成
 
-                isDialogShow.value=true
-                number=""
+                isDialogShow.value = true
+                number = ""
             }
-            if(order_state==40){//待评价--司机对货主的评价
+            if (order_state == 40) {//待评价--司机对货主的评价
 
                 UiSwitch.bundleRes(repository().context as Activity, EvaluateActivity::class.java, Bundle().apply {
-                    putString("order_id",order_id)
+                    putString("order_id", order_id)
                     putString("url", "")
                     putString("sn", info.value!!.order.order_sn)
                     putString("time", info.value!!.order.create_time)
-                },MIntentAction.REQUEST_CODE_COMMENT)
+                }, MIntentAction.REQUEST_CODE_COMMENT)
 
 
             }
 
-            if(order_state==50){//查看评价
+            if (order_state == 50) {//查看评价
 
                 UiSwitch.bundle(repository().context, EachOtherActivity::class.java,
                         Bundle().apply {
-                            putString("order_id",order_id)
+                            putString("order_id", order_id)
                         }
                 )
             }
@@ -239,20 +233,19 @@ open class WaybillDetailsVModel : BViewModel<BRepository>() {
         }
 
 
-
     }
 
 
-    fun setSureSend(order_id:String){
+    fun setSureSend(order_id: String) {
 
-        var map= HashMap<String, String>()
+        var map = HashMap<String, String>()
         map["order_id"] = order_id
         map["state"] = "20"
-        repository().lreq(NetEngine.service.setStatus(map))
+        repository().rxLreq(NetEngine.service.setStatus(map))
                 .doOnNext() {
                     if (it.ok()) {
-                        order_state=20//变成运输中
-                        tvTitle.value="已送达"
+                        order_state = 20//变成运输中
+                        tvTitle.value = "已送达"
                     }
                 }
                 .subscribe()
@@ -260,11 +253,10 @@ open class WaybillDetailsVModel : BViewModel<BRepository>() {
     }
 
 
-
     @SuppressLint("WrongConstant")
-    fun toCallPhone(mobile:String){
+    fun toCallPhone(mobile: String) {
         //拨打电话
-        if(TextUtils.isEmpty(mobile)){
+        if (TextUtils.isEmpty(mobile)) {
             toast("未添加该公司的电话!!")
             return
         }
@@ -282,40 +274,42 @@ open class WaybillDetailsVModel : BViewModel<BRepository>() {
 
     }
 
-    fun interceptClick(){
+    fun interceptClick() {
         return
     }
+
     fun choseImg() {
         //选择照片
         ChosePhotoUtils.getChosePhoto(view()!!.context(), 1)
 
     }
-    fun goOperation(type:Int,order_id:String,data_id:String){
-        if(type==1){
-            isDialogShow.value=false
-        }else{
+
+    fun goOperation(type: Int, order_id: String, data_id: String) {
+        if (type == 1) {
+            isDialogShow.value = false
+        } else {
             //确定
-            if(TextUtils.isEmpty(number)){
+            if (TextUtils.isEmpty(number)) {
                 toast("输入运送数量")
                 return
             }
-            if(TextUtils.isEmpty(img.value)){
+            if (TextUtils.isEmpty(img.value)) {
                 toast("请上传凭证")
                 return
             }
 
-            var map= HashMap<String, String>()
+            var map = HashMap<String, String>()
             map["order_id"] = order_id
             map["state"] = "30"
-            map["data_id"] =data_id
+            map["data_id"] = data_id
             map["img"] = img.value.toString()
             map["nums"] = number.toString()
-            repository().lreq(NetEngine.service.setStatus(map))
+            repository().rxLreq(NetEngine.service.setStatus(map))
                     .doOnNext() {
                         if (it.ok(true)) {
-                            order_state=30//变成待结算
-                            tvTitle.value=""
-                            isDialogShow.value=false
+                            order_state = 30//变成待结算
+                            tvTitle.value = ""
+                            isDialogShow.value = false
                         }
                     }
                     .subscribe()
@@ -324,7 +318,7 @@ open class WaybillDetailsVModel : BViewModel<BRepository>() {
 
     }
 
-    fun  getOrderStatus(order_state:Int):String {
+    fun getOrderStatus(order_state: Int): String {
         //0->全部 10->待取货 20->运输中 30->待结算 40->待评价 50->已完成
         if (type.value == 0) {//货主端
             when (order_state) {
@@ -350,8 +344,7 @@ open class WaybillDetailsVModel : BViewModel<BRepository>() {
     }
 
 
-
-    fun showPayDialog(order_id: String){
+    fun showPayDialog(order_id: String) {
         var mNormalPopup = QMUIPopups.fullScreenPopup(repository().context)
         val builder: QMUISkinValueBuilder = QMUISkinValueBuilder.acquire()
         val frameLayout = QMUIFrameLayout(repository().context)
@@ -362,39 +355,40 @@ open class WaybillDetailsVModel : BViewModel<BRepository>() {
         val butCancel: ImageView = layout.findViewById(R.id.iv_close)
         val etMoney: EditText = layout.findViewById(R.id.et_money)
 
-        val butSure: QMUIRoundButton =layout.findViewById(R.id.but_sure)
+        val butSure: QMUIRoundButton = layout.findViewById(R.id.but_sure)
 
         val payPwdEditText: PasswordView = layout.findViewById(R.id.ppet)
-        var password=""
+        var password = ""
 
 
         payPwdEditText.setPasswordListener(object : PasswordView.PasswordListener {
             override fun keyEnterPress(pwd: String?, isComplete: Boolean) {
-                password= pwd!!
-                if(!TextUtils.isEmpty(password)&&password.length==6){
-                    var money=etMoney.text.toString().trim()
-                    if(TextUtils.isEmpty(money)){
+                password = pwd!!
+                if (!TextUtils.isEmpty(password) && password.length == 6) {
+                    var money = etMoney.text.toString().trim()
+                    if (TextUtils.isEmpty(money)) {
                         toast("请输入支付金额")
                         return
                     }
-                    getInfoPay(money,order_id,password)
+                    getInfoPay(money, order_id, password)
                     mNormalPopup.dismiss()
                 }
 
             }
+
             override fun passwordChange(changeText: String?) {
             }
 
             override fun passwordComplete(pwd: String?) {
-                password=pwd!!
-                if(!TextUtils.isEmpty(password)&&password.length==6){
+                password = pwd!!
+                if (!TextUtils.isEmpty(password) && password.length == 6) {
 
-                    var money=etMoney.text.toString().trim()
-                    if(TextUtils.isEmpty(money)){
+                    var money = etMoney.text.toString().trim()
+                    if (TextUtils.isEmpty(money)) {
                         toast("请输入支付金额")
                         return
                     }
-                    getInfoPay(money,order_id,password)
+                    getInfoPay(money, order_id, password)
                     mNormalPopup.dismiss()
                 }
             }
@@ -403,16 +397,16 @@ open class WaybillDetailsVModel : BViewModel<BRepository>() {
 
 
         butSure.setOnClickListener {
-            var money=etMoney.text.toString().trim()
-            if(TextUtils.isEmpty(money)){
+            var money = etMoney.text.toString().trim()
+            if (TextUtils.isEmpty(money)) {
                 toast("请输入支付金额")
                 return@setOnClickListener
             }
 
-            if(!TextUtils.isEmpty(password)&&password.length==6){
-                getInfoPay(money,order_id,password)
+            if (!TextUtils.isEmpty(password) && password.length == 6) {
+                getInfoPay(money, order_id, password)
                 mNormalPopup.dismiss()
-            }else{
+            } else {
                 toast("请输入支付密码")
                 return@setOnClickListener
             }
@@ -424,7 +418,7 @@ open class WaybillDetailsVModel : BViewModel<BRepository>() {
         }
         builder.release();
 
-        val size= QMUIDisplayHelper.getScreenWidth(repository().context)
+        val size = QMUIDisplayHelper.getScreenWidth(repository().context)
 
         val lp: FrameLayout.LayoutParams = FrameLayout.LayoutParams(size,
                 FrameLayout.LayoutParams.WRAP_CONTENT)
@@ -441,26 +435,25 @@ open class WaybillDetailsVModel : BViewModel<BRepository>() {
     }
 
 
-    fun getInfoPay(money:String,order_id: String,pay_pwd:String) {
-        repository().lreq(NetEngine.service.carPay(money,order_id,pay_pwd))
+    fun getInfoPay(money: String, order_id: String, pay_pwd: String) {
+        repository().rxLreq(NetEngine.service.carPay(money, order_id, pay_pwd))
                 .doOnNext() {
                     if (it.ok(true)) {
-                        order_state=40
-                        tvTitle.value= "待评价"
+                        order_state = 40
+                        tvTitle.value = "待评价"
                     }
 
                 }
                 .subscribe()
     }
 
-    fun changeComment(){//发表完评论改变状态
-        order_state=50
-        tvTitle.value="查看评价"
+    fun changeComment() {//发表完评论改变状态
+        order_state = 50
+        tvTitle.value = "查看评价"
 
     }
 
 
-
 }
 
 

+ 1 - 1
base/src/main/java/com/ysnows/base/base/BActivity.kt

@@ -140,7 +140,7 @@ abstract class BActivity<VM : BViewModel<*>, B : ViewDataBinding> : RxAppCompatA
     override fun setStatusBar() = if (transluent()) {
         QMUIStatusBarHelper.translucent(this)
     } else {
-        StatusBarUtil.setColor(this, resources.getColor(R.color.colorPrimary), 1)
+        StatusBarUtil.setColor(this, resources.getColor(R.color.white), 1)
     }
 
     override fun initView(view: View?) {

+ 4 - 0
base/src/main/java/com/ysnows/base/base/BRepository.kt

@@ -46,6 +46,10 @@ open class BRepository : IRepository {
         return rxReq(observable, pageReq = false, loading = true)
     }
 
+    fun <D, T : IResp<D>?> rxPreq(observable: Observable<T>): Observable<T> {
+        return rxReq(observable, pageReq = true, loading = false)
+    }
+
 
     fun <D, T : IResp<D>?> rxReq(observable: Observable<T>): Observable<T> {
         return rxReq(observable, pageReq = false, loading = false)