コード例 #1
0
ファイル: EPay95Notify.aspx.cs プロジェクト: zoomlacms/web022
    //用于后台确认支付
    public static void FinalStep(M_OrderList mod)
    {
        if (mod.id < 1)
        {
            throw new Exception("未指定订单ID");
        }
        if (mod.Ordertype < 1)
        {
            throw new Exception("未指定订单类型");
        }
        if (string.IsNullOrEmpty(mod.OrderNo))
        {
            throw new Exception("未指定订单号");
        }
        M_AdminInfo adminMod = B_Admin.GetLogin();
        B_Payment   payBll   = new B_Payment();
        M_Payment   pinfo    = new M_Payment();

        pinfo.PaymentNum   = mod.OrderNo;
        pinfo.UserID       = mod.Userid;
        pinfo.PayNo        = payBll.CreatePayNo();
        pinfo.MoneyPay     = (decimal)mod.Ordersamount;
        pinfo.MoneyTrue    = pinfo.MoneyPay;//看是否需要支持手输
        pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
        pinfo.CStatus      = true;
        pinfo.Remark       = "管理员确认支付,ID:" + adminMod.AdminId + ",登录名:" + adminMod.AdminName + ",真实姓名:" + adminMod.AdminTrueName;
        pinfo.PaymentID    = payBll.Add(pinfo);
        pinfo.SuccessTime  = DateTime.Now;
        pinfo.PayPlatID    = (int)M_PayPlat.Plat.CashOnDelivery;//默认为线下支付
        pinfo.PlatformInfo = "";
        M_Order_PayLog paylogMod = new M_Order_PayLog();

        FinalStep(pinfo, mod, paylogMod);
    }
