浏览代码

1.已取消的货源也要再来一单按钮。

石慧云 4 年之前
父节点
当前提交
806d9d4a23

+ 8 - 8
app/src/main/java/com/quansu/heifengwuliu/activity/AccountActivity.kt

@@ -1,8 +1,5 @@
 package com.quansu.heifengwuliu.activity
 
-import android.os.Bundle
-import android.view.View
-import android.widget.TextView
 import androidx.fragment.app.Fragment
 import com.qmuiteam.qmui.widget.tab.QMUITab
 import com.qmuiteam.qmui.widget.tab.QMUITabBuilder
@@ -34,7 +31,8 @@ class AccountActivity : MBTabActivity<BViewModel<BRepository>, ActivityAccountBi
     }
 
     override fun getPageCount(): Int {
-        return 2
+     //   return 2
+        return 1
     }
 
     override fun createTabs(tabBuilder: QMUITabBuilder): Array<QMUITab> {
@@ -42,10 +40,12 @@ class AccountActivity : MBTabActivity<BViewModel<BRepository>, ActivityAccountBi
         val component = tabBuilder
                 .setText(getString(R.string.bill))
                 .build(context())
-        val util = tabBuilder
-                .setText(getText(R.string.analysis))
-                .build(context())
+//        val util = tabBuilder
+//                .setText(getText(R.string.analysis))
+//                .build(context())
+
+        //return arrayOf(component, util)
 
-        return arrayOf(component, util)
+        return arrayOf(component)
     }
 }

+ 3 - 0
app/src/main/java/com/quansu/heifengwuliu/adapter/CarEnterAdapter.kt

@@ -291,6 +291,9 @@ class CarEnterAdapter(val vm: OwnerMoreVModel) : BAdapter<ReceiveBean, BaseDataB
                 holder.dataBinding?.etGoodsName!!.removeTextChangedListener(textWatcher)
             }
         }
+
+
+
         holder.dataBinding?.etSingCarNums!!.addTextChangedListener(textWatcher)
         holder.dataBinding?.etSingCarPrice!!.addTextChangedListener(textWatcher)
         holder.dataBinding?.etSingCarTotal!!.addTextChangedListener(textWatcher)

+ 43 - 1
app/src/main/java/com/quansu/heifengwuliu/fragment/OwnerMoreFragment.kt

@@ -3,6 +3,7 @@ package com.quansu.heifengwuliu.fragment
 import android.app.Activity
 import android.content.Intent
 import android.os.Bundle
+import android.text.Editable
 import android.text.TextUtils
 import android.util.Log
 import android.view.LayoutInflater
@@ -30,6 +31,8 @@ import com.quansu.heifengwuliu.model.bean.SendBean
 import com.quansu.heifengwuliu.utils.PopuAllCarsUtils
 import com.quansu.heifengwuliu.utils.PopuListUtils
 import com.quansu.heifengwuliu.utils.PopupUtils
+import com.quansu.heifengwuliu.utils.VerifyUtils
+import com.quansu.heifengwuliu.view.SimpleTextWatcher
 import com.quansu.heifengwuliu.vmodel.OwnerMoreVModel
 import com.ysnows.base.model.PositionBean
 import com.ysnows.base.utils.B
@@ -155,9 +158,29 @@ class OwnerMoreFragment : MBFragment<OwnerMoreVModel, FragmentOwnermoreBinding>(
             UiSwitch.singleRes(this, CollectionActivity::class.java, MIntentAction.REQUEST_CODE_THREE)
 
         }
+        binding.viewHead.getEtName()!!.addTextChangedListener(textWatcher)
 
     }
 
