From 5f20fb54eaeb9add69a7c04cb7d29bf3d0dd8f47 Mon Sep 17 00:00:00 2001 From: "liujw155@outlook.com" Date: Sat, 7 May 2022 10:40:48 +0800 Subject: [PATCH] add collection stadium_id_filter --- src/pages/collection/info/info.vue | 25 +++++++++++++------------ src/pages/collection/list/list.vue | 3 ++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/pages/collection/info/info.vue b/src/pages/collection/info/info.vue index a5d0fd1..a13d424 100644 --- a/src/pages/collection/info/info.vue +++ b/src/pages/collection/info/info.vue @@ -82,7 +82,10 @@ export default { }, data(){ return { - optionsQuery: {}, + optionsQuery: { + // stadium_id_filter + // brand_id + }, stadiumList: [], curStadium: {}, sceneList: [], @@ -98,7 +101,7 @@ export default { onReachBottom(){ let { curStadium, optionsQuery, curScene, curDate, curType, page } = this; let _query = { - brand_id: optionsQuery.brand_id, + brand_id: optionsQuery.brand_id || '', stadium_id: curStadium.val || '', time_str: curDate, scene: curScene.scene, @@ -119,7 +122,7 @@ export default { this.$nextTick(_=>this.refreshList()); }, async initPage(options){ - let _stadiumLs = await this.getStoreList(options.stadium_id); + let _stadiumLs = await this.getStoreList(options.stadium_id_filter); let _sceneLs = await this.getSceneList(); this.curDate = util.formatDate({}); this.$nextTick(_=>this.refreshList()); @@ -130,7 +133,7 @@ export default { this.recordLs = []; let _query = { - brand_id: optionsQuery.brand_id, + brand_id: optionsQuery.brand_id || '', stadium_id: curStadium.val || '', time_str: curDate, scene: curScene.scene, @@ -192,12 +195,12 @@ export default { }) }, // 店铺列表 - getStoreList(stadium_id = ''){ + getStoreList(stadium_id_filter = ''){ let { optionsQuery } = this; return servers.get({ url: API.consumeCountStadiumList, data: { - brand_id: optionsQuery.brand_id, + brand_id: optionsQuery.brand_id || '', }, failMsg: '加载店铺列表失败!', @@ -205,16 +208,14 @@ export default { .then(res=>{ let _list = res || []; let _cur = null; - if(!!stadium_id){ - let _fiLs = _list.filter(e=> +e.val == stadium_id); + // 页面传参 undefined => 'undefined' + if(stadium_id_filter != undefined&&stadium_id_filter != 'undefined'){ + let _fiLs = _list.filter(e=> e.val == stadium_id_filter); if(_fiLs.length)_cur = _fiLs[0]; } if(_cur&&_cur.val){ this.curStadium = _cur; - }else if(optionsQuery.stadium_id == 0){ - let _fLs = _list.filter(e=> +e.val == -1); - if(_fLs.length)this.curStadium = _fLs[0] || {}; }else{ this.curStadium = _list[0] || {}; } @@ -227,7 +228,7 @@ export default { return servers.get({ url: API.consumeCountGetScene, data: { - brand_id: optionsQuery.brand_id, + brand_id: optionsQuery.brand_id || '', stadium_id: curStadium.val || '', }, failMsg: '加载场景列表失败!', diff --git a/src/pages/collection/list/list.vue b/src/pages/collection/list/list.vue index 00704cf..6b105be 100644 --- a/src/pages/collection/list/list.vue +++ b/src/pages/collection/list/list.vue @@ -65,7 +65,8 @@ export default { }, methods: { toInfo(e){ - util.routeTo(`/pages/collection/info/info?stadium_id=${e.stadium_id}&brand_id=${e.brand_id}`, 'nT') + let _qyStr = `stadium_id_filter=${e.stadium_id_filter}&brand_id=${e.brand_id}` + util.routeTo(`/pages/collection/info/info?${_qyStr}`, 'nT') }, showModal(e){ util.showModal({