|
@ -10,7 +10,7 @@ |
|
|
<view>{{pageInfo.name || '-'}}</view> |
|
|
<view>{{pageInfo.name || '-'}}</view> |
|
|
<!-- <image mode="aspectFit" src="/static/images/icon/arrow_b2.png"></image> --> |
|
|
<!-- <image mode="aspectFit" src="/static/images/icon/arrow_b2.png"></image> --> |
|
|
</view> |
|
|
</view> |
|
|
<view class="tts-address" v-else-if="storeList.length ==1"> |
|
|
|
|
|
|
|
|
<view class="tts-address" v-else-if="tabID == 1&&storeList.length ==1"> |
|
|
<view>{{curSelectStore.name || '-'}}</view> |
|
|
<view>{{curSelectStore.name || '-'}}</view> |
|
|
<!-- <image mode="aspectFit" src="/static/images/icon/arrow_b2.png"></image> --> |
|
|
<!-- <image mode="aspectFit" src="/static/images/icon/arrow_b2.png"></image> --> |
|
|
</view> |
|
|
</view> |
|
@ -98,10 +98,13 @@ export default { |
|
|
return { |
|
|
return { |
|
|
tabID: 0, |
|
|
tabID: 0, |
|
|
timeTabID: 0, |
|
|
timeTabID: 0, |
|
|
|
|
|
|
|
|
pageInfo: { |
|
|
pageInfo: { |
|
|
calc: {} |
|
|
calc: {} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
storeList: [], // 店铺列表 |
|
|
storeList: [], // 店铺列表 |
|
|
|
|
|
|
|
|
curSelectStore: {}, // 当前展示数据门店 |
|
|
curSelectStore: {}, // 当前展示数据门店 |
|
|
|
|
|
|
|
|
curTime: { |
|
|
curTime: { |
|
@ -112,25 +115,28 @@ export default { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
onLoad(){ |
|
|
|
|
|
|
|
|
async onLoad(){ |
|
|
let { timeTabID } = this; |
|
|
let { timeTabID } = this; |
|
|
let _timeObj = this.getTime(); |
|
|
let _timeObj = this.getTime(); |
|
|
|
|
|
|
|
|
this.getBrandInfo({ |
|
|
|
|
|
type: timeTabID + 1, |
|
|
|
|
|
date: _timeObj.date, |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.getStoreList(); |
|
|
|
|
|
this.curTime = _timeObj; |
|
|
this.curTime = _timeObj; |
|
|
|
|
|
let _storeList = await this.getStoreList(); |
|
|
|
|
|
if(_storeList.length == 1)this.tabID = 1; |
|
|
|
|
|
|
|
|
|
|
|
this.$nextTick(this.refreshPageInfo); |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
// 时间切换 |
|
|
toTimeSelect(type){ |
|
|
toTimeSelect(type){ |
|
|
let { curTime } = this; |
|
|
|
|
|
if(type == 0)util.routeTo(`/pages/time_select/date/date?date=${curTime.date || ''}`,'nT'); |
|
|
|
|
|
if(type == 2)util.routeTo(`/pages/time_select/month/month?date=${curTime.month || ''}`,'nT'); |
|
|
|
|
|
if(type == 3)util.routeTo(`/pages/time_select/year/year?date=${curTime.year || ''}`,'nT'); |
|
|
|
|
|
|
|
|
let { curTime, tabID, curSelectStore } = this; |
|
|
|
|
|
let storeID = ''; |
|
|
|
|
|
if(tabID == 1)storeID = curSelectStore.id; |
|
|
|
|
|
if(type == 0)util.routeTo(`/pages/time_select/date/date?date=${curTime.date || ''}&store_id=${storeID}`,'nT'); |
|
|
|
|
|
if(type == 2)util.routeTo(`/pages/time_select/month/month?date=${curTime.month || ''}&store_id=${storeID}`,'nT'); |
|
|
|
|
|
if(type == 3)util.routeTo(`/pages/time_select/year/year?date=${curTime.year || ''}&store_id=${storeID}`,'nT'); |
|
|
}, |
|
|
}, |
|
|
|
|
|
// 刷新页面 |
|
|
refreshPageInfo(){ |
|
|
refreshPageInfo(){ |
|
|
let { tabID, timeTabID, curSelectStore, curTime } = this; |
|
|
let { tabID, timeTabID, curSelectStore, curTime } = this; |
|
|
let _date; |
|
|
let _date; |
|
@ -147,14 +153,16 @@ export default { |
|
|
|
|
|
|
|
|
this.getBrandInfo(_query); |
|
|
this.getBrandInfo(_query); |
|
|
}, |
|
|
}, |
|
|
|
|
|
// 店铺切换 |
|
|
storeChange(e){ |
|
|
storeChange(e){ |
|
|
let { storeList } = this; |
|
|
let { storeList } = this; |
|
|
let { value } = e.detail; |
|
|
let { value } = e.detail; |
|
|
this.curSelectStore = storeList[value]; |
|
|
this.curSelectStore = storeList[value]; |
|
|
this.refreshPageInfo(); |
|
|
this.refreshPageInfo(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
// 时间切换 |
|
|
timeChange(date){ |
|
|
timeChange(date){ |
|
|
let { timeTabID, timePickerRange } = this; |
|
|
|
|
|
|
|
|
let { timeTabID } = this; |
|
|
|
|
|
|
|
|
if(timeTabID == 0) this.curTime.date = date; |
|
|
if(timeTabID == 0) this.curTime.date = date; |
|
|
if(timeTabID == 2) this.curTime.month = date; |
|
|
if(timeTabID == 2) this.curTime.month = date; |
|
@ -162,7 +170,7 @@ export default { |
|
|
|
|
|
|
|
|
this.refreshPageInfo(); |
|
|
this.refreshPageInfo(); |
|
|
}, |
|
|
}, |
|
|
// 获取初次时间 |
|
|
|
|
|
|
|
|
// 获取初始时间 |
|
|
getTime(){ |
|
|
getTime(){ |
|
|
let _date = new Date(); |
|
|
let _date = new Date(); |
|
|
let _year = _date.getFullYear(); |
|
|
let _year = _date.getFullYear(); |
|
@ -179,14 +187,16 @@ export default { |
|
|
this.tabID = type; |
|
|
this.tabID = type; |
|
|
this.refreshPageInfo(); |
|
|
this.refreshPageInfo(); |
|
|
},300,300), |
|
|
},300,300), |
|
|
|
|
|
|
|
|
timeTabChange: util.debounce(function(type){ |
|
|
timeTabChange: util.debounce(function(type){ |
|
|
this.timeTabID = type; |
|
|
this.timeTabID = type; |
|
|
this.refreshPageInfo(); |
|
|
this.refreshPageInfo(); |
|
|
},300,300), |
|
|
},300,300), |
|
|
|
|
|
|
|
|
// 获取品牌店铺列表 |
|
|
// 获取品牌店铺列表 |
|
|
getStoreList(){ |
|
|
getStoreList(){ |
|
|
let { brandInfo } = this; |
|
|
let { brandInfo } = this; |
|
|
servers.get({ |
|
|
|
|
|
|
|
|
return servers.get({ |
|
|
url: API.stadiumList, |
|
|
url: API.stadiumList, |
|
|
data: { |
|
|
data: { |
|
|
brand_id: brandInfo.brand.id, |
|
|
brand_id: brandInfo.brand.id, |
|
@ -194,11 +204,14 @@ export default { |
|
|
failMsg: '加载店铺列表失败!', |
|
|
failMsg: '加载店铺列表失败!', |
|
|
}) |
|
|
}) |
|
|
.then(res=>{ |
|
|
.then(res=>{ |
|
|
|
|
|
// let _list = [res.list[0]] || []; |
|
|
let _list = res.list || []; |
|
|
let _list = res.list || []; |
|
|
this.storeList = _list; |
|
|
this.storeList = _list; |
|
|
this.curSelectStore = _list[0] || {}; |
|
|
this.curSelectStore = _list[0] || {}; |
|
|
|
|
|
return _list || []; |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
getBrandInfo({ |
|
|
getBrandInfo({ |
|
|
date, |
|
|
date, |
|
|
type, |
|
|
type, |
|
|