Example #1
0
        public JsonResult Add(DishStore store, int?attrTypeId, [System.Web.Http.FromBody] EditAttbute edit)
        {
            if (!attrTypeId.HasValue)
            {
                return(ApiModel(message: "参数不能为空[attrTypeId]"));
            }

            DishAttrType attrType = DishAttrTypeBLL.SingleModel.GetModel(attrTypeId.Value);

            if (attrType == null || attrType.storeId != store.id)
            {
                return(ApiModel(message: "非法操作"));
            }

            DishAttr newAttrbute = new DishAttr
            {
                attr_name   = edit.Name,
                attr_values = string.Join("\n", edit.Option),
                aid         = store.aid,
                cat_id      = edit.AttrTypeId,
                storeId     = store.id,
                sort        = edit.Sort,
                state       = 1,
            };

            int  newId;
            bool success = int.TryParse(DishAttrBLL.SingleModel.Add(newAttrbute)?.ToString(), out newId) && newId > 0;

            return(ApiModel(isok: success, message: success ? "新增成功" : "新增失败"));
        }
Example #2
0
        /// <summary>
        /// 会员卡资金记录
        /// </summary>
        /// <returns></returns>
        public ActionResult CardLog(int id = 0, int aId = 0, int storeId = 0, int pageIndex = 0, int pageSize = 20)
        {
            DishStore store = DishStoreBLL.SingleModel.GetModelByAid_Id(aId, storeId);

            if (store == null)
            {
                _result.code = 500;
                _result.msg  = "门店不存在";
                return(View("PageError", _result));
            }
            if (id <= 0)
            {
                _result.code = 500;
                _result.msg  = "参数错误 id_error";
                return(View("PageError", _result));
            }
            DishVipCard card                  = DishVipCardBLL.SingleModel.GetVipCardById_StoreId(id, storeId);
            int         recordCount           = 0;
            ViewModel <DishCardAccountLog> vm = new ViewModel <DishCardAccountLog>();

            vm.DataList   = DishCardAccountLogBLL.SingleModel.GetRecordLogList(storeId, card.uid, pageIndex + 1, pageSize, out recordCount);
            vm.TotalCount = recordCount;
            vm.PageIndex  = pageIndex;
            vm.PageSize   = pageSize;
            vm.storeId    = storeId;
            vm.aId        = aId;
            return(View(vm));
        }
Example #3
0
        public void Export(int id = 0, int aId = 0, int storeId = 0, int pageIndex = 0, int pageSize = 20, string nickname = "", string u_name = "", string u_phone = "", string number = "")
        {
            DishStore store = DishStoreBLL.SingleModel.GetModelByAid_Id(aId, storeId);

            if (store == null)
            {
                Response.Write("<script>alert('门店不存在');window.opener=null;window.close();</script>");
            }
            int recordCount            = 0;
            ViewModel <DishVipCard> vm = new ViewModel <DishVipCard>();

            vm.DataList = DishVipCardBLL.SingleModel.GetVipCardList(storeId, pageIndex, pageSize, nickname, u_name, u_phone, number, out recordCount);
            string filename = $"表单导出";

            if (vm.DataList != null && vm.DataList.Count > 0)
            {
                DataTable exportTable = new DataTable();
                exportTable = ExportExcelBLL.GetDishVipData(vm.DataList);
                ExcelHelper <DishVipCard> .Out2Excel(exportTable, filename);//导出
            }
            else
            {
                Response.Write("<script>alert('查无数据');window.opener=null;window.close();</script>");
                return;
            }
        }
Example #4
0
        public JsonResult List(DishStore store, int pageIndex = 1, int pageSize = 10, string searchName = null, int classId = 0)
        {
            var tupleResult = DishGoodBLL.SingleModel.GetListFromTable(store.aid, store.id, pageIndex, pageSize, searchName, classId);

            List <DishGood> product = tupleResult.Item1;
            int             total   = tupleResult.Item2;

            //string classIds = string.Join(",", product.Select(item => item.cate_id));
            //List<DishCategory> productClass = null;
            //if(!string.IsNullOrWhiteSpace(classIds))
            //{
            //    productClass = DishCategoryBLL.SingleModel.GetListById(classIds);
            //}

            object formatProduct = product.Select(item => new
            {
                Id    = item.id,
                Name  = item.g_name,
                Img   = item.img,
                Class = item.cat_name,
                //Class = productClass.First(thisItem => thisItem.id == item.cate_id)?.title,
                Sort        = item.is_order,
                Price       = item.shop_price,
                DailySupply = item.day_kucun,
                Display     = item.state == 1,
            });

            return(ApiModel(isok: true, message: "获取成功", data: new { page = formatProduct, total }));
        }
