新增党员认证,红色方向盘,运单跳转逻辑优化

This commit is contained in:
lijia 2024-03-15 16:08:47 +08:00
parent a4dda3564b
commit 8186bc25db
34 changed files with 498 additions and 121 deletions

View File

@ -135,6 +135,9 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//
implementation 'me.zhanghai.android.materialratingbar:library:1.4.0'
implementation project(path: ':mylibrary') implementation project(path: ':mylibrary')
// //

View File

@ -64,8 +64,8 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.GLDriver" android:theme="@style/Theme.GLDriver"
tools:targetApi="31" android:usesCleartextTraffic="true"
android:usesCleartextTraffic="true"> tools:targetApi="31">
<meta-data <meta-data
android:name="CHANNEL" android:name="CHANNEL"
@ -211,6 +211,11 @@
android:configChanges="keyboardHidden|orientation|locale" android:configChanges="keyboardHidden|orientation|locale"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden" /> android:windowSoftInputMode="adjustPan|stateHidden" />
<activity
android:name=".ui.waybill.activity.WaybillRateActivity"
android:configChanges="keyboardHidden|orientation|locale"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden" />
<activity <activity
android:name=".ui.waybill.activity.WaybillUnlLoadActivity" android:name=".ui.waybill.activity.WaybillUnlLoadActivity"

View File

@ -31,6 +31,12 @@ class WaybillListAdapter :
setText(R.id.tvMoney,it.driverFreight) setText(R.id.tvMoney,it.driverFreight)
setText(R.id.tvComName,it.realCompanyName) setText(R.id.tvComName,it.realCompanyName)
setText(R.id.btnOk,OrderUtils.getInstance().getNextByStatu(it.orderStatus)) setText(R.id.btnOk,OrderUtils.getInstance().getNextByStatu(it.orderStatus))
setGone(R.id.btnOk,!(it.orderStatus=="102040"||it.orderStatus=="102050"||it.orderStatus=="102070"||it.orderStatus=="102090"))
if (it.orderStatus=="102070"||it.orderStatus=="102090"){
//待结算,已完成
setGone(R.id.btnOk,it.driverEvaluationStatus=="1")
}
ImageLoader.getInstance() ImageLoader.getInstance()

View File

@ -39,6 +39,8 @@ data class OrderBean(
val vehicleLength: String= "", val vehicleLength: String= "",
val vehicleType: String = "", val vehicleType: String = "",
val goodItemGrossWeight: String = "", val goodItemGrossWeight: String = "",
val driverEvaluationStatus: String = "",//司机评价状态0=未评价1=已评价)
val shipperEvaluationStatus: String = "",//货主评价状态0=未评价1=已评价)
val goodName: String = "", val goodName: String = "",
val vehicleNum: String = "" val vehicleNum: String = ""
) )

View File

@ -201,3 +201,28 @@ data class Material(
) )
/**
* 评价运单
* @property opinionsContent String
* @property opinionsStarRating Int
* @property orderId Int
* @property resourcesList List<Resources>
* @constructor
*/
data class UpRate(
var opinionsContent: String = "",
var opinionsStarRating: String= "",
var orderId: String= "",
var resourcesList: MutableList<Resources> = mutableListOf()
)
data class Resources(
var resourcesSort: String= "",
var resourcesType: String= "",
var resourcesUrl: String= ""
)

View File

@ -0,0 +1,14 @@
package com.dahe.gldriver.callback
import com.dahe.gldriver.bean.OcrPersonBean
import com.luck.picture.lib.entity.LocalMedia
/**
* @ClassName OnOcrPicResultListener
* @Author john
* @Date 2024/2/28 17:18
* @Description TODO
*/
fun interface OnResultListener {
fun onResult(success:Boolean)
}

View File

