Browse Source

2024-12-13 修改

修改:
1. 团组经理主管 - 出入境费用明细 UI逻辑修改
zhaiy 3 weeks ago
parent
commit
9c8637eab8

+ 78 - 24
app/src/main/java/com/pan_american/android/ui/group_management/entry_and_exit_fee_detail/EntryAndExitFeeTotalFragment.kt

@@ -60,70 +60,114 @@ class EntryAndExitFeeTotalFragment : BaseFragment<FragmentEntryAndExitFeeTotalBi
 
     override fun initViews() {
         OASystem.entryAndExitDetailResponse.apply {
+
+            economyTotalPayment = 0.0
+            bussinessTotalPayment = 0.0
+            firstClassTotalPayment = 0.0
+
             binding.checkInBoard.isChecked = choiceOne == 1
+
             binding.inBoardTotal.text = String.format(
                 resources.getString(R.string.total_per_fee_format),
                 choiceOneTotalCost
             )
 
+            if (choiceOne == 1) {
+                economyTotalPayment += choiceOneTotalCost
+                bussinessTotalPayment += choiceOneTotalCost
+                firstClassTotalPayment += choiceOneTotalCost
+            }
+
             binding.checkEconomyClass.isChecked = choiceTwoJJ == 1
+
+            if (choiceTwoJJ == 1) {
+                binding.economyClass.text = String.format(resources.getString(R.string.economy_class_price), outsideJJPay)
+                economyTotalPayment += outsideJJPay
+            } else {
+                binding.economyClass.text = String.format(resources.getString(R.string.economy_class_price), 0.0)
+            }
+
             binding.checkBusinessClass.isChecked = choiceTwoGW == 1
+
+            if (choiceTwoGW == 1) {
+                binding.businessClass.text = String.format(resources.getString(R.string.business_class_price), outsideGWPay)
+                bussinessTotalPayment += outsideGWPay
+            } else {
+                binding.businessClass.text = String.format(resources.getString(R.string.business_class_price), 0.0)
+            }
+
             binding.checkFirstClass.isChecked = choiceTwoTD == 1
 
+            if (choiceTwoTD == 1) {
+                binding.firstClass.text = String.format(resources.getString(R.string.first_class_price), outsideTDPay)
+                firstClassTotalPayment += outsideTDPay
+            } else {
+                binding.firstClass.text = String.format(resources.getString(R.string.first_class_price), 0.0)
+            }
+
             binding.checkAccommodationFee.isChecked = choiceThree == 1
+
             binding.accommodationTotal.text = String.format(
                 resources.getString(R.string.total_per_fee_format),
                 choiceThreeTotalCost
             )
 
+            if (choiceThree == 1) {
+                economyTotalPayment += choiceThreeTotalCost
+                bussinessTotalPayment += choiceThreeTotalCost
+                firstClassTotalPayment += choiceThreeTotalCost
+            }
+
             binding.checkMealFee.isChecked = choiceFour == 1
+
             binding.mealTotal.text = String.format(
                 resources.getString(R.string.total_per_fee_format),
                 choiceFourTotalCost
             )
 
+            if (choiceFour == 1) {
+                economyTotalPayment += choiceFourTotalCost
+                bussinessTotalPayment += choiceFourTotalCost
+                firstClassTotalPayment += choiceFourTotalCost
+            }
+
             binding.checkPublicAndMiscellaneous.isChecked = choiceFive == 1
+
             binding.publicAndMiscellaneousTotal.text = String.format(
                 resources.getString(R.string.total_per_fee_format),
                 choiceFiveTotalCost
             )
 
+            if (choiceFive == 1) {
+                economyTotalPayment += choiceFiveTotalCost
+                bussinessTotalPayment += choiceFiveTotalCost
+                firstClassTotalPayment += choiceFiveTotalCost
+            }
+
             binding.checkTraining.isChecked = choiceSix == 1
+
             binding.trainingTotal.text = String.format(
                 resources.getString(R.string.total_per_fee_format),
                 choiceSixTotalCost
             )
 
+            if (choiceSix == 1) {
+                economyTotalPayment += choiceSixTotalCost
+                bussinessTotalPayment += choiceSixTotalCost
+                firstClassTotalPayment += choiceSixTotalCost
+            }
+
             binding.checkOther.isChecked = otherExpenses_Checked == 1
+
             binding.otherTotal.text = String.format(
                 resources.getString(R.string.total_per_fee_format),
                 otherExpensesTotalCost
             )
 
-            binding.economyClass.text = if (choiceTwoJJ == 1) {
-                String.format(resources.getString(R.string.economy_class_price), outsideJJPay)
-            } else {
-                String.format(resources.getString(R.string.economy_class_price), 0.0)
-            }
-            binding.businessClass.text = if (choiceTwoGW == 1) {
-                String.format(resources.getString(R.string.business_class_price), outsideGWPay)
-            } else {
-                String.format(resources.getString(R.string.business_class_price), 0.0)
-            }
-            binding.firstClass.text = if (choiceTwoTD == 1) {
-                String.format(resources.getString(R.string.first_class_price), outsideTDPay)
-            } else {
-                String.format(resources.getString(R.string.first_class_price), 0.0)
-            }
-
-
-            OASystem.entryAndExitDetailResponse.apply {
-                economyTotalPayment =
-                    choiceOneTotalCost + outsideJJPay + choiceThreeTotalCost + choiceFourTotalCost + choiceFiveTotalCost
-                bussinessTotalPayment =
-                    choiceOneTotalCost + outsideGWPay + choiceThreeTotalCost + choiceFourTotalCost + choiceFiveTotalCost
-                firstClassTotalPayment =
-                    choiceOneTotalCost + outsideTDPay + choiceThreeTotalCost + choiceFourTotalCost + choiceFiveTotalCost
+            if (otherExpenses_Checked == 1) {
+                economyTotalPayment += otherExpensesTotalCost
+                bussinessTotalPayment += otherExpensesTotalCost
+                firstClassTotalPayment += otherExpensesTotalCost
             }
 
             binding.economyClassTotal.text = if (choiceTwoJJ == 1) {
@@ -313,6 +357,11 @@ class EntryAndExitFeeTotalFragment : BaseFragment<FragmentEntryAndExitFeeTotalBi
     }
 
     private fun exportPaymentToCollectionBill() {
+
+        if (!isAdded) {
+            return
+        }
+
         apiService.exportPaymentToCollectionBill(groupId = OASystem.entryAndExitDetailResponse.diId)
             .enqueue(object :
                 Callback<BaseResponse> {
@@ -335,6 +384,11 @@ class EntryAndExitFeeTotalFragment : BaseFragment<FragmentEntryAndExitFeeTotalBi
     }
 
     private fun downloadCustomerList() {
+
+        if (!isAdded) {
+            return
+        }
+
         apiService.downloadCustomerList(DownloadCustomerListRequest(diId = OASystem.entryAndExitDetailResponse.diId)).enqueue(object : Callback<DownloadCustomerListResponse> {
             override fun onResponse(
                 call: Call<DownloadCustomerListResponse>,

+ 0 - 4
app/src/main/java/com/pan_american/android/ui/group_management/entry_and_exit_fee_detail/EntryAndExitPaymentDetailActivity.kt

@@ -3,7 +3,6 @@ package com.pan_american.android.ui.group_management.entry_and_exit_fee_detail
 import android.os.Bundle
 import android.text.Editable
 import android.text.TextWatcher
-import android.util.Log
 import android.view.Gravity
 import android.view.View
 import android.view.ViewGroup
@@ -13,7 +12,6 @@ import android.widget.PopupWindow
 import android.widget.TextView
 import androidx.core.content.res.ResourcesCompat
 import androidx.recyclerview.widget.LinearLayoutManager
-import com.google.gson.Gson
 import com.pan_american.android.OASystem
 import com.pan_american.android.R
 import com.pan_american.android.base.BaseActivity
@@ -462,8 +460,6 @@ class EntryAndExitPaymentDetailActivity : BaseActivity<ActivityEntryAndExitPayme
     }
 
     private fun updateEntryAndExitPaymentDetail() {
-
-        Log.e("request", Gson().toJson(updateEntryAndExitPaymentDetailRequest))
         apiService.updateEntryAndExitPaymentDetail(updateEntryAndExitPaymentDetailRequest).enqueue(object : Callback<BaseResponse> {
             override fun onResponse(call: Call<BaseResponse>, response: Response<BaseResponse>) {
 

+ 20 - 8
app/src/main/java/com/pan_american/android/ui/group_management/entry_and_exit_fee_detail/EntryAndExitPaymentListFragment.kt

@@ -2,7 +2,6 @@ package com.pan_american.android.ui.group_management.entry_and_exit_fee_detail
 
 import android.content.Intent
 import android.os.Bundle
-import android.util.Log
 import android.view.Gravity
 import android.view.LayoutInflater
 import android.view.View
@@ -11,7 +10,6 @@ import android.widget.EditText
 import android.widget.PopupWindow
 import android.widget.TextView
 import androidx.recyclerview.widget.LinearLayoutManager
-import com.google.gson.Gson
 import com.pan_american.android.OASystem
 import com.pan_american.android.R
 import com.pan_american.android.base.BaseFragment
@@ -83,6 +81,11 @@ class EntryAndExitPaymentListFragment : BaseFragment<FragmentEntryAndExitPayment
     }
 
     private fun getPaymentList() {
+
+        if (!isAdded) {
+            return
+        }
+
         apiService.getEntryAndExitPaymentList(
             EntryAndExitPaymentTypeRequest(
                 diId = groupId,
@@ -245,6 +248,11 @@ class EntryAndExitPaymentListFragment : BaseFragment<FragmentEntryAndExitPayment
     }
 
     private fun deletePaymentItem(position: Int) {
+
+        if (!isAdded) {
+            return
+        }
+
         apiService.deleteEntryAndExitPaymentItem(DeleteEntryAndExitPaymentItemRequest(id = paymentList[position].subId))
             .enqueue(object : Callback<BaseResponse> {
                 override fun onResponse(
@@ -288,6 +296,11 @@ class EntryAndExitPaymentListFragment : BaseFragment<FragmentEntryAndExitPayment
     }
 
     private fun updateCurrency(currencyList: ArrayList<Selector>) {
+
+        if (!isAdded) {
+            return
+        }
+
         apiService.updateEntryAndExitCurrencyRate(
             UpdateEntryAndExitCurrencyRateRequest(
                 id = paymentId,
@@ -437,12 +450,11 @@ class EntryAndExitPaymentListFragment : BaseFragment<FragmentEntryAndExitPayment
     }
 
     private fun updateSelectStatus(status: Int) {
-        Log.e("request", Gson().toJson(UpdateEntryAndExitTypeStatusRequest(
-            id = paymentId,
-            diId = groupId,
-            itemType = typeId,
-            isSelected = status
-        )))
+
+        if (!isAdded) {
+            return
+        }
+
         apiService.updateEntryAndExitTypeStatus(
             UpdateEntryAndExitTypeStatusRequest(
                 id = paymentId,

+ 15 - 3
app/src/main/java/com/pan_american/android/ui/group_management/entry_and_exit_fee_detail/InBoardFeeFragment.kt

@@ -1,11 +1,9 @@
 package com.pan_american.android.ui.group_management.entry_and_exit_fee_detail
 
 import android.os.Bundle
-import android.util.Log
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
-import com.google.gson.Gson
 import com.pan_american.android.OASystem
 import com.pan_american.android.R
 import com.pan_american.android.base.BaseFragment
@@ -61,6 +59,11 @@ class InBoardFeeFragment : BaseFragment<FragmentInBoardFeeBinding>() {
     }
 
     private fun getInBoardFeeDetail() {
+
+        if (!isAdded) {
+            return
+        }
+
         apiService.getInBoardPaymentDetail(EntryAndExitPaymentTypeRequest(diId = groupId, subType = 1)).enqueue(object : Callback<InBoardDetailResponse> {
             override fun onResponse(
                 call: Call<InBoardDetailResponse>,
@@ -155,6 +158,11 @@ class InBoardFeeFragment : BaseFragment<FragmentInBoardFeeBinding>() {
     }
 
     private fun getNewestVisaPayment() {
+
+        if (!isAdded) {
+            return
+        }
+
         apiService.getNewestVisaPayment(EntryAndExitTipsRequest(groupId = groupId, tipsType = 2)).enqueue(object : Callback<NewestVisaPaymentResponse> {
             override fun onResponse(
                 call: Call<NewestVisaPaymentResponse>,
@@ -186,7 +194,11 @@ class InBoardFeeFragment : BaseFragment<FragmentInBoardFeeBinding>() {
     }
 
     private fun updateInBoardPayment(updateInBoardPaymentRequest: UpdateInBoardPaymentRequest) {
-        Log.e("request", Gson().toJson(updateInBoardPaymentRequest))
+
+        if (!isAdded) {
+            return
+        }
+
         apiService.updateInBoardPayment(updateInBoardPaymentRequest).enqueue(object : Callback<UpdateInBoardPaymentResponse> {
             override fun onResponse(
                 call: Call<UpdateInBoardPaymentResponse>,

+ 14 - 7
app/src/main/java/com/pan_american/android/ui/group_management/entry_and_exit_fee_detail/InternationalTravelFeeFragment.kt

@@ -1,11 +1,9 @@
 package com.pan_american.android.ui.group_management.entry_and_exit_fee_detail
 
 import android.os.Bundle
-import android.util.Log
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
-import com.google.gson.Gson
 import com.pan_american.android.OASystem
 import com.pan_american.android.R
 import com.pan_american.android.base.BaseFragment
@@ -64,10 +62,11 @@ class InternationalTravelFeeFragment : BaseFragment<FragmentInternationalTravelF
     }
 
     private fun getInternationalTravelFeeDetail() {
-        Log.e("request", Gson().toJson(EntryAndExitPaymentTypeRequest(
-            diId = groupId,
-            subType = 2
-        )))
+
+        if (!isAdded) {
+            return
+        }
+
         apiService.getInternationalTravelFeeDetail(
             EntryAndExitPaymentTypeRequest(
                 diId = groupId,
@@ -116,6 +115,11 @@ class InternationalTravelFeeFragment : BaseFragment<FragmentInternationalTravelF
     }
 
     private fun getInternationalTravelTips() {
+
+        if (!isAdded) {
+            return
+        }
+
         apiService.getInternationalTravelTips(
             EntryAndExitTipsRequest(
                 groupId = groupId,
@@ -220,7 +224,10 @@ class InternationalTravelFeeFragment : BaseFragment<FragmentInternationalTravelF
 
     private fun updateInternationalTravel(updateInternationalTravelRequest: UpdateInternationalTravelRequest) {
 
-        Log.e("request", Gson().toJson(updateInternationalTravelRequest))
+        if (!isAdded) {
+            return
+        }
+
         apiService.updateInternationalTravelPayment(updateInternationalTravelRequest)
             .enqueue(object : Callback<UpdateInternationalTravelResponse> {
                 override fun onResponse(

+ 0 - 3
app/src/main/java/com/pan_american/android/ui/group_management/entry_and_exit_fee_detail/OtherPaymentDetailActivity.kt

@@ -3,10 +3,8 @@ package com.pan_american.android.ui.group_management.entry_and_exit_fee_detail
 import android.os.Bundle
 import android.text.Editable
 import android.text.TextWatcher
-import android.util.Log
 import android.widget.TextView
 import androidx.core.content.res.ResourcesCompat
-import com.google.gson.Gson
 import com.pan_american.android.OASystem
 import com.pan_american.android.R
 import com.pan_american.android.base.BaseActivity
@@ -355,7 +353,6 @@ class OtherPaymentDetailActivity : BaseActivity<ActivityOtherPaymentDetailBindin
     }
 
     private fun updateOtherPayment() {
-        Log.e("request", Gson().toJson(updateOtherPaymentRequest))
         apiService.updateEntryAndExitOtherPayment(updateOtherPaymentRequest).enqueue(object : Callback<BaseResponse> {
             override fun onResponse(call: Call<BaseResponse>, response: Response<BaseResponse>) {
                 val updateResponse = response.body()

+ 20 - 0
app/src/main/java/com/pan_american/android/ui/group_management/entry_and_exit_fee_detail/OtherPaymentFragment.kt

@@ -80,6 +80,11 @@ class OtherPaymentFragment : BaseFragment<FragmentOtherPaymentBinding>() {
     }
 
     private fun getPaymentList() {
+
+        if (!isAdded) {
+            return
+        }
+
         apiService.getEntryAndExitOtherPaymentList(
             EntryAndExitPaymentTypeRequest(
                 diId = groupId,
@@ -326,6 +331,11 @@ class OtherPaymentFragment : BaseFragment<FragmentOtherPaymentBinding>() {
     }
 
     private fun updateCurrency(currencyList: ArrayList<Selector>) {
+
+        if (!isAdded) {
+            return
+        }
+
         apiService.updateEntryAndExitCurrencyRate(
             UpdateEntryAndExitCurrencyRateRequest(
                 id = paymentId,
@@ -358,6 +368,11 @@ class OtherPaymentFragment : BaseFragment<FragmentOtherPaymentBinding>() {
     }
 
     private fun updateSelectStatus(status: Int) {
+
+        if (!isAdded) {
+            return
+        }
+
         apiService.updateEntryAndExitTypeStatus(
             UpdateEntryAndExitTypeStatusRequest(
                 id = paymentId,
@@ -390,6 +405,11 @@ class OtherPaymentFragment : BaseFragment<FragmentOtherPaymentBinding>() {
     }
 
     private fun deletePaymentItem(position: Int) {
+
+        if (!isAdded) {
+            return
+        }
+
         apiService.deleteEntryAndExitOtherPayment(DeleteEntryAndExitPaymentItemRequest(id = paymentList[position].subId))
             .enqueue(object : Callback<BaseResponse> {
                 override fun onResponse(