|
@@ -6,6 +6,7 @@ import android.text.TextUtils
|
|
|
import android.util.Log
|
|
|
import androidx.databinding.Bindable
|
|
|
import androidx.lifecycle.MutableLiveData
|
|
|
+import com.qmuiteam.qmui.kotlin.onClick
|
|
|
import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
|
|
|
import com.quansu.heifengwuliu.BR
|
|
|
import com.quansu.heifengwuliu.inte.ChoiceListData
|
|
@@ -23,7 +24,7 @@ import java.util.*
|
|
|
*Created by shihuiyun
|
|
|
*on 2020/9/27
|
|
|
*/
|
|
|
-class DriverWayBillVModel(application: Application) : BViewModel<BRepository>(application) {
|
|
|
+class DriverWayBillVModel(application: Application) : BViewModel<BRepository>(application) {
|
|
|
//搜索条件
|
|
|
var province_out: String = ""
|
|
|
var city_out: String = ""
|
|
@@ -39,10 +40,17 @@ class DriverWayBillVModel(application: Application) : BViewModel<BRepository>(ap
|
|
|
//按钮颜色
|
|
|
val butColor: MutableLiveData<Boolean> = MutableLiveData<Boolean>(false)
|
|
|
|
|
|
- val list:MutableLiveData<List<InfoBean.CarTypeBeanS>> = MutableLiveData<List<InfoBean.CarTypeBeanS>>(null)
|
|
|
+ val list: MutableLiveData<List<InfoBean.CarTypeBeanS>> = MutableLiveData<List<InfoBean.CarTypeBeanS>>(null)
|
|
|
+ val goodsList: MutableLiveData<List<SelectData>> = MutableLiveData<List<SelectData>>()
|
|
|
+
|
|
|
//车辆类型
|
|
|
var carName: MutableLiveData<String> = MutableLiveData<String>("")
|
|
|
- var carCode: String=""
|
|
|
+ var carCode: String = ""
|
|
|
+
|
|
|
+ //商品类型
|
|
|
+ var goodsName: MutableLiveData<String> = MutableLiveData<String>()
|
|
|
+ var goodsCode: String = ""
|
|
|
+
|
|
|
|
|
|
//装货时间段
|
|
|
var timeOutStart: MutableLiveData<String> = MutableLiveData<String>("")
|
|
@@ -56,12 +64,12 @@ class DriverWayBillVModel(application: Application) : BViewModel<BRepository>(ap
|
|
|
|
|
|
var sortName: MutableLiveData<String> = MutableLiveData<String>("")
|
|
|
|
|
|
- var sortCode: String=""
|
|
|
+ var sortCode: String = ""
|
|
|
|
|
|
val sortChose: MutableLiveData<Int> = MutableLiveData<Int>(-1)//0是正序 1是倒序
|
|
|
|
|
|
|
|
|
- var butCarType: QMUIRoundButton? =null
|
|
|
+ var butCarType: QMUIRoundButton? = null
|
|
|
|
|
|
override fun firstReq() {
|
|
|
super.firstReq()
|
|
@@ -69,8 +77,6 @@ class DriverWayBillVModel(application: Application) : BViewModel<BRepository>(ap
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
@Bindable
|
|
|
var priceStart: String? = null
|
|
|
set(value) {
|
|
@@ -93,11 +99,12 @@ class DriverWayBillVModel(application: Application) : BViewModel<BRepository>(ap
|
|
|
field = value
|
|
|
notifyPropertyChanged(BR.k)
|
|
|
}
|
|
|
+
|
|
|
init {
|
|
|
- k=""
|
|
|
- priceStart=""
|
|
|
- priceEnd=""
|
|
|
- list.value= ArrayList<InfoBean.CarTypeBeanS>()
|
|
|
+ k = ""
|
|
|
+ priceStart = ""
|
|
|
+ priceEnd = ""
|
|
|
+ list.value = ArrayList<InfoBean.CarTypeBeanS>()
|
|
|
}
|
|
|
|
|
|
|
|
@@ -107,8 +114,10 @@ class DriverWayBillVModel(application: Application) : BViewModel<BRepository>(ap
|
|
|
.doOnNext {
|
|
|
if (it.ok()) {
|
|
|
val bean = it.data()
|
|
|
- list.value=bean!!.car_types
|
|
|
- if(boolean){
|
|
|
+ list.value = bean!!.car_types
|
|
|
+ goodsList.value = bean!!.goods_type
|
|
|
+
|
|
|
+ if (boolean) {
|
|
|
show()
|
|
|
}
|
|
|
}
|
|
@@ -117,13 +126,12 @@ class DriverWayBillVModel(application: Application) : BViewModel<BRepository>(ap
|
|
|
|
|
|
}
|
|
|
|
|
|
- fun toChoseSort(type:Int){//1正序 2倒序
|
|
|
+ fun toChoseSort(type: Int) {//1正序 2倒序
|
|
|
sortChose.value = type
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
- var textWatcher= object: SimpleTextWatcher(){
|
|
|
+ var textWatcher = object : SimpleTextWatcher() {
|
|
|
override fun afterTextChanged(s: Editable?) {
|
|
|
super.afterTextChanged(s)
|
|
|
inspectButColor()
|
|
@@ -131,51 +139,53 @@ class DriverWayBillVModel(application: Application) : BViewModel<BRepository>(ap
|
|
|
}
|
|
|
|
|
|
|
|
|
- fun inspectButColor(){
|
|
|
+ fun inspectButColor() {
|
|
|
|
|
|
- butColor.value = !(TextUtils.isEmpty(province_out)&& TextUtils.isEmpty(city_out)&& TextUtils.isEmpty(area_out)&&
|
|
|
- TextUtils.isEmpty(province_in)&& TextUtils.isEmpty(city_in)&& TextUtils.isEmpty(area_in)&&
|
|
|
- TextUtils.isEmpty(carCode)&& TextUtils.isEmpty(timeOutStart.value)&&
|
|
|
- TextUtils.isEmpty(timeOutEnd.value)&& TextUtils.isEmpty(timeInStart.value)&& TextUtils.isEmpty(timeInEnd.value)&&
|
|
|
- TextUtils.isEmpty(sortName.value)&& TextUtils.isEmpty(k))
|
|
|
+ butColor.value = !(TextUtils.isEmpty(province_out) && TextUtils.isEmpty(city_out) && TextUtils.isEmpty(area_out) &&
|
|
|
+ TextUtils.isEmpty(province_in) && TextUtils.isEmpty(city_in) && TextUtils.isEmpty(area_in) &&
|
|
|
+ TextUtils.isEmpty(carCode) && TextUtils.isEmpty(timeOutStart.value) &&
|
|
|
+ TextUtils.isEmpty(timeOutEnd.value) && TextUtils.isEmpty(timeInStart.value) && TextUtils.isEmpty(timeInEnd.value) &&
|
|
|
+ TextUtils.isEmpty(sortName.value) && TextUtils.isEmpty(k))
|
|
|
|
|
|
}
|
|
|
|
|
|
- fun clearSearch(){
|
|
|
+ fun clearSearch() {
|
|
|
//清空
|
|
|
- k=""
|
|
|
- priceStart=""
|
|
|
- priceEnd=""
|
|
|
- name_out.value=""
|
|
|
- name_in.value=""
|
|
|
- province_out=""
|
|
|
- city_out=""
|
|
|
- area_out=""
|
|
|
- province_in=""
|
|
|
- city_in=""
|
|
|
- area_in=""
|
|
|
- carName.value=""
|
|
|
- carCode=""
|
|
|
- timeOutStart.value=""
|
|
|
- timeOutEnd.value=""
|
|
|
- timeInStart.value=""
|
|
|
- timeInEnd.value=""
|
|
|
- sortName.value=""
|
|
|
- sortCode=""
|
|
|
- sortChose.value=-1
|
|
|
+ k = ""
|
|
|
+ priceStart = ""
|
|
|
+ priceEnd = ""
|
|
|
+ name_out.value = ""
|
|
|
+ name_in.value = ""
|
|
|
+ province_out = ""
|
|
|
+ city_out = ""
|
|
|
+ area_out = ""
|
|
|
+ province_in = ""
|
|
|
+ city_in = ""
|
|
|
+ area_in = ""
|
|
|
+ carName.value = ""
|
|
|
+ carCode = ""
|
|
|
+ timeOutStart.value = ""
|
|
|
+ timeOutEnd.value = ""
|
|
|
+ timeInStart.value = ""
|
|
|
+ timeInEnd.value = ""
|
|
|
+ sortName.value = ""
|
|
|
+ sortCode = ""
|
|
|
+ sortChose.value = -1
|
|
|
+ goodsName.value = ""
|
|
|
+ goodsCode = ""
|
|
|
//筛选按钮颜色
|
|
|
- butColor.value=false
|
|
|
+ butColor.value = false
|
|
|
}
|
|
|
|
|
|
|
|
|
- fun toChoseCar(){
|
|
|
+ fun toChoseCar() {
|
|
|
|
|
|
- if(list.value?.size==0){
|
|
|
- Log.e("-shy-", "1111: " )
|
|
|
+ if (list.value?.size == 0) {
|
|
|
+ Log.e("-shy-", "1111: ")
|
|
|
getInfo(true)
|
|
|
|
|
|
- }else {
|
|
|
- Log.e("-shy-", "2222: " )
|
|
|
+ } else {
|
|
|
+ Log.e("-shy-", "2222: ")
|
|
|
|
|
|
show()
|
|
|
|
|
@@ -183,18 +193,35 @@ class DriverWayBillVModel(application: Application) : BViewModel<BRepository>(ap
|
|
|
}
|
|
|
|
|
|
|
|
|
- fun show(){
|
|
|
+ fun toGoodsType() {
|
|
|
+
|
|
|
+ if(null==goodsList.value){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ PopuBottomUtils.showList(repository().context!!, (goodsList.value as ArrayList<SelectData>?)!!,object : ChoiceListData {
|
|
|
+ override fun onRestuse(code: String?,name: String?) {
|
|
|
+ goodsName.value = name
|
|
|
+ goodsCode=code.toString()
|
|
|
+ butColor.value=true
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ fun show() {
|
|
|
var seletlist = ArrayList<SelectData>()
|
|
|
for (item in list.value!!) {
|
|
|
var bean = SelectData(item.type_id, item.type_name)
|
|
|
seletlist.add(bean)
|
|
|
}
|
|
|
|
|
|
- PopuBottomUtils.showList(repository().context!!,seletlist,object : ChoiceListData {
|
|
|
- override fun onRestuse(code: String?,name: String?) {
|
|
|
+ PopuBottomUtils.showList(repository().context!!, seletlist, object : ChoiceListData {
|
|
|
+ override fun onRestuse(code: String?, name: String?) {
|
|
|
carCode = code.toString()
|
|
|
carName.value = name
|
|
|
- butColor.value=true
|
|
|
+ butColor.value = true
|
|
|
}
|
|
|
})
|
|
|
|
|
@@ -208,6 +235,4 @@ class DriverWayBillVModel(application: Application) : BViewModel<BRepository>(ap
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
}
|