小程序端工程代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.8 KiB

  1. <template>
  2. <view class="commission-details" ref="container">
  3. <view class="promoterHeader bg-color-red">
  4. <view class="headerCon acea-row row-between-wrapper">
  5. <view>
  6. <view class="name">佣金明细</view>
  7. <view class="money">
  8. <text class="num">{{ commission }}</text>
  9. </view>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="sign-record" ref="content">
  14. <view class="list">
  15. <view class="item" v-for="(item, infoIndex) in info" :key="infoIndex">
  16. <view class="data">{{ item.time }}</view>
  17. <view class="listn" v-for="(val, indexn) in item.list" :key="indexn">
  18. <view class="itemn acea-row row-between-wrapper">
  19. <view>
  20. <view class="name line1">{{ val.title }}</view>
  21. <view>{{ val.addTime }}</view>
  22. </view>
  23. <view class="num" v-if="val.pm == 1">+{{ val.number }}</view>
  24. <view class="num font-color-red" v-if="val.pm == 0"> -{{ val.number }} </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <Loading :loaded="loaded" :loading="loading"></Loading>
  31. </view>
  32. </template>
  33. <script>
  34. import { getCommissionInfo, getSpreadInfo } from '@/api/user'
  35. import Loading from '@/components/Loading'
  36. export default {
  37. name: 'CommissionDetails',
  38. components: {
  39. Loading,
  40. },
  41. props: {},
  42. data: function() {
  43. return {
  44. info: [],
  45. commission: 0,
  46. where: {
  47. page: 1,
  48. limit: 3,
  49. },
  50. types: 3,
  51. loaded: false,
  52. loading: false,
  53. }
  54. },
  55. mounted: function() {
  56. this.getCommission()
  57. this.getIndex()
  58. },
  59. onReachBottom() {
  60. this.loading === false && this.getIndex()
  61. },
  62. methods: {
  63. getIndex: function() {
  64. let that = this
  65. if (that.loading == true || that.loaded == true) return
  66. that.loading = true
  67. getCommissionInfo(that.where, that.types).then(
  68. res => {
  69. that.loading = false
  70. that.loaded = res.data.length < that.where.limit
  71. that.loadTitle = that.loaded ? '人家是有底线的' : '上拉加载更多'
  72. that.where.page = that.where.page + 1
  73. that.info.push.apply(that.info, res.data[0])
  74. },
  75. err => {
  76. uni.showToast({
  77. title: err.msg || err.response.data.msg || err.response.data.message,
  78. icon: 'none',
  79. duration: 2000,
  80. })
  81. }
  82. )
  83. },
  84. getCommission: function() {
  85. let that = this
  86. getSpreadInfo().then(
  87. res => {
  88. that.commission = res.data.commissionCount
  89. },
  90. err => {
  91. uni.showToast({
  92. title: err.msg || err.response.data.msg || err.response.data.message,
  93. icon: 'none',
  94. duration: 2000,
  95. })
  96. }
  97. )
  98. },
  99. },
  100. }
  101. </script>