index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <view>
  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'>{{name}}</view>
  8. <view class='money' v-if="type === 1">¥<text class='num'>{{ fen2yuan(spreadInfo.withdrawPrice, 0) }}</text></view>
  9. <view class='money' v-else>¥<text class='num'>{{ fen2yuan(spreadInfo.brokeragePrice, 0) }}</text></view>
  10. </view>
  11. <view class='iconfont icon-jinbi1'></view>
  12. </view>
  13. </view>
  14. <!-- 情况一:提现列表 -->
  15. <view class='sign-record' v-if="type === 1">
  16. <block v-for="(item,index) in recordList" :key="index" v-if="recordList.length > 0">
  17. <view class='list'>
  18. <view class='item'>
  19. <view class='listn borRadius14'>
  20. <block :key="index">
  21. <view class='itemn acea-row row-between-wrapper'>
  22. <view>
  23. <view class='name line1'>{{ item.statusName }}</view>
  24. <view>{{ formatDate(item.createTime) }}</view>
  25. </view>
  26. <view class='num font-color'>+{{ fen2yuan(item.price) }}</view>
  27. </view>
  28. </block>
  29. </view>
  30. </view>
  31. </view>
  32. </block>
  33. <view v-if="recordList.length === 0">
  34. <emptyPage title='暂无提现记录~'></emptyPage>
  35. </view>
  36. </view>
  37. <!-- 情况二:佣金列表 -->
  38. <view class='sign-record' v-else>
  39. <block v-for="(item,index) in recordList" :key="index" v-if="recordList.length > 0">
  40. <view class='list'>
  41. <view class='item'>
  42. <view class='listn borRadius14'>
  43. <block :key="index">
  44. <view class='itemn acea-row row-between-wrapper'>
  45. <view>
  46. <view class='name line1'>{{ item.title }}</view>
  47. <view>{{ formatDate(item.createTime) }}</view>
  48. </view>
  49. <view class='num font-color' v-if="item.price > 0">+{{item.price}}
  50. </view>
  51. <view class='num' v-else>{{item.price}}</view>
  52. </view>
  53. </block>
  54. </view>
  55. </view>
  56. </view>
  57. </block>
  58. <view v-if="recordList.length === 0">
  59. <emptyPage title='暂无佣金记录~'></emptyPage>
  60. </view>
  61. </view>
  62. </view>
  63. <home></home>
  64. </view>
  65. </template>
  66. <script>
  67. import { toLogin } from '@/libs/login.js';
  68. import { mapGetters } from "vuex";
  69. import emptyPage from '@/components/emptyPage.vue'
  70. import home from '@/components/home';
  71. import * as BrokerageAPI from '@/api/trade/brokerage.js'
  72. import * as Util from '@/utils/util.js';
  73. import dayjs from "@/plugin/dayjs/dayjs.min.js";
  74. export default {
  75. components: {
  76. emptyPage,
  77. home
  78. },
  79. data() {
  80. return {
  81. name: '', // 标题
  82. type: 0, // 类型;1 - 提现;2 - 佣金
  83. page: 1,
  84. limit: 15,
  85. recordList: [],
  86. statuss: false, // 是否到达底部
  87. spreadInfo: {},
  88. };
  89. },
  90. computed: mapGetters(['isLogin']),
  91. onLoad(options) {
  92. if (!this.isLogin) {
  93. toLogin();
  94. return;
  95. }
  96. this.type = parseInt(options.type);
  97. },
  98. onShow: function() {
  99. this.getSpreadInfo();
  100. // 获得列表
  101. let type = this.type;
  102. if (type === 1) {
  103. uni.setNavigationBarTitle({
  104. title: "提现记录"
  105. });
  106. this.name = '提现总额';
  107. this.getList();
  108. } else if (type === 2) {
  109. uni.setNavigationBarTitle({
  110. title: "佣金记录"
  111. });
  112. this.name = '佣金明细';
  113. this.getRecordList();
  114. } else {
  115. uni.showToast({
  116. title: '参数错误',
  117. icon: 'none',
  118. duration: 1000,
  119. mask: true,
  120. success: function(res) {
  121. setTimeout(function() {
  122. // #ifndef H5
  123. uni.navigateBack({
  124. delta: 1,
  125. });
  126. // #endif
  127. // #ifdef H5
  128. history.back();
  129. // #endif
  130. }, 1200)
  131. },
  132. });
  133. }
  134. },
  135. methods: {
  136. /**
  137. * 获得提现列表
  138. */
  139. getList: function() {
  140. if (this.statuss) {
  141. return;
  142. }
  143. const recordList = this.recordList;
  144. let recordListNew = [];
  145. BrokerageAPI.getBrokerageWithdrawPage({
  146. pageNo: this.page,
  147. pageSize: this.limit
  148. }).then(res => {
  149. const len = res.data.list ? res.data.list.length : 0;
  150. const recordListData = res.data.list || [];
  151. recordListNew = recordList.concat(recordListData);
  152. this.statuss = this.limit > len;
  153. this.page = this.page + 1;
  154. this.$set(this, 'recordList', recordListNew);
  155. });
  156. },
  157. /**
  158. * 获得佣金列表
  159. */
  160. getRecordList: function() {
  161. if (this.statuss) {
  162. return;
  163. }
  164. let page = this.page;
  165. let limit = this.limit;
  166. let recordList = this.recordList;
  167. let recordListNew = [];
  168. BrokerageAPI.getBrokerageRecordPage({
  169. pageNo: this.page,
  170. pageSize: this.limit
  171. }).then(res => {
  172. if (!res.data.list) {
  173. return;
  174. }
  175. const len = res.data.list ? res.data.list.length : 0;
  176. const recordListData = res.data.list || [];
  177. recordListNew = recordList.concat(recordListData);
  178. this.statuss = limit > len;
  179. this.page = page + 1;
  180. this.$set(this, 'recordList', recordListNew);
  181. });
  182. },
  183. /**
  184. * 获取个人用户信息
  185. */
  186. getSpreadInfo: function() {
  187. BrokerageAPI.getBrokerageUserSummary().then(res => {
  188. this.$set(this,'spreadInfo',res.data);
  189. });
  190. },
  191. fen2yuan(price) {
  192. return Util.fen2yuan(price)
  193. },
  194. formatDate: function(date) {
  195. return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
  196. },
  197. },
  198. onReachBottom: function() {
  199. this.getRecordList();
  200. }
  201. }
  202. </script>
  203. <style scoped lang="scss">
  204. .commission-details .promoterHeader .headerCon .money {
  205. font-size: 36rpx;
  206. }
  207. .commission-details .promoterHeader .headerCon .money .num {
  208. font-family: 'Guildford Pro';
  209. }
  210. </style>