Example #5
0
        public ActionResult List(DishStore store, string productId, int pageIndex = 1, int pageSize = 10)
        {
            List <DishComment> comment = DishCommentBLL.SingleModel.GetListByStore(storeId: store.id, pageIndex: pageIndex, pageSize: pageSize);
            int total = DishCommentBLL.SingleModel.GetCountByStore(store.id);

            string            userId = string.Join(",", comment.Select(item => item.uId));
            List <C_UserInfo> users  = new List <C_UserInfo>();

            if (!string.IsNullOrWhiteSpace(userId))
            {
                users = C_UserInfoBLL.SingleModel.GetListByIds(userId);
            }
            object formatComment = comment.Select(item => new
            {
                Id          = item.id,
                Star        = item.star,
                Content     = item.content,
                Date        = item.addTime.ToString(),
                Imgs        = item.imgsList,
                User        = item.nickName,
                UserHeadImg = users.FirstOrDefault(user => user.Id == item.uId)?.HeadImgUrl,
            });

            return(ApiModel(isok: true, message: "获取评论成功", data: new { page = formatComment, total }));
        }
Example #6
0
        /// <summary>
        /// 餐饮打印订单
        /// </summary>
        /// <param name="food"></param>
        /// <param name="order"></param>
        /// <param name="carts"></param>
        /// <param name="foodPrintList"></param>
        /// <param name="account">加传参数,打单失败会通过提示该用户,若不想提示,可传null</param>
        /// <returns></returns>
        public static void DishPrintOrder(DishStore store, DishOrder order, List <DishShoppingCart> carts, List <DishPrint> prints)
        {
            if (store == null || order == null || carts == null || !carts.Any() || prints == null || !prints.Any())
            {
                log4net.LogHelper.WriteInfo(typeof(PrinterHelper), $"参数为空导致无法打印:dishStore:{store == null},order :{ order == null }, carts: {carts == null || !carts.Any()}, foodPrintList : {prints == null || !prints.Any()}");
                return;
            }

            prints.ForEach(print =>
            {
                if (print.print_d_type == 1)                                                      //整单打印
                {
                    string totalPrintContent = GetPrintContent_Total(store, order, carts, print); //整单打印内容
                    if (!string.IsNullOrWhiteSpace(totalPrintContent))                            //当此打印的设定打单匹配到有要打印的内容时,才去打印
                    {
                        FoodYiLianYunPrintHelper.printContent(print.apiPrivateKey, print.platform_userId.ToString(), print.print_bianma, print.print_shibiema, totalPrintContent);
                    }
                }
                else //分单打印
                {
                    List <string> singlePrintContentsByGoods = GetPrintContent_Part(store, order, carts, print); //分单(按菜品)打印内容
                    if (singlePrintContentsByGoods?.Count > 0)
                    {
                        foreach (string content in singlePrintContentsByGoods)
                        {
                            if (!string.IsNullOrWhiteSpace(content))//当此打印的设定打单匹配到有要打印的内容时,才去打印
                            {
                                FoodYiLianYunPrintHelper.printContent(print.apiPrivateKey, print.platform_userId.ToString(), print.print_bianma, print.print_shibiema, content);
                            }
                        }
                    }
                }
            });
        }
Example #7
0
        public JsonResult Edit(DishStore store, int?categoryId, [System.Web.Http.FromBody] EditCategory edit)
        {
            if (!categoryId.HasValue)
            {
                return(ApiModel(message: "参数不能为空[categoryId]"));
            }

            DishCategory category = DishCategoryBLL.SingleModel.GetModel(categoryId.Value);

            if (category == null || category.storeId != store.id)
            {
                return(ApiModel(message: "非法操作"));
            }

            category.title      = edit.Name;
            category.img        = edit.Icon;
            category.name_info  = edit.Description;
            category.is_show    = edit.Display ? 1 : 0;
            category.is_order   = edit.Sort;
            category.updateTime = DateTime.Now;

            bool success = DishCategoryBLL.SingleModel.Update(category, "title,img,name_info,is_show,is_order,updateTime");

            return(ApiModel(isok: success, message: success ? "编辑成功" : "编辑失败"));
        }
