bill.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. ;
  2. layui.define(['form','flow','element'], function (e) {
  3. var s = layui.$,
  4. flow = layui.flow,
  5. element = layui.element,
  6. form = layui.form;
  7. element.on('tab(profit)', function(data){
  8. var account = s(this).attr('lay-id');
  9. s('.profit-list').empty();
  10. flow.load({
  11. elem: '.profit-list'
  12. ,done: function(page, next){
  13. var lis = [];
  14. s.post('load.html',{page:page,account:account},function(res){
  15. var lis = [];
  16. layui.each(res.data, function(index, item){
  17. var li = ['<li>',
  18. '<p>',
  19. '<span class="type_text">'+item['type_text']+'</span>',
  20. '<span class="value">发生额:'+item['value']+'</span>',
  21. '</p>',
  22. '<p>',
  23. '<span class="create_time">'+item['create_time']+'</span>',
  24. '<span class="value">余额:'+item['amount']+'</span>',
  25. '</p>',
  26. '</li>'];
  27. lis.push(li.join(''));
  28. });
  29. next(lis.join(''), page < res.pages);
  30. });
  31. }
  32. });
  33. });
  34. var bill = function(){
  35. if (s('.profit-list').length > 0) {
  36. element.tabChange('profit', 'coin')
  37. }
  38. }
  39. e('bill',new bill())
  40. })