list.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>资金流水</title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <link href="../../css/mui.min.css" rel="stylesheet" />
  8. <link href="../../css/mui.picker.min.css" rel="stylesheet" />
  9. <style>
  10. .m_box {padding: 10px 10px 25px 15px;box-shadow: 0 1px 6px #dbdbdb;border-radius: 8px;position: relative;overflow: hidden;}
  11. .fm{width: 100%;z-index: 1;}
  12. .mui-content{padding: 0px 15px!important;margin-top: -65px;z-index: 11111;}
  13. .items{padding: 10px;font-size: 12px;margin-top:10px;background-color: white;border-bottom: 1px solid #eeeded;}
  14. .items:last-child{border: 0px;}
  15. .divider{margin-top: 25px;margin-bottom: 25px;}
  16. .qian{float: left;width: 40px;height: 40px;border-radius: 50%;background-color: orange;text-align: center;line-height: 40px;}
  17. .icsf{color: white;}
  18. .ccn{float: left;padding-left: 10px;width: 75%;}
  19. .ccn .stitle{font-size: 14px;width: 100%;color: #6c6c6c;}
  20. .sm7{overflow: hidden;}
  21. .money{float: right;color: orange;font-size: 15px;padding-top: 3px;}
  22. .ccn .time{color: darkgray;}
  23. .save{color:white;padding-top: 12px;}
  24. .year{position: absolute;font-size: 13px;color: darkgray;z-index: 11;}
  25. [v-cloak] {display: none;}
  26. </style>
  27. </head>
  28. <body>
  29. <div id="app" v-cloak>
  30. <header class="mui-bar mui-bar-nav">
  31. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  32. <h1 class="mui-title">资金流水</h1>
  33. <div class="save mui-pull-right" @click="record()">请款记录</div>
  34. </header>
  35. <img src="../../images/top.png" class="fm" />
  36. <div class="mui-content">
  37. <div class="m_box">
  38. <div class="year" @click.stop="select()">
  39. <span>{{year}}年</span>
  40. <span class="icon">&#xe6b9;</span>
  41. </div>
  42. <div id="main" style="height:220px;"></div>
  43. <div class="divider">
  44. <div class="line" style="width: 30%;"></div>
  45. <div class="text" style="width: 40%;">资金明细</div>
  46. <div class="line" style="width: 30%;"></div>
  47. <div class="clear"></div>
  48. </div>
  49. <div v-if="list.length>0">
  50. <div class="items" v-for="(item,index) in list">
  51. <div class="row">
  52. <div class="sm7">
  53. <div class="qian" style="background-color: #4CAF50;" v-if="item.pay_mode=='收款方'">
  54. <i class="icon icsf">收</i>
  55. </div>
  56. <div class="qian" style="background-color: #F44336;" v-if="item.pay_mode=='付款方'">
  57. <i class="icon icsf">支</i>
  58. </div>
  59. <div class="ccn omit">
  60. <div class="stitle omit">{{item.parttime_title}}</div>
  61. <div class="time">{{item.pay_date}}</div>
  62. </div>
  63. </div>
  64. <div class="sm3">
  65. <div class="money" v-if="item.type=='0'" style="color: #4CAF50;">+{{item.amount}}元</div>
  66. <div class="money" v-if="item.type=='1'" style="color: #F44336;">-{{item.amount}}元</div>
  67. </div>
  68. <div class="clear"></div>
  69. </div>
  70. </div>
  71. </div>
  72. <div class="no_data" v-else style="padding-top: 50px;">
  73. <i class="icon icon-48">&#xe61a;</i><br />没有数据
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <script src="../../js/mui.min.js"></script>
  79. <script src="../../js/app.js"></script>
  80. <script src="../../js/vue.min.js"></script>
  81. <script src="../../js/echarts.min.js"></script>
  82. <script src="../../js/mui.picker.min.js"></script>
  83. <script type="text/javascript">
  84. var vm = new Vue({
  85. el: "#app",
  86. data: {
  87. year:getDate('year'),
  88. list: [],
  89. xAxis: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  90. chart: []
  91. },
  92. mounted: function() {
  93. this.getData();
  94. this.getChartData();
  95. },
  96. methods: {
  97. //请款记录
  98. record:function(){
  99. open('record', 'record.html', null, 'slide-in-bottom');
  100. },
  101. select:function(){
  102. var dtPicker = new mui.DtPicker({type:'month'});
  103. dtPicker.show(function (selectItems) {
  104. vm.year=selectItems.y.text;
  105. console.log("asdsad");
  106. vm.getChartData();
  107. })
  108. },
  109. getData: function() {
  110. request(urls().finance_list, {userId: getUser().id,state:1}, function(res) {
  111. vm.list = res.data;
  112. plus.nativeUI.closeWaiting();
  113. })
  114. },
  115. //获取图表数据
  116. getChartData:function(){
  117. this.chart=[{series: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]},{series: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}];
  118. request(urls().chart_list, {userId: getUser().id,year:this.year}, function(res) {
  119. res.data.forEach((item, index) => {
  120. if (item.pay_mode == '收款方') {
  121. vm.chart[0].series[item.pay_date - 1] = item.amount;
  122. }
  123. if (item.pay_mode == '付款方') {
  124. vm.chart[1].series[item.pay_date - 1] = item.amount;
  125. }
  126. });
  127. vm.initChart();
  128. plus.nativeUI.closeWaiting();
  129. })
  130. },
  131. //初始化图表
  132. initChart: function() {
  133. var myChart = echarts.init(document.getElementById('main'));
  134. var option = {
  135. toolbox: {
  136. show: true,
  137. iconStyle: {
  138. borderColor: "#6c6c6c",
  139. },
  140. feature: {
  141. magicType: {
  142. type: ['line', 'bar']
  143. },
  144. }
  145. },
  146. color: ['#4CAF50', '#F44336'],
  147. grid: {
  148. left: '15',
  149. top: '20%',
  150. right: '15',
  151. bottom: '5',
  152. containLabel: true
  153. },
  154. legend: {
  155. data: ['收入', '支出']
  156. },
  157. xAxis: {
  158. data: vm.xAxis
  159. },
  160. yAxis: {},
  161. series: [{
  162. name: '收入',
  163. type: 'bar',
  164. data: vm.chart[0].series,
  165. },
  166. {
  167. name: '支出',
  168. type: 'bar',
  169. data: vm.chart[1].series,
  170. }
  171. ]
  172. };
  173. myChart.setOption(option);
  174. }
  175. }
  176. })
  177. </script>
  178. </body>
  179. </html>