@@ -89,21 +89,21 @@ <h3 class="panel-title">分类</h3>
89
89
<!-- </ul> -->
90
90
<!-- 6y </div>-->
91
91
<!-- </div>-->
92
- <!-- <!– Manufatues widget –>-->
93
- <!-- <div class="panel manufatue widget panel-default">-->
94
- <!-- <div class="panel-heading">-->
95
- <!-- <h3 class="panel-title">品牌</h3>-->
96
- <!-- </div>-->
97
- <!-- <div class="panel-body">-->
98
- <!-- <ul class="category-list">-->
99
- <!-- <li><i class="side-icon pull-right active">15</i>Gucci</li>-->
100
- <!-- <li><i class="side-icon pull-right active">37</i>Asos</li>-->
101
- <!-- <li><i class="side-icon pull-right active">50</i>Blubery</li>-->
102
- <!-- <li><i class="side-icon pull-right active">78</i>H&M</li>-->
103
- <!-- <li><i class="side-icon pull-right active">94</i>Tesco</li>-->
104
- <!-- </ul>-->
105
- <!-- </div>-->
106
- <!-- </div>-->
92
+ <!-- <!– Manufatues widget –>-->
93
+ <!-- <div class="panel manufatue widget panel-default">-->
94
+ <!-- <div class="panel-heading">-->
95
+ <!-- <h3 class="panel-title">品牌</h3>-->
96
+ <!-- </div>-->
97
+ <!-- <div class="panel-body">-->
98
+ <!-- <ul class="category-list">-->
99
+ <!-- <li><i class="side-icon pull-right active">15</i>Gucci</li>-->
100
+ <!-- <li><i class="side-icon pull-right active">37</i>Asos</li>-->
101
+ <!-- <li><i class="side-icon pull-right active">50</i>Blubery</li>-->
102
+ <!-- <li><i class="side-icon pull-right active">78</i>H&M</li>-->
103
+ <!-- <li><i class="side-icon pull-right active">94</i>Tesco</li>-->
104
+ <!-- </ul>-->
105
+ <!-- </div>-->
106
+ <!-- </div>-->
107
107
<!-- On Sale widget -->
108
108
< div class ="panel widget panel-default ">
109
109
< div class ="panel-heading ">
@@ -133,15 +133,18 @@ <h3 class="panel-title">限时折扣</h3>
133
133
< div class ="row ">
134
134
< div class ="ad-3 ">
135
135
< div class ="col-md-12 col-sm-12 col-xs-12 ">
136
- < div > < img class ="img-responsive ad-3 " src ="/res/buy_more/images/banner2.jpg " alt =""/> </ div >
136
+ < div > < img class ="img-responsive ad-3 " src ="/res/buy_more/images/banner2.jpg " alt =""/>
137
+ </ div >
137
138
</ div >
138
139
</ div >
139
140
</ div >
140
141
141
142
<!-- subcategory -->
142
143
< div class ="row ">
143
144
< div class ="col-md-12 col-sm-12 col-xs-12 ">
144
- < h3 class ="women "> Women < small class ="pull-right "> There Are 120 Products</ small > </ h3 >
145
+ < h3 class ="women "> Women
146
+ < small class ="pull-right "> There Are 120 Products</ small >
147
+ </ h3 >
145
148
< h4 class ="subcategory "> 二级类目</ h4 >
146
149
< div id ="subcategoryBox " class ="row ">
147
150
@@ -161,9 +164,14 @@ <h4 class="subcategory">二级类目</h4>
161
164
</ div >
162
165
</ div >
163
166
<!-- 商品列表 -->
167
+ < div id ="searchCondition ">
168
+ < input id ="pBoxCId " type ="hidden " name ="categoryId " value ="0 ">
169
+ < input id ="pBoxSubCId " type ="hidden " name ="subCategoryId " value ="0 ">
170
+ </ div >
164
171
< div id ="productListBox " class ="row m-30 " tabindex ="0 " hidefocus ="true ">
165
172
166
173
</ div >
174
+
167
175
< div id ="page "> </ div >
168
176
169
177
<!-- <nav>-->
@@ -174,6 +182,7 @@ <h4 class="subcategory">二级类目</h4>
174
182
</ div >
175
183
</ div >
176
184
</ div >
185
+ </ div >
177
186
</ section >
178
187
179
188
<!-- 通用footer -->
@@ -190,6 +199,7 @@ <h4 class="subcategory">二级类目</h4>
190
199
< script >
191
200
$ ( function ( ) {
192
201
innit ( ) ;
202
+
193
203
} ) ;
194
204
195
205
// 初始化方法
@@ -198,7 +208,6 @@ <h4 class="subcategory">二级类目</h4>
198
208
innitMinPriceGoodsBoxBody ( ) ;
199
209
innitOfferBox ( ) ;
200
210
innitFooterBox ( ) ;
201
- innitProductListBox ( ) ;
202
211
}
203
212
204
213
function innitCategory ( ) {
@@ -212,14 +221,19 @@ <h4 class="subcategory">二级类目</h4>
212
221
success : function ( data ) {
213
222
console . log ( data ) ;
214
223
data . forEach ( function ( item , index ) {
215
- str = " <li id='categoryLi" + index + "' onclick=\" categoryClick(this.id);\"> <i class=\"fa fa-eye side-icon pull-left categoryHref " ;
224
+ if ( index == 1 ) {
225
+ $ ( "#pBoxCId" ) . val ( "" + item . categoryId + "" ) ;
226
+ }
227
+ str = " <li id='categoryLi" + index + "' onclick=\" categoryClick(this.id," + item . categoryId + ");\"> <i class=\"fa fa-eye side-icon pull-left categoryHref " ;
216
228
if ( index == 0 ) {
217
229
str += "active" ;
218
230
}
219
231
str += "\"></i>" + item . categoryName + " <i class=\"fa fa-angle-right pull-right\"></i></li>" ;
220
232
categoryBox . append ( str )
221
233
} )
222
234
innitSubCategory ( data [ 0 ] . categoryId ) ;
235
+ // console.log($("#categoryLi0"))
236
+ // $("#categoryLi0").click();
223
237
} ,
224
238
error : function ( ) {
225
239
bs4pop . notice ( '初始化异常,请稍后重试!' , { position : 'topcenter' } ) ;
@@ -228,10 +242,13 @@ <h4 class="subcategory">二级类目</h4>
228
242
}
229
243
230
244
// 设置选中样式
231
- function categoryClick ( id ) {
245
+ function categoryClick ( id , categoryId ) {
232
246
// console.log($(".categoryHref"));
233
247
$ ( ".categoryHref" ) . removeClass ( "active" ) ;
234
248
$ ( "#" + id + " i:eq(0)" ) . addClass ( "active" ) ;
249
+ $ ( "#pBoxCId" ) . val ( "" + categoryId + "" ) ;
250
+ innitSubCategory ( categoryId ) ;
251
+ $ ( ".subcategoryHref:eq(0)" ) . click ( ) ;
235
252
}
236
253
237
254
//初始化子分类
@@ -254,14 +271,19 @@ <h4 class="subcategory">二级类目</h4>
254
271
if ( data . records . length >= 1 ) {
255
272
subCategory . empty ( ) ;
256
273
data . records . forEach ( function ( item , index ) {
274
+ if ( index == 1 ) {
275
+ $ ( "#pBoxSubCId" ) . val ( "" + item . subCategoryId + "" ) ;
276
+ innitProductListBox ( ) ;
277
+ }
257
278
str = " <div class=\"col-md-2 col-sm-4 col-xs-6\">\n" +
258
279
" <div class=\"subcategory-img\">\n" +
259
280
" <img class=\"img-responsive\" src=\"" + item . image + "\" alt=\"\"/>\n" +
260
- " <div class=\"subcategory-overlay\">" + item . subCategoryName + "</div>\n" +
281
+ " <div id='sunCategoryHref" + item . subCategoryId + "' class=\"subcategoryHref subcategory-overlay\" onclick='subCategoryActive(" + item . subCategoryId + ");' >" + item . subCategoryName + "</div>\n" +
261
282
" </div>\n" +
262
283
" </div>" ;
263
284
subCategory . append ( str ) ;
264
285
} ) ;
286
+ $ ( ".subcategoryHref:eq(0)" ) . addClass ( "subcategory-active" ) ;
265
287
}
266
288
} ,
267
289
error : function ( ) {
@@ -270,6 +292,14 @@ <h4 class="subcategory">二级类目</h4>
270
292
} )
271
293
}
272
294
295
+ //子分类样式
296
+ function subCategoryActive ( subCategoryId ) {
297
+ $ ( ".subcategoryHref" ) . removeClass ( "subcategory-active" ) ;
298
+ $ ( "#sunCategoryHref" + subCategoryId + "" ) . addClass ( "subcategory-active" ) ;
299
+ $ ( "#pBoxSubCId" ) . val ( "" + subCategoryId + "" ) ;
300
+ innitProductListBox ( ) ;
301
+ }
302
+
273
303
// 初始化特价商品
274
304
function innitMinPriceGoodsBoxBody ( ) {
275
305
var minPriceGoodsBoxBody = $ ( "#minPriceGoodsBoxBody" ) ;
@@ -346,13 +376,19 @@ <h4 class="subcategory">二级类目</h4>
346
376
if ( current == null || current <= 0 ) {
347
377
current = 1 ;
348
378
}
379
+ console . log ( "分类id的值---------------------------->" + $ ( "#pBoxCId" ) . val ( ) )
380
+ console . log ( "子分类id的值---------------------------->" + $ ( "#pBoxSubCId" ) . val ( ) )
381
+ const categoryId = $ ( "#pBoxCId" ) . val ( ) == 0 ? null : $ ( "#pBoxCId" ) . val ( ) ;
382
+ const subCategoryId = $ ( "#pBoxSubCId" ) . val ( ) == 0 ? null : $ ( "#pBoxSubCId" ) . val ( ) ;
349
383
$ . ajax ( {
350
384
url : "innit_productListBox" ,
351
385
dataType : "json" ,
352
386
type : "post" ,
353
387
data : {
354
388
"current" : current ,
355
- "size" : 6
389
+ "size" : 6 ,
390
+ "categoryId" :categoryId ,
391
+ "subCategoryId" :subCategoryId
356
392
} ,
357
393
success : function ( data ) {
358
394
console . log ( "初始化商品列表------------------------------------->" )
@@ -362,8 +398,8 @@ <h4 class="subcategory">二级类目</h4>
362
398
let tagStr = " " ;
363
399
let activityStr = " " ;
364
400
let isNewStr = " " ;
401
+ productListBox . empty ( ) ;
365
402
if ( data . records . length >= 1 ) {
366
- productListBox . empty ( ) ;
367
403
data . records . forEach ( function ( item , index ) {
368
404
if ( item . productTagId > 0 ) {
369
405
tagStr = " <strong>" + item . productTagStr + "</strong>" ;
@@ -379,10 +415,10 @@ <h4 class="subcategory">二级类目</h4>
379
415
" <div class=\"grid-img\">\n" +
380
416
" <img class=\"img-resposive\" src=\"" + item . image + "\" alt=\"women\"/>\n" +
381
417
tagStr + isNewStr + activityStr +
382
- " <div class=\"grid-overlay\" onclick='showDetail(" + item . productId + ")' >\n" +
418
+ " <div class=\"grid-overlay\" onclick='showDetail(" + item . productId + ")' >\n" +
383
419
" <ul>\n" +
384
- " <li onclick='likeThis(" + item . productId + ")'><i class=\"lnr lnr-heart\"></i></li>\n" +
385
- " <li onclick='carThis(" + item . productId + ")'><i class=\"lnr lnr-cart\"></i></li>\n" +
420
+ " <li onclick='likeThis(" + item . productId + ")'><i class=\"lnr lnr-heart\"></i></li>\n" +
421
+ " <li onclick='carThis(" + item . productId + ")'><i class=\"lnr lnr-cart\"></i></li>\n" +
386
422
" </ul>\n" +
387
423
" </div>\n" +
388
424
" </div>\n" +
@@ -396,23 +432,26 @@ <h4 class="subcategory">二级类目</h4>
396
432
// 翻页插件
397
433
boxFooter2 ( data . total , data . size , data . current , data . pages ) ;
398
434
}
435
+ else {
436
+ $ ( "#page" ) . empty ( ) ;
437
+ }
399
438
} ,
400
439
error : function ( ) {
401
440
bs4pop . notice ( '初始化异常,请稍后重试!' , { position : 'topcenter' } ) ;
402
441
}
403
442
} )
404
443
}
405
444
406
- function showDetail ( productId ) {
407
- $ ( location ) . prop ( 'href' , "/AWyOfhUI/buyMore/single-product.html?productId=" + productId ) ;
445
+ function showDetail ( productId ) {
446
+ $ ( location ) . prop ( 'href' , "/AWyOfhUI/buyMore/single-product.html?productId=" + productId ) ;
408
447
}
409
448
410
- function likeThis ( productId ) {
449
+ function likeThis ( productId ) {
411
450
window . event . cancelBubble = true ;
412
451
alert ( "大幅度" )
413
452
}
414
453
415
- function carThis ( productId ) {
454
+ function carThis ( productId ) {
416
455
window . event . cancelBubble = true ;
417
456
alert ( "大幅度2" )
418
457
}
0 commit comments