@@ -6,7 +6,7 @@ var totalPage,currpage,limit
6
6
$ ( function ( ) {
7
7
getCartList ( )
8
8
$ ( "body" ) . on ( "click" , ".selectSub" , function ( ) {
9
- currentName = this . getAttribute ( 'name ' )
9
+ currentName = this . parentNode . parentNode . getAttribute ( 'id ' )
10
10
if ( this . checked ) {
11
11
if ( multiDeleteArr . length ) {
12
12
for ( var i = 0 ; i < multiDeleteArr . length ; i ++ ) {
@@ -30,7 +30,6 @@ $(function(){
30
30
$ ( "body" ) . on ( 'click' , '.plus' , function ( ) {
31
31
//获取总价列
32
32
var sum_money = this . parentNode . nextSibling ;
33
- console . log ( sum_money )
34
33
while ( sum_money . nodeName == "#text" ) {
35
34
sum_money = sum_money . nextSibling ;
36
35
}
@@ -176,14 +175,12 @@ function getCartList(page,limit){
176
175
"limit" : limit ,
177
176
} ,
178
177
success :function ( data ) {
179
- console . log ( data )
180
178
totalPage = data . pageInfo . pages
181
179
limit = data . pageInfo . pageSize
182
180
currpage = data . pageInfo . pageNum
183
181
$ ( ".papigationPage" ) . html ( "第" + currpage + "页/共" + totalPage + "页" )
184
182
var html = '' ;
185
183
$ . each ( data . cartList , function ( index , cdata ) {
186
- console . log ( cdata )
187
184
html += "<tr index=" + index + " id=" + cdata [ 'cId' ] + "><td><input type=\"checkbox\" class=\"selectSub\" name=" + cdata [ 'bId' ] + "></td>"
188
185
html += "<td><img class=\"table-img\" src=\"img/book_images/" + cdata [ 'bPic' ] + "\" /></td>"
189
186
html += "<td class='bname'>" + cdata [ 'bName' ] + "</td>"
@@ -212,7 +209,7 @@ function getCartList(page,limit){
212
209
if ( $ ( this ) . attr ( 'name' ) == 'book-select' ) {
213
210
console . log ( 'no need 表头不需要' )
214
211
} else {
215
- console . log ( "!!!" , $ ( this ) . attr ( 'name' ) ) ;
212
+ let cId = $ ( this ) . parent ( ) . parent ( ) . attr ( 'id' ) ;
216
213
let bId = $ ( this ) . attr ( 'name' ) ;
217
214
let imgSrc = $ ( this ) . parent ( ) . next ( ) . find ( ".table-img" ) . attr ( 'src' ) ;
218
215
let bname = $ ( this ) . parent ( ) . siblings ( ) . eq ( 1 ) . html ( ) ;
@@ -221,7 +218,7 @@ function getCartList(page,limit){
221
218
let bNum = $ ( this ) . parent ( ) . siblings ( ) . eq ( 4 ) . find ( ".num-text" ) . val ( ) ;
222
219
let bSumdiscountprice = $ ( this ) . parent ( ) . siblings ( ) . eq ( 5 ) . html ( ) ;
223
220
let bSumprice = bPrice * bNum
224
- obj = { "bId" :bId , "imgSrc" :imgSrc , "bName" :bname , "bPrice" :bPrice , "bDiscountprice" :bDiscountprice , "bNum" :bNum , "bSumdiscountprice" :bSumdiscountprice , "bSumprice" :bSumprice } ;
221
+ obj = { "cId" : cId , " bId" :bId , "imgSrc" :imgSrc , "bName" :bname , "bPrice" :bPrice , "bDiscountprice" :bDiscountprice , "bNum" :bNum , "bSumdiscountprice" :bSumdiscountprice , "bSumprice" :bSumprice } ;
225
222
selectedGoods . push ( obj )
226
223
}
227
224
} )
@@ -257,7 +254,7 @@ $("#selectAll").click(function () {
257
254
}
258
255
}
259
256
if ( ! flag ) {
260
- multiDeleteArr . push ( check [ i ] . getAttribute ( 'name ' ) )
257
+ multiDeleteArr . push ( check [ i ] . parentNode . parentNode . getAttribute ( 'id ' ) )
261
258
}
262
259
263
260
}
@@ -298,7 +295,6 @@ $("body").on('change','.selectSub',function(){
298
295
getSumPrice ( )
299
296
} )
300
297
function toPage ( str ) {
301
- console . log ( str )
302
298
if ( str == "index" ) {
303
299
getCartList ( 1 , limit )
304
300
}
0 commit comments