/// <summary>
        /// 正式提交订单
        /// </summary>
        protected override bool SubmitOrderInternal()
        {
            if (!base.SubmitOrderInternal())
            {
                return(false);
            }

            if (!_orderInfoChecked && !CheckOrderInfo())
            {
                return(false);
            }

            if (NeedVc == true && RandCode.IsNullOrEmpty())
            {
                SetSubmitOrderError("[NEEDVC] 请输入验证码");
                return(false);
            }


            if (NeedVcTime > 0)
            {
                var safeTime = NeedVcTime - (int)(DateTime.Now - VcBaseTime.Value).TotalMilliseconds;
                StateMessage = $"Delayed for {safeTime}ms";
                Trace.TraceInformation($"SUMITORDER: DELAY {safeTime}ms");
                if (safeTime > 0)
                {
                    Thread.Sleep(safeTime);
                }
            }
            if (!RandCode.IsNullOrEmpty())
            {
                StateMessage = "正在校验验证码...";

                //var result = Session.NetClient.RunRequestLoop(
                //											 () => Session.NetClient.Create(HttpMethod.Post,
                //																			"passcodeNew/checkRandCodeAnsyn",
                //																			currentPage,
                //																			new {randCode = RandCode, rand = "randp", _json_att = Session.Attributes ?? "", REPEAT_SUBMIT_TOKEN = Token},
                //																			new {data = new {result = 0}}, isXhr: true
                //														),
                //											_ => StateMessage = $"[{_}] 正在校验验证码...");
                //Session.LastCheckRandCodeTime = DateTime.Now;
                //if (!result.IsValid())
                //{
                //	SetSubmitOrderError("校验验证码时网络错误,请重试");
                //	return;
                //}
                //if (result.Result.data.result != 1)
                //{
                //	SetSubmitOrderError("验证码错误,请重试。");
                //	return;
                //}
                var result = Session.NetClient.VerifyRandCode(Query.Resign ? RandCodeType.RandpResign : RandCodeType.Randp, RandCode, null, _ => StateMessage = $"[{_}] 正在检查验证码……");

                if (!result.IsNullOrEmpty())
                {
                    SetSubmitOrderError(result.DefaultForEmpty("验证码错误"));
                    return(false);
                }
            }

            //检测队列信息。仅异步模式下需要。
            if (Async)
            {
                var queueSeat = Passengers[0].SeatType;
                StateMessage = "正在检测排队信息....";
                var checkQueueData = new NameValueCollection
                {
                    { "train_date", Date.Date.ToString("R") },
                    //checkQueueData.Add("train_date", "Mon Apr 28 2014 00:00:00 GMT+0800 (中国标准时间)");
                    { "train_no", Train.Id },
                    { "stationTrainCode", Train.Code },
                    { "seatType", queueSeat.ToString() },
                    { "fromStationTelecode", Train.FromStation.Code },
                    { "toStationTelecode", Train.ToStation.Code },
                    { "leftTicket", LeftTicketStr },
                    { "purpose_codes", _purposeCode }
                };
                if (_isCheckOrderInfo != null)
                {
                    checkQueueData.Add("isCheckOrderInfo", _isCheckOrderInfo);
                }
                checkQueueData.Add("_json_att", Session.Attributes ?? "");
                checkQueueData.Add("train_location", TrainLocation);
                checkQueueData.Add("REPEAT_SUBMIT_TOKEN", Token);

                var checkQueueResult = Session.NetClient.RunRequestLoop(
                    _ => Session.NetClient.Create <GetQueueCountResponse>(HttpMethod.Post, "confirmPassenger/getQueueCount", _currentPage, checkQueueData), _ => StateMessage = $"[{_}] 正在检测排队信息...."
                    );

                if (!checkQueueResult.IsValid())
                {
                    SetSubmitOrderError("网络错误:" + checkQueueResult?.GetErrorMsg());
                    return(false);
                }

                if (!checkQueueResult.Result.Status || checkQueueResult.Result.Data == null)
                {
                    SetSubmitOrderError(checkQueueResult.Result.Messages.JoinAsString("").DefaultForEmpty("系统忙,请重试"));
                    return(false);
                }

                if (checkQueueResult.Result.Data.isRelogin == "Y")
                {
                    SetSubmitOrderError("登录状态异常,请重新登录。");
                    return(false);
                }

                SetTicketCount(queueSeat, checkQueueResult.Result.Data.ticket);
                if (!CheckTicketCount())
                {
                    return(false);
                }

                WaitCount = checkQueueResult.Result.Data.countT.ToInt32();
                if (checkQueueResult.Result.Data.op_2 == "true")
                {
                    if (OrderConfiguration.Instance.IgnoreQueueError)
                    {
                        QueueWarning = true;
                    }
                    else
                    {
                        SetSubmitOrderError("排队人数过多,不允许提交订单。排队人数=" + (WaitCount > 0 ? WaitCount.ToString() : "<已无票>"));
                        return(false);
                    }
                }
            }

            //开始提交订单
            StateMessage = "正在提交订单...";

            //座位
            var(seats, beds) = BuildSeatInfo();

            var orderData = new NameValueCollection
            {
                { "passengerTicketStr", PassengerString[0] },
                { "oldPassengerStr", PassengerString[1] },
                { "purpose_codes", _purposeCode },
                { "key_check_isChange", KeyCheckIsChange },
                { "leftTicketStr", LeftTicketStr },
                { "train_location", TrainLocation },
                { "choose_seats", seats },
                { "seatDetailType", beds },
                { "whatsSelect", "1" },               //受让人为0
                { "roomType", "00" },                 //动卧需要
                { "dwAll", BuyAllSeat ? "Y" : "N" },
                { "_json_att", Session.Attributes ?? "" },
                { "REPEAT_SUBMIT_TOKEN", Token }
            };

            if (!RandCode.IsNullOrEmpty())
            {
                orderData.Add("randCode", RandCode);
            }

            //Thread.Sleep(Configuration.SubmitOrder.Current.OrderSubmitDelay);

#if DEBUG
            if (TestFlag.BlockOrderSubmit)
            {
                SetSubmitOrderError("[测试]余票不足!");
            }

            if (TestFlag.BlockOrderSubmit || TestFlag.FakeOrderSubmit)
            {
                return(false);
            }
#endif
            //confirmPassenger/confirmSingle
            //confirmPassenger/confirmGo
            //confirmPassenger/confirmBack
            //confirmPassenger/confirmResign

            //延迟
            var submiturl     = Async ? (Query.Resign ? "confirmPassenger/confirmResignForQueue" : "confirmPassenger/confirmSingleForQueue") : (Query.Resign ? "confirmPassenger/confirmResign" : "confirmPassenger/confirmSingle");
            var orderResponse = Session.NetClient.RunRequestLoop(
                _ => Session.NetClient.Create(
                    FSLib.Network.Http.HttpMethod.Post,
                    submiturl,
                    _currentPage,
                    orderData,
                    new
            {
                status = false,
                data   = new
                {
                    submitStatus = true,
                    errMsg       = ""
                },
                messages = new string[0]
            }),
                _ => StateMessage = $"[{_}] 正在提交订单..."
                );
            if (orderResponse == null || !orderResponse.IsSuccess)
            {
                SetSubmitOrderError("网络错误:[SUBMITORDER] " + orderResponse?.GetErrorMsg());
                return(false);
            }
            var orderresult = orderResponse.Result;
            if (orderresult.status)
            {
                if (!orderresult.data.submitStatus)
                {
                    SetSubmitOrderError("提交订单错误:" + orderresult.data.errMsg);
                }
                else if (!Async)
                {
                    LoadOrderIdFromNotComplete();
                }
            }
            else
            {
                SetSubmitOrderError(orderresult.messages.JoinAsString("").DefaultForEmpty("系统忙"));
            }

            return(true);
        }
        //bool _hasTryReloadingPassenger = false;

        /// <summary>
        /// 正式提交订单
        /// </summary>
        protected override bool SubmitOrderInternal()
        {
            if (!base.SubmitOrderInternal())
            {
                return(false);
            }

            var purposeCode = IsStudent ? "0X00" : "ADULT";

            //test.import cookies.js


            if (NeedVcTime > 0)
            {
                var safeTime = NeedVcTime - (int)(DateTime.Now - VcBaseTime.Value).TotalMilliseconds;
                StateMessage = $"Delayed for {safeTime}ms";
                if (safeTime > 0)
                {
                    Thread.Sleep(safeTime);
                }
            }
            if (!RandCode.IsNullOrEmpty())
            {
                StateMessage = "正在校验验证码...";

                //var result =
                //	Session.NetClient.RunRequestLoop(
                //									 () =>
                //									Session.NetClient.Create(HttpMethod.Post,
                //															"passcodeNew/checkRandCodeAnsyn",
                //															"leftTicket/init",
                //															new { randCode = RandCode, rand = "randp", _json_att = Session.Attributes ?? "" },
                //															new { data = new { result = 0 }, messages = new List<string>() }, isXhr: true
                //										),
                //									_ => StateMessage = $"[{_}] 正在校验验证码..."
                //		);
                //Session.LastCheckRandCodeTime = DateTime.Now;

                //if (!result.IsValid())
                //{
                //	SetSubmitOrderError("校验验证码时网络错误,请重试");
                //	return;
                //}
                //if (result.Result.data == null)
                //{
                //	if (result.Result.messages?.Count > 0)
                //	{
                //		SetSubmitOrderError(result.Result.messages.JoinAsString(""));
                //	}
                //	else
                //		SetSubmitOrderError($"未知错误信息。返回:{(result.ResponseContent as FSLib.Network.Http.ResponseStringContent)?.StringResult}");

                //	return;
                //}
                //if (result.Result.data.result != 1)
                //{
                //	SetSubmitOrderError("验证码错误,请重试。");
                //	return;
                //}
                var result = Session.NetClient.VerifyRandCode(Query.Resign ? RandCodeType.RandpResign : RandCodeType.Randp, RandCode, null, _ => StateMessage = $"[{_}] 正在检查验证码……");

                if (!result.IsNullOrEmpty())
                {
                    SetSubmitOrderError(result);
                    return(false);
                }
            }

#if DEBUG
            if (TestFlag.BlockOrderSubmit)
            {
                SetSubmitOrderError("[测试]余票不足!");
            }

            if (TestFlag.BlockOrderSubmit || TestFlag.FakeOrderSubmit)
            {
                return(false);
            }
#endif


            //提交订单
            StateMessage = "正在提交订单...";
            //座位
            var(seats, beds) = BuildSeatInfo();

            var orderData = new NameValueCollection();
            orderData.Add("passengerTicketStr", PassengerString[0]);
            orderData.Add("oldPassengerStr", PassengerString[1]);
            //if (ForceMode)
            //	orderData.Add("tour_flag", "dc");
            orderData.Add("randCode", RandCode);
            orderData.Add("purpose_codes", purposeCode);
            orderData.Add("key_check_isChange", KeyCheckIsChange);
            //if (!ForceMode)
            orderData.Add("leftTicketStr", LeftTicketStr);
            orderData.Add("train_location", TrainLocation);
            orderData.Add("_json_att", Session.Attributes ?? "");
            orderData.Add("choose_seats", seats);                 //二等ABCDF 一等ACDF 特等 AC
            orderData.Add("seatDetailType", beds);                //下铺中铺上铺,每个铺位的数字

            var ordertask = Session.NetClient.RunRequestLoop(
                _ =>
                Session.NetClient.Create <OrderQueueResponse>(
                    HttpMethod.Post,
                    Async ? "confirmPassenger/confirmSingleForQueueAsys" : "confirmPassenger/confirmSingle",
                    "leftTicket/init",
                    orderData,
                    isXhr: true
                    ),
                _ => StateMessage = $"[{_}] 正在提交订单..."
                );
            if (!ordertask.IsValid())
            {
                SetSubmitOrderError("网络错误:[ASW-CQ] " + ordertask.GetErrorMsg());
                return(false);
            }

            if (!ordertask.Result.Status)
            {
                var msg = ordertask?.Result?.Messages.JoinAsString("");
                SetSubmitOrderError(ordertask.GetExceptionMessage(msg ?? (ordertask.ResponseContent as ResponseStringContent)?.StringResult));
                return(false);
            }

            if (ordertask.Result.Data == null)
            {
                SetSubmitOrderError(ordertask.Result.Messages.JoinAsString("").DefaultForEmpty("系统返回正常,但是结果不对。可能是这次登录已经被限制,请等待几分钟再操作,或点击『注销登录』后重新登录。无法解决时请暂时改用浏览器订票。"));
                return(false);
            }
            if (!ordertask.Result.Data.SubmitStatus)
            {
                if (ordertask.Result.Data.errMsg?.IndexOf("出票失败") > -1)
                {
                    SetSubmitOrderError($"出票失败,可能是流程有问题,请重试一次。如果重试无效,请及时重新查询 ({ordertask.Result.Data.errMsg})");
                    //_hasTryReloadingPassenger = true;
                    Session.IsPassengerLoaded = false;
                    return(false);
                }
                SetSubmitOrderError("订单提交错误:" + ordertask.Result.Data.errMsg);
            }
            else if (!Async)
            {
                //直接等待订单
                LoadOrderIdFromNotComplete();
            }

            return(true);
        }