Esempio n. 1
0
        private void ShowInfo()
        {
            BLL.orderconfig   bll   = new BLL.orderconfig();
            Model.orderconfig model = bll.loadConfig();

            if (model.anonymous == 1)
            {
                anonymous.Checked = true;
            }
            else
            {
                anonymous.Checked = false;
            }
            taxtype.SelectedValue     = model.taxtype.ToString();
            taxamount.Text            = model.taxamount.ToString();
            confirmmsg.SelectedValue  = model.confirmmsg.ToString();
            confirmcallindex.Text     = model.confirmcallindex;
            expressmsg.SelectedValue  = model.expressmsg.ToString();
            expresscallindex.Text     = model.expresscallindex;
            completemsg.SelectedValue = model.completemsg.ToString();
            completecallindex.Text    = model.completecallindex;

            kuaidiapi.Text            = model.kuaidiapi;
            kuaidikey.Text            = model.kuaidikey;
            kuaidishow.SelectedValue  = model.kuaidishow.ToString();
            kuaidimuti.SelectedValue  = model.kuaidimuti.ToString();
            kuaidiorder.SelectedValue = model.kuaidiorder;
        }
Esempio n. 2
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("order_config", DTEnums.ActionEnum.Edit.ToString()); //检查权限
            BLL.orderconfig   bll   = new BLL.orderconfig();
            Model.orderconfig model = bll.loadConfig();
            try
            {
                if (anonymous.Checked == true)
                {
                    model.anonymous = 1;
                }
                else
                {
                    model.anonymous = 0;
                }
                model.taxtype           = Utils.StrToInt(taxtype.SelectedValue, 1);
                model.taxamount         = Utils.StrToDecimal(taxamount.Text.Trim(), 0);
                model.confirmmsg        = Utils.StrToInt(confirmmsg.SelectedValue, 0);
                model.confirmcallindex  = confirmcallindex.Text;
                model.expressmsg        = Utils.StrToInt(expressmsg.SelectedValue, 0);
                model.expresscallindex  = expresscallindex.Text;
                model.completemsg       = Utils.StrToInt(completemsg.SelectedValue, 0);
                model.completecallindex = completecallindex.Text;

                bll.saveConifg(model);
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改订单配置信息"); //记录日志
                JscriptMsg("修改订单配置成功!", "order_config.aspx");
            }
            catch
            {
                JscriptMsg("文件写入失败,请检查是否有权限!", string.Empty);
            }
        }
Esempio n. 3
0
        //儲存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevelEdit("sys_quan", "Edit");
            //ChkAdminLevel("order_config", TWEnums.ActionEnum.Edit.ToString()); //檢查許可權
            BLL.orderconfig   bll   = new BLL.orderconfig();
            Model.orderconfig model = bll.loadConfig();
            try
            {
                model.maned    = Utils.StrToInt(maned.Text, 0);
                model.zhekou   = Utils.StrToInt(zhekou.Text, 0);
                model.quanguan = Utils.StrToDecimal(quanguan.Text.Trim(), 0);
                model.yunfei   = Utils.StrToInt(yunfei.Text, 0);
                model.yunmian  = Utils.StrToInt(yunmian.Text, 0);

                model.mebegin = Utils.StrToDateTime(mebegin.Text);
                model.meend   = Utils.StrToDateTime(meend.Text);
                model.metype  = Utils.StrToInt(metype.SelectedValue, 0);
                model.zkjin   = Utils.StrToInt(zkjin.Text, 0);

                model.qgbegin     = Utils.StrToDateTime(qgbegin.Text);
                model.qgend       = Utils.StrToDateTime(qgend.Text);
                model.qgtype      = Utils.StrToInt(qgtype.SelectedValue, 0);
                model.quanguanjin = Utils.StrToInt(quanguanjin.Text, 0);

                bll.saveConifg(model);
                AddAdminLog(TWEnums.ActionEnum.Edit.ToString(), "修改折扣設定資料"); //記錄日誌
                JscriptMsg("修改折扣設定成功!", "order_config.aspx");
            }
            catch
            {
                JscriptMsg("檔寫入失敗,請檢查是否有許可權!", string.Empty);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!")));
         return;
     }
     model = bll.GetModel(id);
     if (model.user_id != userModel.id)
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的订单信息!")));
         return;
     }
     payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
     //根据订单状态和物流单号跟踪物流信息
     if (model.status > 1 && model.status < 4 && model.express_status == 2 && model.express_no.Trim().Length > 0)
     {
         Model.express     modelt      = new BLL.express().GetModel(model.express_id);
         Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
     }
 }
Esempio n. 5
0
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!")));
         return;
     }
     model = bll.GetModel(id);
     if (model.user_id != userModel.id)
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的订单信息!")));
         return;
     }
     payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
     //根据订单状态和物流单号跟踪物流信息
     if (model.status > 1 && model.status < 4 && model.express_status == 2 && model.express_no.Trim().Length > 0)
     {
         Model.express modelt = new BLL.express().GetModel(model.express_id);
         Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
     }
 }
        private void ShowInfo()
        {
            BLL.orderconfig bll = new BLL.orderconfig();
            Model.orderconfig model = bll.loadConfig();

            if (model.anonymous == 1)
            {
                anonymous.Checked = true;
            }
            else
            {
                anonymous.Checked = false;
            }
            confirmmsg.SelectedValue = model.confirmmsg.ToString();
            confirmcallindex.Text = model.confirmcallindex;
            expressmsg.SelectedValue = model.expressmsg.ToString();
            expresscallindex.Text = model.expresscallindex;
            completemsg.SelectedValue = model.completemsg.ToString();
            completecallindex.Text = model.completecallindex;

            kuaidiapi.Text = model.kuaidiapi;
            kuaidikey.Text = model.kuaidikey;
            kuaidishow.SelectedValue = model.kuaidishow.ToString();
            kuaidimuti.SelectedValue = model.kuaidimuti.ToString();
            kuaidiorder.SelectedValue = model.kuaidiorder;
        }
Esempio n. 7
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("order_config", DTEnums.ActionEnum.Edit.ToString()); //检查权限
            BLL.orderconfig bll = new BLL.orderconfig();
            Model.orderconfig model = bll.loadConfig();
            try
            {
                if (anonymous.Checked == true)
                {
                    model.anonymous = 1;
                }
                else
                {
                    model.anonymous = 0;
                }
                model.taxtype = Utils.StrToInt(taxtype.SelectedValue, 1);
                model.taxamount = Utils.StrToDecimal(taxamount.Text.Trim(), 0);
                model.confirmmsg = Utils.StrToInt(confirmmsg.SelectedValue, 0);
                model.confirmcallindex = confirmcallindex.Text;
                model.expressmsg = Utils.StrToInt(expressmsg.SelectedValue, 0);
                model.expresscallindex = expresscallindex.Text;
                model.completemsg = Utils.StrToInt(completemsg.SelectedValue, 0);
                model.completecallindex = completecallindex.Text;

                bll.saveConifg(model);
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改订单配置信息"); //记录日志
                JscriptMsg("修改订单配置成功!", "order_config.aspx");
            }
            catch
            {
                JscriptMsg("文件写入失败,请检查是否有权限!", string.Empty);
            }
        }
Esempio n. 8
0
 /// <summary>
 /// 返回税金费用金额
 /// </summary>
 /// <param name="total_amount">总金额</param>
 /// <returns>decimal</returns>
 protected decimal get_order_taxamount(decimal total_amount)
 {
     Model.orderconfig model = new BLL.orderconfig().loadConfig();
     decimal taxamount = model.taxamount;
     if (model.taxtype == 1)
     {
         taxamount = (taxamount * total_amount) / 100;
     }
     return taxamount;
 }
