You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

217 lines
4.6 KiB

4 years ago
<template>
<view>
3 years ago
<topnav :title="pagetitle" @tohome='tohome'></topnav>
<view class="content">
<emptyListHint v-if="news.length==0" content="暂无数据">
</emptyListHint>
<view class="listBox" v-else>
4 years ago
<block v-for="(item,index) in news">
<navigator :url="'../../../packageorder/pages/orderinfo/orderinfo?id='+item.order_id">
<view class="listBoxItem">
<view class="listBoxItemLeft">
<view class="leftbg">
<text class="iconfont icon-details"></text>
</view>
</view>
<view class="listBoxItemRight">
<text class="listBoxItemRightText">订单编号{{item.serial}}</text>
3 years ago
<text class="listBoxItemRightfText">{{item.created_at}}
3 years ago
<text class="txtge">|</text>
{{(item.payment_name?item.payment_name:item.payment)}}:{{item.money}}
4 years ago
</text>
</view>
</view>
</navigator>
<view class="listBoxline"></view>
</block>
</view>
3 years ago
4 years ago
</view>
</view>
</template>
<script>
var util = require("../../../../utils/util.js");
export default {
data() {
return {
news: [],
currentPage: 1,
host: "",
pagetitle: "今日统计",
detailtype: "recharge",
duration: "today",
info: [{
"type": "today",
3 years ago
"name": "今日",
4 years ago
"data": {}
}, {
"type": "yesterday",
"name": "昨日营收",
"data": {}
}, {
"type": "this_week",
"name": "本周营收",
"data": {}
}, {
"type": "this_month",
"name": "本月营收",
"data": {}
}]
}
},
onLoad: function(option) {
3 years ago
var type = option.type;
4 years ago
var obj = this.getJsonObj(option.from)[0];
console.log(obj)
this.duration = obj.type;
3 years ago
this.detailtype = type;
this.pagetitle = obj.name + (type == "recharge" ? '营收' : '退款');
4 years ago
this.loadPage(1);
this.host = util.HOST;
},
onReachBottom: function(e) {
3 years ago
console.log(this.currentPage)
4 years ago
this.loadPage(this.currentPage + 1);
},
onPullDownRefresh: function(e) {
this.loadPage(1);
},
3 years ago
methods: {
tohome: function() {
uni.navigateTo({
url: "../../../../pages/index/index"
})
4 years ago
},
getJsonObj: function(keys) {
var newArr = this.info.filter(function(p) {
return p.type == keys;
});
return newArr;
},
loadPage: function(page) {
var that = this;
var currentProject = uni.getStorageSync('currentProject');
util.request({
bindThis: that,
api: 'manager/statistics/by-duration',
customLoading: false,
data: {
page: page,
project_id: currentProject.id,
3 years ago
page_size: 12,
4 years ago
detail_type: that.detailtype,
duration: that.duration
},
utilSuccess: function(r) {
var res = r.data;
uni.stopPullDownRefresh(); // 服务器总条数 < 每页条数, 会将第一页的条数重新返回
console.log(res);
3 years ago
var hasNoMore = that.news.length < 12 && page > 1;
4 years ago
if (hasNoMore || res.length == 0 && page > 1) {
// 已加载到最后一页
uni.showToast({
title: '已加载到最后一页',
icon: 'none'
});
return;
}
var news = that.news;
var _res = [];
if (page == 1) {
news = res;
} else {
news.push(...res);
}
that.currentPage = page;
that.news = news;
},
utilFail: function(res) {
uni.stopPullDownRefresh();
if (page == 1) {
that.currentPage = page;
that.news = [];
}
util.alert(res);
}
});
}
}
}
</script>
<style>
page {
padding-top: 160rpx;
3 years ago
}
.listBox {
3 years ago
background: #FFFFFF;
3 years ago
padding: 20rpx 30rpx;
4 years ago
}
.listBoxItemLeftVideoBox {
width: 240rpx;
height: 133rpx;
}
.listBoxItemRight {
flex-direction: column;
align-items: unset !important;
}
.listBoxItemRightText {
text-align: left;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
width: 600rpx;
font-family: SourceHanSansCN-Normal;
font-size: 32rpx;
color: #333333;
letter-spacing: 0;
}
.listBoxItemRightfText {
font-family: PingFangSC-Regular;
font-size: 24rpx;
color: #666666;
letter-spacing: 0;
text-align: left;
}
3 years ago
.txtge {
color: #666666;
padding: 0rpx 20rpx;
}
4 years ago
.icon-details {
font-size: 40rpx;
color: #43C9CF;
}
.leftbg {
background: rgba(19, 169, 135, 0.10);
border-radius: 100%;
width: 80rpx;
height: 80rpx;
margin-right: 20rpx;
align-items: center;
justify-content: center;
display: flex;
}
3 years ago
</style>