123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <!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">
- </head>
- <body class="bgc-back">
- <div id="app" v-cloak>
- <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="accountrecordinfo.TradeMonth" @open="showPop"></van-dropdown-item>
- </van-dropdown-menu>
- </template>
- </van-nav-bar>
- <van-tabs v-model="active" animated line-width="20" line-height="2" @click="changetabs">
- <van-tab :title="'收益 ¥'+ profittotal">
- <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="paymentlist.length === 0 ? 'isnodata':''">
- <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" :title="item.Remark" :label="item.CreateDate" center>
- <template #default><span>+{{item.ChangeAmount | tofixed2}}</span></template>
- <template #icon><img class="pr16" :src="item.type == 1 ? './static/images/payment-type-1.png' : './static/images/payment-type-2.png'" alt=""></template>
- </van-cell>
- </van-list>
- </van-pull-refresh>
- </van-tab>
- <van-tab :title="'支出 ¥'+ paytotal">
- <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="paymentlist.length === 0 ? 'isnodata':''">
- <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" :title="item.Remark" :label="item.CreateDate" center>
- <template #icon><img class="pr16" :src="item.ChangeType == 1 ? './static/images/payment-type-1.png' : './static/images/payment-type-2.png'" alt=""></template>
- <template #default><span>-{{item.ChangeAmount | tofixed2}}</span></template>
- </van-cell>
- </van-list>
- </van-pull-refresh>
- </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/klm-axios-config.js"></script>
- <script>
- // 通过 CDN 引入时不会自动注册 Lazyload 组件
- // 可以通过下面的方式手动注册
- Vue.use(vant.Lazyload);
-
- // 在 #app 标签下渲染一个按钮组件
- let app = new Vue({
- el: '#app',
- data() {
- return {
- isnodata:false,
- active: 0,
- isShow: false,
- toptitleisshow:true,
- paymentlist:[
- ],
- accountrecordinfo:{
- PageSize:10,
- PageNum:1,
- UserId:'',
- TradeMonth:'',
- Kind:'',
- },
- loading: false,
- finished: false,
- refreshing: false,
- minDate: new Date(2020, 0, 1),
- maxDate: new Date(),
- currentDate: new Date(),
- paytotal:'',
- profittotal:''
- };
- },
- created() {
- this.accountrecordinfo.TradeMonth = new Date().getFullYear()+'-'+ (new Date().getMonth()+1);
- this.getpaymentlist();
- },
- methods: {
- showPop(){
- this.isShow = true;
- },
- formatter(type, val) {
- if (type === 'year') {
- return `${val}年`;
- } else if (type === 'month') {
- return `${val}月`;
- }
- return val;
- },
- confirmDate(value) {
- this.accountrecordinfo.TradeMonth = value.getFullYear().toString() + '-' + (value.getMonth() + 1).toString();
- console.log(this.accountrecordinfo.TradeMonth)
- this.isShow = false;
- this.paymentlist = [];
- //- this.currentDate = new Date(this.accountrecordinfo.TradeMonth);
- this.getpaymentlist();
- 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.onLoad();
- },
- //- 获取列表数据
- async getpaymentlist(){
- this.accountrecordinfo.Kind = this.active === 0 ? 1 : 2;
- this.accountrecordinfo.UserId = PublicLib.getCookieInfo('userId');
- const res = await getRequest('/api/v1/useraccountrecord/list',JSON.stringify(this.accountrecordinfo));
- this.paymentlist = [];
- if(res.status === 1) {
- if(res.data.length < this.accountrecordinfo.PageSize) {
- this.finished = true;
- };
- this.paytotal = 0.00.toFixed(2);
- this.profittotal = 0.00.toFixed(2);
- this.paymentlist.push(...res.data);
- if(this.accountrecordinfo.TradeMonth === new Date().getFullYear()+'-'+ (new Date().getMonth()+1)) {
- this.paytotal = 0.00.toFixed(2);
- this.profittotal = 10.50.toFixed(2);
- }
- if(this.active === 0 && this.accountrecordinfo.TradeMonth === new Date().getFullYear()+'-'+ (new Date().getMonth()+1)) {
- this.paymentlist = [{Remark:'注册奖励',ChangeAmount:10.50,CreateDate:new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + (new Date().getDate())}];
- }
- this.loading = false;
- if(this.paymentlist.length === 0) {this.isnodata = true}else{this.isnodata = false};
- }
- },
- //- 切换tab栏
- async changetabs(){
- this.accountrecordinfo.PageNum = 1;
- await this.getpaymentlist();
- //- 切换tab是否还原月份(默认不还原)
- //- this.currentDate = new Date();
- //- this.accountrecordinfo.TradeMonth = new Date().getFullYear()+'-'+ (new Date().getMonth()+1);
- },
- goback(){
- PublicLib.GoBack({Level:1});
- }
- }
- });
- </script>
- </body>
- </html>
|