user-payment-list.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. <style>
  17. .top0{
  18. top:0;
  19. z-index:-1;
  20. }
  21. </style>
  22. </head>
  23. <body class="bgc-back pb0 ovh" style="box-sizing:border-box">
  24. <div id="app" v-cloak>
  25. <div class="bgcfff paymenttop abs top0" style="width:100%;"></div>
  26. <div class="payment-list">
  27. <van-nav-bar class="user_rank_explan_title user_title_normal" left-arrow @click-left="goback">
  28. <template #left> <img src="./static/images/left.png" alt=""></template>
  29. <template #title>
  30. <van-dropdown-menu :overlay="false">
  31. <van-dropdown-item :title="showTradeMonth" @open="showPop"></van-dropdown-item>
  32. </van-dropdown-menu>
  33. </template>
  34. </van-nav-bar>
  35. <van-tabs v-model="active" animated line-width="20" line-height="2" swipeable @change="changetabs">
  36. <van-tab :title="'收益 ¥'+ profittotal">
  37. <div class="screenroll ovh-x" ref="wrapper1" v-if="active === 0">
  38. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="paymentlist.length === 0 ? 'isnodata':''" style="height:100%;">
  39. <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
  40. <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="isnodata"></van-empty>
  41. <van-cell v-for="item,index in paymentlist" :key="index" :label="item.CreateDate" center>
  42. <template #default><span>+{{item.ChangeAmount}}</span></template>
  43. <template #title>
  44. <div>{{item.Remark}}</div>
  45. <div class="f12 c666" v-if="item.remakeinfo">备注:{{item.remakeinfo}}</div>
  46. </template>
  47. <template #icon><img class="pr16" :src="item.ChangeType === 50 ? './static/images/payment-type-2.png' : './static/images/payment-type-1.png'" alt=""></template>
  48. </van-cell>
  49. </van-list>
  50. </van-pull-refresh>
  51. </div>
  52. </van-tab>
  53. <van-tab :title="'支出 ¥'+ paytotal">
  54. <div class="screenroll ovh-x" ref="wrapper1" v-if="active === 1">
  55. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="paymentlist.length === 0 ? 'isnodata':''" style="height:100%;">
  56. <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
  57. <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="isnodata"></van-empty>
  58. <van-cell v-for="item,index in paymentlist" :key="index" :label="item.CreateDate" center>
  59. <template #icon><img class="pr16" :src="item.ChangeType == 50 ? './static/images/payment-type-1.png' : './static/images/payment-type-2.png'" alt=""></template>
  60. <template #title>
  61. <div>{{item.Remark}}</div>
  62. <div class="f12 c666" v-if="item.remakeinfo">备注:{{item.remakeinfo}}</div>
  63. </template>
  64. <template #default><span>-{{item.ChangeAmount}}</span></template>
  65. </van-cell>
  66. </van-list>
  67. </van-pull-refresh>
  68. </div>
  69. </van-tab>
  70. </van-tabs>
  71. </div>
  72. <van-popup v-model="isShow" position="bottom">
  73. <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>
  74. </van-popup>
  75. </div>
  76. <script src="./static/js/klm-vv.min.js"></script>
  77. <script src="./static/js/appfunc.min.js"></script>
  78. <script src="./static/js/klm-axios-config.js"></script>
  79. <script src="./static/js/publicfn.js"></script>
  80. <script>
  81. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  82. // 可以通过下面的方式手动注册
  83. Vue.use(vant.Lazyload);
  84. PublicLib.SetStatusBarBgColor({bgcolor:'ffffff'});
  85. // 在 #app 标签下渲染一个按钮组件
  86. let app = new Vue({
  87. el: '#app',
  88. data() {
  89. return {
  90. isnodata:false,
  91. active: 0,
  92. isShow: false,
  93. toptitleisshow:true,
  94. paymentlist:[
  95. ],
  96. accountrecordinfo:{
  97. PageSize:20,
  98. PageNum:1,
  99. UserId:'',
  100. TradeMonth:'',
  101. Kind:'',
  102. },
  103. loading: true,
  104. finished: false,
  105. refreshing: false,
  106. minDate: new Date(2020, 0, 1),
  107. maxDate: new Date(),
  108. currentDate: new Date(),
  109. paytotal:'',
  110. profittotal:'',
  111. showTradeMonth:'',
  112. type:'',
  113. };
  114. },
  115. created() {
  116. this.type = browsertype.versions.ios ? 'ios' : 'android';
  117. if(this.type !== 'ios'){
  118. document.querySelector('.paymenttop').style.height = `${Func.getStatusBarHeight()}px`;
  119. };
  120. this.getpaymentlist('refresh');
  121. this.showTradeMonth = new Date().getFullYear()+'-'+ (new Date().getMonth()+1);
  122. },
  123. beforeUpdate(){
  124. const that = this;
  125. that.$nextTick(() => {
  126. if(that.type === 'ios'){
  127. that.$refs.wrapper1.style.height = `${document.documentElement.clientHeight - 90}px`;
  128. }else{
  129. that.$refs.wrapper1.style.height = `${document.documentElement.clientHeight - (90 + Func.getStatusBarHeight())}px`;
  130. };
  131. });
  132. },
  133. methods: {
  134. showPop(){
  135. this.isShow = true;
  136. },
  137. formatter(type, val) {
  138. if (type === 'year') {
  139. return `${val}年`;
  140. } else if (type === 'month') {
  141. return `${val}月`;
  142. }
  143. return val;
  144. },
  145. confirmDate(value) {
  146. //- this.paymentlist = [];
  147. this.showTradeMonth = value.getFullYear().toString() + '-' + (value.getMonth() + 1).toString();
  148. this.isShow = false;
  149. //- this.currentDate = new Date(this.accountrecordinfo.TradeMonth);
  150. this.getpaymentlist('refresh');
  151. this.loading = false;
  152. },
  153. onLoad() {
  154. if (this.refreshing) {
  155. //- this.paymentlist = [];
  156. this.refreshing = false;
  157. this.accountrecordinfo.PageNum = 0;
  158. }
  159. this.accountrecordinfo.PageNum++;
  160. this.getpaymentlist();
  161. },
  162. onRefresh() {
  163. // 清空列表数据
  164. this.finished = false;
  165. // 重新加载数据
  166. // 将 loading 设置为 true,表示处于加载状态
  167. this.loading = true;
  168. this.accountrecordinfo.PageNum = 1;
  169. this.getpaymentlist('refresh');
  170. },
  171. //- 获取列表数据
  172. async getpaymentlist(type = 'onload'){
  173. this.accountrecordinfo.TradeMonth = fillzero(formatDate(this.currentDate.getFullYear(),this.currentDate.getMonth() + 1));
  174. this.accountrecordinfo.Kind = this.active === 0 ? 1 : 2;
  175. this.accountrecordinfo.UserId = PublicLib.getCookieInfo('userId');
  176. const res = await getRequest('api/v1/useraccountrecord/list?t='+Math.random(6),JSON.stringify(this.accountrecordinfo));
  177. res.data.forEach(item=>{
  178. item.remakeinfo = item.Remark.split('\n')[1];
  179. item.Remark = item.Remark.split('\n')[0];
  180. });
  181. if(res.status === '1'){
  182. if(res.data.length < this.accountrecordinfo.PageSize) {
  183. this.finished = true;
  184. };
  185. this.paytotal = res.other.Expend;
  186. this.profittotal = res.other.Income;
  187. res.data.forEach(item=>{
  188. item.ChangeAmount = item.ChangeAmount.toFixed(2)
  189. });
  190. if(type === 'refresh'){
  191. this.paymentlist = res.data
  192. this.refreshing = false;
  193. }else{
  194. this.paymentlist.push(...res.data);
  195. }
  196. this.loading = false;
  197. if(this.paymentlist.length === 0) {this.isnodata = true}else{this.isnodata = false};
  198. }
  199. },
  200. //- 切换tab栏
  201. changetabs(){
  202. let num = 0;
  203. this.paymentlist.forEach(item=>{
  204. if(Number(item.ChangeAmount) === 300){
  205. num += Number(item.ChangeAmount);
  206. }
  207. });
  208. console.log(num);
  209. this.finished = false;
  210. this.accountrecordinfo.PageNum = 1;
  211. this.paymentlist = [];
  212. this.getpaymentlist('refresh');
  213. //- 切换tab是否还原月份
  214. //- this.currentDate = new Date();
  215. //- this.accountrecordinfo.TradeMonth = new Date().getFullYear()+'-'+ (new Date().getMonth()+1);
  216. },
  217. goback(){
  218. PublicLib.GoBack({Level:1});
  219. }
  220. }
  221. });
  222. </script>
  223. </body>
  224. </html>