Esempio n. 9
0
        private void ShowInfo(int _id)
        {
            BLL.orders bll = new BLL.orders();
            model = bll.GetModel(_id);
            //绑定商品列表
            this.rptList.DataSource = model.order_goods;
            this.rptList.DataBind();
            //根据订单状态,显示各类操作按钮
            switch (model.status)
            {
            case 1:     //如果是线下支付,支付状态为0,如果是线上支付,支付成功后会自动改变订单状态为已确认
                if (model.payment_status > 0)
                {
                    //确认付款、取消订单、修改收货按钮显示
                    btnPayment.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true;
                }
                else
                {
                    //确认订单、取消订单、修改收货按钮显示
                    btnConfirm.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true;
                }
                //修改订单备注、修改商品总金额、修改配送费用、修改支付手续费、修改发票税金按钮显示
                btnEditRemark.Visible = btnEditRealAmount.Visible = btnEditExpressFee.Visible = btnEditPaymentFee.Visible = btnEditInvoiceTaxes.Visible = true;
                break;

            case 2:     //如果订单为已确认状态,则进入发货状态
                if (model.express_status == 1)
                {
                    //确认发货、取消订单、修改收货信息按钮显示
                    btnExpress.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true;
                }
                else if (model.express_status == 2)
                {
                    //完成订单、取消订单按钮可见
                    btnComplete.Visible = btnCancel.Visible = true;
                }
                //修改订单备注按钮可见
                btnEditRemark.Visible = true;
                break;

            case 3:
                //作废订单、修改订单备注按钮可见
                btnInvalid.Visible = btnEditRemark.Visible = true;
                break;
            }
            //根据订单状态和物流单号跟踪物流信息
            if (model.express_status == 2 && model.express_no.Trim().Length > 0)
            {
                Model.express     modelt      = new BLL.express().GetModel(model.express_id);
                Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
            }
        }
Esempio n. 10
0
        private void ShowInfo()
        {
            BLL.orderconfig   bll   = new BLL.orderconfig();
            Model.orderconfig model = bll.loadConfig();

            if (model.anonymous == 1)
            {
                anonymous.Checked = true;
            }
            else
            {
                anonymous.Checked = false;
            }
            confirmmsg.SelectedValue  = model.confirmmsg.ToString();
            confirmcallindex.Text     = model.confirmcallindex;
            expressmsg.SelectedValue  = model.expressmsg.ToString();
            expresscallindex.Text     = model.expresscallindex;
            completemsg.SelectedValue = model.completemsg.ToString();
            completecallindex.Text    = model.completecallindex;
        }
Esempio n. 11
0
        private void ShowInfo()
        {
            BLL.orderconfig   bll   = new BLL.orderconfig();
            Model.orderconfig model = bll.loadConfig();
            maned.Text    = model.maned.ToString();
            zhekou.Text   = model.zhekou.ToString();
            quanguan.Text = model.quanguan.ToString();
            yunfei.Text   = model.yunfei.ToString();
            yunmian.Text  = model.yunmian.ToString();

            mebegin.Text         = model.mebegin.GetValueOrDefault().ToString("yyyy-MM-dd");
            meend.Text           = model.meend.GetValueOrDefault().ToString("yyyy-MM-dd");
            metype.SelectedValue = model.metype.ToString();
            zkjin.Text           = model.zkjin.ToString();


            qgbegin.Text         = model.qgbegin.GetValueOrDefault().ToString("yyyy-MM-dd");
            qgend.Text           = model.qgend.GetValueOrDefault().ToString("yyyy-MM-dd");
            qgtype.SelectedValue = model.qgtype.ToString();
            quanguanjin.Text     = model.quanguanjin.ToString();
        }
Esempio n. 12
0
        private void ShowInfo()
        {
            BLL.orderconfig bll = new BLL.orderconfig();
            Model.orderconfig model = bll.loadConfig();

            if (model.anonymous == 1)
            {
                anonymous.Checked = true;
            }
            else
            {
                anonymous.Checked = false;
            }
            taxtype.SelectedValue = model.taxtype.ToString();
            taxamount.Text = model.taxamount.ToString();
            confirmmsg.SelectedValue = model.confirmmsg.ToString();
            confirmcallindex.Text = model.confirmcallindex;
            expressmsg.SelectedValue = model.expressmsg.ToString();
            expresscallindex.Text = model.expresscallindex;
            completemsg.SelectedValue = model.completemsg.ToString();
            completecallindex.Text = model.completecallindex;
        }
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("order_config", MXEnums.ActionEnum.Edit.ToString()); //检查权限
            BLL.orderconfig bll = new BLL.orderconfig();
            Model.orderconfig model = bll.loadConfig();
            try
            {
                if (anonymous.Checked == true)
                {
                    model.anonymous = 1;
                }
                else
                {
                    model.anonymous = 0;
                }
                model.confirmmsg = Utils.StrToInt(confirmmsg.SelectedValue, 0);
                model.confirmcallindex = confirmcallindex.Text;
                model.expressmsg = Utils.StrToInt(expressmsg.SelectedValue, 0);
                model.expresscallindex = expresscallindex.Text;
                model.completemsg = Utils.StrToInt(completemsg.SelectedValue, 0);
                model.completecallindex = completecallindex.Text;

                model.kuaidiapi = kuaidiapi.Text;
                model.kuaidikey = kuaidikey.Text;
                model.kuaidishow = Utils.StrToInt(kuaidishow.SelectedValue, 3);
                model.kuaidimuti = Utils.StrToInt(kuaidimuti.SelectedValue, 1);
                model.kuaidiorder = kuaidiorder.SelectedValue;

                bll.saveConifg(model);
                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改订单配置信息"); //记录日志
                JscriptMsg("修改订单配置成功!", "order_config.aspx", "Success");
            }
            catch
            {
                JscriptMsg("文件写入失败,请检查是否有权限!", "", "Error");
            }
        }
Esempio n. 14
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("order_config", DTEnums.ActionEnum.Edit.ToString()); //检查权限
            BLL.orderconfig   bll   = new BLL.orderconfig();
            Model.orderconfig model = bll.loadConfig();
            try
            {
                if (anonymous.Checked == true)
                {
                    model.anonymous = 1;
                }
                else
                {
                    model.anonymous = 0;
                }
                model.confirmmsg        = Utils.StrToInt(confirmmsg.SelectedValue, 0);
                model.confirmcallindex  = confirmcallindex.Text;
                model.expressmsg        = Utils.StrToInt(expressmsg.SelectedValue, 0);
                model.expresscallindex  = expresscallindex.Text;
                model.completemsg       = Utils.StrToInt(completemsg.SelectedValue, 0);
                model.completecallindex = completecallindex.Text;

                model.kuaidiapi   = kuaidiapi.Text;
                model.kuaidikey   = kuaidikey.Text;
                model.kuaidishow  = Utils.StrToInt(kuaidishow.SelectedValue, 3);
                model.kuaidimuti  = Utils.StrToInt(kuaidimuti.SelectedValue, 1);
                model.kuaidiorder = kuaidiorder.SelectedValue;

                bll.saveConifg(model);
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改订单配置信息"); //记录日志
                JscriptMsg("修改订单配置成功!", "order_config.aspx", "Success");
            }
            catch
            {
                JscriptMsg("文件写入失败,请检查是否有权限!", "", "Error");
            }
        }
Esempio n. 15
0
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!")));
         return;
     }
     model = bll.GetModel(id);
     if (model.user_id != userModel.id)
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的订单信息!")));
         return;
     }
     payModel = new BLL.site_payment().GetPaymentModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
     //根据订单状态和物流单号跟踪物流信息
     if (model.status > 1 && model.status < 4 && model.express_status == 2 && model.express_no.Trim().Length > 0)
     {
         Model.express     modelt      = new BLL.express().GetModel(model.express_id);
         Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
         if (modelt != null && modelt.express_code.Trim().Length > 0 && orderConfig.kuaidiapi != "")
         {
             string apiurl = orderConfig.kuaidiapi + "?id=" + orderConfig.kuaidikey + "&com=" + modelt.express_code + "&nu=" + model.express_no + "&show=" + orderConfig.kuaidishow + "&muti=" + orderConfig.kuaidimuti + "&order=" + orderConfig.kuaidiorder;
             string detail = Utils.HttpGet(@apiurl);
             if (detail != null)
             {
                 expressdetail = Utils.ToHtml(detail);
             }
         }
     }
 }
Esempio n. 16
0
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!")));
         return;
     }
     model = bll.GetModel(id);
     if (model.user_id != userModel.id)
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的订单信息!")));
         return;
     }
     payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
     //根据订单状态和物流单号跟踪物流信息
     if (model.status > 1 && model.status < 4 && model.express_status == 2 && model.express_no.Trim().Length > 0)
     {
         Model.express modelt = new BLL.express().GetModel(model.express_id);
         Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
         if (modelt != null && modelt.express_code.Trim().Length > 0 && orderConfig.kuaidiapi != "")
         {
             string apiurl = orderConfig.kuaidiapi + "?id=" + orderConfig.kuaidikey + "&com=" + modelt.express_code + "&nu=" + model.express_no + "&show=" + orderConfig.kuaidishow + "&muti=" + orderConfig.kuaidimuti + "&order=" + orderConfig.kuaidiorder;
             string detail = Utils.HttpGet(@apiurl);
             if (detail != null)
             {
                 expressdetail = Utils.ToHtml(detail);
             }
         }
     }
 }
