229 lines
14 KiB
C#
229 lines
14 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Data;
|
|
namespace Mtxfw.shop
|
|
{
|
|
public partial class Member_Orders_List : Mtxfw.Utility.MemberBase
|
|
{
|
|
Mtxfw.DAL.order_info daoorder = new Mtxfw.DAL.order_info();
|
|
Mtxfw.DAL.order_product_info daoorderproduct = new Mtxfw.DAL.order_product_info();
|
|
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
|
protected string ShowPage = "", ShowConent = "", strcurrend1 = "", strcurrend2 = "", strcurrend3 = "", strcurrend4 = "", strcurrend5 = "";
|
|
protected Double UserMoney = 0.00;
|
|
public Mtxfw.DAL.P_Product daoProduct = new Mtxfw.DAL.P_Product();
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
base.OnLoad(e);
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
if (Request.QueryString["s"] != null)
|
|
{
|
|
if (Request.QueryString["s"].ToString() == "0")
|
|
{
|
|
strcurrend2 = "class=\"currend\"";
|
|
}
|
|
else if (Request.QueryString["s"].ToString() == "1")
|
|
{
|
|
strcurrend3 = "class=\"currend\"";
|
|
}
|
|
else if (Request.QueryString["s"].ToString() == "-1")
|
|
{
|
|
strcurrend4 = "class=\"currend\"";
|
|
}
|
|
else
|
|
{
|
|
strcurrend1 = "class=\"currend\"";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strcurrend1 = "class=\"currend\"";
|
|
}
|
|
Mtxfw.Model.user_info ModelUser = daoUser.GetModel(Card);
|
|
if (ModelUser != null)
|
|
{
|
|
UserMoney = ModelUser.umoney14;
|
|
}
|
|
myDataBind();
|
|
Page.Title = "我的订单 - " + GetWebName;
|
|
}
|
|
}
|
|
|
|
private void myDataBind()
|
|
{
|
|
|
|
int pagecount = 20;
|
|
int intPage = 1;
|
|
string state = "-2", key="";
|
|
if (Request.QueryString["page"] != null)
|
|
{
|
|
intPage = Convert.ToInt32(Mtxfw.Utility.Tools.SafeSQL(Request.QueryString["page"].ToString()));
|
|
}
|
|
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
|
sb.Append("UserID='" + Card + "' And IFDelete=0");
|
|
if (Request.QueryString["key"] != null)
|
|
{
|
|
key = Request.QueryString["key"].ToString();
|
|
}
|
|
if (Request.QueryString["s"] != null)
|
|
{
|
|
state = Mtxfw.Utility.Tools.SafeSQL(Request.QueryString["s"].ToString());
|
|
}
|
|
if (state != "-2")
|
|
{
|
|
sb.Append(" and O_Payed='" + state + "'");
|
|
}
|
|
if (!String.IsNullOrEmpty(key))
|
|
{
|
|
sb.Append(" and orderid like '%" + Mtxfw.Utility.Tools.SafeSQL(key) + "%'");
|
|
}
|
|
DataSet ds = daoorder.GetList("", sb.ToString() + " Order by ID desc");
|
|
int strcount = ds.Tables[0].Rows.Count;
|
|
if (strcount > 0)
|
|
{
|
|
int n = 0;
|
|
if (strcount % pagecount == 0)
|
|
{
|
|
n = strcount / pagecount;
|
|
}
|
|
else
|
|
{
|
|
n = strcount / pagecount + 1;
|
|
}
|
|
for (int k = 1; k <= n; k++)
|
|
{
|
|
if (intPage == k)
|
|
{
|
|
if (n == 1)
|
|
{
|
|
ShowPage = "";
|
|
}
|
|
else
|
|
{
|
|
string stru = "/Member_Orders_List.aspx";
|
|
if (Request.QueryString != null)
|
|
{
|
|
string strq = Request.QueryString.ToString();
|
|
if (strq != "")
|
|
{
|
|
if (strq.IndexOf("Page=") != -1)
|
|
{
|
|
stru += "?" + strq.Substring(0, strq.IndexOf("Page="));
|
|
}
|
|
else
|
|
{
|
|
stru += "?" + strq + "&";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
stru += "?";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
stru += "?";
|
|
}
|
|
if (k == 1)
|
|
{
|
|
ShowPage = "首页 上一页 <a href='" + stru + "Page=" + (k + 1) + "' target='_self'>下一页</a> <a href='" + stru + "Page=" + n + "' target='_self'>尾页</a> 第[ 1 ]页,共有[ " + n + " ]页 共[ " + strcount + " ]条";
|
|
}
|
|
else if (k == n)
|
|
{
|
|
ShowPage = "<a href='" + stru + "Page=1' target='_self'>首页</a> <a href='" + stru + "Page=" + (k - 1) + "' target='_self'>上一页</a> 下一页 尾页 第[ " + k + " ]页,共有[ " + n + " ]页 共[ " + strcount + " ]条";
|
|
}
|
|
else
|
|
{
|
|
ShowPage = "<a href='" + stru + "Page=1' target='_self'>首页</a> <a href='" + stru + "Page=" + (k - 1) + "' target='_self'>上一页</a> <a href='" + stru + "Page=" + (k + 1) + "' target='_self'>下一页</a> <a href='" + stru + "Page=" + n + "' target='_self'>尾页</a> 第[ " + k + " ]页,共有[ " + n + " ]页 共[ " + strcount + " ]条";
|
|
}
|
|
}
|
|
|
|
for (int j = pagecount * (k - 1); j < pagecount * k; j++)
|
|
{
|
|
if (j >= ds.Tables[0].Rows.Count)
|
|
{
|
|
break;
|
|
}
|
|
string utype = ds.Tables[0].Rows[j]["utype"].ToString();
|
|
|
|
string O_Id = ds.Tables[0].Rows[j]["id"].ToString();
|
|
string orderid = ds.Tables[0].Rows[j]["orderid"].ToString();
|
|
string ProductID = ds.Tables[0].Rows[j]["pid"].ToString();
|
|
string strUrl = "/view-" + ProductID + ".html";
|
|
string Contactname = ds.Tables[0].Rows[j]["Contactname"].ToString();
|
|
string O_TotalNum = ds.Tables[0].Rows[j]["Totalnum"].ToString();
|
|
string O_TotalMoney = Convert.ToDouble(ds.Tables[0].Rows[j]["Totalprice"]).ToString("f2");
|
|
string O_TotalMoney2 = O_TotalMoney;
|
|
if (Convert.ToDouble(Convert.ToDouble(ds.Tables[0].Rows[j]["Totalprice3"]).ToString("f2")) > 0.00)
|
|
{
|
|
O_TotalMoney += " 使用积分:" + Convert.ToDouble(ds.Tables[0].Rows[j]["Totalprice3"]).ToString("f2");
|
|
O_TotalMoney2 += "<br>使用积分:" + Convert.ToDouble(ds.Tables[0].Rows[j]["Totalprice3"]).ToString("f2");
|
|
}
|
|
string O_Payed = ds.Tables[0].Rows[j]["O_Payed"].ToString();
|
|
string O_Payed_Date = ds.Tables[0].Rows[j]["O_Payed_Date"].ToString();
|
|
string O_Shipped = ds.Tables[0].Rows[j]["O_Shipped"].ToString();
|
|
string O_received = ds.Tables[0].Rows[j]["O_received"].ToString();
|
|
string O_Return = ds.Tables[0].Rows[j]["O_Return"].ToString();
|
|
string O_Returned = ds.Tables[0].Rows[j]["O_Returned"].ToString();
|
|
string O_recReturn = ds.Tables[0].Rows[j]["O_recReturn"].ToString();
|
|
string O_SubmitDate = ds.Tables[0].Rows[j]["O_SubmitDate"].ToString().Replace(" ", "<br>");
|
|
string O_SubmitDate2 = ds.Tables[0].Rows[j]["O_SubmitDate"].ToString();
|
|
string[] strStatus = Mtxfw.Utility.Common.GetOrderStatus(utype, O_Id, O_SubmitDate, O_Payed, O_Payed_Date, 0);
|
|
string strutype = Mtxfw.Utility.Common.cutype(utype);
|
|
|
|
ShowConent += "<ul class=\"toptitle\"><li><label>订单号:</label>" + orderid + " <label>数量:" + O_TotalNum + "</label> <span class=\"show930\"><label>金额:" + O_TotalMoney + "</label></span><br><span class=\"show930\"><label>下单时间:" + O_SubmitDate2 + "</label></span> <span class=\"block310\"><span class=\"show620\"><label>状态:<span id='status_" + O_Id + "'>" + strStatus[0] + "</span></label></span> <span class=\"show620\"><label><span id='cz_" + O_Id + "'>" + strStatus[1] + "</span> <a href=\"Member_Orders_Info.aspx?Id=" + O_Id + "\">查看详情</a></label></span></span></li></ul>\n";
|
|
ShowConent += "<ul class=\"midtitle\"><li class=\"ddxx\">\n";
|
|
System.Data.DataSet Ds_op = daoorderproduct.GetList("(Select utype from P_Product b where b.P_ID=a.pid) as cutype,(Select P_NAME from P_Product b where b.P_ID=a.pid) as prodName,(Select P_images from P_Product b where b.P_ID=a.pid) as prodimg,(Select selcolor from P_Product b where b.P_ID=a.pid) as cselcolor,", "orderid=" + O_Id + " And UserID=" + Card + " And IFDelete=0 Order By SubmitTime asc");
|
|
if (Ds_op.Tables[0].Rows.Count > 0)
|
|
{
|
|
for (int l = 0; l < Ds_op.Tables[0].Rows.Count; l++)
|
|
{
|
|
string prodimg2 = Ds_op.Tables[0].Rows[l]["prodimg"].ToString().Split('|')[0].Split(',')[0];
|
|
string prodid2 = Ds_op.Tables[0].Rows[l]["pid"].ToString();
|
|
string prodName2 = Ds_op.Tables[0].Rows[l]["prodName"].ToString();
|
|
string selcolor2 = Ds_op.Tables[0].Rows[l]["cselcolor"].ToString();
|
|
string Totalnum2 = Ds_op.Tables[0].Rows[l]["Totalnum"].ToString();
|
|
string Totalprice2 = Ds_op.Tables[0].Rows[l]["Totalprice"].ToString();
|
|
string cutype = Ds_op.Tables[0].Rows[l]["cutype"].ToString();
|
|
string strUrl2 = "/view-" + prodid2 + ".html";
|
|
if (cutype == "3")
|
|
{
|
|
|
|
ShowConent += "<div class=\"taocaolist\"><a href='/Member_Orders_List_taocao.aspx?id=" + prodid2 + "' class='black' target='_blank'>" + prodName2 + "</a><br><div class=\"taocaoproducts\">\n";
|
|
System.Data.DataSet tc_op = daoProduct.GetList("", "utype='0' and charindex(',' + Convert(varchar(50),P_ID) + ',',(Select P_CATEGORYs From P_Product b Where P_ID=" + prodid2 + "))>0 And P_State=N'已处理' Order By P_ADDATE asc");
|
|
if (tc_op.Tables[0].Rows.Count > 0)
|
|
{
|
|
for (int o = 0; o < Ds_op.Tables[0].Rows.Count; o++)
|
|
{
|
|
string prodimg3 = tc_op.Tables[0].Rows[o]["P_images"].ToString().Split('|')[0].Split(',')[0];
|
|
string prodid3 = tc_op.Tables[0].Rows[o]["P_ID"].ToString();
|
|
string prodName3 = tc_op.Tables[0].Rows[o]["P_NAME"].ToString();
|
|
string selcolor3 = tc_op.Tables[0].Rows[o]["P_yanse"].ToString();
|
|
string strUrl3 = "/view-" + prodid3 + ".html";
|
|
ShowConent += "<a href='" + strUrl3 + "' class='black' target='_blank' title=\"" + prodName3 + (selcolor3.Split('#')[0] != "" ? "[" + selcolor3.Split('#')[0] + "]" : "") + "\"><img src='" + Mtxfw.Utility.Common.GetCoverPic(prodimg3, "40x40", "cut") + "'/></a>\n";
|
|
}
|
|
}
|
|
tc_op.Clear();
|
|
ShowConent += "</div></div>\n";
|
|
}
|
|
else
|
|
{
|
|
ShowConent += "<a href='" + strUrl2 + "' class='black' target='_blank' title=\"" + prodName2 + (selcolor2.Split('#')[0] != "" ? "[" + selcolor2.Split('#')[0] + "]" : "") + "\"><img src='" + Mtxfw.Utility.Common.GetCoverPic(prodimg2, "60x60", "cut") + "'/></a>\n";
|
|
}
|
|
}
|
|
}
|
|
Ds_op.Clear();
|
|
|
|
ShowConent += "<li class=\"hide930\">" + O_TotalMoney2 + "</li><li class=\"hide930\">" + O_SubmitDate + "</li><li class=\"zt hide620\"><span id='status2_" + O_Id + "'>" + strStatus[0] + "</span></li><li class=\"cz hide620\"><span id='cz2_" + O_Id + "'>" + strStatus[1] + "</span><br><a href=\"Member_Orders_Info.aspx?Id=" + O_Id + "\">查看详情</a></li>\n";
|
|
ShowConent += "</ul>\n";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |