运单流程优化
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user