Example #8
0
        public JsonResult EditStore(Account account, DishStore store, [System.Web.Http.FromBody] EditStore edit)
        {
            if (DishStoreBLL.SingleModel.CheckExistLoginName(store.id, store.aid, edit.Login))
            {
                //请输入门店管理员账号
                return(ApiModel(message: "存在同名的管理者账号,请修改!"));
            }

            store.updateTime      = DateTime.Now;
            store.dish_name       = edit.Name;
            store.dish_logo       = edit.Logo;
            store.dish_begin_time = edit.Begin.Value;
            store.dish_end_time   = edit.Expire.Value;
            store.login_username  = edit.Login;
            string updateColumns = "dish_name,dish_logo,dish_begin_time,dish_end_time,login_username,updateTime";

            if (!string.IsNullOrEmpty(edit.Password))
            {
                updateColumns       += ",login_userpass";
                store.login_userpass = DESEncryptTools.GetMd5Base32(edit.Password);
            }
            bool success = DishStoreBLL.SingleModel.Update(store, updateColumns);

            return(ApiModel(isok: success, message: success ? "更新成功" : "更新失败"));
        }
Example #9
0
        public JsonResult Base(DishStore store, [System.Web.Http.FromBody] EditBaseConfig config)
        {
            store.dish_name = config.storename;
            store.dish_logo = config.logo;
            store.ws_lat    = config.lat;
            store.ws_lng    = config.lng;
            if (string.IsNullOrWhiteSpace(config.dish_address))
            {
                return(ApiModel(message: "请填写商家地址"));
            }
            if (string.IsNullOrWhiteSpace(config.dish_jieshao))
            {
                return(ApiModel(message: "请填写门店介绍"));
            }
            if (string.IsNullOrWhiteSpace(config.dish_con_mobile))
            {
                return(ApiModel(message: "请填写门店手机号码"));
            }
            if (string.IsNullOrWhiteSpace(config.dish_fuwu))
            {
                return(ApiModel(message: "请填写提供服务"));
            }

            store.baseConfigJson = JsonConvert.SerializeObject(JsonConvert.DeserializeObject <DishBaseConfig>(JsonConvert.SerializeObject(config)));
            bool success = DishStoreBLL.SingleModel.Update(store, "baseConfigJson");

            return(ApiModel(isok: success, message: "保存成功"));
        }
Example #10
0
        public JsonResult Payment(DishStore store, [System.Web.Http.FromBody] DishPaySetting config)
        {
            store.paySettingJson = JsonConvert.SerializeObject(config);
            bool success = DishStoreBLL.SingleModel.Update(store, "paySettingJson");

            return(ApiModel(isok: success, message: "保存成功"));
        }
Example #11
0
        public JsonResult TakeOut(DishStore store, [System.Web.Http.FromBody] DishTakeoutConfig config)
        {
            store.takeoutConfigJson = JsonConvert.SerializeObject(config);
            bool success = DishStoreBLL.SingleModel.Update(store, "takeoutConfigJson");

            return(ApiModel(isok: success, message: "保存成功"));
        }
Example #12
0
 /// <summary>
 /// 基本设置
 /// </summary>
 /// <returns></returns>
 public ActionResult Config(string act, int aId, int storeId, DishStore model = null)
 {
     //显示
     if (string.IsNullOrEmpty(act))
     {
         model = DishStoreBLL.SingleModel.GetModelByAid_Id(aId, storeId);
         if (model == null)
         {
             model = new DishStore();
         }
         EditModel <DishStore> em = new EditModel <DishStore>();
         em.DataModel = model;
         em.aId       = aId;
         em.storeId   = storeId;
         return(View(em));
     }
     else
     {
         if (act == "edit")
         {
             bool updateResult = DishStoreBLL.SingleModel.Update(model, "ps_open_status,ps_type");
             _result.msg  = updateResult ? "修改成功" : "修改失败";
             _result.code = updateResult ? 1 : 0;
         }
         return(Json(_result, JsonRequestBehavior.AllowGet));
     }
 }
