award.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="money-box flex">
  5. <view>
  6. <view class="text">可提现佣金(元)</view>
  7. <view class="money">{{ money | getMoneyStyle }}</view>
  8. </view>
  9. <navigator url="/pages/wallet/freezeList">
  10. <view>
  11. <view class="text">冻结佣金(元)</view>
  12. <view class="money">{{ freezeMoney | getMoneyStyle }}</view>
  13. </view>
  14. </navigator>
  15. </view>
  16. <!-- <view class="moneyTx" @click="navto('./withdrawal')">提现</view> -->
  17. <!-- <view class="moneyTxs" @click="navto('./withdmoenys')" >转余额</view> -->
  18. <view class="flex buttom-box">
  19. <view class="buttom" @click="navto('./withdrawal')">
  20. <view class="icon"><image class="icon-img" src="/static/icon/i6.png" mode="aspectFit"></image></view>
  21. <text class="font-size-sm">提现</text>
  22. </view>
  23. <view class="interval"></view>
  24. <view class="buttom" @click="navto('./withdmoenys')">
  25. <view class="icon"><image class="icon-img" src="/static/icon/i7.png" mode="aspectFit"></image></view>
  26. <text class="font-size-sm">转余额</text>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="navbar">
  31. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  32. </view>
  33. <swiper :current="tabCurrentIndex" :style="{ height: maxheight + 'px' }" class="swiper-box" duration="300" @change="changeTab">
  34. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  35. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  36. <!-- 空白页 -->
  37. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  38. <!-- 订单列表 -->
  39. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item flex">
  40. <view class="title-box">
  41. <view class="title">
  42. <text>{{ item.title }}</text>
  43. </view>
  44. <view class="time">
  45. <text>{{ item.add_time }}</text>
  46. </view>
  47. </view>
  48. <view class="money">
  49. <text>{{ (item.pm == 0 ? '-' : '+') + item.number }}</text>
  50. </view>
  51. </view>
  52. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  53. </scroll-view>
  54. </swiper-item>
  55. </swiper>
  56. </view>
  57. </template>
  58. <script>
  59. import { spreadCommission, extractBank } from '@/api/wallet.js';
  60. import { mapState, mapMutations } from 'vuex';
  61. import { getMoneyStyle } from '@/utils/rocessor.js';
  62. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  63. import empty from '@/components/empty';
  64. export default {
  65. filters: {
  66. getMoneyStyle
  67. },
  68. components: {
  69. empty,
  70. uniLoadMore
  71. },
  72. onReady() {
  73. // 初始化获取页面宽度
  74. uni.createSelectorQuery()
  75. .select('.content')
  76. .fields(
  77. {
  78. size: true
  79. },
  80. data => {
  81. // 保存头部高度
  82. this.maxheight = data.height - Math.floor((data.width / 750) * 570);
  83. console.log(this.maxheight);
  84. }
  85. )
  86. .exec();
  87. },
  88. data() {
  89. return {
  90. // 头部图高度
  91. maxheight: '',
  92. tabCurrentIndex: 0,
  93. navList: [
  94. {
  95. state: 0,
  96. text: '收入',
  97. loadingType: 'more',
  98. orderList: [],
  99. page: 1, //当前页数
  100. limit: 10 //每次信息条数
  101. },
  102. {
  103. state: 1,
  104. text: '支出',
  105. loadingType: 'more',
  106. orderList: [],
  107. page: 1, //当前页数
  108. limit: 10 //每次信息条数
  109. }
  110. ],
  111. money: '', //可提现佣金
  112. freezeMoney: '' //冻结中的佣金
  113. };
  114. },
  115. onLoad(options) {},
  116. onShow() {
  117. this.loadData();
  118. // 获取用户余额
  119. extractBank({}).then(({ data }) => {
  120. this.money = data.commissionCount;
  121. // 冻结佣金
  122. this.freezeMoney = data.freezePrice;
  123. });
  124. },
  125. methods: {
  126. // 页面跳转
  127. navto(e) {
  128. uni.navigateTo({
  129. url: e
  130. });
  131. },
  132. //获取收入支出信息
  133. async loadData(source) {
  134. //这里是将订单挂载到tab列表下
  135. let index = this.tabCurrentIndex;
  136. let navItem = this.navList[index];
  137. let state = navItem.state + 3;
  138. if (source === 'tabChange' && navItem.loaded === true) {
  139. //tab切换只有第一次需要加载数据
  140. return;
  141. }
  142. if (navItem.loadingType === 'loading') {
  143. //防止重复加载
  144. return;
  145. }
  146. // 修改当前对象状态为加载中
  147. navItem.loadingType = 'loading';
  148. spreadCommission(
  149. {
  150. page: navItem.page,
  151. limit: navItem.limit
  152. },
  153. state
  154. )
  155. .then(({ data }) => {
  156. if (data.length > 0) {
  157. navItem.orderList = navItem.orderList.concat(data[0].list);
  158. console.log(navItem.orderList);
  159. navItem.page++;
  160. }
  161. if (navItem.limit == data.length) {
  162. //判断是否还有数据, 有改为 more, 没有改为noMore
  163. navItem.loadingType = 'more';
  164. return;
  165. } else {
  166. //判断是否还有数据, 有改为 more, 没有改为noMore
  167. navItem.loadingType = 'noMore';
  168. }
  169. uni.hideLoading();
  170. this.$set(navItem, 'loaded', true);
  171. })
  172. .catch(e => {
  173. console.log(e);
  174. });
  175. },
  176. //swiper 切换
  177. changeTab(e) {
  178. this.tabCurrentIndex = e.target.current;
  179. this.loadData('tabChange');
  180. },
  181. //顶部tab点击
  182. tabClick(index) {
  183. this.tabCurrentIndex = index;
  184. }
  185. }
  186. };
  187. </script>
  188. <style lang="scss">
  189. page {
  190. background: #ffffff;
  191. height: 100%;
  192. }
  193. .content-money {
  194. padding-bottom: 30rpx;
  195. background: $page-color-base;
  196. .moneyTx {
  197. position: absolute;
  198. top: 150rpx;
  199. right: 0rpx;
  200. width: 150rpx;
  201. padding: 10rpx 30rpx;
  202. border: 2px solid #ffffff;
  203. border-top-left-radius: 99rpx;
  204. border-bottom-left-radius: 99rpx;
  205. color: #ffffff;
  206. line-height: 1;
  207. font-size: $font-base;
  208. }
  209. .moneyTxs {
  210. position: absolute;
  211. top: 220rpx;
  212. right: 0rpx;
  213. width: 150rpx;
  214. padding: 10rpx 30rpx;
  215. border: 2px solid #ffffff;
  216. border-top-left-radius: 99rpx;
  217. border-bottom-left-radius: 99rpx;
  218. color: #ffffff;
  219. line-height: 1;
  220. font-size: $font-base;
  221. }
  222. .buttom-box {
  223. background-color: #ffffff;
  224. text-align: center;
  225. margin: 0 30rpx;
  226. padding: 20rpx 0;
  227. border-radius: $border-radius-sm;
  228. margin-top: -60rpx;
  229. .buttom {
  230. font-size: $font-lg;
  231. flex-grow: 1;
  232. }
  233. .interval {
  234. width: 2px;
  235. height: 60rpx;
  236. background-color: #eeeeee;
  237. }
  238. .icon {
  239. height: 50rpx;
  240. width: 48rpx;
  241. margin: 0 auto;
  242. .icon-img {
  243. width: 100%;
  244. height: 100%;
  245. }
  246. }
  247. }
  248. }
  249. .money-box {
  250. background-color: $base-color;
  251. padding-top: var(--status-bar-height);
  252. height: 368rpx;
  253. color: #ffffff;
  254. text-align: center;
  255. justify-content: space-around;
  256. .text {
  257. font-size: $font-sm;
  258. }
  259. .money {
  260. font-size: 56rpx;
  261. }
  262. }
  263. .navbar {
  264. display: flex;
  265. height: 40px;
  266. padding: 0 5px;
  267. background: #fff;
  268. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  269. position: relative;
  270. z-index: 10;
  271. .nav-item {
  272. flex: 1;
  273. display: flex;
  274. justify-content: center;
  275. align-items: center;
  276. height: 100%;
  277. font-size: 15px;
  278. color: $font-color-dark;
  279. position: relative;
  280. &.current {
  281. color: $base-color;
  282. &:after {
  283. content: '';
  284. position: absolute;
  285. left: 50%;
  286. bottom: 0;
  287. transform: translateX(-50%);
  288. width: 44px;
  289. height: 0;
  290. border-bottom: 2px solid $base-color;
  291. }
  292. }
  293. }
  294. }
  295. // 列表
  296. .swiper-box {
  297. padding-top: 10rpx;
  298. .order-item {
  299. padding: 20rpx 30rpx;
  300. line-height: 1.5;
  301. .title-box {
  302. .title {
  303. font-size: $font-lg;
  304. color: $font-color-base;
  305. }
  306. .time {
  307. font-size: $font-base;
  308. color: $font-color-light;
  309. }
  310. }
  311. .money {
  312. color: #fd5b23;
  313. font-size: $font-lg;
  314. }
  315. }
  316. }
  317. .list-scroll-content {
  318. height: 100%;
  319. }
  320. .content {
  321. height: 100%;
  322. .empty-content {
  323. background-color: #ffffff;
  324. }
  325. }
  326. </style>