接单功能封装优化
This commit is contained in:
parent
8205238697
commit
cfc9b81650
@ -0,0 +1,39 @@
|
||||
package com.dahe.gldriver.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import android.widget.LinearLayout
|
||||
import com.chad.library.adapter4.BaseQuickAdapter
|
||||
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.bean.CarBean
|
||||
import com.dahe.glex.bean.WayBillBean
|
||||
|
||||
/**
|
||||
* @ClassName WaybillAdapter
|
||||
* @Author 用户
|
||||
* @Date 2024/1/23 16:27
|
||||
* @Description TODO
|
||||
*/
|
||||
class SelectCarAdapter :
|
||||
BaseQuickAdapter<CarBean, QuickViewHolder>() {
|
||||
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: CarBean?) {
|
||||
holder.run {
|
||||
setText(R.id.tvCarNum, item?.vehicleNum)
|
||||
setText(R.id.tvCarType, """${item?.vehicleType}""")
|
||||
setText(R.id.tvCarLen, """车长:${item?.carLong}""")
|
||||
setText(R.id.tvCarWei, """核定载重:${item?.approvedLoad}""")
|
||||
setSelected(R.id.llContent, item?.isSelect!!)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
context: Context,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): QuickViewHolder {
|
||||
// 返回一个 ViewHolder
|
||||
return QuickViewHolder(R.layout.item_car, parent)
|
||||
}
|
||||
}
|
33
app/src/main/java/com/dahe/gldriver/bean/CarBean.kt
Normal file
33
app/src/main/java/com/dahe/gldriver/bean/CarBean.kt
Normal file
@ -0,0 +1,33 @@
|
||||
package com.dahe.gldriver.bean
|
||||
|
||||
/**
|
||||
* @ClassName CarBean
|
||||
* @Author john
|
||||
* @Date 2024/3/6 10:26
|
||||
* @Description TODO
|
||||
*/
|
||||
data class CarBean(
|
||||
val approvedLoad: String="",
|
||||
val carHeight: String="",
|
||||
val carId: String="",
|
||||
val carLong: String="",
|
||||
val carUrl: String="",
|
||||
val carWidth: String="",
|
||||
val energySign: String="",
|
||||
val energySignCode: String="",
|
||||
val isTrailer: String="",
|
||||
val plateColor: String="",
|
||||
val plateColorCode: String="",
|
||||
val trailerApprovedLoad: String="",
|
||||
val trailerHeight: String="",
|
||||
val trailerId: String="",
|
||||
val trailerLong: String="",
|
||||
val trailerUrl: String="",
|
||||
val trailerVehicleNum: String="",
|
||||
val trailerVehicleType: String="",
|
||||
val trailerVehicleTypeCode: String="",
|
||||
var vehicleNum: String="",
|
||||
val vehicleType: String="",
|
||||
val vehicleTypeCode: String="",
|
||||
var isSelect: Boolean = false
|
||||
)
|
93
app/src/main/java/com/dahe/gldriver/mypop/PopBottomCar.kt
Normal file
93
app/src/main/java/com/dahe/gldriver/mypop/PopBottomCar.kt
Normal file
@ -0,0 +1,93 @@
|
||||
package com.dahe.gldriver.mypop
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.widget.Button
|
||||
import android.widget.LinearLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.chad.library.adapter4.BaseQuickAdapter
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.adapter.SelectCarAdapter
|
||||
import com.dahe.gldriver.bean.CarBean
|
||||
import com.dahe.mylibrary.adapter.GridImageAdapter
|
||||
import com.dahe.mylibrary.callback.OnPicResultListener
|
||||
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
|
||||
import com.dahe.mylibrary.utils.ConvertUtils
|
||||
import com.luck.picture.lib.entity.LocalMedia
|
||||
import com.lxj.xpopup.core.BottomPopupView
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName PopBottomPic
|
||||
* @Author john
|
||||
* @Date 2024/1/31 11:11
|
||||
* @Description TODO
|
||||
*/
|
||||
class PopBottomCar(
|
||||
context: Context,
|
||||
cars: MutableList<CarBean>,
|
||||
onCarSelectListener: OnCarSelectListener
|
||||
) : BottomPopupView(context) {
|
||||
|
||||
private var cars: MutableList<CarBean>
|
||||
private var listener: OnCarSelectListener
|
||||
private var currCar: CarBean? = null
|
||||
|
||||
init {
|
||||
this.listener = onCarSelectListener
|
||||
this.cars = cars
|
||||
}
|
||||
|
||||
|
||||
override fun getImplLayoutId() = R.layout.choice_car
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
var recycler = findViewById<RecyclerView>(R.id.recycler)
|
||||
var btnOk = findViewById<Button>(R.id.btnOk)
|
||||
initRecycle(recycler)
|
||||
|
||||
btnOk.setOnClickListener {
|
||||
if (currCar == null) {
|
||||
dismiss()
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
if (listener != null) {
|
||||
listener.onResult(currCar!!)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun initRecycle(recycler: RecyclerView) {
|
||||
recycler.run {
|
||||
layoutManager = LinearLayoutManager(context, RecyclerView.VERTICAL, false)
|
||||
setHasFixedSize(true)
|
||||
addItemDecoration(
|
||||
RecycleViewDivider(
|
||||
LinearLayout.VERTICAL,
|
||||
ConvertUtils.dp2px(10.0f),
|
||||
Color.TRANSPARENT
|
||||
)
|
||||
)
|
||||
adapter = SelectCarAdapter()
|
||||
(adapter as SelectCarAdapter).submitList(cars)
|
||||
(adapter as SelectCarAdapter)
|
||||
}.run {
|
||||
setOnItemClickListener() { adapter, view, position ->
|
||||
currCar = items[position]
|
||||
items.find { it.isSelect }?.isSelect = false
|
||||
items[position].isSelect = true
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun interface OnCarSelectListener {
|
||||
fun onResult(result: CarBean)
|
||||
}
|
@ -2,6 +2,7 @@ package com.dahe.gldriver.net
|
||||
|
||||
import com.dahe.gldriver.BuildConfig
|
||||
import com.dahe.gldriver.bean.AuthTeamBean
|
||||
import com.dahe.gldriver.bean.CarBean
|
||||
import com.dahe.gldriver.bean.OcrPersonBean
|
||||
import com.dahe.gldriver.bean.OrderDetailBean
|
||||
import com.dahe.gldriver.bean.OssBean
|
||||
@ -155,6 +156,13 @@ interface Api {
|
||||
@GET(BASE_URL + "driver/order/detail")
|
||||
fun orderDetail(@Query("orderId") orderId: String): Observable<CommonResponseBean<OrderDetailBean>>
|
||||
|
||||
/**
|
||||
*
|
||||
* 车辆列表
|
||||
* */
|
||||
@GET(BASE_URL+"driver/car/carList")
|
||||
fun carList(): Observable<CommonResponseBean<MutableList<CarBean>>>
|
||||
|
||||
/**
|
||||
* 司机接单
|
||||
* */
|
||||
|
@ -6,11 +6,7 @@ import com.dahe.gldriver.databinding.ActivitySelectRoleBinding
|
||||
import com.dahe.gldriver.net.BaseObserver
|
||||
import com.dahe.gldriver.net.DataManager
|
||||
import com.dahe.gldriver.net.RxHttpCallBack
|
||||
import com.dahe.gldriver.ui.account.authperson.AuthBankCardActivity
|
||||
import com.dahe.gldriver.ui.account.authperson.AuthDriverActivity
|
||||
import com.dahe.gldriver.ui.account.authperson.AuthDrivingActivity
|
||||
import com.dahe.gldriver.ui.account.authperson.AuthPersonActivity
|
||||
import com.dahe.gldriver.ui.account.authperson.AuthQualificationActivity
|
||||
import com.dahe.gldriver.ui.account.authteam.AuthTeamActivity
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
|
@ -3,7 +3,6 @@ package com.dahe.gldriver.ui.account.authperson
|
||||
import android.os.Bundle
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.bean.OcrPersonBean
|
||||
import com.dahe.gldriver.bean.OssBean
|
||||
import com.dahe.gldriver.bean.UpPersonInfoBean
|
||||
import com.dahe.gldriver.databinding.ActivityAuthPersonBinding
|
||||
import com.dahe.gldriver.net.BaseObserver
|
||||
@ -11,7 +10,6 @@ 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.glex.bean.UserBean
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
@ -20,7 +18,6 @@ import com.dahe.mylibrary.utils.PickerUtils
|
||||
import com.dahe.mylibrary.utils.PopsUtils
|
||||
import com.dahe.mylibrary.utils.TimeUtil
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.functions.Function
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.MultipartBody
|
||||
|
@ -5,8 +5,6 @@ import android.view.View
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.bean.AuthTeamBean
|
||||
import com.dahe.gldriver.bean.OcrPersonBean
|
||||
import com.dahe.gldriver.bean.UpPersonInfoBean
|
||||
import com.dahe.gldriver.callback.PicPath
|
||||
import com.dahe.gldriver.databinding.ActivityAuthTeamBinding
|
||||
import com.dahe.gldriver.net.BaseObserver
|
||||
import com.dahe.gldriver.net.DataManager
|
||||
@ -16,17 +14,11 @@ import com.dahe.gldriver.utils.OcrUtils
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import com.dahe.mylibrary.utils.ImageLoader
|
||||
import com.dahe.mylibrary.utils.LoadingUtils
|
||||
import com.dahe.mylibrary.utils.LoadingUtils3
|
||||
import com.dahe.mylibrary.utils.PickerUtils
|
||||
import com.dahe.mylibrary.utils.PopsUtils
|
||||
import com.dahe.mylibrary.utils.TimeUtil
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
import okhttp3.MultipartBody
|
||||
import okhttp3.RequestBody.Companion.asRequestBody
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* @ClassName AuthTeamActivity
|
||||
|
@ -5,11 +5,11 @@ import android.os.Bundle
|
||||
import android.widget.LinearLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.amap.api.services.route.DistanceSearch
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.adapter.GridItemAdapter
|
||||
import com.dahe.gldriver.adapter.WaybillAdapter
|
||||
import com.dahe.gldriver.base.AppConfig
|
||||
import com.dahe.gldriver.bean.CarBean
|
||||
import com.dahe.gldriver.bean.GridBean
|
||||
import com.dahe.gldriver.databinding.FragmentHomeBinding
|
||||
import com.dahe.gldriver.event.OrderStauEvent
|
||||
@ -17,8 +17,8 @@ import com.dahe.gldriver.net.BaseObserver
|
||||
import com.dahe.gldriver.net.DataManager
|
||||
import com.dahe.gldriver.net.RxHttpCallBack
|
||||
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.utils.CommonPopUtils
|
||||
import com.dahe.gldriver.utils.OrderUtils
|
||||
import com.dahe.glex.bean.OrderBean
|
||||
import com.dahe.mylibrary.base.BaseFragment
|
||||
import com.dahe.mylibrary.callback.RefreshCallBack
|
||||
@ -26,7 +26,6 @@ import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
import com.dahe.mylibrary.utils.ConvertUtils
|
||||
import com.flyco.tablayout.CommonTabLayout
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
@ -135,21 +134,14 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
||||
mContext,
|
||||
WaybillDetailActivity::class.java,
|
||||
Bundle().apply { putString(AppConfig.ORDER_ID, items[position].orderId) })
|
||||
|
||||
|
||||
}
|
||||
addOnItemChildClickListener(R.id.btnOk) { adapter, view, position ->
|
||||
OrderUtils.getInstance().goReceWaybill(mContext, items[position].orderId)
|
||||
// ActivityUtils.startActivity(
|
||||
// mContext,
|
||||
// WaybillDetailActivity::class.java,
|
||||
// Bundle().apply { putString(AppConfig.ORDER_ID, items[position].orderId) })
|
||||
}
|
||||
addOnItemChildClickListener(R.id.btnOk) { adapter, view, position ->
|
||||
|
||||
ActivityUtils.startActivity(
|
||||
mContext,
|
||||
WaybillDetailActivity::class.java,
|
||||
Bundle().apply { putString(AppConfig.ORDER_ID, items[position].orderId) })
|
||||
// ActivityUtils.startActivity(mContext, WaybillDetailActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import com.dahe.gldriver.net.DataManager
|
||||
import com.dahe.gldriver.net.RxHttpCallBack
|
||||
import com.dahe.gldriver.utils.GDLocationUtils
|
||||
import com.dahe.gldriver.utils.LocationUtils
|
||||
import com.dahe.gldriver.utils.OrderUtils
|
||||
import com.dahe.glex.bean.OrderBean
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
@ -54,14 +55,16 @@ class WaybillDetailActivity : BaseActivity<ActivityWaybillDetailBinding>() {
|
||||
BaseUtils.callPhone(this@WaybillDetailActivity, "15838201105")
|
||||
}
|
||||
binding.btnReceiving.setOnClickListener {
|
||||
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))
|
||||
}
|
||||
}))
|
||||
OrderUtils.getInstance().goReceWaybill(mContext, orderId)
|
||||
|
||||
// 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))
|
||||
// }
|
||||
// }))
|
||||
|
||||
}
|
||||
|
||||
@ -150,52 +153,6 @@ class WaybillDetailActivity : BaseActivity<ActivityWaybillDetailBinding>() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// private fun initXml(data: OrderDetailBean) {
|
||||
// val load = data.orderChildList.find { it.type == "1" }
|
||||
// val unLoad = data.orderChildList.find { it.type == "2" }
|
||||
//
|
||||
// binding.run {
|
||||
// tvTime.text = data.receiverDeadline
|
||||
// tvType.text = if (data.orderType == "0") "一装一卸" else "一装多卸"
|
||||
// tvLoad.text = load?.address
|
||||
// tvPhone.text = """${load?.name} ${load?.phone}"""
|
||||
//
|
||||
// tvUnload.text = unLoad?.address
|
||||
// tvUnloadPhone.text = """${unLoad?.name} ${unLoad?.phone}"""
|
||||
//
|
||||
//
|
||||
// tvCom.text = data?.receiverBusinessName
|
||||
// tvConsignor.text = data?.realCompanyName
|
||||
// tvFreight.text = data?.driverFreight.toString()
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// btnCall.setOnClickListener {
|
||||
//
|
||||
// PermissionX.init(this@WaybillDetailActivity)
|
||||
// .permissions(Manifest.permission.CALL_PHONE)
|
||||
// .request { allGranted, grantedList, deniedList ->
|
||||
// if (allGranted) {
|
||||
// BaseUtils.callPhone(
|
||||
// this@WaybillDetailActivity,
|
||||
// data.shipperContactPhone
|
||||
// )
|
||||
// } else {
|
||||
// Toast.makeText(
|
||||
// mContext,
|
||||
// "开启权限失败,请在应用设置-权限中打开电话权限",
|
||||
// Toast.LENGTH_SHORT
|
||||
// ).show()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
var adapter: WaybillNodeAdapter? = null
|
||||
private fun initRecy() {
|
||||
adapter = binding.recycler.run {
|
||||
@ -223,4 +180,8 @@ class WaybillDetailActivity : BaseActivity<ActivityWaybillDetailBinding>() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun receWaybill(){
|
||||
|
||||
}
|
||||
}
|
@ -41,7 +41,6 @@ class WaybillLoadActivity : BaseActivity<ActivityWaybillLoadBinding>() {
|
||||
var aMap: AMap? = null
|
||||
|
||||
var orderId: String = ""
|
||||
var waybillId: String = ""
|
||||
lateinit var orderBean: OrderDetailBean
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
|
||||
|
@ -1,6 +1,12 @@
|
||||
package com.dahe.gldriver.utils
|
||||
|
||||
import android.content.Context
|
||||
import com.dahe.gldriver.bean.CarBean
|
||||
import com.dahe.gldriver.mypop.OnCarSelectListener
|
||||
import com.dahe.gldriver.mypop.PopBottomCar
|
||||
import com.dahe.mylibrary.base.SingletonNoPHolder
|
||||
import com.lxj.xpopup.XPopup
|
||||
import com.lxj.xpopup.interfaces.OnConfirmListener
|
||||
|
||||
/**
|
||||
* @ClassName CommonPopUtils
|
||||
@ -8,10 +14,36 @@ import com.dahe.mylibrary.base.SingletonNoPHolder
|
||||
* @Date 2024/3/5 15:48
|
||||
* @Description TODO
|
||||
*/
|
||||
class CommonPopUtils private constructor(){
|
||||
class CommonPopUtils private constructor() {
|
||||
|
||||
companion object : SingletonNoPHolder<CommonPopUtils>(::CommonPopUtils)
|
||||
|
||||
|
||||
/**
|
||||
* 选择车辆
|
||||
* */
|
||||
fun showCarList(context: Context, cars: MutableList<CarBean>, listener: OnCarSelectListener) {
|
||||
XPopup.Builder(context)
|
||||
.isViewMode(true)
|
||||
// .isDestroyOnDismiss(true) //对于只使用一次的弹窗,推荐设置这个
|
||||
.asCustom(PopBottomCar(context, cars, listener))
|
||||
.show()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 装货弹框
|
||||
* */
|
||||
fun showLoadPop(context: Context,carBean: CarBean ,listener: OnConfirmListener) {
|
||||
XPopup.Builder(context)
|
||||
.isDestroyOnDismiss(true)
|
||||
.asConfirm(
|
||||
"去装货", """已选择:${carBean.vehicleNum},是否立即装货""",
|
||||
"取消", "确定",
|
||||
listener, null, true
|
||||
)
|
||||
.show()
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,20 @@
|
||||
package com.dahe.gldriver.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import com.dahe.gldriver.base.AppConfig
|
||||
import com.dahe.gldriver.bean.CarBean
|
||||
import com.dahe.gldriver.event.OrderStauEvent
|
||||
import com.dahe.gldriver.net.BaseObserver
|
||||
import com.dahe.gldriver.net.DataManager
|
||||
import com.dahe.gldriver.net.RxHttpCallBack
|
||||
import com.dahe.gldriver.ui.waybill.activity.WaybillLoadActivity
|
||||
import com.dahe.mylibrary.base.SingletonNoPHolder
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
/**
|
||||
* @ClassName OrderUtils
|
||||
@ -64,4 +78,62 @@ class OrderUtils private constructor() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 接单(包含选择车辆)->装货
|
||||
* */
|
||||
fun goReceWaybill(context: Context, orderId: String) {
|
||||
//选择车辆
|
||||
DataManager.getInstance().carList()
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
BaseObserver(context, object : RxHttpCallBack<MutableList<CarBean>>() {
|
||||
override fun onSuccess(t: CommonResponseBean<MutableList<CarBean>>) {
|
||||
super.onSuccess(t)
|
||||
if (t.data.size > 0) {//多辆车需选择车辆,单个车辆直接接单
|
||||
CommonPopUtils.getInstance()
|
||||
.showCarList(context, t.data) {
|
||||
//接单接口
|
||||
receivingOrders(context, orderId, it)
|
||||
}
|
||||
} else {
|
||||
//单量车,直接默认当前车辆 ,接单接口
|
||||
receivingOrders(context, orderId, t.data[0])
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*调用接单接口
|
||||
* */
|
||||
private fun receivingOrders(context: Context, orderId: String, car: CarBean) {
|
||||
DataManager.getInstance()
|
||||
.receivingOrders(orderId, car.carId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
BaseObserver(
|
||||
context,
|
||||
object : RxHttpCallBack<String>() {
|
||||
override fun onSuccess(t: CommonResponseBean<String>) {
|
||||
super.onSuccess(t)
|
||||
//接单成功,弹窗是否去装货
|
||||
CommonPopUtils.getInstance()
|
||||
.showLoadPop(context, car) {
|
||||
ActivityUtils.startActivity(context,
|
||||
WaybillLoadActivity::class.java,
|
||||
Bundle().apply {
|
||||
putString(AppConfig.ORDER_ID, orderId)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
7
app/src/main/res/drawable/select_car_bg.xml
Normal file
7
app/src/main/res/drawable/select_car_bg.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/shape_gray_5" android:state_selected="false"></item>
|
||||
<item android:drawable="@drawable/shape_select_5" android:state_selected="true"></item>
|
||||
<item android:drawable="@drawable/shape_gray_5"></item>
|
||||
</selector>
|
16
app/src/main/res/drawable/shape_select_5.xml
Normal file
16
app/src/main/res/drawable/shape_select_5.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:endColor="#FAAE90"
|
||||
android:startColor="#FFE1D5"
|
||||
android:type="linear"
|
||||
android:useLevel="true" />
|
||||
<corners
|
||||
android:bottomLeftRadius="5dp"
|
||||
android:bottomRightRadius="5dp"
|
||||
android:topLeftRadius="5dp"
|
||||
android:topRightRadius="5dp" />
|
||||
|
||||
</shape>
|
40
app/src/main/res/layout/choice_car.xml
Normal file
40
app/src/main/res/layout/choice_car.xml
Normal file
@ -0,0 +1,40 @@
|
||||
<?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="wrap_content"
|
||||
android:background="@drawable/bg_bai"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
android:text="选择车辆"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_18" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_12"
|
||||
android:layout_marginRight="@dimen/dp_12" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnOk"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_marginRight="@dimen/dp_20"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
android:background="@drawable/shape_ok_bg"
|
||||
android:text="接单"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_17" />
|
||||
|
||||
|
||||
</LinearLayout>
|
57
app/src/main/res/layout/item_car.xml
Normal file
57
app/src/main/res/layout/item_car.xml
Normal file
@ -0,0 +1,57 @@
|
||||
<?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="wrap_content"
|
||||
android:background="@drawable/select_car_bg"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/dp_15"
|
||||
android:paddingTop="@dimen/dp_20"
|
||||
android:id="@+id/llContent"
|
||||
android:paddingRight="@dimen/dp_15"
|
||||
android:paddingBottom="@dimen/dp_20">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCarNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="豫A4854S"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_18" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCarType"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="重型栏板半挂车"
|
||||
android:textColor="@color/color_9"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCarLen"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="车长:16米"
|
||||
android:textColor="@color/color_9"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCarWei"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="核定载重:40吨"
|
||||
android:textColor="@color/color_9"
|
||||
android:textSize="@dimen/sp_14" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -1,100 +0,0 @@
|
||||
package com.dahe.mylibrary.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class CarBean implements Serializable {
|
||||
|
||||
|
||||
// private String approved_load;
|
||||
// private String driver_name;
|
||||
// private String current_load;
|
||||
// private String car_number;
|
||||
// private String outline_wide;
|
||||
// private String outline_long;
|
||||
// private String driver_phone;
|
||||
// private Integer car_id;
|
||||
// private String outline_high;
|
||||
private boolean isSelect;
|
||||
|
||||
private String vehicle;
|
||||
private String carId;
|
||||
private String outlineWide;
|
||||
private String outlineHigh;
|
||||
private String outlineLong;
|
||||
private String approvedLoad;
|
||||
private String driverName;
|
||||
private String driverPhone;
|
||||
|
||||
public String getVehicle() {
|
||||
return vehicle;
|
||||
}
|
||||
|
||||
public void setVehicle(String vehicle) {
|
||||
this.vehicle = vehicle;
|
||||
}
|
||||
|
||||
public String getCarId() {
|
||||
return carId;
|
||||
}
|
||||
|
||||
public void setCarId(String carId) {
|
||||
this.carId = carId;
|
||||
}
|
||||
|
||||
public String getOutlineWide() {
|
||||
return outlineWide;
|
||||
}
|
||||
|
||||
public void setOutlineWide(String outlineWide) {
|
||||
this.outlineWide = outlineWide;
|
||||
}
|
||||
|
||||
public String getOutlineHigh() {
|
||||
return outlineHigh;
|
||||
}
|
||||
|
||||
public void setOutlineHigh(String outlineHigh) {
|
||||
this.outlineHigh = outlineHigh;
|
||||
}
|
||||
|
||||
public String getOutlineLong() {
|
||||
return outlineLong;
|
||||
}
|
||||
|
||||
public void setOutlineLong(String outlineLong) {
|
||||
this.outlineLong = outlineLong;
|
||||
}
|
||||
|
||||
public String getApprovedLoad() {
|
||||
return approvedLoad;
|
||||
}
|
||||
|
||||
public void setApprovedLoad(String approvedLoad) {
|
||||
this.approvedLoad = approvedLoad;
|
||||
}
|
||||
|
||||
public String getDriverName() {
|
||||
return driverName;
|
||||
}
|
||||
|
||||
public void setDriverName(String driverName) {
|
||||
this.driverName = driverName;
|
||||
}
|
||||
|
||||
public String getDriverPhone() {
|
||||
return driverPhone;
|
||||
}
|
||||
|
||||
public void setDriverPhone(String driverPhone) {
|
||||
this.driverPhone = driverPhone;
|
||||
}
|
||||
|
||||
public boolean isSelect() {
|
||||
return isSelect;
|
||||
}
|
||||
|
||||
public void setSelect(boolean select) {
|
||||
isSelect = select;
|
||||
}
|
||||
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<corners android:topLeftRadius="@dimen/dp_8"
|
||||
android:topRightRadius="@dimen/dp_8"
|
||||
android:bottomLeftRadius="@dimen/dp_8"
|
||||
android:bottomRightRadius="@dimen/dp_8"/>
|
||||
/>
|
||||
<solid android:color="#fff"/>
|
||||
</shape>
|
Loading…
Reference in New Issue
Block a user