Example #13
0
 /// <summary>
 /// 根据参数配置打单
 /// </summary>
 /// <param name="order"></param>
 /// <param name="print_type">打单类型 0:直接所有相关打印机打单 1:下单后打单 2.支付后打单</param>
 public static void DishPrintOrderByPrintType(DishOrder order, DishStore store, List <DishShoppingCart> carts, int print_type = 0, string printerIds = null)
 {
     Task.Factory.StartNew(() =>
     {
         List <DishPrint> prints = string.IsNullOrWhiteSpace(printerIds) ? DishPrintBLL.SingleModel.GetPrintsByParams(store.aid, store.id, print_type) : DishPrintBLL.SingleModel.GetByIds(printerIds);
         DishPrintOrder(store, order, carts, prints);
     });
 }
Example #14
0
        public JsonResult Base(DishStore store)
        {
            EditBaseConfig config = JsonConvert.DeserializeObject <EditBaseConfig>(store.baseConfigJson);

            config.logo      = store.dish_logo;
            config.storename = store.dish_name;
            config.lat       = store.ws_lat;
            config.lng       = store.ws_lng;
            return(ApiModel(isok: true, message: "获取成功", data: config));
        }
Example #15
0
        public JsonResult List(DishStore store, int?pageIndex = null, int?pageSize = null)
        {
            List <DishTable> table = DishTableBLL.SingleModel.GetTableByParams(aid: store.aid, storeId: store.id, effData: true, pageIndex: pageIndex, pageSize: pageSize);
            object           DTO   = new
            {
                page  = table.Select(item => new { Id = item.id, Name = item.table_name }),
                total = DishTableBLL.SingleModel.GetCountByStoreId(store.id)
            };

            return(ApiModel(isok: true, message: "获取成功", data: DTO));
        }
Example #16
0
        public JsonResult List(DishStore store, int?pageIndex = null, int?pageSize = null)
        {
            List <DishPrint> printer = DishPrintBLL.SingleModel.GetPrintsByParams(aId: store.aid, storeId: store.id, pageIndex: pageIndex, pageSize: pageSize);
            object           DTO     = new
            {
                page  = printer.Select(item => new { Id = item.id, Name = item.print_name }),
                total = DishPrintBLL.SingleModel.GetCountByStoreId(store.id),
            };

            return(ApiModel(isok: true, message: "获取成功", data: DTO));
        }
Example #17
0
        public JsonResult List(DishStore store, int?pageIndex = null, int?pageSize = null)
        {
            List <DishTag> printLabel = DishTagBLL.SingleModel.GetTagByParams(aId: store.aid, storeId: store.id, type: (int)DishEnums.TagType.打印, pageIndex: pageIndex, pageSize: pageSize);
            object         DTO        = new
            {
                page  = printLabel.Select(item => new { Id = item.id, Name = item.name }),
                total = DishTagBLL.SingleModel.GetCountByParams(store.aid, store.id, (int)DishEnums.TagType.打印),
            };

            return(ApiModel(isok: true, message: "获取成功", data: DTO));
        }
Example #18
0
        public JsonResult List(DishStore store, int?pageIndex = null, int?pageSize = null)
        {
            List <DishTransporter> deliveryman = DishTransporterBLL.SingleModel.GetTransportersByparams(store.aid, store.id, true, pageIndex, pageSize);

            object DTO = new
            {
                page  = deliveryman.Select(item => new { Id = item.id, Name = item.dm_name }),
                total = DishPrintBLL.SingleModel.GetCountByStoreId(store.id),
            };

            return(ApiModel(isok: true, message: "获取成功", data: DTO));
        }
Example #19
0
        public ActionResult SetMainStore(bool?enable, Account account, DishStore store)
        {
            if (!enable.HasValue)
            {
                return(ApiModel(message: "参数不合法"));
            }

            int  enableValue = enable.Value ? 1 : 0;
            bool success     = DishStoreBLL.SingleModel.SetMainStore(enableValue, store.aid, store.id);

            return(ApiModel(isok: success, message: success ? "设置成功" : "设置失败"));
        }
Example #20
0
        public ActionResult Sale(DishStore store, DateTime?begin, DateTime?end)
        {
            DataTable saleReport = DishOrderBLL.SingleModel.GoodSalesCountReport(store.id, begin, end);

            object DTO = new
            {
                columns = new string[] { "商品", "销量" },
                rows    = saleReport.AsEnumerable().Select(item => new { 商品 = item["goods_name"], 销量 = item["sales_count"] })
            };

            return(ApiModel(isok: true, message: "获取成功", data: DTO));
        }