@ -19,6 +19,7 @@ import com.dahe.gldriver.bean.UpPart
import com.dahe.gldriver.bean.UpPersonInfoBean import com.dahe.gldriver.bean.UpPersonInfoBean
import com.dahe.gldriver.bean.UpPicBean import com.dahe.gldriver.bean.UpPicBean
import com.dahe.gldriver.bean.UpQualiInfoBean import com.dahe.gldriver.bean.UpQualiInfoBean
import com.dahe.gldriver.bean.UpRate
import com.dahe.gldriver.bean.UpRoadInfoBean import com.dahe.gldriver.bean.UpRoadInfoBean
import com.dahe.glex.bean.* import com.dahe.glex.bean.*
import com.dahe.mylibrary.net.CommonResponseBean import com.dahe.mylibrary.net.CommonResponseBean
@ -175,14 +176,14 @@ interface Api {
* @return Observable<CommonResponseBean<String>> * @return Observable<CommonResponseBean<String>>
*/ */
@POST(BASE_URL+"driver/driver/submitToCpcAuthentication") @POST(BASE_URL+"driver/driver/submitToCpcAuthentication")
fun submitToCpcAuthentication(@Body upPart: UpPart): Observable<CommonResponseBean<String>> fun submitToCpcAuthentication(@Body upPart: UpPart): Observable<CommonResponseBean<Any>>
/** /**
* 查询党员认证资料 * 查询党员认证资料
* @param upPart UpPart * @param upPart UpPart
* @return Observable<CommonResponseBean<String>> * @return Observable<CommonResponseBean<String>>
*/ */
@POST(BASE_URL+"driver/driver/getCpcAuthenticationInfo") @GET(BASE_URL+"driver/driver/getCpcAuthenticationInfo")
fun getCpcAuthenticationInfo(): Observable<CommonResponseBean<UpPart>> fun getCpcAuthenticationInfo(): Observable<CommonResponseBean<UpPart>>
@ -218,7 +219,7 @@ interface Api {
fun receivingOrders( fun receivingOrders(
@Query("orderId") orderId: String, @Query("orderId") orderId: String,
@Query("carId") carId: String @Query("carId") carId: String
): Observable<CommonResponseBean<String>> ): Observable<CommonResponseBean<Any>>
/** /**
* 司机装卸货 * 司机装卸货
@ -226,7 +227,16 @@ interface Api {
@POST(BASE_URL + "driver/driverWaybill/driverLoadOrUnload") @POST(BASE_URL + "driver/driverWaybill/driverLoadOrUnload")
fun driverLoadOrUnload( fun driverLoadOrUnload(
@Body upPicBean: UpPicBean @Body upPicBean: UpPicBean
): Observable<CommonResponseBean<String>> ): Observable<CommonResponseBean<Any>>
/**
* 评价运单
* @param upRate UpRate
* @return Observable<CommonResponseBean<Any>>
*/
@POST(BASE_URL+"driver/opinions/submitComments")
fun submitComments(@Body upRate: UpRate):Observable<CommonResponseBean<Any>>
/** /**
@ -235,7 +245,7 @@ interface Api {
* @return Observable<CommonResponseBean<String>> * @return Observable<CommonResponseBean<String>>
*/ */
@GET(BASE_URL + "driver/driver/setUpDriverRole") @GET(BASE_URL + "driver/driver/setUpDriverRole")
fun setUpDriverRole(@Query("role") role: String): Observable<CommonResponseBean<String>> fun setUpDriverRole(@Query("role") role: String): Observable<CommonResponseBean<Any>>
/** /**
@ -257,14 +267,14 @@ interface Api {
* 解绑车辆 * 解绑车辆
* */ * */
@POST(BASE_URL + "driver/car/unBindCar") @POST(BASE_URL + "driver/car/unBindCar")
fun unBindCar(@Body carBean: CarBean): Observable<CommonResponseBean<String>> fun unBindCar(@Body carBean: CarBean): Observable<CommonResponseBean<Any>>
/** /**
* *
* 绑定车辆 * 绑定车辆
* */ * */
@POST(BASE_URL + "driver/car/bindCar") @POST(BASE_URL + "driver/car/bindCar")
fun bindCar(@Body carBean: CarBean): Observable<CommonResponseBean<String>> fun bindCar(@Body carBean: CarBean): Observable<CommonResponseBean<Any>>
/** /**
* *
@ -315,7 +325,7 @@ interface Api {
* @return Observable<CommonResponseBean<String>> * @return Observable<CommonResponseBean<String>>
*/ */
@POST(BASE_URL + "driver/driver/responseToCaptain") @POST(BASE_URL + "driver/driver/responseToCaptain")
fun responseToCaptain(@Body upCaptain: UpCaptain): Observable<CommonResponseBean<String>> fun responseToCaptain(@Body upCaptain: UpCaptain): Observable<CommonResponseBean<Any>>
/** /**
* 司机退出车队 * 司机退出车队
@ -323,7 +333,7 @@ interface Api {
* @return Observable<CommonResponseBean<String>> * @return Observable<CommonResponseBean<String>>
*/ */
@POST(BASE_URL + "driver/captain/unbindDriver") @POST(BASE_URL + "driver/captain/unbindDriver")
fun unbindDriver(@Body upCaptain: UpCaptain): Observable<CommonResponseBean<String>> fun unbindDriver(@Body upCaptain: UpCaptain): Observable<CommonResponseBean<Any>>
/** /**

View File

@ -10,6 +10,7 @@ import com.dahe.mylibrary.net.ResultException
import com.dahe.mylibrary.utils.LoadingUtils import com.dahe.mylibrary.utils.LoadingUtils
import com.dahe.mylibrary.utils.ToastUtils import com.dahe.mylibrary.utils.ToastUtils
import com.lxj.xpopup.impl.LoadingPopupView import com.lxj.xpopup.impl.LoadingPopupView
import org.json.JSONException
import java.net.ConnectException import java.net.ConnectException
import java.net.SocketTimeoutException import java.net.SocketTimeoutException
import java.net.UnknownHostException import java.net.UnknownHostException
@ -122,9 +123,12 @@ abstract class RxHttpCallBack<T> {
e.printStackTrace() e.printStackTrace()
//自定义的ResultException //自定义的ResultException
//由于返回200,300返回格式不统一的问题自定义GsonResponseBodyConverter凡是300的直接抛异常 //由于返回200,300返回格式不统一的问题自定义GsonResponseBodyConverter凡是300的直接抛异常
ToastUtils.showToast(mContext, "请检查您的网络~")
// System.out.println("---------errorCode------->"+((ResultException) e).getErrCode()); // System.out.println("---------errorCode------->"+((ResultException) e).getErrCode());
} else if (e is SSLException) { } else if (e is SSLException) {
ToastUtils.showToast(mContext, "网络连接终端,请检查您的网络~") ToastUtils.showToast(mContext, "网络连接终端,请检查您的网络~")
}else if (e is JSONException) {
ToastUtils.showToast(mContext, "数据格式转换异常~")
} else { } else {
ToastUtils.showToast(mContext, e.message) ToastUtils.showToast(mContext, e.message)
} }

View File

@ -7,10 +7,6 @@ import com.dahe.gldriver.databinding.ActivityAuthSuccBinding
import com.dahe.gldriver.ui.HomeActivity import com.dahe.gldriver.ui.HomeActivity
import com.dahe.gldriver.ui.account.authperson.AuthDrivingActivity import com.dahe.gldriver.ui.account.authperson.AuthDrivingActivity
import com.dahe.gldriver.ui.mine.activity.CarsManActivity import com.dahe.gldriver.ui.mine.activity.CarsManActivity
import com.dahe.gldriver.ui.waybill.activity.WaybillDetailActivity
import com.dahe.gldriver.ui.waybill.activity.WaybillLoadActivity
import com.dahe.gldriver.ui.waybill.activity.WaybillUnlLoadActivity
import com.dahe.gldriver.ui.waybill.activity.WaybillUpPicActivity
import com.dahe.mylibrary.base.BaseActivity import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.utils.ActivityUtils import com.dahe.mylibrary.utils.ActivityUtils
import com.dahe.mylibrary.utils.BaseUtils import com.dahe.mylibrary.utils.BaseUtils
@ -51,7 +47,7 @@ class AuthSuccActivity : BaseActivity<ActivityAuthSuccBinding>() {
if (isLeft) { if (isLeft) {
ActivityUtils.finishToActivity(HomeActivity::class.java, false) ActivityUtils.finishToActivity(HomeActivity::class.java, false)
} else { } else {
ActivityUtils.finishToActivity(mContext,CarsManActivity::class.java,AuthDrivingActivity::class.java,false) ActivityUtils.finishToActivityAndGoNew(mContext,CarsManActivity::class.java,AuthDrivingActivity::class.java,false)
} }
} }
} }

View File

@ -46,8 +46,8 @@ class SelectRoleActivity : BaseActivity<ActivitySelectRoleBinding>() {
DataManager.getInstance().setUpDriverRole("1") DataManager.getInstance().setUpDriverRole("1")
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<String>(this) { .subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>(this) {
override fun onSuccess(t: CommonResponseBean<String>) { override fun onSuccess(t: CommonResponseBean<Any>) {
super.onSuccess(t) super.onSuccess(t)
ActivityUtils.startActivity(mContext, AuthTeamActivity::class.java) ActivityUtils.startActivity(mContext, AuthTeamActivity::class.java)
} }

View File

@ -67,6 +67,25 @@ class AuthPartyActivity : BaseActivity<ActivityAuthPartyBinding>() {
} }
override fun initDate() { override fun initDate() {
DataManager.getInstance().getCpcAuthenticationInfo()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext,object :RxHttpCallBack<UpPart>(){
override fun onSuccess(t: CommonResponseBean<UpPart>) {
super.onSuccess(t)
t.data?.let {
upPart = it
binding.run {
tvData.text = it.partyMembershipTime
tvAddress.text = it.provinceCityArea
etAddress.setText(it.address)
ImageLoader.getInstance().loadRoundImage(mContext,it.materialList[0].materialUrl,12,ivUp)
}
}
}
}))
} }
private fun subMit() { private fun subMit() {
@ -78,12 +97,12 @@ class AuthPartyActivity : BaseActivity<ActivityAuthPartyBinding>() {
showToast("请完善信息") showToast("请完善信息")
return return
} }
upPart.address = binding.etAddress.text.toString()
DataManager.getInstance().submitToCpcAuthentication(upPart) DataManager.getInstance().submitToCpcAuthentication(upPart)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<String>() { .subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
override fun onSuccess(t: CommonResponseBean<String>) { override fun onSuccess(t: CommonResponseBean<Any>) {
super.onSuccess(t) super.onSuccess(t)
finish() finish()
} }

View File

@ -13,14 +13,10 @@ import com.dahe.gldriver.base.AppConfig
import com.dahe.gldriver.bean.CarBean import com.dahe.gldriver.bean.CarBean
import com.dahe.gldriver.bean.GridBean import com.dahe.gldriver.bean.GridBean
import com.dahe.gldriver.databinding.FragmentHomeBinding import com.dahe.gldriver.databinding.FragmentHomeBinding
import com.dahe.gldriver.event.OrderStauEvent
import com.dahe.gldriver.net.BaseObserver import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack import com.dahe.gldriver.net.RxHttpCallBack
import com.dahe.gldriver.ui.account.authperson.AuthDrivingActivity
import com.dahe.gldriver.ui.waybill.activity.WaybillDetailActivity import com.dahe.gldriver.ui.waybill.activity.WaybillDetailActivity
import com.dahe.gldriver.ui.waybill.activity.WaybillUpPicActivity
import com.dahe.gldriver.utils.CommonPopUtils
import com.dahe.gldriver.utils.OrderUtils import com.dahe.gldriver.utils.OrderUtils
import com.dahe.glex.bean.OrderBean import com.dahe.glex.bean.OrderBean
import com.dahe.mylibrary.base.BaseFragment import com.dahe.mylibrary.base.BaseFragment
@ -72,7 +68,6 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
gridView.run { gridView.run {
adapter = activity?.let { GridItemAdapter(it, gridDatas) } adapter = activity?.let { GridItemAdapter(it, gridDatas) }
setOnItemClickListener { adapterView, view, i, l -> setOnItemClickListener { adapterView, view, i, l ->
} }
} }
tvMar.isSelected = true tvMar.isSelected = true
@ -114,14 +109,6 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
})) }))
} }
@Subscribe
fun eventStatu(orderStauEvent: OrderStauEvent) {
if (orderStauEvent.statu == 1) {
initData()
}
}
private fun initRecy() { private fun initRecy() {
adapter = binding.recyclerView.run { adapter = binding.recyclerView.run {
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false) layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
@ -145,7 +132,11 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
Bundle().apply { putString(AppConfig.ORDER_ID, items[position].orderId) }) Bundle().apply { putString(AppConfig.ORDER_ID, items[position].orderId) })
} }
addOnItemChildClickListener(R.id.btnOk) { adapter, view, position -> addOnItemChildClickListener(R.id.btnOk) { adapter, view, position ->
OrderUtils.getInstance().goReceWaybill(mContext, items[position].orderId) OrderUtils.getInstance().goReceWaybill(mContext, items[position].orderId){
if (it){
initData()
}
}
// ActivityUtils.startActivity( // ActivityUtils.startActivity(
// mContext, // mContext,
// WaybillDetailActivity::class.java, // WaybillDetailActivity::class.java,
@ -155,13 +146,4 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
} }
override fun onStart() {
super.onStart()
EventBus.getDefault().register(this);
}
override fun onStop() {
super.onStop()
EventBus.getDefault().unregister(this);
}
} }

View File

@ -60,8 +60,8 @@ class CarsManActivity : BaseActivity<ActivityCarsManBinding>() {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( .subscribe(
BaseObserver(mContext, BaseObserver(mContext,
object : RxHttpCallBack<String>() { object : RxHttpCallBack<Any>() {
override fun onSuccess(t: CommonResponseBean<String>) { override fun onSuccess(t: CommonResponseBean<Any>) {
super.onSuccess(t) super.onSuccess(t)
unBindCar(items[position].carId) unBindCar(items[position].carId)
} }
@ -95,8 +95,8 @@ class CarsManActivity : BaseActivity<ActivityCarsManBinding>() {
this.carId = carId this.carId = carId
}) })
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<String>() { .subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
override fun onSuccess(t: CommonResponseBean<String>) { override fun onSuccess(t: CommonResponseBean<Any>) {
super.onSuccess(t) super.onSuccess(t)
initDate() initDate()
} }

View File

@ -167,8 +167,8 @@ class DriverTeamDetailActivity : BaseActivity<ActivityDriverTeamDetailBinding>()
driverId = SPUtils.instance.getUserInfo(mContext)!!.driverId driverId = SPUtils.instance.getUserInfo(mContext)!!.driverId
}) })
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<String>() { .subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
override fun onSuccess(t: CommonResponseBean<String>) { override fun onSuccess(t: CommonResponseBean<Any>) {
super.onSuccess(t) super.onSuccess(t)
setResult(RESULT_OK, Intent().apply { putExtra(AppConfig.REFRSH, true) }) setResult(RESULT_OK, Intent().apply { putExtra(AppConfig.REFRSH, true) })
finish() finish()
@ -181,8 +181,8 @@ class DriverTeamDetailActivity : BaseActivity<ActivityDriverTeamDetailBinding>()
reason = reject reason = reject
}) })
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<String>() { .subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
override fun onSuccess(t: CommonResponseBean<String>) { override fun onSuccess(t: CommonResponseBean<Any>) {
super.onSuccess(t) super.onSuccess(t)
setResult(RESULT_OK, Intent().apply { putExtra(AppConfig.REFRSH, true) }) setResult(RESULT_OK, Intent().apply { putExtra(AppConfig.REFRSH, true) })
finish() finish()

View File

@ -48,8 +48,8 @@ class WaybillFragment : BaseFragment<FragmentWaybillBinding>(), RefreshCallBack
"全部", "全部",
"待装货", "待装货",
"待卸货", "待卸货",
"评价", "结算",
"取消" "已完成"
) )
override fun onFragmentVisibleChange(isVisible: Boolean) { override fun onFragmentVisibleChange(isVisible: Boolean) {

View File

@ -51,17 +51,9 @@ class WaybillDetailActivity : BaseActivity<ActivityWaybillDetailBinding>() {
BaseUtils.callPhone(this@WaybillDetailActivity, "15838201105") BaseUtils.callPhone(this@WaybillDetailActivity, "15838201105")
} }
binding.btnReceiving.setOnClickListener { binding.btnReceiving.setOnClickListener {
OrderUtils.getInstance().goReceWaybill(mContext, orderId) OrderUtils.getInstance().goReceWaybill(mContext, orderId){
ActivityUtils.startActivity(mContext,WaybillSuccActivity::class.java,intent.extras)
// DataManager.getInstance().receivingOrders(orderId, "22") }
// .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
// .subscribe(BaseObserver(mContext, object : RxHttpCallBack<String>() {
// override fun onSuccess(t: CommonResponseBean<String>) {
// super.onSuccess(t)
// EventBus.getDefault().post(OrderStauEvent(1))
// }
// }))
} }
} }

View File

@ -17,6 +17,7 @@ import com.dahe.gldriver.adapter.WaybillNodeAdapter
import com.dahe.gldriver.base.AppConfig import com.dahe.gldriver.base.AppConfig
import com.dahe.gldriver.bean.OrderDetailBean import com.dahe.gldriver.bean.OrderDetailBean
import com.dahe.gldriver.databinding.ActivityWaybillLoadBinding import com.dahe.gldriver.databinding.ActivityWaybillLoadBinding
import com.dahe.gldriver.event.RefreshEvent
import com.dahe.gldriver.net.BaseObserver import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack import com.dahe.gldriver.net.RxHttpCallBack
@ -34,6 +35,7 @@ import com.dahe.mylibrary.utils.ToastUtils
import com.permissionx.guolindev.PermissionX import com.permissionx.guolindev.PermissionX
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers import io.reactivex.rxjava3.schedulers.Schedulers
import org.greenrobot.eventbus.EventBus
/** /**
@ -50,7 +52,9 @@ class WaybillLoadActivity : BaseActivity<ActivityWaybillLoadBinding>() {
lateinit var orderBean: OrderDetailBean lateinit var orderBean: OrderDetailBean
override fun initView(savedInstanceState: Bundle?) { override fun initView(savedInstanceState: Bundle?) {
setTitleBar("运单详情", View.OnClickListener { finish() }, true, "查看单据") { setTitleBar("运单详情", View.OnClickListener {
finish()
}, true, "查看单据") {
ToastUtils.showToast(mContext, "查看单据") ToastUtils.showToast(mContext, "查看单据")
} }

View File

@ -0,0 +1,90 @@
package com.dahe.gldriver.ui.waybill.activity
import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import com.dahe.gldriver.R
import com.dahe.gldriver.base.AppConfig
import com.dahe.gldriver.bean.Resources
import com.dahe.gldriver.bean.UpRate
import com.dahe.gldriver.bean.WaybillPhoto
import com.dahe.gldriver.databinding.ActivityWaybillRateBinding
import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack
import com.dahe.gldriver.oss.OssServiceUtil
import com.dahe.gldriver.utils.OcrUtils
import com.dahe.mylibrary.adapter.GridImageAdapter
import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.utils.ImageLoader
import com.dahe.mylibrary.utils.PopsUtils
import com.dahe.mylibrary.weight.FullyGridLayoutManager
import com.luck.picture.lib.decoration.GridSpacingItemDecoration
import com.luck.picture.lib.entity.LocalMedia
import com.luck.picture.lib.utils.DensityUtil
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
/**
* @ClassName WaybillRateActivtiy
* @Author john
* @Date 2024/3/14 16:36
* @Description TODO
*/
class WaybillRateActivity : BaseActivity<ActivityWaybillRateBinding>() {
private var upRate = UpRate()
override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white)
setTitleBar("评价", true)
binding.run {
rating.setOnRatingChangeListener { ratingBar, rating ->
upRate.opinionsStarRating = (rating.toInt() * 2).toString()
}
btnOk.setOnClickListener {
subMint()
}
ivAdd.setOnClickListener {
OcrUtils.getInstance()
.noOcrUpPic(mContext, this@WaybillRateActivity) { picPath, ocrResult ->
ImageLoader.getInstance()
.loadRoundImage(mContext, picPath.locPic, 12, ivAdd)
upRate.resourcesList.add(0, Resources().apply {
resourcesUrl = picPath.picPath
resourcesType = "0"
})
}
}
}
}
override fun initDate() {
}
private fun subMint() {
var orderID = intent.extras?.getString(AppConfig.ORDER_ID,"")
if (upRate.opinionsStarRating.isNullOrEmpty() ||
binding.etContent.text.isNullOrEmpty() ||
orderID.isNullOrEmpty() ||
upRate.resourcesList.size == 0
) {
showToast("请完善信息")
return
}
upRate.opinionsContent = binding.etContent.text.trim().toString()
upRate.orderId = orderID
DataManager.getInstance().submitComments(upRate)
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext,object : RxHttpCallBack<Any>(){
override fun onSuccess(t: CommonResponseBean<Any>) {
super.onSuccess(t)
finish()
}
}))
}
}

