public void GetOrderList(int userId, string version, string equType, string equName)
        {
            if (userId == 0)
            {
                Context.Response.Write("{\"status\":\"false\",\"data\":\"对不起,此用户不存在!\"}");
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                return;
            }
            BLL.orders bll_order = new BLL.orders();
            List<Model.orders> lst_order = bll_order.GetOrderList(userId);

            if (lst_order == null || lst_order.Count == 0)
            {
                Context.Response.Write("{\"status\":\"true\",\"data\":\"[]\"}");
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                return;
            }
            Model.goods model_good = null;
            StringBuilder sb = new StringBuilder();
            sb.Append("[");
            foreach (var each in lst_order)
            {
                if (each.order_goods.Count == 0)
                {
                    continue;
                }
                //此处限制同样的产品在同一个定单内
                model_good = bll_business.GetGoodsModel(each.order_goods[0].goods_id);
                if (model_good == null) { continue; }
                sb.Append("{ \"order_no\": \"" + each.order_no + "\",");
                sb.Append("\"order_name\": \"" + each.order_goods[0].goods_name + "\",");
                sb.Append("\"message\": \"" + model_good.content + "\",");
                sb.Append(" \"img_url\":\"" + this.webUrl + model_good.img_url + "\",");

                sb.Append(" \"order_status\": \"" + each.status + "\",");
                // sb.Append(" \"payment_status\": \"" + (each.payment_status == 1 ? "未支付" : "已支付") + "\",");
                sb.Append(" \"real_amount\": \"" + each.real_amount + "\",");
                sb.Append(" \"goods_count\": \"" + each.order_goods.Count + "\",");
                sb.Append(" \"add_time\": \"" + each.add_time.ToString("yyyy-MM-dd") + "\",");
                sb.Append("\"order_goods\":[");

                foreach (var each_good in each.order_goods)
                {
                    sb.Append("{ \"goods_id\": \"" + each_good.goods_id + "\",\"goods_name\": \"" + each_good.goods_name + "\",\"goods_price\": \"" + each_good.goods_price + "\",\"menpiao_type\": \"" + each_good.menpiao_type + "\", \"end_date\": \"" + model_good.end_date + "\",\"quantity\": \"" + each_good.quantity + "\",\"unique_code\": \"" + each_good.unique_code + "\",\"good_status\": \"" + (each_good.status == 0 ? "未使用" : "已使用") + "\"},");
                }
                sb.Remove(sb.ToString().LastIndexOf(','), 1);

                sb.Append("]},");

            }
            sb.Remove(sb.ToString().LastIndexOf(','), 1);
            sb.Append("]");
            WriteWebServiceLog(version, equType, equName, "GetOrderList", "");
            Context.Response.Write("{\"status\":\"true\",\"currentDate\":\"" + DateTime.Now.ToString("yyyy-MM-dd") + "\",\"nextPage\":\"False\",\"data\":" + sb.ToString() + "}");
            HttpContext.Current.ApplicationInstance.CompleteRequest();
            return;
        }
