award.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <template>
  2. <view class="content">
  3. <view class="bg">
  4. </view>
  5. <view class="content-money">
  6. <view class="conetnt-box">
  7. <view class="money-box">
  8. <view class="text">可用佣金(元)</view>
  9. <view class="money">{{ money | getMoneyStyle }}</view>
  10. </view>
  11. <view class="detailBox flex">
  12. <view class="item">
  13. <view class="nametype">
  14. 提现中
  15. </view>
  16. <view class="moneyNum font-color-red">
  17. {{addMoney||0}}
  18. </view>
  19. </view>
  20. <view class="item">
  21. <view class="nametype">
  22. 即将到账
  23. </view>
  24. <view class="moneyNum ">
  25. {{timeMoney||0}}
  26. </view>
  27. </view>
  28. <view class="item">
  29. <view class="nametype">
  30. 累计收益
  31. </view>
  32. <view class="moneyNum ">
  33. {{allMoney||0}}
  34. </view>
  35. </view>
  36. </view>
  37. <view class="flex buttom-box">
  38. <view class="buttom geMoney" @click="navto('./withdrawal')">
  39. <text>提现</text>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="listbox">
  45. <view class="navbar flex">
  46. <view class="title">
  47. 佣金变动明细
  48. </view>
  49. <view class="alllist" @click="navto('./awardList')">
  50. 全部
  51. </view>
  52. </view>
  53. <view class="conetntList">
  54. <view class="listItem flex" v-for="(item, tabIndex) in navList[0].orderList">
  55. <view class="itemLeft">
  56. <view class="itemTitle flex">
  57. <text>{{item.title}}</text>
  58. <text class="font-size-sm font-color-red" v-if="item.status==0">(未到账)</text>
  59. </view>
  60. <view class="itemBottom">
  61. {{item.add_time}}
  62. </view>
  63. </view>
  64. <view class="itemRight">
  65. <view class="itemTitle">
  66. {{(item.pm == 0 ? '-' : '+')+item.number}}
  67. </view>
  68. <!-- <view class="itemBottom">
  69. 余额{{item.yue}}
  70. </view> -->
  71. </view>
  72. </view>
  73. <uni-load-more :status="navList[0].loadingType"></uni-load-more>
  74. </view>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. import {
  80. spreadCommission,
  81. extractBank
  82. } from '@/api/wallet.js';
  83. import {
  84. mapState,
  85. mapMutations
  86. } from 'vuex';
  87. import {
  88. getMoneyStyle
  89. } from '@/utils/rocessor.js';
  90. // import empty from '@/components/empty';
  91. export default {
  92. filters: {
  93. getMoneyStyle
  94. },
  95. // components: {
  96. // empty,
  97. // },
  98. data() {
  99. return {
  100. tabCurrentIndex: 0,
  101. navList: [{
  102. state: 3,
  103. text: '收入',
  104. loadingType: 'more',
  105. orderList: [],
  106. page: 1, //当前页面
  107. limit: 10 //每次信息条数
  108. }],
  109. money: 0, //可提现佣金
  110. addMoney: 200, //提现中到账
  111. timeMoney: 200, //即将到账
  112. allMoney: 1000, //累计收益
  113. };
  114. },
  115. onLoad(options) {
  116. this.loadData();
  117. },
  118. onShow() {
  119. //获取用户余额
  120. extractBank({}).then(({
  121. data
  122. }) => {
  123. this.money = data.commissionCount;
  124. this.addMoney = data.ext_broerage;
  125. this.timeMoney = data.not_broerage;
  126. this.allMoney = data.total_brokerage;
  127. });
  128. },
  129. // 页面到底部后加载数据
  130. onReachBottom() {
  131. this.loadData();
  132. },
  133. methods: {
  134. navto(e) {
  135. uni.navigateTo({
  136. url: e
  137. });
  138. },
  139. async loadData(source) {
  140. //这里时将订单挂载到tab列表下
  141. let index = this.tabCurrentIndex;
  142. let navItem = this.navList[index];
  143. let state = navItem.state ;
  144. if (source === 'tabChange' && navItem.loaded === true) {
  145. //tab切换只有第一次需要加载数据
  146. return;
  147. }
  148. if (navItem.loadingType === 'loading') {
  149. //防止重复加载
  150. return;
  151. }
  152. //修改当前对象状态为加载中
  153. navItem.loadingType = 'loading';
  154. spreadCommission({
  155. page: navItem.page,
  156. limit: navItem.limit
  157. },
  158. state
  159. )
  160. .then(({
  161. data
  162. }) => {
  163. if (data.length > 0) {
  164. navItem.orderList = navItem.orderList.concat(data[0].list);
  165. console.log(navItem.orderList);
  166. navItem.page++;
  167. }
  168. //判断是否还有数据, 有改为more, 没有改为noMore
  169. if (navItem.limit == data.length) {
  170. navItem.loadingType = 'more';
  171. return;
  172. } else {
  173. navItem.loadingType = 'noMore';
  174. }
  175. uni.hideLoading();
  176. this.$set(navItem, 'loaded', true);
  177. })
  178. .catch(e => {
  179. console.log(e);
  180. });
  181. },
  182. }
  183. }
  184. </script>
  185. <style lang="scss">
  186. page {
  187. height: 100%;
  188. }
  189. .content-money {
  190. position: relative;
  191. padding: 20rpx;
  192. z-index: 1;
  193. .conetnt-box {
  194. border-radius: 20rpx;
  195. background-color: #ffffff;
  196. padding-bottom: 50rpx;
  197. // height: 400rpx;
  198. .detailBox {
  199. justify-content: space-around;
  200. padding-top: 30rpx;
  201. .item {
  202. text-align: center;
  203. color: $font-color-light;
  204. .nametype {
  205. color: $font-color-disabled;
  206. font-size: 24rpx;
  207. }
  208. .moneyNum {
  209. margin-top: 20rpx;
  210. font-size: 28rpx;
  211. font-weight: bold;
  212. }
  213. }
  214. }
  215. }
  216. .buttom-box {
  217. text-align: center;
  218. margin: 0 30rpx;
  219. margin-top: 50rpx;
  220. .buttom {
  221. flex-grow: 1;
  222. border-radius: 100rpx;
  223. font-size: $font-lg;
  224. width: 300rpx;
  225. height: 80rpx;
  226. line-height: 80rpx;
  227. background-color: $color-green;
  228. color: #FFFFFF;
  229. &.geMoney {
  230. border: 1px solid $font-color-disabled;
  231. color: $font-color-disabled;
  232. background-color: #FFFFFF;
  233. }
  234. }
  235. }
  236. }
  237. .money-box {
  238. text-align: center;
  239. color: $font-color-dark;
  240. font-weight: bold;
  241. .text {
  242. padding-top: 85rpx;
  243. font-size: 24rpx;
  244. margin-bottom: 20rpx;
  245. }
  246. .money {
  247. font-size: 60rpx;
  248. }
  249. }
  250. .listbox {
  251. margin: 0 20rpx;
  252. border-radius: 20rpx;
  253. position: relative;
  254. }
  255. .navbar {
  256. background: #fff;
  257. padding: 30rpx;
  258. border-bottom: 1px solid $page-color-light;
  259. border-top-left-radius: 20rpx;
  260. border-top-right-radius: 20rpx;
  261. .title {
  262. font-size: 32rpx;
  263. font-weight: bold;
  264. }
  265. .alllist {
  266. font-size: 28rpx;
  267. }
  268. }
  269. .content {
  270. height: 100%;
  271. .bg {
  272. background-color: #f6ab0b;
  273. width: 950rpx;
  274. position: absolute;
  275. left: -100rpx;
  276. border-bottom-left-radius: 1000rpx;
  277. border-bottom-right-radius: 1000rpx;
  278. top: 0rpx;
  279. height: 300rpx;
  280. }
  281. }
  282. .conetntList {
  283. padding: 30rpx;
  284. background-color: #FFFFFF;
  285. border-bottom-left-radius: 20rpx;
  286. border-bottom-right-radius: 20rpx;
  287. .listItem {
  288. font-size: 30rpx;
  289. color: $font-color-dark;
  290. align-items: flex-start;
  291. }
  292. .itemBottom {
  293. font-size: 24rpx;
  294. color: $font-color-disabled;
  295. }
  296. }
  297. </style>