浏览代码

1.发票抬头编辑

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

+ 1 - 0
app/src/main/AndroidManifest.xml

@@ -89,6 +89,7 @@
         <activity android:name=".activity.AllCarActivity"/>
         <activity android:name=".activity.InvoiceActivity"/>
         <activity android:name=".activity.PasswordActivity"/>
+        <activity android:name=".activity.InvoiceTitleActivity"/>
 
 
     </application >

+ 1 - 0
app/src/main/java/com/quansu/heifengwuliu/activity/InvoiceActivity.kt

@@ -24,6 +24,7 @@ class InvoiceActivity : MBRActivity<InvoiceVModel, InvoiceAdapter, ActivityInvoi
         titleBar()?.setRightText(getString(R.string.invoice_title))
         titleBar()?.tvRight!!.setOnClickListener {
             //发票抬头
+            UiSwitch.single(this,InvoiceTitleActivity::class.java)
 
         }
     }

+ 31 - 0
app/src/main/java/com/quansu/heifengwuliu/activity/InvoiceTitleActivity.kt

@@ -0,0 +1,31 @@
+package com.quansu.heifengwuliu.activity
+
+import android.os.Bundle
+import com.quansu.heifengwuliu.base.MBActivity
+import com.quansu.heifengwuliu.databinding.ActivityInvoiceTitleBinding
+import com.quansu.heifengwuliu.vmodel.InvoiceTitleVModel
+
+/**
+ *Created by shihuiyun
+ *on 2020/9/18
+ */
+class InvoiceTitleActivity : MBActivity<InvoiceTitleVModel, ActivityInvoiceTitleBinding>(){
+
+
+    override fun initCreate(savedInstanceState: Bundle?) {
+        super.initCreate(savedInstanceState)
+        vm.getInfo()
+    }
+    override fun vmClass(): Class<InvoiceTitleVModel> {
+        return InvoiceTitleVModel::class.java
+    }
+
+
+    override fun binding(): ActivityInvoiceTitleBinding {
+        return ActivityInvoiceTitleBinding.inflate(layoutInflater)
+    }
+
+    override fun title(): String? {
+        return "发票抬头"
+    }
+}

+ 14 - 0
app/src/main/java/com/quansu/heifengwuliu/model/Invoice.kt

@@ -0,0 +1,14 @@
+package com.quansu.heifengwuliu.model
+
+import com.ysnows.base.inter.IModel
+
+/**
+ *Created by shihuiyun
+ *on 2020/9/18
+ */
+class Invoice(var invoice_id:String,var uid:String,var company:String,
+              var sn:String,var addr:String,var tel:String,
+              var bank:String,var number:String,var create_time:String,
+              var update_time:String,var delete_time:String
+) : IModel {
+}

+ 22 - 0
app/src/main/java/com/quansu/heifengwuliu/utils/net/ApiService.kt

@@ -312,4 +312,26 @@ interface ApiService {
 
 
 
+    /**
+     * 编辑发票抬头
+     * @return
+     */
+    @POST("api/invoice/invoiceEdit")
+    @FormUrlEncoded
+    fun invoiceEdit(@Field("invoice_id") invoice_id: String?, @Field("company") company: String?,
+                @Field("sn") sn: String?, @Field("addr") addr: String?,
+                    @Field("tel") tel: String?, @Field("bank") bank: String?,
+                   @Field("number") number: String?
+    ): Observable<Response<Any>>
+
+
+    /**
+     * 获取信息-发票抬头
+     * @return
+     */
+    @GET("api/invoice/invoiceGet")
+    fun invoiceGet(): Observable<Response<Invoice>>
+
+
+
 }

+ 125 - 0
app/src/main/java/com/quansu/heifengwuliu/vmodel/InvoiceTitleVModel.kt

@@ -0,0 +1,125 @@
+package com.quansu.heifengwuliu.vmodel
+
+import android.app.Activity
+import android.text.TextUtils
+import androidx.databinding.Bindable
+import com.quansu.heifengwuliu.BR
+import com.quansu.heifengwuliu.utils.net.NetEngine
+import com.ysnows.base.base.BRepository
+import com.ysnows.base.base.BViewModel
+
+class InvoiceTitleVModel : BViewModel<BRepository>() {
+
+
+
+    var invoice_id="0"
+
+    @Bindable
+    var company: String? = null
+        set(value) {
+            field = value
+            notifyPropertyChanged(BR.company)
+        }
+
+    @Bindable
+    var sn: String? = null
+        set(value) {
+            field = value
+            notifyPropertyChanged(BR.sn)
+        }
+    @Bindable
+    var addr: String? = null
+        set(value) {
+            field = value
+            notifyPropertyChanged(BR.addr)
+        }
+
+    @Bindable
+    var tel: String? = null
+        set(value) {
+            field = value
+            notifyPropertyChanged(BR.tel)
+        }
+    @Bindable
+    var bank: String? = null
+        set(value) {
+            field = value
+            notifyPropertyChanged(BR.bank)
+        }
+
+    @Bindable
+    var number: String? = null
+        set(value) {
+            field = value
+            notifyPropertyChanged(BR.number)
+        }
+
+
+
+
+
+    fun  toSubmit(){
+
+        if(TextUtils.isEmpty(company)){
+            toast("请输入发票抬头")
+            return
+        }
+
+        if(TextUtils.isEmpty(sn)){
+            toast("请输入税号")
+            return
+        }
+        if(TextUtils.isEmpty(addr)){
+            toast("请输入单位地址")
+            return
+        }
+
+        if(TextUtils.isEmpty(tel)){
+            toast("请输入电话号码")
+            return
+        }
+        if(TextUtils.isEmpty(bank)){
+            toast("请输入开户银行")
+            return
+        }
+
+        if(TextUtils.isEmpty(number)){
+            toast("请输入银行账号")
+            return
+        }
+
+        repository().lreq(NetEngine.service.invoiceEdit(invoice_id,company,sn,addr,tel,bank,number))
+                .doOnNext {
+                    if (it.ok(true)) {
+                        (repository().context as Activity).finish()
+                    }
+                }
+                .subscribe()
+
+    }
+
+
+    fun getInfo(){
+        //获取发票抬头
+        repository().lreq(NetEngine.service.invoiceGet())
+                .doOnNext {
+                    if (it.ok(true)) {
+                        var bean=it.data()
+                        if(null!=bean){
+                            invoice_id=bean.invoice_id
+                            company=bean.company
+                            sn=bean.sn
+                            addr=bean.addr
+                            tel=bean.tel
+                            bank=bean.bank
+                            number=bean.number
+                        }
+
+                    }
+                }
+                .subscribe()
+
+    }
+
+
+}

