Esempio n. 1
0
        protected virtual async Task OnCaptchaErrorAsync()
        {
            if (SubmitOrderWorker.NeedSlideVc)
            {
                _slideVc.Reload();
            }
            else
            {
                if (VerifyCodeBox?.AutoVcCode == LastVcCode)
                {
                    VerifyCodeBox?.MarkError(LastVcCode);
                }

                VerifyCodeBox?.LoadVerifyCode();
            }
            await SetAllowOperationAsync(false, true).ConfigureAwait(true);
        }
        async void SubmitOrderAsync()
        {
            var pas    = _cart.Passengers;
            var trains = _cart.Items;

            if (pas.Count == 0 || pas.Count > 3)
            {
                this.ShowWarningToastMini("联系人必选且不得超过三位啊哈哈哈……");
                return;
            }

            if (trains.Count == 0)
            {
                this.ShowWarningToastMini("怎么会没有车次呢,好奇怪……");
                return;
            }

            //参数
            _cart.EndTime      = backupEndDate.Value;
            _cart.EnableLkList = flpLkList.Controls.OfType <CheckBox>().Where(s => s.Checked).Select(s => (char)s.Tag).MapToHashSet();

            btnSubmit.Enabled = false;


            this.ShowInfoToast("正在信心满满地提交订单...", 0);

            var service = _session.GetService <IBackupOrderService>();

            var(ok, msg, data) = await service.CommitBackupOrderAsync();

            this.CloseToast();


            if (ok && data.IsAsync)
            {
                (ok, msg) = await QueueOrderAsync();
            }

            btnSubmit.Enabled = true;

            if (ok)
            {
                _cart.Items.Clear();
                this.ShowSuccessToastMini("嘿嘿,提交成功!");
                Session.OnRequestShowPanel(PanelIndex.HbOrder);
                Session.OnHbOrderChanged();

                await Task.Delay(1500);

                Close();
            }
            else
            {
                if (msg.Contains("验证码"))
                {
                    _slideVc.Visible = true;
                    _slideVc.Reload();
                    btnSubmit.Visible = false;
                }
                if (!msg.IsNullOrEmpty())
                {
                    this.ShowErrorToastMini(msg);
                }
            }
        }