Browse Source

add statistics api

organize
刘嘉炜 3 years ago
parent
commit
9d289e953a
  1. 92
      src/pages/collection/info/info.vue

92
src/pages/collection/info/info.vue

@ -1,7 +1,7 @@
<template> <template>
<view class="collection-info"> <view class="collection-info">
<view class="ci-header"> <view class="ci-header">
<view class="ch-stadium">
<view class="ch-stadium" v-if="optionsQuery.stadium_id != 0">
<view class="cs-txt">当前门店</view> <view class="cs-txt">当前门店</view>
<picker :range="stadiumList" range-key="name" @change="storeChange"> <picker :range="stadiumList" range-key="name" @change="storeChange">
<view class="cs-picker"> <view class="cs-picker">
@ -38,31 +38,34 @@
</view> </view>
<view class="ci-tab"> <view class="ci-tab">
<view class="ct-item" @click="curType = 0">
<view class="ct-item" @click="typeChange(0)">
<view :class="[curType == 0?'active':'']">全部</view> <view :class="[curType == 0?'active':'']">全部</view>
</view> </view>
<view class="ct-item" @click="curType = 1">
<view class="ct-item" @click="typeChange(1)">
<view :class="[curType == 1?'active':'']">退款</view> <view :class="[curType == 1?'active':'']">退款</view>
</view> </view>
</view> </view>
<view class="ci-total"> <view class="ci-total">
收款100<text>10000.00</text>) 退款2<text>200.00</text>
收款{{ totalInfo.income_num || 0 }}<text>{{ totalInfo.income_amount || 0 }}</text>) 退款{{ totalInfo.refund_num || 0 }}<text>{{ totalInfo.refund_amount || 0 }}</text>
</view> </view>
<view class="ci-ls"> <view class="ci-ls">
<block v-for="(e, i) in recordLs" :key="i">
<view class="cl-item"> <view class="cl-item">
<view class="ci-name"> <view class="ci-name">
<view>线上-订购</view>
<view>+20.00</view>
<view>{{ e.desc || '-' }}</view>
<view :class="e.amount<=0?'black': ''">{{ e.amount>0?'+':'' }}{{ e.amount || '-' }}</view>
</view> </view>
<view class="ci-line"> <view class="ci-line">
<view>c2021122215468999</view>
<view>退款成功</view>
<view>{{ e.order_no || '-' }}</view>
<view v-if="e.amount<=0">{{ e.refund_desc || '-' }}</view>
</view> </view>
<view class="ci-line"> <view class="ci-line">
<view>221-12-12 14:13:25</view>
<view>{{ e.pay_time || '-' }}</view>
<view></view> <view></view>
</view> </view>
</view> </view>
</block>
</view> </view>
</view> </view>
</template> </template>
@ -92,50 +95,65 @@ export default {
page: 1 page: 1
} }
}, },
onReachBottom(){
let { curStadium, optionsQuery, curScene, curDate, curType, page } = this;
let _query = {
brand_id: optionsQuery.brand_id,
stadium_id: optionsQuery.stadium_id == 0 ? -1 : curStadium.id,
time_str: curDate,
scene: curScene.scene,
type: curType == 1 ? '退款' : '全部',
page: ++page
}
this.getRecordLs(_query);
},
onLoad(options){ onLoad(options){
this.optionsQuery = options || {}; this.optionsQuery = options || {};
this.initPage(options); this.initPage(options);
}, },
methods: { methods: {
typeChange(idx){
this.curType = idx;
this.$nextTick(_=>this.refreshList());
},
async initPage(options){ async initPage(options){
let _stadiumLs = await this.getStoreList(options.stadium_id);
let _stadiumLs = [];
if(!!options.stadium_id)_stadiumLs = await this.getStoreList(options.stadium_id);
let _sceneLs = await this.getSceneList(); let _sceneLs = await this.getSceneList();
let _date = this.curDate = util.formatDate({});
let _sid = options.stadium_id
this.getRecordLs({
brand_id: options.brand_id,
stadium_id: _sid,
time_str: _date,
scene: _sceneLs[0].scene,
})
this.curDate = util.formatDate({});
this.$nextTick(_=>this.refreshList());
}, },
refreshList(){ refreshList(){
let { curStadium, optionsQuery, curScene, curDate, curType } = this; let { curStadium, optionsQuery, curScene, curDate, curType } = this;
this.page = 1;
this.recordLs = [];
let _query = {
brand_id: optionsQuery.brand_id,
stadium_id: optionsQuery.stadium_id == 0 ? -1 : curStadium.id,
time_str: curDate,
scene: curScene.scene,
type: curType == 1 ? '退款' : '全部'
}
this.getRecordLs(_query);
}, },
dateChange(e){ dateChange(e){
this.curDate = e.detail.value; this.curDate = e.detail.value;
this.$nextTick(_=>this.refreshList());
}, },
sceneChange(e){ sceneChange(e){
let { sceneList } = this; let { sceneList } = this;
this.curScene = sceneList[e.detail.value]; this.curScene = sceneList[e.detail.value];
this.$nextTick(_=>this.refreshList());
}, },
async storeChange(e){ async storeChange(e){
try{
util.showLoad();
// let { curDate, stadiumList } = this;
// await this.getRecordList({
// stadium_id: stadiumList[e.detail.value].id || '',
// date: `${curDate.year}-${curDate.month}`
// });
let { stadiumList } = this;
this.curStadium = stadiumList[e.detail.value] || {}; this.curStadium = stadiumList[e.detail.value] || {};
util.hideLoad();
}catch(err){
util.hideLoad();
console.warn('dateChange err',err)
}
this.$nextTick(_=>this.refreshList());
}, },
getRecordLs({ getRecordLs({
brand_id, brand_id,
@ -147,6 +165,7 @@ export default {
page = 1, page = 1,
}){ }){
let { optionsQuery } = this; let { optionsQuery } = this;
util.showLoad();
return servers.get({ return servers.get({
url: API.consumeCountDetailLs, url: API.consumeCountDetailLs,
data: { data: {
@ -162,6 +181,7 @@ export default {
}) })
.then(res=>{ .then(res=>{
util.hideLoad();
let _list = res.list || []; let _list = res.list || [];
this.totalInfo = res || {}; this.totalInfo = res || {};
if(page == 1)return this.recordLs = _list; if(page == 1)return this.recordLs = _list;
@ -226,10 +246,13 @@ export default {
background-color: #fff; background-color: #fff;
} }
.collection-info{ .collection-info{
padding-bottom: 0upx;
padding-bottom: calc( 0upx + constant(safe-area-inset-bottom)); /* 兼容 iOS < 11.2 */
padding-bottom: calc( 0upx + env(safe-area-inset-bottom)); /* 兼容 iOS >= 11.2 */
.ci-header{ .ci-header{
padding: 0 24upx;
padding: 26upx 24upx 0;
.ch-stadium{ .ch-stadium{
padding: 26upx 0;
padding-bottom: 26upx;
@include centerFlex(space-between); @include centerFlex(space-between);
.cs-txt{ .cs-txt{
@ -389,7 +412,9 @@ export default {
padding: 0 30upx; padding: 0 30upx;
.cl-item{ .cl-item{
padding: 30upx 0; padding: 30upx 0;
&:not(:last-child){
border-bottom: 2upx solid #D8D8D8; border-bottom: 2upx solid #D8D8D8;
}
.ci-name{ .ci-name{
margin-bottom: 8upx; margin-bottom: 8upx;
@include centerFlex(space-between); @include centerFlex(space-between);
@ -402,6 +427,9 @@ export default {
text-align: right; text-align: right;
font-weight: 500; font-weight: 500;
color: #F6843E; color: #F6843E;
&.black{
color: #1A1A1A;
}
} }
} }
} }

Loading…
Cancel
Save