index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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">
  9. {{ $t(`¥`) }}
  10. <text class="num">{{ extractCount }}</text>
  11. </view>
  12. <view class="money" v-else>
  13. {{ $t(`¥`) }}
  14. <text class="num">{{ recordCount }}</text>
  15. </view>
  16. </view>
  17. <view class="iconfont icon-jinbi1"></view>
  18. </view>
  19. </view>
  20. <view class="sign-record">
  21. <block v-for="(item, index) in recordList" :key="index" v-if="recordList.length > 0">
  22. <view class="list">
  23. <view class="item">
  24. <view class="data">{{ item.time }}</view>
  25. <view class="listn">
  26. <block v-for="(child, indexn) in item.child" :key="indexn">
  27. <view class="itemn acea-row row-between-wrapper">
  28. <view class="title">
  29. <view class="name line1">{{ type == 1 ? $t(child.mark) : $t(child.title) }}</view>
  30. <view>{{ child.add_time }}</view>
  31. <view class="fail-msg" v-if="child.fail_msg">{{ $t(`原因`) }}:{{ child.fail_msg }}</view>
  32. <!-- <view class="fail-msg" v-else-if="child.extract_type">
  33. {{$t(`提现方式`)}}:{{child.extract_type}}
  34. </view> -->
  35. </view>
  36. <view class="acea-row row-column items-end">
  37. <view class="num font-color" v-if="child.pm == 1">+{{ child.number }}</view>
  38. <view class="num" v-else>-{{ child.number }}</view>
  39. <template v-if="child.state == 'WAIT_USER_CONFIRM'">
  40. <view
  41. class="w-154 h-56 rd-30rpx flex-center mt-16 bg-color fs-24 text--w111-fff"
  42. @tap="jumpPath('/pages/users/user_spread_money/receiving?type=1&id=' + child.wechat_order_id)"
  43. >
  44. 立即收款
  45. </view>
  46. </template>
  47. </view>
  48. </view>
  49. </block>
  50. </view>
  51. </view>
  52. </view>
  53. </block>
  54. <view class="loadingicon acea-row row-center-wrapper" v-if="recordList.length">
  55. <text class="loading iconfont icon-jiazai" :hidden="loading == false"></text>
  56. {{ loadTitle }}
  57. </view>
  58. <view v-if="recordList.length < 1 && page > 1">
  59. <emptyPage :title="$t(`暂无数据~`)"></emptyPage>
  60. </view>
  61. </view>
  62. </view>
  63. <!-- #ifdef H5 -->
  64. <home></home>
  65. <!-- #endif -->
  66. </view>
  67. </template>
  68. <script>
  69. import { getCommissionInfo, getSpreadInfo } from '@/api/user.js';
  70. import { toLogin } from '@/libs/login.js';
  71. import { mapGetters } from 'vuex';
  72. // #ifdef MP
  73. import authorize from '@/components/Authorize';
  74. // #endif
  75. import emptyPage from '@/components/emptyPage.vue';
  76. import home from '@/components/home';
  77. import colors from '@/mixins/color.js';
  78. export default {
  79. components: {
  80. // #ifdef MP
  81. authorize,
  82. // #endif
  83. emptyPage,
  84. home
  85. },
  86. mixins: [colors],
  87. data() {
  88. return {
  89. name: '',
  90. type: 0,
  91. page: 1,
  92. limit: 15,
  93. loading: false,
  94. loadend: false,
  95. loadTitle: this.$t(`加载更多`),
  96. recordList: [],
  97. recordType: 0,
  98. recordCount: 0,
  99. extractCount: 0,
  100. times: [],
  101. isWeixin: false
  102. };
  103. },
  104. computed: {
  105. ...mapGetters(['isLogin'])
  106. // showWithdrawal() {
  107. // //#ifdef H5
  108. // // 仅编译到 H5 平台
  109. // return this.isWeixin;
  110. // // #endif
  111. // //#ifndef H5
  112. // // 非 H5 平台直接返回 false
  113. // return true;
  114. // // #endif
  115. // }
  116. },
  117. onLoad(options) {
  118. if (this.isLogin) {
  119. this.type = options.type;
  120. } else {
  121. toLogin();
  122. }
  123. },
  124. onShow() {
  125. //#ifdef H5
  126. this.isWeixin = this.$wechat.isWeixin();
  127. //#endif
  128. let type = this.type;
  129. this.loadend = false
  130. this.page = 1;
  131. this.times = [];
  132. this.recordList = [];
  133. if (type == 1) {
  134. uni.setNavigationBarTitle({
  135. title: '提现记录'
  136. });
  137. this.name = '提现总额';
  138. this.recordType = 4;
  139. this.getRecordList();
  140. this.getRecordListCount();
  141. } else if (type == 2) {
  142. uni.setNavigationBarTitle({
  143. title: '佣金记录'
  144. });
  145. this.name = '佣金明细';
  146. this.recordType = 3;
  147. this.getRecordList();
  148. this.getRecordListCount();
  149. } else {
  150. uni.showToast({
  151. title: '参数错误',
  152. icon: 'none',
  153. duration: 1000,
  154. mask: true,
  155. success: function (res) {
  156. setTimeout(function () {
  157. // #ifndef H5
  158. uni.navigateBack({
  159. delta: 1
  160. });
  161. // #endif
  162. // #ifdef H5
  163. history.back();
  164. // #endif
  165. }, 1200);
  166. }
  167. });
  168. }
  169. },
  170. methods: {
  171. jumpPath(url) {
  172. uni.navigateTo({
  173. url
  174. });
  175. },
  176. getRecordList: function () {
  177. let that = this;
  178. let page = that.page;
  179. let limit = that.limit;
  180. let recordType = that.recordType;
  181. if (that.loading) return;
  182. if (that.loadend) return;
  183. that.loading = true;
  184. that.loadTitle = '';
  185. getCommissionInfo(
  186. {
  187. page: page,
  188. limit: limit
  189. },
  190. recordType
  191. )
  192. .then((res) => {
  193. for (let i = 0; i < res.data.time.length; i++) {
  194. if (!this.times.includes(res.data.time[i])) {
  195. this.times.push(res.data.time[i]);
  196. this.recordList.push({
  197. time: res.data.time[i],
  198. child: []
  199. });
  200. }
  201. }
  202. for (let x = 0; x < this.times.length; x++) {
  203. for (let j = 0; j < res.data.list.length; j++) {
  204. if (this.times[x] === res.data.list[j].time_key) {
  205. this.recordList[x].child.push(res.data.list[j]);
  206. }
  207. }
  208. }
  209. let loadend = res.data.list.length < that.limit;
  210. that.loadend = loadend;
  211. that.loadTitle = loadend ? that.$t(`我也是有底线的`) : that.$t(`加载更多`);
  212. that.page += 1;
  213. that.loading = false;
  214. })
  215. .catch((err) => {
  216. that.loading = false;
  217. that.loadTitle = that.$t(`加载更多`);
  218. });
  219. },
  220. getRecordListCount: function () {
  221. let that = this;
  222. getSpreadInfo().then((res) => {
  223. that.recordCount = res.data.commissionCount;
  224. that.extractCount = res.data.extractCount;
  225. });
  226. }
  227. },
  228. onReachBottom: function () {
  229. this.getRecordList();
  230. }
  231. };
  232. </script>
  233. <style scoped lang="scss">
  234. .commission-details .promoterHeader .headerCon .money {
  235. font-size: 36rpx;
  236. }
  237. .commission-details .promoterHeader .headerCon .money .num {
  238. font-family: 'Guildford Pro';
  239. }
  240. .sign-record .list .item .listn .itemn .name {
  241. width: 100%;
  242. // max-width: 100%;
  243. white-space: break-spaces;
  244. }
  245. .sign-record .list .item .listn .itemn .title {
  246. padding-right: 30rpx;
  247. flex: 1;
  248. }
  249. </style>