Ejemplo n.º 1
0
        public IActionResult Order_API()
        {
            if (!B_ARoleAuth.AuthCheckEx(ZLEnum.Auth.shop, "order"))
            {
                return(Content(Failed.ToString()));
            }
            string action = GetParam("a");
            string ids    = GetParam("ids");
            int    Mid    = DataConvert.CLng(GetParam("ids"));

            switch (action)
            {
            case "info_normal":
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "恢复正常");
                string        str    = "Aside=0,Suspended=0,Settle=0,BackID=0,OrderStatus=" + (int)M_OrderList.StatusEnum.Normal;
                orderBll.UpOrderinfo(str, Mid); logBll.Insert(logMod);
            }
            break;

            case "info_complete":    //完结订单
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "完结订单");
                //前使用必须修改,只更改状态,不执行FinalStep
                M_OrderList orderMod = oll.SelReturnModel(Mid);
                if (string.IsNullOrEmpty(orderMod.PaymentNo))        //未支付则生成支付单
                {
                    OrderHelper.FinalStep(orderMod);
                }
                else
                {
                    M_Payment payMod = payBll.SelModelByOrder(orderMod);
                    OrderHelper.FinalStep(payMod, orderMod, new M_Order_PayLog());
                }
                logBll.Insert(logMod);
            }
            break;

            case "info_invoce":    //已开发票
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "已开发票");
                oll.UpOrderinfo("Developedvotes=1", Mid); logBll.Insert(logMod);
            }
            break;

            case "info_suspend":    //冻结,挂起订单
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "冻结处理");
                oll.UpOrderinfo("Suspended=1", Mid); logBll.Insert(logMod);
            }
            break;

            case "info_suspend_no":
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "取消冻结");
                oll.UpOrderinfo("Suspended=0", Mid); logBll.Insert(logMod);
            }
            break;

            case "info_aside":
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "订单作废");
                oll.UpOrderinfo("Aside=1", Mid); logBll.Insert(logMod);
            }
            break;

            case "info_refund":    //退单还款
            {
                M_Order_OPLog logMod    = logBll.NewLog(Mid, "退单还款");
                M_OrderList   orderinfo = oll.GetOrderListByid(Mid);
                if (orderinfo.Paymentstatus == (int)M_OrderList.PayEnum.NoPay)
                {
                    return(WriteErr("操作失败,订单还未支付"));
                }
                if (orderinfo.Paymentstatus == (int)M_OrderList.PayEnum.Refunded)
                {
                    return(WriteErr("操作失败,该订单已退款"));
                }
                buser.ChangeVirtualMoney(orderinfo.Userid, new M_UserExpHis()
                    {
                        score     = orderinfo.Receivablesamount,
                        ScoreType = 1,
                        detail    = "订单[" + orderinfo.id + "]退单返款,返款金额:" + orderinfo.Receivablesamount
                    });
                oll.UpOrderinfo("Paymentstatus=" + (int)M_OrderList.PayEnum.Refunded, Mid); logBll.Insert(logMod);
            }
            break;

            case "info_payed":
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "已经支付");
                oll.UpOrderinfo("Paymentstatus=" + (int)M_OrderList.PayEnum.HasPayed, Mid); logBll.Insert(logMod);
            }
            break;

            case "info_pay_cancel":
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "取消支付");
                oll.UpOrderinfo("Paymentstatus=" + (int)M_OrderList.PayEnum.NoPay + ",PaymentNo=''", Mid);
                logBll.Insert(logMod);
            }
            break;

            case "info_remind":    //更新备注信息
            {
                M_OrderList orderinfo = oll.SelReturnModel(Mid);
                orderinfo.Internalrecords = GetParam("Internalrecords");
                orderinfo.Ordermessage    = GetParam("Ordermessage");
                oll.UpdateByID(orderinfo);
            }
            break;

            case "exp_cancel":    //取消发送
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "取消发送");
                oll.UpOrderinfo("StateLogistics=" + (int)M_OrderList.ExpEnum.NoSend + ",ExpressNum=''", Mid); logBll.Insert(logMod);
            }
            break;

            case "exp_sign":
            {
                M_Order_OPLog logMod = logBll.NewLog(Mid, "客户已签收");
                oll.UpOrderinfo("Signed=1,StateLogistics=" + (int)M_OrderList.ExpEnum.HasReceived, Mid); logBll.Insert(logMod);
            }
            break;

            //------------------------
            case "sure":    //确认订单
            {
                orderBll.ChangeSure(ids, 1);
                //M_Order_OPLog logMod = logBll.NewLog(Mid, "确认订单");
                //oll.UpOrderinfo("IsSure=1", Mid); logBll.Insert(logMod);
            }
            break;

            case "sure_no":
            {
                orderBll.ChangeSure(ids, 0);
                //M_Order_OPLog logMod = logBll.NewLog(Mid, "取消确认");
                //oll.UpOrderinfo("IsSure=0", Mid); logBll.Insert(logMod);
                //return WriteOK("取消确认成功", "Orderlistinfo?id=" + Mid);
            }
            break;

            case "recycle":    //回收站
            {
                orderBll.ChangeStatus(ids, "recycle");
            }
            break;

            case "recover":
            {
                orderBll.ChangeStatus(ids, "recover");
            }
            break;

            case "del":
            {
                orderBll.DelByIDS(ids);
            }
            break;

            case "clear":
            {
                orderBll.ClearRecycle();
            }
            break;
            }
            return(Content(Success.ToString()));
        }