Example #21
0
        public JsonResult Income(DishStore store, int year = 0, int month = 0)
        {
            if (year == 0)
            {
                year = DateTime.Now.Year;
            }
            if (month == 0)
            {
                month = DateTime.Now.Month;
            }

            DateTime  startTime   = Convert.ToDateTime($"{year}-{month}-01 00:00:00");
            DateTime  endTime     = startTime.AddMonths(1).AddMilliseconds(-1);
            DataTable incomeTable = DishOrderBLL.SingleModel.IncomeReport(store.id, startTime, endTime);

            object DTO = new
            {
                TotalIncome = incomeTable.Compute("sum(total_total_fee)+sum(wx_maidan_total_fee)+sum(ye_maidan_total_fee)-sum(ye_total_fee)", null),
                //WechatIncome = incomeTable.Compute("sum(wx_total_fee)", null),
                //CashIncome = incomeTable.Compute("sum(xj_total_fee)", null),
                //AccountIncome = incomeTable.Compute("sum(ye_total_fee)", null),
                TotalOrder = incomeTable.Compute("sum(order_count)", null),
                //DineInOrder = incomeTable.Compute("sum(dn_order_count)", null),
                //TakeoutOrder = incomeTable.Compute("sum(wm_order_coun)", null),
                //WechatPayOrder = incomeTable.Compute("sum(wx_order_count)", null),
                //CashOrder = incomeTable.Compute("sum(xj_order_count)", null),
                //AccountOrder = incomeTable.Compute("sum(ye_order_count)", null),
                //WechatCheckoutOrder = incomeTable.Compute("sum(ye_order_count)", null),
                Daily = incomeTable.Rows.Cast <DataRow>().Select(item =>
                                                                 new
                {
                    Date   = item["order_date"],
                    Income = item["total_total_fee"],
                    Order  = item["order_count"],
                }),
            };

            //<th width="80">@(Model.Compute("sum(wx_maidan_order_count)+sum(ye_maidan_order_count)-sum(ye_order_count)", ""))</th>
            //<th width="60">@(Model.Compute("sum(wx_maidan_order_count)", ""))/@(Model.Compute("sum(wx_maidan_total_fee)", ""))</th>
            //<th width="60">
            //    @{
            //        object sum2 = Model.Compute("sum(ye_maidan_total_fee)-sum(ye_total_fee)", "");
            //        string sum2Result = "0.00";
            //        if (!Convert.IsDBNull(sum2))
            //        {
            //            sum2Result= Convert.ToDouble(sum2).ToString("F");
            //        }
            //    }
            //    @(Model.Compute("sum(ye_maidan_order_count)-sum(ye_order_count)", ""))/@(sum2Result)
            //</th>
            return(ApiModel(isok: true, message: "获取成功", data: DTO));
        }
Example #22
0
        public JsonResult UpdateState(DishStore store, string orderId, string state)
        {
            orderId = string.Join(",", orderId.ConvertToIntList(',').FindAll(id => id > 0));
            if (string.IsNullOrWhiteSpace(orderId))
            {
                return(ApiModel(message: "参数不能为空[orderId]"));
            }
            if (string.IsNullOrWhiteSpace(state))
            {
                return(ApiModel(message: "参数不能为空[state]"));
            }

            List <DishOrder> orders = DishOrderBLL.SingleModel.GetListByIds(orderId);

            if (orders == null || orders.Count == 0)
            {
                return(ApiModel(message: "无效订单,数据不存在"));
            }

            if (orders.Exists(item => item.storeId != store.id))
            {
                return(ApiModel(message: "非法操作"));
            }

            bool success = false;

            int[] updateOrder = orders.Select(item => item.id).ToArray();
            switch (state)
            {
            case "pay":
                success = DishOrderBLL.SingleModel.BtachModifyPayState(updateOrder, DishEnums.PayState.已付款); break;

            case "delete":
                success = DishOrderBLL.SingleModel.BtachDelete(updateOrder); break;

            default:
                Dictionary <string, DishEnums.OrderState> matchState = new Dictionary <string, DishEnums.OrderState>
                {
                    { "confirm", DishEnums.OrderState.已确认 },
                    { "complete", DishEnums.OrderState.已完成 },
                    { "cancel", DishEnums.OrderState.已取消 },
                };
                DishEnums.OrderState newState;
                success = matchState.TryGetValue(state, out newState) && DishOrderBLL.SingleModel.BtachModifyOrderState(updateOrder, newState);
                break;
            }

            return(ApiModel(isok: success, message: success ? "更新成功" : $"更新失败[{state}]"));
        }
Example #23
0
        public JsonResult Refund(DishStore store, int?orderId, string remark = null)
        {
            if (!orderId.HasValue)
            {
                return(ApiModel(message: "参数不能为空[orderId]"));
            }
            if (DishOrderBLL.SingleModel.GetModel(orderId.Value)?.storeId != store.id)
            {
                return(ApiModel(message: "非法操作"));
            }
            DishReturnMsg result = new DishReturnMsg();

            DishOrderBLL.SingleModel.RefundOrderById(orderId.Value, result, remark);
            return(ApiModel(isok: result.code == 1, message: result.msg, data: result.obj));
        }
Example #24
0
        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            if (filterContext.ActionDescriptor.IsDefined(typeof(AllowAnonymousAttribute), true))
            {
                return;
            }

            int storeId = Context.GetRequestInt("storeId", 0);

            if (storeId > 0)
            {
                string cookieSoreId = CookieHelper.GetCookie("dzDishAdmin");
                //如果没有找到登陆cookie
                if (string.IsNullOrEmpty(cookieSoreId))
                {
                    filterContext.Result = new RedirectResult("/DishAdmin/main/login");
                    return;
                }
                int storeid = 0;
                int.TryParse(DESEncryptTools.DESDecrypt(cookieSoreId), out storeid);
                //如果登陆cookie无法解密
                if (storeid <= 0)
                {
                    filterContext.Result = new RedirectResult("/DishAdmin/main/login");
                    return;
                }
                //只能进对应的管理后台
                if (storeid != storeId)
                {
                    filterContext.Result = new RedirectResult("/DishAdmin/main/login");
                    return;
                }
                DishStore dishStore = DishStoreBLL.SingleModel.GetModel(storeid);
                //如果门店不存在
                if (dishStore == null)
                {
                    filterContext.Result = new RedirectResult("/DishAdmin/main/login");
                    return;
                }

                filterContext.RouteData.Values["dishStore"] = dishStore;
            }
            else
            {
                filterContext.Result = new RedirectResult("/DishAdmin/main/login");
                return;
            }
        }
Example #25
0
        public ActionResult Table(DishStore store, DateTime?begin = null, DateTime?end = null)
        {
            DataTable tableIncome = DishOrderBLL.SingleModel.TableStatisticsReport(store.id, begin, end);

            object DTO = tableIncome.Rows.Cast <DataRow>().Select(item =>
                                                                  new
            {
                Name       = item["table_name"],
                OrderCount = item["order_count"],
                TotalPay   = item["all_total_fee"],
                WechatPay  = item["wx_total_fee"],
                OtherPay   = item["else_total_fee"],
            });

            return(ApiModel(isok: true, message: "获取成功", data: DTO));
        }
Example #26
0
        /// <summary>
        /// 根据参数配置打单
        /// </summary>
        /// <param name="order"></param>
        /// <param name="print_type">打单类型 0:直接所有相关打印机打单 1:下单后打单 2.支付后打单</param>
        public static void DishPrintOrderByPrintType(DishOrder order, int print_type = 0, string printerIds = null)
        {
            if (order == null)
            {
                return;
            }
            DishStore store = DishStoreBLL.SingleModel.GetModel(order.storeId);

            if (store == null)
            {
                return;
            }
            List <DishShoppingCart> carts = DishShoppingCartBLL.SingleModel.GetCartsByOrderId(order.id);

            DishPrintOrderByPrintType(order, store, carts, print_type, printerIds);
        }
Example #27
0
        public JsonResult AddType(DishStore store, [System.Web.Http.FromBody] EditAttrType edit)
        {
            DishAttrType newAttrType = new DishAttrType
            {
                aid      = store.aid,
                cat_name = edit.Name,
                enabled  = edit.Enable.Value ? 1 : 0,
                storeId  = store.id,
                state    = 1,
            };

            int  newId;
            bool success = int.TryParse(DishAttrTypeBLL.SingleModel.Add(newAttrType)?.ToString(), out newId) && newId > 0;

            return(ApiModel(isok: success, message: success ? "新增成功" : "新增失败"));
        }
