award.vue 9.2 KB

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