Exemplo n.º 2
0
        private void ShowInfo(int _id)
        {
            BLL.orders bll = new BLL.orders();
            model = bll.GetModel(_id);

            DataTable dt = bll.GetOrderList(0, " t1.order_no='" + _id + "'", " t1.id desc").Tables[0];

            var refund_status = 0;

            if (dt.Rows[0]["refund_status"].ToString() != "" && dt.Rows[0]["refund_status"].ToString() != null)
            {
                refund_status = int.Parse(dt.Rows[0]["refund_status"].ToString());
            }


            //绑定商品列表
            this.rptList.DataSource = model.order_goods;
            this.rptList.DataBind();
            //获得会员信息
            if (model.user_id > 0)
            {
                Model.users user_info = new BLL.users().GetModel(model.user_id);
                if (user_info != null)
                {
                    Model.user_groups group_info = new BLL.user_groups().GetModel(user_info.group_id);
                    if (group_info != null)
                    {
                        dlUserInfo.Visible  = true;
                        lbUserName.Text     = user_info.user_name;
                        lbUserGroup.Text    = group_info.title;
                        lbUserDiscount.Text = group_info.discount.ToString() + " %";
                        lbUserAmount.Text   = user_info.amount.ToString();
                        lbUserPoint.Text    = user_info.point.ToString();
                    }
                }
            }

            //根据订单状态,显示各类操作按钮
            switch (int.Parse(dt.Rows[0]["status"].ToString()))
            {
            case 1:     //如果是线下支付,支付状态为0,如果是线上支付,支付成功后会自动改变订单状态为已确认
                if (int.Parse(dt.Rows[0]["payment_status"].ToString()) == 1)
                {
                    //作废订单、修改商品总金额、修改配送费用、修改支付手续费、修改积分总计按钮、确认付款、取消订单
                    btnInvalid.Visible = btnEditExpressFee.Visible = btnEditPaymentFee.Visible = btnPayment.Visible = btnEditRealAmount.Visible = btnCancel.Visible = true;
                }
                //作废订单、修改订单备注、取消订单、修改收货按钮显示显示
                btnInvalid.Visible = btnEditRemark.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true;
                break;

            case 2:     //如果是DIY待确认状态
                if (int.Parse(dt.Rows[0]["express_status"].ToString()) == 1 && refund_status == 0)
                {
                    //作废订单、确认发货、修改订单备注按钮显示
                    btnInvalid.Visible = btnExpress.Visible = btnEditRemark.Visible = true;
                }
                else if (int.Parse(dt.Rows[0]["express_status"].ToString()) == 1 && refund_status == 1)
                {
                    //作废订单可见
                    btnInvalid.Visible = true;
                }
                else if (int.Parse(dt.Rows[0]["express_status"].ToString()) == 1 && refund_status == 2)
                {
                    //作废订单可见
                    btnInvalid.Visible = true;
                }
                else if (int.Parse(dt.Rows[0]["express_status"].ToString()) == 1 && refund_status == 3)
                {
                    //作废订单可见
                    btnInvalid.Visible = true;
                }
                else if (int.Parse(dt.Rows[0]["express_status"].ToString()) == 1 && refund_status == 4)
                {
                    //作废订单可见
                    btnInvalid.Visible = true;
                }
                else if (int.Parse(dt.Rows[0]["express_status"].ToString()) == 1 && refund_status == 5)
                {
                    //作废订单、确认发货、修改订单备注按钮显示
                    btnInvalid.Visible = btnExpress.Visible = btnEditRemark.Visible = true;
                }
                else if (model.express_status == 2)
                {
                    //作废订单、完成订单可见
                    btnInvalid.Visible = btnComplete.Visible = true;
                }
                break;
            }
        }
        public void ValidateOrderList(string order_no, string version, string equType, string equName)
        {
            if (string.IsNullOrEmpty(order_no))
            {
                Context.Response.Write("{\"status\":\"false\",\"data\":\"对不起,订单号不能为空!\"}");
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                return;
            }
            BLL.orders bll_order = new BLL.orders();
            List<Model.orders> lst_order = bll_order.GetOrderList(order_no);

            if (lst_order == null || lst_order.Count == 0)
            {
                Context.Response.Write("{\"status\":\"true\",\"data\":\"[]\"}");
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                return;
            }
            Model.goods model_good = null;
            StringBuilder sb = new StringBuilder();
            sb.Append("[");
            foreach (var each in lst_order)
            {
                if (each.order_goods.Count == 0)
                {
                    continue;
                }
                //此处限制同样的产品在同一个定单内
                model_good = bll_business.GetGoodsModel(each.order_goods[0].goods_id);
                if (model_good == null) { continue; }
                sb.Append("{ \"order_no\": \"" + each.order_no + "\",");
                sb.Append("\"order_name\": \"" + each.order_goods[0].goods_name + "\",");
                sb.Append("\"message\": \"" + model_good.content + "\",");
                sb.Append(" \"img_url\":\"" + this.webUrl + model_good.img_url + "\",");

                sb.Append(" \"order_status\": \"" + each.status + "\",");
                // sb.Append(" \"payment_status\": \"" + (each.payment_status == 1 ? "未支付" : "已支付") + "\",");
                sb.Append(" \"real_amount\": \"" + each.real_amount + "\",");
                sb.Append(" \"goods_count\": \"" + each.order_goods.Count + "\",");
                sb.Append(" \"add_time\": \"" + each.add_time.ToString("yyyy-MM-dd") + "\",");
                sb.Append("\"order_goods\":[");

                var lst_ordergoods = from p in each.order_goods
                                     group p
                                     by p.menpiao_type into m
                                     select new
                                     {
                                         menpiao_type = m.Key,
                                         goods_name = m.First().goods_name,
                                         goods_price = m.First().goods_price,
                                         goods_count = m.Count()

                                     };
                foreach (var each_good in lst_ordergoods)
                {
                    sb.Append("{ \"goods_name\": \"" + each_good.goods_name + "\",\"goods_price\": \"" + each_good.goods_price + "\",\"menpiao_type\": \"" + each_good.menpiao_type + "\", \"goods_count\": \"" + each_good.goods_count + "\"},");
                }
                sb.Remove(sb.ToString().LastIndexOf(','), 1);

                sb.Append("]},");

            }
            sb.Remove(sb.ToString().LastIndexOf(','), 1);
            sb.Append("]");
            WriteWebServiceLog(version, equType, equName, "ValidateOrderList", "");
            Context.Response.Write("{\"status\":\"true\",\"currentDate\":\"" + DateTime.Now.ToString("yyyy-MM-dd") + "\",\"nextPage\":\"False\",\"data\":" + sb.ToString() + "}");
            HttpContext.Current.ApplicationInstance.CompleteRequest();
            return;
        }