|
|
@ -1,22 +1,22 @@ |
|
|
|
<template> |
|
|
|
<view class="turnover-container"> |
|
|
|
<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 :class="[tabID == 4?'active':'']" @click="tabChange(4)">品牌统计</view> |
|
|
|
<view :class="[tabID == 3?'active':'']" @click="tabChange(3)">门店统计</view> |
|
|
|
</view> |
|
|
|
<view class="tc-total-section"> |
|
|
|
|
|
|
|
<!-- 品牌 --> |
|
|
|
<view class="tts-address" v-if="tabID == 0&&storeList.length > 1"> |
|
|
|
<image class="ta-logo" :src="pageInfo.logo" mode="aspectFit"></image> |
|
|
|
<view>{{pageInfo.name || '-'}}</view> |
|
|
|
<view class="tts-address" v-if="tabID == 4&&storeList.length > 1"> |
|
|
|
<image class="ta-logo" :src="totalData.logo" mode="aspectFit"></image> |
|
|
|
<view>{{totalData.brand_or_stadium_name || '-'}}</view> |
|
|
|
</view> |
|
|
|
<!-- 仅有一家店铺情况下,没有品牌查看权限 --> |
|
|
|
<view class="tts-address" v-else-if="tabID == 1&&storeList.length ==1"> |
|
|
|
<view class="tts-address" v-else-if="tabID == 3&&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"> |
|
|
|
<picker v-else-if="tabID == 3" :range="storeList" range-key="name" @change="storeChange"> |
|
|
|
<view class="tts-address"> |
|
|
|
<view>{{curSelectStore.name || '-'}}</view> |
|
|
|
<image mode="aspectFit" src="/static/images/icon/arrow_b2.png"></image> |
|
|
@ -24,12 +24,12 @@ |
|
|
|
</picker> |
|
|
|
|
|
|
|
<view class="tts-money"> |
|
|
|
<view>{{pageInfo.duration || '-'}}</view> |
|
|
|
<view>{{totalData.brand_or_stadium_duration || '-'}}</view> |
|
|
|
<view> |
|
|
|
<text>总收入</text> |
|
|
|
<image mode="aspectFit" src="/static/images/icon/question_mark.png" @click="showQuestionModal"></image> |
|
|
|
</view> |
|
|
|
<view><text>¥</text>{{pageInfo.total || '0'}}</view> |
|
|
|
<view><text>¥</text>{{totalData.total || '0'}}</view> |
|
|
|
</view> |
|
|
|
<view class="tts-preview"> |
|
|
|
<view>线上 ¥0.00</view> |
|
|
@ -112,9 +112,9 @@ export default { |
|
|
|
}, |
|
|
|
data(){ |
|
|
|
return { |
|
|
|
tabID: 0, |
|
|
|
tabID: 4, |
|
|
|
timeTabIdx: 0, |
|
|
|
|
|
|
|
totalData: {}, |
|
|
|
pageInfo: { |
|
|
|
calc: {} |
|
|
|
}, |
|
|
@ -138,7 +138,7 @@ export default { |
|
|
|
|
|
|
|
this.curTime = _timeObj; |
|
|
|
let _storeList = await this.getStoreList(); |
|
|
|
if(_storeList.length == 1)this.tabID = 1; |
|
|
|
if(_storeList.length == 1)this.tabID = 3; |
|
|
|
|
|
|
|
this.$nextTick(this.refreshPageInfo); |
|
|
|
}catch(err){ |
|
|
@ -148,13 +148,48 @@ export default { |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getCountType({ tabID, timeTabIdx }){ |
|
|
|
|
|
|
|
/* |
|
|
|
count_type |
|
|
|
|
|
|
|
3 门店总的统计 |
|
|
|
4 品牌总的统计 |
|
|
|
|
|
|
|
0 统计门店的某一天 (近7天) |
|
|
|
1 统计门店的某一月 |
|
|
|
2 统计门店的某一年 |
|
|
|
5 统计品牌的某一天 (近7天) |
|
|
|
6 统计品牌的某一月 |
|
|
|
7 统计品牌的某一年 |
|
|
|
*/ |
|
|
|
getCountType({ tab_id = -1, time_tab_idx = -1 }){ |
|
|
|
if(time_tab_idx == -1)return tab_id; |
|
|
|
|
|
|
|
let _type = getType(time_tab_idx) || -1 |
|
|
|
|
|
|
|
if(tab_id == 3&&_type != -1)return _type; |
|
|
|
|
|
|
|
if(tab_id == 4&&_type != -1)return _type + 5; |
|
|
|
|
|
|
|
function getType(idx){ |
|
|
|
switch(idx){ |
|
|
|
case 0: |
|
|
|
return 0 |
|
|
|
case 1: |
|
|
|
return 0 |
|
|
|
case 2: |
|
|
|
return 1 |
|
|
|
case 3: |
|
|
|
return 2 |
|
|
|
default: |
|
|
|
return -1 |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
showQuestionModal(){ |
|
|
|
let { totalData } = this |
|
|
|
util.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: '总收入为:线上(微信支付)+线下的总收入(退款已删除)', |
|
|
|
title: totalData.income_record_tips || '提示', |
|
|
|
content: totalData.income_record_name || '总收入为:线上(微信支付)+ 线下的总收入(退款已删除)', |
|
|
|
showCancel: true, |
|
|
|
success: mRes => { |
|
|
|
|
|
|
@ -165,7 +200,7 @@ export default { |
|
|
|
toTimeSelect(type){ |
|
|
|
let { curTime, tabID, curSelectStore } = this; |
|
|
|
let storeID = ''; |
|
|
|
if(tabID == 1)storeID = curSelectStore.id; |
|
|
|
if(tabID == 3)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'); |
|
|
@ -175,16 +210,20 @@ export default { |
|
|
|
let { tabID, timeTabIdx, curSelectStore, curTime } = this; |
|
|
|
let _date; |
|
|
|
if(timeTabIdx == 0)_date = curTime.date || '' |
|
|
|
if(timeTabIdx == 1)_date = util.formatDate({}).substr(0,10); |
|
|
|
// if(timeTabIdx == 1)_date = util.formatDate({}).substr(0,10); |
|
|
|
if(timeTabIdx == 2)_date = `${curTime.month}-01` || '' // 统一格式 |
|
|
|
if(timeTabIdx == 3)_date = `${curTime.year}-01-01` || ''// 统一格式 |
|
|
|
|
|
|
|
|
|
|
|
let _query = { |
|
|
|
type: timeTabIdx + 1, |
|
|
|
date: _date, |
|
|
|
} |
|
|
|
if(tabID == 1)_query.stadium_id = curSelectStore.id; |
|
|
|
|
|
|
|
if(tabID == 3)_query.stadium_id = curSelectStore.id; |
|
|
|
// 汇总 |
|
|
|
this.getCountData({ |
|
|
|
stadium_id: curSelectStore.id || '', |
|
|
|
count_type: this.getCountType({ tab_id: tabID }) |
|
|
|
}) |
|
|
|
this.getBrandInfo(_query); |
|
|
|
}, |
|
|
|
// 店铺切换 |
|
|
@ -265,7 +304,7 @@ export default { |
|
|
|
getCountData({ |
|
|
|
stadium_id, |
|
|
|
count_type, |
|
|
|
time_str, // 筛选=某个时间 y-m-d某一天/y-m某月/y某年 |
|
|
|
time_str = '', // 筛选=某个时间 y-m-d某一天/y-m某月/y某年 |
|
|
|
time_str_max = '', // 筛选 >=某个时间 y-m-d |
|
|
|
time_str_min = '', // 筛选 <=某个时间 y-m-d |
|
|
|
}){ |
|
|
|