/// <summary>
 /// 置为退款完成,前置条件:退款申请中订单,不包括货到付款订单
 /// 如果是线上支付订单,需要调用接口完成退款操作(目前暂无接口)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnAskRefund_Click(object sender, EventArgs e)
 {
     CommOrderBll obll = new CommOrderBll();
     OrderChangeLogBll lbll = new OrderChangeLogBll();
     CommOrderModel order = obll.GetModel(lblOrderId.Text);
     if (order != null && order.PayMethod != PayMethType.货到付款 && order.PayStatus == PayStatus.支付成功)
     {
         obll.ChangePayStatus(order.OrderId, PayStatus.退款申请中);
         lbll.Add(order.OrderId, txtActionRemark.Text.Trim(), PayStatus.退款申请中.ToString(),
             Context.User.Identity.Name);
         ShowOrderInfo(lblOrderId.Text);
     }
 }
 /// <summary>
 /// 发货,前置条件为:订单处于备货状态
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSend_Click(object sender, EventArgs e)
 {
     GiftOrderBll obll = new GiftOrderBll();
     OrderChangeLogBll lbll = new OrderChangeLogBll();
     GiftOrderModel order = obll.GetModel(lblOrderId.Text);
     if (order != null && order.OrderStatus == OrderStatus.备货中)
     {
         obll.ChangeOrderStatus(order.OrderId, OrderStatus.已发货);
         lbll.Add(order.OrderId, txtActionRemark.Text.Trim(), OrderStatus.已发货.ToString(),
             Context.User.Identity.Name);
     }
     ShowOrderInfo(lblOrderId.Text);
 }
 /// <summary>
 /// 关闭订单,前置条件为:订单处于初始创建,且未支付
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnClose_Click(object sender, EventArgs e)
 {
     CommOrderBll obll = new CommOrderBll();
     OrderChangeLogBll lbll = new OrderChangeLogBll();
     CommOrderModel order = obll.GetModel(lblOrderId.Text);
     if (order != null && order.OrderStatus == OrderStatus.已创建 && order.PayStatus== PayStatus.等待付款)
     {
         obll.ChangeOrderStatus(order.OrderId, OrderStatus.交易关闭);
         lbll.Add(order.OrderId, txtActionRemark.Text.Trim(), OrderStatus.交易关闭.ToString(),
             Context.User.Identity.Name);
         ShowOrderInfo(lblOrderId.Text);
     }
 }
 /// <summary>
 /// 置为交易失败,前置条件为:货到付款订单,已发货;其他订单,已退款
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnFail_Click(object sender, EventArgs e)
 {
     CommOrderBll obll = new CommOrderBll();
     OrderChangeLogBll lbll = new OrderChangeLogBll();
     CommOrderModel order = obll.GetModel(lblOrderId.Text);
     if (order != null &&
         ((order.PayMethod== PayMethType.货到付款 && order.OrderStatus== OrderStatus.已发货)
         || (order.PayMethod!= PayMethType.货到付款 && order.PayStatus == PayStatus.退款完成)))
     {
         obll.ChangeOrderStatus(order.OrderId, OrderStatus.交易失败);
         lbll.Add(order.OrderId, txtActionRemark.Text.Trim(), OrderStatus.交易失败.ToString(),
             Context.User.Identity.Name);
         ShowOrderInfo(lblOrderId.Text);
     }
 }
        /// <summary>
        /// 置为交易失败,前置条件为:货到付款订单,已发货;其他订单,已退款
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnFail_Click(object sender, EventArgs e)
        {
            GiftOrderBll obll = new GiftOrderBll();
            OrderChangeLogBll lbll = new OrderChangeLogBll();
            GiftOrderModel order = obll.GetModel(lblOrderId.Text);
            if (order != null &&
                (order.OrderStatus == OrderStatus.已创建 || order.OrderStatus == OrderStatus.备货中
                || order.OrderStatus == OrderStatus.已发货))
            {
                obll.ChangeOrderStatus(order.OrderId, OrderStatus.交易失败);
                lbll.Add(order.OrderId, txtActionRemark.Text.Trim(), OrderStatus.交易失败.ToString(),
                    Context.User.Identity.Name);

                MemberInfo.LogScore(order.UserId, NoName.NetShop.Common.ScoreType.Gift, order.TotalScore, order.OrderId, "订单失败,归还积分");
            }
            ShowOrderInfo(lblOrderId.Text);
        }
        /// <summary>
        /// 置为买家签收(买家确认),隐含实现,如果为线上支付,则同时跳转至结算页面,前置条件:订单已发货
        /// 如果是货到付款订单,同时设置订单支付状态为已支付
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnCherrys_Click(object sender, EventArgs e)
        {
            CommOrderBll obll = new CommOrderBll();
            OrderChangeLogBll lbll = new OrderChangeLogBll();
            CommOrderModel order = obll.GetModel(lblOrderId.Text);
            if (order.OrderStatus == OrderStatus.已发货 || order.OrderStatus == OrderStatus.物流到货)
            {
                obll.ChangeOrderStatus(order.OrderId, OrderStatus.买家确认);
                lbll.Add(order.OrderId, txtActionRemark.Text.Trim(), OrderStatus.买家确认.ToString(),
                    Context.User.Identity.Name);

                if (order.PayMethod == PayMethType.支付宝)
                {
                    // 转向支付结算页面
                }
                ShowOrderInfo(lblOrderId.Text);

            }
        }
 /// <summary>
 /// 置为备货状态,前置条件为:订单为初始创建,如果是货到付款,不需要判断支付状态,其他的需要为已支付状态
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnPrepareGoods_Click(object sender, EventArgs e)
 {
     CommOrderBll obll = new CommOrderBll();
     OrderChangeLogBll lbll = new OrderChangeLogBll();
     CommOrderModel order = obll.GetModel(lblOrderId.Text);
     if (order != null && order.OrderStatus == OrderStatus.已创建 &&
         (order.PayMethod== PayMethType.货到付款 || order.PayStatus == PayStatus.支付成功))
     {
         obll.ChangeOrderStatus(order.OrderId, OrderStatus.备货中);
         lbll.Add(order.OrderId, txtActionRemark.Text.Trim(), OrderStatus.备货中.ToString(),
             Context.User.Identity.Name);
         ShowOrderInfo(lblOrderId.Text);
     }
 }