123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>收支明细-创业帮</title>
- <meta name="keywords" content="收支明细-创业帮">
- <meta name="description" content="收支明细-创业帮">
- <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
- <meta content="telephone=no" name="format-detection">
- <meta content="email=no" name="format-detection">
- <meta name="apple-mobile-web-app-title" content="收支明细-创业帮">
- <meta http-equiv="Cache-Control" content="no-siteapp">
- <link rel="stylesheet" href="./static/css/main.css">
- <style>
- .top0{
- top:0;
- z-index:-1;
- }
- </style>
- </head>
- <body class="bgc-back pb0 ovh" style="box-sizing:border-box">
- <div id="app" v-cloak>
- <div class="bgcfff paymenttop abs top0" style="width:100%;"></div>
- <div class="payment-list">
- <van-nav-bar class="user_rank_explan_title user_title_normal" left-arrow @click-left="goback">
- <template #left> <img src="./static/images/left.png" alt=""></template>
- <template #title>
- <van-dropdown-menu :overlay="false">
- <van-dropdown-item :title="showTradeMonth" @open="showPop"></van-dropdown-item>
- </van-dropdown-menu>
- </template>
- </van-nav-bar>
- <van-tabs v-model="active" animated line-width="20" line-height="2" swipeable @change="changetabs">
- <van-tab :title="'收益 ¥'+ profittotal">
- <div class="screenroll ovh-x" ref="wrapper1" v-if="active === 0">
- <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="paymentlist.length === 0 ? 'isnodata':''" style="height:100%;">
- <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
- <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="isnodata"></van-empty>
- <van-cell v-for="item,index in paymentlist" :key="index" :label="item.CreateDate" center>
- <template #default><span>+{{item.ChangeAmount}}</span></template>
- <template #title>
- <div>{{item.Remark}}</div>
- <div class="f12 c666" v-if="item.remakeinfo">备注:{{item.remakeinfo}}</div>
- </template>
- <template #icon><img class="pr16" :src="item.ChangeType === 50 ? './static/images/payment-type-2.png' : './static/images/payment-type-1.png'" alt=""></template>
- </van-cell>
- </van-list>
- </van-pull-refresh>
- </div>
- </van-tab>
- <van-tab :title="'支出 ¥'+ paytotal">
- <div class="screenroll ovh-x" ref="wrapper1" v-if="active === 1">
- <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="paymentlist.length === 0 ? 'isnodata':''" style="height:100%;">
- <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
- <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="isnodata"></van-empty>
- <van-cell v-for="item,index in paymentlist" :key="index" :label="item.CreateDate" center>
- <template #icon><img class="pr16" :src="item.ChangeType == 50 ? './static/images/payment-type-1.png' : './static/images/payment-type-2.png'" alt=""></template>
- <template #title>
- <div>{{item.Remark}}</div>
- <div class="f12 c666" v-if="item.remakeinfo">备注:{{item.remakeinfo}}</div>
- </template>
- <template #default><span>-{{item.ChangeAmount}}</span></template>
- </van-cell>
- </van-list>
- </van-pull-refresh>
- </div>
- </van-tab>
- </van-tabs>
- </div>
- <van-popup v-model="isShow" position="bottom">
- <van-datetime-picker v-model="currentDate" type="year-month" title="选择年月" :min-date="minDate" :max-date="maxDate" :formatter="formatter" @confirm="confirmDate" @cancel="isShow = false"></van-datetime-picker>
- </van-popup>
- </div>
- <script src="./static/js/klm-vv.min.js"></script>
- <script src="./static/js/appfunc.min.js"></script>
- <script src="./static/js/klm-axios-config.js"></script>
- <script src="./static/js/publicfn.js"></script>
- <script>
- // 通过 CDN 引入时不会自动注册 Lazyload 组件
- // 可以通过下面的方式手动注册
- Vue.use(vant.Lazyload);
- PublicLib.SetStatusBarBgColor({bgcolor:'ffffff'});
- // 在 #app 标签下渲染一个按钮组件
- let app = new Vue({
- el: '#app',
- data() {
- return {
- isnodata:false,
- active: 0,
- isShow: false,
- toptitleisshow:true,
- paymentlist:[
- ],
- accountrecordinfo:{
- PageSize:20,
- PageNum:1,
- UserId:'',
- TradeMonth:'',
- Kind:'',
- },
- loading: true,
- finished: false,
- refreshing: false,
- minDate: new Date(2020, 0, 1),
- maxDate: new Date(),
- currentDate: new Date(),
- paytotal:'',
- profittotal:'',
- showTradeMonth:'',
- type:'',
- };
- },
- created() {
- this.type = browsertype.versions.ios ? 'ios' : 'android';
- if(this.type !== 'ios'){
- document.querySelector('.paymenttop').style.height = `${Func.getStatusBarHeight()}px`;
- };
- this.getpaymentlist('refresh');
- this.showTradeMonth = new Date().getFullYear()+'-'+ (new Date().getMonth()+1);
- },
- beforeUpdate(){
- const that = this;
- that.$nextTick(() => {
- if(that.type === 'ios'){
- that.$refs.wrapper1.style.height = `${document.documentElement.clientHeight - 90}px`;
- }else{
- that.$refs.wrapper1.style.height = `${document.documentElement.clientHeight - (90 + Func.getStatusBarHeight())}px`;
- };
- });
- },
- methods: {
- showPop(){
- this.isShow = true;
- },
- formatter(type, val) {
- if (type === 'year') {
- return `${val}年`;
- } else if (type === 'month') {
- return `${val}月`;
- }
- return val;
- },
- confirmDate(value) {
- //- this.paymentlist = [];
- this.showTradeMonth = value.getFullYear().toString() + '-' + (value.getMonth() + 1).toString();
- this.isShow = false;
- //- this.currentDate = new Date(this.accountrecordinfo.TradeMonth);
- this.getpaymentlist('refresh');
- this.loading = false;
- },
- onLoad() {
- if (this.refreshing) {
- //- this.paymentlist = [];
- this.refreshing = false;
- this.accountrecordinfo.PageNum = 0;
- }
- this.accountrecordinfo.PageNum++;
- this.getpaymentlist();
- },
- onRefresh() {
- // 清空列表数据
- this.finished = false;
- // 重新加载数据
- // 将 loading 设置为 true,表示处于加载状态
- this.loading = true;
- this.accountrecordinfo.PageNum = 1;
- this.getpaymentlist('refresh');
- },
- //- 获取列表数据
- async getpaymentlist(type = 'onload'){
- this.accountrecordinfo.TradeMonth = fillzero(formatDate(this.currentDate.getFullYear(),this.currentDate.getMonth() + 1));
- this.accountrecordinfo.Kind = this.active === 0 ? 1 : 2;
- this.accountrecordinfo.UserId = PublicLib.getCookieInfo('userId');
- const res = await getRequest('api/v1/useraccountrecord/list?t='+Math.random(6),JSON.stringify(this.accountrecordinfo));
- res.data.forEach(item=>{
- item.remakeinfo = item.Remark.split('\n')[1];
- item.Remark = item.Remark.split('\n')[0];
- });
- if(res.status === '1'){
- if(res.data.length < this.accountrecordinfo.PageSize) {
- this.finished = true;
- };
- this.paytotal = res.other.Expend;
- this.profittotal = res.other.Income;
- res.data.forEach(item=>{
- item.ChangeAmount = item.ChangeAmount.toFixed(2)
- });
- if(type === 'refresh'){
- this.paymentlist = res.data
- this.refreshing = false;
- }else{
- this.paymentlist.push(...res.data);
- }
- this.loading = false;
- if(this.paymentlist.length === 0) {this.isnodata = true}else{this.isnodata = false};
- }
- },
- //- 切换tab栏
- changetabs(){
- let num = 0;
- this.paymentlist.forEach(item=>{
- if(Number(item.ChangeAmount) === 300){
- num += Number(item.ChangeAmount);
- }
- });
- console.log(num);
- this.finished = false;
- this.accountrecordinfo.PageNum = 1;
- this.paymentlist = [];
- this.getpaymentlist('refresh');
- //- 切换tab是否还原月份
- //- this.currentDate = new Date();
- //- this.accountrecordinfo.TradeMonth = new Date().getFullYear()+'-'+ (new Date().getMonth()+1);
- },
- goback(){
- PublicLib.GoBack({Level:1});
- }
- }
- });
- </script>
- </body>
- </html>
|