award.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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. navItem.page++;
  166. }
  167. //判断是否还有数据, 有改为more, 没有改为noMore
  168. if (navItem.limit == data.length) {
  169. navItem.loadingType = 'more';
  170. return;
  171. } else {
  172. navItem.loadingType = 'noMore';
  173. }
  174. uni.hideLoading();
  175. this.$set(navItem, 'loaded', true);
  176. })
  177. .catch(e => {
  178. console.log(e);
  179. });
  180. },
  181. }
  182. }
  183. </script>
  184. <style lang="scss">
  185. page {
  186. height: 100%;
  187. }
  188. .content-money {
  189. position: relative;
  190. padding: 20rpx;
  191. z-index: 1;
  192. .conetnt-box {
  193. border-radius: 20rpx;
  194. background-color: #ffffff;
  195. padding-bottom: 50rpx;
  196. // height: 400rpx;
  197. .detailBox {
  198. justify-content: space-around;
  199. padding-top: 30rpx;
  200. .item {
  201. text-align: center;
  202. color: $font-color-light;
  203. .nametype {
  204. color: $font-color-disabled;
  205. font-size: 24rpx;
  206. }
  207. .moneyNum {
  208. margin-top: 20rpx;
  209. font-size: 28rpx;
  210. font-weight: bold;
  211. }
  212. }
  213. }
  214. }
  215. .buttom-box {
  216. text-align: center;
  217. margin: 0 30rpx;
  218. margin-top: 50rpx;
  219. .buttom {
  220. flex-grow: 1;
  221. border-radius: 100rpx;
  222. font-size: $font-lg;
  223. width: 300rpx;
  224. height: 80rpx;
  225. line-height: 80rpx;
  226. background-color: $color-green;
  227. color: #FFFFFF;
  228. &.geMoney {
  229. border: 1px solid $font-color-disabled;
  230. color: $font-color-disabled;
  231. background-color: #FFFFFF;
  232. }
  233. }
  234. }
  235. }
  236. .money-box {
  237. text-align: center;
  238. color: $font-color-dark;
  239. font-weight: bold;
  240. .text {
  241. padding-top: 85rpx;
  242. font-size: 24rpx;
  243. margin-bottom: 20rpx;
  244. }
  245. .money {
  246. font-size: 60rpx;
  247. }
  248. }
  249. .listbox {
  250. margin: 0 20rpx;
  251. border-radius: 20rpx;
  252. position: relative;
  253. }
  254. .navbar {
  255. background: #fff;
  256. padding: 30rpx;
  257. border-bottom: 1px solid $page-color-light;
  258. border-top-left-radius: 20rpx;
  259. border-top-right-radius: 20rpx;
  260. .title {
  261. font-size: 32rpx;
  262. font-weight: bold;
  263. }
  264. .alllist {
  265. font-size: 28rpx;
  266. }
  267. }
  268. .content {
  269. height: 100%;
  270. .bg {
  271. background-color: #f6ab0b;
  272. width: 950rpx;
  273. position: absolute;
  274. left: -100rpx;
  275. border-bottom-left-radius: 1000rpx;
  276. border-bottom-right-radius: 1000rpx;
  277. top: 0rpx;
  278. height: 300rpx;
  279. }
  280. }
  281. .conetntList {
  282. padding: 30rpx;
  283. background-color: #FFFFFF;
  284. border-bottom-left-radius: 20rpx;
  285. border-bottom-right-radius: 20rpx;
  286. .listItem {
  287. font-size: 30rpx;
  288. color: $font-color-dark;
  289. align-items: flex-start;
  290. }
  291. .itemBottom {
  292. font-size: 24rpx;
  293. color: $font-color-disabled;
  294. }
  295. }
  296. </style>