123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456 |
- <template>
- <view class="center">
- <view class="top">
- <image src="../../static/img/sybg.png" mode="" class="sybg"></image>
- <picker mode="date" :value="now_date" @change="bindDateChange" :fields="'date'" :end="now_date">
- <view class="uni-input choose-time">{{now_date}} ></view>
- </picker>
- <view class="top-card">
- <view class="card-tit">
- <view class="tit-point"></view>
- 营业额总览
- </view>
- <view class="card-icon">
- <image src="../../static/icon/moneyget.png" mode=""></image>
- </view>
- <view class="now-tit">
- 本月营业额
- </view>
- <view class="now-money">
- {{month_momey}}
- </view>
- <view class="card-btm flex">
- <view class="card-info flex">
- <image src="../../static/icon/dayget.png" mode=""></image>
- <view class="info-wrap">
- <view class="info-tit">
- 今日营业额
- </view>
- <view class="info-val">
- ¥{{today_momey}}
- </view>
- </view>
- </view>
- <view class="card-info flex">
- <image src="../../static/icon/daydd.png" mode=""></image>
- <view class="info-wrap">
- <view class="info-tit">
- 今日订单
- </view>
- <view class="info-val dan">
- {{today_count }}
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="mid-tit flex">
- <view class="mid-left flex">
- <image src="../../static/icon/time.png" mode=""></image>
- <view class="left-tit">
- 本月订单数
- </view>
- </view>
- <view class="mid-right">
- {{month_count}}单
- </view>
- </view>
- <view class="btm-tab">
- <view class="tab-tit flex">
- <view class="tab-top-left tab-content">
- 月份
- </view>
- <view class="tab-top-center tab-content">
- 订单数
- </view>
- <view class="tab-top-right tab-content">
- 金额
- </view>
- </view>
- <scroll-view scroll-y="true" class="list-wrapper" :style="{'height':height}">
- <!-- 空白页 -->
- <empty v-if=" loaded && monthList.length == 0"></empty>
- <view v-for="item in monthList" class="flex list" :key="item.time">
- <view class="tab-top-left tab-content ">
- {{item.time | time}}
- </view>
- <view class="tab-top-center tab-content">
- {{item.frontNumber}}单
- </view>
- <view class="tab-top-right tab-content money">
- ¥{{item.frontPrice}}
- </view>
- </view>
- <uni-load-more :status="loadingType" v-if="loadingType == 'loading'"></uni-load-more>
- </scroll-view>
- </view>
- </view>
- </template>
- <script>
- import {
- getOrderTime,
- getOrderData,
- getOrderMonth
- } from '@/api/wallet.js'
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
- import empty from '@/components/empty';
- export default {
- components: {
- empty,
- uniLoadMore
- },
- data() {
- let start = new Date(new Date().toLocaleDateString()).getTime()
- let a = new Date()
- let month = a.getMonth() + 1
- let date = a.getDate()
- let year = a.getFullYear() + ''
- if(month < 10) {
- month = '0' +month
- }else {
- month = month + ''
- }
- if(date < 10) {
- date = '0' +date
- }else {
- date = date + ''
- }
- return {
- height: '',
- list: [],
- loadingType: 'more',
- page: 1,
- limit: 10,
- monthList: {},
- loaded: false,
- month_momey: '',//月营业额
- today_momey: '',//日营业额
- tiday_start: start/1000,//今日零点时间戳
- today_count: '',//今日订单数
- now_date: year+ '-' + month + '-' +date
- }
- },
- computed: {
- month_count() {
- if(this.monthList.length > 0) {
- return this.monthList[0].frontNumber
- }else {
- return 0
- }
-
- }
- },
- filters: {
- time(val) {
- let str = ''
- if (val) {
- val = val + ''
- let str1 = val.slice(0, 4)
- let str2 = val.slice(4, )
- return str = str1 + '年' + str2 + '月'
- }
- return str
- }
- },
- onReady(res) {
- var _this = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.list-wrapper').boundingClientRect();
- query.exec(function(res) {
- console.log(res, 'ddddddddddddd');
- _this.height = resu.windowHeight - res[0].top + 'px';
- console.log('打印页面的剩余高度', _this.height);
- });
- },
- fail: res => {}
- });
- },
- onLoad() {
- console.log(this.tiday_start,'start')
- console.log(this.now_date)
- this.getOrderMonth()
- this.getMonth()
- this.getTaday()
- this.getTadayCount()
- },
- methods: {
- // 获取每月数据
- getOrderMonth() {
- this.loadingType = 'loading'
- getOrderMonth().then(({
- data
- }) => {
- this.loadingType = 'noMore'
- let arr = []
- for (let val in data) {
- arr.push({
- time: +val.replace(/-/, ''),
- frontPrice: data[val].frontPrice,
- frontNumber: data[val].frontNumber
- })
- }
- this.monthList = arr.sort(function(a, b) {
- return b.time - a.time
- })
- })
- },
- // 获取本月营业额
- getMonth() {
- getOrderTime({
- type: 1
- }).then(({
- data
- }) => {
- console.log(data, '本月营业额')
- this.month_momey = data.time
- })
- },
- // 获取本日营业额
- getTaday() {
- getOrderTime({
- start: this.tiday_start,
- type: 1
- }).then(({data}) => {
- console.log(data, '本日营业额')
- this.today_momey = data.time
- })
- },
- //获取本日订单数
- getTadayCount() {
- getOrderTime({
- start: this.tiday_start,
- type: 0
- }).then(({data}) => {
- console.log(data, '本日单数')
- this.today_count= data.time
- })
- },
- // 切换月份
- bindDateChange(e) {
- console.log(e.detail,'dddddddddddd')
- this.now_date = e.detail.value
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .top {
- height: 585rpx;
- // background-color: #f6f7f8;
- position: relative;
- .sybg {
- position: absolute;
- width: 100%;
- height: 265rpx;
- }
- .top-card {
- width: 688rpx;
- height: 398rpx;
- padding: 32rpx;
- background: #FFFFFF;
- box-shadow: -2rpx 4rpx 18rpx 0px rgba(0, 110, 238, 0.2);
- border-radius: 24rpx;
- position: absolute;
- right: 0;
- left: 0;
- bottom: 40rpx;
- margin: 0 auto;
- .now-tit {
- text-align: right;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- }
- .now-money {
- padding-top: 10rpx;
- text-align: right;
- font-size: 72rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #52C696;
- &::before {
- content: '¥';
- font-size: 44rpx;
- position: relative;
- bottom: 5rpx;
- }
- }
- .card-icon {
- position: absolute;
- top: 100rpx;
- left: 48rpx;
- width: 224rpx;
- height: 122rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .card-tit {
- display: flex;
- align-items: center;
- .tit-point {
- display: inline-block;
- width: 12rpx;
- height: 32rpx;
- background: #52C696;
- border-radius: 3rpx;
- margin-right: 17rpx;
- }
- font-size: 32rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- }
- .card-btm {
- position: absolute;
- bottom: 32rpx;
- width: 624rpx;
- height: 122rpx;
- background: linear-gradient(180deg, rgba(220, 184, 118, 0.12) 0%, rgba(220, 184, 118, 0) 100%);
- border-radius: 12rpx;
- .card-info {
- width: 50%;
- flex-shrink: 0;
- padding-left: 30rpx;
- justify-content: flex-start;
- align-items: center;
- image {
- width: 48rpx;
- height: 48rpx;
- }
- .info-wrap {
- padding-left: 20rpx;
- .info-tit {
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- }
- .info-val {
- // padding-top: 15rpx;
- font-size: 36rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #DCB876;
- text-align: center;
- }
- .dan {
- &::after {
- content: '单';
- font-size: 32rpx;
- position: relative;
- bottom: 3rpx;
- }
- }
- }
- }
- }
- }
- }
- .mid-tit {
- background-color: #fff;
- height: 80rpx;
- padding: 0 30rpx 0 33rpx;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 12rpx;
- .mid-left {
- image {
- margin-right: 13rpx;
- width: 33rpx;
- height: 33rpx;
- }
- }
- }
- .btm-tab {
- background-color: #fff;
- // padding: 0 30rpx 0 35rpx;
- .tab-top-left {
- text-align: left;
- padding-left: 35rpx;
- }
- .tab-top-center {
- text-align: center;
- }
- .tab-top-right {
- text-align: right;
- padding-right: 30rpx;
- }
- .tab-tit {
- height: 72rpx;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- .tab-content {
- width: 33%;
- }
- }
- }
- .list-wrapper {
- background-color: #fff;
- .list {
- height: 70rpx;
- view {
- width: 33.3%;
- flex-shrink: 0;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- }
- .money {
- color: #52C696;
- }
- }
- }
- .choose-time {
- position: absolute;
- top: 90rpx;
- line-height: 1.5;
- padding-left: 32rpx;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #FFFFFF;
- }
- </style>
|