|
|
@ -1,15 +1,19 @@ |
|
|
|
<template> |
|
|
|
<view class="turnover-container"> |
|
|
|
<view class="tc-tab"> |
|
|
|
<view class="tc-tab" v-if="storeList.length > 1"> |
|
|
|
<view :class="[tabID == 0?'active':'']" @click="tabChange(0)">品牌</view> |
|
|
|
<view :class="[tabID == 1?'active':'']" @click="tabChange(1)">门店</view> |
|
|
|
</view> |
|
|
|
<view class="tc-total-section"> |
|
|
|
|
|
|
|
<view class="tts-address" v-if="tabID == 0"> |
|
|
|
<view class="tts-address" v-if="tabID == 0&&storeList.length > 1"> |
|
|
|
<view>{{pageInfo.name || '-'}}</view> |
|
|
|
<!-- <image mode="aspectFit" src="/static/images/icon/arrow_b2.png"></image> --> |
|
|
|
</view> |
|
|
|
<view class="tts-address" v-else-if="storeList.length ==1"> |
|
|
|
<view>{{curSelectStore.name || '-'}}</view> |
|
|
|
<!-- <image mode="aspectFit" src="/static/images/icon/arrow_b2.png"></image> --> |
|
|
|
</view> |
|
|
|
<picker v-else-if="tabID == 1" :range="storeList" range-key="name" @change="storeChange"> |
|
|
|
<view class="tts-address"> |
|
|
|
<view>{{curSelectStore.name || '-'}}</view> |
|
|
@ -31,23 +35,16 @@ |
|
|
|
<view :class="[timeTabID == 3?'active':'']" @click="timeTabChange(3)">年报</view> |
|
|
|
</view> |
|
|
|
<view class="tis-data"> |
|
|
|
<view class="td-date" v-if="timeTabID == 0" @click="toTimeSelect(timeTabID)"> |
|
|
|
<view class="td-date" v-if="timeTabID == 0 || timeTabID == 2 || timeTabID == 3" @click="toTimeSelect(timeTabID)"> |
|
|
|
<text>{{dataTime}}</text> |
|
|
|
<view></view> |
|
|
|
<image mode="aspectFit" src="/static/images/icon/calendar.png"></image> |
|
|
|
</view> |
|
|
|
<view class="td-date" v-else-if="timeTabID == 1"> |
|
|
|
<view class="td-date" v-else> |
|
|
|
<text>{{beforeSevenDay}}</text> |
|
|
|
<!-- <view></view> --> |
|
|
|
<!-- <image mode="aspectFit" src="/static/images/icon/calendar.png"></image> --> |
|
|
|
</view> |
|
|
|
<picker v-else :mode="timePickerMode" :range="timePickerRange" @change="timeChange"> |
|
|
|
<view class="td-date"> |
|
|
|
<text>{{dataTime}}</text> |
|
|
|
<view></view> |
|
|
|
<image mode="aspectFit" src="/static/images/icon/calendar.png"></image> |
|
|
|
</view> |
|
|
|
</picker> |
|
|
|
|
|
|
|
<view class="td-tip">实际收入</view> |
|
|
|
<view class="td-price"><text>¥</text>{{pageInfo.calc.total || 0}}</view> |
|
|
@ -86,24 +83,10 @@ export default { |
|
|
|
...mapState([ 'brandInfo' ]), |
|
|
|
dataTime(){ |
|
|
|
let { curTime, timeTabID } = this; |
|
|
|
if(timeTabID == 0)return util.formatDate({ date: curTime.date, partition: 'zh' }); |
|
|
|
if(timeTabID == 0)return util.formatDate({ date: curTime.date || '', partition: 'zh' }); |
|
|
|
if(timeTabID == 2)return util.formatDate({ date: `${curTime.month}-01`, partition: 'zh' }).substr(0,8); |
|
|
|
if(timeTabID == 3)return `${curTime.year}年`; |
|
|
|
}, |
|
|
|
// picker 类型 |
|
|
|
timePickerMode(){ |
|
|
|
let { timeTabID } = this; |
|
|
|
if(timeTabID == 0)return 'date' |
|
|
|
if(timeTabID == 2)return 'multiSelector' |
|
|
|
if(timeTabID == 3)return 'selector' |
|
|
|
}, |
|
|
|
// picker 列表 |
|
|
|
timePickerRange(){ |
|
|
|
let { timeTabID } = this; |
|
|
|
if(timeTabID == 0)return []; |
|
|
|
if(timeTabID == 2)return this.getMonthRange(); |
|
|
|
if(timeTabID == 3)return new Array(10).fill(1).map((e,i)=>new Date().getFullYear()-i); |
|
|
|
}, |
|
|
|
// 最近7天 |
|
|
|
beforeSevenDay(){ |
|
|
|
let _date = new Date(); |
|
|
@ -145,6 +128,8 @@ export default { |
|
|
|
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'); |
|
|
|
}, |
|
|
|
refreshPageInfo(){ |
|
|
|
let { tabID, timeTabID, curSelectStore, curTime } = this; |
|
|
@ -168,24 +153,15 @@ export default { |
|
|
|
this.curSelectStore = storeList[value]; |
|
|
|
this.refreshPageInfo(); |
|
|
|
}, |
|
|
|
timeChange(e){ |
|
|
|
let { value } = e.detail; |
|
|
|
timeChange(date){ |
|
|
|
let { timeTabID, timePickerRange } = this; |
|
|
|
|
|
|
|
if(timeTabID == 0) this.curTime.date = value; |
|
|
|
if(timeTabID == 2) this.curTime.month = `${timePickerRange[0][value[0]]}-${timePickerRange[1][value[1]]}`; |
|
|
|
if(timeTabID == 3) this.curTime.year = timePickerRange[value]; |
|
|
|
if(timeTabID == 0) this.curTime.date = date; |
|
|
|
if(timeTabID == 2) this.curTime.month = date; |
|
|
|
if(timeTabID == 3) this.curTime.year = date; |
|
|
|
|
|
|
|
this.refreshPageInfo(); |
|
|
|
}, |
|
|
|
// 获取月份 picker 列表 |
|
|
|
getMonthRange(){ |
|
|
|
let _curDate = new Date(); |
|
|
|
return [ |
|
|
|
new Array(5).fill(1).map((e,i)=>_curDate.getFullYear()-i), |
|
|
|
new Array(12).fill(1).map((e,i)=>util.formatNumber(i+1)) |
|
|
|
] |
|
|
|
}, |
|
|
|
// 获取初次时间 |
|
|
|
getTime(){ |
|
|
|
let _date = new Date(); |
|
|
|