View File

@ -1,9 +1,11 @@
package com.dahe.gldriver.ui.waybill.activity package com.dahe.gldriver.ui.waybill.activity
import android.os.Bundle import android.os.Bundle
import android.view.View
import com.dahe.gldriver.R import com.dahe.gldriver.R
import com.dahe.gldriver.base.AppConfig import com.dahe.gldriver.base.AppConfig
import com.dahe.gldriver.databinding.ActivityWaybillSuccBinding import com.dahe.gldriver.databinding.ActivityWaybillSuccBinding
import com.dahe.gldriver.event.RefreshEvent
import com.dahe.gldriver.ui.HomeActivity import com.dahe.gldriver.ui.HomeActivity
import com.dahe.mylibrary.base.BaseActivity import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.utils.ActivityUtils import com.dahe.mylibrary.utils.ActivityUtils
@ -11,6 +13,7 @@ import com.dahe.mylibrary.utils.AppUtils
import com.dahe.mylibrary.utils.BaseUtils import com.dahe.mylibrary.utils.BaseUtils
import com.dahe.mylibrary.utils.TimeUtil import com.dahe.mylibrary.utils.TimeUtil
import com.dahe.mylibrary.utils.ToastUtils import com.dahe.mylibrary.utils.ToastUtils
import org.greenrobot.eventbus.EventBus
/** /**
* @ClassName WaybillSuccActivity * @ClassName WaybillSuccActivity
@ -19,17 +22,19 @@ import com.dahe.mylibrary.utils.ToastUtils
* @Description 接单 装货 卸货成功页面 * @Description 接单 装货 卸货成功页面
*/ */
class WaybillSuccActivity : BaseActivity<ActivityWaybillSuccBinding>() { class WaybillSuccActivity : BaseActivity<ActivityWaybillSuccBinding>() {
lateinit var orderId: String
override fun initView(savedInstanceState: Bundle?) { override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white) setStatusBarColor(R.color.white)
val type = intent.extras?.getInt(AppConfig.SUCCESS_TYPE) val type = intent.extras?.getInt(AppConfig.SUCCESS_TYPE)
setTitleBar(if (type==0) "接单成功" else if (type==1) "装货成功" else "卸货成功", true) orderId = intent.extras?.getString(AppConfig.ORDER_ID).toString()
setTitleBar(if (type == 0) "接单成功" else if (type == 1) "装货成功" else "卸货成功", true)
changeType(type) changeType(type)
binding.run { binding.run {
btnLeft.setOnClickListener { btnLeft.setOnClickListener {
goLeftOrRight(type,true) goLeftOrRight(type, true)
} }
btnRight.setOnClickListener { btnRight.setOnClickListener {
goLeftOrRight(type,false) goLeftOrRight(type, false)
} }
tvTime.text = TimeUtil.getNowString("") tvTime.text = TimeUtil.getNowString("")
@ -72,7 +77,8 @@ class WaybillSuccActivity : BaseActivity<ActivityWaybillSuccBinding>() {
}.setBackgroundResource(R.drawable.icon_succ_unload) }.setBackgroundResource(R.drawable.icon_succ_unload)
tvSucc.text = "恭喜您,卸货成功" tvSucc.text = "恭喜您,卸货成功"
btnLeft.text = "返回首页" btnLeft.text = "返回首页"
btnRight.text = "查看运单" btnRight.visibility = View.GONE
// btnRight.text = "查看运单"
} }
} }
} }
@ -82,16 +88,40 @@ class WaybillSuccActivity : BaseActivity<ActivityWaybillSuccBinding>() {
* *
* */ * */
private fun goLeftOrRight(type: Int?, isLeft: Boolean) { private fun goLeftOrRight(type: Int?, isLeft: Boolean) {
if (isLeft){ if (isLeft) {
when(type){ when (type) {
0->ActivityUtils.startActivity(mContext, WaybillLoadActivity::class.java) 0 -> ActivityUtils.finishToActivityAndGoNew(
1,2->ActivityUtils.finishToActivity(HomeActivity::class.java,false) mContext,
HomeActivity::class.java,
WaybillLoadActivity::class.java,
intent.extras,
false
)
1, 2 -> {
ActivityUtils.finishToActivity(HomeActivity::class.java, false)
EventBus.getDefault().post(RefreshEvent(type))
} }
}else{ }
when(type){ } else {
0->ActivityUtils.startActivity(mContext, WaybillUpPicActivity::class.java,Bundle().apply { putInt(AppConfig.SUCCESS_TYPE,1) }) when (type) {
1->ActivityUtils.startActivity(mContext, WaybillUnlLoadActivity::class.java) 0 -> ActivityUtils.finishToActivityAndGoNew(
2->ActivityUtils.startActivity(mContext, WaybillDetailActivity::class.java) mContext,
HomeActivity::class.java,
WaybillUpPicActivity::class.java,
intent.extras,
false
)
1 -> ActivityUtils.finishToActivityAndGoNew(
mContext,
HomeActivity::class.java,
WaybillUnlLoadActivity::class.java,
intent.extras,
false
)
2 -> ActivityUtils.finishToActivity(HomeActivity::class.java, false)
} }
} }
} }

View File

@ -100,7 +100,8 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
if (upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" } == null) { if (upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" } == null) {
upBean.waybillPhotoList.add(picBean) upBean.waybillPhotoList.add(picBean)
} else { } else {
upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" }!!.photoUrl = oldPath upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" }!!.photoUrl =
oldPath
} }
} }
} }
@ -126,7 +127,8 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
if (upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" } == null) { if (upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" } == null) {
upBean.waybillPhotoList.add(picBean) upBean.waybillPhotoList.add(picBean)
} else { } else {
upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" }!!.photoUrl = oldPath upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" }!!.photoUrl =
oldPath
} }
} }
} }
@ -172,7 +174,8 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
if (upBean.waybillPhotoList.find { it.type == "3" } == null) { if (upBean.waybillPhotoList.find { it.type == "3" } == null) {
upBean.waybillPhotoList.add(picBean) upBean.waybillPhotoList.add(picBean)
} else { } else {
upBean.waybillPhotoList.find { it.type == "3" }!!.photoUrl = oldPath upBean.waybillPhotoList.find { it.type == "3" }!!.photoUrl =
oldPath
} }
} }
} }
@ -199,7 +202,8 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
if (upBean.waybillPhotoList.find { it.type == "3" } == null) { if (upBean.waybillPhotoList.find { it.type == "3" } == null) {
upBean.waybillPhotoList.add(picBean) upBean.waybillPhotoList.add(picBean)
} else { } else {
upBean.waybillPhotoList.find { it.type == "3" }!!.photoUrl = oldPath upBean.waybillPhotoList.find { it.type == "3" }!!.photoUrl =
oldPath
} }
} }
} }
@ -246,19 +250,19 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
DataManager.getInstance().driverLoadOrUnload(upBean) DataManager.getInstance().driverLoadOrUnload(upBean)
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<String>() { .subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
override fun onSuccess(t: CommonResponseBean<String>) { override fun onSuccess(t: CommonResponseBean<Any>) {
super.onSuccess(t) super.onSuccess(t)
if (1 == type) { if (1 == type) {
ActivityUtils.startActivity( ActivityUtils.startActivity(
mContext, mContext,
WaybillSuccActivity::class.java, WaybillSuccActivity::class.java,
Bundle().apply { putInt(AppConfig.SUCCESS_TYPE, 1) }) intent.extras)
} else { } else {
ActivityUtils.startActivity( ActivityUtils.startActivity(
mContext, mContext,
WaybillSuccActivity::class.java, WaybillSuccActivity::class.java,
Bundle().apply { putInt(AppConfig.SUCCESS_TYPE, 2) }) intent.extras)
} }
} }
})) }))

