sz.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <view class="content">
  3. <view class="navbar">
  4. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  5. </view>
  6. <swiper :current="tabCurrentIndex" :style="{ height: maxheight }" class="swiper-box" duration="300" @change="changeTab">
  7. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  8. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="getList()">
  9. <!-- 空白页 -->
  10. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  11. <!-- 订单列表 -->
  12. <view class="order-item flex" v-for="(item, index) in tabItem.orderList" :key="index">
  13. <view class="title-box">
  14. <view class="title">
  15. <text>{{ item.title }}</text>
  16. </view>
  17. <view class="time">
  18. <text>{{ item.add_time }}</text>
  19. </view>
  20. </view>
  21. <view class="money">
  22. <text>{{ (item.pm == 0 ? '-' : '+') + item.number }}</text>
  23. </view>
  24. </view>
  25. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  26. </scroll-view>
  27. </swiper-item>
  28. </swiper>
  29. </view>
  30. </template>
  31. <script>
  32. import { spreadCommission } from '@/api/wallet.js';
  33. export default {
  34. data() {
  35. return {
  36. maxheight: '',
  37. tabCurrentIndex: 0,
  38. navList: [
  39. {
  40. state: 1,
  41. text: '收入',
  42. loadingType: 'more',
  43. orderList: [],
  44. page: 1, //当前页面
  45. limit: 10 //每次信息条数
  46. },
  47. {
  48. state: 0,
  49. text: '支出',
  50. loadingType: 'more',
  51. orderList: [],
  52. page: 1, //当前页面
  53. limit: 10 //每次信息条数
  54. }
  55. ],
  56. type: 0,//1-复投积分 2-佣金 3-分红额度 4-消费积分
  57. }
  58. },
  59. onLoad(opt) {
  60. this.type = opt.type
  61. },
  62. onShow() {
  63. this.getList()
  64. },
  65. onReady(res) {
  66. var _this = this;
  67. uni.getSystemInfo({
  68. success: resu => {
  69. const query = uni.createSelectorQuery();
  70. query.select('.swiper-box').boundingClientRect();
  71. query.exec(function(res) {
  72. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  73. console.log('打印页面的剩余高度', _this.maxheight);
  74. });
  75. },
  76. fail: res => {}
  77. });
  78. },
  79. methods:{
  80. //顶部tab点击
  81. tabClick(index) {
  82. this.tabCurrentIndex = index;
  83. },
  84. changeTab(res) {
  85. console.log(res);
  86. let that = this
  87. that.tabCurrentIndex = res.detail.current
  88. that.getList('tab')
  89. },
  90. getList(type) {
  91. let that = this
  92. let item = that.navList[that.tabCurrentIndex]
  93. let status = 0
  94. let qdata = {
  95. page: item.page,
  96. limit: item.limit,
  97. }
  98. if(type == 'tab' && item.loaded) {
  99. return
  100. }
  101. if(item.loadingType == 'noMore' || item.loadingType == 'loading') {
  102. return
  103. }
  104. item.loadingType = 'loading'
  105. if(that.type == 2 || that.type ==4) {
  106. if(that.type == 2 ) {
  107. if(item.state == 1) {
  108. status =3
  109. }else {
  110. status = 4
  111. }
  112. }else {
  113. if(item.state == 1) {
  114. status = 2
  115. }else {
  116. status =1
  117. }
  118. }
  119. }else {
  120. if(that.type == 1) {
  121. status = 7
  122. qdata.category = 'resumption'
  123. if(item.state == 1) {
  124. qdata.pm = 1
  125. }else {
  126. qdata.pm = 0
  127. }
  128. }else if(that.type == 3){
  129. status = 6
  130. qdata.category = 'pool'
  131. if(item.state == 1) {
  132. qdata.pm = 1
  133. }else {
  134. qdata.pm = 0
  135. }
  136. }else if(that.type == 8) {
  137. status = 8
  138. qdata.category = 'points'
  139. if(item.state == 1) {
  140. qdata.pm = 1
  141. }else {
  142. qdata.pm = 0
  143. }
  144. }else if(that.type == 9) {
  145. status = 9
  146. qdata.category = 'pass'
  147. if(item.state == 1) {
  148. qdata.pm = 1
  149. }else {
  150. qdata.pm = 0
  151. }
  152. }else if(that.type == 10) {
  153. status = 10
  154. qdata.category = 'integral'
  155. if(item.state == 1) {
  156. qdata.pm = 1
  157. }else {
  158. qdata.pm = 0
  159. }
  160. }else if(that.type == 11) {
  161. status = 11
  162. qdata.category = 'freeze_points'
  163. if(item.state == 1) {
  164. qdata.pm = 1
  165. }else {
  166. qdata.pm = 0
  167. }
  168. }
  169. }
  170. spreadCommission(qdata,status).then(({data})=> {
  171. if(data.length > 0) {
  172. let arr = []
  173. data.forEach(item => {
  174. arr = arr.concat(item.list)
  175. console.log(arr);
  176. })
  177. item.orderList = item.orderList.concat(arr);
  178. item.page++;
  179. if (item.limit == data.length) {
  180. item.loadingType = 'more';
  181. return;
  182. } else {
  183. item.loadingType = 'noMore';
  184. }
  185. // uni.hideLoading();
  186. that.$set(item, 'loaded', true);
  187. }else {
  188. item.loadingType = 'noMore'
  189. }
  190. })
  191. }
  192. }
  193. }
  194. </script>
  195. <style lang="scss" scoped>
  196. .navbar {
  197. display: flex;
  198. height: 40px;
  199. padding: 0 5px;
  200. background: #fff;
  201. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  202. position: relative;
  203. z-index: 10;
  204. .nav-item {
  205. flex: 1;
  206. display: flex;
  207. justify-content: center;
  208. align-items: center;
  209. height: 100%;
  210. font-size: 15px;
  211. color: $font-color-dark;
  212. position: relative;
  213. &.current {
  214. color: #000;
  215. font-weight: bold;
  216. &:after {
  217. content: '';
  218. position: absolute;
  219. left: 50%;
  220. bottom: 0;
  221. transform: translateX(-50%);
  222. width: 44px;
  223. height: 0;
  224. border-bottom: 2px solid #FF4C4C;
  225. }
  226. }
  227. }
  228. }
  229. .swiper-box {
  230. .order-item {
  231. padding: 20rpx 30rpx;
  232. line-height: 1.5;
  233. .title-box {
  234. .title {
  235. font-size: $font-lg;
  236. color: $font-color-base;
  237. }
  238. .time {
  239. font-size: $font-base;
  240. color: $font-color-light;
  241. }
  242. }
  243. .money {
  244. color: rgba(239, 58, 85, 1);
  245. font-size: $font-lg;
  246. }
  247. }
  248. }
  249. .list-scroll-content {
  250. background-color: #ffffff;
  251. height: 100%;
  252. }
  253. </style>