账单详情整完了

This commit is contained in:
wulongxiao 2024-12-18 17:04:21 +08:00
parent 0db2e858d0
commit ab765c38d8
8 changed files with 137 additions and 33 deletions

View File

@ -9,6 +9,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 8800312809106112679}
- component: {fileID: 4613460312564376388}
m_Layer: 5
m_Name: Asset_Details_item
m_TagString: Untagged
@ -23,7 +24,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8800312809106112678}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -38,6 +39,20 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 46.3059}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &4613460312564376388
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8800312809106112678}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e3eea65db936075409912a8a7d52d647, type: 3}
m_Name:
m_EditorClassIdentifier:
info: {fileID: 8800312809432703904}
number: {fileID: 8800312810282259072}
--- !u!1 &8800312809432703918
GameObject:
m_ObjectHideFlags: 0

View File

@ -92,8 +92,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 72535d4c13f2ce34ab87fb251511760c, type: 3}
m_Name:
m_EditorClassIdentifier:
time: {fileID: 0}
count: {fileID: 0}
time: {fileID: 3085038605624301837}
count: {fileID: 3085038605682806839}
--- !u!1 &3085038604622350453
GameObject:
m_ObjectHideFlags: 0
@ -130,7 +130,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 35}
m_SizeDelta: {x: 0, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3085038605624301827
GameObject:
@ -166,9 +166,9 @@ RectTransform:
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.09248908, y: 1}
m_AnchoredPosition: {x: -0.5, y: 0}
m_SizeDelta: {x: -1, y: 0}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: -1.4489136, y: 0}
m_SizeDelta: {x: -2.8979034, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3085038605624301836
CanvasRenderer:
@ -200,16 +200,16 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 30
m_FontSize: 45
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_BestFit: 1
m_MinSize: 30
m_MaxSize: 50
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: 09.16
--- !u!1 &3085038605682806837
@ -245,10 +245,10 @@ RectTransform:
m_Father: {fileID: 3085038604622350452}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0.079}
m_AnchorMin: {x: 0.7737991, y: 0}
m_AnchorMin: {x: 0.6107773, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -0.43347168, y: 0.5}
m_SizeDelta: {x: 0.9021001, y: -1}
m_AnchoredPosition: {x: 0.8760376, y: 0.5}
m_SizeDelta: {x: -1.7642975, y: -1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3085038605682806838
CanvasRenderer:
@ -280,15 +280,15 @@ MonoBehaviour:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 30
m_FontSize: 45
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_BestFit: 1
m_MinSize: 30
m_MaxSize: 50
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: "\u603B\u8BA1\uFF1A-\xA5195"

View File

@ -104663,6 +104663,11 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &1453243347 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6931136037450377241, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3}
m_PrefabInstance: {fileID: 1553952861}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1454508580
GameObject:
m_ObjectHideFlags: 0
@ -112912,7 +112917,15 @@ PrefabInstance:
- target: {fileID: 1553952866, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3}
propertyPath: itemPrefab
value:
objectReference: {fileID: 8800312809106112678, guid: 8b02cd965c34edb4ebf6d67db033ccd2, type: 3}
- target: {fileID: 1553952866, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3}
propertyPath: itemBoxPrefab
value:
objectReference: {fileID: 3085038604584877223, guid: ce7baf84b8801624aa22e8f29b4b95b7, type: 3}
- target: {fileID: 1553952866, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3}
propertyPath: itemBoxPrefabParent
value:
objectReference: {fileID: 1453243347}
- target: {fileID: 65411648539017065, guid: e80ddc32e04c4a44eaeabc0e8937a298, type: 3}
propertyPath: m_AnchorMax.y
value: 0

View File

@ -12,6 +12,11 @@ public class Asset_Details : MonoBehaviour
public Text HaveMoneyText;
public GameObject itemBoxPrefab;
public GameObject itemBoxPrefabParent;
public List<GameObject> itemBoxPrefabList = new List<GameObject>();
public GameObject itemPrefab;
// Start is called before the first frame update
void Start()
@ -27,7 +32,9 @@ public class Asset_Details : MonoBehaviour
/// <param name="type">1±¦Ê¯,2½ð±Ò,3Ë®,4¶ÍÔìÁî</param>
public async void ShowPanel(int type)
{
DeleteAllChildren(itemBoxPrefabParent);
billingStatisticsData info=await Scene_main_jiekou.instance.GetbillingStatisticsData(type);
switch (type)
@ -48,7 +55,18 @@ public class Asset_Details : MonoBehaviour
IcomeList infoIcomeList = await Scene_main_jiekou.instance.GetIncomeList(1,10,type);
foreach (statistics value in infoIcomeList.Data.statistics)
{
GameObject go = GameObject.Instantiate(itemBoxPrefab, itemBoxPrefabParent.transform);
go.GetComponent<Asset_Details_itembox>().init(value.date_time.ToString(), (value.total_income-value.total_expend).ToString());
itemBoxPrefabList.Add(go);
}
foreach (Transaction value in infoIcomeList.Data.List)
{
GameObject.Instantiate(itemPrefab, itemBoxPrefabList[0].transform).GetComponent<Asset_Details_item>().init(value.Income,value.Remark,value.Amount);
}
this.gameObject.SetActive(true);
}
@ -67,4 +85,24 @@ public class Asset_Details : MonoBehaviour
GiveMoneyText.text = "£¤" + give;
HaveMoneyText.text = "£¤" + have;
}
public void DeleteAllChildren(GameObject obg)
{
// 确保父物体不为空
if (obg != null)
{
// 遍历父物体的所有子物体并删除
foreach (Transform child in obg.transform)
{
GameObject.Destroy(child.gameObject);
}
itemBoxPrefabList.Clear();
}
else
{
Debug.LogWarning("itemBoxPrefabParent is not assigned.");
}
}
}

View File

@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Asset_Details_item : MonoBehaviour
{
public Text info;
public Text number;
public void init(bool _bool,string info,string number)
{
if (_bool)
{
this.info.text = info;
this.number.text = "<b><color=#FF0000FF>+£¤" + number+ "</color></b>";
}
else
{
this.info.text = info;
this.number.text ="<b><color=red>-£¤" + number+ "</color></b>";
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e3eea65db936075409912a8a7d52d647
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -6,12 +6,11 @@ using UnityEngine.UI;
public class Asset_Details_itembox : MonoBehaviour
{
public Text time;
public Text count;
public void init(string time,string count)
{
this.time.text = time;
this.count.text = count;
this.time.text = "时间:" + time;
this.count.text ="总计:"+ count;
}
}

View File

@ -43,7 +43,8 @@ public class IcomeListData
{
public IcomeListPageInfo Pages { get; set; }
public List<Transaction> List { get; set; }
public List<Statistics> Statistics { get; set; }
public List<statistics> statistics { get; set; }
}
public class IcomeListPageInfo
@ -65,9 +66,11 @@ public class Transaction
public string CreateTime { get; set; }
}
public class Statistics
public class statistics
{
public int DateTime { get; set; }
public int TotalExpend { get; set; }
public int TotalIncome { get; set; }
}
public int date_time { get; set; }
public float total_expend { get; set; }
public float total_income { get; set; }
}