index.vue 5.5 KB

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