浏览代码

发票的页面

liukai 2 年之前
父节点
当前提交
72eb9677cc
共有 22 个文件被更改,包括 361 次插入13 次删除
  1. 12 10
      cpt_ewallet/src/main/AndroidManifest.xml
  2. 76 0
      cpt_ewallet/src/main/java/com/hongyegroup/cpt_ewallet/mvvm/MonthlyInvoiceViewModel.kt
  3. 2 1
      cpt_ewallet/src/main/java/com/hongyegroup/cpt_ewallet/mvvm/WithdrawAppointmentViewModel.kt
  4. 1 2
      cpt_ewallet/src/main/java/com/hongyegroup/cpt_ewallet/ui/EWalletMainFragment.kt
  5. 77 0
      cpt_ewallet/src/main/java/com/hongyegroup/cpt_ewallet/ui/MonthlyInvoiceActivity.kt
  6. 二进制
      cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_filter_line.webp
  7. 二进制
      cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_filter_month.webp
  8. 二进制
      cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_filter_year.webp
  9. 二进制
      cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_apr.webp
  10. 二进制
      cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_aug.webp
  11. 二进制
      cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_dec.webp
  12. 二进制
      cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_feb.webp
  13. 二进制
      cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_jan.webp
  14. 二进制
      cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_jul.webp
  15. 二进制
      cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_jun.webp
  16. 二进制
      cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_mar.webp
  17. 二进制
      cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_may.webp
  18. 二进制
      cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_nov.webp
  19. 二进制
      cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_oct.webp
  20. 二进制
      cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_sep.webp
  21. 125 0
      cpt_ewallet/src/main/res/layout/activity_monthly_invoice.xml
  22. 68 0
      cpt_ewallet/src/main/res/layout/item_monthly_invoice.xml

+ 12 - 10
cpt_ewallet/src/main/AndroidManifest.xml

@@ -4,25 +4,27 @@
 
     <application android:allowBackup="true">
 
-        <activity android:name=".ui.EWalletHistoryActivity"/>
+        <activity android:name=".ui.EWalletHistoryActivity" />
 
-        <activity android:name=".ui.EWalletWithdrawActivity"/>
+        <activity android:name=".ui.EWalletWithdrawActivity" />
 
-        <activity android:name=".ui.BankWithdrawActivity"/>
+        <activity android:name=".ui.BankWithdrawActivity" />
 
-        <activity android:name=".ui.WithdrawAppointmentActivity"/>
+        <activity android:name=".ui.WithdrawAppointmentActivity" />
 
-        <activity android:name=".ui.AppointmentEnquiryActivity"/>
+        <activity android:name=".ui.AppointmentEnquiryActivity" />
 
-        <activity android:name=".ui.AppointmentEnquiryDetailActivity"/>
+        <activity android:name=".ui.AppointmentEnquiryDetailActivity" />
 
-        <activity android:name=".ui.PaymentPsdActivity"/>
+        <activity android:name=".ui.PaymentPsdActivity" />
 
-        <activity android:name=".ui.EWalletHistoryDetailJobActivity"/>
+        <activity android:name=".ui.EWalletHistoryDetailJobActivity" />
 
-        <activity android:name=".ui.HistoryJobIssueActivity"/>
+        <activity android:name=".ui.HistoryJobIssueActivity" />
 
-        <activity android:name=".ui.HistoryJobIssueDetailActivity"/>
+        <activity android:name=".ui.HistoryJobIssueDetailActivity" />
+
+        <activity android:name=".ui.MonthlyInvoiceActivity" />
 
     </application>
 

+ 76 - 0
cpt_ewallet/src/main/java/com/hongyegroup/cpt_ewallet/mvvm/MonthlyInvoiceViewModel.kt