+ 197 - 0
app/src/main/res/layout/activity_invoice_title.xml

@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto" >
+
+    <data >
+        <import type="android.view.View" />
+        <variable
+            name="vm"
+            type="com.quansu.heifengwuliu.vmodel.InvoiceTitleVModel" />
+    </data >
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:paddingStart="@dimen/dp_14"
+        android:orientation="vertical"
+        android:paddingEnd="@dimen/dp_14" >
+
+
+        <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
+            android:id="@+id/lay_input"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/dp_12"
+            android:gravity="center_vertical"
+            android:orientation="vertical"
+            android:paddingStart="@dimen/dp_8"
+            android:paddingEnd="@dimen/dp_14"
+            app:qmui_borderColor="#F4F3F9"
+            app:qmui_borderWidth="@dimen/dp_1"
+            app:rv_radius="25dp" >
+
+            <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="48dp"
+                android:gravity="center_vertical"
+                android:paddingStart="@dimen/dp_8"
+                android:paddingEnd="@dimen/dp_14" >
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="名  称" />
+
+                <com.ysnows.base.widget.DelEditText
+
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:background="@color/white"
+                    android:hint="@string/please_enter"
+                    android:paddingStart="@dimen/dp_18"
+                    android:text="@={vm.company}"
+                    android:textSize="@dimen/sp_13" />
+
+            </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout >
+
+            <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="48dp"
+                android:gravity="center_vertical"
+                android:paddingStart="@dimen/dp_8"
+                android:paddingEnd="@dimen/dp_14" >
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="税  号" />
+
+                <com.ysnows.base.widget.DelEditText
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:background="@color/white"
+                    android:hint="@string/please_enter"
+                    android:paddingStart="@dimen/dp_18"
+                    android:text="@={vm.sn}"
+                    android:textSize="@dimen/sp_13" />
+
+            </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout >
+
+
+            <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="48dp"
+                android:gravity="center_vertical"
+                android:paddingStart="@dimen/dp_8"
+                android:paddingEnd="@dimen/dp_14" >
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="单位地址" />
+
+                <com.ysnows.base.widget.DelEditText
+
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:background="@color/white"
+                    android:hint="@string/please_enter"
+                    android:paddingStart="@dimen/dp_18"
+                    android:text="@={vm.addr}"
+                    android:textSize="@dimen/sp_13" />
+
+            </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout >
+            <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="48dp"
+                android:gravity="center_vertical"
+                android:paddingStart="@dimen/dp_8"
+                android:paddingEnd="@dimen/dp_14" >
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="电话号码" />
+
+                <com.ysnows.base.widget.DelEditText
+
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:background="@color/white"
+                    android:hint="@string/please_enter"
+                    android:inputType="phone"
+                    android:paddingStart="@dimen/dp_18"
+                    android:text="@={vm.tel}"
+                    android:textSize="@dimen/sp_13" />
+
+            </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout >
+            <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="48dp"
+                android:gravity="center_vertical"
+                android:paddingStart="@dimen/dp_8"
+                android:paddingEnd="@dimen/dp_14" >
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="开户银行" />
+
+                <com.ysnows.base.widget.DelEditText
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:background="@color/white"
+                    android:hint="@string/please_enter"
+                    android:paddingStart="@dimen/dp_18"
+                    android:text="@={vm.bank}"
+                    android:textSize="@dimen/sp_13" />
+
+            </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout >
+            <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="48dp"
+                android:gravity="center_vertical"
+                android:paddingStart="@dimen/dp_8"
+                android:paddingEnd="@dimen/dp_14" >
+
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="银行账号" />
+
+                <com.ysnows.base.widget.DelEditText
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:background="@color/white"
+                    android:hint="@string/please_enter"
+                    android:paddingStart="@dimen/dp_18"
+                    android:text="@={vm.number}"
+                    android:textSize="@dimen/sp_13" />
+
+            </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout >
+
+
+
+
+
+        </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout >
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_weight="1"
+            android:layout_height="0dp"></View>
+
+        <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
+            android:id="@+id/btn_submmit"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/dp_40"
+            android:layout_marginStart="@dimen/dp_30"
+            android:layout_marginEnd="@dimen/dp_30"
+            android:layout_marginBottom="@dimen/dp_30"
+            android:onClick="@{v->vm.toSubmit()}"
+            android:text="@string/save"
+            />
+
+    </LinearLayout >
+
+</layout >

+ 3 - 0
app/src/main/res/values/strings.xml

@@ -469,6 +469,9 @@ Api 已达到使用限制
     <string name="invoice" >发票</string >
     <string name="invoice_title" >发票抬头</string >
 
+    <string name="please_enter" >请输入</string >
+
+