コード例 #2
0
        public static M_Payment GetPaymentByOrderNo(string payno, string orderno, double allmoney)
        {
            B_Payment payBll = new B_Payment();
            M_Payment payMod = null;

            if (!string.IsNullOrEmpty(payno))
            {
                payMod = payBll.SelModelByPayNo(payno);
            }
            else if (!string.IsNullOrEmpty(orderno))
            {
                payMod = payBll.SelModelByOrderNo(orderno);
            }
            if (payMod == null)
            {
                payMod           = new M_Payment();
                payMod.MoneyReal = allmoney;
            }
            return(payMod);
        }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!B_ARoleAuth.Check(ZLEnum.Auth.shop, "OrderList"))
        {
            function.WriteErrMsg("没有权限进行此项操作");
        }
        if (Mid < 1 && string.IsNullOrEmpty(OrderNO))
        {
            function.WriteErrMsg("未指定订单");
        }
        if (!IsPostBack)
        {
            if (Mid > 0)
            {
                orderinfo = oll.GetOrderListByid(Mid);
            }
            else if (!string.IsNullOrEmpty(Request["OrderNo"]))
            {
                orderinfo = oll.GetByOrder(Request["OrderNo"], "0");
            }
            if (orderinfo == null || orderinfo.id < 1)
            {
                function.WriteErrMsg("订单不存在");
            }
            OrderNO = orderinfo.OrderNo;
            //----------------------------------------------------------
            M_UserInfo mu = buser.SelReturnModel(orderinfo.Userid);
            HeadTitle_L.Text = "订 单 信 息(订单编号:" + orderinfo.OrderNo + ")";
            string giveurl = customPath2 + "User/Userexp.aspx?UserID=" + orderinfo.Userid
                             + "&orderid=" + orderinfo.id;
            give_score_a.HRef   = giveurl + "&type=" + (int)M_UserExpHis.SType.Point;
            give_purse_a.HRef   = giveurl + "&type=" + (int)M_UserExpHis.SType.Purse;
            OrderNo_L.Text      = orderinfo.OrderNo;
            Orderamounts_L.Text = orderinfo.Ordersamount.ToString("f2");
            isCheckRe_L.Text    = orderinfo.Guojia;
            Cdate_L.Text        = orderinfo.AddTime.ToString("yyyy年MM月dd日 HH:mm");
            Reuser.Text         = StringHelper.SubStr(orderinfo.Reuser, 12);
            UName_L.Text        = "<a href='javascript:;' onclick='showuinfo(" + mu.UserID + ");' title='查看用户'>" + mu.UserName + "</a>";
            if (orderinfo.StateLogistics != 0)
            {
                Exp_Send_Btn.Enabled = false;
            }
            if (orderinfo.StateLogistics == 1)
            {
                Exp_ClientSign_Btn.Enabled = true;
            }
            if (orderinfo.Paymentstatus >= (int)M_OrderList.PayEnum.HasPayed)
            {
                Paymentstatus.Text  = "<span  style='color:green;>已经汇款</span>";
                Pay_Has_Btn.Enabled = false;
            }
            else
            {
                Paymentstatus.Text   = "<span style='color:red;'>等待汇款</span>";
                Pay_Has_Btn.Enabled  = true;
                Exp_Send_Btn.Enabled = false;
            }
            switch ((M_OrderList.StatusEnum)orderinfo.OrderStatus)
            {
            case M_OrderList.StatusEnum.Normal:
                OS_Sure_Btn.Enabled = true;
                break;

            case M_OrderList.StatusEnum.DrawBack:
                OS_Sure_Btn.Enabled       = false;
                OS_NoSure_Btn.Enabled     = false;
                CheckReturn.Enabled       = true;
                UnCheckRetrun.Enabled     = true;
                Exp_Send_Btn.Enabled      = false;
                CompleteOrder_Btn.Enabled = false;
                break;

            case M_OrderList.StatusEnum.UnDrawBack:
            case M_OrderList.StatusEnum.CheckDrawBack:
                OS_Invoice_Btn.Enabled    = false;
                OS_Sure_Btn.Enabled       = false;
                OS_NoSure_Btn.Enabled     = false;
                Exp_Send_Btn.Enabled      = false;
                CompleteOrder_Btn.Enabled = false;
                break;

            case M_OrderList.StatusEnum.OrderFinish:
            case M_OrderList.StatusEnum.UnitFinish:
                CompleteOrder_Btn.Enabled = false;
                break;

            default:
                break;
            }
            #region 物流信息
            ExpStatus_L.Text = OrderHelper.GetExpStatus(orderinfo.StateLogistics);
            M_Order_Exp expMod = expBll.SelReturnModel(DataConverter.CLng(orderinfo.ExpressNum));
            if (expMod != null)
            {
                ExpName_L.Text    = expMod.ExpComp;
                ExpCode_L.Text    = expMod.ExpNo;
                ExpStatus_L.Text += "(公司:" + expMod.ExpComp + "/单号:" + expMod.ExpNo + ")";
            }
            switch ((M_OrderList.ExpEnum)orderinfo.StateLogistics)
            {
            case M_OrderList.ExpEnum.NoSend:
                Exp_Cancel_Btn.Enabled = false;
                break;

            case M_OrderList.ExpEnum.HasSend:
                Exp_ClientSign_Btn.Enabled = true;
                break;

            case M_OrderList.ExpEnum.HasReceived:
                Exp_Send_Btn.Enabled = false;
                break;
            }
            DrawBackStr.Text  = orderinfo.Merchandiser;
            Deliverytime.Text = orderinfo.Deliverytime.ToString();//送货时间
            switch (orderinfo.Deliverytime)
            {
            case 1:
                Deliverytime.Text = "对送货时间没有特殊要求";
                break;

            case 2:
                Deliverytime.Text = "双休日或者周一至周五的晚上送达";
                break;

            case 3:
                Deliverytime.Text = "周一至周五的白天送达";
                break;

            default:
                break;
            }
            Phone.Text   = orderinfo.Phone.ToString();                  //联系电话
            ZipCode.Text = orderinfo.ZipCode.ToString();                //邮政编码
            Mobile.Text  = orderinfo.MobileNum;                         //手机
            Reusers.Text = orderinfo.Reuser.ToString();                 //订货人
            Jiedao.Text  = orderinfo.Shengfen + " " + orderinfo.Jiedao; //地址
            #endregion
            OrderStatus.Text = OrderHelper.GetOrderStatus(orderinfo.OrderStatus);
            adddate.Text     = orderinfo.AddTime.ToShortDateString();
            OrderType_L.Text = orderinfo.AddTime.ToString();

            Invoiceneeds.Text   = orderinfo.Invoiceneeds == 1 ? ComRE.Icon_OK : ComRE.Icon_Error;
            Developedvotes.Text = orderinfo.Developedvotes == 1 ? ComRE.Icon_OK : ComRE.Icon_Error;
            //如果已支付
            if (orderinfo.Integral > 0 && orderinfo.Paymentstatus >= (int)M_OrderList.PayEnum.HasPayed)
            {
                if (orderinfo.SendPointStatus == 1)
                {
                    ISsend.Text = "已送出";
                }
            }
            Pay_Has_Btn.Enabled   = orderinfo.Paymentstatus == 1 ? false : true; //更改状态,已支付
            OS_Freeze_Btn.Enabled = orderinfo.Settle == 1 ? false : true;        //冻结
            OS_Pause_Btn.Enabled  = orderinfo.Suspended == 1 ? false : true;     //暂停
            if (orderinfo.Aside == 1)                                            //已作废
            {
                Pay_Has_Btn.Enabled = false;
                //ShowSend_Btn.Enabled = false;
                OS_Sure_Btn.Enabled        = false;
                OS_NoSure_Btn.Enabled      = false;
                Exp_ClientSign_Btn.Enabled = false;
                OS_Freeze_Btn.Enabled      = false;
                OS_Invoice_Btn.Enabled     = false;
                OS_Pause_Btn.Enabled       = false;
                OS_Aside_Btn.Enabled       = false;
            }
            else
            {
                OS_Aside_Btn.Enabled = true;
            }
            if (orderinfo.Settle == 1)//结清
            {
                Pay_Has_Btn.Enabled = false;
                //ShowSend_Btn.Enabled = false;
                OS_Sure_Btn.Enabled        = false;
                OS_NoSure_Btn.Enabled      = false;
                OS_Aside_Btn.Enabled       = false;
                Exp_ClientSign_Btn.Enabled = false;
                OS_Invoice_Btn.Enabled     = false;
                OS_Pause_Btn.Enabled       = false;
            }
            if (orderinfo.Payment > 0)//支付后才有值
            {
                M_PayPlat payPlatMod = platBll.GetPayPlatByid(orderinfo.Payment);
                Payment.Text = payPlatMod.PayPlatName.ToString();
                B_Payment paymentBLL = new B_Payment();
            }
            Email.Text   = orderinfo.Email.ToString();   //电子信
            Invoice.Text = orderinfo.Invoice.ToString(); //发票信息
            if (orderinfo.Outstock == 1)
            {
                Outstock.Text = "缺货时,取消此订单";
            }
            else
            {
                Outstock.Text = "缺货时,将有货的商品发出,取消无货商品的订购";
            }
            AddUser.Text           = orderinfo.AddUser.ToString();         //负责跟单人员
            Internalrecords_T.Text = orderinfo.Internalrecords.ToString(); //内部记录
            Ordermessage_T.Text    = orderinfo.Ordermessage;               //订货留言
            LabScore.Text          = orderinfo.Integral.ToString();        //积分
            //-------购物车
            DataTable cplist = cartProBll.GetCartProOrderID(Mid);
            Procart_RPT.DataSource = cplist;
            Procart_RPT.DataBind();
            if (cplist.Rows.Count > 0 && !string.IsNullOrEmpty(cplist.Rows[0]["Additional"].ToString()))
            {
                M_Cart_Travel          model     = JsonConvert.DeserializeObject <M_Cart_Travel>(cplist.Rows[0]["Additional"].ToString());
                List <M_Cart_Contract> modelList = new List <M_Cart_Contract>();
                modelList.AddRange(model.Guest);
                modelList.AddRange(model.Contract);
                UserRPT.DataSource = modelList;
                UserRPT.DataBind();
            }
            DataTable newtable = cplist.DefaultView.ToTable(false, "Shijia", "Pronum");
            double    allmoney = 0;
            for (int i = 0; i < newtable.Rows.Count; i++)
            {
                allmoney = allmoney + DataConverter.CDouble(cplist.Rows[i]["Allmoney"]);
            }
            //-------
            Label2.Text      = orderinfo.Ordersamount.ToString();
            Label29.Text     = orderinfo.Ordersamount.ToString("f2");
            Label31.Text     = (orderinfo.Ordersamount).ToString("f2") + "元";
            ReceMoney_L.Text = orderinfo.Receivablesamount.ToString("f2") + "元";
            //判断订单所处状态
            {
                if (orderinfo.OrderStatus < (int)M_OrderList.StatusEnum.Normal || orderinfo.Aside == 1)
                {
                    prog_order_div.InnerHtml = OrderHelper.GetOrderStatus(orderinfo.OrderStatus, orderinfo.Aside, orderinfo.StateLogistics);
                }
                else
                {
                    int current = 2;
                    if (orderinfo.OrderStatus >= (int)M_OrderList.StatusEnum.OrderFinish)
                    {
                        current = 5;
                    }
                    else if (orderinfo.Paymentstatus >= (int)M_OrderList.PayEnum.HasPayed)
                    {
                        current++;
                        switch (orderinfo.StateLogistics)
                        {
                        case (int)M_OrderList.ExpEnum.HasSend:
                            current++;
                            break;

                        case (int)M_OrderList.ExpEnum.HasReceived:
                            current += 2;
                            break;
                        }
                    }
                    function.Script(this, "$('#prog_order_div').ZLSteps('订单生成,等待用户支付,等待商户发货,等待用户签收,订单完结'," + current + ")");
                }
            }
            Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='ProductManage.aspx'>商城管理</a></li><li><a href='OrderList.aspx'>订单管理</a></li><li class='active'><a href='" + Request.RawUrl + "'>订单详情</a></li>");
        }
    }