@@ -0,0 +1,76 @@
+package com.hongyegroup.cpt_ewallet.mvvm
+
+import android.annotation.SuppressLint
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.SavedStateHandle
+import com.guadou.cs_cptservices.binding.BaseDataBindingAdapter
+import com.guadou.lib_baselib.base.vm.BaseViewModel
+import com.guadou.lib_baselib.ext.checkEmpty
+import com.guadou.lib_baselib.utils.CommUtils
+import com.hongyegroup.cpt_ewallet.BR
+import com.hongyegroup.cpt_ewallet.R
+import dagger.hilt.android.lifecycle.HiltViewModel
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.withContext
+import javax.inject.Inject
+
+@HiltViewModel
+class MonthlyInvoiceViewModel @Inject constructor(
+    private val savedStateHandle: SavedStateHandle
+) : BaseViewModel() {
+
+    var isNeedPlaceHolder = true
+
+    var mDatas = mutableListOf<String>()
+    val mAdapter by lazy { BaseDataBindingAdapter(R.layout.item_monthly_invoice, BR.item, mDatas) }
+
+
+    fun getInvoiceList(): LiveData<Boolean> {
+        val liveData = MutableLiveData<Boolean>()
+
+        launchOnUI {
+            //开始Loading
+            if (isNeedPlaceHolder) loadStartLoading()
+            val result = withContext(Dispatchers.IO) {
+                delay(1000)
+
+                val list = mutableListOf<String>()
+                for (i in 1..12) {
+                    list.add(i.toString())
+                }
+                return@withContext list
+            }
+
+            loadSuccess()
+            handleData(result)
+            liveData.postValue(true)
+
+        }
+
+        return liveData
+    }
+
+    @SuppressLint("NotifyDataSetChanged")
+    private fun handleData(list: MutableList<String>) {
+
+        if (!list.checkEmpty()) {
+
+            mDatas.clear()
+            mDatas.addAll(list)
+            mAdapter.notifyDataSetChanged()
+
+        } else {
+            //展示无数据
+            mDatas.clear()
+            mAdapter.notifyDataSetChanged()
+            //展示无数据的布局
+            val emptyView = CommUtils.inflate(R.layout.item_empty_layout)
+            mAdapter.setEmptyView(emptyView)
+        }
+
+        isNeedPlaceHolder = false
+    }
+
+}

+ 2 - 1
cpt_ewallet/src/main/java/com/hongyegroup/cpt_ewallet/mvvm/WithdrawAppointmentViewModel.kt

