Exemple #1
0
        protected void RefundButton_Click(object sender, EventArgs e)
        {
            int orderRefundId     = RequestHelper.GetQueryString <int>("Id");
            var submitOrderRefund = OrderRefundBLL.Read(orderRefundId);

            //更改状态为退款中...
            if (submitOrderRefund.Status == (int)OrderRefundStatus.Approve)
            {
                submitOrderRefund.Status = (int)OrderRefundStatus.Returning;
                submitOrderRefund.Remark = "正在处理退款";

                OrderRefundBLL.Update(submitOrderRefund);

                //退款操作记录
                AddOrderRefundAction(submitOrderRefund, (int)BoolType.True);
            }

            //退款到账户余额及各支付渠道
            if (submitOrderRefund.Status == (int)OrderRefundStatus.Returning)
            {
                JWRefund.RefundToAnyPay(submitOrderRefund);
            }
            else
            {
                ScriptHelper.Alert("无效的操作", RequestHelper.RawUrl);
            }
        }
        /// <summary>
        /// 退款操作:通过、拒绝、退款、取消
        /// </summary>
        protected override void PostBack()
        {
            string param     = RequestHelper.GetForm <string>("param").ToLower();
            int    id        = RequestHelper.GetForm <int>("id");
            string returnUrl = "/mobileadmin/orderrefunddetail.html?id=" + id;

            if (id <= 0)
            {
                ScriptHelper.AlertFront("请求参数错误", returnUrl);
            }
            OrderRefundInfo orderRefund = OrderRefundBLL.Read(id);

            switch (param)
            {
            case "approve":
                Approve((int)BoolType.True, orderRefund);
                break;

            case "reject":
                Approve((int)BoolType.False, orderRefund);
                break;

            case "finish":
                //更改状态为退款中...
                if (orderRefund.Status == (int)OrderRefundStatus.Approve)
                {
                    orderRefund.Status = (int)OrderRefundStatus.Returning;
                    orderRefund.Remark = "正在处理退款";

                    OrderRefundBLL.Update(orderRefund);

                    //退款操作记录
                    AddOrderRefundAction(orderRefund, (int)BoolType.True);
                }

                //退款到账户余额及各支付渠道
                if (orderRefund.Status == (int)OrderRefundStatus.Returning)
                {
                    //退款操作完成后跳转回本页面
                    JWRefund.RefundRedirectUrl = returnUrl;
                    JWRefund.RefundToAnyPay(orderRefund);
                }
                else
                {
                    ScriptHelper.AlertFront("无效的操作", returnUrl);
                }
                break;

            case "cancel":
                if (orderRefund.Status == (int)OrderRefundStatus.Approve || orderRefund.Status == (int)OrderRefundStatus.Returning)
                {
                    //更改状态为已取消...
                    orderRefund.Status = (int)OrderRefundStatus.Cancel;
                    orderRefund.Remark = "系统取消了退款";
                    OrderRefundBLL.Update(orderRefund);

                    //退款操作记录
                    AddOrderRefundAction(orderRefund, (int)BoolType.False);
                    ScriptHelper.AlertFront("操作成功", returnUrl);
                }
                else
                {
                    ScriptHelper.AlertFront("无效的操作", returnUrl);
                }
                break;
            }
        }