Example #1
0
        /// <summary>
        /// 根据用户id获取订单列表
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public async Task <OrderListRD> GetOrderListById(int userId, int page, int size)
        {
            string url = "/member/orderList?userId=" + userId.ToString()
                         + "&page=" + page.ToString()
                         + "&size=" + size.ToString();

            OrderListRD orderListRD = await RestSharpHelper <OrderListRD> .GetAsync(url);

            return(orderListRD);
        }
Example #2
0
        /// <summary>
        /// 根据用户id获取订单列表
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public async Task <OrderListRD> GetOrderListById(int userId, int page, int size)
        {
            string url = rootUrl3 + "/member/orderList?userId=" + userId.ToString()
                         + "&page=" + page.ToString()
                         + "&size=" + size.ToString();

            string responseBody = await GetStringDataAsync(url);

            OrderListRD orderListRD = JsonConvert.DeserializeObject <OrderListRD>(responseBody);

            return(orderListRD);
        }
        /// <summary>
        /// 根据用户id获取订单列表
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public static async Task <OrderListRD> GetOrderListById(int userId, int page, int size)
        {
            try
            {
                string url = "/member/orderList?userId=" + userId.ToString()
                             + "&page=" + page.ToString()
                             + "&size=" + size.ToString();

                OrderListRD orderListRD = await RestSharpHelper <OrderListRD> .GetAsync(url);

                return(orderListRD);
            }
            catch (ApplicationException ex)
            {
                throw ex;
            }
        }
        public async void InitOrderList()
        {
            try
            {
                IndicatorIsRunning = true;
                if (!Tools.IsNetConnective())
                {
                    CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long);
                    return;
                }

                RestSharpService _restSharpService = new RestSharpService();
                int         size        = 10;
                OrderListRD orderListRD = await _restSharpService.GetOrderListById(GlobalVariables.LoggedUser.id, page, size);

                if (orderListRD.result.data.Count != 0)
                {
                    foreach (var item in orderListRD.result.data)
                    {
                        OrderList.Add(item);
                    }

                    TotalOrderNum = orderListRD.result.total;
                    OrderNum     += orderListRD.result.data.Count;
                    Visible       = false;

                    foreach (var item in OrderList)
                    {
                        switch (item.paymentType)
                        {
                        case 1: item.PaymentType = "立即支付"; break;

                        case 2: item.PaymentType = "延期一个月"; break;

                        case 3: item.PaymentType = "延期两个月"; break;

                        default:
                            break;
                        }

                        switch (item.orderStatus)
                        {
                        case "0": item.OrderStatus = "未付款"; break;

                        case "1": item.OrderStatus = "已付款"; break;

                        case "2": item.OrderStatus = "未发货"; break;

                        case "3": item.OrderStatus = "已发货"; break;

                        case "4": item.OrderStatus = "交易成功"; break;

                        case "5": item.OrderStatus = "交易关闭"; break;

                        case "6": item.OrderStatus = "交易失败"; break;

                        default:
                            break;
                        }
                    }
                }
                else
                {
                    Visible = true;
                }
                ChangeButtonText();
                IndicatorIsRunning = false;
            }
            catch (Exception)
            {
                throw;
            }
        }