@@ -21,9 +21,10 @@ class WithdrawAppointmentViewModel @Inject constructor(
     private val savedStateHandle: SavedStateHandle
 ) : BaseViewModel() {
 
+    var isNeedPlaceHolder = true
     var mDatas = mutableListOf<String>()
     val mAdapter by lazy { BaseDataBindingAdapter(R.layout.item_withdraw_appointment, BR.item, mDatas) }
-    var isNeedPlaceHolder = true
+
 
     fun getAppointmentList(): LiveData<Boolean> {
         val liveData = MutableLiveData<Boolean>()

+ 1 - 2
cpt_ewallet/src/main/java/com/hongyegroup/cpt_ewallet/ui/EWalletMainFragment.kt

@@ -6,7 +6,6 @@ import com.guadou.cs_cptservices.YYConstants
 import com.guadou.cs_cptservices.base.fragment.YYBaseVDBFragment
 import com.guadou.cs_cptservices.interfaces.IFragmentRefresh
 import com.guadou.lib_baselib.bean.DataBindingConfig
-import com.guadou.lib_baselib.engine.toast
 import com.guadou.lib_baselib.ext.click
 import com.guadou.lib_baselib.ext.vertical
 import com.guadou.lib_baselib.utils.CommUtils
@@ -111,7 +110,7 @@ class EWalletMainFragment(private val needBackLayout: Boolean) : YYBaseVDBFragme
 
         //去年度报表发票页面
         fun gotoEWalletInviocePage() {
-            toast("去年度报表发票页面")
+            MonthlyInvoiceActivity.startInstance()
         }
 
         //去设置密码页面

+ 77 - 0
cpt_ewallet/src/main/java/com/hongyegroup/cpt_ewallet/ui/MonthlyInvoiceActivity.kt

@@ -0,0 +1,77 @@
+package com.hongyegroup.cpt_ewallet.ui
+
+import android.os.Bundle
+import com.guadou.cs_cptservices.base.activity.YYBaseVDBActivity
+import com.guadou.lib_baselib.bean.DataBindingConfig
+import com.guadou.lib_baselib.ext.commContext
+import com.guadou.lib_baselib.ext.gotoActivity
+import com.guadou.lib_baselib.ext.vertical
+import com.hongyegroup.cpt_ewallet.BR
+import com.hongyegroup.cpt_ewallet.R
+import com.hongyegroup.cpt_ewallet.databinding.ActivityMonthlyInvoiceBinding
+import com.hongyegroup.cpt_ewallet.mvvm.MonthlyInvoiceViewModel
+import com.scwang.smart.refresh.layout.api.RefreshLayout
+import com.scwang.smart.refresh.layout.listener.OnRefreshListener
+import dagger.hilt.android.AndroidEntryPoint
+
+/**
+ * 月度的发票账单
+ */
+@AndroidEntryPoint
+class MonthlyInvoiceActivity : YYBaseVDBActivity<MonthlyInvoiceViewModel, ActivityMonthlyInvoiceBinding>(), OnRefreshListener {
+
+    companion object {
+        fun startInstance() {
+            commContext().gotoActivity<MonthlyInvoiceActivity>()
+        }
+    }
+
+    override fun getDataBindingConfig(): DataBindingConfig {
+        return DataBindingConfig(R.layout.activity_monthly_invoice, BR.viewModel, mViewModel)
+    }
+
+    override fun startObserve() {
+
+    }
+
+    override fun init(savedInstanceState: Bundle?) {
+        setStatusBarBlackText()
+
+        initRV()
+        initData()
+        initListener()
+    }
+
+    private fun initData() {
+        mViewModel.getInvoiceList().observe(this) {
+            mBinding.refreshLayout.finishRefresh()
+        }
+    }
+
+    private fun initListener() {
+        mViewModel.mAdapter.loadMoreModule.isEnableLoadMore = false
+
+        //刷新控件初始化
+        mBinding.refreshLayout.setEnableNestedScroll(true)
+        mBinding.refreshLayout.setEnableLoadMore(false)
+        mBinding.refreshLayout.setEnableRefresh(true)
+        mBinding.refreshLayout.setOnRefreshListener(this)
+
+        //点击事件
+        mViewModel.mAdapter.setOnItemClickListener { _, view, position ->
+            if (view.id == R.id.btn_query_status) {
+                //去反馈页面
+                AppointmentEnquiryActivity.startInstance()
+            }
+        }
+    }
+
+    override fun onRefresh(refreshLayout: RefreshLayout) {
+        initData()
+    }
+
+    private fun initRV() {
+        mBinding.recyclerView.vertical().adapter = mViewModel.mAdapter
+    }
+
+}

二进制
cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_filter_line.webp


二进制
cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_filter_month.webp


二进制
cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_filter_year.webp


二进制
cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_apr.webp


二进制
cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_aug.webp


二进制
cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_dec.webp


二进制
cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_feb.webp


二进制
cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_jan.webp


二进制
cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_jul.webp


二进制
cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_jun.webp


二进制
cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_mar.webp


二进制
cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_may.webp


二进制
cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_nov.webp


二进制
cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_oct.webp


二进制
cpt_ewallet/src/main/res/drawable-xxhdpi/payment_invoice_icon_sep.webp


+ 125 - 0
cpt_ewallet/src/main/res/layout/activity_monthly_invoice.xml

@@ -0,0 +1,125 @@
+<?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"
+    xmlns:binding="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    tools:ignore="RtlHardcoded">
+
+    <data>
+
+        <variable
+            name="viewModel"
+            type="com.hongyegroup.cpt_ewallet.mvvm.MonthlyInvoiceViewModel" />
+
+        <import type="android.text.TextUtils" />
+
+    </data>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="#f2f4f8"
+        android:orientation="vertical">
+
+        <com.guadou.lib_baselib.view.titlebar.EasyTitleBar
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            app:Easy_title="我的工作发票" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/d_50dp"
+            android:background="@color/white"
+            android:gravity="center"
+            android:orientation="horizontal">
+
+            <LinearLayout
+                android:id="@+id/ll_select_year"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:gravity="center"
+                android:orientation="horizontal">
+
+                <com.guadou.lib_baselib.font_text_view.TextViewMedium
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:drawableLeft="@drawable/payment_invoice_filter_year"
+                    android:drawablePadding="@dimen/d_10dp"
+                    android:text="年份:"
+                    android:textColor="@color/black"
+                    android:textSize="@dimen/d_15d5dp" />
+
+                <com.guadou.lib_baselib.font_text_view.TextViewMedium
+                    android:id="@+id/tv_select_year"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="@dimen/d_23dp"
+                    android:text="2021"
+                    android:textColor="@color/app_blue"
+                    android:textSize="@dimen/d_15d5dp" />
+
+            </LinearLayout>
+
+            <ImageView
+                android:layout_width="1dp"
+                android:layout_height="@dimen/d_20dp"
+                android:src="@drawable/payment_invoice_filter_line" />
+
+            <LinearLayout
+                android:id="@+id/ll_select_month"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:gravity="center"
+                android:orientation="horizontal">
+
+                <com.guadou.lib_baselib.font_text_view.TextViewMedium
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:drawableLeft="@drawable/payment_invoice_filter_month"
+                    android:drawablePadding="@dimen/d_10dp"
+                    android:text="月份"
+                    android:textColor="@color/black"
+                    android:textSize="@dimen/d_15d5dp" />
+
+
+                <com.guadou.lib_baselib.font_text_view.TextViewMedium
+                    android:id="@+id/tv_select_month"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="@dimen/d_23dp"
+                    android:hint="全部"
+                    android:textColor="@color/app_blue"
+                    android:textColorHint="@color/app_blue"
+                    android:textSize="@dimen/d_16sp" />
+
+            </LinearLayout>
+
+        </LinearLayout>
+
+        <com.scwang.smart.refresh.layout.SmartRefreshLayout
+            android:id="@+id/refresh_layout"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_marginTop="@dimen/d_15dp"
+            android:focusable="true"
+            android:focusableInTouchMode="true"
+            app:srlEnablePreviewInEditMode="false">
+
+            <com.scwang.smart.refresh.header.ClassicsHeader
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" />
+
+            <androidx.recyclerview.widget.RecyclerView
+                android:id="@+id/recycler_view"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:overScrollMode="never"
+                android:scrollbars="none" />
+
+        </com.scwang.smart.refresh.layout.SmartRefreshLayout>
+
+    </LinearLayout>
+
+</layout>

+ 68 - 0
cpt_ewallet/src/main/res/layout/item_monthly_invoice.xml

@@ -0,0 +1,68 @@
+<?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"
+    xmlns:binding="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools">
+
+    <data>
+
+        <variable
+            name="item"
+            type="String" />
+
+        <import
+            alias="textUtlis"
+            type="android.text.TextUtils" />
+
+    </data>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/d_48dp"
+        android:layout_marginLeft="@dimen/d_15dp"
+        android:layout_marginRight="@dimen/d_15dp"
+        android:layout_marginBottom="@dimen/d_10dp"
+        android:background="@drawable/shape_5round_white"
+        android:gravity="center_vertical"
+        android:orientation="horizontal">
+
+        <ImageView
+            android:id="@+id/iv_month_icon"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/d_14dp"
+            android:src="@drawable/payment_invoice_icon_may" />
+
+        <com.guadou.lib_baselib.font_text_view.TextViewMedium
+            android:id="@+id/tv_month_text"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/d_10dp"
+            android:text="1月份"
+            android:textColor="@color/black"
+            android:textSize="@dimen/d_15sp" />
+
+        <View
+            android:layout_width="0dp"
+            android:layout_height="1dp"
+            android:layout_weight="1" />
+
+        <com.guadou.lib_baselib.font_text_view.TextViewMedium
+            android:id="@+id/tv_salary_amount"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textColor="@color/app_blue"
+            android:textSize="@dimen/d_17sp"
+            tools:text="$899" />
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/d_11dp"
+            android:layout_marginRight="@dimen/d_15dp"
+            android:src="@drawable/more_gray_icon" />
+
+    </LinearLayout>
+
+
+</layout>