|
|
@ -5,7 +5,7 @@ |
|
|
|
@change:stadium="stadiumChange" |
|
|
|
></stadium-select> |
|
|
|
<methods-bar |
|
|
|
|
|
|
|
:type="igsType" |
|
|
|
></methods-bar> |
|
|
|
|
|
|
|
<classify-tab |
|
|
@ -19,7 +19,10 @@ |
|
|
|
<view class="sp-modify" @click="modifyBtn">修改人数</view> |
|
|
|
<view class="sp-check" @click="checkNotLeaveBtn">查看未离场订单</view> |
|
|
|
|
|
|
|
<auto-clean></auto-clean> |
|
|
|
<auto-clean |
|
|
|
:auto-clean="siteInfo.present_person_number_clear" |
|
|
|
@switch:change="switchAutoClean" |
|
|
|
></auto-clean> |
|
|
|
|
|
|
|
<modify-number ref="modifyNum"></modify-number> |
|
|
|
<not-leave-modal ref="notLeaveModal"></not-leave-modal> |
|
|
@ -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 |
|
|
|
}); |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|