user-payment-list.html 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>收支明细-爽客邦</title>
  6. <meta name="keywords" content="收支明细-爽客邦">
  7. <meta name="description" content="收支明细-爽客邦">
  8. <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  11. <meta content="telephone=no" name="format-detection">
  12. <meta content="email=no" name="format-detection">
  13. <meta name="apple-mobile-web-app-title" content="收支明细-爽客邦">
  14. <meta http-equiv="Cache-Control" content="no-siteapp">
  15. <link rel="stylesheet" href="./static/css/main.css">
  16. </head>
  17. <body class="bgc-back">
  18. <div id="app" v-cloak>
  19. <div class="payment-list">
  20. <van-nav-bar class="user_rank_explan_title user_title_normal" left-arrow @click-left="goback">
  21. <template #left> <img src="./static/images/left.png" alt=""></template>
  22. <template #title>
  23. <van-dropdown-menu :overlay="false">
  24. <van-dropdown-item :title="accountrecordinfo.TradeMonth" @open="showPop"></van-dropdown-item>
  25. </van-dropdown-menu>
  26. </template>
  27. </van-nav-bar>
  28. <van-tabs v-model="active" animated line-width="20" line-height="2" @click="changetabs">
  29. <van-tab :title="'收益 ¥'+ profittotal">
  30. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="paymentlist.length === 0 ? 'isnodata':''">
  31. <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
  32. <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="isnodata"></van-empty>
  33. <van-cell v-for="item,index in paymentlist" :key="index" :title="item.Remark" :label="item.CreateDate" center>
  34. <template #default><span>+{{item.ChangeAmount | tofixed2}}</span></template>
  35. <template #icon><img class="pr16" :src="item.type == 1 ? './static/images/payment-type-1.png' : './static/images/payment-type-2.png'" alt=""></template>
  36. </van-cell>
  37. </van-list>
  38. </van-pull-refresh>
  39. </van-tab>
  40. <van-tab :title="'支出 ¥'+ paytotal">
  41. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="paymentlist.length === 0 ? 'isnodata':''">
  42. <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
  43. <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="isnodata"></van-empty>
  44. <van-cell v-for="item,index in paymentlist" :key="index" :title="item.Remark" :label="item.CreateDate" center>
  45. <template #icon><img class="pr16" :src="item.ChangeType == 1 ? './static/images/payment-type-1.png' : './static/images/payment-type-2.png'" alt=""></template>
  46. <template #default><span>-{{item.ChangeAmount | tofixed2}}</span></template>
  47. </van-cell>
  48. </van-list>
  49. </van-pull-refresh>
  50. </van-tab>
  51. </van-tabs>
  52. </div>
  53. <van-popup v-model="isShow" position="bottom">
  54. <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>
  55. </van-popup>
  56. </div>
  57. <script src="./static/js/klm-vv.min.js"></script>
  58. <script src="./static/js/klm-axios-config.js"></script>
  59. <script>
  60. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  61. // 可以通过下面的方式手动注册
  62. Vue.use(vant.Lazyload);
  63. // 在 #app 标签下渲染一个按钮组件
  64. let app = new Vue({
  65. el: '#app',
  66. data() {
  67. return {
  68. isnodata:false,
  69. active: 0,
  70. isShow: false,
  71. toptitleisshow:true,
  72. paymentlist:[
  73. ],
  74. accountrecordinfo:{
  75. PageSize:10,
  76. PageNum:1,
  77. UserId:'',
  78. TradeMonth:'',
  79. Kind:'',
  80. },
  81. loading: false,
  82. finished: false,
  83. refreshing: false,
  84. minDate: new Date(2020, 0, 1),
  85. maxDate: new Date(),
  86. currentDate: new Date(),
  87. paytotal:'',
  88. profittotal:''
  89. };
  90. },
  91. created() {
  92. this.accountrecordinfo.TradeMonth = new Date().getFullYear()+'-'+ (new Date().getMonth()+1);
  93. this.getpaymentlist();
  94. },
  95. methods: {
  96. showPop(){
  97. this.isShow = true;
  98. },
  99. formatter(type, val) {
  100. if (type === 'year') {
  101. return `${val}年`;
  102. } else if (type === 'month') {
  103. return `${val}月`;
  104. }
  105. return val;
  106. },
  107. confirmDate(value) {
  108. this.accountrecordinfo.TradeMonth = value.getFullYear().toString() + '-' + (value.getMonth() + 1).toString();
  109. console.log(this.accountrecordinfo.TradeMonth)
  110. this.isShow = false;
  111. this.paymentlist = [];
  112. //- this.currentDate = new Date(this.accountrecordinfo.TradeMonth);
  113. this.getpaymentlist();
  114. this.loading = false;
  115. },
  116. onLoad() {
  117. if (this.refreshing) {
  118. this.paymentlist = [];
  119. this.refreshing = false;
  120. this.accountrecordinfo.PageNum = 0;
  121. }
  122. this.accountrecordinfo.PageNum++;
  123. this.getpaymentlist();
  124. },
  125. onRefresh() {
  126. // 清空列表数据
  127. this.finished = false;
  128. // 重新加载数据
  129. // 将 loading 设置为 true,表示处于加载状态
  130. this.loading = true;
  131. this.onLoad();
  132. },
  133. //- 获取列表数据
  134. async getpaymentlist(){
  135. this.accountrecordinfo.Kind = this.active === 0 ? 1 : 2;
  136. this.accountrecordinfo.UserId = PublicLib.getCookieInfo('userId');
  137. const res = await getRequest('/api/v1/useraccountrecord/list',JSON.stringify(this.accountrecordinfo));
  138. this.paymentlist = [];
  139. if(res.status === '1') {
  140. if(res.data.length < this.accountrecordinfo.PageSize) {
  141. this.finished = true;
  142. };
  143. this.paytotal = 0.00.toFixed(2);
  144. this.profittotal = 0.00.toFixed(2);
  145. this.paymentlist.push(...res.data);
  146. if(this.accountrecordinfo.TradeMonth === new Date().getFullYear()+'-'+ (new Date().getMonth()+1)) {
  147. this.paytotal = 0.00.toFixed(2);
  148. this.profittotal = 10.50.toFixed(2);
  149. }
  150. if(this.active === 0 && this.accountrecordinfo.TradeMonth === new Date().getFullYear()+'-'+ (new Date().getMonth()+1)) {
  151. this.paymentlist = [{Remark:'注册奖励',ChangeAmount:10.50,CreateDate:new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + (new Date().getDate())}];
  152. }
  153. this.loading = false;
  154. if(this.paymentlist.length === 0) {this.isnodata = true}else{this.isnodata = false};
  155. }
  156. },
  157. //- 切换tab栏
  158. async changetabs(){
  159. this.accountrecordinfo.PageNum = 1;
  160. await this.getpaymentlist();
  161. //- 切换tab是否还原月份(默认不还原)
  162. //- this.currentDate = new Date();
  163. //- this.accountrecordinfo.TradeMonth = new Date().getFullYear()+'-'+ (new Date().getMonth()+1);
  164. },
  165. goback(){
  166. PublicLib.GoBack({Level:1});
  167. }
  168. }
  169. });
  170. </script>
  171. </body>
  172. </html>