Browse Source

add linkage

organize
刘嘉炜 3 years ago
parent
commit
0cae652ee8
  1. 58
      src/pages/site/manage/manage.vue

58
src/pages/site/manage/manage.vue

@ -228,6 +228,8 @@ export default {
getVenueStatusnInfo(info){
//
if(info.overdue&&info.type == 'empty_venue')return { zh_text: info.message || info.price, type: 'overdue', className: 'gray', }
// isLinkage
if(info.isLinkage&&info.isLinkage == true)return { zh_text: info.message || info.price || 0, type: 'linkage', className: 'gray', }
switch(info.type){
case 'no_price_venue':
return { zh_text: info.message || '无法订场', type: info.type, className: 'grey', }
@ -298,7 +300,7 @@ export default {
stadium_id: curStoreInfo.id || '',
date: curDateInfo.dateStr || '',
})
let _list = _res.dashboard || [];
let _list = _res || [];
if(!_list.length)return util.showNone('没有场地信息!');
this.venueList = _list || [];
@ -350,7 +352,9 @@ export default {
venueInfo: {...this.getVenueStatusnInfo(_curTarget)},
}
}
if(_curTarget.type !== 'empty_venue')return;
if(_curTarget.isLinkage == true)return;
_venueList[i].items[j]._isSelect = !_curTarget._isSelect;
@ -373,7 +377,13 @@ export default {
// }) || [];
// ----->
//
_venueList = this.checkLinkageVenue({
group: i,
venueList: _venueList,
selectedKey: '_isSelect',
linkageKey: 'isLinkage',
})
this.venueList = _venueList;
this.$nextTick(_=>{
// if(_ctnList.length>1){
@ -384,6 +394,39 @@ export default {
this.getSelectedVenues();
})
},
// &
checkLinkageVenue({
group = 0, //
venueList = [], //
selectedKey = 'selectedKey', // key
linkageKey = 'linkageKey', // key
curTag
}){
let _curGroupInfo = {...venueList[group]};
for(let i=0; i<venueList.length; i++){
let _link_venue_ids = _curGroupInfo.link_venue_ids || [];
if(_link_venue_ids.includes(venueList[i].venue_id)){
_curGroupInfo.items.forEach(ele=>{
//
if(venueList[i].link_venue_ids && venueList[i].link_venue_ids.length == 1){
venueList[i].items[ele._defineIndex][linkageKey] = !!_curGroupInfo.items[ele._defineIndex][selectedKey];
}
//
if(venueList[i].link_venue_ids && venueList[i].link_venue_ids.length > 1){
let _link_venueLs = venueList.filter(item=> venueList[i].link_venue_ids.includes(item.venue_id));
// ex: [ true, false ];
let _link_venueLs_selectedLs = _link_venueLs.map(el=> el['items'][ele._defineIndex] && el['items'][ele._defineIndex][selectedKey]);
venueList[i].items[ele._defineIndex][linkageKey] = _link_venueLs_selectedLs.includes(true); //
}
});
}
}
return venueList || [];
},
//
getSelectedVenues(){
let { venueList } = this;
@ -471,7 +514,15 @@ export default {
return servers.get({
url: API.venue.venueList,
data: { stadium_id, type_key, date },
failMsg: '加载分类失败!'
failMsg: '加载场地列表失败!'
})
.then(res=>{
let _ls = res.dashboard || [];
_ls.map(ele => ele.items.map((item, index) =>{
item._defineIndex = index;
return item;
}))
return _ls;
})
},
//
@ -500,7 +551,6 @@ export default {
}catch(err){
console.warn('get fixed nodes info err', err);
}
console.warn(_fixedTopInfo, _fixedBotInfo)
let _totalHeight = ( _fixedBotInfo.height || 0 ) + ( _fixedTopInfo.height || 0 );
this.venueAreaSize = `width:${ _sysInfo.screenWidth || 0 }px;height:${ ( _sysInfo.windowHeight || 0 ) - _totalHeight }px;`
// util.getNodeMes('.sv-time-interval')

Loading…
Cancel
Save