/// <summary> /// 购物车商品 /// </summary> public void ShopCart() { DataTable dt = new Hi.BLL.DIS_ShopCart().GetGoodsCart(" sc.[CompID]=" + this.CompID + " and sc.[DisID]=" + this.DisID + "and sc.dr=0", "sc.[CreateDate] desc "); if (dt != null && dt.Rows.Count > 0) { decimal TotalAmount = 0; string html = string.Empty; string Digits = OrderInfoType.rdoOrderAudit("订单下单数量是否取整", this.CompID); //小数位数 string str6 = IsInve == 0 ? "" : "display:none"; for (int i = 0; i < dt.Rows.Count; i++) { int goodsinfoid = Convert.ToInt32(dt.Rows[i]["GoodsinfoID"].ToString()); Hi.Model.BD_GoodsInfo model3 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsinfoid); Hi.Model.BD_Goods model4 = new Hi.BLL.BD_Goods().GetModel(model3.GoodsID); string pic = dt.Rows[i]["pic"].ToString(); // new Hi.BLL.BD_Goods().GetModel(Convert.ToInt32(model2.GoodsID)).Pic; string inventory = string.Empty; BLL.Common.GetInevntory(this.CompID, goodsinfoid, 0, Convert.ToDecimal(dt.Rows[i]["GoodsNum"]), out inventory); // dt.Rows[i]["Inventory"].ToString(); string str7 = string.Empty; //是否促销 if (dt.Rows[i]["ProID"].ToString() != "0") { str7 = SelectGoodsInfo.protitle(dt.Rows[i]["ProID"].ToString(), dt.Rows[i]["Unit"].ToString()); } string strremark = string.Empty; decimal zxprice = BLL.Common.GetGoodsPrice(this.CompID, this.DisID, goodsinfoid);//最新价格 decimal num = decimal.Parse(string.Format("{0:N4}", Convert.ToDecimal(dt.Rows[i]["GoodsNum"]).ToString("#,####" + Digits))); TotalAmount += zxprice * num; html += "<tr tip=\"" + goodsinfoid + "\" trindex=\"" + i + "\" trindex2=\"" + i + "\" id=\"\"><td class=\"t8\"><div class=\"addg\"><a href=\"javascript:;\" class=\"minus2\"></a><a href=\"javascript:;\" class=\"add2\"></a></div></td><td><div class=\"sPic\"><a class=\"opt-i2\"></a><span><a href=\"javascript:;\"><img src=\"" + Common.GetPicURL(pic, "resize200") + "\" width=\"60\" height=\"60\"></a></span><a href=\"javascript:;\" class=\"code\">商品编码:" + dt.Rows[i]["barCode"].ToString() + str7 + "</a><a href=\"javascript:;\" class=\"name\">" + GetGoodsName(model4.GoodsName, model3.ValueInfo, "1") + "<i>" + GetGoodsName(model4.GoodsName, model3.ValueInfo, "2") + "</i></a></div></td><td><div class=\"tc\">" + model4.Unit + "</div></td><td><div class=\"tc divprice" + i + "\" tip=\"" + decimal.Parse(string.Format("{0:N2}", zxprice)).ToString("0.00") + "\">¥" + decimal.Parse(string.Format("{0:N2}", zxprice)).ToString("0.00") + "</div><input type=\"hidden\" class=\"hidPrice\" value=\"" + zxprice + "\" /></td><td style=\"" + str6 + "\"><div class=\"tc\"><input type=\"hidden\" id=\"hidInventory_" + i + "\" value=\"" + decimal.Parse(string.Format("{0:N2}", inventory)).ToString(Digits) + "\" />" + decimal.Parse(string.Format("{0:N2}", inventory)).ToString(Digits) + "</div></td><td><div class=\"sl divnum\" tip=\"" + dt.Rows[i]["GoodsinfoID"].ToString() + "\" tip2=\"" + i + "\"><a href=\"javascript:void(0);\" class=\"minus\">-</a><input type=\"text\" class=\"box txtGoodsNum txtGoodsNum" + i + "\" onfocus=\"InputFocus(this)\" onkeyup='KeyInt2(this)' maxlength=\"9\" value=\"" + num + "\"><a href=\"javascript:void(0);\" class=\"add\">+</a></div></td><td><div class=\"tc lblTotal_" + i + "\">¥" + decimal.Parse(string.Format("{0:N2}", zxprice * num)).ToString("0.00") + "</div></td><td><div class=\"tc alink\"><a href=\"javascript:;\" class=\"aremark" + i + "\">添加</a>" + strremark + "</div></td></tr>"; } //查询购物车商品数量、总价 // DataTable dtp = new Hi.BLL.DIS_ShopCart().SumCartNum(this.CompID.ToString(), this.DisID.ToString()); // if (dtp != null && dtp.Rows.Count > 0) //{ //TotalAmount = (dtp.Rows[0]["SumAmount"].ToString().ToDecimal(0)); //订单总价 this.lblTotalAmount.InnerText = decimal.Parse(string.Format("{0:N2}", TotalAmount.ToString())).ToString("0.00");//商品总额 //订单促销 decimal ProAmount = Common.GetProPrice(TotalAmount, out ProID, out ProIDD, out ProType, this.CompID); this.lblCux.InnerText = decimal.Parse(string.Format("{0:N2}", ProAmount.ToString())).ToString("0.00"); //合计 string str8 = (TotalAmount - ProAmount).ToString("N"); ClientScript.RegisterStartupScript(this.GetType(), "adder", "<script>$(function(){disId=" + this.DisID + "; $(\".tabLine table tbody tr:last\").before(\"" + html.Replace("\"", "'") + "\");$(\"#lblYFPrice\").text(\"" + str8 + "\")})</script>"); // } } else { Response.Redirect("/Distributor/Shop.aspx"); } }
/// <summary> /// 代理商选择商品 /// </summary> /// <returns></returns> public string disBing(string compid, string disid) { StringBuilder strwhere = new StringBuilder(); //商品是否启用库存 IsInve = OrderInfoType.rdoOrderAudit("商品是否启用库存", compid.ToInt(0)).ToInt(0); if (IsInve == 0) { strwhere.AppendFormat("and info.Inventory>0"); } DataTable dt = SqlHelper.Query(SqlHelper.LocalSqlServer, SelectGoodsInfo.Returnsql(compid, disid, strwhere.ToString(), "2")).Tables[0]; List <int> infoidl = new List <int>(); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { int id = item["ID"].ToString().ToInt(0);//BD_goodsInfo表的ID infoidl.Add(id); } } //获取商品价格 List <BLL.gDprice> l = BLL.Common.GetPrice(Convert.ToInt32(compid), Convert.ToInt32(disid), infoidl); if (l != null && l.Count > 0) { foreach (var item in l) { DataRow[] dr = dt.Select(" ID=" + item.goodsInfoId); if (dr.Length > 0) { //获取的价格大于促销价时、取促销价 dr[0]["pr"] = item.FinalPrice; dr[0]["typeTinkerPrice"] = item.typePrice; dr[0]["disTinkerPrice"] = item.disPrice; dr[0]["disProPr"] = item.bpPrice; } } } return(ConvertJson.ToJson2(dt)); }
/// <summary> /// 订单信息 /// </summary> public void databind() { if (KeyID != 0) { //判断改该条数据代理商是否有操作权限 if (!Common.PageDisOperable("Order", KeyID, DisID)) { Response.Redirect("../NoOperable.aspx"); return; } hidOrderID.Value = Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey); string where = "and isnull(o.dr,0)=0 and o.otype<>9 and o.DisID=" + DisID + " and o.ID= " + KeyID; DataTable dt = new Hi.BLL.DIS_Order().GetList("", where); if (dt != null && dt.Rows.Count > 0) { //再次购买 buyagain.Visible = false; //订单修改 modifyorder.Visible = false; //订单作废 ordervoid.Visible = false; //申请退货 //orderReturn.Visible = false; Digits = OrderInfoType.rdoOrderAudit("订单下单数量是否取整", dt.Rows[0]["CompID"].ToString().ToInt(0)); IsShow = OrderInfoType.rdoOrderAudit("订单明细是否显示店铺商品", 0).ToInt(0); IsInve = OrderInfoType.rdoOrderAudit("商品是否启用库存", dt.Rows[0]["CompID"].ToString().ToInt(0)).ToInt(0); hidDigits.Value = Digits; isbate = OrderInfoType.rdoOrderAudit("订单支付返利是否启用", dt.Rows[0]["CompID"].ToString().ToInt(0)).ToInt(0); if (isbate == 0) { if (dt.Rows[0]["bateAmount"].ToString() == "" || dt.Rows[0]["bateAmount"].ToString() == "0.00") { this.trbate.Visible = false; this.rebate.Visible = false; } } // 订单编号 lblReceiptNo.InnerText = dt.Rows[0]["ReceiptNo"].ToString(); lblCreateDate.InnerText = dt.Rows[0]["CreateDate"].ToString().ToDateTime().ToString("yyyy-MM-dd"); lblOstate.InnerText = OrderType.GetOState(dt.Rows[0]["OState"].ToString(), dt.Rows[0]["IsOutState"].ToString()); hidOstate.Value = dt.Rows[0]["OState"].ToString(); lblCompID.InnerText = Common.Getcom(dt.Rows[0]["CompID"].ToString().ToInt(0), "CompName"); orderCompId = Convert.ToString(dt.Rows[0]["CompID"]); hidIsOutstate.Value = dt.Rows[0]["IsOutState"].ToString(); OState = dt.Rows[0]["OState"].ToString().ToInt(0); IsOutState = dt.Rows[0]["IsOutState"].ToString().ToInt(0); payState = dt.Rows[0]["PayState"].ToString().ToInt(0); ReturnState = dt.Rows[0]["ReturnState"].ToString().ToInt(0); hidDts.Value = dt.Rows[0]["ts"].ToString(); //订单流程 lblTotalAmount.InnerText = dt.Rows[0]["TotalAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["TotalAmount"].ToString().ToDecimal().ToString("N"); lblProAmount.InnerText = dt.Rows[0]["ProAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["ProAmount"].ToString().ToDecimal().ToString("N"); lblbateAmount.InnerText = dt.Rows[0]["bateAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["bateAmount"].ToString().ToDecimal().ToString("N"); lblbate.InnerText = dt.Rows[0]["bateAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["bateAmount"].ToString().ToDecimal().ToString("N"); lblPostFee.InnerText = dt.Rows[0]["PostFee"].ToString() == "" ? "0.00" : dt.Rows[0]["PostFee"].ToString().ToDecimal().ToString("0.00"); lblAuditAmount.InnerText = dt.Rows[0]["AuditAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["AuditAmount"].ToString().ToDecimal().ToString("N"); //下单信息 lblArriveDate.InnerText = dt.Rows[0]["ArriveDate"].ToString() == "" ? "" : dt.Rows[0]["ArriveDate"].ToString().ToDateTime().ToString("yyyy-MM-dd"); lblGiveMode.InnerText = dt.Rows[0]["GiveMode"].ToString(); iRemark.InnerText = dt.Rows[0]["Remark"].ToString(); //收货地址 lblPrincipal.InnerText = dt.Rows[0]["Principal"].ToString(); lblPhone.InnerText = dt.Rows[0]["Phone"].ToString(); lblAddress.InnerText = dt.Rows[0]["Address"].ToString(); hidAddrID.Value = dt.Rows[0]["AddrID"].ToString(); //开票信息 if (dt.Rows[0]["IsOBill"].ToString().ToInt(0) > 0) { hidDisAccID.Value = dt.Rows[0]["DisAccID"].ToString(); hidval.Value = dt.Rows[0]["IsOBill"].ToString(); string Billing = string.Empty; Billing += "发票抬头:<label id=\"lblRise\" runat=\"server\">" + dt.Rows[0]["Rise"].ToString() + "</label>"; Billing += ",发票内容:<label id=\"lblContent\" runat=\"server\">" + dt.Rows[0]["Content"].ToString() + "</label>"; if (dt.Rows[0]["IsOBill"].ToString().ToInt(0) == 2) { Billing += ",开户银行:<label id=\"lblOBank\" runat=\"server\">" + dt.Rows[0]["OBank"].ToString() + "</label>"; Billing += ",开户账户:<label id=\"lblOAccount\" runat=\"server\">" + dt.Rows[0]["OAccount"].ToString() + "</label>"; Billing += ",纳税人登记号:<label id=\"lblTRNumber\" runat=\"server\">" + dt.Rows[0]["TRNumber"].ToString() + "</label>"; } else { Billing += ",纳税人登记号:<label id=\"lblTRNumber\" runat=\"server\">" + dt.Rows[0]["TRNumber"].ToString() + "</label>"; } iInvoice.InnerHtml = Billing; //lblRise.InnerText = dt.Rows[0]["Rise"].ToString(); //lblContent.InnerText = dt.Rows[0]["Content"].ToString(); //lblOBank.InnerText = dt.Rows[0]["OBank"].ToString(); //lblOAccount.InnerText = dt.Rows[0]["OAccount"].ToString(); //lblTRNumber.InnerText = dt.Rows[0]["TRNumber"].ToString(); } else { this.iInvoice.InnerHtml = "不开发票"; } //发票信息 lblBillNo.InnerText = dt.Rows[0]["BillNo"].ToString(); lblIsBill.InnerText = dt.Rows[0]["IsBill"].ToString() == "1" ? "是" : "否"; this.hidisBill.Value = dt.Rows[0]["IsBill"].ToString(); string msg = string.Empty; bool flag = Common.FCan(dt.Rows[0]["DisID"].ToString(), "1", out msg); if (flag) { this.lblmsg.InnerText = msg; } decimal nopayAmount = OrderInfoType.GetSumAmount(dt.Rows[0]["DisID"].ToString(), dt.Rows[0]["CompID"].ToString(), KeyID); if (nopayAmount > 0) { string promptmsg = "订单待支付金额为¥" + nopayAmount.ToString("0.00") + ",请尽快支付"; this.lblPrompt.InnerText = promptmsg; } else { this.lblPrompt.Visible = false; } #region 订单支付信息 TotalAmount = Convert.ToDecimal(dt.Rows[0]["AuditAmount"]).ToString("0.00"); PayedAmount = Convert.ToDecimal(dt.Rows[0]["PayedAmount"]).ToString("0.00"); //订单已支付不显示支付按钮(未审核、未支付完成) if (Convert.ToInt32(dt.Rows[0]["OState"]) == (int)Enums.OrderState.未提交 || Convert.ToInt32(dt.Rows[0]["OState"]) == (int)Enums.OrderState.待审核 || Convert.ToInt32(dt.Rows[0]["OState"]) == (int)Enums.OrderState.待审核 || Convert.ToInt32(dt.Rows[0]["OState"]) == (int)Enums.OrderState.已退货 || Convert.ToInt32(dt.Rows[0]["OState"]) == (int)Enums.OrderState.已作废 || (Convert.ToDecimal(dt.Rows[0]["AuditAmount"]) - Convert.ToDecimal(dt.Rows[0]["PayedAmount"]) == 0)) { btn_pay.Visible = false; } paymoney = (Convert.ToDecimal(dt.Rows[0]["AuditAmount"]) - Convert.ToDecimal(dt.Rows[0]["PayedAmount"])).ToString("0.00"); //加密keyId desKeyID.Value = Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey); //绑定支付流水信息 DataTable paytable = new Hi.BLL.PAY_PrePayment().GetPayedItem(KeyID); rptmessage.DataSource = paytable; rptmessage.DataBind(); //初始值加载 txtArriveDate.Value = DateTime.Now.ToString("yyyy-MM-dd"); DataTable dtpayment = new Hi.BLL.PAY_PrePayment().GetDate(" top 1 CreateDate, payName ,paycode ,paybank", "pay_payment", " DisID=" + DisID + " and vdef3=5 order by CreateDate desc"); foreach (DataRow dr in dtpayment.Rows) { bankname.Value = Convert.ToString(dr["payName"]); bankcode.Value = Convert.ToString(dr["paycode"]); bank.Value = Convert.ToString(dr["paybank"]); } //附件 //if (dt.Rows[0]["Atta"].ToString() != "") //{ // StringBuilder li = new StringBuilder(); // string[] atta = dt.Rows[0]["Atta"].ToString().Split(new string[] { "$$&&" }, StringSplitOptions.RemoveEmptyEntries); // if (atta.Length > 0) // { // foreach (var item in atta) // { // li.AppendFormat("<li> <a href=\"javascript:;\" class=\"name\">{0}</a><a href=\"javascript:;\" class=\"bule del\" orderid=\"{1}\">删除</a><a href=\"javascript:;\" class=\"bule\">下载</a></li>", item, KeyID); // } // } // this.payulfile.InnerHtml = li.ToString(); //} #endregion //附件 if (dt.Rows[0]["Atta"].ToString() != "") { StringBuilder li = new StringBuilder(); string[] atta = dt.Rows[0]["Atta"].ToString().Split(new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries); if (atta.Length > 0) { foreach (var item in atta) { string[] att = item.Split(new string[] { "^^" }, StringSplitOptions.RemoveEmptyEntries); if (att.Length > 1) { li.AppendFormat("<li> <a href=\"{2}\" target=\"_blank\" class=\"name\">{0}(大小:{4}KB)</a><a href=\"javascript:;\" class=\"bule del\" tip=\"{3}\" orderid=\"{1}\">删除</a><a href=\"{2}\" target=\"_blank\" class=\"bule\">下载</a></li>", att[0] + att[1].Substring(att[1].LastIndexOf(".")), KeyID, Common.GetWebConfigKey("ImgViewPath") + "OrderFJ/" + item, item, OrderType.GetSize(item)); } } } ulAtta.InnerHtml = li.ToString(); this.hrOrderFj.Value = dt.Rows[0]["Atta"].ToString(); } #region 订单明细 //订单所有商品明细 DataTable l = new Hi.BLL.DIS_OrderDetail().GetOrderDe("", " IsNUll(o.dr,0)=0 and o.OrderId=" + KeyID); if (l != null && l.Rows.Count > 0) { rptOrderD.DataSource = l; rptOrderD.DataBind(); //待发货商品 DataTable lno = SelectGoodsInfo.SreeenDataTable(l, "isnull(IsOut,0)=0"); //l.Select(string.Format("IsOut={0}", 0)); if (lno != null && lno.Rows.Count > 0) { rptIsout.DataSource = lno; rptIsout.DataBind(); } //已发货商品 List <Hi.Model.DIS_OrderOutDetail> loud = new Hi.BLL.DIS_OrderOutDetail().GetList("", " isnull(dr,0)=0 and OrderID=" + KeyID, ""); //发货单 and o.IsAudit<>3 DataTable lo = new Hi.BLL.DIS_OrderOut().GetList("", " isnull(o.dr,0)=0 and o.OrderID=" + KeyID + " Order by o.IsAudit"); if (loud != null && loud.Count > 0) { //outbind(lo, l, loud); outGoods.InnerHtml = SelectGoodsInfo.outbind(lo, l, loud, Digits, 0); } #region 流程时间控件 if (lo != null && lo.Rows.Count > 0) { if (((int)Enums.OrderState.已发货 <= OState || OState == (int)Enums.OrderState.退货处理) && (IsOutState == 3 || IsOutState == 4)) { //订单发货时间 DataRow[] sendlo = lo.Select("IsAudit<>3"); DataRow[] dv = sendlo.OrderByDescending(x => x["id"]).ToArray(); if (dv.Length > 0) { sendde = dv[0]["SendDate"].ToString() != "" ? dv[0]["SendDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : ""; } } if ((int)Enums.OrderState.已到货 <= OState || OState == (int)Enums.OrderState.退货处理) { //订单签收时间 DataRow[] signlo = lo.Select("IsAudit<>3 and IsSign=1"); DataRow[] dr = signlo.OrderByDescending(x => x["id"]).ToArray(); if (dr.Length > 0) { signde = dr[0]["SignDate"].ToString() != "" ? dr[0]["SignDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : ""; } } } #endregion } #endregion #region 流程时间控件 //订单流程时间显示 //订单提交时间 CreateDate = dt.Rows[0]["CreateDate"].ToString() != "" ? dt.Rows[0]["CreateDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : ""; //订单审核时间 AuditDate = dt.Rows[0]["AuditDate"].ToString() != "" ? dt.Rows[0]["AuditDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : ""; #endregion 流程时间控件 #region 订单操作按钮 switch (OState) { case (int)Enums.OrderState.待审核: modifyorder.Visible = true; buyagain.Visible = true; ordervoid.Visible = true; break; case (int)Enums.OrderState.已审: //订单审核前,可以修改订单。 buyagain.Visible = true; break; case (int)Enums.OrderState.退货处理: //orderReturn.Visible = false; buyagain.Visible = true; btn_pay.Visible = false; fulfil = signde; break; case (int)Enums.OrderState.已发货: modifyorder.Visible = false; buyagain.Visible = true; break; case (int)Enums.OrderState.已到货: modifyorder.Visible = false; buyagain.Visible = true; if (dt.Rows[0]["CreateDate"].ToString().ToDateTime() > DateTime.Now.AddMonths(-3)) { //三个月以内的订单可退货 //if (ReturnState < (int)Enums.ReturnState.申请退货) //orderReturn.Visible = true; } if (ReturnState >= (int)Enums.ReturnState.申请退货) { btn_pay.Visible = false; } if (sendde == "" && signde == "" && AuditDate != "") { fulfil = AuditDate; } else if (AuditDate.ToString() == "") { fulfil = CreateDate; } else { fulfil = signde == "" ? sendde : signde; } break; case (int)Enums.OrderState.已作废: modifyorder.Visible = false; buyagain.Visible = true; fulfil = Convert.ToDateTime(dt.Rows[0]["ts"]).ToString("yyyy-MM-dd HH:mm"); break; case (int)Enums.OrderState.已退货: buyagain.Visible = true; btn_pay.Visible = false; fulfil = signde; break; default: break; } #endregion //订单修改,再次购买 if (!Common.HasRight(this.CompID, this.UserID, "1010", this.DisID)) { this.buyagain.Visible = false; this.modifyorder.Visible = false; } //订单作废 if (!Common.HasRight(this.CompID, this.UserID, "2012", this.DisID)) { this.ordervoid.Visible = false; } //在线支付 if (!Common.HasRight(this.CompID, this.UserID, "2014", this.DisID)) { ClientScript.RegisterStartupScript(this.GetType(), "btn_pay_xs", "<script> $('#btn_pay_xs').hide();</script>"); } //线下支付 if (!Common.HasRight(this.CompID, this.UserID, "2015", this.DisID)) { this.btn_pay_xx.Visible = false; } //申请退货 //if (!Common.HasRight(this.CompID, this.UserID, "2311", this.DisID)) //this.orderReturn.Visible = false; //确认收货 if (!Common.HasRight(this.CompID, this.UserID, "2013", this.DisID)) { ClientScript.RegisterStartupScript(this.GetType(), "btnsign", "<script> $('.btnsign,.btnsigni').hide();</script>"); } } } else { Response.Redirect("../NoOperable.aspx"); return; } }
/// <summary> ///下拉商品 /// </summary> /// <returns></returns> public string disBing(string compid) { DataTable ds = SqlHelper.Query(SqlHelper.LocalSqlServer, SelectGoodsInfo.sql(compid, "")).Tables[0]; return(ConvertJson.ToJson(ds).ToString()); }
/// <summary> /// 订单信息 /// </summary> public void databind() { if (KeyID != 0) { hidOrderID.Value = Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey); string where = "and isnull(o.dr,0)=0 and o.otype<>9 and o.ID= " + KeyID; DataTable dt = new Hi.BLL.DIS_Order().GetList("", where); if (dt != null && dt.Rows.Count > 0) { CompID = dt.Rows[0]["CompID"].ToString().ToInt(0); DisID = dt.Rows[0]["DisID"].ToString().ToInt(0); hidDisID.Value = DisID.ToString(); //判断改该条数据代理商是否有操作权限 if (!Common.PageDisOperable("Order", KeyID, DisID)) { Response.Redirect("../NoOperable.aspx"); return; } //////再次购买 ////buyagain.Visible = false; //////订单修改 ////modifyorder.Visible = false; //订单作废 //ordervoid.Visible = false; //////订单审核 ////orderaudit.Visible = false; Digits = OrderInfoType.rdoOrderAudit("订单下单数量是否取整", dt.Rows[0]["CompID"].ToString().ToInt(0)); hidDigits.Value = Digits; isbate = OrderInfoType.rdoOrderAudit("订单支付返利是否启用", CompID).ToInt(0); if (isbate == 0) { trbate.Visible = false; rebate.Visible = false; } OState = dt.Rows[0]["OState"].ToString().ToInt(0); if (OState == (int)Enums.OrderState.已作废) { orderDelete.Visible = true; } else { orderDelete.Visible = false; } IsOutState = dt.Rows[0]["IsOutState"].ToString().ToInt(0); payState = dt.Rows[0]["PayState"].ToString().ToInt(0); hidIsOutstate.Value = dt.Rows[0]["IsOutState"].ToString(); hidOstate.Value = OState.ToString(); hidpaystate.Value = payState.ToString(); #region 订单操作按钮 //switch (OState) //{ // case (int)Enums.OrderState.未提交: // //modifyorder.Visible = true; // //buyagain.Visible = true; // //orderaudit.Visible = true; // //ordervoid.Visible = true; // deliver.Attributes.Add("style", "display: none;"); // break; // case (int)Enums.OrderState.待审核: // //modifyorder.Visible = true; // //buyagain.Visible = true; // //orderaudit.Visible = true; // //ordervoid.Visible = true; // deliver.Attributes.Add("style", "display: none;"); // break; // case (int)Enums.OrderState.已审: // //订单审核前,可以修改订单。 // buyagain.Visible = true; // if (payState == 0) // { // //订单支付前订单可以作废,支付后不能作废订单 // ordervoid.Visible = true; // } // break; // case (int)Enums.OrderState.退货处理: // buyagain.Visible = true; // fulfil = signde; // break; // case (int)Enums.OrderState.已发货: // modifyorder.Visible = false; // buyagain.Visible = true; // break; // case (int)Enums.OrderState.已到货: // modifyorder.Visible = false; // buyagain.Visible = true; // fulfil = signde; // break; // case (int)Enums.OrderState.已作废: // modifyorder.Visible = false; // buyagain.Visible = true; // break; // case (int)Enums.OrderState.已退货: // buyagain.Visible = true; // fulfil = signde; // break; // default: // break; //} #endregion // 订单编号 lblReceiptNo.InnerText = dt.Rows[0]["ReceiptNo"].ToString(); lblDisName.InnerText = Common.GetDisValue(dt.Rows[0]["DisID"].ToString().ToInt(0), "DisName").ToString(); lblCreateDate.InnerText = dt.Rows[0]["CreateDate"].ToString().ToDateTime().ToString("yyyy-MM-dd"); lblOstate.InnerText = OrderType.GetOState(dt.Rows[0]["OState"].ToString(), dt.Rows[0]["IsOutState"].ToString()); //订单流程 lblTotalAmount.InnerText = dt.Rows[0]["TotalAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["TotalAmount"].ToString().ToDecimal().ToString("N"); lblProAmount.InnerText = dt.Rows[0]["ProAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["ProAmount"].ToString().ToDecimal().ToString("N"); lblbateAmount.InnerText = dt.Rows[0]["bateAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["bateAmount"].ToString().ToDecimal().ToString("N"); lblbate.InnerText = dt.Rows[0]["bateAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["bateAmount"].ToString().ToDecimal().ToString("0.00"); lblPostFee.InnerText = dt.Rows[0]["PostFee"].ToString() == "" ? "0.00" : dt.Rows[0]["PostFee"].ToString().ToDecimal().ToString("0.00"); lblAuditAmount.InnerText = dt.Rows[0]["AuditAmount"].ToString() == "" ? "0.00" : dt.Rows[0]["AuditAmount"].ToString().ToDecimal().ToString("N"); //下单信息 lblArriveDate.InnerText = dt.Rows[0]["ArriveDate"].ToString() == "" ? "" : dt.Rows[0]["ArriveDate"].ToString().ToDateTime().ToString("yyyy-MM-dd"); lblGiveMode.InnerText = dt.Rows[0]["GiveMode"].ToString(); iRemark.InnerText = dt.Rows[0]["Remark"].ToString(); //收货地址 lblPrincipal.InnerText = dt.Rows[0]["Principal"].ToString(); lblPhone.InnerText = dt.Rows[0]["Phone"].ToString(); lblAddress.InnerText = dt.Rows[0]["Address"].ToString(); hidAddrID.Value = dt.Rows[0]["AddrID"].ToString(); //开票信息 if (dt.Rows[0]["IsOBill"].ToString() == "1") { hidDisAccID.Value = dt.Rows[0]["DisAccID"].ToString(); hidval.Value = dt.Rows[0]["IsOBill"].ToString(); string Billing = string.Empty; Billing += "发票抬头:<label id=\"lblRise\" runat=\"server\">" + dt.Rows[0]["Rise"].ToString() + "</label>"; Billing += ",发票内容:<label id=\"lblContent\" runat=\"server\">" + dt.Rows[0]["Content"].ToString() + "</label>"; if (!string.IsNullOrEmpty(dt.Rows[0]["OBank"].ToString())) { Billing += ",开户银行:<label id=\"lblOBank\" runat=\"server\">" + dt.Rows[0]["OBank"].ToString() + "</label>"; Billing += ",开户账户:<label id=\"lblOAccount\" runat=\"server\">" + dt.Rows[0]["OAccount"].ToString() + "</label>"; Billing += ",纳税人登记号:<label id=\"lblTRNumber\" runat=\"server\">" + dt.Rows[0]["TRNumber"].ToString() + "</label>"; } iInvoice.InnerHtml = Billing; //lblRise.InnerText = dt.Rows[0]["Rise"].ToString(); //lblContent.InnerText = dt.Rows[0]["Content"].ToString(); //lblOBank.InnerText = dt.Rows[0]["OBank"].ToString(); //lblOAccount.InnerText = dt.Rows[0]["OAccount"].ToString(); //lblTRNumber.InnerText = dt.Rows[0]["TRNumber"].ToString(); } else { this.iInvoice.InnerHtml = "不开发票"; } //发票信息 lblBillNo.InnerText = dt.Rows[0]["BillNo"].ToString(); lblIsBill.InnerText = dt.Rows[0]["IsBill"].ToString() == "1" ? "是" : "否"; lblIsBill.Attributes.Add("tip", dt.Rows[0]["IsBill"].ToString()); this.hidisBill.Value = dt.Rows[0]["IsBill"].ToString(); #region 订单支付信息 TotalAmount = Convert.ToDecimal(dt.Rows[0]["AuditAmount"]).ToString("0.00"); PayedAmount = Convert.ToDecimal(dt.Rows[0]["PayedAmount"]).ToString("0.00"); //订单已支付不显示支付按钮(未审核、未支付完成) if (Convert.ToInt32(dt.Rows[0]["OState"]) == 1 || (Convert.ToDecimal(dt.Rows[0]["AuditAmount"]) - Convert.ToDecimal(dt.Rows[0]["PayedAmount"]) == 0)) { btn_pay.Visible = false; } paymoney = (Convert.ToDecimal(dt.Rows[0]["AuditAmount"]) - Convert.ToDecimal(dt.Rows[0]["PayedAmount"])).ToString("0.00"); //加密keyId desKeyID.Value = Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey); //绑定支付流水信息 DataTable paytable = new Hi.BLL.PAY_PrePayment().GetPayedItem(KeyID); rptmessage.DataSource = paytable; rptmessage.DataBind(); //初始值加载 txtArriveDate.Value = DateTime.Now.ToString("yyyy-MM-dd"); DataTable dtpayment = new Hi.BLL.PAY_PrePayment().GetDate(" top 1 CreateDate, payName ,paycode ,paybank", "pay_payment", " DisID=" + DisID + " and vdef3=5 order by CreateDate desc"); foreach (DataRow dr in dtpayment.Rows) { bankname.Value = Convert.ToString(dr["payName"]); bankcode.Value = Convert.ToString(dr["paycode"]); bank.Value = Convert.ToString(dr["paybank"]); } #endregion //附件 if (dt.Rows[0]["Atta"].ToString() != "") { StringBuilder li = new StringBuilder(); string[] atta = dt.Rows[0]["Atta"].ToString().Split(new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries); if (atta.Length > 0) { foreach (var item in atta) { string[] att = item.Split(new string[] { "^^" }, StringSplitOptions.RemoveEmptyEntries); if (att.Length > 1) { li.AppendFormat("<li> <a href=\"{2}\" target=\"_blank\" class=\"name\">{0}(大小:{4}KB)</a><a href=\"javascript:;\" class=\"bule del\" tip=\"{3}\" orderid=\"{1}\">删除</a><a href=\"{2}\" target=\"_blank\" class=\"bule\">下载</a></li>", att[0] + att[1].Substring(att[1].LastIndexOf(".")), KeyID, Common.GetWebConfigKey("ImgViewPath") + "OrderFJ/" + item, item, OrderType.GetSize(item)); } } } ulAtta.InnerHtml = li.ToString(); this.hrOrderFj.Value = dt.Rows[0]["Atta"].ToString(); } #region 订单明细 //订单所有商品明细 DataTable l = new Hi.BLL.DIS_OrderDetail().GetOrderDe("", " IsNUll(o.dr,0)=0 and o.OrderId=" + KeyID); if (l != null && l.Rows.Count > 0) { rptOrderD.DataSource = l; rptOrderD.DataBind(); //待发货商品 DataTable lno = SelectGoodsInfo.SreeenDataTable(l, "isnull(IsOut,0)=0"); //l.Select(string.Format("IsOut={0}", 0)); if (lno != null && lno.Rows.Count > 0) { txtDate.Value = DateTime.Now.ToString("yyyy-MM-dd"); rptIsout.DataSource = lno; rptIsout.DataBind(); } else { deliver.Attributes.Add("style", "display: none;"); } //已发货商品 List <Hi.Model.DIS_OrderOutDetail> loud = new Hi.BLL.DIS_OrderOutDetail().GetList("", " isnull(dr,0)=0 and OrderID=" + KeyID, ""); //发货单 作废-- and o.IsAudit<>3 DataTable lo = new Hi.BLL.DIS_OrderOut().GetList("", " isnull(o.dr,0)=0 and o.OrderID=" + KeyID + " Order by o.IsAudit"); if (loud != null && loud.Count > 0) { //outbind(lo, l, loud); outGoods.InnerHtml = SelectGoodsInfo.outbind(lo, l, loud, Digits, 1); } #region 流程时间控件 //订单流程时间显示 //订单提交时间 CreateDate = dt.Rows[0]["CreateDate"].ToString() != "" ? dt.Rows[0]["CreateDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : ""; //订单审核时间 AuditDate = dt.Rows[0]["AuditDate"].ToString() != "" ? dt.Rows[0]["AuditDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : ""; if (lo != null && lo.Rows.Count > 0) { if (((int)Enums.OrderState.已发货 <= OState || OState == (int)Enums.OrderState.退货处理) && (IsOutState == 3 || IsOutState == 4)) { //订单发货时间 DataRow[] sendlo = lo.Select("IsAudit<>3"); DataRow[] dv = sendlo.OrderByDescending(x => x["id"]).ToArray(); if (dv.Length > 0) { sendde = dv[0]["SendDate"].ToString() != "" ? dv[0]["SendDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : ""; } } if ((int)Enums.OrderState.已到货 <= OState || OState == (int)Enums.OrderState.退货处理) { //订单签收时间 DataRow[] signlo = lo.Select("IsAudit<>3 and IsSign=1"); DataRow[] dr = signlo.OrderByDescending(x => x["id"]).ToArray(); if (dr.Length > 0) { signde = dr[0]["SignDate"].ToString() != "" ? dr[0]["SignDate"].ToString().ToDateTime().ToString("yyyy-MM-dd HH:mm") : ""; } } } #endregion } #endregion } else { Response.Redirect("../NoOperable.aspx"); return; } } }
/// <summary> /// 修改是绑定的数据 /// </summary> public void Bind() { //判断是否有权限 if (!Common.PageCompOperable("Order", KeyID, CompID)) { Response.Redirect("../../NoOperable.aspx"); return; } Hi.Model.DIS_Order OrderInfoModel = new Hi.BLL.DIS_Order().GetModel(KeyID); if (OrderInfoModel != null) { hidts.Value = OrderInfoModel.ts.ToString(); //时间戳 this.divGoodsName.InnerText = disBing(CompID.ToString(), OrderInfoModel.DisID.ToString()); //筛选商品 Hi.Model.BD_Distributor model = new Hi.BLL.BD_Distributor().GetModel(OrderInfoModel.DisID); this.txtDisName.Value = model.DisName; //代理商名称 this.txtDisName.Disabled = true; //只读 this.hidDisID.Value = OrderInfoModel.DisID.ToString(); //代理商ID if (Request["type"] + "" != "2" || Fanli == 1) { this.txtRebate.Value = OrderInfoModel.bateAmount.ToString(); //返利金额 } this.txtDate.Value = OrderInfoModel.ArriveDate.ToString("yyyy-MM-dd") == "0001-01-01" ? "" : OrderInfoModel.ArriveDate.ToString("yyyy-MM-dd"); //交货日期 this.lblPsType.InnerText = OrderInfoModel.GiveMode; //配送方式 this.lblPsType2.InnerText = OrderInfoModel.GiveMode == "送货" ? "自提" : "送货"; this.hidPsType.Value = OrderInfoModel.GiveMode; //配送方式 this.OrderNote.Value = OrderInfoModel.Remark; //订单备注 this.hidAdder.Value = OrderInfoModel.Address; //地址 this.hidAddName.Value = OrderInfoModel.Principal; //联系人 this.hidAddPhone.Value = OrderInfoModel.Phone; //联系人电话 this.hrAdder.Value = OrderInfoModel.AddrID.ToString(); //收货地址id this.hrOrderFj.Value = OrderInfoModel.Atta; //附件文件 string str10 = decimal.Parse(string.Format("{0:N2}", OrderInfoModel.PostFee.ToString())).ToString("0.00"); //运费 this.lblPostFee.InnerText = str10; //运费 this.hidPostFree.Value = str10; //运费 //附件 string str3 = string.Empty; //附件信息 if (OrderInfoModel.Atta.ToString() != "") { StringBuilder li = new StringBuilder(); string[] atta = OrderInfoModel.Atta.Split(new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries); if (atta.Length > 0) { foreach (var item in atta) { string[] att = item.Split(new string[] { "^^" }, StringSplitOptions.RemoveEmptyEntries); li.AppendFormat("<li> <a href=\"javascript:;\" class=\"name\">{0}(大小:{4}KB)</a><a href=\"javascript:;\" class=\"bule del\" tip=\"{3}\" orderid=\"{1}\">删除</a><a href=\"{2}\" target=\"_blank\" class=\"bule\">下载</a></li>", att[0] + att[1].Substring(att[1].LastIndexOf(".")), KeyID, Common.GetWebConfigKey("ImgViewPath") + "OrderFJ/" + item, item, OrderType.GetSize(item)); } } str3 = li.ToString(); } //收货信息 string str = "收货人:" + OrderInfoModel.Principal + ",联系电话:" + OrderInfoModel.Phone + ",收货地址:" + OrderInfoModel.Address; string price = string.Empty;//返利总金额 if (Request.QueryString["type"] + "" == "2") { //再次购买时获取返利总金额 price = OrderType.GetRebate(0, OrderInfoModel.DisID); } else { //其他获取返利总金额 price = OrderType.GetRebate(KeyID, OrderInfoModel.DisID); } //可用返利金额 string str4 = "可用返利¥ <label id=\"lblRebate\">" + string.Format("{0:N2}", price.ToString()) + "</label><i class=\"sus-i seebate\"></i>"; List <Hi.Model.DIS_OrderDetail> ll = new Hi.BLL.DIS_OrderDetail().GetList("", "isnull(dr,0)=0 and orderId=" + KeyID, ""); if (ll.Count > 0) { string html = string.Empty; //绑定的商品数据 int index = 0; //索引 string str8 = "0.00"; //商品小计 foreach (Hi.Model.DIS_OrderDetail obj in ll) { Hi.Model.BD_GoodsInfo model2 = new Hi.BLL.BD_GoodsInfo().GetModel(obj.GoodsinfoID); string kc = string.Empty; decimal newprice = obj.AuditAmount; //判断修改和再次购买时的价格 显示的 decimal newprice2 = obj.GoodsPrice; //判断修改和再次购买时的价格 隐藏的 str8 = decimal.Parse(string.Format("{0:N2}", obj.sumAmount)).ToString("0.00"); //判断修改和再次购买时的小计价格 // decimal str88 = 0;//判断修改和再次购买时的小计价格 隐藏的 if (Request.QueryString["type"] + "" == "2") { //再次 购买时获取库存 kc = model2.Inventory.ToString(); // newprice2 = newprice = BLL.Common.GetGoodsPrice(this.CompID, OrderInfoModel.DisID, obj.GoodsinfoID); // str8 = decimal.Parse(string.Format("{0:N2}", newprice * obj.GoodsNum)).ToString("0.00"); } else { //其他获取库存 kc = (model2.Inventory + obj.GoodsNum + obj.ProNum.ToDecimal(0)).ToString(); } string pic = new Hi.BLL.BD_Goods().GetModel(Convert.ToInt32(model2.GoodsID)).Pic; //图片 string str6 = IsInve == 0 ? "" : "display:none"; //是否显示库存 string str7 = string.Empty; //是否促销 str7 = SelectGoodsInfo.protitle(obj.ProID, obj.Protype, obj.Unit); // ConvertJson.IsCx(dt.Rows[0]["proTypes"].ToString(), dt.Rows[0]["proType"].ToString(), dt.Rows[0]["proGoodsPrice"].ToString(), dt.Rows[0]["proDiscount"].ToString(), dt.Rows[0]["unit"].ToString()); //SelectGoodsInfo.protitle(obj.ProID, obj.Protype, obj.Unit); string Digits = OrderInfoType.rdoOrderAudit("订单下单数量是否取整", this.CompID); //小数位数 decimal num = decimal.Parse(string.Format("{0:N4}", (obj.GoodsNum).ToString("#,####" + Digits))); //购买数量 string str9 = obj.Remark; //goodsInfoid备注 if (obj.Remark != null && obj.Remark.Length > 6) { str9 = obj.Remark.Substring(0, 6) + "..."; } string strremark = string.Empty;//鼠标移上去时显示的备注 if (obj.Remark != "") { strremark = "<div class=\"divremark" + index + "\">" + str9 + "</div><div class=\"cur\">" + obj.Remark + "</div>"; } // decimal zxprice = BLL.Common.GetGoodsPrice(this.CompID, OrderInfoModel.DisID, obj.GoodsinfoID); html += "<tr trindex=\"" + index + "\" trindex2=\"" + index + "\" id=\"" + obj.ID + "\" tip=\"" + obj.GoodsinfoID + "\"><td class=\"t8\"><div class=\"addg\"><a href=\"javascript:;\" class=\"minus2\"></a><a href=\"javascript:;\" class=\"add2\"></a></div></td><td><div class=\"sPic\"><a class=\"opt-i2\"></a><span><a href=\"javascript:;\"><img src=\"" + Common.GetPicURL(pic, "resize200") + "\" width=\"60\" height=\"60\"></a></span><a href=\"javascript:;\" class=\"code\">商品编码:" + obj.GoodsCode + str7 + "</a><a href=\"javascript:;\" class=\"name\">" + GetGoodsName(obj.GoodsName, obj.GoodsInfos, "1") + "<i>" + GetGoodsName(obj.GoodsName, obj.GoodsInfos, "2") + "</i></a></div></td><td><div class=\"tc\">" + obj.Unit + "</div></td><td><input type=\"text\" tip2=\"" + index + "\" class=\"boxs divprice" + index + "\" value=\"" + decimal.Parse(string.Format("{0:N2}", newprice)).ToString("0.00") + "\" maxlength=\"9\" ><input type=\"hidden\" class=\"hidPrice\" value=\"" + decimal.Parse(string.Format("{0:N2}", newprice2)).ToString("0.00") + "\" /></td><td style=\"" + str6 + "\"><div class=\"tc\"><input type=\"hidden\" id=\"hidInventory_" + index + "\" value=\"" + decimal.Parse(string.Format("{0:N2}", kc)).ToString(Digits) + "\" />" + decimal.Parse(string.Format("{0:N2}", kc)).ToString(Digits) + "</div></td><td><div class=\"sl divnum\" tip=\"" + obj.GoodsinfoID + "\" tip2=\"" + index + "\"><a href=\"javascript:void(0);\" class=\"minus\">-</a><input type=\"text\" class=\"box txtGoodsNum txtGoodsNum" + index + "\" onfocus=\"InputFocus(this)\" onkeyup='KeyInt2(this)' maxlength=\"9\" value=\"" + num + "\"><a href=\"javascript:void(0);\" class=\"add\">+</a></div></td><td><div class=\"tc lblTotal_" + index + "\">¥" + str8 + "</div></td><td><div class=\"tc alink\"><a href=\"javascript:;\" class=\"aremark" + index + "\">" + (obj.Remark == "" ? "添加" : "编辑") + "</a>" + strremark + "</div></td></tr>"; index++; } this.lblTotalAmount.InnerText = decimal.Parse(string.Format("{0:N2}", OrderInfoModel.TotalAmount)).ToString("0.00"); //商品总额 string str2 = string.Empty; //开票信息 List <Hi.Model.DIS_OrderExt> l = new Hi.BLL.DIS_OrderExt().GetList("", "orderID=" + KeyID, ""); if (l.Count > 0) { foreach (Hi.Model.DIS_OrderExt item in l) { this.hrOrderInv.Value = item.DisAccID; //开票Id this.hidLookUp.Value = item.Rise; //发票抬头 this.hidBank.Value = item.OBank; //开会银行 this.hidContext.Value = item.Content; //发票内容 this.hidAccount.Value = item.OAccount; //开户帐号 this.hidRegNo.Value = item.TRNumber; //纳税人登记号 if (item.IsOBill == 0) { str2 = "不开票"; this.hidVal.Value = "0"; } else if (item.IsOBill == 1 && item.OAccount == "" && item.TRNumber == "" && item.OBank == "") { str2 = "发票抬头:" + item.Rise + ",发票内容:" + item.Content; this.hidVal.Value = "1"; } else { str2 = "发票抬头:" + item.Rise + ",发票内容:" + item.Content + ",开户银行:" + item.OBank + ",开户账户:" + item.OAccount + ",纳税人登记号:" + item.TRNumber; this.hidVal.Value = "2"; } this.lblCux.InnerText = decimal.Parse(string.Format("{0:N2}", item.ProAmount.ToString())).ToString("0.00");//订单促销 } } if (Convert.ToDecimal(str8) < 0) { str8 = "0.00"; } if (Request["type"] + "" != "2" || Fanli == 1) { this.lblFanl.InnerText = decimal.Parse(string.Format("{0:N2}", OrderInfoModel.bateAmount.ToString())).ToString("0.00");//返利金额 } ClientScript.RegisterStartupScript(this.GetType(), "adder", "<script>$(function(){$(\".site .site-if\").text(\"" + str + "\");$(\".invoice .in-if\").text(\"" + str2 + "\");$(\".attach .list\").html(\"" + str3.Replace("\"", "'") + "\");$(\".edit-ok .txt\").html(\"" + str4.Replace("\"", "'") + "\"); $(\".tabLine table tbody\").html(\"" + html.Replace("\"", "'") + "\"); $(\"#lblYFPrice\").text(\"" + decimal.Parse(string.Format("{0:N2}", (Request["type"] + "" == "2" && Fanli == 0 ? OrderInfoModel.AuditAmount + OrderInfoModel.bateAmount : OrderInfoModel.AuditAmount))).ToString("0.00") + "\"); $(\".jxs-box .opt-i\").hide();})</script>"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.hidType2.Value = Request.QueryString["type"] + ""; this.hidDisID.Value = this.DisID.ToString(); this.hidKeyId.Value = KeyID.ToString(); StringBuilder strwhere = new StringBuilder(); Fanli = OrderInfoType.rdoOrderAudit("订单支付返利是否启用", CompID).ToInt(0); this.hidFanl.Value = Fanli.ToString(); LoginModel logUser = Session["UserModel"] as LoginModel; Common.ListComps(this.ddrComp, this.UserID.ToString(), this.CompID.ToString()); this.hidCompId.Value = this.ddrComp.Value.ToString(); decimal CreditAmount = 0; if (BLL.Common.GetCredit(this.hidCompId.Value.ToString().ToInt(0), logUser.DisID, out CreditAmount)) { decimal GetSumAmount = OrderInfoType.GetSumAmount(logUser.DisID.ToString(), this.hidCompId.Value.ToString(), KeyID); if (GetSumAmount >= CreditAmount) { this.Msg.InnerHtml = "您的授信额度(" + CreditAmount + ")已用完或超出!无法下单"; this.Btn.InnerHtml = "<a href=\"javascript:; \" class=\"gray-btn2\">取消</a>"; } else { this.Msg.InnerHtml = ""; } } else { this.Msg.InnerHtml = ""; } // isbate = OrderInfoType.rdoOrderAudit("订单支付返利是否启用", CompID).ToInt(0); //if (Fanli == 0) //{ // this.trbate.Visible = false; // this.rebate.Visible = false; //} //商品是否启用库存 IsInve = OrderInfoType.rdoOrderAudit("商品是否启用库存", this.CompID).ToInt(0); if (IsInve == 0) { strwhere.AppendFormat("and info.Inventory>0"); } DataTable dt = SqlHelper.Query(SqlHelper.LocalSqlServer, SelectGoodsInfo.Returnsql(CompID.ToString(), DisID.ToString(), strwhere.ToString(), "1")).Tables[0]; List <int> infoidl = new List <int>(); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { int id = item["ID"].ToString().ToInt(0);//BD_goodsInfo表的ID infoidl.Add(id); } } //获取商品价格 List <BLL.gDprice> l = BLL.Common.GetPrice(CompID, DisID, infoidl); if (l != null && l.Count > 0) { foreach (var item in l) { DataRow[] dr = dt.Select(" ID=" + item.goodsInfoId); if (dr.Length > 0) { //获取的价格大于促销价时、取促销价 dr[0]["pr"] = item.FinalPrice; dr[0]["typeTinkerPrice"] = item.typePrice; dr[0]["disTinkerPrice"] = item.disPrice; dr[0]["disProPr"] = item.bpPrice; } } } this.divGoodsName.InnerText = ConvertJson.ToJson2(dt); //代理商列表 List <Hi.Model.BD_Distributor> list = new Hi.BLL.BD_Distributor().GetList("ID,DisName", "isnull(dr,0)=0 and compid=" + this.CompID, ""); this.divDisList.InnerText = ConvertJson.ToJson(Common.FillDataTable(list)); if (KeyID != 0) { if (Request.QueryString["type"] + "" != "2") { Hi.Model.DIS_Order model = new Hi.BLL.DIS_Order().GetModel(KeyID); //判断订单是否可以修改 企业下单订单已审未支付,代理商下单企业不能修改 if (model.OState > (int)Enums.OrderState.待审核) { JScript.AlertAndRedirect("订单已被其他人修改,请刷新后再重新操作!", "orderdetail.aspx?top=1&KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey)); return; } } else { this.hidType.Value = Request.QueryString["type"] + ""; } Bind(); } else { if ((Request.QueryString["type"] + "") == "1") { this.hidType.Value = Request.QueryString["type"] + ""; ShopCart(); } } } }