index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <view :style="colorStyle">
  3. <view class='commission-details'>
  4. <view class='promoterHeader bg-color'>
  5. <view class='headerCon acea-row row-between-wrapper'>
  6. <view>
  7. <view class='name'>{{$t(name)}}</view>
  8. <view class='money' v-if="recordType == 4">{{$t(`¥`)}}<text class='num'>{{extractCount}}</text></view>
  9. <view class='money' v-else>{{$t(`¥`)}}<text class='num'>{{recordCount}}</text></view>
  10. </view>
  11. <view class='iconfont icon-jinbi1'></view>
  12. </view>
  13. </view>
  14. <view class='sign-record'>
  15. <block v-for="(item,index) in recordList" :key="index" v-if="recordList.length>0">
  16. <view class='list'>
  17. <view class='item'>
  18. <view class='data'>{{item.time}}</view>
  19. <view class='listn'>
  20. <block v-for="(child,indexn) in item.child" :key="indexn">
  21. <view class='itemn acea-row row-between-wrapper'>
  22. <view>
  23. <view class='name line1'>{{$t(child.title)}}</view>
  24. <view>{{child.add_time}}</view>
  25. <view class="fail-msg" v-if="child.fail_msg">
  26. {{$t(`原因`)}}:{{child.fail_msg}}
  27. </view>
  28. </view>
  29. <view class='num font-color' v-if="child.pm == 1">+{{child.number}}</view>
  30. <view class='num' v-else>-{{child.number}}</view>
  31. </view>
  32. </block>
  33. </view>
  34. </view>
  35. </view>
  36. </block>
  37. <view class='loadingicon acea-row row-center-wrapper' v-if="recordList.length">
  38. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  39. </view>
  40. <view v-if="recordList.length < 1 && page > 1">
  41. <emptyPage :title='$t(`暂无数据~`)'></emptyPage>
  42. </view>
  43. </view>
  44. </view>
  45. <!-- #ifdef H5 -->
  46. <home></home>
  47. <!-- #endif -->
  48. </view>
  49. </template>
  50. <script>
  51. import {
  52. getCommissionInfo,
  53. getSpreadInfo
  54. } from '@/api/user.js';
  55. import {
  56. toLogin
  57. } from '@/libs/login.js';
  58. import {
  59. mapGetters
  60. } from "vuex";
  61. // #ifdef MP
  62. import authorize from '@/components/Authorize';
  63. // #endif
  64. import emptyPage from '@/components/emptyPage.vue'
  65. import home from '@/components/home';
  66. import colors from '@/mixins/color.js';
  67. export default {
  68. components: {
  69. // #ifdef MP
  70. authorize,
  71. // #endif
  72. emptyPage,
  73. home
  74. },
  75. mixins: [colors],
  76. data() {
  77. return {
  78. name: '',
  79. type: 0,
  80. page: 1,
  81. limit: 15,
  82. loading: false,
  83. loadend: false,
  84. loadTitle: this.$t(`加载更多`),
  85. recordList: [],
  86. recordType: 0,
  87. recordCount: 0,
  88. extractCount: 0,
  89. times: []
  90. };
  91. },
  92. computed: mapGetters(['isLogin']),
  93. onLoad(options) {
  94. if (this.isLogin) {
  95. this.type = options.type;
  96. } else {
  97. toLogin();
  98. }
  99. },
  100. onShow: function() {
  101. let type = this.type;
  102. if (type == 1) {
  103. uni.setNavigationBarTitle({
  104. title: "提现记录"
  105. });
  106. this.name = '提现总额';
  107. this.recordType = 4;
  108. this.getRecordList();
  109. this.getRecordListCount();
  110. } else if (type == 2) {
  111. uni.setNavigationBarTitle({
  112. title: "佣金记录"
  113. });
  114. this.name = '佣金明细';
  115. this.recordType = 3;
  116. this.getRecordList();
  117. this.getRecordListCount();
  118. } else {
  119. uni.showToast({
  120. title: '参数错误',
  121. icon: 'none',
  122. duration: 1000,
  123. mask: true,
  124. success: function(res) {
  125. setTimeout(function() {
  126. // #ifndef H5
  127. uni.navigateBack({
  128. delta: 1,
  129. });
  130. // #endif
  131. // #ifdef H5
  132. history.back();
  133. // #endif
  134. }, 1200)
  135. },
  136. });
  137. }
  138. },
  139. methods: {
  140. getRecordList: function() {
  141. let that = this;
  142. let page = that.page;
  143. let limit = that.limit;
  144. let recordType = that.recordType;
  145. if (that.loading) return;
  146. if (that.loadend) return;
  147. that.loading = true;
  148. that.loadTitle = '';
  149. getCommissionInfo({
  150. page: page,
  151. limit: limit
  152. }, recordType).then(res => {
  153. for (let i = 0; i < res.data.time.length; i++) {
  154. if (!this.times.includes(res.data.time[i])) {
  155. this.times.push(res.data.time[i])
  156. this.recordList.push({
  157. time: res.data.time[i],
  158. child: []
  159. })
  160. }
  161. }
  162. for (let x = 0; x < this.times.length; x++) {
  163. for (let j = 0; j < res.data.list.length; j++) {
  164. if (this.times[x] === res.data.list[j].time_key) {
  165. this.recordList[x].child.push(res.data.list[j])
  166. }
  167. }
  168. }
  169. let loadend = res.data.list.length < that.limit;
  170. that.loadend = loadend;
  171. that.loadTitle = loadend ? that.$t(`我也是有底线的`) : that.$t(`加载更多`);
  172. that.page += 1;
  173. that.loading = false;
  174. }).catch(err => {
  175. that.loading = false;
  176. that.loadTitle = that.$t(`加载更多`);
  177. })
  178. },
  179. getRecordListCount: function() {
  180. let that = this;
  181. getSpreadInfo().then(res => {
  182. that.recordCount = res.data.commissionCount;
  183. that.extractCount = res.data.extractCount;
  184. });
  185. }
  186. },
  187. onReachBottom: function() {
  188. this.getRecordList();
  189. }
  190. }
  191. </script>
  192. <style scoped lang="scss">
  193. .commission-details .promoterHeader .headerCon .money {
  194. font-size: 36rpx;
  195. }
  196. .commission-details .promoterHeader .headerCon .money .num {
  197. font-family: 'Guildford Pro';
  198. }
  199. </style>