user-payment-list1.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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 pb0 ovh" style="box-sizing:border-box">
  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. <div class="screenroll ovh-x" ref="wrapper1" v-if="active === 0">
  31. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="paymentlist.length === 0 ? 'isnodata':''" style="height:100%;">
  32. <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
  33. <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="isnodata"></van-empty>
  34. <van-cell v-for="item,index in paymentlist" :key="index" :title="item.Remark" :label="item.CreateDate" center>
  35. <template #default><span>+{{item.ChangeAmount | tofixed2}}</span></template>
  36. <template #icon><img class="pr16" :src="item.type == 1 ? './static/images/payment-type-1.png' : './static/images/payment-type-2.png'" alt=""></template>
  37. </van-cell>
  38. </van-list>
  39. </van-pull-refresh>
  40. </div>
  41. </van-tab>
  42. <van-tab :title="'支出 ¥'+ paytotal">
  43. <div class="screenroll ovh-x" ref="wrapper1" v-if="active === 1">
  44. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="paymentlist.length === 0 ? 'isnodata':''" style="height:100%;">
  45. <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
  46. <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="isnodata"></van-empty>
  47. <van-cell v-for="item,index in paymentlist" :key="index" :title="item.Remark" :label="item.CreateDate" center>
  48. <template #icon><img class="pr16" :src="item.ChangeType == 1 ? './static/images/payment-type-1.png' : './static/images/payment-type-2.png'" alt=""></template>
  49. <template #default><span>-{{item.ChangeAmount | tofixed2}}</span></template>
  50. </van-cell>
  51. </van-list>
  52. </van-pull-refresh>
  53. </div>
  54. </van-tab>
  55. </van-tabs>
  56. </div>
  57. <van-popup v-model="isShow" position="bottom">
  58. <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>
  59. </van-popup>
  60. </div>
  61. <script src="./static/js/klm-vv.min.js"></script>
  62. <script src="./static/js/appfunc.min.js"></script>
  63. <script src="./static/js/klm-axios-config.js"></script>
  64. <script src="./static/js/publicfn.js"></script>
  65. <script>
  66. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  67. // 可以通过下面的方式手动注册
  68. Vue.use(vant.Lazyload);
  69. PublicLib.SetStatusBarBgColor({bgcolor:'ffffff'});
  70. // 在 #app 标签下渲染一个按钮组件
  71. let app = new Vue({
  72. el: '#app',
  73. data() {
  74. return {
  75. isnodata:true,
  76. active: 0,
  77. isShow: false,
  78. toptitleisshow:true,
  79. paymentlist:[
  80. ],
  81. accountrecordinfo:{
  82. PageSize:10,
  83. PageNum:1,
  84. UserId:'',
  85. TradeMonth:'',
  86. Kind:'',
  87. },
  88. loading: false,
  89. finished: false,
  90. refreshing: false,
  91. minDate: new Date(2020, 0, 1),
  92. maxDate: new Date(),
  93. currentDate: new Date(),
  94. paytotal:'',
  95. profittotal:''
  96. };
  97. },
  98. created() {
  99. this.accountrecordinfo.TradeMonth = new Date().getFullYear()+'-'+ (new Date().getMonth()+1);
  100. //- this.getpaymentlist();
  101. },
  102. updated(){
  103. this.$nextTick(() => {
  104. this.$refs.wrapper1.style.height = `${document.documentElement.clientHeight - 130}px`;
  105. });
  106. },
  107. methods: {
  108. showPop(){
  109. this.isShow = true;
  110. },
  111. formatter(type, val) {
  112. if (type === 'year') {
  113. return `${val}年`;
  114. } else if (type === 'month') {
  115. return `${val}月`;
  116. }
  117. return val;
  118. },
  119. confirmDate(value) {
  120. this.accountrecordinfo.TradeMonth = value.getFullYear().toString() + '-' + (value.getMonth() + 1).toString();
  121. console.log(this.accountrecordinfo.TradeMonth)
  122. this.isShow = false;
  123. this.paymentlist = [];
  124. //- this.currentDate = new Date(this.accountrecordinfo.TradeMonth);
  125. //- this.getpaymentlist();
  126. this.loading = false;
  127. },
  128. onLoad() {
  129. if (this.refreshing) {
  130. this.paymentlist = [];
  131. this.refreshing = false;
  132. this.accountrecordinfo.PageNum = 0;
  133. }
  134. this.accountrecordinfo.PageNum++;
  135. //- this.getpaymentlist();
  136. },
  137. onRefresh() {
  138. // 清空列表数据
  139. this.finished = false;
  140. // 重新加载数据
  141. // 将 loading 设置为 true,表示处于加载状态
  142. this.loading = true;
  143. this.onLoad();
  144. },
  145. //- 获取列表数据
  146. async getpaymentlist(){
  147. this.accountrecordinfo.Kind = this.active === 0 ? 1 : 2;
  148. this.accountrecordinfo.UserId = PublicLib.getCookieInfo('userId');
  149. const res = await getRequest('api/v1/useraccountrecord/list',JSON.stringify(this.accountrecordinfo));
  150. if(res.status === '1'){
  151. if(res.data.length < this.accountrecordinfo.PageSize) {
  152. this.finished = true;
  153. };
  154. if(this.paytotal === '' || this.profittotal === '') {
  155. this.paytotal = res.other.Expend;
  156. this.profittotal = res.other.Income;
  157. };
  158. //- this.paymentlist = [
  159. //- {ChangeAmount:15101.5485},
  160. //- {ChangeAmount:15101.5485},
  161. //- {ChangeAmount:15101.5485},
  162. //- ]
  163. this.paymentlist.push(...res.data);
  164. this.loading = false;
  165. if(this.paymentlist.length === 0) {this.isnodata = true}else{this.isnodata = false};
  166. }
  167. },
  168. //- 切换tab栏
  169. changetabs(){
  170. this.accountrecordinfo.PageNum = 1;
  171. this.paymentlist = [];
  172. //- this.getpaymentlist();
  173. //- 切换tab是否还原月份
  174. //- this.currentDate = new Date();
  175. //- this.accountrecordinfo.TradeMonth = new Date().getFullYear()+'-'+ (new Date().getMonth()+1);
  176. },
  177. goback(){
  178. PublicLib.GoBack({Level:1});
  179. }
  180. }
  181. });
  182. </script>
  183. </body>
  184. </html>