コード例 #4
0
 /// <summary>
 /// 异步回调后-->验证支付单状态-->如果正常,更新订单状态
 /// 多张订单在外层循环,这里只处理单订单
 /// </summary>
 /// <param name="mod">订单模型</param>
 /// <param name="paylogMod">订单支付日志模型</param>
 public static void FinalStep(M_Payment pinfo, M_OrderList mod, M_Order_PayLog paylogMod)
 {
     //B_Order_PayLog paylogBll = new B_Order_PayLog();
     B_PayPlat platBll = new B_PayPlat();
     B_Payment payBll  = new B_Payment();
     B_User    buser   = new B_User();
     //[*]特殊处理,预付与尾款逻辑
     {
         #region
         if (pinfo.PayType == (int)M_OrderList.PayTypeEnum.PrePay)
         {
             M_PrePayinfo preInfo = new M_PrePayinfo(pinfo.PrePayInfo);
             preInfo.money_pre_payed = pinfo.MoneyTrue;
             preInfo.pre_payno       = pinfo.PayNo;
             preInfo.pre_payMethod   = platBll.GetPayPlatName(pinfo);
             pinfo.PrePayInfo        = JsonConvert.SerializeObject(preInfo);
             DBCenter.UpdateSQL(pinfo.TbName, "PrePayInfo=@preInfo", "PayMentID=" + pinfo.PaymentID,
                                new List <SqlParameter>()
             {
                 new SqlParameter("preInfo", pinfo.PrePayInfo)
             });
         }
         else if (pinfo.PayType == (int)M_OrderList.PayTypeEnum.AfterPay)
         {
             try
             {
                 M_OrderList realOrder = orderBll.SelModelByOrderNo(mod.Ordermessage);
                 M_Payment   preMod    = payBll.SelModelByPayNo(realOrder.PaymentNo);
                 //修改订单与支付单信息
                 M_PrePayinfo preInfo = new M_PrePayinfo(preMod.PrePayInfo);
                 preInfo.money_after_payed = pinfo.MoneyTrue;
                 preInfo.status            = (int)ZLEnum.ConStatus.Audited;
                 preInfo.after_payno       = pinfo.PayNo;
                 preInfo.after_payMethod   = platBll.GetPayPlatName(pinfo);
                 //修改二张订单与二张支付单的状态
                 realOrder.IsCount            = true;
                 realOrder.Ordersamount      += pinfo.MoneyTrue;
                 realOrder.Receivablesamount += pinfo.MoneyTrue;
                 orderBll.UpdateByID(realOrder);
                 mod.OrderStatus   = 99;
                 mod.Paymentstatus = 1;
                 mod.PaymentNo     = pinfo.PayNo;
                 orderBll.UpdateByID(mod);
                 DBCenter.UpdateSQL(preMod.TbName, "PrePayInfo=@preInfo", "PayMentID=" + preMod.PaymentID,
                                    new List <SqlParameter>()
                 {
                     new SqlParameter("preInfo", JsonConvert.SerializeObject(preInfo))
                 });
                 return;
             }
             catch (Exception ex)
             {
                 ZLLog.L(Model.ZLEnum.Log.pay, new M_Log()
                 {
                     Action  = "支付尾款异常",
                     Message = "订单号:" + mod.OrderNo + ",支付单:" + pinfo.PayNo + ",原因:" + ex.Message
                 });
                 return;
             }
         }
         #endregion
     }
     //订单已处理,避免重复(如已处理过,则继续处理下一张订单)
     if (mod.OrderStatus >= 99)
     {
         ZLLog.L(Model.ZLEnum.Log.pay, new M_Log()
         {
             Action  = "支付回调异常,订单状态已为99",
             Message = "订单号:" + mod.OrderNo + ",支付单:" + pinfo.PayNo
         });
         return;
     }
     //已经收到钱了,所以先执行(如多订单,则为订单金额)
     if (mod.Receivablesamount <= 0)
     {
         //DD201701112113293112618,DD201701112113293754790
         int orderNum = pinfo.PaymentNum.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Length;
         if (orderNum == 1)
         {
             mod.Receivablesamount = pinfo.MoneyTrue;
         }
         else
         {
             //订单需要改进,支持优惠后的金额等,不能只以支付单中的为准,每张订单需要计算出自己的优惠额与积分支付额
             mod.Receivablesamount = mod.Ordersamount;
         }
     }
     orderBll.UpOrderinfo("Paymentstatus=1,Receivablesamount=" + mod.Receivablesamount, mod.id);
     //if (mod.Ordertype == (int)M_OrderList.OrderEnum.Domain)//域名订单
     //{
     //    orderBll.UpOrderinfo("OrderStatus=1,PaymentNo='" + pinfo.PayNo + "'", mod.id);
     //    //Response.Redirect("~/Plugins/Domain/DomReg2?OrderNo=" + mod.OrderNo);
     //}
     //else if (mod.Ordertype == (int)M_OrderList.OrderEnum.IDC)//IDC服务
     //{
     //    B_Order_IDC idcBll = new B_Order_IDC();
     //    orderBll.FinishOrder(mod.id, pinfo);
     //    idcBll.UpdateEndTimeByNo(mod.OrderNo);
     //}
     //else if ((mod.Ordertype == (int)M_OrderList.OrderEnum.IDCRen))//IDC服务续费
     //{
     //    B_Order_IDC idcBll = new B_Order_IDC();
     //    orderBll.FinishOrder(mod.id, pinfo);
     //    idcBll.RennewTime(mod);
     //}
     if (mod.Ordertype == (int)M_OrderList.OrderEnum.Purse)//余额充值,不支持银币
     {
         buser.AddMoney(mod.Userid, mod.Ordersamount,
                        M_UserExpHis.SType.Purse, "余额充值,订单号:" + mod.OrderNo);
         //检测是否采用了充值赠送规则
         if (DataConvert.CLng(mod.Money_code) > 0)
         {
             B_Shop_MoneyRegular regBll = new B_Shop_MoneyRegular();
             M_Shop_MoneyRegular regMod = regBll.SelReturnModel(DataConvert.CLng(mod.Money_code));
             if (regMod.Purse > 0)
             {
                 buser.AddMoney(mod.Userid, regMod.Purse,
                                M_UserExpHis.SType.Purse, "余额充值--余额赠送,订单号:" + mod.OrderNo);
             }
             if (regMod.Sicon > 0)
             {
                 buser.AddMoney(mod.Userid, regMod.Sicon,
                                M_UserExpHis.SType.SIcon, "余额充值--银币赠送,订单号:" + mod.OrderNo);
             }
             if (regMod.Point > 0)
             {
                 buser.AddMoney(mod.Userid, regMod.Point,
                                M_UserExpHis.SType.Point, "余额充值--积分赠送,订单号:" + mod.OrderNo);
             }
         }
         orderBll.FinishOrder(mod.id, pinfo);                    //成功的订单
     }
     else if (mod.Ordertype == (int)M_OrderList.OrderEnum.Cloud) //虚拟商品订单
     {
         orderBll.FinishOrder(mod.id, pinfo);
     }
     else//其他旅游订单等,只更新状态
     {
         orderBll.FinishOrder(mod.id, pinfo);//成功的订单
     }
     //-------支付成功处理,快照并写入日志
     SaveSnapShot(mod);
     //paylogMod.Remind += "订单" + mod.OrderNo + "购买生效";
     //paylogMod.UserID = mod.Userid;
     //paylogMod.OrderID = mod.id;
     //paylogMod.PayMoney = mod.Ordersamount;
     //paylogMod.PayMethod = (int)M_Order_PayLog.PayMethodEnum.Other;//外部指定
     //paylogMod.PayPlatID = pinfo.PayPlatID;
     //paylogBll.insert(paylogMod);
     //------商品是否赠送积分
     //{//好酒多积分不直接入账
     //    DataTable prodt = DBCenter.JoinQuery("A.ProID,A.Pronum,B.PointVal", "ZL_CartPro", "ZL_Commodities", "A.ProID=B.ID", "A.OrderListID=" + mod.id);
     //    foreach (DataRow dr in prodt.Rows)
     //    {
     //        double point = DataConvert.CDouble(dr["PointVal"])*Convert.ToInt32(dr["Pronum"]);
     //        if (point > 0)
     //        {
     //            buser.AddMoney(mod.Userid, point, M_UserExpHis.SType.Point, "购买商品[" + dr["ProID"] + "],赠送积分");
     //        }
     //    }
     //}
     if (OrderFinish_Event != null)
     {
         OrderFinish_Event(mod, pinfo);
     }
 }