一装多卸
This commit is contained in:
parent
54b3db22e3
commit
8dd32b77c0
@ -20,10 +20,13 @@ class SendGoodsAdapter : BaseQuickAdapter<AddressBean, QuickViewHolder>() {
|
||||
item?.run {
|
||||
holder.run {
|
||||
if (0==position){
|
||||
setGone(R.id.tvDel,true)
|
||||
setBackgroundResource(R.id.ivType,R.drawable.icon_loading)
|
||||
}else if (position==items.size-1){
|
||||
setGone(R.id.tvDel,true)
|
||||
setBackgroundResource(R.id.ivType,R.drawable.icon_unloading)
|
||||
}else{
|
||||
setGone(R.id.tvDel,false)
|
||||
setBackgroundResource(R.id.ivType,R.drawable.icon_point)
|
||||
}
|
||||
setText(R.id.tvAddress, item.addressDetail)
|
||||
|
@ -15,6 +15,7 @@ object AppConfig {
|
||||
const val CX = "DA_HE_CX"
|
||||
const val CC = "DA_HE_CC"
|
||||
const val IS_ADD = "DA_HE_IS_ADD"
|
||||
const val IS_MUL = "DA_HE_IS_MUL"
|
||||
const val CAPTAIN_ID = "CAPTAIN_ID"
|
||||
const val PWD = "DA_HE_PHONE"
|
||||
const val CODE = "DA_HE_PHONE"
|
||||
|
@ -77,6 +77,7 @@ data class AddressBean(
|
||||
val cityCode: String,
|
||||
val companyCode: String,
|
||||
val companyName: String,
|
||||
var isPassingPoints: String,
|
||||
val contactNumber: String,
|
||||
val contactPerson: String,
|
||||
val createBy: String,
|
||||
@ -108,7 +109,7 @@ data class AddressBean(
|
||||
"", "", "", "", "",
|
||||
"", "", "", "", "", "",
|
||||
"", "", "", "", "", "",
|
||||
"", "", "", "", "", "","","", ""
|
||||
"", "", "", "", "", "", "","","", ""
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ import RxHttpCallBack
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.LinearLayout
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
@ -68,12 +67,11 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
||||
|
||||
binding.ivNor.setOnClickListener {
|
||||
// ActivityUtils.startActivity(mContext, MarketsActivity::class.java)
|
||||
ActivityUtils.startActivity(mContext, SendGoodsActivity::class.java)
|
||||
ActivityUtils.startActivity(mContext, SendGoodsActivity::class.java,Bundle().apply { putBoolean(AppConfig.IS_MUL,false) })
|
||||
}
|
||||
|
||||
binding.ivMul.setOnClickListener {
|
||||
showToast("开发中,敬请期待")
|
||||
// ActivityUtils.startActivity(mContext, SendGoodsActivity::class.java)
|
||||
ActivityUtils.startActivity(mContext, SendGoodsActivity::class.java,Bundle().apply { putBoolean(AppConfig.IS_MUL,true) })
|
||||
}
|
||||
initData()
|
||||
|
||||
|
@ -7,6 +7,7 @@ import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
@ -47,76 +48,51 @@ class SendGoodsActivity : BaseActivity<ActivitySendGoodsBinding>() {
|
||||
private lateinit var datas: MutableList<AddressBean>
|
||||
private lateinit var adapter: SendGoodsAdapter
|
||||
private var goodList: MutableList<GoodBean> = mutableListOf()
|
||||
|
||||
private var isMul = false
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
setStatusBarColor(R.color.white)
|
||||
setTitleBar("普通装货", true)
|
||||
|
||||
intent.extras?.let {
|
||||
isMul = it.getBoolean(AppConfig.IS_MUL, false)
|
||||
}
|
||||
|
||||
datas = mutableListOf<AddressBean>(
|
||||
AddressBean(),
|
||||
AddressBean()
|
||||
)
|
||||
binding.run {
|
||||
llAdd.visibility = if (isMul) View.VISIBLE else View.GONE
|
||||
tvAdd.setOnClickListener {
|
||||
|
||||
binding.llGoods.setOnClickListener {
|
||||
ActivityUtils.startActivityForResult(
|
||||
this@SendGoodsActivity,
|
||||
GoodsInfoListActivity::class.java,
|
||||
8888
|
||||
)
|
||||
}
|
||||
binding.llCarType.setOnClickListener {
|
||||
ActivityUtils.startActivityForResult(
|
||||
this@SendGoodsActivity,
|
||||
CarTypeActivity::class.java,
|
||||
9999
|
||||
)
|
||||
adapter.add(datas.size-1,AddressBean())
|
||||
adapter.notifyDataSetChanged()
|
||||
}
|
||||
llGoods.setOnClickListener {
|
||||
ActivityUtils.startActivityForResult(
|
||||
this@SendGoodsActivity,
|
||||
GoodsInfoListActivity::class.java,
|
||||
8888
|
||||
)
|
||||
}
|
||||
llCarType.setOnClickListener {
|
||||
ActivityUtils.startActivityForResult(
|
||||
this@SendGoodsActivity,
|
||||
CarTypeActivity::class.java,
|
||||
9999
|
||||
)
|
||||
}
|
||||
btnOk.setOnClickListener {
|
||||
submit()
|
||||
}
|
||||
|
||||
tvDate.setOnClickListener {
|
||||
selectDate()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
binding.btnOk.setOnClickListener {
|
||||
submit()
|
||||
}
|
||||
|
||||
binding.tvDate.setOnClickListener {
|
||||
PickerUtils.getInstance()
|
||||
.showDateSim(this@SendGoodsActivity, "装货截止时间") { date ->
|
||||
binding.tvDate.text = date
|
||||
postOrderBean.run {
|
||||
effectiveTimeStart =TimeUtil.getString(
|
||||
date,
|
||||
SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()),
|
||||
SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()),
|
||||
1439,
|
||||
TimeConstants.MIN
|
||||
)
|
||||
loadingDeadline =
|
||||
TimeUtil.getString(
|
||||
date,
|
||||
SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()),
|
||||
SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()),
|
||||
8639,
|
||||
TimeConstants.MIN
|
||||
) //装货截止时间
|
||||
receiverDeadline =
|
||||
TimeUtil.getString(
|
||||
date,
|
||||
SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()),
|
||||
SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()),
|
||||
23039,
|
||||
TimeConstants.MIN
|
||||
)//卸货截止时间
|
||||
effectiveTimeEnd =
|
||||
TimeUtil.getString(
|
||||
date,
|
||||
SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()),
|
||||
SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()),
|
||||
30239,
|
||||
TimeConstants.MIN
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
adapter = binding.recycler.run {
|
||||
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
|
||||
@ -138,6 +114,10 @@ class SendGoodsActivity : BaseActivity<ActivitySendGoodsBinding>() {
|
||||
position
|
||||
)
|
||||
}
|
||||
|
||||
addOnItemChildClickListener(R.id.tvDel){adapter,_,position->
|
||||
adapter.removeAt(position)
|
||||
}
|
||||
}
|
||||
adapter.submitList(datas)
|
||||
|
||||
@ -161,13 +141,20 @@ class SendGoodsActivity : BaseActivity<ActivitySendGoodsBinding>() {
|
||||
name = contactPerson
|
||||
phone = contactNumber
|
||||
}
|
||||
} else if (requestCode == 1) {
|
||||
} else if (requestCode == datas.size-1) {
|
||||
datas[requestCode] = addressBean.apply {
|
||||
type = "2"
|
||||
address = addressDetail
|
||||
name = contactPerson
|
||||
phone = contactNumber
|
||||
}
|
||||
}else{
|
||||
datas[requestCode] = addressBean.apply {
|
||||
isPassingPoints = "1"
|
||||
address = addressDetail
|
||||
name = contactPerson
|
||||
phone = contactNumber
|
||||
}
|
||||
}
|
||||
adapter.notifyItemChanged(requestCode)
|
||||
}
|
||||
@ -240,13 +227,58 @@ class SendGoodsActivity : BaseActivity<ActivitySendGoodsBinding>() {
|
||||
override fun onSuccess(t: CommonResponseBean<PostOrderBean>) {
|
||||
super.onSuccess(t)
|
||||
t.data.order?.let {
|
||||
ActivityUtils.startActivity(mContext, SendSuccActivity::class.java,Bundle().apply {
|
||||
putString(AppConfig.ID,it.orderId)
|
||||
})
|
||||
ActivityUtils.startActivity(
|
||||
mContext,
|
||||
SendSuccActivity::class.java,
|
||||
Bundle().apply {
|
||||
putString(AppConfig.ID, it.orderId)
|
||||
})
|
||||
finish()
|
||||
}
|
||||
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
private fun selectDate(){
|
||||
PickerUtils.getInstance()
|
||||
.showDateSim(this@SendGoodsActivity, "装货截止时间") { date ->
|
||||
binding.tvDate.text = date
|
||||
postOrderBean.run {
|
||||
effectiveTimeStart = TimeUtil.getString(
|
||||
date,
|
||||
SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()),
|
||||
SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()),
|
||||
1439,
|
||||
TimeConstants.MIN
|
||||
)
|
||||
loadingDeadline =
|
||||
TimeUtil.getString(
|
||||
date,
|
||||
SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()),
|
||||
SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()),
|
||||
8639,
|
||||
TimeConstants.MIN
|
||||
) //装货截止时间
|
||||
receiverDeadline =
|
||||
TimeUtil.getString(
|
||||
date,
|
||||
SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()),
|
||||
SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()),
|
||||
23039,
|
||||
TimeConstants.MIN
|
||||
)//卸货截止时间
|
||||
effectiveTimeEnd =
|
||||
TimeUtil.getString(
|
||||
date,
|
||||
SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()),
|
||||
SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()),
|
||||
30239,
|
||||
TimeConstants.MIN
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ import android.view.View
|
||||
import com.dahe.gldriver.base.AppConfig
|
||||
import com.dahe.mylibrary.base.BaseActivity
|
||||
import com.dahe.mylibrary.utils.ActivityUtils
|
||||
import com.dahe.mylibrary.utils.TimeUtil
|
||||
import com.dhsd.glowner.R
|
||||
import com.dhsd.glowner.bean.HomeEvent
|
||||
import com.dhsd.glowner.databinding.ActivitySendSuccBinding
|
||||
@ -36,6 +37,7 @@ class SendSuccActivity : BaseActivity<ActivitySendSuccBinding>(), OnLimitClickLi
|
||||
orderId= it.getString(AppConfig.ID,"")
|
||||
}
|
||||
binding.run {
|
||||
tvTime.text = TimeUtil.getNowString("yyyy-MM-dd HH:mm:ss")
|
||||
btnLeft.setOnClickListener {
|
||||
EventBus.getDefault().post(HomeEvent(true))
|
||||
ActivityUtils.finishToActivity(HomeActivity::class.java,false)
|
||||
|
BIN
app/src/main/res/drawable-xxhdpi/icon_add.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/icon_add.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 969 B |
@ -18,17 +18,50 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_15"
|
||||
android:layout_marginTop="@dimen/dp_13"
|
||||
android:layout_marginRight="@dimen/dp_15"
|
||||
android:background="@drawable/shape_white_8"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/dp_15"
|
||||
android:paddingBottom="@dimen/dp_15" />
|
||||
android:paddingBottom="@dimen/dp_15">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llAdd"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/dp_10"
|
||||
android:paddingRight="@dimen/dp_10"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="一装多卸" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAdd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/icon_add"
|
||||
android:drawablePadding="@dimen/dp_4"
|
||||
android:gravity="right"
|
||||
android:text="添加途径点" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llGoods"
|
||||
@ -161,7 +194,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:drawableLeft="@drawable/start"
|
||||
android:text="运费"
|
||||
android:text="运费(元)"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_16" />
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:layout_marginRight="@dimen/dp_10"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
@ -14,6 +15,7 @@
|
||||
android:background="@drawable/icon_loading" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_6"
|
||||
@ -66,4 +68,15 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/tvDel"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/main_red"
|
||||
android:paddingLeft="@dimen/dp_6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="删除"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user