Ejemplo n.º 1
0
        /// <summary>
        /// 根据订单id显示详细的订单信息,要验证用户。
        /// </summary>
        /// <param name="id">订单id</param>
        /// <returns>返回用户DTO</returns>
        public ActionResult OrderInfo(int?id)
        {
            //WechatJSConfig wechatJS = new WechatJSConfig(wid);
            WechatJSConfig wechatJS = new WechatJSConfig("['chooseWXPay']", wid);

            ViewData["wxjs"] = wechatJS.ToString();
            OrderDTO dTO = _iOrderService.Get(id.Value);

            dTO.OrderProducts = _iOrderService.GetProducts(dTO.Id);
            return(View(dTO));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据订单id显示付款信息,带上用户地址信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Pay(int?id)
        {
            //WechatJSConfig wechatJS = new WechatJSConfig(wid);
            WechatJSConfig wechatJS = new WechatJSConfig("['chooseWXPay']", wid);

            //jsApiList =
            ViewData["wxjs"] = wechatJS.ToString();

            OrderDTO model = new OrderDTO();

            if (id > 0)
            {
                model = _iOrderService.Get(id.Value);
                model.OrderProducts = _iOrderService.GetProducts(id.Value);
            }
            return(View(model));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 直接购买商品,跳转到Pay页面
        /// </summary>
        /// <param name="Id">商品id</param>
        public ActionResult PayNow(int?Id, int?num)
        {
            //WechatJSConfig wechatJS = new WechatJSConfig(wid);
            WechatJSConfig wechatJS = new WechatJSConfig("['chooseWXPay']", wid);

            ViewData["wxjs"] = wechatJS.ToString();
            GetUserInfo(UserData, "地址");
            if (UserData.DefUaddress == null)
            {
                return(RedirectToAction("Address"));
            }

            if (Id == null)
            {
                return(View("index"));
            }
            if (num == null)
            {
                num = 1;
            }
            OrderDTO dTO = new OrderDTO();
            //var uadto = _iUserService.GetAddress(UserData);
            ProductDTO pdTO = _iProSer.Get(Id.Value);

            pdTO.Num     = num.Value;
            dTO.Products = new List <ProductDTO>
            {
                pdTO
            };
            dTO.Price       = pdTO.Price_yh > 0? pdTO.Price_yh * num.Value: pdTO.Price * num.Value;
            dTO.Addtime     = (int)GetTimestamp(DateTime.Now);
            dTO.Uid         = UserData.Id;
            dTO.Address_xq  = UserData.DefUaddress.Address_xq;
            dTO.Receiver    = UserData.DefUaddress.Name;
            dTO.Tel         = UserData.DefUaddress.Tel;
            dTO.Status      = 10;
            dTO.Order_sn    = DateTime.Now.ToString("yyyyMMddHHmmss") + Rand.Number(6);
            dTO.Post_remark = "";
            dTO.Post        = 0;
            var result = _iOrderService.SaveOrUpdate(dTO);

            dTO = _iOrderService.Get(int.Parse(result.Key.ToString()));
            dTO.OrderProducts = _iOrderService.GetProducts(dTO.Id);

            return(View("Pay", dTO));
        }