+    var oldNmae:String=""
+
+    var  textWatcher= object: SimpleTextWatcher(){
+        override fun afterTextChanged(s: Editable?) {
+            super.afterTextChanged(s)
+
+            var name=s.toString()
+            if(!TextUtils.isEmpty(oldNmae)&& oldNmae == name){
+                return
+            }
+            if(!TextUtils.isEmpty(name)) {
+                if (!VerifyUtils.isLegalName(name)) {
+                    toast("装货人姓名格式不对!!")
+                    return
+                }
+            }
+        }
+    }
+
     private fun judgeValue() {
 
         var type_id = binding.viewHead.type_id
@@ -175,6 +198,11 @@ class OwnerMoreFragment : MBFragment<OwnerMoreVModel, FragmentOwnermoreBinding>(
             toast("请输入发货人!")
             return
         }
+
+        if(!VerifyUtils.isLegalName(name_out)){
+            toast("卸货人姓名格式不对,请检查!")
+            return
+        }
         var mobile_out = binding.viewHead.getEtPhone()!!.text.toString().trim()
         if (TextUtils.isEmpty(mobile_out)) {
             toast("请输入发货人电话!")
@@ -196,6 +224,10 @@ class OwnerMoreFragment : MBFragment<OwnerMoreVModel, FragmentOwnermoreBinding>(
                 toast("请输入卸货人!")
                 return
             }
+            if(!VerifyUtils.isLegalName(item.name)){
+                toast("卸货人姓名格式不对,请检查!")
+                return
+            }
             if (TextUtils.isEmpty(item.mobile)) {
                 toast("请输入卸货人电话!")
                 return
@@ -369,7 +401,17 @@ class OwnerMoreFragment : MBFragment<OwnerMoreVModel, FragmentOwnermoreBinding>(
                         4->list[pos].name=str.toString()
                         5->list[pos].mobile=str.toString()
                         6->list[pos].address=str.toString()
-                        7->list[pos].goods=str.toString()
+                        7->{
+                            if(!TextUtils.isEmpty(str)){
+
+                                if(!VerifyUtils.isLegalName(str!!)){
+                                    toast("卸货人姓名格式不对!!")
+                                    return
+                                }
+                            }
+
+                            list[pos].goods=str.toString()
+                           }
                         else -> ""
                     }
 

+ 32 - 0
app/src/main/java/com/quansu/heifengwuliu/fragment/OwnerSingleFragment.kt

@@ -31,6 +31,8 @@ import com.quansu.heifengwuliu.model.bean.SendBean
 import com.quansu.heifengwuliu.utils.PopuAllCarsUtils
 import com.quansu.heifengwuliu.utils.PopuListUtils
 import com.quansu.heifengwuliu.utils.PopupUtils
+import com.quansu.heifengwuliu.utils.VerifyUtils
+import com.quansu.heifengwuliu.view.SimpleTextWatcher
 import com.quansu.heifengwuliu.vmodel.OwnerSingleVModel
 import com.yanzhenjie.permission.AndPermission
 import com.yanzhenjie.permission.runtime.Permission
@@ -199,10 +201,29 @@ class OwnerSingleFragment : MBFragment<OwnerSingleVModel, FragmentOwnersingleBin
             UiSwitch.singleRes(this, CollectionActivity::class.java, MIntentAction.REQUEST_CODE_THREE)
 
         }
+        binding.viewHead.getEtName()!!.addTextChangedListener(textWatcher)
 
 
     }
 
+    var oldNmae:String=""
+    var  textWatcher= object: SimpleTextWatcher(){
+        override fun afterTextChanged(s: Editable?) {
+            super.afterTextChanged(s)
+
+            var name=s.toString()
+            if(!TextUtils.isEmpty(oldNmae)&& oldNmae == name){
+                return
+            }
+            if(!TextUtils.isEmpty(name)) {
+                if (!VerifyUtils.isLegalName(name)) {
+                    toast("装货人姓名格式不对!!")
+                    return
+                }
+            }
+        }
+    }
+
 
     private fun judgeValue() {
 
@@ -230,6 +251,12 @@ class OwnerSingleFragment : MBFragment<OwnerSingleVModel, FragmentOwnersingleBin
             toast("请输入发货人!")
             return
         }
+        if(!VerifyUtils.isLegalName(name_out)){
+
+            toast("发货人姓名格式不对,请检查!")
+            return
+        }
+
         var mobile_out = binding.viewHead.getEtPhone()!!.text.toString().trim()
         if (TextUtils.isEmpty(mobile_out)) {
             toast("请输入发货人电话!")
@@ -255,6 +282,11 @@ class OwnerSingleFragment : MBFragment<OwnerSingleVModel, FragmentOwnersingleBin
             toast("请输入卸货人!")
             return
         }
+        if(!VerifyUtils.isLegalName(name_in)){
+            toast("卸货人姓名格式不对,请检查!")
+            return
+        }
+
         var mobile_in = binding.viewEnter.getEtPhone()!!.text.toString().trim()
         if (TextUtils.isEmpty(mobile_in)) {
             toast("请输入卸货人电话!")

+ 8 - 5
app/src/main/java/com/quansu/heifengwuliu/utils/PopupUtils.java

@@ -24,13 +24,13 @@ public class PopupUtils {
      * 选择时间
      */
     public static void setChoseTime(Context context, TextView tv, ChoiceData choiceData) {
-        Calendar startDate = Calendar.getInstance();
-        startDate.set(1980, 0, 23);
+//        Calendar startDate = Calendar.getInstance();
+//        startDate.set(1980, 0, 23);
 
         Calendar endDate = Calendar.getInstance();
         endDate.set(2020, 12, 31);
 
-//        Calendar endDate = Calendar.getInstance();//当前时间
+        Calendar startDate = Calendar.getInstance();//当前时间
 
         TimePickerView timePickerView = new TimePickerBuilder(context, new OnTimeSelectListener() {
             @Override
@@ -51,8 +51,11 @@ public class PopupUtils {
     }
 
     public static void setChoseTime(Context context,ChoiceData choiceData) {
-        Calendar startDate = Calendar.getInstance();
-        startDate.set(1980, 0, 23);
+//        Calendar startDate = Calendar.getInstance();
+//        startDate.set(1980, 0, 23);
+
+        Calendar startDate = Calendar.getInstance();//当前时间
+
 
         Calendar endDate = Calendar.getInstance();
         endDate.set(2020, 12, 31);

+ 32 - 0
app/src/main/java/com/quansu/heifengwuliu/utils/VerifyUtils.kt

@@ -0,0 +1,32 @@
+package com.quansu.heifengwuliu.utils
+
+/**
+ *Created by shihuiyun
+ *on 2020/10/16
+ */
+object VerifyUtils {
+
+
+    /**
+     * 验证输入的名字是否为“中文”或者是否包含“·”
+     */
+    fun isLegalName(name: String): Boolean {
+        return if (name.contains("·") || name.contains("•")) {
+            Regex("^[\\u4e00-\\u9fa5]+[·•][\\u4e00-\\u9fa5]+\$").matches(name)
+        } else {
+            Regex("^[\\u4e00-\\u9fa5]+\$").matches(name)
+        }
+    }
+
+
+    /**
+     * 验证输入的身份证号是否合法
+     */
+    fun isLegalId(id: String): Boolean {//
+        return  Regex("(^\\d{15}\$)|(^\\d{17}([0-9]|X)\$)").matches(id.toUpperCase())
+    }
+
+
+}
+
+

+ 29 - 0
app/src/main/java/com/quansu/heifengwuliu/vmodel/PersonalVerityVModel.kt

@@ -14,6 +14,7 @@ import com.quansu.heifengwuliu.model.LoginBean
 import com.quansu.heifengwuliu.model.User
 import com.quansu.heifengwuliu.repository.PersonalVerifyRepository
 import com.quansu.heifengwuliu.utils.ChosePhotoUtils
+import com.quansu.heifengwuliu.utils.VerifyUtils
 import com.quansu.heifengwuliu.utils.net.NetEngine
 import com.tencent.mmkv.MMKV
 import com.ysnows.base.base.BViewModel
@@ -28,6 +29,9 @@ class PersonalVerityVModel(application: Application) : BViewModel<PersonalVerify
 
     var isShow: MutableLiveData<Boolean> = MutableLiveData(true)
 
+    var nameID:String=""
+    var iDNumberID:String=""
+
 
     @Bindable
     var name: String? = null
@@ -71,11 +75,32 @@ class PersonalVerityVModel(application: Application) : BViewModel<PersonalVerify
             toast("请输入姓名")
             return
         }
+        //验证姓名的格式
+
+        if(!VerifyUtils.isLegalName(name!!)){
+            toast("姓名格式不对,请核实!")
+            return
+        }
+        //判断是否和图片上的一致
+        if(!TextUtils.isEmpty(nameID)&&(!name.equals(nameID))){
+            toast("输入姓名和身份证上姓名不一致,请核实!")
+            return
+        }
 
         if(TextUtils.isEmpty(iDNumber)){
             toast("请输入身份证号")
             return
         }
+        if(!VerifyUtils.isLegalId(iDNumber!!)){
+            toast("身份证格式不对,请核实!")
+            return
+        }
+        //判断是否和图片上的一致
+        if(!TextUtils.isEmpty(iDNumberID)&&(!iDNumber.equals(iDNumberID))){
+            toast("输入身份证号和身份证上的身份证号不一致,请核实!")
+            return
+        }
+
 
         repository().rxLreq(NetEngine.service.setInfo(imgIDMan.value, imgIDEmblem.value,name,iDNumber))
                 .doOnNext {
@@ -123,6 +148,10 @@ class PersonalVerityVModel(application: Application) : BViewModel<PersonalVerify
                        var bean=it.data() as Idcard
                         name=bean.name
                         iDNumber=bean.id
+
+                        nameID=bean.name
+                        iDNumberID=bean.id
+
                     }
                 }
                 .subscribe()

+ 1 - 1
app/src/main/java/com/quansu/heifengwuliu/vmodel/SearchVModel.kt

@@ -20,7 +20,7 @@ open abstract class SearchVModel(application: Application) : BRViewModel<BRRepos
         if (actionId == EditorInfo.IME_ACTION_SEARCH) {
             firstReq()
         }
-        return false;
+        return false
     }
 
 }

+ 2 - 0
app/src/main/java/com/quansu/heifengwuliu/vmodel/WaybillDetailsVModel.kt

@@ -628,6 +628,7 @@ open class WaybillDetailsVModel(application: Application) : BViewModel<BReposito
                 .doOnNext {
                     if (it.ok(true)) {
                         is_collect.value=1
+                        info.value!!.driver.is_collect=1
                     }
                 }
                 .subscribe()
@@ -641,6 +642,7 @@ open class WaybillDetailsVModel(application: Application) : BViewModel<BReposito
            val it= repository().lreq { NetEngine.service.delDriver(arr) }
             if(it.ok(true)){
                 is_collect.value=0
+                info.value!!.driver.is_collect=0
             }
         }
 

+ 2 - 2
app/src/main/java/com/quansu/heifengwuliu/widget/ShipmentHeadView.kt

@@ -109,14 +109,14 @@ class ShipmentHeadView(context: Context, attrs: AttributeSet) :BaseLinearLayout(
 //        binding.tabs.setupWithViewPager(binding.qmViewPager, false)
 //        binding.tabs.setPadding(space, 0, space, 0)
 //
-        val size: Int = QMUIDisplayHelper.dp2px(context, 17)
+        val size: Int = QMUIDisplayHelper.dp2px(context, 14)
 
         val builder = binding!!.tabs.tabBuilder()
         builder
                 .skinChangeWithTintColor(false)
                 .setSelectColor(Color.parseColor("#FFBC00"))
                 .setNormalColor(Color.parseColor("#5E5F60"))
-                .setTypeface(Typeface.DEFAULT_BOLD, Typeface.DEFAULT)
+               // .setTypeface(Typeface.DEFAULT_BOLD, Typeface.DEFAULT)
                 .setTextSize(size,size)
                 .setDynamicChangeIconColor(false)
 

+ 5 - 2
app/src/main/res/layout/activity_account.xml

@@ -19,6 +19,7 @@
                 android:id="@+id/tabs"
                 android:layout_width="match_parent"
                 android:layout_height="@dimen/title_bar_height"
+                android:visibility="gone"
                 android:background="@color/white"
                 android:textSize="12sp" />
 
@@ -26,15 +27,17 @@
                 android:layout_width="match_parent"
                 android:layout_height="8dp"
                 android:layout_marginTop="@dimen/title_bar_height"
+                android:visibility="gone"
                 android:background="@color/color_page" />
 
+<!--      android:layout_marginTop="58dp"       -->
             <com.qmuiteam.qmui.widget.QMUIViewPager
                 android:id="@+id/view_pager"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
-                android:layout_marginTop="58dp" />
+                android:layout_marginTop="12dp" />
 
         </FrameLayout >
 
     </LinearLayout >
-</layout >
+</layout >

+ 0 - 1
app/src/main/res/layout/activity_personal_verify.xml

@@ -224,7 +224,6 @@
                     android:layout_height="match_parent"
                     android:background="@color/white"
                     android:hint="@string/please_input_id_number"
-                    android:inputType="phone"
                     android:paddingStart="@dimen/dp_18"
                     android:text="@={vm.iDNumber}"
                     android:gravity="center|right"

+ 2 - 1
app/src/main/res/layout/fragment_ownersingle.xml

@@ -59,7 +59,8 @@
                         <com.quansu.heifengwuliu.widget.EnterInfoView
                             android:id="@+id/view_enter"
                             android:layout_width="match_parent"
-                            android:layout_height="wrap_content"></com.quansu.heifengwuliu.widget.EnterInfoView>
+                            android:layout_height="wrap_content"/>
+
 
 
                         <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout

+ 1 - 0
app/src/main/res/layout/widget_addressitem.xml

@@ -186,6 +186,7 @@
                         android:paddingStart="8dp"
                         android:background="@null"
                         android:hint="电话"
+                        android:inputType="phone"
                         android:textColor="#545556"
                         android:textColorHint="#979899"
                         android:textSize="@dimen/sp_15">

+ 8 - 8
app/src/main/res/layout/widget_search.xml

@@ -49,7 +49,7 @@
 
                 </ImageView >
 
-                <EditText
+                <com.ysnows.base.widget.DelEditText
                     android:id="@+id/et_name"
                     android:layout_width="0dp"
                     android:layout_height="match_parent"
@@ -66,14 +66,14 @@
                     android:textSize="13sp"
                     app:on_action="@{(a,b,c)->vm.onAction(b)}" />
 
-                <ImageView
-                    android:id="@+id/iv_delete"
-                    android:layout_width="14dp"
-                    android:layout_height="14dp"
-                    android:layout_marginLeft="10dp"
-                    android:src="@drawable/stock_delete" >
+<!--                <ImageView-->
+<!--                    android:id="@+id/iv_delete"-->
+<!--                    android:layout_width="14dp"-->
+<!--                    android:layout_height="14dp"-->
+<!--                    android:layout_marginLeft="10dp"-->
+<!--                    android:src="@drawable/stock_delete" >-->
 
-                </ImageView >
+<!--                </ImageView >-->
 
             </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout >