zhoufan il y a 8 ans
Parent
commit
93163f8130

+ 5 - 0
ShopMobile.Bll/PT_Order_Item.cs

@@ -131,7 +131,12 @@ namespace ShopMobile.Bll
131 131
                     {
132 132
                         model.Qty = int.Parse(dt.Rows[n]["Qty"].ToString());
133 133
                     }
134
+                    model.Attrs = dt.Rows[n]["Attrs"].ToString();
134 135
 
136
+                    if (dt.Rows[n]["SpNo"].ToString() != "")
137
+                    {
138
+                        model.SpNo = int.Parse(dt.Rows[n]["SpNo"].ToString());
139
+                    }
135 140
 
136 141
                     modelList.Add(model);
137 142
                 }

+ 17 - 4
ShopMobile.Common/Utils.cs

@@ -53,10 +53,23 @@ namespace ShopMobile.Common
53 53
         #region SHA256加密
54 54
         public static string SHA256(string pwd)
55 55
         {
56
-            byte[] SHA256Data = Encoding.UTF8.GetBytes(pwd);
57
-            SHA256Managed Sha256 = new SHA256Managed();
58
-            byte[] Result = Sha256.ComputeHash(SHA256Data);
59
-            return Convert.ToBase64String(Result);  //返回长度为44字节的字符串
56
+            //byte[] SHA256Data = Encoding.UTF8.GetBytes(pwd);
57
+            //SHA256Managed Sha256 = new SHA256Managed();
58
+            //byte[] Result = Sha256.ComputeHash(SHA256Data);
59
+            //return Convert.ToBase64String(Result);  //返回长度为44字节的字符串
60
+            using (SHA256Managed sha256 = new SHA256Managed())
61
+            {
62
+                var hash = sha256.ComputeHash(Encoding.UTF8.GetBytes(pwd));
63
+                var sb = new StringBuilder(hash.Length * 2);
64
+
65
+                foreach (byte b in hash)
66
+                {
67
+                    sb.Append(b.ToString("x2"));
68
+                }
69
+
70
+                return sb.ToString();
71
+            }
72
+
60 73
         }
61 74
         public static string SHA1(string pwd)
62 75
         {

+ 6 - 6
ShopMobile.Dal/PT_Order_Header.cs

@@ -48,7 +48,7 @@ namespace ShopMobile.Dal
48 48
                         new SqlParameter("@ExpressTime", SqlDbType.DateTime) ,
49 49
                         new SqlParameter("@QHPeople", SqlDbType.VarChar,50) ,
50 50
                         new SqlParameter("@OrderID", SqlDbType.VarChar,30) ,
51
-                        new SqlParameter("@QHRemark", SqlDbType.VarChar,500) ,
51
+                        new SqlParameter("@QHRemark", SqlDbType.VarChar,-1) ,
52 52
                         new SqlParameter("@DiscountNo", SqlDbType.VarChar,50) ,
53 53
                         new SqlParameter("@DiscountPrice", SqlDbType.Decimal,9) ,
54 54
                         new SqlParameter("@Points", SqlDbType.Decimal,9) ,
@@ -59,7 +59,7 @@ namespace ShopMobile.Dal
59 59
                         new SqlParameter("@InvoiceTitle", SqlDbType.VarChar,50) ,
60 60
                         new SqlParameter("@InvoiceContent", SqlDbType.VarChar,50) ,
61 61
                         new SqlParameter("@Receiver", SqlDbType.VarChar,30) ,
62
-                        new SqlParameter("@OrderMemo", SqlDbType.VarChar,200) ,
62
+                        new SqlParameter("@OrderMemo", SqlDbType.VarChar,-1) ,
63 63
                         new SqlParameter("@CreateUser", SqlDbType.VarChar,30) ,
64 64
                         new SqlParameter("@CreateTime", SqlDbType.DateTime) ,
65 65
                         new SqlParameter("@PayTime", SqlDbType.DateTime) ,
@@ -136,7 +136,7 @@ namespace ShopMobile.Dal
136 136
                         new SqlParameter("@ExpressTime", SqlDbType.DateTime) ,
137 137
                         new SqlParameter("@QHPeople", SqlDbType.VarChar,50) ,
138 138
                         new SqlParameter("@OrderID", SqlDbType.VarChar,30) ,
139
-                        new SqlParameter("@QHRemark", SqlDbType.VarChar,500) ,
139
+                        new SqlParameter("@QHRemark", SqlDbType.VarChar,-1) ,
140 140
                         new SqlParameter("@DiscountNo", SqlDbType.VarChar,50) ,
141 141
                         new SqlParameter("@DiscountPrice", SqlDbType.Decimal,9) ,
142 142
                         new SqlParameter("@Points", SqlDbType.Decimal,9) ,
@@ -147,7 +147,7 @@ namespace ShopMobile.Dal
147 147
                         new SqlParameter("@InvoiceTitle", SqlDbType.VarChar,50) ,
148 148
                         new SqlParameter("@InvoiceContent", SqlDbType.VarChar,50) ,
149 149
                         new SqlParameter("@Receiver", SqlDbType.VarChar,30) ,
150
-                        new SqlParameter("@OrderMemo", SqlDbType.VarChar,200) ,
150
+                        new SqlParameter("@OrderMemo", SqlDbType.VarChar,-1) ,
151 151
                         new SqlParameter("@CreateUser", SqlDbType.VarChar,30) ,
152 152
                         new SqlParameter("@CreateTime", SqlDbType.DateTime) ,
153 153
                         new SqlParameter("@PayTime", SqlDbType.DateTime) ,
@@ -260,7 +260,7 @@ namespace ShopMobile.Dal
260 260
                         new SqlParameter("@ExpressTime", SqlDbType.DateTime) ,
261 261
                         new SqlParameter("@QHPeople", SqlDbType.VarChar,50) ,
262 262
                         new SqlParameter("@OrderID", SqlDbType.VarChar,30) ,
263
-                        new SqlParameter("@QHRemark", SqlDbType.VarChar,500) ,
263
+                        new SqlParameter("@QHRemark", SqlDbType.VarChar,-1) ,
264 264
                         new SqlParameter("@DiscountNo", SqlDbType.VarChar,50) ,
265 265
                         new SqlParameter("@DiscountPrice", SqlDbType.Decimal,9) ,
266 266
                         new SqlParameter("@Points", SqlDbType.Decimal,9) ,
@@ -271,7 +271,7 @@ namespace ShopMobile.Dal
271 271
                         new SqlParameter("@InvoiceTitle", SqlDbType.VarChar,50) ,
272 272
                         new SqlParameter("@InvoiceContent", SqlDbType.VarChar,50) ,
273 273
                         new SqlParameter("@Receiver", SqlDbType.VarChar,30) ,
274
-                        new SqlParameter("@OrderMemo", SqlDbType.VarChar,200) ,
274
+                        new SqlParameter("@OrderMemo", SqlDbType.VarChar,-1) ,
275 275
                         new SqlParameter("@CreateUser", SqlDbType.VarChar,30) ,
276 276
                         new SqlParameter("@CreateTime", SqlDbType.DateTime) ,
277 277
                         new SqlParameter("@PayTime", SqlDbType.DateTime) ,

+ 28 - 10
ShopMobile.Dal/PT_Order_Item.cs

@@ -33,9 +33,9 @@ namespace ShopMobile.Dal
33 33
         {
34 34
             StringBuilder strSql = new StringBuilder();
35 35
             strSql.Append("insert into PT_Order_Item(");
36
-            strSql.Append("CreateUser,CreateTime,OrderID,PID,Title,ImgUrl,Price1,Price2,Price3,Qty");
36
+            strSql.Append("CreateUser,CreateTime,OrderID,PID,Title,ImgUrl,Price1,Price2,Price3,Qty,Attrs,SpNo");
37 37
             strSql.Append(") values (");
38
-            strSql.Append("@CreateUser,@CreateTime,@OrderID,@PID,@Title,@ImgUrl,@Price1,@Price2,@Price3,@Qty");
38
+            strSql.Append("@CreateUser,@CreateTime,@OrderID,@PID,@Title,@ImgUrl,@Price1,@Price2,@Price3,@Qty,@Attrs,@SpNo");
39 39
             strSql.Append(") ");
40 40
             strSql.Append(";select @@IDENTITY");
41 41
             SqlParameter[] parameters = {
@@ -48,7 +48,9 @@ namespace ShopMobile.Dal
48 48
                         new SqlParameter("@Price1", SqlDbType.Decimal,9) ,
49 49
                         new SqlParameter("@Price2", SqlDbType.Decimal,9) ,
50 50
                         new SqlParameter("@Price3", SqlDbType.Decimal,9) ,
51
-                        new SqlParameter("@Qty", SqlDbType.Int,4)
51
+                        new SqlParameter("@Qty", SqlDbType.Int,4),
52
+                        new SqlParameter("@Attrs", SqlDbType.VarChar,-1),
53
+                        new SqlParameter("@SpNo", SqlDbType.Int,4)
52 54
 
53 55
             };
54 56
 
@@ -62,6 +64,8 @@ namespace ShopMobile.Dal
62 64
             parameters[7].Value = model.Price2;
63 65
             parameters[8].Value = model.Price3;
64 66
             parameters[9].Value = model.Qty;
67
+            parameters[10].Value = model.Attrs;
68
+            parameters[11].Value = model.SpNo;
65 69
 
66 70
             object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
67 71
             if (obj == null)
@@ -84,9 +88,9 @@ namespace ShopMobile.Dal
84 88
         {
85 89
             StringBuilder strSql = new StringBuilder();
86 90
             strSql.Append("insert into PT_Order_Item(");
87
-            strSql.Append("CreateUser,CreateTime,OrderID,PID,Title,ImgUrl,Price1,Price2,Price3,Qty");
91
+            strSql.Append("CreateUser,CreateTime,OrderID,PID,Title,ImgUrl,Price1,Price2,Price3,Qty,Attrs,SpNo");
88 92
             strSql.Append(") values (");
89
-            strSql.Append("@CreateUser,@CreateTime,@OrderID,@PID,@Title,@ImgUrl,@Price1,@Price2,@Price3,@Qty");
93
+            strSql.Append("@CreateUser,@CreateTime,@OrderID,@PID,@Title,@ImgUrl,@Price1,@Price2,@Price3,@Qty,@Attrs,@SpNo");
90 94
             strSql.Append(") ");
91 95
             strSql.Append(";select @@IDENTITY");
92 96
             SqlParameter[] parameters = {
@@ -99,7 +103,9 @@ namespace ShopMobile.Dal
99 103
                         new SqlParameter("@Price1", SqlDbType.Decimal,9) ,
100 104
                         new SqlParameter("@Price2", SqlDbType.Decimal,9) ,
101 105
                         new SqlParameter("@Price3", SqlDbType.Decimal,9) ,
102
-                        new SqlParameter("@Qty", SqlDbType.Int,4)
106
+                        new SqlParameter("@Qty", SqlDbType.Int,4),
107
+                        new SqlParameter("@Attrs", SqlDbType.VarChar,-1),
108
+                        new SqlParameter("@SpNo", SqlDbType.Int,4)
103 109
 
104 110
             };
105 111
 
@@ -113,6 +119,8 @@ namespace ShopMobile.Dal
113 119
             parameters[7].Value = model.Price2;
114 120
             parameters[8].Value = model.Price3;
115 121
             parameters[9].Value = model.Qty;
122
+            parameters[10].Value = model.Attrs;
123
+            parameters[11].Value = model.SpNo;
116 124
 
117 125
             CommandInfo cio = new CommandInfo();
118 126
             cio.CommandText = strSql.ToString();
@@ -139,7 +147,9 @@ namespace ShopMobile.Dal
139 147
             strSql.Append(" Price1 = @Price1 , ");
140 148
             strSql.Append(" Price2 = @Price2 , ");
141 149
             strSql.Append(" Price3 = @Price3 , ");
142
-            strSql.Append(" Qty = @Qty  ");
150
+            strSql.Append(" Qty = @Qty , ");
151
+            strSql.Append(" Attrs=@Attrs ,");
152
+            strSql.Append(" SpNo=@SpNo ");
143 153
             strSql.Append(" where ID=@ID ");
144 154
 
145 155
             SqlParameter[] parameters = {
@@ -153,7 +163,9 @@ namespace ShopMobile.Dal
153 163
                         new SqlParameter("@Price1", SqlDbType.Decimal,9) ,
154 164
                         new SqlParameter("@Price2", SqlDbType.Decimal,9) ,
155 165
                         new SqlParameter("@Price3", SqlDbType.Decimal,9) ,
156
-                        new SqlParameter("@Qty", SqlDbType.Int,4)
166
+                        new SqlParameter("@Qty", SqlDbType.Int,4),
167
+                        new SqlParameter("@Attrs", SqlDbType.VarChar,-1),
168
+                        new SqlParameter("@SpNo", SqlDbType.Int,4)
157 169
 
158 170
             };
159 171
 
@@ -168,6 +180,8 @@ namespace ShopMobile.Dal
168 180
             parameters[8].Value = model.Price2;
169 181
             parameters[9].Value = model.Price3;
170 182
             parameters[10].Value = model.Qty;
183
+            parameters[11].Value = model.Attrs;
184
+            parameters[12].Value = model.SpNo;
171 185
             int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
172 186
             if (rows > 0)
173 187
             {
@@ -233,7 +247,7 @@ namespace ShopMobile.Dal
233 247
         {
234 248
 
235 249
             StringBuilder strSql = new StringBuilder();
236
-            strSql.Append("select ID, CreateUser, CreateTime, OrderID, PID, Title, ImgUrl, Price1, Price2, Price3, Qty  ");
250
+            strSql.Append("select *  ");
237 251
             strSql.Append("  from PT_Order_Item ");
238 252
             strSql.Append(" where ID=@ID");
239 253
             SqlParameter[] parameters = {
@@ -279,7 +293,11 @@ namespace ShopMobile.Dal
279 293
                 {
280 294
                     model.Qty = int.Parse(ds.Tables[0].Rows[0]["Qty"].ToString());
281 295
                 }
282
-
296
+                model.Attrs = ds.Tables[0].Rows[0]["Attrs"].ToString();
297
+                if (ds.Tables[0].Rows[0]["SpNo"].ToString() != "")
298
+                {
299
+                    model.SpNo = int.Parse(ds.Tables[0].Rows[0]["SpNo"].ToString());
300
+                }
283 301
                 return model;
284 302
             }
285 303
             else

+ 2 - 2
ShopMobile.Dal/PT_Pro_Product.cs

@@ -58,7 +58,7 @@ namespace ShopMobile.Dal
58 58
                         new SqlParameter("@SpNo", SqlDbType.Int,4) ,
59 59
                         new SqlParameter("@SPPrice", SqlDbType.Decimal,9) ,
60 60
                         new SqlParameter("@SpBQ", SqlDbType.VarChar,500) ,
61
-                        new SqlParameter("@Title", SqlDbType.VarChar,100) ,
61
+                        new SqlParameter("@Title", SqlDbType.VarChar,-1) ,
62 62
                         new SqlParameter("@ImgUrl", SqlDbType.VarChar,2000) ,
63 63
                         new SqlParameter("@ImgUrl1", SqlDbType.VarChar,100)
64 64
 
@@ -155,7 +155,7 @@ namespace ShopMobile.Dal
155 155
                         new SqlParameter("@SpNo", SqlDbType.Int,4) ,
156 156
                         new SqlParameter("@SPPrice", SqlDbType.Decimal,9) ,
157 157
                         new SqlParameter("@SpBQ", SqlDbType.VarChar,500) ,
158
-                        new SqlParameter("@Title", SqlDbType.VarChar,100) ,
158
+                        new SqlParameter("@Title", SqlDbType.VarChar,-1) ,
159 159
                         new SqlParameter("@ImgUrl", SqlDbType.VarChar,2000) ,
160 160
                         new SqlParameter("@ImgUrl1", SqlDbType.VarChar,100)
161 161
 

+ 13 - 1
ShopMobile.Model/PT_Order_Item.cs

@@ -73,5 +73,17 @@ namespace ShopMobile.Model
73 73
 		[DisplayName("CreateTime")]
74 74
 		public DateTime? CreateTime { get; set; }
75 75
 
76
-	}
76
+        /// <summary>
77
+		/// Attrs
78
+		/// </summary>
79
+		[DisplayName("Attrs")]
80
+        public string Attrs { get; set; }
81
+
82
+        /// <summary>
83
+		/// SpNo
84
+		/// </summary>
85
+		[DisplayName("SpNo")]
86
+        public int? SpNo { get; set; }
87
+
88
+    }
77 89
 }

+ 1 - 1
ShopMobile/Admin/Defult.Master

@@ -80,7 +80,7 @@
80 80
                         <li><a href="UserList.aspx"><i class="icon-user"></i><span class="menu-text">用户管理</span></a></li>
81 81
                         <li><a href="ProductCategoryList.aspx"><i class="icon-user"></i><span class="menu-text">分类管理</span></a></li>
82 82
                         <li><a href="ProductList.aspx"><i class="icon-home"></i><span class="menu-text">商品管理</span></a></li>
83
-
83
+                        <li><a href="ProductListOther.aspx"><i class="icon-home"></i><span class="menu-text">转换商品管理</span></a></li>
84 84
                         <li><a><span class="menu-text">====可爱的分割线====</span></a></li>
85 85
                         <li><a href="AdminUserList.aspx"><i class="icon-cogs"></i><span class="menu-text">管理员管理</span></a></li>
86 86
 

+ 3 - 3
ShopMobile/Admin/Defult.Master.cs

@@ -15,7 +15,7 @@ namespace ShopMobile.Admin
15 15
         {
16 16
             if (Request.Cookies["admin"] == null)
17 17
             {
18
-                Response.Redirect("login.aspx");
18
+                Response.Redirect("/Admin/login.aspx");
19 19
             }
20 20
             else
21 21
             {
@@ -29,12 +29,12 @@ namespace ShopMobile.Admin
29 29
                     {
30 30
                         CookieUtil.RemoveCookie("admin");
31 31
 
32
-                        Response.Redirect("Login.aspx");
32
+                        Response.Redirect("/Admin/Login.aspx");
33 33
                     }
34 34
                 }
35 35
                 catch
36 36
                 {
37
-                    Response.Redirect("Login.aspx");
37
+                    Response.Redirect("/Admin/Login.aspx");
38 38
                 }
39 39
             }
40 40
 

+ 7 - 1
ShopMobile/Admin/ProductList.aspx

@@ -15,10 +15,16 @@
15 15
                 <div class="row">
16 16
                     <div class="col-xs-8">
17 17
                         商品名称:<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
18
+                        上架状态:
19
+                        <asp:DropDownList ID="ddlzt" runat="server">
20
+                            <asp:ListItem></asp:ListItem>
21
+                            <asp:ListItem Value="1">上架</asp:ListItem>
22
+                            <asp:ListItem Value="0">下架</asp:ListItem>
23
+                        </asp:DropDownList>
18 24
                     </div>
19 25
                     <div class="col-xs-4">
20 26
                         <asp:Button ID="btnsearch" runat="server" Text="搜索" OnClick="btnsearch_Click" />
21
-                        <asp:Button ID="btn" runat="server" Text="同步商品" OnClick="btn_Click" />
27
+                        <%--<asp:Button ID="btn" runat="server" Text="同步商品" OnClick="btn_Click" />--%>
22 28
                     </div>
23 29
                 </div>
24 30
                 

+ 10 - 30
ShopMobile/Admin/ProductList.aspx.cs

@@ -74,10 +74,16 @@ namespace ShopMobile.Admin
74 74
 
75 75
             if (!string.IsNullOrEmpty(Request.QueryString["zh"]))
76 76
             {
77
-                _search = _search + " and Title like '%" + Request.QueryString["zh"] + "%'";
77
+               _search = _search + " and Title like '%" + Request.QueryString["zh"] + "%'";
78 78
                 txtname.Text = Request.QueryString["zh"];
79 79
             }
80 80
 
81
+            if (!string.IsNullOrEmpty(Request.QueryString["zt"]))
82
+            {
83
+                _search = _search + " and IsSelf = '" + Request.QueryString["zt"] + "'";
84
+                ddlzt.SelectedValue= Request.QueryString["zt"];
85
+            }
86
+
81 87
             RpList.DataSource = Paginator.MyExecutePage("*", "[PT_Pro_Product]", _search,"id", "id desc", PageIndex, PageSize, out RecordCount, out PageCount);
82 88
             paging = Paginator.Pagination(PageIndex, PageCount, RecordCount);
83 89
             RpList.DataBind();
@@ -86,41 +92,15 @@ namespace ShopMobile.Admin
86 92
         protected void btnsearch_Click(object sender, EventArgs e)
87 93
         {
88 94
             string strzh = txtname.Text.Trim();
95
+            string strzt = ddlzt.SelectedValue;
89 96
 
90 97
             string _url = HttpContext.Current.Request.Url.AbsoluteUri;
91 98
             if (_url.IndexOf('?') != -1)
92 99
             {
93
-                if (_url.Contains("&Page="))
94
-                {
95
-                    _url = _url.Remove(_url.LastIndexOf("&"));
96
-                    _url = _url + "&";
97
-                }
98
-                else if (_url.Contains("?Page="))
99
-                {
100
-                    _url = _url.Remove(_url.LastIndexOf("?"));
101
-                    _url = _url + "?";
102
-                }
103
-                if (_url.Contains("&zh="))
104
-                {
105
-                    _url = _url.Remove(_url.LastIndexOf("&zh="));
106
-                    _url = _url + "&";
107
-                }
108
-                else if (_url.Contains("?zh="))
109
-                {
110
-                    _url = _url.Remove(_url.LastIndexOf("?"));
111
-                    _url = _url + "?";
112
-                }
113
-                else
114
-                {
115
-                    _url = _url + "&";
116
-                }
117
-            }
118
-            else
119
-            {
120
-                _url = _url + "?";
100
+                _url = _url.Remove(_url.LastIndexOf("?"));
121 101
             }
122 102
 
123
-            _url = _url + "zh=" + strzh ;
103
+            _url = _url+ "?zh=" + strzh +"&zt="+ strzt;
124 104
             Response.Redirect(_url);
125 105
         }
126 106
 

+ 4 - 4
ShopMobile/Admin/ProductList.aspx.designer.cs

@@ -22,22 +22,22 @@ namespace ShopMobile.Admin {
22 22
         protected global::System.Web.UI.WebControls.TextBox txtname;
23 23
         
24 24
         /// <summary>
25
-        /// btnsearch 控件。
25
+        /// ddlzt 控件。
26 26
         /// </summary>
27 27
         /// <remarks>
28 28
         /// 自动生成的字段。
29 29
         /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
30 30
         /// </remarks>
31
-        protected global::System.Web.UI.WebControls.Button btnsearch;
31
+        protected global::System.Web.UI.WebControls.DropDownList ddlzt;
32 32
         
33 33
         /// <summary>
34
-        /// btn 控件。
34
+        /// btnsearch 控件。
35 35
         /// </summary>
36 36
         /// <remarks>
37 37
         /// 自动生成的字段。
38 38
         /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
39 39
         /// </remarks>
40
-        protected global::System.Web.UI.WebControls.Button btn;
40
+        protected global::System.Web.UI.WebControls.Button btnsearch;
41 41
         
42 42
         /// <summary>
43 43
         /// RpList 控件。

+ 96 - 0
ShopMobile/Admin/ProductListOther.aspx

@@ -0,0 +1,96 @@
1
+<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Defult.Master" AutoEventWireup="true" CodeBehind="ProductListOther.aspx.cs" Inherits="ShopMobile.Admin.ProductListOther" %>
2
+
3
+<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
4
+</asp:Content>
5
+<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
6
+    <div class="page-content">
7
+        <div class="page-header">
8
+            <h1>转换商品列表
9
+            </h1>
10
+        </div>
11
+        <div class="row">
12
+            <div class="col-xs-12" style="margin-bottom: 10px;">
13
+                <div class="row">
14
+                    <div class="col-xs-8">
15
+                        商品名称:<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
16
+                    </div>
17
+                    <div class="col-xs-4">
18
+                        <asp:Button ID="btnsearch" runat="server" Text="搜索" OnClick="btnsearch_Click" />
19
+                    </div>
20
+                </div>
21
+            </div>
22
+            <div class="col-xs-12">
23
+                <div class="table-responsive">
24
+                    <table id="sample-table-1" class="table table-striped table-bordered table-hover">
25
+                        <thead>
26
+                            <tr>
27
+                                <th>编号
28
+                                </th>
29
+                                <th>名称
30
+                                </th>
31
+                                <th>价格
32
+                                </th>
33
+                                <th>图片
34
+                                </th>
35
+                                <th>品牌
36
+                                </th>
37
+                                <th>状态
38
+                                </th>
39
+                                <th>操作
40
+                                </th>
41
+                            </tr>
42
+                        </thead>
43
+                        <tbody>
44
+                            <asp:Repeater ID="RpList" runat="server" OnItemCommand="RpList_ItemCommand">
45
+                                <ItemTemplate>
46
+                                    <tr>
47
+                                        <td>
48
+                                            <%#Eval("ProductSysNo") %>
49
+                                        </td>
50
+                                        <td>
51
+                                            <%#Eval("ProductName") %>
52
+                                        </td>
53
+                                        <td>
54
+                                            <%#Eval("ProductPrice") %>
55
+                                        </td>
56
+                                        <td>
57
+                                            <img src='<%#Eval("AppActiveProductImg") %>' style="height: 50px;" />
58
+                                        </td>
59
+                                        <td>
60
+                                            <%#Eval("Brand_Name") %>
61
+                                        </td>
62
+                                        <td>
63
+                                            <%#Eval("Status").ToString()=="3"?"上架":"<span style='color:red'>下架</span>" %>
64
+                                        </td>
65
+                                        <td>
66
+                                            <%--<a href="?Action=export&Id=<%#Eval("ProductSysNo") %>" title="导入" onclick="return confirm('确定要导入吗?')">导入本地商品库
67
+                                            </a>--%>
68
+                                            <asp:LinkButton ID="lbexport" CommandName="export" CommandArgument='<%#Eval("ProductSysNo") %>' OnClientClick="return confirm('确定要导入吗?')" runat="server" >导入本地商品库</asp:LinkButton>
69
+                                        </td>
70
+                                    </tr>
71
+                                </ItemTemplate>
72
+                            </asp:Repeater>
73
+                        </tbody>
74
+                    </table>
75
+                    <div class="row">
76
+                        <div class="col-sm-6">
77
+                        </div>
78
+                        <div class="col-sm-6">
79
+                            <div class="dataTables_paginate paging_bootstrap">
80
+                                <ul class="pagination">
81
+                                    <li class="active">
82
+                                        <%=paging %></li>
83
+                                </ul>
84
+                            </div>
85
+                        </div>
86
+                    </div>
87
+                </div>
88
+                <!-- /.table-responsive -->
89
+            </div>
90
+            <!-- /span -->
91
+        </div>
92
+        <!-- /.row -->
93
+    </div>
94
+</asp:Content>
95
+<asp:Content ID="Content3" ContentPlaceHolderID="otherjquery" runat="server">
96
+</asp:Content>

+ 140 - 0
ShopMobile/Admin/ProductListOther.aspx.cs

@@ -0,0 +1,140 @@
1
+using Newtonsoft.Json;
2
+using Newtonsoft.Json.Linq;
3
+using ShopMobile.Admin.common;
4
+using ShopMobile.Common;
5
+using System;
6
+using System.Collections.Generic;
7
+using System.Linq;
8
+using System.Web;
9
+using System.Web.UI;
10
+using System.Web.UI.WebControls;
11
+
12
+namespace ShopMobile.Admin
13
+{
14
+    public partial class ProductListOther : BasePage
15
+    {
16
+        public string paging;
17
+
18
+        protected void Page_Load(object sender, EventArgs e)
19
+        {
20
+            if (!IsPostBack)
21
+            {
22
+                bind();
23
+            }
24
+        }
25
+
26
+        protected void bind()
27
+        {
28
+
29
+            string url = CommFun.GetConfigString("shopurl").ToString();
30
+            string appkey = CommFun.GetConfigString("appkey").ToString();
31
+            string userkey = "&" + CommFun.GetConfigString("userkey").ToString();
32
+
33
+            int page = CommFun.RequestInt("Page", 1);
34
+            int pageindex = 10;
35
+
36
+            string key = CommFun.QueryString("zh");
37
+            txtname.Text = key;
38
+
39
+            try
40
+            {
41
+                var strdate = DateTime.Now.ToString("yyyyMMddHHmmss");
42
+                string strdata = "app_key=" + appkey + "&format=json&KeyWord=" + key + "&PageCount=" + pageindex
43
+                    + "&PageIndex=" + page + "&sign_method=md5&timestamp=" + strdate
44
+                    + "&sign=" + Utils.MD5(appkey + "json" + key + pageindex + page + "md5" + strdate + userkey).ToLower();
45
+                string result = CommFun.Get(url + "/v2/By/Products", strdata);
46
+                JObject res = JsonConvert.DeserializeObject(result) as JObject;
47
+                JObject ret = JsonConvert.DeserializeObject(res["Result"].ToString()) as JObject;
48
+                JObject con = JsonConvert.DeserializeObject(res["Content"].ToString()) as JObject;
49
+                if (ret["code"].ToString() == "1001")
50
+                {
51
+                    int tc = Int32.Parse(con["TotalCount"].ToString());
52
+                    int pc = Int32.Parse(Math.Ceiling(decimal.Parse(tc.ToString()) / pageindex).ToString());
53
+                    paging = Paginator.Pagination(page, pc, tc);
54
+                    ViewState["list"] = con["Products"].ToString();
55
+                    List<JObject> list = JsonConvert.DeserializeObject<List<JObject>>(con["Products"].ToString());
56
+
57
+                    RpList.DataSource = list.ToArray();
58
+                    RpList.DataBind();
59
+                }
60
+            }
61
+            catch (Exception ex)
62
+            { }
63
+        }
64
+
65
+        protected void btnsearch_Click(object sender, EventArgs e)
66
+        {
67
+            string strzh = txtname.Text.Trim();
68
+
69
+            string _url = HttpContext.Current.Request.Url.AbsoluteUri;
70
+            if (_url.IndexOf('?') != -1)
71
+            {
72
+                _url = _url.Remove(_url.LastIndexOf("?"));
73
+            }
74
+            _url = _url + "?";
75
+
76
+            _url = _url + "zh=" + strzh;
77
+            Response.Redirect(_url);
78
+        }
79
+
80
+        protected void RpList_ItemCommand(object source, RepeaterCommandEventArgs e)
81
+        {
82
+            if (e.CommandName == "export")
83
+            {
84
+                int _id = Int32.Parse(e.CommandArgument.ToString());
85
+                if (_id > 0)
86
+                {
87
+                    List<JObject> list = JsonConvert.DeserializeObject<List<JObject>>((string)ViewState["list"]);
88
+                    JObject obj = new JObject();
89
+                    foreach (JObject l in list)
90
+                    {
91
+                        if (l["ProductSysNo"].ToString() == _id.ToString())
92
+                        {
93
+                            obj = l;
94
+                            break;
95
+                        }
96
+                    }
97
+
98
+                    Model.PT_Pro_Product model = new Bll.PT_Pro_Product().GetModelBySpNo(_id);
99
+                    if (model == null)
100
+                    {
101
+                        Model.PT_Pro_Product pt = new Model.PT_Pro_Product();
102
+                        pt.Title = obj["ProductName"].ToString();
103
+                        pt.SPPrice = decimal.Parse(obj["ProductPrice"].ToString());
104
+                        pt.ImgUrl1 = obj["AppActiveProductImg"].ToString();
105
+                        pt.Category = Int32.Parse(obj["Product_C3SysNo"].ToString());
106
+                        pt.SpNo = Int32.Parse(obj["ProductSysNo"].ToString());
107
+                        pt.Status = Int32.Parse(obj["Status"].ToString());
108
+                        pt.Brand = obj["Brand_Name"].ToString();
109
+
110
+                        pt.Type = 1;
111
+                        pt.IsSelf = 0;
112
+                        pt.Deleted = 0;
113
+                        pt.CreateUser = uModel.UserName;
114
+                        pt.CreateTime = DateTime.Now;
115
+
116
+                        new Bll.PT_Pro_Product().Add(pt);
117
+                    }
118
+                    else
119
+                    {
120
+                        model.Title = obj["ProductName"].ToString();
121
+                        model.SPPrice = decimal.Parse(obj["ProductPrice"].ToString());
122
+                        model.ImgUrl1 = obj["AppActiveProductImg"].ToString();
123
+                        model.Category = Int32.Parse(obj["Product_C3SysNo"].ToString());
124
+                        model.SpNo = Int32.Parse(obj["ProductSysNo"].ToString());
125
+                        model.Status = Int32.Parse(obj["Status"].ToString());
126
+                        model.Brand = obj["Brand_Name"].ToString();
127
+
128
+                        new Bll.PT_Pro_Product().Update(model);
129
+                    }
130
+
131
+                    Common.MessageBox.Show(this, "导入完成");
132
+                }
133
+                else
134
+                {
135
+                    Common.MessageBox.Show(this, "导入失败");
136
+                }
137
+            }
138
+        }
139
+    }
140
+}

+ 42 - 0
ShopMobile/Admin/ProductListOther.aspx.designer.cs

@@ -0,0 +1,42 @@
1
+//------------------------------------------------------------------------------
2
+// <自动生成>
3
+//     此代码由工具生成。
4
+//
5
+//     对此文件的更改可能导致不正确的行为,如果
6
+//     重新生成代码,则所做更改将丢失。
7
+// </自动生成>
8
+//------------------------------------------------------------------------------
9
+
10
+namespace ShopMobile.Admin {
11
+    
12
+    
13
+    public partial class ProductListOther {
14
+        
15
+        /// <summary>
16
+        /// txtname 控件。
17
+        /// </summary>
18
+        /// <remarks>
19
+        /// 自动生成的字段。
20
+        /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
21
+        /// </remarks>
22
+        protected global::System.Web.UI.WebControls.TextBox txtname;
23
+        
24
+        /// <summary>
25
+        /// btnsearch 控件。
26
+        /// </summary>
27
+        /// <remarks>
28
+        /// 自动生成的字段。
29
+        /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
30
+        /// </remarks>
31
+        protected global::System.Web.UI.WebControls.Button btnsearch;
32
+        
33
+        /// <summary>
34
+        /// RpList 控件。
35
+        /// </summary>
36
+        /// <remarks>
37
+        /// 自动生成的字段。
38
+        /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
39
+        /// </remarks>
40
+        protected global::System.Web.UI.WebControls.Repeater RpList;
41
+    }
42
+}

+ 1 - 1
ShopMobile/Admin/common/BasePage.cs

@@ -15,7 +15,7 @@ namespace ShopMobile.Admin.common
15 15
             //验证登录权限
16 16
             if (Request.Cookies["admin"] == null)
17 17
             {
18
-                Response.Redirect("/Login.aspx", true);
18
+                Response.Redirect("/Admin/Login.aspx", true);
19 19
 
20 20
             }
21 21
             else

+ 31 - 25
ShopMobile/Mobile/View/Order.html

@@ -27,25 +27,18 @@
27 27
             },
28 28
             GetAllPrice: function () {
29 29
                 var pri = 0;
30
-                $(model.ctData).each(function (i, n) {
31
-                    if (n.isxz) {
32
-                        pri = pri * 1 + n.qty * n.price;
33
-                    }
30
+                $(model.ctData).each(function (j, m) {
31
+                    $(m.items).each(function (i, n) {
32
+                        if (n.isxz) {
33
+                            pri = pri * 1 + n.qty * n.price;
34
+                        }
35
+                    })
34 36
                 })
35 37
                 return pri;
36 38
             },
37 39
             AllPrice: 0,
38
-            //KYJF: "0",
39
-            remark:"",
40 40
             PostDD: function () {
41
-                var ids = "";
42
-                $(model.ctData).each(function (i, n) {
43
-                    ids = ids + n.pid + "_" + n.qty + ",";
44
-                })
45
-                if (ids) {
46
-                    ids = ids.substring(0, ids.length - 1)
47
-                }
48
-                else {
41
+                if (model.ctData.length==0) {
49 42
                     common.alert("未选择商品!", "warn");
50 43
                     return;
51 44
                 }
@@ -53,9 +46,9 @@
53 46
                     common.alert("请选择收货地址!", "warn");
54 47
                     return;
55 48
                 }
56
-                if (ids && model.dzData.ID) {
49
+                if ( model.dzData.ID) {
57 50
                     var date = common.getnowdate("yyyyMMddHHmmss");
58
-                    var strdata = { action: "order_addorder", "ids": ids, "addid": model.dzData.ID, "remark": model.remark, timestamp: date };
51
+                    var strdata = { action: "order_addorder", "ids": JSON.stringify(model.ctData.$model), "addid": model.dzData.ID, timestamp: date };
59 52
                     var sign = common.getsign(JSON.stringify(strdata));
60 53
                     var data = JSON.parse(JSON.stringify(strdata));
61 54
                     data.sign = sign;
@@ -66,7 +59,12 @@
66 59
                             $(".ui-btn-wrap").remove();
67 60
                             common.delxzcart();
68 61
                             common.alert("提交订单成功", "success", function () {
69
-                                window.location.href = 'OrderDatail.html?oid=' + datamodel.result1;
62
+                                if (model.ctData.length > 0) {
63
+                                    window.location.href = 'OrderDatail.html?oid=' + datamodel.result1;
64
+                                }
65
+                                else {
66
+                                    window.location.href = 'UserOrder.html';
67
+                                }
70 68
                             })
71 69
                         }
72 70
                     })
@@ -133,19 +131,32 @@
133 131
             <div class="ui-form-item ui-form-item-order ui-border-b">
134 132
                 <a>商品明细</a>
135 133
             </div>
136
-            <ul class="ui-list ui-list-text ui-border-b" style="margin-bottom:0px">
137
-                <li ms-repeat-el="ctData" ms-class-1="ui-border-t:!$first" style="padding:0;">
134
+            <ul class="ui-list ui-list-text ui-border-b" style="margin-bottom:0px" ms-repeat-elt="ctData">
135
+                <li>商家{{$index+1}}</li>
136
+                <li ms-repeat-el="elt.items" class="ui-border-t" >
138 137
                     <div class="ui-list-thumb ">
139 138
                         <img ms-src="el.imgurl" style="width:50px;" />
140 139
                     </div>
141 140
                     <div class="ui-list-info">
142 141
                         <h4 class="ui-nowrap">{{el.title}}</h4>
142
+                        <div class="ui-row-flex" ms-visible="el.group.length>0">
143
+                            <div class="ui-col ui-col" style="color: #777;font-size: 14px;" ms-repeat-item="el.group">{{item.key+':'+item.value}}</div>
144
+                        </div>
143 145
                         <div style="display: -webkit-box;background-color: #fff;">
144 146
                             <h4 style="-webkit-box-flex: 1;"><span style="color:red">¥{{el.price/2}}</span>+<span style="color:red">¥{{el.price/2}}</span></h4>
145 147
                             <div>x{{el.qty}}</div>
146 148
                         </div>
147 149
                     </div>
148 150
                 </li>
151
+
152
+                <li class="ui-border-t" style="padding:0;">
153
+                    <div class="ui-form-item ui-form-item-textarea " style="width: 100%;padding: 0;">
154
+                        <label>
155
+                            备注
156
+                        </label>
157
+                        <textarea placeholder="请输入备注" ms-duplex="elt.remark"></textarea>
158
+                    </div>
159
+                </li>
149 160
             </ul>
150 161
             <div class="ui-form ui-border-b">
151 162
                 <!--<div class="ui-form-item ui-border-b">
@@ -153,12 +164,7 @@
153 164
                     <span style="color: red;padding-left: 95px;">¥{{KYJF}}</span>
154 165
                 </div>-->
155 166
 
156
-                <div class="ui-form-item ui-form-item-textarea ui-border-b">
157
-                    <label>
158
-                        备注
159
-                    </label>
160
-                    <textarea placeholder="请输入备注" ms-duplex="remark"></textarea>
161
-                </div>
167
+                
162 168
                 <div class="ui-form-item ui-border-b">
163 169
                     <label>
164 170
                         合计金额

+ 5 - 2
ShopMobile/Mobile/View/OrderDatail.html

@@ -90,7 +90,7 @@
90 90
     <style>
91 91
         .order-flow{ margin:0 auto; padding:0; font-size:12px; font-weight:normal; padding-bottom:4px; }
92 92
         .order-flow-left, .order-flow-arrive, .order-flow-wait, .order-flow-right-arrive, .order-flow-right-wait{ 
93
-            margin:0; padding:0; background: url(/img/order_speed.gif) no-repeat scroll 0 0; float:left; 
93
+            margin:0; padding:0; background: url(/Mobile/img/order_speed.gif) no-repeat scroll 0 0; float:left; 
94 94
             font-family:Arial; line-height:16px; text-align:center; width:120px;
95 95
         }
96 96
         .order-flow div span{ margin:0; padding:0; background:none repeat scroll 0 0 #fff; display:block;}
@@ -152,12 +152,15 @@
152 152
                 <a>商品明细</a>
153 153
             </div>
154 154
             <ul class="ui-list ui-list-text ui-border-b" style="margin-bottom:0px">
155
-                <li ms-repeat-el="modelData.item" ms-class-1="ui-border-t:!$first" style="padding:0;">
155
+                <li ms-repeat-el="modelData.item" ms-class-1="ui-border-t:!$first" >
156 156
                     <div class="ui-list-thumb ">
157 157
                         <img ms-src="el.ImgUrl" style="width:50px;" />
158 158
                     </div>
159 159
                     <div class="ui-list-info">
160 160
                         <h4 class="ui-nowrap">{{el.Title}}</h4>
161
+                        <div class="ui-row-flex" ms-visible="JSON.parse(el.Attrs).length>0">
162
+                            <div class="ui-col ui-col" style="color: #777;font-size: 14px;" ms-repeat-item="JSON.parse(el.Attrs)">{{item.key+':'+item.value}}</div>
163
+                        </div>
161 164
                         <div style="display: -webkit-box;background-color: #fff;">
162 165
                             <h4 style="-webkit-box-flex: 1;"><strong style="color:red">¥{{el.Price1/2}}</strong>+<strong style="color:red">¥{{el.Price1/2}}</strong></h4>
163 166
                             <div>x{{el.Qty}}</div>

+ 8 - 17
ShopMobile/Mobile/View/Pay/pay_zfb.aspx.cs

@@ -33,8 +33,7 @@ namespace ShopMobile.View.Pay
33 33
 
34 34
                             string url = CommFun.GetDomainName();
35 35
 
36
-                            //支付类型
37
-                            string payment_type = "1";
36
+
38 37
                             //必填,不能修改
39 38
                             //服务器异步通知页面路径
40 39
                             string notify_url = url + "/Mobile/View/Alipay/notify_url.aspx";
@@ -57,20 +56,11 @@ namespace ShopMobile.View.Pay
57 56
                             //必填
58 57
 
59 58
                             //商品展示地址
60
-                            string show_url = url + "/Mobile/View/OrderDatail.aspx?oid=" + out_trade_no;
59
+                            string show_url = url + "/Mobile/View/OrderDatail.html?oid=" + out_trade_no;
61 60
                             //必填,需以http://开头的完整路径,例如:http://www.商户网址.com/myorder.html
62 61
 
63 62
                             //订单描述
64
-                            string body = ""; //WIDbody.Text.Trim();
65
-                                              //选填
66
-
67
-                            //超时时间
68
-                            string it_b_pay = ""; //WIDit_b_pay.Text.Trim();
69
-                                                  //选填
70
-
71
-                            //钱包token
72
-                            string extern_token = ""; //WIDextern_token.Text.Trim();
73
-                                                      //选填
63
+                            string body = ""; //选填
74 64
 
75 65
 
76 66
                             ////////////////////////////////////////////////////////////////////////////////////////////////
@@ -80,17 +70,18 @@ namespace ShopMobile.View.Pay
80 70
                             sParaTemp.Add("partner", Config.partner);
81 71
                             sParaTemp.Add("seller_id", Config.seller_id);
82 72
                             sParaTemp.Add("_input_charset", Config.input_charset.ToLower());
83
-                            sParaTemp.Add("service", "alipay.wap.create.direct.pay.by.user");
84
-                            sParaTemp.Add("payment_type", payment_type);
73
+                            sParaTemp.Add("service", Config.service);
74
+                            sParaTemp.Add("payment_type", Config.payment_type);
85 75
                             sParaTemp.Add("notify_url", notify_url);
86 76
                             sParaTemp.Add("return_url", return_url);
87 77
                             sParaTemp.Add("out_trade_no", out_trade_no);
88 78
                             sParaTemp.Add("subject", subject);
89 79
                             sParaTemp.Add("total_fee", total_fee);
90 80
                             sParaTemp.Add("show_url", show_url);
81
+                            //sParaTemp.Add("app_pay","Y");//启用此参数可唤起钱包APP支付。
91 82
                             sParaTemp.Add("body", body);
92
-                            sParaTemp.Add("it_b_pay", it_b_pay);
93
-                            sParaTemp.Add("extern_token", extern_token);
83
+                            //其他业务参数根据在线开发文档,添加参数.文档地址:https://doc.open.alipay.com/doc2/detail.htm?spm=a219a.7629140.0.0.2Z6TSk&treeId=60&articleId=103693&docType=1
84
+                            //如sParaTemp.Add("参数名","参数值");
94 85
 
95 86
                             //建立请求
96 87
                             string sHtmlText = Submit.BuildRequest(sParaTemp, "get", "确认");

+ 2 - 2
ShopMobile/Mobile/View/SCSY.html

@@ -30,10 +30,10 @@
30 30
             DataModel: [],
31 31
             DataModel1: [],
32 32
             golist: function () {
33
-                window.location.href = "SPList.html?key=" + encodeURI($("#conkey").val());
33
+                window.location.href = "/Mobile/View/SPList.html?key=" + encodeURI($("#conkey").val());
34 34
             },
35 35
             viewsp: function (el) {
36
-                window.location.href = "SPXQ.html?id=" + el.SpNo;//el.ProductSysNo;
36
+                window.location.href = "/Mobile/View/SPXQ.html?id=" + el.ID;//el.ProductSysNo;
37 37
             }
38 38
         });
39 39
         avalon.ready(function () {

+ 1 - 1
ShopMobile/Mobile/View/SPList.html

@@ -65,7 +65,7 @@
65 65
                 }
66 66
             },
67 67
             viewsp: function (el) {
68
-                window.location.href = "SPXQ.html?id=" + el.SpNo;//el.ProductSysNo;
68
+                window.location.href = "SPXQ.html?id=" + el.ID;//el.ProductSysNo;
69 69
             }
70 70
 
71 71
         });

+ 46 - 42
ShopMobile/Mobile/View/SPXQ.html

@@ -254,7 +254,7 @@
254 254
             selData: {},
255 255
             scjdata: common.getcart(),
256 256
             spid: common.getQueryString("id") ? common.getQueryString("id") : "",
257
-            lsspid:0,
257
+            lsspno: 0,
258 258
             goback: function () {
259 259
                 history.back()
260 260
             },
@@ -278,7 +278,7 @@
278 278
                 }
