Browse Source

2024-05-23 新增

新增

1. 机票费用 新增/详细 界面,新增 显示成本 弹出弹窗展示成本表格
zhaiy 10 months ago
parent
commit
f5e8cd89ee

+ 16 - 0
app/src/main/java/com/pan_american/android/data/model/group_airplane_ticket/airplane_payment_insert/entity/AirplaneCost.kt

@@ -0,0 +1,16 @@
+package com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.entity
+
+import com.bin.david.form.annotation.SmartColumn
+import com.bin.david.form.annotation.SmartTable
+
+@SmartTable(name = "机票成本")
+class AirplaneCost {
+    @SmartColumn(id = 1, name = "舱位类型")
+    var airType = ""
+    @SmartColumn(id = 2, name = "人数")
+    var airNum = 0
+    @SmartColumn(id = 3, name = "单人成本")
+    var airDRCB = 0.0
+    @SmartColumn(id = 4, name = "总成本")
+    var airZCB = 0.0
+}

+ 12 - 0
app/src/main/java/com/pan_american/android/data/model/group_airplane_ticket/airplane_payment_insert/entity/AirplaneItinerary.kt

@@ -0,0 +1,12 @@
+package com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.entity
+
+import com.bin.david.form.annotation.SmartColumn
+import com.bin.david.form.annotation.SmartTable
+
+@SmartTable(name = "机票行程")
+class AirplaneItinerary {
+    @SmartColumn(id = 1, name = "日期", fixed = true)
+    var date = ""
+    @SmartColumn(id = 2, name = "行程")
+    var itinerary = ""
+}

+ 15 - 0
app/src/main/java/com/pan_american/android/data/model/group_airplane_ticket/airplane_payment_insert/network/AirplaneCostDetailResponse.kt

@@ -0,0 +1,15 @@
+package com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.network
+
+import com.pan_american.android.base.BaseResponse
+import com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.entity.AirplaneCost
+import com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.entity.AirplaneItinerary
+
+class AirplaneCostDetailResponse(val data: Data): BaseResponse() {
+
+    inner class Data (val modulePromptInfos: ArrayList<AirplaneCostDetail>)
+
+    inner class AirplaneCostDetail(val currencyCode: String, val rate: Double, val data: AirplaneCostLists)
+
+    inner class AirplaneCostLists(val airFeeData: ArrayList<AirplaneCost>, val airInitData: ArrayList<AirplaneItinerary>)
+
+}

+ 7 - 0
app/src/main/java/com/pan_american/android/data/network/APIService.kt

@@ -29,6 +29,7 @@ import com.pan_american.android.data.model.daily_payment.network.DailyPaymentLis
 import com.pan_american.android.data.model.daily_payment.network.DailyPaymentSelectorItemResponse
 import com.pan_american.android.data.model.daily_payment.network.DailyPaymentSiftResponse
 import com.pan_american.android.data.model.daily_payment.network.UpdateDailyPaymentRequest
+import com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.network.AirplaneCostDetailResponse
 import com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.network.AirplaneTicketDetailRequest
 import com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.network.AirplaneTicketDetailResponse
 import com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.network.AirplaneTicketListRequest
@@ -441,6 +442,12 @@ interface APIService {
     @POST("/api/Groups/AirTicketResSelect")
     fun getAirplaneTicketSelectorResource(@Body airplaneTicketSelectorResourceRequest: AirplaneTicketSelectorResourceRequest): Call<AirplaneTicketSelectorResourceResponse>
 
+    /**
+     * 团组机票,团组成本
+     */
+    @POST("/api/Groups/PostGroupCostModulePrompt")
+    fun getAirplaneCostData(@Body groupCostDataRequest: GroupCostDataRequest): Call<AirplaneCostDetailResponse>
+
     /**
      * 团组机票费用录入,添加/修改费用信息
      * status: 1. 新增    2. 修改

+ 98 - 0
app/src/main/java/com/pan_american/android/ui/group_airplane_ticket/airplane_payment_insert/AddAirplaneTicketActivity.kt

@@ -3,10 +3,15 @@ package com.pan_american.android.ui.group_airplane_ticket.airplane_payment_inser
 import android.os.Bundle
 import android.text.Editable
 import android.text.TextWatcher
+import android.view.Gravity
 import android.view.View
+import android.view.ViewGroup
+import android.widget.PopupWindow
 import android.widget.TextView
 import androidx.core.content.res.ResourcesCompat
 import androidx.recyclerview.widget.LinearLayoutManager
+import com.bin.david.form.core.SmartTable
+import com.bin.david.form.data.style.FontStyle
 import com.pan_american.android.OASystem
 import com.pan_american.android.R
 import com.pan_american.android.base.BaseActivity
@@ -15,7 +20,11 @@ import com.pan_american.android.base.CardAdapter
 import com.pan_american.android.base.ListAdapter
 import com.pan_american.android.data.model.common.entity.CardPaymentResource
 import com.pan_american.android.data.model.common.entity.Selector
+import com.pan_american.android.data.model.common.network.GroupCostDataRequest
+import com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.entity.AirplaneCost
+import com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.entity.AirplaneItinerary
 import com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.entity.AirplaneTicketResource
+import com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.network.AirplaneCostDetailResponse
 import com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.network.AirplaneTicketDetailRequest
 import com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.network.AirplaneTicketDetailResponse
 import com.pan_american.android.data.model.group_airplane_ticket.airplane_payment_insert.network.AirplaneTicketSelectorResourceRequest
@@ -93,6 +102,16 @@ class AddAirplaneTicketActivity : BaseActivity<ActivityAddAirplaneTicketBinding>
 
     private var isAuditGM = -1
 
+    private var airplaneCostInit = false
+
+    private var airplaneCostCurrency = ""
+
+    private var airplaneCostExchangeRate = 0.0
+
+    private var airplaneCostList = ArrayList<AirplaneCost>()
+
+    private var airplaneItineraryList = ArrayList<AirplaneItinerary>()
+
     override fun getViewBinding() = ActivityAddAirplaneTicketBinding.inflate(layoutInflater)
 
     override fun onCreate(savedInstanceState: Bundle?) {
@@ -129,9 +148,88 @@ class AddAirplaneTicketActivity : BaseActivity<ActivityAddAirplaneTicketBinding>
                 titleText.text = resources.getString(R.string.add_airplane_ticket_payment)
             }
 
+            rightTextField.apply {
+                visibility = View.VISIBLE
+                text = resources.getString(R.string.show_cost)
+            }
+
             backButton.setOnClickListener {
                 back()
             }
+
+            rightTextField.setOnClickListener {
+
+                val airplaneCostPopView = View.inflate(OASystem.context, R.layout.popup_airplane_cost_table, null)
+                popupWindow = PopupWindow(airplaneCostPopView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
+
+                showPopupWindow {
+
+                    val currencyAbbr = airplaneCostPopView.findViewById<TextView>(R.id.currency_abbr)
+                    val exchangeRate = airplaneCostPopView.findViewById<TextView>(R.id.exchange_rate)
+                    val airplaneCostTable = airplaneCostPopView.findViewById<SmartTable<AirplaneCost>>(R.id.airplane_cost_table)
+                    val airplaneItineraryTable = airplaneCostPopView.findViewById<SmartTable<AirplaneItinerary>>(R.id.airplane_itinerary_table)
+
+                    airplaneCostTable.config.apply {
+                        isShowXSequence = false
+                        isShowYSequence = false
+                        tableTitleStyle = FontStyle(50, ResourcesCompat.getColor(resources, R.color.text_color, theme))
+                        contentStyle = FontStyle(40, ResourcesCompat.getColor(resources, R.color.text_color, theme))
+                    }
+
+                    airplaneItineraryTable.config.apply {
+                        isShowXSequence = false
+                        isShowYSequence = false
+                        tableTitleStyle = FontStyle(50, ResourcesCompat.getColor(resources, R.color.text_color, theme))
+                        contentStyle = FontStyle(40, ResourcesCompat.getColor(resources, R.color.text_color, theme))
+                    }
+
+                    if (!airplaneCostInit) {
+                        apiService.getAirplaneCostData(GroupCostDataRequest(groupId, OASystem.C_TABLE_AIRPLANE_TICKET)).enqueue(object : Callback<AirplaneCostDetailResponse> {
+                            override fun onResponse(
+                                call: Call<AirplaneCostDetailResponse>,
+                                response: Response<AirplaneCostDetailResponse>
+                            ) {
+
+                                val costResponse = response.body()
+
+                                if (costResponse != null) {
+                                    if (costResponse.code == 200) {
+
+                                        airplaneCostCurrency = costResponse.data.modulePromptInfos[0].currencyCode
+                                        airplaneCostExchangeRate = costResponse.data.modulePromptInfos[0].rate
+
+                                        airplaneCostList = costResponse.data.modulePromptInfos[0].data.airFeeData
+                                        airplaneItineraryList = costResponse.data.modulePromptInfos[0].data.airInitData
+
+                                        currencyAbbr.text = airplaneCostCurrency
+                                        exchangeRate.text = airplaneCostExchangeRate.toString()
+
+                                        airplaneCostTable.setData(airplaneCostList)
+                                        airplaneItineraryTable.setData(airplaneItineraryList)
+
+                                        airplaneCostInit = true
+
+                                    } else {
+                                        showMessage(costResponse.msg)
+                                    }
+                                }
+                            }
+
+                            override fun onFailure(call: Call<AirplaneCostDetailResponse>, t: Throwable) {
+                                showErrorInfo(R.string.airplane_cost_get_failed)
+                            }
+                        })
+                    } else {
+                        currencyAbbr.text = airplaneCostCurrency
+                        exchangeRate.text = airplaneCostExchangeRate.toString()
+
+                        airplaneCostTable.setData(airplaneCostList)
+                        airplaneItineraryTable.setData(airplaneItineraryList)
+                    }
+
+                    popupWindow.showAtLocation(binding.root, Gravity.BOTTOM, 0, 0)
+                }
+            }
         }
     }
 

+ 5 - 5
app/src/main/java/com/pan_american/android/ui/group_op/ground_convey_payment_insert/GroundConveyPaymentDetailActivity.kt

@@ -139,9 +139,9 @@ class GroundConveyPaymentDetailActivity : BaseActivity<ActivityGroundConveyPayme
 
                     val currencyAbbr = groundConveyCostPopView.findViewById<TextView>(R.id.currency_abbr)
                     val exchangeRate = groundConveyCostPopView.findViewById<TextView>(R.id.exchange_rate)
-                    val hotelCostTable = groundConveyCostPopView.findViewById<SmartTable<GroundConveyCost>>(R.id.table)
+                    val groundConveyCostTable = groundConveyCostPopView.findViewById<SmartTable<GroundConveyCost>>(R.id.table)
 
-                    hotelCostTable.config.apply {
+                    groundConveyCostTable.config.apply {
                         isShowXSequence = false
                         isShowYSequence = false
                         tableTitleStyle = FontStyle(50, ResourcesCompat.getColor(resources, R.color.text_color, theme))
@@ -168,7 +168,7 @@ class GroundConveyPaymentDetailActivity : BaseActivity<ActivityGroundConveyPayme
                                         currencyAbbr.text = groundConveyCostCurrency
                                         exchangeRate.text = groundConveyCostExchangeRate.toString()
 
-                                        hotelCostTable.setData(groundConveyCostList)
+                                        groundConveyCostTable.setData(groundConveyCostList)
 
                                         groundConveyCostInit = true
 
@@ -179,14 +179,14 @@ class GroundConveyPaymentDetailActivity : BaseActivity<ActivityGroundConveyPayme
                             }
 
                             override fun onFailure(call: Call<GroundConveyCostDetailResponse>, t: Throwable) {
-                                showErrorInfo(R.string.hotel_cost_detail_get_failed)
+                                showErrorInfo(R.string.ground_convey_cost_get_failed)
                             }
                         })
                     } else {
                         currencyAbbr.text = groundConveyCostCurrency
                         exchangeRate.text = groundConveyCostExchangeRate.toString()
 
-                        hotelCostTable.setData(groundConveyCostList)
+                        groundConveyCostTable.setData(groundConveyCostList)
                     }
 
                     popupWindow.showAtLocation(binding.root, Gravity.BOTTOM, 0, 0)

+ 84 - 0
app/src/main/res/layout/popup_airplane_cost_table.xml

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@drawable/shape_corner_white"
+    android:orientation="vertical"
+    tools:viewBindingIgnore="true">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/common_padding"
+        android:layout_marginTop="@dimen/common_padding_huge"
+        android:layout_marginEnd="@dimen/common_padding"
+        android:layout_marginBottom="@dimen/common_padding"
+        android:orientation="horizontal">
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/currency"
+            android:textColorHint="@color/text_color"
+            android:textSize="@dimen/text_size_medium" />
+
+        <TextView
+            android:id="@+id/currency_abbr"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:gravity="end"
+            android:hint="@string/no_info"
+            android:textColor="@color/text_color"
+            android:textColorHint="@color/hint_text_color"
+            android:textSize="@dimen/text_size_medium" />
+
+        <View
+            android:layout_width="@dimen/line"
+            android:layout_height="match_parent"
+            android:layout_marginStart="@dimen/common_padding_heavy"
+            android:layout_marginEnd="@dimen/common_padding_heavy"
+            android:background="@color/line_color" />
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/exchange_rate"
+            android:textColorHint="@color/text_color"
+            android:textSize="@dimen/text_size_medium" />
+
+        <TextView
+            android:id="@+id/exchange_rate"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:gravity="end"
+            android:hint="@string/no_info"
+            android:textColor="@color/text_color"
+            android:textColorHint="@color/hint_text_color"
+            android:textSize="@dimen/text_size_medium" />
+
+    </LinearLayout>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/line"
+        android:layout_marginStart="@dimen/common_padding"
+        android:layout_marginEnd="@dimen/common_padding"
+        android:background="@color/line_color" />
+
+    <com.bin.david.form.core.SmartTable
+        android:id="@+id/airplane_cost_table"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:layout_margin="@dimen/common_padding" />
+
+    <com.bin.david.form.core.SmartTable
+        android:id="@+id/airplane_itinerary_table"
+        android:layout_width="match_parent"
+        android:layout_height="500dp"
+        android:layout_margin="@dimen/common_padding" />
+
+</LinearLayout>

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

@@ -656,6 +656,7 @@
 
     <!-- 机票费用详情,错误信息 -->
     <string name="get_airplane_ticket_info_failed">获取机票详情失败</string>
+    <string name="airplane_cost_get_failed">机票成本获取失败</string>
 
     <!-- OP费用录入 -->
     <string name="add_ground_entry_payment">新增地接费用</string>
@@ -697,6 +698,7 @@
 
     <!-- OP费用录入详情,错误信息 -->
     <string name="ground_convey_info_get_failed">地接费用详情获取失败</string>
+    <string name="ground_convey_cost_get_failed">地接费用成本获取失败</string>
 
     <!-- OP费用录入详情 -->
     <string name="cost_entry_detail">费用录入详情</string>