运单流程优化

This commit is contained in:
lijia 2024-03-08 14:49:25 +08:00
parent 0999a99eb7
commit 14dde2eb20
5 changed files with 98 additions and 37 deletions

View File

@ -23,7 +23,7 @@ class CarsAdapter :
holder.run {
setText(R.id.tvCarNum, item?.vehicleNum)
setText(R.id.tvCarType, item?.vehicleType)
setText(R.id.tvCarLen, """${item?.carLong}""")
setText(R.id.tvCarLen, """${item?.carLong}mm""")
setText(R.id.tvCarWei, """${item?.approvedLoad?.toFloat()?.div(1000)}""")
ImageLoader.getInstance()

View File

@ -78,13 +78,13 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
ivMyWaybill.setOnClickListener {
// TODO: 调试图片上传todo
ActivityUtils.startActivity(mContext,WaybillUpPicActivity::class.java,Bundle().apply {
putInt(AppConfig.SUCCESS_TYPE,1)
})
// TODO: 调试图片上传
// ActivityUtils.startActivity(mContext,WaybillUpPicActivity::class.java,Bundle().apply {
// putInt(AppConfig.SUCCESS_TYPE,1)
// })
// if (this@HomeFragment.mListener != null)
// this@HomeFragment?.mListener?.invoke(2)
if (this@HomeFragment.mListener != null)
this@HomeFragment?.mListener?.invoke(2)
}
}
initData()

View File

@ -84,36 +84,56 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
)
var myAdapter = GridImageAdapter(mContext, mData)
myAdapter.selectMax = 6
myAdapter.selectMax = 1
myAdapter.setOnItemClickListener(object : OnItemClickListener {
override fun onItemClick(v: View?, position: Int) {
// 预览图片、视频、音频
PictureSelector.create(this@WaybillUpPicActivity)
.openPreview()
.setImageEngine(GlideEngine.createGlideEngine())
.isHidePreviewDownload(true)
.startActivityPreview(position, false, myAdapter.data)
PopsUtils.getInstance().showSelPic(mContext, myAdapter) {
OssServiceUtil.getInstance().run {
asyncPutImage(it[0].realPath, this@WaybillUpPicActivity)
setResultCallBack { data, oldPath ->
picBean = WaybillPhoto()
picBean.run {
photoUrl = oldPath
this.type = if (type == 1) "1" else "2"
}
if (upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" } == null) {
upBean.waybillPhotoList.add(picBean)
} else {
upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" }!!.photoUrl = oldPath
}
}
}
myAdapter.data.run {
clear()
addAll(it)
}
myAdapter.notifyDataSetChanged()
}
}
override fun openPicture() {
PopsUtils.getInstance().showSelPic(mContext, myAdapter) {
// TODO: 暂时注释
OssServiceUtil.getInstance().run {
// TODO: 暂时注释
// asyncPutImage(it[0].realPath, this@WaybillUpPicActivity)
// setResultCallBack { data, oldPath ->
// picBean = WaybillPhoto()
// picBean.run {
// photoUrl = oldPath
// this.type = if (type == 1) "1" else "2"
// }
//
// upBean.waybillPhotoList.add(picBean)
// }
asyncPutImage(it[0].realPath, this@WaybillUpPicActivity)
setResultCallBack { data, oldPath ->
picBean = WaybillPhoto()
picBean.run {
photoUrl = oldPath
this.type = if (type == 1) "1" else "2"
}
if (upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" } == null) {
upBean.waybillPhotoList.add(picBean)
} else {
upBean.waybillPhotoList.find { it.type == if (type == 1) "1" else "2" }!!.photoUrl = oldPath
}
}
}
myAdapter.data.run {
clear()
addAll(it)
}
myAdapter.data.addAll(it)
myAdapter.notifyDataSetChanged()
}
@ -138,9 +158,30 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
myAdapter.selectMax = 1
myAdapter.setOnItemClickListener(object : OnItemClickListener {
override fun onItemClick(v: View?, position: Int) {
// 预览图片、视频、音频
PictureSelector.create(this@WaybillUpPicActivity)
.openPreview()
PopsUtils.getInstance().showSelPic(mContext, myAdapter) {
OssServiceUtil.getInstance().run {
asyncPutImage(it[0].realPath, this@WaybillUpPicActivity)
setResultCallBack { data, oldPath ->
picBean = WaybillPhoto()
picBean.run {
photoUrl = oldPath
receiptType =
if (type == 1) "4" else if (type == 2) "5" else "6"
this.type = "3"
}
if (upBean.waybillPhotoList.find { it.type == "3" } == null) {
upBean.waybillPhotoList.add(picBean)
} else {
upBean.waybillPhotoList.find { it.type == "3" }!!.photoUrl = oldPath
}
}
}
myAdapter.data.run {
clear()
addAll(it)
}
myAdapter.notifyDataSetChanged()
}
}
override fun openPicture() {
@ -155,10 +196,17 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
if (type == 1) "4" else if (type == 2) "5" else "6"
this.type = "3"
}
upBean.waybillPhotoList.add(picBean)
if (upBean.waybillPhotoList.find { it.type == "3" } == null) {
upBean.waybillPhotoList.add(picBean)
} else {
upBean.waybillPhotoList.find { it.type == "3" }!!.photoUrl = oldPath
}
}
}
myAdapter.data.addAll(it)
myAdapter.data.run {
clear()
addAll(it)
}
myAdapter.notifyDataSetChanged()
}
@ -178,7 +226,18 @@ class WaybillUpPicActivity : BaseActivity<ActivityWaybillUppicBinding>() {
this.type = if (type == 1) "1" else "2"
}
if (type==2){
if (type == 1) {
if (upBean.waybillPhotoList.find { it.type == "1" } == null) {
showToast("请上传装货照片")
return@setOnClickListener
}
}
if (type == 2) {
if (upBean.waybillPhotoList.find { it.type == "3" } == null) {
showToast("请上传卸货照片")
return@setOnClickListener
}
if (upBean.waybillPhotoList.find { it.receiptType == "4" || it.receiptType == "5" } == null) {
showToast("卸货请上传卸货回单照片")
return@setOnClickListener

View File

@ -104,7 +104,9 @@ class GridImageAdapter(context: Context?, result: List<LocalMedia>?) :
}
viewHolder.mIvDel.visibility = View.INVISIBLE
} else {
viewHolder.mIvDel.visibility = View.VISIBLE
//删除按钮隐藏
viewHolder.mIvDel.visibility = View.GONE
viewHolder.mIvDel.setOnClickListener { view: View? ->
val index = viewHolder.absoluteAdapterPosition
if (index != RecyclerView.NO_POSITION && data.size > index) {

View File

@ -91,9 +91,9 @@ class PopBottomPic(
.setCompressEngine(ImageFileCompressEngine())
.isPreviewImage(true)
.isMaxSelectEnabledMask(true)
.setMaxSelectNum(6)
.setMaxSelectNum(1)
.isGif(false)
// .setSelectionMode(SelectModeConfig.SINGLE)
.setSelectionMode(SelectModeConfig.SINGLE)
.setSelectedData(myAdapter.data)
selectionModel.forResult(object : OnResultCallbackListener<LocalMedia> {
override fun onResult(result: ArrayList<LocalMedia>) {