From 50a41765cd5933aa9b2cc2bc73e6d51531073dd4 Mon Sep 17 00:00:00 2001 From: "liujw155@outlook.com" Date: Fri, 28 Jun 2024 18:05:44 +0800 Subject: [PATCH] finish md240529 demand --- src/pages.json | 6 - src/pages/index/index.vue | 2 +- src/pages/write_off/menu/menu.vue | 11 +- .../verification/pages/site_people/index.vue | 172 +++++++++++++++------ .../pages/site_people/modules/auto_clean.vue | 27 +++- .../pages/site_people/modules/methods_bar.vue | 15 +- .../pages/site_people/modules/modify_number.vue | 64 +++++++- .../pages/site_people/modules/not_leave_modal.vue | 55 ++++++- .../pages/site_people/modules/stadium_select.vue | 6 +- 9 files changed, 290 insertions(+), 68 deletions(-) diff --git a/src/pages.json b/src/pages.json index aa5f62a..813c428 100644 --- a/src/pages.json +++ b/src/pages.json @@ -177,12 +177,6 @@ } }, { - "path": "pages/write_off/number_of_people/number_of_people", - "style": { - "navigationBarTitleText": "查询" - } - }, - { "path": "pages/write_off/menu/menu", "style": { "navigationBarTitleText": "核销订单" diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 11e5583..bca99c3 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -251,7 +251,7 @@ }); } - if(tabInfo.id === 10 || tabInfo.id === 11)return util.routeTo(tabInfo.path + `?brand_id=${indexData.brand.id}`,'nT'); + if([ 10, 11, 4 ].includes(tabInfo.id))return util.routeTo(tabInfo.path + `?brand_id=${indexData.brand.id}`,'nT'); if(tabInfo.id === 12){ // if(!indexData.brand.mini_wechat_appid)return util.showNone('暂无appid!') diff --git a/src/pages/write_off/menu/menu.vue b/src/pages/write_off/menu/menu.vue index e84cae4..5e75f0b 100644 --- a/src/pages/write_off/menu/menu.vue +++ b/src/pages/write_off/menu/menu.vue @@ -56,9 +56,18 @@ import util from '../../../utils/util'; import { WRITE_OFF_STORE_NAME } from '../../../js/once_name'; export default { + data(){ + return { + brand_id: '' + } + }, + onLoad(options){ + this.brand_id = options?.brand_id || '' + }, methods: { toPeopleNum(){ - util.routeTo(`/pages/write_off/number_of_people/number_of_people`, 'nT'); + let _qryStr = `brand_id=${this.brand_id}` + util.routeTo(`/subpackage/verification/pages/site_people/index?${_qryStr}`, 'nT'); }, toOperate(type){ util.$_emit(WRITE_OFF_STORE_NAME, null); diff --git a/src/subpackage/verification/pages/site_people/index.vue b/src/subpackage/verification/pages/site_people/index.vue index a7d9c3f..771b371 100644 --- a/src/subpackage/verification/pages/site_people/index.vue +++ b/src/subpackage/verification/pages/site_people/index.vue @@ -5,7 +5,7 @@ @change:stadium="stadiumChange" > 修改人数 查看未离场订单 - + @@ -52,6 +55,7 @@ export default { // 0时用,对应门店人数/ 1时用,对应门禁人数/ 2时用,对应场地分类人数 return this.siteInfo?.igs_type || 0; }, + // 现场人数 siteNum(){ let { igsType, siteInfo, tabLs } = this; if(igsType === 0) return siteInfo?.stadium_num || 0; @@ -68,13 +72,13 @@ export default { siteInfo: {}, tabLs: [ // { [label], [key], [number], [selected] } - ] + ], + intervalTimer: null } }, async onLoad(options){ this.$refs.stadiumSelect.initStadium(options?.brand_id || '') .then(stadiumInfo=>{ - console.log('stadiumInfo', stadiumInfo); if(!stadiumInfo?.id) return; this.stadiumInfo = stadiumInfo; this.initData({ @@ -83,37 +87,78 @@ export default { }) }) }, + onShow(){ + this.setTimer(); + }, + onHide(){ + this.clearTimer(this.intervalTimer); + }, + onUnload(){ + this.clearTimer(this.intervalTimer); + }, methods: { - stadiumChange(stadiumInfo){ - console.log('stadium change', stadiumInfo); - if(!stadiumInfo?.id) return; + setTimer(){ + this.intervalTimer = setInterval(()=>{ + let { brand_id, id } = this.stadiumInfo; + if(!brand_id || !id) return; + this.refreshData({ brand_id, stadium_id: id }); + }, 3000) + }, + clearTimer(timer){ + try{ + clearInterval(timer); + this.intervalTimer = null; + }catch(err){ + } + }, + stadiumChange(sInfo){ + if(!sInfo?.id) return; + this.stadiumInfo = sInfo; this.initData({ - brand_id: stadiumInfo?.brand_id || '', - stadium_id: stadiumInfo?.id || '' + brand_id: sInfo?.brand_id || '', + stadium_id: sInfo?.id || '' }) }, async initData({ brand_id, stadium_id }){ try{ showLoad(); let _skInfo = await this.getSkNumber({ brand_id, stadium_id }); - console.log('site people index initData', _skInfo); - this.siteInfo = _skInfo || {}; - this.tabLs = []; hideLoad(); - if([1,2].includes(_skInfo?.igs_type)){ - let _tabLs = this.getTabList(_skInfo); - _tabLs[0].selected = true; - this.tabLs = _tabLs; - } + this.resetData(_skInfo); }catch(err){ console.warn('site people index initData err', err); } }, - modifyBtn(){ - this.$refs.modifyNum.show(); + // 重置页面数据 + resetData(res){ + this.siteInfo = res || {}; + this.tabLs = []; + if([1,2].includes(res?.igs_type)){ + let _tabLs = this.getTabList(res); + _tabLs[0].selected = true; + this.tabLs = _tabLs; + } }, - checkNotLeaveBtn(){ - this.$refs.notLeaveModal.show(); + async refreshData({ brand_id, stadium_id }){ + let { siteInfo, tabLs } = this; + let _skInfo = await this.getSkNumber({ brand_id, stadium_id }); + if(_skInfo?.igs_type === siteInfo?.igs_type){ + if(_skInfo?.igs_type === 0)return this.siteInfo = _skInfo; + let _tabLs = this.getTabList(_skInfo); + let _selectedTab = tabLs.find(e=>e.selected); + let _newTabIdx = _tabLs.findIndex(e=>e.key === _selectedTab?.key); + if(_newTabIdx > -1){ + _tabLs[_newTabIdx].selected = true; + this.tabLs = _tabLs; + this.siteInfo = _skInfo; + }else{ + this.resetData(_skInfo); + } + }else{ + this.resetData(_skInfo); + } + this.$forceUpdate(); + }, getSkNumber({ brand_id, stadium_id }){ return server.post({ @@ -125,34 +170,31 @@ export default { failMsg: '加载现场人数信息失败!' }) .then(res=>{ - if(stadium_id === 156){ - res.igs_type = 1; - res.hw_num = [ - { gate_id: 1, gate_name: 'A门', number: 10 }, - { gate_id: 2, gate_name: 'B门', number: 20 }, - { gate_id: 3, gate_name: 'C门', number: 30 }, - ] - } - if(stadium_id === 151){ - res.igs_type = 2; - res.vt_num = [ - { venue_type_key: 1, venue_type_name: '羽毛球', number: 101 }, - { venue_type_key: 2, venue_type_name: '篮球', number: 210 }, - { venue_type_key: 3, venue_type_name: '乒乓球', number: 310 }, - ] - } + // if(stadium_id === 156){ + // res.igs_type = 1; + // res.hw_num = [ + // { gate_id: 1, gate_name: 'A门', number: 10 }, + // { gate_id: 2, gate_name: 'B门', number: 20 }, + // { gate_id: 3, gate_name: 'C门', number: 30 }, + // ] + // } + // if(stadium_id === 151){ + // res.igs_type = 2; + // res.vt_num = [ + // { venue_type_key: 1, venue_type_name: '羽毛球', number: 101 }, + // { venue_type_key: 2, venue_type_name: '篮球', number: 210 }, + // { venue_type_key: 3, venue_type_name: '乒乓球', number: 310 }, + // ] + // } return res || {}; }) .catch(err=>{ console.warn('site people index getSkNumber', err); }) }, - formatSkInfo(res){ - - }, getTabList(res){ let _ls = []; - if(res?.igs_type === 1){ + if(res?.igs_type === 1){ // 门禁 res?.hw_num?.forEach(e=>{ if(e?.gate_id)_ls.push({ label: e?.gate_name || '', @@ -161,7 +203,7 @@ export default { }) }) } - if(res?.igs_type === 2){ + if(res?.igs_type === 2){ // 场地分类 res?.vt_num?.forEach(e=>{ if(e?.venue_type_key)_ls.push({ label: e?.venue_type_name || '', @@ -171,7 +213,51 @@ export default { }) } return _ls; - } + }, + modifyBtn(){ + let { siteNum, stadiumInfo, tabLs, igsType } = this; + let { brand_id, id } = stadiumInfo; + this.$refs.modifyNum.initData({ + num: siteNum, + brand_id, + stadium_id: id, + igsType, + key: tabLs.find(e=>e.selected)?.key, + success: ()=>{ + this.refreshData({ brand_id, stadium_id: id }); + } + }); + }, + // 自动清零状态切换 + switchAutoClean(status){ + let { brand_id, id } = this.stadiumInfo; + server.get({ + url: API.timingOpen, + data: { + brand_id: brand_id, + stadium_id: id, + status: status + }, + failMsg: '操作失败!' + }) + .then(res=>{ + hideLoad(); + showNone('操作成功!'); + setTimeout(_=>{ + this.refreshData({ brand_id, stadium_id: id }); + }, 1000) + }) + }, + checkNotLeaveBtn(){ + let { tabLs, stadiumInfo, igsType } = this; + let { brand_id, id } = stadiumInfo; + this.$refs.notLeaveModal.initData({ + brand_id, + stadium_id: id, + igsType, + key: tabLs.find(e=>e.selected)?.key + }); + }, } } diff --git a/src/subpackage/verification/pages/site_people/modules/auto_clean.vue b/src/subpackage/verification/pages/site_people/modules/auto_clean.vue index 1d304aa..9c3a828 100644 --- a/src/subpackage/verification/pages/site_people/modules/auto_clean.vue +++ b/src/subpackage/verification/pages/site_people/modules/auto_clean.vue @@ -2,7 +2,7 @@ 凌晨自动清零 - + *不开启凌晨自动清零,则现场灯光按【现场散客人数】去判断是否开启或关闭;修改人数会直接影响现场灯光开关! @@ -14,8 +14,31 @@ diff --git a/src/subpackage/verification/pages/site_people/modules/methods_bar.vue b/src/subpackage/verification/pages/site_people/modules/methods_bar.vue index 4a1011e..bd8f495 100644 --- a/src/subpackage/verification/pages/site_people/modules/methods_bar.vue +++ b/src/subpackage/verification/pages/site_people/modules/methods_bar.vue @@ -1,7 +1,7 @@