Пример #1
0
        public async Task <ActionResult> Add(long goodsId, long memberId)
        {
            DataTable dt = await _specAppService.GetObjTableBuyObjId(goodsId);

            if (dt.Rows.Count == 0 || dt == null)//商品如果没有规格
            {
                DataRow dr    = dt.NewRow();
                var     goods = await _AppService.GetByIdAsync(goodsId);

                dr["Id"]    = goodsId;
                dr["Text"]  = "--";
                dr["Stock"] = goods.Stock;
                dr["Price"] = goods.Price;
                dt.Rows.Add(dr);
            }


            ViewBag.Member = await _memAppService.GetEntity(memberId);

            decimal pp = Convert.ToDecimal(await _parService.GetParameterValue("PointPayPrice"));

            ViewBag.MaxIntegralToMoney = ((decimal)(ViewBag.Member.Integral / pp)).ToString("#0.00");

            ViewBag.PayType = await _parService.GetParameterValue("PayType");

            ViewBag.Coupon = _copAppService.GetUseableCoupon(memberId, (decimal)dt.Rows[0]["Price"]);
            return(View("_Select", dt));
        }
Пример #2
0
        public async Task <IActionResult> Add(long?id)
        {
            CreateOrEditDto     s         = new CreateOrEditDto();
            List <Entity.Image> imageList = new List <Entity.Image>();

            Entity.Goods a = new Entity.Goods();
            if (id != null)
            {
                a = await _AppService.GetByIdAsync((long)id);

                imageList = await _imgAppService.GetList((long)id, (int)ImageType.商品图片);

                string imgs = "", config = "";
                for (int i = 0; i < imageList.Count; i++)
                {
                    imgs += $"\'{imageList[i].Url.ToString()}\',";
                    //config += string.Format("{" + "key: 'item{0}',url:'{1}',size:{2}" + "}",
                    //    imageList[i].ToString(), imageList[i].Url, imageList[i].Size);
                    config += "{img:'" + imageList[i].Url + "', key: '" + imageList[i].Id.ToString() + "',url:'/common/deleteimg'},";
                }
                ViewBag.Images = imgs;
                ViewBag.Config = config;
            }
            s.Goods     = a;
            s.ImageList = imageList;

            var cat = _catAppService.GetCategoryDropDownList(AbpSession.TenantId, 0);

            ViewData.Add("Category", new SelectList(cat, "Id", "Title"));
            var b = _brandAppService.GetMultiSelect();

            ViewData.Add("Brand", new SelectList(b, "Id", "Title"));

            var storeDropDown = (await _storeAppService.GetDropDown());

            ViewData.Add("ChainStore", new SelectList(storeDropDown, "Id", "Name"));

            IList <SelectListItem> listItem = new List <SelectListItem>();
            Array values = System.Enum.GetValues(typeof(Entity.GoodsType));

            foreach (int item in values)
            {
                listItem.Add(new SelectListItem
                {
                    Value = item.ToString(),
                    Text  = L(System.Enum.GetName(typeof(Entity.GoodsType), item))
                });
            }
            ViewData.Add("GoodsType", new SelectList(listItem, "Value", "Text"));
            return(View(s));
        }