Browse Source

add data api

organize
刘嘉炜 3 years ago
parent
commit
af8dfdc19d
  1. 18512
      package-lock.json
  2. 4
      src/js/api.js
  3. 112
      src/pages/turnover/turnover.vue
  4. BIN
      src/static/images/icon/question_mark.png

18512
package-lock.json
File diff suppressed because it is too large
View File

4
src/js/api.js

@ -49,6 +49,10 @@ export const API = {
turnoverBrand: `${ORIGIN}/admin/assistant/turnover/brand/calc`, // 营业额记录-品牌
turnoverStadium: `${ORIGIN}/admin/assistant/turnover/brand/stadium/calc`, // 营业额记录-门店
// 20220415 新统计接口
consumeCountGet: `${ORIGIN}/admin/stadium/consumeCount/get`, // 收入统计获取 包含年月日近7天
turnoverDay: `${ORIGIN}/admin/assistant/turnover/calc/day`, // 营业额记录-时间选择-天
turnoverMonth: `${ORIGIN}/admin/assistant/turnover/calc/month`, // 营业额记录-时间选择-月
turnoverYear: `${ORIGIN}/admin/assistant/turnover/calc/year`, // 营业额记录-时间选择-年

112
src/pages/turnover/turnover.vue

@ -10,7 +10,6 @@
<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>
<image class="ta-change-btn" mode="aspectFit" src="/static/images/icon/arrow_b2.png"></image>
</view>
<!-- 仅有一家店铺情况下没有品牌查看权限 -->
<view class="tts-address" v-else-if="tabID == 1&&storeList.length ==1">
@ -26,7 +25,10 @@
<view class="tts-money">
<view>{{pageInfo.duration || '-'}}</view>
<view><text>总收入</text><image></image></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>
<view class="tts-preview">
@ -36,13 +38,13 @@
</view>
<view class="tc-info-section">
<view class="tis-tab">
<view :class="[timeTabID == 0?'active':'']" @click="timeTabChange(0)">日报</view>
<view :class="[timeTabID == 1?'active':'']" @click="timeTabChange(1)">近7天</view>
<view :class="[timeTabID == 2?'active':'']" @click="timeTabChange(2)">月报</view>
<view :class="[timeTabID == 3?'active':'']" @click="timeTabChange(3)">年报</view>
<view :class="[timeTabIdx == 0?'active':'']" @click="timeTabChange(0)">日报</view>
<view :class="[timeTabIdx == 1?'active':'']" @click="timeTabChange(1)">近7天</view>
<view :class="[timeTabIdx == 2?'active':'']" @click="timeTabChange(2)">月报</view>
<view :class="[timeTabIdx == 3?'active':'']" @click="timeTabChange(3)">年报</view>
</view>
<view class="tis-data">
<view class="td-date" v-if="timeTabID == 0 || timeTabID == 2 || timeTabID == 3" @click="toTimeSelect(timeTabID)">
<view class="td-date" v-if="timeTabIdx == 0 || timeTabIdx == 2 || timeTabIdx == 3" @click="toTimeSelect(timeTabIdx)">
<text>{{dataTime}}</text>
<view></view>
<image mode="aspectFit" src="/static/images/icon/calendar.png"></image>
@ -96,10 +98,10 @@ export default {
computed: {
...mapState([ 'brandInfo' ]),
dataTime(){
let { curTime, timeTabID } = this;
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}`;
let { curTime, timeTabIdx } = this;
if(timeTabIdx == 0)return util.formatDate({ date: curTime.date || '', partition: 'zh' });
if(timeTabIdx == 2)return util.formatDate({ date: `${curTime.month}-01`, partition: 'zh' }).substr(0,8);
if(timeTabIdx == 3)return `${curTime.year}`;
},
// 7
beforeSevenDay(){
@ -111,7 +113,7 @@ export default {
data(){
return {
tabID: 0,
timeTabID: 0,
timeTabIdx: 0,
pageInfo: {
calc: {}
@ -131,7 +133,7 @@ export default {
},
async onLoad(){
try{
let { timeTabID } = this;
let { timeTabIdx } = this;
let _timeObj = this.getTime();
this.curTime = _timeObj;
@ -146,6 +148,19 @@ export default {
},
methods: {
getCountType({ tabID, timeTabIdx }){
},
showQuestionModal(){
util.showModal({
title: '提示',
content: '总收入为:线上(微信支付)+线下的总收入(退款已删除)',
showCancel: true,
success: mRes => {
}
})
},
//
toTimeSelect(type){
let { curTime, tabID, curSelectStore } = this;
@ -157,15 +172,15 @@ export default {
},
//
refreshPageInfo(){
let { tabID, timeTabID, curSelectStore, curTime } = this;
let { tabID, timeTabIdx, curSelectStore, curTime } = this;
let _date;
if(timeTabID == 0)_date = curTime.date || ''
if(timeTabID == 1)_date = util.formatDate({}).substr(0,10);
if(timeTabID == 2)_date = `${curTime.month}-01` || '' //
if(timeTabID == 3)_date = `${curTime.year}-01-01` || ''//
if(timeTabIdx == 0)_date = curTime.date || ''
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: timeTabID + 1,
type: timeTabIdx + 1,
date: _date,
}
if(tabID == 1)_query.stadium_id = curSelectStore.id;
@ -181,11 +196,11 @@ export default {
},
//
timeChange(date){
let { timeTabID } = this;
let { timeTabIdx } = this;
if(timeTabID == 0) this.curTime.date = date;
if(timeTabID == 2) this.curTime.month = date;
if(timeTabID == 3) this.curTime.year = date;
if(timeTabIdx == 0) this.curTime.date = date;
if(timeTabIdx == 2) this.curTime.month = date;
if(timeTabIdx == 3) this.curTime.year = date;
this.refreshPageInfo();
},
@ -202,13 +217,14 @@ export default {
}
},
tabChange: util.debounce(function(type){
this.tabID = type;
this.refreshPageInfo();
},300,300),
timeTabChange: util.debounce(function(type){
this.timeTabID = type;
this.timeTabIdx = type;
this.refreshPageInfo();
},300,300),
@ -232,6 +248,50 @@ export default {
return _list || [];
})
},
/*
count_type
3 门店总的统计
4 品牌总的统计
0 统计门店的某一天
1 统计门店的某一月
2 统计门店的某一年
5 统计品牌的某一天
6 统计品牌的某一月
7 统计品牌的某一年
*/
getCountData({
stadium_id,
count_type,
time_str, // = y-m-d/y-m/y
time_str_max = '', // >= y-m-d
time_str_min = '', // <= y-m-d
}){
let { brandInfo } = this;
util.showLoad();
servers.get({
url: API.consumeCountGet,
data: {
brand_id: brandInfo.brand.id,
'filter[brand_id:eq]': brandInfo.brand.id,
'filter[stadium_id:eq]': stadium_id,
'filter[count_type:eq]': count_type,
'filter[time_str:eq]': time_str,
'filter[time_str:egt]': time_str_max,
'filter[time_str:elt]': time_str_min,
},
failMsg: '加载失败!'
})
.then(res=>{
util.hideLoad();
let _data = res || {};
if(count_type == 3 || count_type == 4)return this.totalData = _data;
this.botData = _data
})
.catch(util.hideLoad)
},
getBrandInfo({
date,
@ -322,9 +382,6 @@ export default {
width: 52upx;
height: 52upx;
}
.ta-change-btn{
background-color: skyblue;
}
}
.tts-money{
padding-top: 48upx;
@ -351,7 +408,6 @@ export default {
width: 28upx;
height: 28upx;
margin-left: 8upx;
background-color: skyblue;
}
}
&:nth-child(3){

BIN
src/static/images/icon/question_mark.png

After

Width: 56  |  Height: 56  |  Size: 1023 B

Loading…
Cancel
Save