发货-用车信息,装货时间
This commit is contained in:
parent
94b8b36b7b
commit
40697d7219
@ -11,6 +11,8 @@ object AppConfig {
|
||||
const val TIME = "DA_HE_TIME"
|
||||
const val ID = "DA_HE_ID"
|
||||
const val BEAN = "DA_HE_BEAN"
|
||||
const val CX = "DA_HE_CX"
|
||||
const val CC = "DA_HE_CC"
|
||||
const val IS_ADD = "DA_HE_IS_ADD"
|
||||
const val CAPTAIN_ID = "CAPTAIN_ID"
|
||||
const val PWD = "DA_HE_PHONE"
|
||||
|
@ -3,9 +3,11 @@ package com.dhsd.glowner.ui.home.activtiy
|
||||
import BaseObserver
|
||||
import DataManager
|
||||
import RxHttpCallBack
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.dahe.gldriver.base.AppConfig
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.net.CommonResponseBean
|
||||
import com.dahe.mylibrary.weight.FullyGridLayoutManager
|
||||
@ -131,6 +133,17 @@ class CarTypeActivity : BaseActivity<ActivityCarTypeBinding>(), OnLimitClickList
|
||||
private fun subMint(){
|
||||
val dataCc = adapterCc.items.filter { it.isCheck }
|
||||
val dataCx = adapterCx.items.filter { it.isCheck }
|
||||
dataCx.toString()
|
||||
if (dataCc.isEmpty()||dataCx.isEmpty()){
|
||||
showToast("请选择用车类型")
|
||||
return
|
||||
}
|
||||
val cc = dataCc.joinToString(",") { it.dictValue }
|
||||
val cx =dataCx.joinToString(",") { it.dictValue }
|
||||
|
||||
val intent = Intent()
|
||||
intent.putExtra(AppConfig.CC,cc)
|
||||
intent.putExtra(AppConfig.CX,cx)
|
||||
setResult(RESULT_OK,intent)
|
||||
finish()
|
||||
}
|
||||
}
|
@ -46,7 +46,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
* @ClassName GoodsInfoActivity
|
||||
* @Author john
|
||||
* @Date 2024/2/4 11:09
|
||||
* @Description 新增货物信息列表
|
||||
* @Description 发货 - 新增货物信息列表
|
||||
*/
|
||||
class GoodsInfoListActivity : BaseActivity<ActivityGoodsInfoListBinding>(),
|
||||
OnLimitClickListener, OnClickListener {
|
||||
@ -67,7 +67,7 @@ class GoodsInfoListActivity : BaseActivity<ActivityGoodsInfoListBinding>(),
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
setStatusBarColor(R.color.white)
|
||||
setTitleBar("货物信息", { finish() }, true, "常用货物") {
|
||||
// launcher.launch(Intent(mContext,GoodsListActivity::class.java))
|
||||
ActivityUtils.startActivityForResult(this@GoodsInfoListActivity, GoodsListActivity::class.java, 2)
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
* @ClassName GoodsListActivity
|
||||
* @Author john
|
||||
* @Date 2024/11/1 16:36
|
||||
* @Description 货物列表
|
||||
* @Description 常用货物列表
|
||||
*/
|
||||
class GoodsListActivity : BaseActivity<ActivityGoodsListBinding>(), RefreshCallBack {
|
||||
lateinit var adapter: GoodsAdapter
|
||||
@ -47,14 +47,14 @@ class GoodsListActivity : BaseActivity<ActivityGoodsListBinding>(), RefreshCallB
|
||||
}
|
||||
|
||||
override fun initDate() {
|
||||
// DataManager.getInstance().getGoodsList()
|
||||
// .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe(BaseObserver(mContext,object : RxHttpCallBack<OrderListBean<GoodBean>>(){
|
||||
// override fun onSuccess(t: CommonResponseBean<OrderListBean<GoodBean>>) {
|
||||
// super.onSuccess(t)
|
||||
// initList(t.data.rows)
|
||||
// }
|
||||
// }))
|
||||
DataManager.getInstance().getGoodsList()
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(BaseObserver(mContext,object : RxHttpCallBack<OrderListBean<GoodBean>>(binding.smartRefresh){
|
||||
override fun onSuccess(t: CommonResponseBean<OrderListBean<GoodBean>>) {
|
||||
super.onSuccess(t)
|
||||
initList(t.data.rows)
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
override fun getRefreshDate(stat: Int, page: Int, count: Int) {
|
||||
|
@ -16,6 +16,7 @@ import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
import com.dahe.mylibrary.utils.ConvertUtils
|
||||
import com.dahe.mylibrary.utils.PickerUtils
|
||||
import com.dahe.mylibrary.utils.ToastUtils
|
||||
import com.dhsd.glowner.R
|
||||
import com.dhsd.glowner.adapter.SendGoodsAdapter
|
||||
@ -50,7 +51,7 @@ class SendGoodsActivity : BaseActivity<ActivitySendGoodsBinding>() {
|
||||
ActivityUtils.startActivity(mContext, GoodsInfoListActivity::class.java)
|
||||
}
|
||||
binding.llCarType.setOnClickListener {
|
||||
ActivityUtils.startActivity(mContext, CarTypeActivity::class.java)
|
||||
ActivityUtils.startActivityForResult(this@SendGoodsActivity, CarTypeActivity::class.java,9999)
|
||||
}
|
||||
|
||||
|
||||
@ -59,6 +60,13 @@ class SendGoodsActivity : BaseActivity<ActivitySendGoodsBinding>() {
|
||||
return@setOnLongClickListener true
|
||||
}
|
||||
|
||||
binding.tvDate.setOnClickListener {
|
||||
PickerUtils.getInstance()
|
||||
.showDateSim(this@SendGoodsActivity, "装货截止时间") { date ->
|
||||
binding.tvDate.text = date
|
||||
}
|
||||
}
|
||||
|
||||
adapter = binding.recycler.run {
|
||||
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
|
||||
addItemDecoration(
|
||||
@ -99,6 +107,13 @@ class SendGoodsActivity : BaseActivity<ActivitySendGoodsBinding>() {
|
||||
}
|
||||
|
||||
}
|
||||
data?.let {
|
||||
if (requestCode==9999){
|
||||
val cx = it.getStringExtra(AppConfig.CX)
|
||||
val cc = it.getStringExtra(AppConfig.CC)
|
||||
binding.tvCarType.setText("""${cc} ${cx}""")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
144
app/src/main/java/com/dhsd/glowner/utils/PickerUtils.kt
Normal file
144
app/src/main/java/com/dhsd/glowner/utils/PickerUtils.kt
Normal file
@ -0,0 +1,144 @@
|
||||
package com.dhsd.glowner.utils
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.dahe.mylibrary.base.SingletonNoPHolder
|
||||
import com.dahe.mylibrary.callback.OnMyDatePickedListener
|
||||
import com.github.gzuliyujiang.wheelpicker.AddressPicker
|
||||
import com.github.gzuliyujiang.wheelpicker.BirthdayPicker
|
||||
import com.github.gzuliyujiang.wheelpicker.DatePicker
|
||||
import com.github.gzuliyujiang.wheelpicker.OptionPicker
|
||||
import com.github.gzuliyujiang.wheelpicker.annotation.AddressMode
|
||||
import com.github.gzuliyujiang.wheelpicker.annotation.DateMode
|
||||
import com.github.gzuliyujiang.wheelpicker.contract.OnAddressPickedListener
|
||||
import com.github.gzuliyujiang.wheelpicker.contract.OnOptionPickedListener
|
||||
import com.github.gzuliyujiang.wheelpicker.entity.DateEntity
|
||||
import com.github.gzuliyujiang.wheelview.contract.TextProvider
|
||||
|
||||
/**
|
||||
* @ClassName PickUtils
|
||||
* @Author john
|
||||
* @Date 2024/2/5 14:48
|
||||
* @Description 选择器工具类
|
||||
*/
|
||||
class PickerUtils private constructor() {
|
||||
companion object : SingletonNoPHolder<PickerUtils>(::PickerUtils)
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* 底部弹出生日日期选择
|
||||
* @param activity
|
||||
* @param title 日期选择title
|
||||
* @param dateEntity 默认参数:默认当天
|
||||
* @param listener
|
||||
*/
|
||||
fun showDate(
|
||||
activity: AppCompatActivity,
|
||||
title: String = "",
|
||||
dateEntity: DateEntity = DateEntity.today(),
|
||||
listener: OnMyDatePickedListener
|
||||
) {
|
||||
val picker = BirthdayPicker(activity)
|
||||
picker.setTitle(title)
|
||||
picker.setDefaultValue(dateEntity.year, dateEntity.month, dateEntity.day)
|
||||
picker.setOnDatePickedListener { year, month, day ->
|
||||
if (listener != null)
|
||||
listener.onDatePicked("$year-${if (month <= 9) "0${month}" else month}-${if (day <= 9) "0${day}" else day}")
|
||||
}
|
||||
picker.wheelLayout.setResetWhenLinkage(false)
|
||||
picker.show()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* 底部弹出日期选择
|
||||
* @param activity
|
||||
* @param title 日期选择title
|
||||
* @param listener
|
||||
*/
|
||||
fun showDateSim(
|
||||
activity: AppCompatActivity,
|
||||
title: String = "日期选择",
|
||||
listener: OnMyDatePickedListener
|
||||
) {
|
||||
val picker = DatePicker(activity)
|
||||
picker.setTitle(title)
|
||||
val wheelLayout = picker.wheelLayout
|
||||
wheelLayout.setDateMode(DateMode.YEAR_MONTH_DAY)
|
||||
wheelLayout.setDateLabel("年", "月", "日")
|
||||
picker.setOnDatePickedListener { year, month, day ->
|
||||
listener.onDatePicked("$year-${if (month <= 9) "0${month}" else month}-${if (day <= 9) "0${day}" else day}")
|
||||
|
||||
}
|
||||
picker.show()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 地址选择
|
||||
* @param activity AppCompatActivity
|
||||
* @param lis OnAddressPickedListener
|
||||
*/
|
||||
fun showAddress(activity: AppCompatActivity,lis:OnAddressPickedListener) {
|
||||
val picker = AddressPicker(activity)
|
||||
picker.setAddressMode(AddressMode.PROVINCE_CITY_COUNTY)
|
||||
picker.setDefaultValue("河南省", "郑州市", "金水区")
|
||||
picker.setOnAddressPickedListener(lis)
|
||||
picker.wheelLayout.setOnLinkageSelectedListener { first, second, third ->
|
||||
picker.titleView.text = String.format(
|
||||
"%s%s%s",
|
||||
picker.firstWheelView.formatItem(first),
|
||||
picker.secondWheelView.formatItem(second),
|
||||
picker.thirdWheelView.formatItem(third)
|
||||
)
|
||||
}
|
||||
picker.show()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 选择驾驶证类型
|
||||
* @param activity
|
||||
* @param title
|
||||
* @param listener
|
||||
*/
|
||||
fun showSelectCarType(
|
||||
activity: AppCompatActivity,
|
||||
title: String = "",
|
||||
listener: OnOptionPickedListener
|
||||
) {
|
||||
OptionPicker(activity)
|
||||
.run {
|
||||
setData("A1", "A2", "A3", "B1", "B2", "B3", "C1", "C2")
|
||||
setDefaultValue("B1")
|
||||
setTitle(title)
|
||||
setOnOptionPickedListener(listener)
|
||||
show()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 底部弹框-单选
|
||||
* @param activity AppCompatActivity
|
||||
* @param title String
|
||||
* @param listener OnOptionPickedListener
|
||||
*/
|
||||
fun <T:TextProvider> showSelectCarColor(
|
||||
activity: AppCompatActivity,
|
||||
title: String = "",
|
||||
default: String = "",
|
||||
datas: MutableList<T>,
|
||||
listener: OnOptionPickedListener
|
||||
) {
|
||||
OptionPicker(activity)
|
||||
.run {
|
||||
setData(datas)
|
||||
setDefaultValue(default)
|
||||
setTitle(title)
|
||||
setOnOptionPickedListener(listener)
|
||||
show()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
@ -88,11 +89,13 @@
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCarType"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="16米,厢式"
|
||||
android:hint="请选择用车信息"
|
||||
android:textColor="#FF4A02"
|
||||
android:textSize="@dimen/sp_16" />
|
||||
android:textSize="@dimen/sp_16"
|
||||
tools:text="16米,厢式" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@ -125,9 +128,12 @@
|
||||
|
||||
|
||||
<TextView
|
||||
android:gravity="right"
|
||||
android:hint="请选择装货时间"
|
||||
android:id="@+id/tvDate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="明天上午 06:00-12:00"
|
||||
tools:text="明天上午 06:00-12:00"
|
||||
android:textColor="#FF4A02"
|
||||
android:textSize="@dimen/sp_16" />
|
||||
</LinearLayout>
|
||||
@ -155,10 +161,14 @@
|
||||
android:textSize="@dimen/sp_16" />
|
||||
|
||||
|
||||
<TextView
|
||||
<EditText
|
||||
android:gravity="right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="5000元"
|
||||
tools:text="5000元"
|
||||
android:inputType="numberDecimal"
|
||||
android:hint="请输入运费金额"
|
||||
android:background="@null"
|
||||
android:textColor="#FF4A02"
|
||||
android:textSize="@dimen/sp_16" />
|
||||
</LinearLayout>
|
||||
@ -172,9 +182,9 @@
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_70"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:background="@color/white"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/dp_15"
|
||||
|
Loading…
Reference in New Issue
Block a user