commission.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. var _request = require('../../../../utils/request.js')
  2. var util = require('../../../../utils/util.js')
  3. Page({
  4. data: {
  5. page: 1,
  6. per_page: 20,
  7. list: [],
  8. more: true,
  9. balance: 0
  10. },
  11. onLoad: function (options) {
  12. this.getBalanceInfo()
  13. this.getBalanceList()
  14. },
  15. onShow () {
  16. },
  17. onReachBottom: function () {
  18. if (this.data.more) {
  19. var page = this.data.page + 1
  20. this.setData({
  21. page: page
  22. })
  23. this.getBalanceList()
  24. }
  25. },
  26. getBalanceInfo () {
  27. var that = this
  28. var url = 'v1/district/total'
  29. var params = {
  30. }
  31. var success = function (res) {
  32. console.log('res',res);
  33. var result = res.data.sum
  34. that.setData({
  35. balance: result
  36. })
  37. }
  38. _request.$get(url, params, success)
  39. },
  40. getBalanceList () {
  41. var that = this
  42. var url = 'v1/district/orders'
  43. var params = {
  44. page: this.data.page,
  45. per_page: this.data.per_page
  46. }
  47. var success = function (res) {
  48. var result = that.data.list.concat(res.data.list || []);
  49. console.log('result',result)
  50. that.setData({
  51. list: result
  52. })
  53. var listMore = res.data.list_count > that.data.list.length
  54. that.setData({
  55. more: listMore
  56. })
  57. }
  58. _request.$get(url, params, success)
  59. },
  60. // getDetail (val) {
  61. // var id = val.currentTarget.dataset.val
  62. // wx.navigateTo({
  63. // url: '/packageUser/pages/user/silverDetail/silverDetail?id=' + id
  64. // })
  65. // },
  66. onShareAppMessage: function (val) {
  67. return _request.share({
  68. sc: 'xcx_user_silver'
  69. })
  70. }
  71. })