View File

@ -13,6 +13,7 @@ import com.dahe.gldriver.databinding.FragmentWaybillListBinding
import com.dahe.gldriver.net.BaseObserver import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack import com.dahe.gldriver.net.RxHttpCallBack
import com.dahe.gldriver.ui.waybill.activity.WaybillRateActivity
import com.dahe.gldriver.utils.OrderUtils import com.dahe.gldriver.utils.OrderUtils
import com.dahe.glex.bean.OrderBean import com.dahe.glex.bean.OrderBean
import com.dahe.glex.bean.WayBillBean import com.dahe.glex.bean.WayBillBean
@ -20,6 +21,7 @@ import com.dahe.mylibrary.base.BaseFragment
import com.dahe.mylibrary.callback.RefreshCallBack import com.dahe.mylibrary.callback.RefreshCallBack
import com.dahe.mylibrary.net.CommonResponseBean import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
import com.dahe.mylibrary.utils.ActivityUtils
import com.dahe.mylibrary.utils.ConvertUtils import com.dahe.mylibrary.utils.ConvertUtils
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers import io.reactivex.rxjava3.schedulers.Schedulers
@ -28,7 +30,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers
* @ClassName AllWaybillFragment * @ClassName AllWaybillFragment
* @Author 用户 * @Author 用户
* @Date 2024/1/24 14:06 * @Date 2024/1/24 14:06
* @Description 取消运单 * @Description 取消运单-修改未已完成
*/ */
class CancelWaybillFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCallBack , class CancelWaybillFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCallBack ,
OnSearchListener { OnSearchListener {
@ -56,6 +58,10 @@ class CancelWaybillFragment : BaseFragment<FragmentWaybillListBinding>(), Refres
// 打开空布局功能 // 打开空布局功能
(adapter as WaybillListAdapter).isStateViewEnable = true (adapter as WaybillListAdapter).isStateViewEnable = true
adapter as WaybillListAdapter adapter as WaybillListAdapter
}.apply {
addOnItemChildClickListener(R.id.btnOk){_,_,position->
ActivityUtils.startActivity(mContext,WaybillRateActivity::class.java)
}
} }
} }
initData() initData()
@ -70,7 +76,7 @@ class CancelWaybillFragment : BaseFragment<FragmentWaybillListBinding>(), Refres
} }
private fun initData(search: String = "") { private fun initData(search: String = "") {
DataManager.getInstance().selectMyWaybillList(mRefreshPage, mRefreshCount, "103000",search) DataManager.getInstance().selectMyWaybillList(mRefreshPage, mRefreshCount, "102090",search)
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<MutableList<OrderBean>>() { .subscribe(BaseObserver(mContext, object : RxHttpCallBack<MutableList<OrderBean>>() {
override fun onSuccess(t: CommonResponseBean<MutableList<OrderBean>>) { override fun onSuccess(t: CommonResponseBean<MutableList<OrderBean>>) {

View File

@ -2,17 +2,20 @@ package com.dahe.gldriver.ui.waybill.fragment
import android.content.Context import android.content.Context
import android.graphics.Color import android.graphics.Color
import android.os.Bundle
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.dahe.gldriver.R import com.dahe.gldriver.R
import com.dahe.gldriver.adapter.WaybillListAdapter import com.dahe.gldriver.adapter.WaybillListAdapter
import com.dahe.gldriver.base.AppConfig
import com.dahe.gldriver.callback.OnSearchListener import com.dahe.gldriver.callback.OnSearchListener
import com.dahe.gldriver.databinding.FragmentWaybillBinding import com.dahe.gldriver.databinding.FragmentWaybillBinding
import com.dahe.gldriver.databinding.FragmentWaybillListBinding import com.dahe.gldriver.databinding.FragmentWaybillListBinding
import com.dahe.gldriver.net.BaseObserver import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack import com.dahe.gldriver.net.RxHttpCallBack
import com.dahe.gldriver.ui.waybill.activity.WaybillRateActivity
import com.dahe.gldriver.utils.OrderUtils import com.dahe.gldriver.utils.OrderUtils
import com.dahe.glex.bean.OrderBean import com.dahe.glex.bean.OrderBean
import com.dahe.glex.bean.WayBillBean import com.dahe.glex.bean.WayBillBean
@ -20,6 +23,7 @@ import com.dahe.mylibrary.base.BaseFragment
import com.dahe.mylibrary.callback.RefreshCallBack import com.dahe.mylibrary.callback.RefreshCallBack
import com.dahe.mylibrary.net.CommonResponseBean import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
import com.dahe.mylibrary.utils.ActivityUtils
import com.dahe.mylibrary.utils.ConvertUtils import com.dahe.mylibrary.utils.ConvertUtils
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers import io.reactivex.rxjava3.schedulers.Schedulers
@ -28,9 +32,9 @@ import io.reactivex.rxjava3.schedulers.Schedulers
* @ClassName AllWaybillFragment * @ClassName AllWaybillFragment
* @Author 用户 * @Author 用户
* @Date 2024/1/24 14:06 * @Date 2024/1/24 14:06
* @Description 待评价 * @Description 待评价-修改未待结算
*/ */
class WaitAppraiseFragment : BaseFragment<FragmentWaybillListBinding>() , RefreshCallBack , class WaitAppraiseFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCallBack,
OnSearchListener { OnSearchListener {
@ -56,6 +60,13 @@ class WaitAppraiseFragment : BaseFragment<FragmentWaybillListBinding>() , Refres
// 打开空布局功能 // 打开空布局功能
(adapter as WaybillListAdapter).isStateViewEnable = true (adapter as WaybillListAdapter).isStateViewEnable = true
adapter as WaybillListAdapter adapter as WaybillListAdapter
}.apply {
addOnItemChildClickListener(R.id.btnOk) { _, _, position ->
val orderBean = items[position]
ActivityUtils.startActivity(mContext,WaybillRateActivity::class.java, Bundle().apply {
putString(AppConfig.ORDER_ID,orderBean.orderId)
})
}
} }
} }
initData() initData()
@ -70,16 +81,16 @@ class WaitAppraiseFragment : BaseFragment<FragmentWaybillListBinding>() , Refres
} }
private fun initData(search: String = "") { private fun initData(search: String = "") {
DataManager.getInstance().selectMyWaybillList(mRefreshPage,mRefreshCount,"102080",search) DataManager.getInstance().selectMyWaybillList(mRefreshPage, mRefreshCount, "102070", search)
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<MutableList<OrderBean>>() { .subscribe(BaseObserver(mContext, object : RxHttpCallBack<MutableList<OrderBean>>() {
override fun onSuccess(t: CommonResponseBean<MutableList<OrderBean>>) { override fun onSuccess(t: CommonResponseBean<MutableList<OrderBean>>) {
super.onSuccess(t) super.onSuccess(t)
if (mRefreshPage === 1) { if (mRefreshPage === 1) {
if (t.data.size==0){ if (t.data.size == 0) {
adapter.submitList(null) adapter.submitList(null)
adapter.setStateViewLayout(mContext, R.layout.empty_view) adapter.setStateViewLayout(mContext, R.layout.empty_view)
}else{ } else {
adapter?.submitList(t.data) adapter?.submitList(t.data)
} }
} else { } else {
@ -91,7 +102,10 @@ class WaitAppraiseFragment : BaseFragment<FragmentWaybillListBinding>() , Refres
) )
} }
override fun onCodeError(mContext: Context?, t: CommonResponseBean<MutableList<OrderBean>>) { override fun onCodeError(
mContext: Context?,
t: CommonResponseBean<MutableList<OrderBean>>
) {
super.onCodeError(mContext, t) super.onCodeError(mContext, t)
setFinishRefresh( setFinishRefresh(
binding.refresh, binding.refresh,

View File

@ -13,6 +13,7 @@ import com.dahe.gldriver.base.AppConfig
import com.dahe.gldriver.callback.OnSearchListener import com.dahe.gldriver.callback.OnSearchListener
import com.dahe.gldriver.databinding.FragmentWaybillBinding import com.dahe.gldriver.databinding.FragmentWaybillBinding
import com.dahe.gldriver.databinding.FragmentWaybillListBinding import com.dahe.gldriver.databinding.FragmentWaybillListBinding
import com.dahe.gldriver.event.RefreshEvent
import com.dahe.gldriver.net.BaseObserver import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack import com.dahe.gldriver.net.RxHttpCallBack
@ -30,6 +31,8 @@ import com.dahe.mylibrary.utils.ActivityUtils
import com.dahe.mylibrary.utils.ConvertUtils import com.dahe.mylibrary.utils.ConvertUtils
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers import io.reactivex.rxjava3.schedulers.Schedulers
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
/** /**
* @ClassName AllWaybillFragment * @ClassName AllWaybillFragment
@ -48,6 +51,7 @@ class WaitLoadFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCall
} }
override fun onFragmentFirstVisible() { override fun onFragmentFirstVisible() {
EventBus.getDefault().register(this);
binding.run { binding.run {
setRefresh(refresh, this@WaitLoadFragment) setRefresh(refresh, this@WaitLoadFragment)
adapter = recyclerView.run { adapter = recyclerView.run {
@ -142,6 +146,17 @@ class WaitLoadFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCall
} }
})) }))
} }
@Subscribe
fun eventStatu(event: RefreshEvent) {
if (event.statu == 1) {
initData()
}
}
override fun onDestroy() {
super.onDestroy()
EventBus.getDefault().unregister(this);
}
} }

View File

@ -12,6 +12,7 @@ import com.dahe.gldriver.base.AppConfig
import com.dahe.gldriver.callback.OnSearchListener import com.dahe.gldriver.callback.OnSearchListener
import com.dahe.gldriver.databinding.FragmentWaybillBinding import com.dahe.gldriver.databinding.FragmentWaybillBinding
import com.dahe.gldriver.databinding.FragmentWaybillListBinding import com.dahe.gldriver.databinding.FragmentWaybillListBinding
import com.dahe.gldriver.event.RefreshEvent
import com.dahe.gldriver.net.BaseObserver import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack import com.dahe.gldriver.net.RxHttpCallBack
@ -29,6 +30,8 @@ import com.dahe.mylibrary.utils.ActivityUtils
import com.dahe.mylibrary.utils.ConvertUtils import com.dahe.mylibrary.utils.ConvertUtils
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers import io.reactivex.rxjava3.schedulers.Schedulers
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
/** /**
* @ClassName AllWaybillFragment * @ClassName AllWaybillFragment
@ -47,6 +50,7 @@ class WaitUnLoadFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCa
} }
override fun onFragmentFirstVisible() { override fun onFragmentFirstVisible() {
EventBus.getDefault().register(this);
binding.run { binding.run {
setRefresh(refresh, this@WaitUnLoadFragment) setRefresh(refresh, this@WaitUnLoadFragment)
adapter = recyclerView.run { adapter = recyclerView.run {
@ -141,4 +145,18 @@ class WaitUnLoadFragment : BaseFragment<FragmentWaybillListBinding>(), RefreshCa
} }
})) }))
} }
@Subscribe
fun eventStatu(event: RefreshEvent) {
if (event.statu == 2) {
initData()
}
}
override fun onDestroy() {
super.onDestroy()
EventBus.getDefault().unregister(this);
}
} }

View File

@ -42,7 +42,7 @@ class CommonPopUtils private constructor() {
.asConfirm( .asConfirm(
"去装货", """已选择:${carBean.vehicleNum},是否立即装货""", "去装货", """已选择:${carBean.vehicleNum},是否立即装货""",
"取消", "确定", "取消", "确定",
listener, null, true listener, null,false
) )
.show() .show()
} }

View File

@ -4,6 +4,7 @@ import android.content.Context
import android.os.Bundle import android.os.Bundle
import com.dahe.gldriver.base.AppConfig import com.dahe.gldriver.base.AppConfig
import com.dahe.gldriver.bean.CarBean import com.dahe.gldriver.bean.CarBean
import com.dahe.gldriver.callback.OnResultListener
import com.dahe.gldriver.net.BaseObserver import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack import com.dahe.gldriver.net.RxHttpCallBack
@ -13,7 +14,6 @@ import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.utils.ActivityUtils import com.dahe.mylibrary.utils.ActivityUtils
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers import io.reactivex.rxjava3.schedulers.Schedulers
import org.greenrobot.eventbus.EventBus
/** /**
* @ClassName OrderUtils * @ClassName OrderUtils
@ -35,7 +35,7 @@ class OrderUtils private constructor() {
"102050" -> "待卸货" "102050" -> "待卸货"
"102060" -> "待签收" "102060" -> "待签收"
"102070" -> "待结算" "102070" -> "待结算"
"102080" -> "待评价" "102090" -> "已完成"
"103000" -> "已取消" "103000" -> "已取消"
else -> { else -> {
"" ""
@ -52,8 +52,8 @@ class OrderUtils private constructor() {
"102040" -> "去装货" "102040" -> "去装货"
"102050" -> "去卸货" "102050" -> "去卸货"
"102060" -> "待签收" "102060" -> "待签收"
"102070" -> "待结算" "102070" -> "去评价"
"102080" -> "去评价" "102090" -> "去评价"
"103000" -> "已取消" "103000" -> "已取消"
else -> { else -> {
"" ""
@ -83,7 +83,7 @@ class OrderUtils private constructor() {
* *
* 接单包含选择车辆->装货 * 接单包含选择车辆->装货
* */ * */
fun goReceWaybill(context: Context, orderId: String) { fun goReceWaybill(context: Context, orderId: String,listener:OnResultListener) {
//选择车辆 //选择车辆
DataManager.getInstance().carList() DataManager.getInstance().carList()
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
@ -95,11 +95,11 @@ class OrderUtils private constructor() {
CommonPopUtils.getInstance() CommonPopUtils.getInstance()
.showCarList(context, t.data) { .showCarList(context, t.data) {
//接单接口 //接单接口
receivingOrders(context, orderId, it) receivingOrders(context, orderId, it,listener)
} }
} else { } else {
//单量车,直接默认当前车辆 ,接单接口 //单量车,直接默认当前车辆 ,接单接口
receivingOrders(context, orderId, t.data[0]) receivingOrders(context, orderId, t.data[0], listener)
} }
} }
}) })
@ -110,7 +110,12 @@ class OrderUtils private constructor() {
* *
*调用接单接口 *调用接单接口
* */ * */
private fun receivingOrders(context: Context, orderId: String, car: CarBean) { private fun receivingOrders(
context: Context,
orderId: String,
car: CarBean,
listener: OnResultListener
) {
DataManager.getInstance() DataManager.getInstance()
.receivingOrders(orderId, car.carId) .receivingOrders(orderId, car.carId)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
@ -118,9 +123,10 @@ class OrderUtils private constructor() {
.subscribe( .subscribe(
BaseObserver( BaseObserver(
context, context,
object : RxHttpCallBack<String>() { object : RxHttpCallBack<Any>() {
override fun onSuccess(t: CommonResponseBean<String>) { override fun onSuccess(t: CommonResponseBean<Any>) {
super.onSuccess(t) super.onSuccess(t)
listener.onResult(true)
//接单成功,弹窗是否去装货 //接单成功,弹窗是否去装货
CommonPopUtils.getInstance() CommonPopUtils.getInstance()
.showLoadPop(context, car) { .showLoadPop(context, car) {

View File

@ -126,8 +126,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@null" android:background="@null"
android:drawableRight="@drawable/right_gray" android:paddingRight="@dimen/dp_8"
android:drawablePadding="@dimen/dp_6"
android:hint="请输入详细地址" android:hint="请输入详细地址"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/sp_15" /> android:textSize="@dimen/sp_15" />

View File

@ -277,7 +277,6 @@
<LinearLayout <LinearLayout
android:visibility=""
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tvDriverInfo" android:layout_below="@+id/tvDriverInfo"

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/color_F5"
android:orientation="vertical">
<include layout="@layout/common_toolbar"></include>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_marginTop="@dimen/dp_18"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:padding="@dimen/dp_12">
<me.zhanghai.android.materialratingbar.MaterialRatingBar
android:id="@+id/rating"
style="@style/Widget.MaterialRatingBar.RatingBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:mrb_fillBackgroundStars="true"
app:mrb_progressTint="@color/main_red"
app:mrb_secondaryProgressTint="@color/main_red"
android:numStars="5"
android:stepSize="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:background="@color/white"
android:paddingBottom="@dimen/dp_20"
android:orientation="vertical">
<EditText
android:id="@+id/etContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:background="@null"
android:gravity="top|left"
android:hint="请输入您的评价内容"
android:lines="5"
android:padding="@dimen/dp_12"
android:textColor="@color/black" />
<ImageView
android:id="@+id/ivAdd"
android:layout_width="@dimen/dp_100"
android:layout_height="@dimen/dp_100"
android:background="@drawable/icon_add_pic"
android:layout_marginLeft="@dimen/dp_12"
/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_70"
android:background="@color/white"
android:gravity="center"
android:paddingLeft="@dimen/dp_15"
android:paddingRight="@dimen/dp_15">
<Button
android:id="@+id/btnOk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_btn"
android:text="提交"
android:textColor="@color/white"
android:textSize="@dimen/sp_17">
</Button>
</LinearLayout>
</LinearLayout>

View File

@ -528,7 +528,7 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/btnRight" android:layout_toLeftOf="@+id/btnRight"
android:background="@drawable/shape_btn_empty_bg" android:background="@drawable/shape_btn_empty_bg"
android:text="联系货人" android:text="联系货人"
android:textColor="@color/main_red" android:textColor="@color/main_red"
android:textSize="@dimen/sp_15" /> android:textSize="@dimen/sp_15" />

View File

@ -49,7 +49,7 @@ public class JsonInterceptor implements Interceptor {
JSONObject jsonObject = new JSONObject(responseBodyStr); JSONObject jsonObject = new JSONObject(responseBodyStr);
String str = jsonObject.optString("data"); String str = jsonObject.optString("data");
int code = jsonObject.optInt("code"); int code = jsonObject.optInt("code");
// if (-1 == code) { // if (500 == code) {
// jsonObject.put("data", new JSONObject()); // jsonObject.put("data", new JSONObject());
// throw new ResultException(); // throw new ResultException();
// } else { // } else {
@ -57,10 +57,9 @@ public class JsonInterceptor implements Interceptor {
// jsonObject.put("data", new JSONObject()); // jsonObject.put("data", new JSONObject());
// } // }
// } // }
if (code != 200) {
if (TextUtils.isEmpty(str)) { if (TextUtils.isEmpty(str)) {
jsonObject.put("data", new String()); jsonObject.put("data", new JSONObject());
}
} }
String data = jsonObject.toString(); String data = jsonObject.toString();

View File

@ -5,8 +5,6 @@ import android.widget.Button
import com.dahe.mylibrary.R import com.dahe.mylibrary.R
import com.dahe.mylibrary.adapter.GridImageAdapter import com.dahe.mylibrary.adapter.GridImageAdapter
import com.dahe.mylibrary.callback.OnPicResultListener import com.dahe.mylibrary.callback.OnPicResultListener
import com.dahe.mylibrary.utils.SelectPicUtils
import com.dahe.mylibrary.utils.ToastUtils
import com.dahe.mylibrary.weight.GlideEngine import com.dahe.mylibrary.weight.GlideEngine
import com.dahe.mylibrary.weight.ImageFileCompressEngine import com.dahe.mylibrary.weight.ImageFileCompressEngine
import com.luck.picture.lib.basic.PictureSelectionCameraModel import com.luck.picture.lib.basic.PictureSelectionCameraModel
@ -17,7 +15,7 @@ import com.luck.picture.lib.config.SelectModeConfig
import com.luck.picture.lib.entity.LocalMedia import com.luck.picture.lib.entity.LocalMedia
import com.luck.picture.lib.interfaces.OnResultCallbackListener import com.luck.picture.lib.interfaces.OnResultCallbackListener
import com.lxj.xpopup.core.BottomPopupView import com.lxj.xpopup.core.BottomPopupView
import kotlin.math.min import kotlin.properties.Delegates
/** /**
* @ClassName PopBottomPic * @ClassName PopBottomPic
@ -27,6 +25,7 @@ import kotlin.math.min
*/ */
class PopBottomPic( class PopBottomPic(
context: Context, context: Context,
num: Int = 1,
myAdapter: GridImageAdapter, myAdapter: GridImageAdapter,
onPicResultListener: OnPicResultListener onPicResultListener: OnPicResultListener
) : BottomPopupView(context) { ) : BottomPopupView(context) {
@ -34,10 +33,12 @@ class PopBottomPic(
private var listener: OnPicResultListener private var listener: OnPicResultListener
var myAdapter: GridImageAdapter var myAdapter: GridImageAdapter
var num by Delegates.notNull<Int>()
init { init {
this.listener = onPicResultListener this.listener = onPicResultListener
this.myAdapter = myAdapter this.myAdapter = myAdapter
this.num = num
} }
@ -91,7 +92,7 @@ class PopBottomPic(
.setCompressEngine(ImageFileCompressEngine()) .setCompressEngine(ImageFileCompressEngine())
.isPreviewImage(true) .isPreviewImage(true)
.isMaxSelectEnabledMask(true) .isMaxSelectEnabledMask(true)
.setMaxSelectNum(1) .setMaxSelectNum(num)
.isGif(false) .isGif(false)
.setSelectionMode(SelectModeConfig.SINGLE) .setSelectionMode(SelectModeConfig.SINGLE)
.setSelectedData(myAdapter.data) .setSelectedData(myAdapter.data)

View File

@ -291,7 +291,7 @@ public class ActivityUtils {
* *
* @param isIncludeSelf 是否结束该activity自己 * @param isIncludeSelf 是否结束该activity自己
*/ */
public static boolean finishToActivity(Context ctx ,@NonNull final Class<?> clz,@NonNull final Class<?> newclz, public static boolean finishToActivityAndGoNew(Context ctx ,@NonNull final Class<?> clz,@NonNull final Class<?> newclz,
final boolean isIncludeSelf) { final boolean isIncludeSelf) {
List<Activity> activities = CommonBaseLibrary.activityList; List<Activity> activities = CommonBaseLibrary.activityList;
for (int i = activities.size() - 1; i >= 0; --i) { for (int i = activities.size() - 1; i >= 0; --i) {
@ -310,6 +310,30 @@ public class ActivityUtils {
return false; return false;
} }
/**
* 结束到指定Activity,并进入指定页面
*
* @param isIncludeSelf 是否结束该activity自己
*/
public static boolean finishToActivityAndGoNew(Context ctx ,@NonNull final Class<?> clz,@NonNull final Class<?> newclz,Bundle bundle,
final boolean isIncludeSelf) {
List<Activity> activities = CommonBaseLibrary.activityList;
for (int i = activities.size() - 1; i >= 0; --i) {
Activity aActivity = activities.get(i);
if (aActivity.getClass().equals(clz)) {
if (isIncludeSelf) {
finishActivity(aActivity);
}
startActivity(ctx,newclz,bundle);
return true;
} else {
finishActivity(aActivity);
}
// finishActivity(aActivity);
}
return false;
}
/** /**
* 结束除最新之外的同类型Activity * 结束除最新之外的同类型Activity
* <p>也就是让栈中最多只剩下一种类型的Activity</p> * <p>也就是让栈中最多只剩下一种类型的Activity</p>

View File

@ -30,11 +30,25 @@ class PopsUtils private constructor(){
fun showSelPic(ctx: Context,myAdapter: GridImageAdapter, listenter: OnPicResultListener){ fun showSelPic(ctx: Context,myAdapter: GridImageAdapter, listenter: OnPicResultListener){
XPopup.Builder(ctx) XPopup.Builder(ctx)
.dismissOnTouchOutside(true) .dismissOnTouchOutside(true)
.asCustom(PopBottomPic(ctx, myAdapter, listenter)) .asCustom(PopBottomPic(ctx,1, myAdapter, listenter))
.show() .show()
} }
/**
* 选择照片并设置最大选中数量
*
* @param myAdapter
* @param listenter 结果回调
*/
fun showNorSelPicAndNum(ctx: Context,num: Int = 1,myAdapter: GridImageAdapter, listenter: OnPicResultListener){
// XPopup.Builder(ctx)
// .dismissOnTouchOutside(true)
// .asCustom(PopNorBottomPic(ctx,1, myAdapter, listenter))
// .show()
}
/** /**
* 选择照片 拍照或者相机 * 选择照片 拍照或者相机
* *