279 279
             },
280 280
             addCar: function () {
281
-                var prd = { "id": model.DataModel.Product_SysNo, "num": $(".shopNumber .number").text(), isxz: 1 };
281
+                var prd = { "id": model.spid, "spno": (model.DataModel.Product_SysNo?model.DataModel.Product_SysNo:0), "num": $(".shopNumber .number").text(), isxz: 1 };
282 282
                 common.addcart(prd);
283 283
                 model.scjdata = common.getcart();
284 284
                 common.alert("加入购物车成功", "success");
@@ -291,14 +291,14 @@
291 291
                 location.href = "/Mobile/View/ShopCart.html";
292 292
             },
293 293
             xzval1: function (el) {
294
-                model.lsspid = model.spid;
294
+                model.lsspno = model.spno;
295 295
                 model.lssxDataItem = model.sxDataItem;
296 296
                 model.sxDataItem = el.item;
297 297
                 if (model.sxCount > 1) {
298 298
                     var bl = true;
299 299
                     $(el.item).each(function (i, n) {
300 300
                         if (n.name == model.selData.Value2) {
301
-                            model.spid = n.mum;
301
+                            model.spno = n.mum;
302 302
                             bl = false;
303 303
                             return false;
304 304
                         }
@@ -306,19 +306,19 @@
306 306
                     if (bl) { model.spid = el.item[0].num; }
307 307
                 }
308 308
                 else {
309
-                    model.spid = el.num;
309
+                    model.spno = el.num;
310 310
                 }
311 311
                 model.getdata();
312 312
             },
313 313
             xzval2: function (el) {
314
-                model.lsspid = model.spid;
314
+                model.lsspno = model.spid;
315 315
                 model.lssxDataItem = model.sxDataItem;
316
-                model.spid = el.num;
316
+                model.spno = el.num;
317 317
                 model.getdata();
318 318
             },
319 319
             getdata: function () {
320 320
                 var date = common.getnowdate("yyyyMMddHHmmss");
321
-                var strdata = { action: "product_productinfo", id: model.spid, timestamp: date };
321
+                var strdata = { action: "product_productinfo", id: model.spid, spno: model.spno, timestamp: date };
322 322
                 var sign = common.getsign(JSON.stringify(strdata));
323 323
                 var data = JSON.parse(JSON.stringify(strdata));
324 324
                 data.sign = sign;
@@ -343,42 +343,46 @@
343 343
                                 autoplay: true,
344 344
                                 interval: 3000
345 345
                             });
346
-                            if (model.DataModel.Product_Group.length > 0) {
347
-                                var sx = model.DataModel.Product_Group[0].Group_Name.split('|');
348
-                                $(sx).each(function (i, n) {
349
-                                    $(".sx" + (i + 1)).show();
350
-                                    $(".sx" + (i + 1)).find("label").text(n);
351
-                                })
352
-                                model.sxCount = sx.length;
353
-                                $(model.DataModel.Product_Group).each(function (i, n) {
354
-                                    var bl = true;
355
-                                    $(model.sxData).each(function (j, m) {
356
-                                        if (m.name == n.Value1) {
357
-                                            bl = false;
346
+                            model.sxData.clear();
347
+                            model.sxDataItem.clear();
348
+                            if (resultData.result2 == '1') {
349
+                                if (model.DataModel.Product_Group.length > 0) {
350
+                                    var sx = model.DataModel.Product_Group[0].Group_Name.split('|');
351
+                                    $(sx).each(function (i, n) {
352
+                                        $(".sx" + (i + 1)).show();
353
+                                        $(".sx" + (i + 1)).find("label").text(n);
354
+                                    })
355
+                                    model.sxCount = sx.length;
356
+                                    $(model.DataModel.Product_Group).each(function (i, n) {
357
+                                        var bl = true;
358
+                                        $(model.sxData).each(function (j, m) {
359
+                                            if (m.name == n.Value1) {
360
+                                                bl = false;
361
+                                                if (model.sxCount > 1) {
362
+                                                    m.item.push({ id: n.Value1, name: n.Value2, num: n.ProductSysNo });
363
+                                                }
364
+                                            }
365
+                                        })
366
+                                        if (n.ProductSysNo == model.DataModel.Product_SysNo) { model.selData = n; }
367
+                                        if (bl) {
368
+                                            var sxmodel = { name: n.Value1, item: [] }
358 369
                                             if (model.sxCount > 1) {
359
-                                                m.item.push({ id: n.Value1, name: n.Value2, num: n.ProductSysNo });
370
+                                                sxmodel.item.push({ id: n.Value1, name: n.Value2, num: n.ProductSysNo });
360 371
                                             }
372
+                                            else {
373
+                                                sxmodel.num = n.ProductSysNo;
374
+                                            }
375
+                                            model.sxData.push(sxmodel);
361 376
                                         }
362 377
                                     })
363
-                                    if (n.ProductSysNo == model.spid) { model.selData = n; }
364
-                                    if (bl) {
365
-                                        var sxmodel = { name: n.Value1, item: [] }
366
-                                        if (model.sxCount > 1) {
367
-                                            sxmodel.item.push({ id: n.Value1, name: n.Value2, num: n.ProductSysNo });
368
-                                        }
369
-                                        else {
370
-                                            sxmodel.num = n.ProductSysNo;
371
-                                        }
372
-                                        model.sxData.push(sxmodel);
378
+                                    if (model.sxCount > 1) {
379
+                                        $(model.sxData).each(function (i, n) {
380
+                                            if (n.name == model.selData.Value1) {
381
+                                                model.sxDataItem = n.item;
382
+                                                return false;
383
+                                            }
384
+                                        })
373 385
                                     }
374
-                                })
375
-                                if (model.sxCount > 1) {
376
-                                    $(model.sxData).each(function (i, n) {
377
-                                        if (n.name == model.selData.Value1) {
378
-                                            model.sxDataItem = n.item;
379
-                                            return false;
380
-                                        }
381
-                                    })
382 386
                                 }
383 387
                             }
384 388
 
@@ -389,7 +393,7 @@
389 393
                                 stayTime: 2000,
390 394
                                 type: "warn"
391 395
                             })
392
-                            model.spid = model.lsspid;
396
+                            model.spno = model.lsspno;
393 397
                             model.sxDataItem = model.lssxDataItem;
394 398
                         }
395 399
                     }
@@ -459,12 +463,12 @@
459 463
             </div>
460 464
         </div>
461 465
 
462
-        <ul class="ui-list ui-list-text ui-list-link ui-border-b" >
466
+        <ul class="ui-list ui-list-text ui-list-link ui-border-b" style="margin:0;">
463 467
             <li class="ui-border-t" ms-on-click="showdv()">
464 468
                 <h4 class="ui-nowrap">图文详情</h4>
465 469
             </li>
466 470
         </ul>
467
-        <ul class="ui-list ui-list-text ui-border-b" >
471
+        <ul class="ui-list ui-list-text ui-border-b" style="margin:0;">
468 472
             <li style="display:none" id="dvdetail">
469 473
                 {{DataModel.ProductImgDetail|html}}
470 474
             </li>

+ 14 - 10
ShopMobile/Mobile/View/ShopCart.html

@@ -24,10 +24,12 @@
24 24
             ctData: [],
25 25
             GetAllPrice: function () {
26 26
                 var pri = 0;
27
-                $(model.ctData).each(function (i, n) {
28
-                    if (n.isxz) {
29
-                        pri = pri * 1 + n.qty * n.price;
30
-                    }
27
+                $(model.ctData).each(function (j, m) {
28
+                    $(m.items).each(function (i, n) {
29
+                        if (n.isxz) {
30
+                            pri = pri * 1 + n.qty * n.price;
31
+                        }
32
+                    })
31 33
                 })
32 34
 
33 35
                 return pri;
@@ -103,18 +105,22 @@
103 105
         <div class="ui-form" ms-if="model.cart.size() != 0">
104 106
 
105 107
 
106
-            <ul class="ui-list ui-list-text ui-border-b " style="margin-bottom:0px" ms-repeat-el="ctData">
107
-                <li style="padding:0;">
108
+            <ul class="ui-list ui-list-text ui-border-b " style="margin-bottom:0px" ms-repeat-elt="ctData">
109
+                <li class="ui-border-b ">商家{{$index+1}}</li>
110
+                <li ms-repeat-el="elt.items" class="ui-border-b ">
108 111
                     <label class="ui-checkbox" style="line-height: 60px;">
109 112
                         <input type="checkbox" ms-attr-checked="el.isxz=='1'?'checked':''" ms-change="setxz(el)">
110 113
                     </label>
111 114
                     <div class="ui-list-thumb ">
112 115
                         <img ms-src="el.imgurl" style="width:50px;" />
113 116
                     </div>
114
-                    <div class="ui-list-info ui-border-t">
117
+                    <div class="ui-list-info ">
115 118
                         <h4 class="ui-nowrap">{{el.title}}</h4>
119
+                        <div class="ui-row-flex" ms-visible="el.group.length>0">
120
+                            <div class="ui-col ui-col" style="color: #777;font-size: 14px;" ms-repeat-item="el.group">{{item.key+':'+item.value}}</div>
121
+                        </div>
116 122
                         <div style="display: -webkit-box;background-color: #fff;">
117
-                            <h4 style="-webkit-box-flex: 1;"><strong style="color:red">¥{{el.price/2}}</strong>+<strong style="color:red">¥{{el.price/2}}</strong> </h4>
123
+                            <h4 style="-webkit-box-flex: 1;line-height: 25px;"><strong style="color:red">¥{{el.price/2}}</strong>+<strong style="color:red">¥{{el.price/2}}</strong> </h4>
118 124
                             <div style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-box-pack: center; -webkit-box-align: center; text-align: center;">
119 125
                                 <table class="ui-table ui-border" style="line-height:25px">
120 126
                                     <thead>
@@ -130,9 +136,7 @@
130 136
                             </div>
131 137
                         </div>
132 138
                     </div>
133
-                    
134 139
                 </li>
135
-
136 140
             </ul>
137 141
             <div class="ui-form ui-border-b">
138 142
                 <div class="ui-form-item ui-border-b">

+ 8 - 0
ShopMobile/ShopMobile.csproj

@@ -387,6 +387,7 @@
387 387
     <Content Include="Admin\ProductCategoryList.aspx" />
388 388
     <Content Include="Admin\ProductEdit.aspx" />
389 389
     <Content Include="Admin\ProductList.aspx" />
390
+    <Content Include="Admin\ProductListOther.aspx" />
390 391
     <Content Include="Admin\UserList.aspx" />
391 392
     <Content Include="Mobile\CSS\frozenui-1.3.0\css\actionsheet.css" />
392 393
     <Content Include="Mobile\CSS\frozenui-1.3.0\css\arrowlink.css" />
@@ -595,6 +596,13 @@
595 596
     <Compile Include="Admin\ProductList.aspx.designer.cs">
596 597
       <DependentUpon>ProductList.aspx</DependentUpon>
597 598
     </Compile>
599
+    <Compile Include="Admin\ProductListOther.aspx.cs">
600
+      <DependentUpon>ProductListOther.aspx</DependentUpon>
601
+      <SubType>ASPXCodeBehind</SubType>
602
+    </Compile>
603
+    <Compile Include="Admin\ProductListOther.aspx.designer.cs">
604
+      <DependentUpon>ProductListOther.aspx</DependentUpon>
605
+    </Compile>
598 606
     <Compile Include="Admin\UserList.aspx.cs">
599 607
       <DependentUpon>UserList.aspx</DependentUpon>
600 608
       <SubType>ASPXCodeBehind</SubType>

+ 99 - 22
ShopMobile/apiclass/common.cs

@@ -23,10 +23,10 @@ namespace ShopMobile.apiclass
23 23
 
24 24
                 string url = CommFun.GetConfigString("loginurl");
25 25
                 string code = CommFun.GetConfigString("signcode");
26
-                string param = "type=login&username=" + uname + "&password=" + upsd + "&timestamp=" + DateTime.Now.Ticks;
27
-                //string token = Utils.MD5(Utils.SHA256(param + code)).ToLower();
28
-                //param = param + "&token=" + token + "&channel=shop";
29
-                param = param + "&debug=true";
26
+                string param = "type=login&username=" + uname + "&password=" + upsd + "&timestamp=" + DateTime.Now.Ticks + "&channel=shop";
27
+                string token = Utils.MD5(Utils.SHA256(param + code)).ToLower();
28
+                param = param + "&token=" + token ;
29
+                //param = param + "&debug=true";
30 30
                 string result = CommFun.Get(url, param);
31 31
 
32 32
                 JObject obj = JsonConvert.DeserializeObject(result) as JObject;
@@ -154,54 +154,131 @@ namespace ShopMobile.apiclass
154 154
             string appkey = CommFun.GetConfigString("appkey").ToString();
155 155
             string userkey = "&"+ CommFun.GetConfigString("userkey").ToString();
156 156
 
157
-            List<orderitem> list = new List<orderitem>();
157
+            List<orderitems> list = new List<orderitems>();
158 158
             string carts = Common.Utils.HtmlDecode(Common.CommFun.QueryString("cart"));
159 159
             List<cartitem> objs = JsonConvert.DeserializeObject<List<cartitem>>(carts) ;
160 160
             foreach (cartitem obj in objs)
161 161
             {
162
-                try
162
+                Model.PT_Pro_Product pt = new Bll.PT_Pro_Product().GetModel(obj.id);
163
+                if (pt != null)
163 164
                 {
164
-                    var strdate = DateTime.Now.ToString("yyyyMMddHHmmss");
165
-                    string strdata = "app_key=" + appkey + "&format=json&product_SysNo=" + obj.id + "&sign_method=md5&timestamp=" + strdate
166
-                        + "&sign=" + Utils.MD5(appkey+ "json"+ obj.id+ "md5"+ strdate+ userkey).ToLower();
167
-                    string result = CommFun.Get(url + "/v2/By/ProductsDetail", strdata);
168
-                    JObject res = JsonConvert.DeserializeObject(result) as JObject;
169
-                    JObject ret = JsonConvert.DeserializeObject(res["Result"].ToString()) as JObject;
170
-                    JObject spxq = JsonConvert.DeserializeObject(res["Content"].ToString()) as JObject;
171
-                    if (ret["code"].ToString() == "1001" && spxq["AvailableQty"].ToString() != "0")
165
+                    if (pt.Type == 0)
172 166
                     {
173 167
                         orderitem oim = new orderitem();
174 168
                         oim.pid = obj.id;
169
+                        oim.spno = obj.spno;
175 170
                         oim.qty = obj.num;
176
-                        oim.isxz = obj.isxz;
177
-                        oim.title = spxq["Product_Name"].ToString();
178
-                        oim.price = decimal.Parse(spxq["Product_Price"].ToString());
179
-                        oim.kcqty = Int32.Parse(spxq["AvailableQty"].ToString());
180
-                        oim.imgurl = new Uri("http://img.3721zh.com/UploadFiles/Product/" + obj.id + "/AppPic/1.jpg").ToString();
181
-                        list.Add(oim);
171
+                        oim.title = pt.Title;
172
+                        oim.price = pt.SPPrice.Value;
173
+                        oim.imgurl = pt.ImgUrl1;
174
+                        oim.kcqty = pt.Qty.Value;
175
+
176
+                        var os = list.Where(p => p.type == 0).FirstOrDefault();
177
+
178
+                        if (os == null)
179
+                        {
180
+                            os = new orderitems();
181
+                            os.type = 0;
182
+                            os.items = new List<orderitem>();
183
+                            list.Add(os);
184
+                        }
185
+                        else
186
+                        {
187
+                            os.items.Add(oim);
188
+                        }
189
+                    }
190
+                    if (pt.Type == 1)
191
+                    {
192
+                        try
193
+                        {
194
+                            var strdate = DateTime.Now.ToString("yyyyMMddHHmmss");
195
+                            string strdata = "app_key=" + appkey + "&format=json&product_SysNo=" + obj.spno + "&sign_method=md5&timestamp=" + strdate
196
+                                + "&sign=" + Utils.MD5(appkey + "json" + obj.spno + "md5" + strdate + userkey).ToLower();
197
+                            string result = CommFun.Get(url + "/v2/By/ProductsDetail", strdata);
198
+                            JObject res = JsonConvert.DeserializeObject(result) as JObject;
199
+                            JObject ret = JsonConvert.DeserializeObject(res["Result"].ToString()) as JObject;
200
+                            JObject spxq = JsonConvert.DeserializeObject(res["Content"].ToString()) as JObject;
201
+                            if (ret["code"].ToString() == "1001" && spxq["AvailableQty"].ToString() != "0")
202
+                            {
203
+                                orderitem oim = new orderitem();
204
+                                oim.pid = obj.id;
205
+                                oim.spno = obj.spno;
206
+                                oim.qty = obj.num;
207
+                                oim.isxz = obj.isxz;
208
+                                oim.title = spxq["Product_Name"].ToString();
209
+                                oim.price = decimal.Parse(spxq["Product_Price"].ToString());
210
+                                oim.kcqty = Int32.Parse(spxq["AvailableQty"].ToString());
211
+                                oim.imgurl = new Uri("http://img.3721zh.com/UploadFiles/Product/" + obj.spno + "/AppPic/1.jpg").ToString();
212
+                                oim.group = new List<attritem>();
213
+                                var grouplist = JsonConvert.DeserializeObject<List<JObject>>(spxq["Product_Group"].ToString());
214
+                                foreach (var gp in grouplist)
215
+                                {
216
+                                    if (gp["ProductSysNo"].ToString() == obj.spno.ToString())
217
+                                    {
218
+                                        var gps = gp["Group_Name"].ToString().Split('|');
219
+                                        oim.group.Add(new attritem() { key = gps[0], value = gp["Value1"].ToString() });
220
+                                        if (gps.Length > 1)
221
+                                        {
222
+                                            oim.group.Add(new attritem() { key = gps[1], value = gp["Value2"].ToString() });
223
+                                        }
224
+                                        break;
225
+                                    }
226
+                                }
227
+
228
+                                var os = list.Where(p => p.type == 1).FirstOrDefault();
229
+                                if (os == null)
230
+                                {
231
+                                    os = new orderitems();
232
+                                    os.type = 1;
233
+                                    os.items = new List<orderitem>();
234
+                                    os.items.Add(oim);
235
+
236
+                                    list.Add(os);
237
+                                }
238
+                                else {
239
+                                    os.items.Add(oim);
240
+                                }
241
+                                
242
+                            }
243
+                        }
244
+                        catch (Exception ex)
245
+                        { }
182 246
                     }
183 247
                 }
184
-                catch(Exception ex)
185
-                { }
186 248
             }
187 249
             msg.result1 = list;
188 250
         }
251
+        public class orderitems
252
+        {
253
+            public int type { get; set; }
254
+            public string name { get; set; }
255
+            public string remark { get; set; }
256
+            public List<orderitem> items { get; set; }
257
+        }
189 258
         public class orderitem
190 259
         {
191 260
             public int pid { get; set; }
261
+            public int spno { get; set; }
192 262
             public string title { get; set; }
193 263
             public string imgurl { get; set; }
194 264
             public decimal price { get; set; }
195 265
             public int kcqty { get; set; }
196 266
             public int qty { get; set; }
197 267
             public int isxz { get; set; }
268
+            public List<attritem> group { get; set; }
198 269
         }
199 270
         public class cartitem
200 271
         {
201 272
             public int id { get; set; }
273
+            public int spno { get; set; }
202 274
             public int num { get; set; }
203 275
             public int isxz { get; set; }
204 276
         }
277
+        public class attritem
278
+        {
279
+            public string key { get; set; }
280
+            public string value { get; set; }
281
+        }
205 282
         #endregion
206 283
     }
207 284
 }

+ 147 - 84
ShopMobile/apiclass/order.cs

@@ -140,8 +140,7 @@ namespace ShopMobile.apiclass
140 140
             {
141 141
                 //获得传参信息
142 142
                 int addid = CommFun.RequestInt("addid");
143
-                string ids = CommFun.QueryString("ids");
144
-                string remark = CommFun.QueryString("remark");
143
+                string ids = Utils.HtmlDecode( CommFun.QueryString("ids"));
145 144
 
146 145
                 if (addid == 0)
147 146
                 {
@@ -155,120 +154,184 @@ namespace ShopMobile.apiclass
155 154
                     return;
156 155
                 }
157 156
 
158
-                List<orderitem> list = new List<orderitem>();
157
+                
159 158
                 decimal total = 0;
160 159
                 if (string.IsNullOrEmpty(ids))
161 160
                 {
162
-                    msg.msgcode = "购物车为空!";
161
+                    msg.msgcode = "商品为空!";
163 162
                     return;
164 163
                 }
165 164
                 else
166 165
                 {
166
+                    List<CommandInfo> SQLStringList = new List<CommandInfo>();
167
+                    List<string> ods = new List<string>();
167 168
                     string url = CommFun.GetConfigString("shopurl").ToString();
168 169
                     string appkey = CommFun.GetConfigString("appkey").ToString();
169 170
                     string userkey = "&" + CommFun.GetConfigString("userkey").ToString();
170 171
 
171
-                    string[] sps = ids.Split(',');
172
-                    foreach (string sp in sps)
172
+                    List<JObject> objs = JsonConvert.DeserializeObject<List<JObject>>(ids);
173
+                    foreach (var obj in objs)
173 174
                     {
174
-                        string[] arr = sp.Split('_');
175
-
176
-                        var strdate = DateTime.Now.ToString("yyyyMMddHHmmss");
177
-                        string strdata = "app_key=" + appkey + "&format=json&product_SysNo=" + arr[0] + "&sign_method=md5&timestamp=" + strdate
178
-                            + "&sign=" + Utils.MD5(appkey + "json" + arr[0] + "md5" + strdate + userkey).ToLower();
179
-                        string result = CommFun.Get(url + "/v2/By/ProductsDetail", strdata);
180
-                        JObject res = JsonConvert.DeserializeObject(result) as JObject;
181
-                        JObject ret = JsonConvert.DeserializeObject(res["Result"].ToString()) as JObject;
182
-                        JObject spxq = JsonConvert.DeserializeObject(res["Content"].ToString()) as JObject;
183
-                        if (ret["code"].ToString() == "1001" && spxq["AvailableQty"].ToString() != "0")
175
+                        string remark = obj["remark"].ToString();
176
+                        List<orderitem> list = new List<orderitem>();
177
+
178
+                        List<JObject> splist = JsonConvert.DeserializeObject<List<JObject>>(obj["items"].ToString());
179
+                        foreach (var sp in splist)
184 180
                         {
185
-                            if (Int32.Parse(arr[1]) <= Int32.Parse(spxq["AvailableQty"].ToString()))
181
+                            int qty= Int32.Parse(sp["qty"].ToString());
182
+                            int spno = Int32.Parse(sp["spno"].ToString());
183
+                            Model.PT_Pro_Product pt = new Bll.PT_Pro_Product().GetModel(Int32.Parse(sp["pid"].ToString()));
184
+                            if (pt != null)
186 185
                             {
187
-                                orderitem oim = new orderitem();
188
-                                oim.pid = Int32.Parse(arr[0]);
189
-                                oim.qty = Int32.Parse(arr[1]);
190
-                                oim.title = spxq["Product_Name"].ToString();
191
-                                oim.price = decimal.Parse(spxq["Product_Price"].ToString());
192
-                                oim.imgurl = new Uri("http://img.3721zh.com/UploadFiles/Product/" + arr[0] + "/AppPic/1.jpg").ToString();
193
-                                list.Add(oim);
194
-
195
-                                total = total + oim.price * oim.qty;
186
+                                if (pt.Type == 0)
187
+                                {
188
+                                    #region 本地商品处理
189
+                                    orderitem oim = new orderitem();
190
+                                    oim.pid = pt.ID;
191
+                                    oim.spno = spno;
192
+                                    oim.qty = qty;
193
+                                    oim.title = pt.Title;
194
+                                    oim.price = pt.SPPrice.Value;
195
+                                    oim.imgurl = pt.ImgUrl1;
196
+
197
+                                    list.Add(oim);
198
+
199
+                                    total = total + oim.price * oim.qty; 
200
+                                    #endregion
201
+                                }
202
+                                if (pt.Type == 1)
203
+                                {
204
+                                    #region 转换商城商品处理
205
+                                    var strdate = DateTime.Now.ToString("yyyyMMddHHmmss");
206
+                                    string strdata = "app_key=" + appkey + "&format=json&product_SysNo=" + spno + "&sign_method=md5&timestamp=" + strdate
207
+                                        + "&sign=" + Utils.MD5(appkey + "json" + spno + "md5" + strdate + userkey).ToLower();
208
+                                    string result = CommFun.Get(url + "/v2/By/ProductsDetail", strdata);
209
+                                    JObject res = JsonConvert.DeserializeObject(result) as JObject;
210
+                                    JObject ret = JsonConvert.DeserializeObject(res["Result"].ToString()) as JObject;
211
+                                    JObject spxq = JsonConvert.DeserializeObject(res["Content"].ToString()) as JObject;
212
+                                    if (ret["code"].ToString() == "1001" && spxq["AvailableQty"].ToString() != "0")
213
+                                    {
214
+                                        if (qty <= Int32.Parse(spxq["AvailableQty"].ToString()))
215
+                                        {
216
+                                            orderitem oim = new orderitem();
217
+                                            oim.pid = pt.ID;
218
+                                            oim.spno = spno;
219
+                                            oim.qty = qty;
220
+                                            oim.title = spxq["Product_Name"].ToString();
221
+                                            oim.price = decimal.Parse(spxq["Product_Price"].ToString());
222
+                                            oim.imgurl = new Uri("http://img.3721zh.com/UploadFiles/Product/" + spno + "/AppPic/1.jpg").ToString();
223
+                                            oim.group = new List<attritem>();
224
+                                            var grouplist = JsonConvert.DeserializeObject<List<JObject>>(spxq["Product_Group"].ToString());
225
+                                            foreach (var gp in grouplist)
226
+                                            {
227
+                                                if (gp["ProductSysNo"].ToString() == spno.ToString())
228
+                                                {
229
+                                                    var gps = gp["Group_Name"].ToString().Split('|');
230
+                                                    oim.group.Add(new attritem() { key = gps[0], value = gp["Value1"].ToString() });
231
+                                                    if (gps.Length > 1)
232
+                                                    {
233
+                                                        oim.group.Add(new attritem() { key = gps[1], value = gp["Value2"].ToString() });
234
+                                                    }
235
+                                                }
236
+                                            }
237
+
238
+                                            list.Add(oim);
239
+
240
+                                            total = total + oim.price * oim.qty;
241
+                                        }
242
+                                    }
243
+
244
+                                    #endregion
245
+                                }
196 246
                             }
197 247
                         }
198
-                    }
199
-                }
200 248
 
201
-                if (total <= 0)
202
-                {
203
-                    msg.msgcode = "购物车为空!";
204
-                    return;
205
-                }
206
-                //else if (user.Points < total)
207
-                //{
208
-                //    msg.msgcode = "会员积分不足!";
209
-                //    return;
210
-                //}
211
-
212
-                string orderid = DbHelperSQL.GetSingle(" SELECT dbo.GetOrderID() ").ToString();
213
-
214
-                List<CommandInfo> SQLStringList = new List<CommandInfo>();
215
-
216
-                Model.PT_Order_Header head = new Model.PT_Order_Header();
217
-                head.OrderID = orderid;
218
-                head.State = 0;
219
-                head.Receiver = addrModel.Receiver;
220
-                head.Province = addrModel.Province;
221
-                head.City = addrModel.City;
222
-                head.County = addrModel.County;
223
-                head.Address = addrModel.Address;
224
-                head.Telephone = addrModel.Telephone;
225
-                head.PostCode = addrModel.YB;
226
-                head.OrderMemo = remark;
227
-                head.SumPrice = total;
228
-                head.PayPrice = total/2;
229
-                head.Points = total / 2;
230
-                head.CreateUser = user.MID;
231
-                head.CreateTime = DateTime.Now;
232
-
233
-                SQLStringList.Add(new Bll.PT_Order_Header().GetAddSql(head));
234
-
235
-                foreach (var l in list)
236
-                {
237
-                    Model.PT_Order_Item item = new Model.PT_Order_Item();
238
-                    item.OrderID = orderid;
239
-                    item.ImgUrl = l.imgurl;
240
-                    item.PID = l.pid;
241
-                    item.Price1 = l.price;
242
-                    item.Title = l.title;
243
-                    item.Qty = l.qty;
244
-                    item.CreateUser = user.MID;
245
-                    item.CreateTime = DateTime.Now;
246
-
247
-                    SQLStringList.Add(new Bll.PT_Order_Item().GetAddSql(item));
248
-                }
249
+                        if (total > 0)
250
+                        {
251
+                            string type = string.Empty;
252
+                            switch (obj["type"].ToString())
253
+                            {
254
+                                case "0": type = "S"; break;
255
+                                case "1": type = "B"; break;
256
+                            }
249 257
 
250
-                try
251
-                {
252
-                    DbHelperSQL.ExecuteSqlTranWithIndentity(SQLStringList);
253
-                    msg.result1 = orderid;
254
-                }
255
-                catch (Exception ex)
256
-                {
257
-                    msg.msgcode = "提交订单失败!";
258
+                            string orderid = DbHelperSQL.GetSingle(" SELECT dbo.GetOrderID('"+ type + "') ").ToString();
259
+
260
+                            #region 订单表头
261
+                            Model.PT_Order_Header head = new Model.PT_Order_Header();
262
+                            head.OrderID = orderid;
263
+                            head.State = 0;
264
+                            head.Receiver = addrModel.Receiver;
265
+                            head.Province = addrModel.Province;
266
+                            head.City = addrModel.City;
267
+                            head.County = addrModel.County;
268
+                            head.Address = addrModel.Address;
269
+                            head.Telephone = addrModel.Telephone;
270
+                            head.PostCode = addrModel.YB;
271
+                            head.OrderMemo = remark;
272
+                            head.SumPrice = total;
273
+                            head.PayPrice = total / 2;
274
+                            head.Points = total / 2;
275
+                            head.CreateUser = user.MID;
276
+                            head.CreateTime = DateTime.Now;
277
+
278
+                            SQLStringList.Add(new Bll.PT_Order_Header().GetAddSql(head));
279
+                            #endregion
280
+
281
+                            #region 订单明细
282
+                            foreach (var l in list)
283
+                            {
284
+                                Model.PT_Order_Item item = new Model.PT_Order_Item();
285
+                                item.OrderID = orderid;
286
+                                item.ImgUrl = l.imgurl;
287
+                                item.PID = l.pid;
288
+                                item.Price1 = l.price;
289
+                                item.Title = l.title;
290
+                                item.Qty = l.qty;
291
+                                item.SpNo = l.spno;
292
+                                item.Attrs = JsonConvert.SerializeObject(l.group);
293
+                                item.CreateUser = user.MID;
294
+                                item.CreateTime = DateTime.Now;
295
+
296
+                                SQLStringList.Add(new Bll.PT_Order_Item().GetAddSql(item));
297
+                            }
298
+                            #endregion
299
+
300
+                            ods.Add(orderid);
301
+                        }
302
+                    }
303
+                    try
304
+                    {
305
+                        DbHelperSQL.ExecuteSqlTranWithIndentity(SQLStringList);
306
+                        msg.result1 = ods[0];
307
+                    }
308
+                    catch (Exception ex)
309
+                    {
310
+                        msg.msgcode = "提交订单失败!";
311
+                    }
258 312
                 }
313
+                
259 314
             }
260 315
             catch
261 316
             {
262 317
                 msg.msgcode = "提交订单失败!";
263 318
             }
264 319
         }
320
+
265 321
         public class orderitem
266 322
         {
267 323
             public int pid { get; set; }
324
+            public int spno { get; set; }
268 325
             public string title { get; set; }
269 326
             public string imgurl { get; set; }
270 327
             public decimal price { get; set; }
271 328
             public int qty { get; set; }
329
+            public List<attritem> group { get; set; }
330
+        }
331
+        public class attritem
332
+        {
333
+            public string key { get; set; }
334
+            public string value { get; set; }
272 335
         }
273 336
         #endregion
274 337
 

+ 30 - 12
ShopMobile/apiclass/product.cs

@@ -90,23 +90,41 @@ namespace ShopMobile.apiclass
90 90
             string userkey = "&" + CommFun.GetConfigString("userkey").ToString();
91 91
 
92 92
             int id = CommFun.RequestInt("id");
93
+            int spno = CommFun.RequestInt("spno");
93 94
 
94
-            try
95
+            Model.PT_Pro_Product pt = new Bll.PT_Pro_Product().GetModel(id);
96
+            if (pt != null)
95 97
             {
96
-                var strdate = DateTime.Now.ToString("yyyyMMddHHmmss");
97
-                string strdata = "app_key=" + appkey + "&format=json&product_SysNo=" + id + "&sign_method=md5&timestamp=" + strdate
98
-                    + "&sign=" + Utils.MD5(appkey + "json" + id + "md5" + strdate + userkey).ToLower();
99
-                string result = CommFun.Get(url + "/v2/By/ProductsDetail", strdata);
100
-                JObject res = JsonConvert.DeserializeObject(result) as JObject;
101
-                JObject ret = JsonConvert.DeserializeObject(res["Result"].ToString()) as JObject;
102
-                JObject con = JsonConvert.DeserializeObject(res["Content"].ToString()) as JObject;
103
-                if (ret["code"].ToString() == "1001")
98
+                if (pt.Type == 0)
104 99
                 {
105
-                    msg.result1 = con;
100
+                    msg.result1 = pt;
106 101
                 }
102
+                if (pt.Type == 1)
103
+                {
104
+                    try
105
+                    {
106
+                        if (spno == 0) { spno = pt.SpNo.Value; }
107
+                        var strdate = DateTime.Now.ToString("yyyyMMddHHmmss");
108
+                        string strdata = "app_key=" + appkey + "&format=json&product_SysNo=" + spno + "&sign_method=md5&timestamp=" + strdate
109
+                            + "&sign=" + Utils.MD5(appkey + "json" + spno + "md5" + strdate + userkey).ToLower();
110
+                        string result = CommFun.Get(url + "/v2/By/ProductsDetail", strdata);
111
+                        JObject res = JsonConvert.DeserializeObject(result) as JObject;
112
+                        JObject ret = JsonConvert.DeserializeObject(res["Result"].ToString()) as JObject;
113
+                        JObject con = JsonConvert.DeserializeObject(res["Content"].ToString()) as JObject;
114
+                        if (ret["code"].ToString() == "1001")
115
+                        {
116
+                            msg.result1 = con;
117
+                        }
118
+                    }
119
+                    catch (Exception ex)
120
+                    { }
121
+                }
122
+                msg.result2 = pt.Type;
123
+            }
124
+            else
125
+            {
126
+                msg.msgcode = "此商品不存在";
107 127
             }
108
-            catch (Exception ex)
109
-            { }
110 128
         }
111 129
         #endregion
112 130