Esempio n. 17
0
        public static Model.cart_total GetTotal(int group_id)
        {
            string  by = "", sid1 = "0", gid = "0";
            int     g = 0, zz = 0;
            int     a = 0, b = 0;
            decimal zc = 0, k = 0, c = 0;

            Model.cart_total         model  = new Model.cart_total();
            IList <Model.cart_items> i_List = GetList(group_id);

            if (i_List != null)
            {
                foreach (Model.cart_items modelt in i_List)
                {
                    model.total_num++;
                    model.total_quantity += modelt.quantity;
                    if (modelt.point == 0)
                    {
                        model.payable_amount += modelt.price * modelt.quantity;
                        model.real_amount    += modelt.user_price * modelt.quantity;
                    }
                    if (modelt.by == "point")
                    {
                        model.total_point += modelt.point * modelt.quantity;
                    }
                    //model.total_moneyback += modelt.money_back * modelt.quantity;
                    if (modelt.chang > c)
                    {
                        c = modelt.chang;
                        model.total_chang = modelt.chang;
                    }
                    if (modelt.kuan > k)
                    {
                        k = modelt.kuan;
                        model.total_kuan = modelt.kuan;
                    }
                    model.total_gao   += modelt.gao * modelt.quantity;
                    model.total_zhong += modelt.zhong * modelt.quantity;



                    if (modelt.point == 0 && modelt.sales_id > 0)
                    {
                        sid1 = sid1 + "," + modelt.sales_id;
                    }
                    gid = gid + "," + modelt.goodsid;

                    if (modelt.psmoney == "2")
                    {
                        IList _list = new ArrayList();
                        if (!_list.Contains(modelt.id))
                        {
                            _list.Add(modelt.id);
                        }
                        if (_list.Count > 0)
                        {
                            model.brand_id = 2;
                        }
                    }

                    if (modelt.sales_name == "no")
                    {
                        a = 1;
                    }
                    if (string.IsNullOrEmpty(modelt.sales_name))
                    {
                        b = 1;
                    }
                }
                if (a == 1)
                {
                    model.brandid = 3;
                }
            }
            zc = model.total_kuan * model.total_gao * model.total_chang;
            decimal zcall = zc / 6000;

            if (zcall > model.total_zhong)
            {
                model.total_num_zhe = zcall;
            }
            else
            {
                model.total_num_zhe = model.total_zhong;
            }
            int    moenynum1 = 0, moenynum2 = 0, moenynum3 = 0;
            string sales_str = "";

            //滿件
            if (sid1.Length > 2)
            {
                DataSet ds = Tea.DBUtility.DbHelperSQL.Query("select id from shop_sales where id in(" + sid1 + ") and status=1 and datediff(day,start_time,getdate())>=0 and datediff(day,end_time,getdate())<=0  group by id");
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    int     num  = zhe_num_jian(group_id, dr["id"].ToString());
                    decimal pnum = zhe_num_jian_zhe(group_id, dr["id"].ToString());
                    DataSet d_s  = Tea.DBUtility.DbHelperSQL.Query("select top 1 * from view_goods_sales where main_id=" + dr["id"].ToString() + " and parent_id<=" + num + " order by parent_id desc");
                    if (d_s.Tables[0].Rows.Count > 0)
                    {
                        //
                        if (d_s.Tables[0].Rows[0]["scompany"].ToString() == "2")
                        {
                            sales_str = sales_str + d_s.Tables[0].Rows[0]["stitle"].ToString() + "&nbsp;滿" + decimal.Parse(d_s.Tables[0].Rows[0]["parent_id"].ToString()).ToString("0.") + "件減" + d_s.Tables[0].Rows[0]["goods_id"].ToString() + "元";// +"|";
                            decimal listm = decimal.Parse(d_s.Tables[0].Rows[0]["goods_id"].ToString());
                            moenynum1 = moenynum1 + int.Parse(listm.ToString("0."));
                        }
                        else
                        {
                            sales_str = sales_str + d_s.Tables[0].Rows[0]["stitle"].ToString() + "&nbsp;滿" + decimal.Parse(d_s.Tables[0].Rows[0]["parent_id"].ToString()).ToString("0.") + "件折扣" + d_s.Tables[0].Rows[0]["goods_id"].ToString() + "%";// +"|";
                            decimal listm = decimal.Parse(d_s.Tables[0].Rows[0]["goods_id"].ToString());
                            moenynum1 = moenynum1 + Utils.StrToInt((pnum * (100 - Utils.StrToInt(listm.ToString("0."), 0)) / 100).ToString(), 0);
                        }
                    }
                }
            }
            Model.orderconfig oconfig = new BLL.orderconfig().loadConfig();
            if (oconfig.qgbegin < System.DateTime.Now && oconfig.qgend.Value.AddDays(1) > System.DateTime.Now)
            {
                if (oconfig.qgtype == 1 && oconfig.quanguan < 100)
                {
                    moenynum2 = Utils.StrToInt(model.real_amount.ToString("0."), 0) - Utils.StrToInt((model.real_amount * oconfig.quanguan / 100).ToString(), 0);
                }
                if (oconfig.qgtype == 2 && oconfig.quanguanjin > 0)
                {
                    moenynum2 = oconfig.quanguanjin;
                }
            }
            if (model.real_amount > oconfig.maned && oconfig.mebegin < System.DateTime.Now && oconfig.meend.Value.AddDays(1) > System.DateTime.Now)
            {
                if (oconfig.metype == 1 && oconfig.zhekou < 100)
                {
                    moenynum3 = Utils.StrToInt(model.real_amount.ToString("0."), 0) - Utils.StrToInt((model.real_amount * oconfig.zhekou / 100).ToString(), 0);
                }
                if (oconfig.metype == 2 && oconfig.zkjin > 0)
                {
                    moenynum3 = oconfig.zkjin;
                }
            }
            if (moenynum1 > moenynum2 && moenynum1 > moenynum3)
            {
                model.total_moneyback = moenynum1;
                model.sales_str       = sales_str;
            }
            if (moenynum2 > moenynum1 && moenynum2 > moenynum3)
            {
                model.total_moneyback = moenynum2;
                if (oconfig.qgtype == 1)
                {
                    sales_str = "全館折扣" + oconfig.quanguan + "%";
                }
                if (oconfig.qgtype == 2)
                {
                    sales_str = "全館折扣" + oconfig.quanguanjin + "元";
                }
                model.sales_str = sales_str;
            }
            if (moenynum3 > moenynum1 && moenynum3 > moenynum2)
            {
                model.total_moneyback = moenynum3;
                if (oconfig.metype == 1)
                {
                    model.sales_str = "滿額折扣滿" + oconfig.maned + "元折扣" + oconfig.zhekou + "%";
                }
                if (oconfig.metype == 2)
                {
                    model.sales_str = "滿額折扣滿" + oconfig.maned + "元折扣" + oconfig.zkjin + "元";
                }
            }
            model.by = sid1;



            model.total_num_str = gid;
            return(model);
        }
Esempio n. 18
0
        private void order_save(HttpContext context)
        {
            //获得传参信息
            int payment_id = DTRequest.GetFormInt("payment_id");
            int express_id = DTRequest.GetFormInt("express_id");
            string accept_name = Utils.ToHtml(DTRequest.GetFormString("accept_name"));
            string post_code = Utils.ToHtml(DTRequest.GetFormString("post_code"));
            string telphone = Utils.ToHtml(DTRequest.GetFormString("telphone"));
            string mobile = Utils.ToHtml(DTRequest.GetFormString("mobile"));
            string address = Utils.ToHtml(DTRequest.GetFormString("address"));
            string message = Utils.ToHtml(DTRequest.GetFormString("message"));
            //获取订单配置信息
            Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();

            //检查物流方式
            if (express_id == 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请选择配送方式!\"}");
                return;
            }
            Model.express expModel = new BLL.express().GetModel(express_id);
            if (expModel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,配送方式不存在或已删除!\"}");
                return;
            }
            //检查支付方式
            if (payment_id == 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请选择支付方式!\"}");
                return;
            }
            Model.payment payModel = new BLL.payment().GetModel(payment_id);
            if (payModel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,支付方式不存在或已删除!\"}");
                return;
            }
            //检查收货人
            if (string.IsNullOrEmpty(accept_name))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入收货人姓名!\"}");
                return;
            }
            //检查手机和电话
            if (string.IsNullOrEmpty(telphone) && string.IsNullOrEmpty(mobile))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入收货人联系电话或手机!\"}");
                return;
            }
            //检查地址
            if (string.IsNullOrEmpty(address))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入详细的收货地址!\"}");
                return;
            }
            //如果开启匿名购物则不检查会员是否登录
            int user_id = 0;
            int user_group_id = 0;
            string user_name = string.Empty;
            //检查用户是否登录
            Model.users userModel = new BasePage().GetUserInfo();
            if (userModel != null)
            {
                user_id = userModel.id;
                user_group_id = userModel.group_id;
                user_name = userModel.user_name;
            }
            if (orderConfig.anonymous == 0 && userModel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,用户尚未登录或已超时!\"}");
                return;
            }
            //检查购物车商品
            IList<Model.cart_items> iList = DTcms.Web.UI.ShopCart.GetList(user_group_id);
            if (iList == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,购物车为空,无法结算!\"}");
                return;
            }
            //统计购物车
            Model.cart_total cartModel = DTcms.Web.UI.ShopCart.GetTotal(user_group_id);
            //保存订单=======================================================================
            Model.orders model = new Model.orders();
            model.order_no = "B" + Utils.GetOrderNumber(); //订单号B开头为商品订单
            model.user_id = user_id;
            model.user_name = user_name;
            model.payment_id = payment_id;
            model.express_id = express_id;
            model.accept_name = accept_name;
            model.post_code = post_code;
            model.telphone = telphone;
            model.mobile = mobile;
            model.address = address;
            model.message = message;
            model.payable_amount = cartModel.payable_amount;
            model.real_amount = cartModel.real_amount;
            model.express_status = 1;
            model.express_fee = expModel.express_fee; //物流费用
            //如果是先款后货的话
            if (payModel.type == 1)
            {
                model.payment_status = 1; //标记未付款
                if (payModel.poundage_type == 1) //百分比
                {
                    model.payment_fee = model.real_amount * payModel.poundage_amount / 100;
                }
                else //固定金额
                {
                    model.payment_fee = payModel.poundage_amount;
                }
            }
            //订单总金额=实付商品金额+运费+支付手续费
            model.order_amount = model.real_amount + model.express_fee + model.payment_fee;
            //购物积分,可为负数
            model.point = cartModel.total_point;
            model.add_time = DateTime.Now;
            //商品详细列表
            List<Model.order_goods> gls = new List<Model.order_goods>();
            foreach (Model.cart_items item in iList)
            {
                gls.Add(new Model.order_goods { goods_id = item.id, goods_title = item.title, goods_price = item.price, real_price = item.user_price, quantity = item.quantity, point = item.point });
            }
            model.order_goods = gls;
            int result = new BLL.orders().Add(model);
            if (result < 1)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"订单保存过程中发生错误,请重新提交!\"}");
                return;
            }
            //扣除积分
            if (model.point < 0)
            {
                new BLL.user_point_log().Add(model.user_id, model.user_name, model.point, "积分换购,订单号:" + model.order_no, false);
            }
            //清空购物车
            DTcms.Web.UI.ShopCart.Clear("0");
            //提交成功,返回URL
            context.Response.Write("{\"status\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("payment", "confirm", model.order_no) + "\", \"msg\":\"恭喜您,订单已成功提交!\"}");
            return;
        }
Esempio n. 19
0
        private void edit_order_status(HttpContext context)
        {
            //取得管理员登录信息
            Model.manager adminInfo = new Web.UI.ManagePage().GetAdminInfo();
            if (adminInfo == null)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"未登录或已超时,请重新登录!\"}");
                return;
            }
            //取得站点配置信息
            Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig();
            //取得订单配置信息
            Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();

            string order_no = MXRequest.GetString("order_no");
            string edit_type = MXRequest.GetString("edit_type");
            if (order_no == "")
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"传输参数有误,无法获取订单号!\"}");
                return;
            }
            if (edit_type == "")
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"无法获取修改订单类型!\"}");
                return;
            }

            BLL.orders bll = new BLL.orders();
            Model.orders model = bll.GetModel(order_no);
            if (model == null)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"订单号不存在或已被删除!\"}");
                return;
            }
            switch (edit_type.ToLower())
            {
                case "order_confirm": //确认订单
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Confirm.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有确认订单的权限!\"}");
                        return;
                    }
                    if (model.status > 1)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已经确认,不能重复处理!\"}");
                        return;
                    }
                    model.status = 2;
                    model.confirm_time = DateTime.Now;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单确认失败!\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Confirm.ToString(), "确认订单号:" + model.order_no); //记录日志
                    #region 发送短信或邮件
                    if (orderConfig.confirmmsg > 0)
                    {
                        switch (orderConfig.confirmmsg)
                        {
                            case 1: //短信通知
                                if (string.IsNullOrEmpty(model.mobile))
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >对方未填写手机号码!\"}");
                                    return;
                                }
                                Model.sms_template smsModel = new BLL.sms_template().GetModel(orderConfig.confirmcallindex); //取得短信内容
                                if (smsModel == null)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >短信通知模板不存在!\"}");
                                    return;
                                }
                                //替换标签
                                string msgContent = smsModel.content;
                                msgContent = msgContent.Replace("{webname}", siteConfig.webname);
                                msgContent = msgContent.Replace("{username}", model.user_name);
                                msgContent = msgContent.Replace("{orderno}", model.order_no);
                                msgContent = msgContent.Replace("{amount}", model.order_amount.ToString());
                                //发送短信
                                string tipMsg = string.Empty;
                                bool sendStatus = new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg);
                                if (!sendStatus)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >" + tipMsg + "\"}");
                                    return;
                                }
                                break;
                            case 2: //邮件通知
                                //取得用户的邮箱地址
                                if (model.user_id > 0)
                                {
                                    Model.users userModel = new BLL.users().GetModel(model.user_id);
                                    if (userModel == null || string.IsNullOrEmpty(userModel.email))
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >该用户不存在或没有填写邮箱地址。\"}");
                                        return;
                                    }
                                    //取得邮件模板内容
                                    Model.mail_template mailModel = new BLL.mail_template().GetModel(orderConfig.confirmcallindex);
                                    if (mailModel == null)
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >邮件通知模板不存在。\"}");
                                        return;
                                    }
                                    //替换标签
                                    string mailTitle = mailModel.maill_title;
                                    mailTitle = mailTitle.Replace("{username}", model.user_name);
                                    string mailContent = mailModel.content;
                                    mailContent = mailContent.Replace("{webname}", siteConfig.webname);
                                    mailContent = mailContent.Replace("{weburl}", siteConfig.weburl);
                                    mailContent = mailContent.Replace("{webtel}", siteConfig.webtel);
                                    mailContent = mailContent.Replace("{username}", model.user_name);
                                    mailContent = mailContent.Replace("{orderno}", model.order_no);
                                    mailContent = mailContent.Replace("{amount}", model.order_amount.ToString());
                                    //发送邮件
                                    MXMail.sendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname,
                                        siteConfig.emailfrom, userModel.email, mailTitle, mailContent);
                                }
                                break;
                        }
                    }
                    #endregion
                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功!\"}");
                    break;
                case "order_payment": //确认付款
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Confirm.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有确认付款的权限!\"}");
                        return;
                    }
                    if (model.status > 1 || model.payment_status == 2)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已确认,不能重复处理!\"}");
                        return;
                    }
                    model.payment_status = 2;
                    model.payment_time = DateTime.Now;
                    model.status = 2;
                    model.confirm_time = DateTime.Now;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单确认付款失败!\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Confirm.ToString(), "确认付款订单号:" + model.order_no); //记录日志
                    #region 发送短信或邮件
                    if (orderConfig.confirmmsg > 0)
                    {
                        switch (orderConfig.confirmmsg)
                        {
                            case 1: //短信通知
                                if (string.IsNullOrEmpty(model.mobile))
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >对方未填写手机号码!\"}");
                                    return;
                                }
                                Model.sms_template smsModel = new BLL.sms_template().GetModel(orderConfig.confirmcallindex); //取得短信内容
                                if (smsModel == null)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >短信通知模板不存在!\"}");
                                    return;
                                }
                                //替换标签
                                string msgContent = smsModel.content;
                                msgContent = msgContent.Replace("{webname}", siteConfig.webname);
                                msgContent = msgContent.Replace("{username}", model.user_name);
                                msgContent = msgContent.Replace("{orderno}", model.order_no);
                                msgContent = msgContent.Replace("{amount}", model.order_amount.ToString());
                                //发送短信
                                string tipMsg = string.Empty;
                                bool sendStatus = new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg);
                                if (!sendStatus)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >" + tipMsg + "\"}");
                                    return;
                                }
                                break;
                            case 2: //邮件通知
                                //取得用户的邮箱地址
                                if (model.user_id > 0)
                                {
                                    Model.users userModel = new BLL.users().GetModel(model.user_id);
                                    if (userModel == null || string.IsNullOrEmpty(userModel.email))
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >该用户不存在或没有填写邮箱地址。\"}");
                                        return;
                                    }
                                    //取得邮件模板内容
                                    Model.mail_template mailModel = new BLL.mail_template().GetModel(orderConfig.confirmcallindex);
                                    if (mailModel == null)
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >邮件通知模板不存在。\"}");
                                        return;
                                    }
                                    //替换标签
                                    string mailTitle = mailModel.maill_title;
                                    mailTitle = mailTitle.Replace("{username}", model.user_name);
                                    string mailContent = mailModel.content;
                                    mailContent = mailContent.Replace("{webname}", siteConfig.webname);
                                    mailContent = mailContent.Replace("{weburl}", siteConfig.weburl);
                                    mailContent = mailContent.Replace("{webtel}", siteConfig.webtel);
                                    mailContent = mailContent.Replace("{username}", model.user_name);
                                    mailContent = mailContent.Replace("{orderno}", model.order_no);
                                    mailContent = mailContent.Replace("{amount}", model.order_amount.ToString());
                                    //发送邮件
                                    MXMail.sendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname,
                                        siteConfig.emailfrom, userModel.email, mailTitle, mailContent);
                                }
                                break;
                        }
                    }
                    #endregion
                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认付款成功!\"}");
                    break;
                case "order_express": //确认发货
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Confirm.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有确认发货的权限!\"}");
                        return;
                    }
                    if (model.status > 2 || model.express_status == 2)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已完成或已发货,不能重复处理!\"}");
                        return;
                    }
                    int express_id = MXRequest.GetFormInt("express_id");
                    string express_no = MXRequest.GetFormString("express_no");
                    if (express_id == 0)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"请选择配送方式!\"}");
                        return;
                    }
                    model.express_id = express_id;
                    model.express_no = express_no;
                  
                    model.express_time = DateTime.Now;
                    string ret = "";
                    if (model.payment_id == 3 && model.express_status != 2)
                    { 
                        //通知微信支付,改变发货状态
                        FaHuoProc fahuo = new FaHuoProc();

                        BLL.wx_payment_wxpay payBll = new BLL.wx_payment_wxpay();
                        Model.wx_payment_wxpay paymentInfo = payBll.GetModelByWid(model.wid.Value);
                        Dictionary<string, object> fahuoDict = fahuo.fahuomgr(paymentInfo, model);
                        string errcode = fahuoDict["errcode"].ToString();
                        string errmsg = fahuoDict["errmsg"].ToString();
                        model.fahuoCode = errcode;
                        model.fahuoMsg = errmsg;
                        if (errcode == "0")
                        {
                            model.express_status = 2;
                        }
                        else
                        {
                            ret = "通知微信支付,改变发货状态失败:"+errmsg;
                        }
                    }
                    model.express_status = 2;
                    if (!bll.Update(model))
                    {
                        ret += "订单发货失败!";
                        context.Response.Write("{\"status\": 0, \"msg\": \"" + ret + "\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Confirm.ToString(), "确认发货订单号:" + model.order_no); //记录日志
                    #region 发送短信或邮件
                    if (orderConfig.expressmsg > 0)
                    {
                        switch (orderConfig.expressmsg)
                        {
                            case 1: //短信通知
                                if (string.IsNullOrEmpty(model.mobile))
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >对方未填写手机号码!\"}");
                                    return;
                                }
                                Model.sms_template smsModel = new BLL.sms_template().GetModel(orderConfig.expresscallindex); //取得短信内容
                                if (smsModel == null)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >短信通知模板不存在!\"}");
                                    return;
                                }
                                //替换标签
                                string msgContent = smsModel.content;
                                msgContent = msgContent.Replace("{webname}", siteConfig.webname);
                                msgContent = msgContent.Replace("{username}", model.user_name);
                                msgContent = msgContent.Replace("{orderno}", model.order_no);
                                msgContent = msgContent.Replace("{amount}", model.order_amount.ToString());
                                //发送短信
                                string tipMsg = string.Empty;
                                bool sendStatus = new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg);
                                if (!sendStatus)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >" + tipMsg + "\"}");
                                    return;
                                }
                                break;
                            case 2: //邮件通知
                                //取得用户的邮箱地址
                                if (model.user_id > 0)
                                {
                                    Model.users userModel = new BLL.users().GetModel(model.user_id);
                                    if (userModel == null || string.IsNullOrEmpty(userModel.email))
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >该用户不存在或没有填写邮箱地址。\"}");
                                        return;
                                    }
                                    //取得邮件模板内容
                                    Model.mail_template mailModel = new BLL.mail_template().GetModel(orderConfig.expresscallindex);
                                    if (mailModel == null)
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >邮件通知模板不存在。\"}");
                                        return;
                                    }
                                    //替换标签
                                    string mailTitle = mailModel.maill_title;
                                    mailTitle = mailTitle.Replace("{username}", model.user_name);
                                    string mailContent = mailModel.content;
                                    mailContent = mailContent.Replace("{webname}", siteConfig.webname);
                                    mailContent = mailContent.Replace("{weburl}", siteConfig.weburl);
                                    mailContent = mailContent.Replace("{webtel}", siteConfig.webtel);
                                    mailContent = mailContent.Replace("{username}", model.user_name);
                                    mailContent = mailContent.Replace("{orderno}", model.order_no);
                                    mailContent = mailContent.Replace("{amount}", model.order_amount.ToString());
                                    //发送邮件
                                    MXMail.sendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname,
                                        siteConfig.emailfrom, userModel.email, mailTitle, mailContent);
                                }
                                break;
                        }
                    }
                    #endregion
                    context.Response.Write("{\"status\": 1, \"msg\": \"订单发货成功!\"}");
                    break;
                case "order_complete": //完成订单=========================================
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Confirm.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有确认完成订单的权限!\"}");
                        return;
                    }
                    if (model.status > 2)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已经完成,不能重复处理!\"}");
                        return;
                    }
                    model.status = 3;
                    model.complete_time = DateTime.Now;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"确认订单完成失败!\"}");
                        return;
                    }
                    //给会员增加积分检查升级
                    if (model.user_id > 0 && model.point > 0)
                    {
                        new BLL.user_point_log().Add(model.user_id, model.user_name, model.point, "购物获得积分,订单号:" + model.order_no, true);
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Confirm.ToString(), "确认交易完成订单号:" + model.order_no); //记录日志
                    #region 发送短信或邮件
                    if (orderConfig.completemsg > 0)
                    {
                        switch (orderConfig.completemsg)
                        {
                            case 1: //短信通知
                                if (string.IsNullOrEmpty(model.mobile))
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >对方未填写手机号码!\"}");
                                    return;
                                }
                                Model.sms_template smsModel = new BLL.sms_template().GetModel(orderConfig.completecallindex); //取得短信内容
                                if (smsModel == null)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >短信通知模板不存在!\"}");
                                    return;
                                }
                                //替换标签
                                string msgContent = smsModel.content;
                                msgContent = msgContent.Replace("{webname}", siteConfig.webname);
                                msgContent = msgContent.Replace("{username}", model.user_name);
                                msgContent = msgContent.Replace("{orderno}", model.order_no);
                                msgContent = msgContent.Replace("{amount}", model.order_amount.ToString());
                                //发送短信
                                string tipMsg = string.Empty;
                                bool sendStatus = new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg);
                                if (!sendStatus)
                                {
                                    context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >" + tipMsg + "\"}");
                                    return;
                                }
                                break;
                            case 2: //邮件通知
                                //取得用户的邮箱地址
                                if (model.user_id > 0)
                                {
                                    Model.users userModel = new BLL.users().GetModel(model.user_id);
                                    if (userModel == null || string.IsNullOrEmpty(userModel.email))
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >该用户不存在或没有填写邮箱地址。\"}");
                                        return;
                                    }
                                    //取得邮件模板内容
                                    Model.mail_template mailModel = new BLL.mail_template().GetModel(orderConfig.completecallindex);
                                    if (mailModel == null)
                                    {
                                        context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >邮件通知模板不存在。\"}");
                                        return;
                                    }
                                    //替换标签
                                    string mailTitle = mailModel.maill_title;
                                    mailTitle = mailTitle.Replace("{username}", model.user_name);
                                    string mailContent = mailModel.content;
                                    mailContent = mailContent.Replace("{webname}", siteConfig.webname);
                                    mailContent = mailContent.Replace("{weburl}", siteConfig.weburl);
                                    mailContent = mailContent.Replace("{webtel}", siteConfig.webtel);
                                    mailContent = mailContent.Replace("{username}", model.user_name);
                                    mailContent = mailContent.Replace("{orderno}", model.order_no);
                                    mailContent = mailContent.Replace("{amount}", model.order_amount.ToString());
                                    //发送邮件
                                    MXMail.sendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname,
                                        siteConfig.emailfrom, userModel.email, mailTitle, mailContent);
                                }
                                break;
                        }
                    }
                    #endregion
                    context.Response.Write("{\"status\": 1, \"msg\": \"确认订单完成成功!\"}");
                    break;
                case "order_cancel": //取消订单==========================================
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Cancel.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有取消订单的权限!\"}");
                        return;
                    }
                    if (model.status > 2)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已经完成,不能取消订单!\"}");
                        return;
                    }
                    model.status = 4;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"取消订单失败!\"}");
                        return;
                    }
                    int check_revert1 = MXRequest.GetFormInt("check_revert");
                    if (check_revert1 == 1)
                    {
                        //如果存在积分换购则返还会员积分
                        if (model.user_id > 0 && model.point < 0)
                        {
                            new BLL.user_point_log().Add(model.user_id, model.user_name, (model.point * -1), "取消订单返还积分,订单号:" + model.order_no, false);
                        }
                        //如果已支付则退还金额到会员账户
                        if (model.user_id > 0 && model.payment_status == 2 && model.order_amount > 0)
                        {
                            new BLL.user_amount_log().Add(model.user_id, model.user_name, MXEnums.AmountTypeEnum.BuyGoods.ToString(), model.order_amount, "取消订单退还金额,订单号:" + model.order_no);
                        }
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Cancel.ToString(), "取消订单号:" + model.order_no); //记录日志
                    context.Response.Write("{\"status\": 1, \"msg\": \"取消订单成功!\"}");
                    break;
                case "order_invalid": //作废订单==========================================
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Invalid.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有作废订单的权限!\"}");
                        return;
                    }
                    if (model.status != 3)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单尚未完成,不能作废订单!\"}");
                        return;
                    }
                    model.status = 5;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"作废订单失败!\"}");
                        return;
                    }
                    int check_revert2 = MXRequest.GetFormInt("check_revert");
                    if (check_revert2 == 1)
                    {
                        //扣除购物赠送的积分
                        if (model.user_id > 0 && model.point > 0)
                        {
                            new BLL.user_point_log().Add(model.user_id, model.user_name, (model.point * -1), "作废订单扣除积分,订单号:" + model.order_no, false);
                        }
                        //退还金额到会员账户
                        if (model.user_id > 0 && model.order_amount > 0)
                        {
                            new BLL.user_amount_log().Add(model.user_id, model.user_name, MXEnums.AmountTypeEnum.BuyGoods.ToString(), model.order_amount, "取消订单退还金额,订单号:" + model.order_no);
                        }
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Invalid.ToString(), "作废订单号:" + model.order_no); //记录日志
                    context.Response.Write("{\"status\": 1, \"msg\": \"作废订单成功!\"}");
                    break;
                case "edit_accept_info": //修改收货信息====================================
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Edit.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有修改收货信息的权限!\"}");
                        return;
                    }
                    if (model.express_status == 2)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已经发货,不能修改收货信息!\"}");
                        return;
                    }
                    string accept_name = MXRequest.GetFormString("accept_name");
                    string province = MXRequest.GetFormString("province");
                    string city = MXRequest.GetFormString("city");
                    string area = MXRequest.GetFormString("area");
                    string address = MXRequest.GetFormString("address");
                    string post_code = MXRequest.GetFormString("post_code");
                    string mobile = MXRequest.GetFormString("mobile");
                    string telphone = MXRequest.GetFormString("telphone");

                    if (accept_name == "")
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"请填写收货人姓名!\"}");
                        return;
                    }
                    if (area == "")
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"请选择所在地区!\"}");
                        return;
                    }
                    if (address == "")
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"请填写详细的送货地址!\"}");
                        return;
                    }
                    if (mobile == "" && telphone == "")
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"联系手机或电话至少填写一项!\"}");
                        return;
                    }

                    model.accept_name = accept_name;
                    model.area = province + "," + city + "," + area;
                    model.address = address;
                    model.post_code = post_code;
                    model.mobile = mobile;
                    model.telphone = telphone;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"修改收货人信息失败!\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Edit.ToString(), "修改收货信息,订单号:" + model.order_no); //记录日志
                    context.Response.Write("{\"status\": 1, \"msg\": \"修改收货人信息成功!\"}");
                    break;
                case "edit_order_remark": //修改订单备注=================================
                    string remark = MXRequest.GetFormString("remark");
                    if (remark == "")
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"请填写订单备注内容!\"}");
                        return;
                    }
                    model.remark = remark;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"修改订单备注失败!\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Edit.ToString(), "修改订单备注,订单号:" + model.order_no); //记录日志
                    context.Response.Write("{\"status\": 1, \"msg\": \"修改订单备注成功!\"}");
                    break;
                case "edit_real_amount": //修改商品总金额================================
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Edit.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有修改商品金额的权限!\"}");
                        return;
                    }
                    if (model.status > 1)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已经确认,不能修改金额!\"}");
                        return;
                    }
                    decimal real_amount = MXRequest.GetFormDecimal("real_amount", 0);
                    model.real_amount = real_amount;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"修改商品总金额失败!\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Edit.ToString(), "修改商品金额,订单号:" + model.order_no); //记录日志
                    context.Response.Write("{\"status\": 1, \"msg\": \"修改商品总金额成功!\"}");
                    break;
                case "edit_express_fee": //修改配送费用==================================
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Edit.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有配送费用的权限!\"}");
                        return;
                    }
                    if (model.status > 1)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已经确认,不能修改金额!\"}");
                        return;
                    }
                    decimal express_fee = MXRequest.GetFormDecimal("express_fee", 0);
                    model.express_fee = express_fee;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"修改配送费用失败!\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Edit.ToString(), "修改配送费用,订单号:" + model.order_no); //记录日志
                    context.Response.Write("{\"status\": 1, \"msg\": \"修改配送费用成功!\"}");
                    break;
                case "edit_payment_fee": //修改支付手续费=================================
                    //检查权限
                    if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Edit.ToString()))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"您没有修改支付手续费的权限!\"}");
                        return;
                    }
                    if (model.status > 1)
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"订单已经确认,不能修改金额!\"}");
                        return;
                    }
                    decimal payment_fee = MXRequest.GetFormDecimal("payment_fee", 0);
                    model.payment_fee = payment_fee;
                    if (!bll.Update(model))
                    {
                        context.Response.Write("{\"status\": 0, \"msg\": \"修改支付手续费失败!\"}");
                        return;
                    }
                    new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Edit.ToString(), "修改支付手续费,订单号:" + model.order_no); //记录日志
                    context.Response.Write("{\"status\": 1, \"msg\": \"修改支付手续费成功!\"}");
                    break;
            }

        }
Esempio n. 20
0
        private void ShowInfo(int _id)
        {
            BLL.orders bll = new BLL.orders();
            model    = bll.GetModel(_id);
            modelart = new Tea.BLL.article().GetModel(model.artid);
            if (modelart == null)
            {
                modelart = new Model.article();
            }
            //綁定商品列表
            this.rptList.DataSource = model.order_goods;
            this.rptList.DataBind();
            foreach (Tea.Model.order_goods goods in model.order_goods)
            {
                Tea.Model.goods mgoods = new Tea.BLL.goods().GetModel(goods.goodsid);
                try
                {
                    zhong = zhong + (goods.quantity * mgoods.zhong);
                    if (mgoods.chang > c_chang)
                    {
                        c_chang = mgoods.chang;
                    }
                    if (mgoods.kuan > c_kuan)
                    {
                        c_kuan = mgoods.kuan;
                    }
                    c_gao += mgoods.gao * goods.quantity;
                }
                catch (Exception eee) { }
            }

            //Response.Write(zhong);
            //Response.Write("-"+c_chang + "-" + c_kuan + "-" + c_gao);
            zc = c_chang * c_kuan * c_gao / 6000;
            if (zc > zhong)
            {
                zhong = zc;
            }

            data_gift.DataSource = Tea.DBUtility.DbHelperSQL.Query("select * from view_order_gift where order_id=" + id + "");
            data_gift.DataBind();
            //根據訂單狀態,顯示各類操作按鈕
            switch (model.status)
            {
            case 1:     //如果是線下支付,支付狀態為0,如果是線上支付,支付成功後會自動改變訂單狀態為已確認
                if (model.payment_status != 2)
                {
                    //確認付款、取消訂單、修改收貨按鈕顯示
                    btnPayment.Visible = btnEditAcceptInfo.Visible = true;
                }
                else
                {
                    btnCancel.Visible = false;
                    //確認訂單、取消訂單、修改收貨按鈕顯示
                    btnConfirm.Visible = btnEditAcceptInfo.Visible = true;
                }
                //修改訂單備註、修改商品總金額、修改配送費用、修改支付手續費、修改發票稅金按鈕顯示
                break;

            case 2:     //如果訂單為已確認狀態,則進入發貨狀態
                if (model.express_status != 2)
                {
                    //確認發貨、取消訂單、修改收貨資訊按鈕顯示
                    btnExpress.Visible = btnEditAcceptInfo.Visible = true;
                }
                else
                {
                    btnCancel.Visible = false;
                    //完成訂單、取消訂單按鈕可見
                    btnComplete.Visible = true;
                }
                if (model.payment_status == 2)
                {
                    btnCancel.Visible = false;
                }
                //修改訂單備註按鈕可見
                //btnEditRemark.Visible = true;
                break;

            case 3:
                //退貨訂單、修改訂單備註按鈕可見
                btnInvalid.Visible = true;
                btnCancel.Visible  = false;
                break;

            case 5:
                //退貨訂單、修改訂單備註按鈕可見
                btnCancel.Visible = false;
                break;
            }
            //根據訂單狀態和物流單號跟蹤物流資訊
            if (model.express_status == 2)
            {
                ddlExpressId.SelectedValue = model.express_id.ToString();
                //長:<%=getbao(model.order_bao,0) %> 寬:<%=getbao(model.order_bao,1) %> 高:<%=getbao(model.order_bao,2) %> 重:<%=getbao(model.order_bao,3) %>
                chang.Text      = getbao(model.order_bao, 0);
                kuan.Text       = getbao(model.order_bao, 1);
                gao.Text        = getbao(model.order_bao, 2);
                txtzhong.Text   = getbao(model.order_bao, 3);
                express_no.Text = model.express_no;
                Model.express     modelt      = new BLL.express().GetModel(model.express_id);
                Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
            }

            trade_no.Text = model.trade_no;
            if (model.invoice_taxes == 1)
            {
                cbFaPiao.Checked = true;
            }
        }
Esempio n. 21
0
        private void ShowInfo(int _id)
        {
            BLL.orders bll = new BLL.orders();
            model = bll.GetModel(_id);
            //绑定商品列表
            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 (model.status)
            {
                case 1: //如果是线下支付,支付状态为0,如果是线上支付,支付成功后会自动改变订单状态为已确认
                    if (model.payment_status > 0)
                    {
                        //确认付款、取消订单、修改收货按钮显示
                        btnPayment.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true;
                    }
                    else
                    {
                        //确认订单、取消订单、修改收货按钮显示
                        btnConfirm.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true;
                    }
                    //修改订单备注、修改商品总金额、修改配送费用、修改支付手续费、修改发票税金按钮显示
                    btnEditRemark.Visible = btnEditRealAmount.Visible = btnEditExpressFee.Visible = btnEditPaymentFee.Visible = btnEditInvoiceTaxes.Visible = true;
                    break;
                case 2: //如果订单为已确认状态,则进入发货状态
                    if (model.express_status == 1)
                    {
                        //确认发货、取消订单、修改收货信息按钮显示
                        btnExpress.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true;
                    }
                    else if (model.express_status == 2)
                    {
                        //完成订单、取消订单按钮可见
                        btnComplete.Visible = btnCancel.Visible = true;
                    }
                    //修改订单备注按钮可见
                    btnEditRemark.Visible = true;
                    break;
                case 3:
                    //作废订单、修改订单备注按钮可见
                    btnInvalid.Visible = btnEditRemark.Visible = true;
                    break;
            }
            //根据订单状态和物流单号跟踪物流信息
            if (model.express_status == 2 && model.express_no.Trim().Length > 0)
            {
                Model.express modelt = new BLL.express().GetModel(model.express_id);
                Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
                if (modelt != null && modelt.express_code.Trim().Length > 0 && orderConfig.kuaidiapi != "")
                {
                    string apiurl = orderConfig.kuaidiapi + "?id=" + orderConfig.kuaidikey + "&com=" + modelt.express_code + "&nu=" + model.express_no + "&show=" + orderConfig.kuaidishow + "&muti=" + orderConfig.kuaidimuti + "&order=" + orderConfig.kuaidiorder;
                    string detail = Utils.HttpGet(@apiurl);
                    if (detail != null)
                    {
                        litExpressDetail.Text = Utils.ToHtml(detail);
                    }
                }
            }

        }
Esempio n. 22
0
        private void order_save(HttpContext context)
        {
            //获取传参信息===================================
            string hideGoodsJson = Utils.GetCookie(DTKeys.COOKIE_SHOPPING_BUY); //获取商品JSON数据
            string sitepath = DTRequest.GetQueryString("site"); //站点目录
            int book_id = DTRequest.GetFormInt("book_id", 1);
            int payment_id = DTRequest.GetFormInt("payment_id");
            int express_id = DTRequest.GetFormInt("express_id");
            int is_invoice = DTRequest.GetFormInt("is_invoice", 0);
            string accept_name = Utils.ToHtml(DTRequest.GetFormString("accept_name"));
            string province = Utils.ToHtml(DTRequest.GetFormString("province"));
            string city = Utils.ToHtml(DTRequest.GetFormString("city"));
            string area = Utils.ToHtml(DTRequest.GetFormString("area"));
            string address = Utils.ToHtml(DTRequest.GetFormString("address"));
            string telphone = Utils.ToHtml(DTRequest.GetFormString("telphone"));
            string mobile = Utils.ToHtml(DTRequest.GetFormString("mobile"));
            string email = Utils.ToHtml(DTRequest.GetFormString("email"));
            string post_code = Utils.ToHtml(DTRequest.GetFormString("post_code"));
            string message = Utils.ToHtml(DTRequest.GetFormString("message"));
            string invoice_title = Utils.ToHtml(DTRequest.GetFormString("invoice_title"));
            Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig(); //获取订单配置

            //检查传参信息===================================
            if (string.IsNullOrEmpty(hideGoodsJson))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,无法获取商品信息!\"}");
                return;
            }
            //检查站点目录
            if (string.IsNullOrEmpty(sitepath))
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"错误提示:站点传输参数不正确!\"}");
                return;
            }
            if (express_id == 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请选择配送方式!\"}");
                return;
            }
            if (payment_id == 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请选择支付方式!\"}");
                return;
            }
            Model.express expModel = new BLL.express().GetModel(express_id);
            if (expModel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,配送方式不存在或已删除!\"}");
                return;
            }
            //检查支付方式
            Model.payment payModel = new BLL.payment().GetModel(payment_id);
            if (payModel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,支付方式不存在或已删除!\"}");
                return;
            }
            //检查收货人
            if (string.IsNullOrEmpty(accept_name))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入收货人姓名!\"}");
                return;
            }
            //检查手机和电话
            if (string.IsNullOrEmpty(telphone) && string.IsNullOrEmpty(mobile))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入收货人联系电话或手机!\"}");
                return;
            }
            //检查地区
            if (string.IsNullOrEmpty(province) && string.IsNullOrEmpty(city))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请选择您所在的省市区!\"}");
                return;
            }
            //检查地址
            if (string.IsNullOrEmpty(address))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入详细的收货地址!\"}");
                return;
            }
            //如果开启匿名购物则不检查会员是否登录
            int user_id = 0;
            int user_group_id = 0;
            string user_name = string.Empty;
            //检查用户是否登录
            Model.users userModel = new Web.UI.BasePage().GetUserInfo();
            if (userModel != null)
            {
                user_id = userModel.id;
                user_group_id = userModel.group_id;
                user_name = userModel.user_name;
                //检查是否需要添加会员地址
                if (book_id == 0)
                {
                    Model.user_addr_book addrModel = new Model.user_addr_book();
                    addrModel.user_id=userModel.id;
                    addrModel.user_name=userModel.user_name;
                    addrModel.accept_name = accept_name;
                    addrModel.area = province + "," + city + "," + area;
                    addrModel.address = address;
                    addrModel.mobile = mobile;
                    addrModel.telphone = telphone;
                    addrModel.email = email;
                    addrModel.post_code = post_code;
                    new BLL.user_addr_book().Add(addrModel);
                }
            }
            if (orderConfig.anonymous == 0 && userModel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,用户尚未登录或已超时!\"}");
                return;
            }
            //获取商品信息==================================
            List<Model.cart_keys> iList = (List<Model.cart_keys>)JsonHelper.JSONToObject<List<Model.cart_keys>>(hideGoodsJson);
            List<Model.cart_items> goodsList = ShopCart.ToList(iList, user_group_id); //商品列表
            Model.cart_total goodsTotal = ShopCart.GetTotal(goodsList); //商品统计
            if (goodsList == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,商品为空,无法结算!\"}");
                return;
            }
            //保存订单=======================================
            Model.orders model = new Model.orders();
            model.order_no = "B" + Utils.GetOrderNumber(); //订单号B开头为商品订单
            model.user_id = user_id;
            model.user_name = user_name;
            model.payment_id = payment_id;
            model.express_id = express_id;
            model.accept_name = accept_name;
            model.area = province + "," + city + "," + area; //省市区以逗号相隔
            model.address = address;
            model.telphone = telphone;
            model.mobile = mobile;
            model.message = message;
            model.email = email;
            model.post_code = post_code;
            model.is_invoice = is_invoice;
            model.payable_amount = goodsTotal.payable_amount;
            model.real_amount = goodsTotal.real_amount;
            model.express_status = 1;
            model.express_fee = expModel.express_fee; //物流费用
            //是否先款后货
            if (payModel.type == 1)
            {
                model.payment_status = 1; //标记未付款
                if (payModel.poundage_type == 1 && payModel.poundage_amount > 0) //百分比
                {
                    model.payment_fee = model.real_amount * payModel.poundage_amount / 100;
                }
                else //固定金额
                {
                    model.payment_fee = payModel.poundage_amount;
                }
            }
            //是否开具发票
            if (model.is_invoice == 1)
            {
                model.invoice_title = invoice_title;
                if (orderConfig.taxtype == 1 && orderConfig.taxamount > 0) //百分比
                {
                    model.invoice_taxes = model.real_amount * orderConfig.taxamount / 100;
                }
                else //固定金额
                {
                    model.invoice_taxes = orderConfig.taxamount;
                }
            }
            //订单总金额=实付商品金额+运费+支付手续费+税金
            model.order_amount = model.real_amount + model.express_fee + model.payment_fee + model.invoice_taxes;
            //购物积分,可为负数
            model.point = goodsTotal.total_point;
            model.add_time = DateTime.Now;
            //商品详细列表
            List<Model.order_goods> gls = new List<Model.order_goods>();
            foreach (Model.cart_items item in goodsList)
            {
                gls.Add(new Model.order_goods { article_id = item.article_id, goods_id = item.goods_id, goods_no = item.goods_no, goods_title = item.title, 
                    img_url = item.img_url, spec_text = item.spec_text, goods_price = item.sell_price, real_price = item.user_price, quantity = item.quantity, point = item.point });
            }
            model.order_goods = gls;
            int result = new BLL.orders().Add(model);
            if (result < 1)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"订单保存发生错误,请联系管理员!\"}");
                return;
            }
            //扣除积分
            if (model.point < 0)
            {
                new BLL.user_point_log().Add(model.user_id, model.user_name, model.point, "积分换购,订单号:" + model.order_no, false);
            }
            //删除购物车对应的商品
            Web.UI.ShopCart.Clear(iList);
            //清空结账清单
            Utils.WriteCookie(DTKeys.COOKIE_SHOPPING_BUY, "");
            //提交成功,返回URL
            context.Response.Write("{\"status\":1, \"url\":\""
                + new Web.UI.BasePage().getlink(sitepath, new Web.UI.BasePage().linkurl("payment", "?action=confirm&order_no=" + model.order_no)) + "\", \"msg\":\"恭喜您,订单已成功提交!\"}");
            return;
        }
Esempio n. 23
0
        private void ShowInfo(int _id)
        {
            BLL.orders bll = new BLL.orders();
            model = bll.GetModel(_id);
            //绑定商品列表
            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 (model.status)
            {
            case 1:     //如果是线下支付,支付状态为0,如果是线上支付,支付成功后会自动改变订单状态为已确认
                if (model.payment_status > 0)
                {
                    //确认付款、取消订单、修改收货按钮显示
                    btnPayment.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true;
                }
                else
                {
                    //确认订单、取消订单、修改收货按钮显示
                    btnConfirm.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true;
                }
                //修改订单备注、修改商品总金额、修改配送费用、修改支付手续费、修改发票税金按钮显示
                btnEditRemark.Visible = btnEditRealAmount.Visible = btnEditExpressFee.Visible = btnEditPaymentFee.Visible = btnEditInvoiceTaxes.Visible = true;
                break;

            case 2:     //如果订单为已确认状态,则进入发货状态
                if (model.express_status == 1)
                {
                    //确认发货、取消订单、修改收货信息按钮显示
                    btnExpress.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true;
                }
                else if (model.express_status == 2)
                {
                    //完成订单、取消订单按钮可见
                    btnComplete.Visible = btnCancel.Visible = true;
                }
                //修改订单备注按钮可见
                btnEditRemark.Visible = true;
                break;

            case 3:
                //作废订单、修改订单备注按钮可见
                btnInvalid.Visible = btnEditRemark.Visible = true;
                break;
            }
            //根据订单状态和物流单号跟踪物流信息
            if (model.express_status == 2 && model.express_no.Trim().Length > 0)
            {
                Model.express     modelt      = new BLL.express().GetModel(model.express_id);
                Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
                if (modelt != null && modelt.express_code.Trim().Length > 0 && orderConfig.kuaidiapi != "")
                {
                    string apiurl = orderConfig.kuaidiapi + "?id=" + orderConfig.kuaidikey + "&com=" + modelt.express_code + "&nu=" + model.express_no + "&show=" + orderConfig.kuaidishow + "&muti=" + orderConfig.kuaidimuti + "&order=" + orderConfig.kuaidiorder;
                    string detail = Utils.HttpGet(@apiurl);
                    if (detail != null)
                    {
                        litExpressDetail.Text = Utils.ToHtml(detail);
                    }
                }
            }
        }
Esempio n. 24
0
 /// <summary>
 /// 返回税金费用金额
 /// </summary>
 /// <param name="total_amount">总金额</param>
 /// <returns>decimal</returns>
 protected decimal get_order_taxamount(decimal total_amount)
 {
     Model.orderconfig model = new BLL.orderconfig().loadConfig();
     decimal taxamount = model.taxamount;
     if (model.taxtype == 1)
     {
         taxamount = (taxamount * total_amount) / 100;
     }
     return taxamount;
 }