Example #28
0
        public JsonResult Remark(DishStore store, int?orderId, string remark = null)
        {
            if (!orderId.HasValue)
            {
                return(ApiModel(message: "参数不能为空[orderId]"));
            }

            DishOrder         order     = DishOrderBLL.SingleModel.GetModel(orderId.Value);
            DishOrderAttrbute orderAttr = order.GetAttrbute();

            orderAttr.mark = remark;
            order.attrbute = JsonConvert.SerializeObject(orderAttr);

            bool success = DishOrderBLL.SingleModel.Update(order, "attrbute");

            return(ApiModel(isok: success, message: success ? "操作成功" : "操作失败"));
        }
Example #29
0
        public JsonResult List(DishStore store,
                               int pageIndex  = 1, int pageSize       = 10,
                               string orderNo = null, int orderState  = -1, int orderType  = 0, int payState = -1, int payWay = 0, int pickUp = -1,
                               bool isToday   = false, DateTime?start = null, DateTime?end = null)
        {
            if (pickUp == 1) //订单类型为自取
            {
                orderType = (int)DishEnums.OrderType.店内;
            }

            if (isToday)//是否今日订单
            {
                start = DateTime.Now.Date;
                end   = DateTime.Now.Date.AddHours(23).AddMinutes(59).AddSeconds(59).AddMilliseconds(999);
            }

            List <DishOrder> orders = DishOrderBLL.SingleModel.GetOrders(store.aid, store.id, orderNo, orderState, orderType, payState, payWay, start, end, pageIndex, pageSize, is_ziqu: pickUp);
            int total = DishOrderBLL.SingleModel.GetOrdersCount(store.aid, store.id, orderNo, orderState, orderType, payState, payWay, start, end, is_ziqu: pickUp);

            object formatDTO = orders.Select(order =>
            {
                return(new
                {
                    Id = order.id,
                    OrderNo = order.order_sn,
                    OrderDate = order.ctime.ToString(),
                    OrderStateEnum = order.order_status,
                    OrderState = order.order_status_txt,
                    OrderTypeEnum = order.order_type,
                    OrderType = order.order_type_txt,
                    UserName = order.user_name,
                    IsPickUp = order.is_ziqu == 1,
                    PickUpName = order.ziqu_username,
                    PickUpPhoneNo = order.ziqu_userphone,
                    ReceivingName = order.consignee,
                    ReceivingPhoneNo = order.mobile,
                    Address = order.address,
                    PayAmount = order.settlement_total_fee,
                    Table = order.order_table_id == "0" ? null : order.order_table_id,
                });
            });

            formatDTO = new { page = formatDTO, total };

            return(ApiModel(isok: true, message: "获取成功", data: formatDTO));
        }
Example #30
0
        /// <summary>
        /// 首单立减
        /// </summary>
        /// <returns></returns>
        public ActionResult Shou(string act = "", int aId = 0, int storeId = 0, DishGaojiConfig model = null)
        {
            EditModel <DishGaojiConfig> em = new EditModel <DishGaojiConfig>();

            if (string.IsNullOrEmpty(act))
            {
                DishStore store = DishStoreBLL.SingleModel.GetModel(storeId);
                if (store != null && !string.IsNullOrEmpty(store.gaojiConfigJson))
                {
                    em.DataModel = JsonConvert.DeserializeObject <DishGaojiConfig>(store.gaojiConfigJson);
                }
                else
                {
                    em.DataModel = new DishGaojiConfig();
                }
            }
            else if (act == "edit")
            {
                DishStore store = DishStoreBLL.SingleModel.GetModel($"id={storeId} and aid={aId}");
                if (store != null)
                {
                    DishGaojiConfig storeGojiConfig = null;
                    if (!string.IsNullOrEmpty(store.gaojiConfigJson))
                    {
                        storeGojiConfig = JsonConvert.DeserializeObject <DishGaojiConfig>(store.gaojiConfigJson);
                    }
                    else
                    {
                        storeGojiConfig = new DishGaojiConfig();
                    }

                    storeGojiConfig.huodong_shou_isopen = model.huodong_shou_isopen;
                    storeGojiConfig.huodong_shou_jiner  = model.huodong_shou_jiner;
                    store.gaojiConfigJson = JsonConvert.SerializeObject(storeGojiConfig);
                    if (DishStoreBLL.SingleModel.Update(store))
                    {
                        _result.code = 1;
                        _result.msg  = "设置成功";
                    }
                }
                return(Json(_result));
            }
            em.aId     = aId;
            em.storeId = storeId;
            return(View(em));
        }