Commit d8de94cae719c3b194022be7a72efba43c08c4a5
1 parent
f25b4d8a
fixbug 【一键订:商家新建桌位或者剩余桌位少于3个,订座页面显示2个相同的桌位】https://www.tapd.cn/57419716/bugtrace…
…/bugs/view?bug_id=1157419716001002122
Showing
1 changed file
with
8 additions
and
14 deletions
| @@ -331,7 +331,7 @@ Page({ | @@ -331,7 +331,7 @@ Page({ | ||
| 331 | tid: form.tabid, | 331 | tid: form.tabid, |
| 332 | rid: this.reserve_id, | 332 | rid: this.reserve_id, |
| 333 | }).then(res => { | 333 | }).then(res => { |
| 334 | - let tables = [], tables_tmp = []; | 334 | + let tables = []; |
| 335 | let tablesLength = 0; | 335 | let tablesLength = 0; |
| 336 | if (tableid.length > 0) { | 336 | if (tableid.length > 0) { |
| 337 | let toastTables={...this.checkedTables} | 337 | let toastTables={...this.checkedTables} |
| @@ -368,25 +368,19 @@ Page({ | @@ -368,25 +368,19 @@ Page({ | ||
| 368 | } | 368 | } |
| 369 | wx.removeStorage({key: 'tableid'}) | 369 | wx.removeStorage({key: 'tableid'}) |
| 370 | } | 370 | } |
| 371 | - console.log('tables',tables); | 371 | + console.log('tables-first',tables); |
| 372 | if(tables.length<1){ | 372 | if(tables.length<1){ |
| 373 | tablesLength=0; | 373 | tablesLength=0; |
| 374 | - tables_tmp = []; | 374 | + let fortids=[]; |
| 375 | res.data.forEach((p,ri) => { | 375 | res.data.forEach((p,ri) => { |
| 376 | p.list.forEach(t => { | 376 | p.list.forEach(t => { |
| 377 | - if(ri>0) tablesLength++; | ||
| 378 | - //if(tables.length>=3) return true; | ||
| 379 | - // if (t.tid == 2) { | ||
| 380 | - // tables.push(t); | ||
| 381 | - // } else { | ||
| 382 | - // tables_tmp.push(t); | ||
| 383 | - // } | ||
| 384 | - tables.push(t); | 377 | + if(fortids._indexOf(t.id)<0) { |
| 378 | + tablesLength++; | ||
| 379 | + tables.push(t); | ||
| 380 | + fortids.push(t.id); | ||
| 381 | + } | ||
| 385 | }) | 382 | }) |
| 386 | }) | 383 | }) |
| 387 | - if (tables.length < 3) { | ||
| 388 | - tables = tables.concat(tables_tmp); | ||
| 389 | - } | ||
| 390 | if (tables.length >= 3) { | 384 | if (tables.length >= 3) { |
| 391 | tables = tables.slice(0, 3); | 385 | tables = tables.slice(0, 3); |
| 392 | } | 386 | } |
-
Please register or login to post a comment