async void RefreshToolbar() { var lvitem = orderList.SelectedItems.OfType <ListViewItem>().FirstOrDefault(); var lvgroup = lvitem?.Group; var lvGroupObj = lvgroup?.Tag as HbOrderListViewGroup; var notCompleteOrder = lvGroupObj?.NotCompleteOrder; var orderItem = lvGroupObj?.Order; var need = (lvitem?.Tag is BackupTrain tmp) ? tmp : null; //待支付订单 btnPay.Enabled = notCompleteOrder != null; //取消订单 btnCancel.Enabled = notCompleteOrder != null || orderItem?.StatusCode < 5; //提示 pMemo.Visible = false; if (orderList.Items.Count == 0) { pMemo.Visible = true; lblMemo.Text = "<font color='gray'><i>没有查询到候补订单</i></font>"; } else if (notCompleteOrder != null) { pMemo.Visible = true; lblMemo.Text = $"<font color='red'><b>未支付订单,请在 {notCompleteOrder.LoseTime.ToLongTimeString()} 前完成支付</b></font>"; } else if (orderItem?.HasRefundInfo == true) { pMemo.Visible = true; if (orderItem.RefundInfo == null) { lblMemo.Text = "<font color='gray'>退款信息正在努力地查询中...</font>"; var(ok, msg) = await _service.QueryRefundInfo(orderItem); if (!ok) { lblMemo.Text = $"<font color='red'>查询退款信息失败:<b>{msg}</b></font>"; } } if (orderItem.RefundInfo != null) { var ri = orderItem.RefundInfo; string txt; if (ri.TransAmount > 0) { txt = $"<font color='ForestGreen'>退款金额:</font><font color='Crimson'>{(ri.TransAmount / 100):C}</font><font color='ForestGreen'>,平台流水号:</font><font color='Crimson'>{ri.TransNo}</font><font color='ForestGreen'>,业务流水号:</font><font color='Crimson'>{ri.TradeNo}</font><font color='ForestGreen'>,退款状态:</font>"; if (ri.TransStatus == 1) { txt += $"<b><font color='royalblue'>成功</font></b><font color='ForestGreen'>,已成功退至 </font><font color='Crimson'><b>{ParamData.GetBankName(ri.BankCode)}</b></font>"; } else if (ri.TransStatus == 2) { txt += $"<b><font color='red'>失败</font></b><font color='ForestGreen'>,请与 </font><font color='Crimson'><b>{ParamData.GetBankName(ri.BankCode)} </b></font><font color='ForestGreen'>联系</font>"; } else { txt += "<font color='royalblue'>退款处理中,两周没到账则火速 CALL 12306</font>"; } } else { txt = "<font color='royalblue'>退款金额为0,无后续处理</font>"; } lblMemo.Text = txt; } } }