104 lines
2.4 KiB
C#
104 lines
2.4 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
public class OrderPanel : MonoBehaviour
|
|||
|
{
|
|||
|
public ScrollRect sv;
|
|||
|
|
|||
|
public GameObject orderObj;
|
|||
|
|
|||
|
|
|||
|
private string urlPath = "/snail/order/queryPage";
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
private OrderInfo orderInfo;
|
|||
|
|
|||
|
// Start is called before the first frame update
|
|||
|
void Start()
|
|||
|
{
|
|||
|
ReGetOrder();
|
|||
|
}
|
|||
|
|
|||
|
// Update is called once per frame
|
|||
|
void Update()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public class OrderMsg
|
|||
|
{
|
|||
|
public int orderByDesc { get; set; }
|
|||
|
}
|
|||
|
|
|||
|
public class OrderInfo
|
|||
|
{
|
|||
|
public int code;
|
|||
|
public string message;
|
|||
|
public OrderData data = new OrderData();
|
|||
|
}
|
|||
|
|
|||
|
public class OrderData
|
|||
|
{
|
|||
|
public int pageNo;
|
|||
|
public int pageSize;
|
|||
|
public int totalCount;
|
|||
|
public List<OrderList> dataList = new List<OrderList>();
|
|||
|
}
|
|||
|
|
|||
|
public class OrderList
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD>id
|
|||
|
public int userId;
|
|||
|
//<2F><>Ʒid
|
|||
|
public int productId;
|
|||
|
public int productType;
|
|||
|
//0֧<30><D6A7><EFBFBD>У<EFBFBD>1<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>2ʧ<32><CAA7>
|
|||
|
public int payStatus;
|
|||
|
public int price;
|
|||
|
//<2F>µ<EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
public string createTime;
|
|||
|
public string receiveName;
|
|||
|
public string receivePhone;
|
|||
|
public string area;
|
|||
|
public string address;
|
|||
|
}
|
|||
|
|
|||
|
OrderMsg msg = new OrderMsg() { orderByDesc = 1 };
|
|||
|
|
|||
|
//<><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
|||
|
private Dictionary<string, string> headInfo = new Dictionary<string, string>
|
|||
|
{
|
|||
|
{ "Authorization", Global.global.serverResponse.data.token }
|
|||
|
};
|
|||
|
|
|||
|
//
|
|||
|
public async Task ReGetOrder()
|
|||
|
{
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//<2F>첽<EFBFBD><ECB2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
string responsel6 = await web.SendRequest(web.URL + "/snail/order/queryPage", "POST", JsonUtility.ToJson(msg), headInfo);
|
|||
|
|
|||
|
Debug.Log(responsel6);
|
|||
|
//orderInfo = JsonUtility.FromJson<OrderInfo>(responsel6);
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
orderInfo = new OrderInfo();
|
|||
|
orderInfo.data.dataList.Add(new OrderList());
|
|||
|
orderInfo.data.dataList.Add(new OrderList());
|
|||
|
orderInfo.data.dataList.Add(new OrderList());
|
|||
|
|
|||
|
for (int i = 0; i < orderInfo.data.dataList.Count; i++)
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
GameObject go = Instantiate(orderObj);
|
|||
|
go.transform.SetParent(sv.content, false);
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
go.GetComponent<OrderObj>().UpdatePanel(orderInfo.data.dataList[i]);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|