Browse Source

add statistics api

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

116
src/pages/collection/info/info.vue

@ -1,7 +1,7 @@
<template>
<view class="collection-info">
<view class="ci-header">
<view class="ch-stadium">
<view class="ch-stadium" v-if="optionsQuery.stadium_id != 0">
<view class="cs-txt">当前门店</view>
<picker :range="stadiumList" range-key="name" @change="storeChange">
<view class="cs-picker">
@ -38,31 +38,34 @@
</view>
<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>
<view class="ct-item" @click="curType = 1">
<view class="ct-item" @click="typeChange(1)">
<view :class="[curType == 1?'active':'']">退款</view>
</view>
</view>
<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 class="ci-ls">
<view class="cl-item">
<view class="ci-name">
<view>线上-订购</view>
<view>+20.00</view>
</view>
<view class="ci-line">
<view>c2021122215468999</view>
<view>退款成功</view>
</view>
<view class="ci-line">
<view>221-12-12 14:13:25</view>
<view></view>
<block v-for="(e, i) in recordLs" :key="i">
<view class="cl-item">
<view class="ci-name">
<view>{{ e.desc || '-' }}</view>
<view :class="e.amount<=0?'black': ''">{{ e.amount>0?'+':'' }}{{ e.amount || '-' }}</view>
</view>
<view class="ci-line">
<view>{{ e.order_no || '-' }}</view>
<view v-if="e.amount<=0">{{ e.refund_desc || '-' }}</view>
</view>
<view class="ci-line">
<view>{{ e.pay_time || '-' }}</view>
<view></view>
</view>
</view>
</view>
</block>
</view>
</view>
</template>
@ -92,50 +95,65 @@ export default {
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){
this.optionsQuery = options || {};
this.initPage(options);
},
methods: {
typeChange(idx){
this.curType = idx;
this.$nextTick(_=>this.refreshList());
},
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 _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(){
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){
this.curDate = e.detail.value;
this.$nextTick(_=>this.refreshList());
},
sceneChange(e){
let { sceneList } = this;
this.curScene = sceneList[e.detail.value];
this.$nextTick(_=>this.refreshList());
},
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}`
// });
this.curStadium = stadiumList[e.detail.value] || {};
util.hideLoad();
}catch(err){
util.hideLoad();
console.warn('dateChange err',err)
}
let { stadiumList } = this;
this.curStadium = stadiumList[e.detail.value] || {};
this.$nextTick(_=>this.refreshList());
},
getRecordLs({
brand_id,
@ -147,6 +165,7 @@ export default {
page = 1,
}){
let { optionsQuery } = this;
util.showLoad();
return servers.get({
url: API.consumeCountDetailLs,
data: {
@ -162,6 +181,7 @@ export default {
})
.then(res=>{
util.hideLoad();
let _list = res.list || [];
this.totalInfo = res || {};
if(page == 1)return this.recordLs = _list;
@ -226,10 +246,13 @@ export default {
background-color: #fff;
}
.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{
padding: 0 24upx;
padding: 26upx 24upx 0;
.ch-stadium{
padding: 26upx 0;
padding-bottom: 26upx;
@include centerFlex(space-between);
.cs-txt{
@ -389,7 +412,9 @@ export default {
padding: 0 30upx;
.cl-item{
padding: 30upx 0;
border-bottom: 2upx solid #D8D8D8;
&:not(:last-child){
border-bottom: 2upx solid #D8D8D8;
}
.ci-name{
margin-bottom: 8upx;
@include centerFlex(space-between);
@ -402,6 +427,9 @@ export default {
text-align: right;
font-weight: 500;
color: #F6843E;
&.black{
color: #1A1A1A;
}
}
}
}

Loading…
Cancel
Save