jlDetil.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <view>
  3. <swiper :style="{ height: height }" class="swiper-box" duration="300">
  4. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  5. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData">
  6. <!-- 空白页 -->
  7. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  8. <!-- 订单列表 -->
  9. <view>
  10. <view class="order-item flex" v-for="(item, index) in tabItem.orderList" >
  11. <view class="title-box">
  12. <view class="title">
  13. <text>怪兽名称:{{ item.name }}</text>
  14. </view>
  15. <view class="time">
  16. <text>{{ item.create_time }}</text>
  17. </view>
  18. <view class="time">
  19. <text>场次:第{{ item.stage }}期</text>
  20. </view>
  21. </view>
  22. <view class="money">
  23. <view>打怪血量:{{ item.price*1 }}</view>
  24. <!-- <view class="">
  25. {{item.status==0&&item.is_return==1}} 待返还
  26. {{item.status==0&&item.is_return==0}} 进行中
  27. {{item.status==1}} 打怪成功
  28. {{item.status==2}} 打怪失败
  29. </view> -->
  30. <view class="money" v-if="item.status==0&&item.is_return==1">
  31. 待发放
  32. </view>
  33. <view class="money" v-else-if="item.status==0&&item.is_return==0">
  34. 进行中
  35. </view>
  36. <view class="money" v-else-if="item.status==1">
  37. 打怪成功
  38. </view>
  39. <view class="money" v-else-if ="item.status==2" >
  40. 打怪失败
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <uni-load-more :status="tabItem.loadingType"
  46. v-if="!(tabItem.orderList.length == 0 && tabItem.loaded)"></uni-load-more>
  47. </scroll-view>
  48. </swiper-item>
  49. </swiper>
  50. </view>
  51. </template>
  52. <script>
  53. import { getJl} from '@/api/user.js'
  54. import {
  55. mapState,
  56. mapMutations
  57. } from 'vuex';
  58. import {
  59. getMoneyStyle
  60. } from '@/utils/rocessor.js';
  61. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  62. import empty from '@/components/empty';
  63. export default {
  64. components: {
  65. empty,
  66. uniLoadMore
  67. },
  68. filters: {
  69. getMoneyStyle
  70. },
  71. data() {
  72. return {
  73. zc: 0,
  74. sr: 0,
  75. height: '',
  76. // 头部图高度
  77. maxheight: '',
  78. tabCurrentIndex: 0,
  79. orderStatusSum: 0,
  80. recharge: 0,
  81. navList: [
  82. {
  83. loadingType: 'more',
  84. orderList: [],
  85. page: 1, //当前页数
  86. limit: 10 ,//每次信息条数
  87. loaded:false
  88. }
  89. ],
  90. money: ''
  91. };
  92. },
  93. computed: {
  94. ...mapState('user', ['userInfo'])
  95. },
  96. onReady(res) {
  97. var _this = this;
  98. uni.getSystemInfo({
  99. success: resu => {
  100. const query = uni.createSelectorQuery();
  101. query.select('.swiper-box').boundingClientRect();
  102. query.exec(function(res) {
  103. _this.height = resu.windowHeight - res[0].top + 'px';
  104. console.log('打印页面的剩余高度', _this.height);
  105. });
  106. },
  107. fail: res => {}
  108. });
  109. },
  110. onPullDownRefresh() {
  111. this.loadData()
  112. },
  113. onLoad() {
  114. this.loadData()
  115. },
  116. methods:{
  117. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  118. async loadData() {
  119. let obj = this
  120. //这里是将订单挂载到tab列表下
  121. // let index = this.tabCurrentIndex;
  122. let navItem = obj.navList[0];
  123. console.log(navItem,'we2wqe');
  124. let state = navItem.state;
  125. // if (navItem.loaded === true) {
  126. // //tab切换只有第一次需要加载数据
  127. // return;
  128. // }
  129. if (navItem.loadingType === 'loading') {
  130. //防止重复加载
  131. return;
  132. }
  133. // 修改当前对象状态为加载中
  134. navItem.loadingType = 'loading';
  135. // console.log(navItem.loadingType);
  136. getJl({
  137. page: navItem.page,
  138. limit: navItem.limit,
  139. // pm: navItem.state
  140. })
  141. .then(({
  142. data
  143. }) => {
  144. // console.log(data.data,'2222');
  145. // obj.zc = data.zc
  146. // obj.sr = data.sr
  147. navItem.orderList = navItem.orderList.concat(data.data)
  148. console.log(navItem.orderList,'item');
  149. navItem.page++
  150. if (navItem.limit == data.data.length) {
  151. navItem.loadingType = 'more'
  152. } else {
  153. navItem.loadingType = 'noMore'
  154. }
  155. obj.$set(navItem, 'loaded', true);
  156. })
  157. .catch(e => {
  158. console.log(e);
  159. });
  160. },
  161. }
  162. }
  163. </script>
  164. <style lang="scss">
  165. //列表
  166. .swiper-box {
  167. .order-item:last-child {
  168. margin-bottom: 60rpx;
  169. }
  170. .order-item {
  171. padding: 20rpx 30rpx;
  172. line-height: 1.5;
  173. .title-box {
  174. .title {
  175. font-size: $font-lg;
  176. color: $font-color-base;
  177. }
  178. .time {
  179. font-size: $font-base;
  180. color: $font-color-light;
  181. }
  182. }
  183. .money {
  184. color: #fd5b23;
  185. font-size: $font-lg;
  186. text-align: right;
  187. .status {
  188. color: $font-color-light;
  189. }
  190. }
  191. }
  192. }
  193. .list-scroll-content {
  194. background: #ffffff;
  195. height: 100%;
  196. }
  197. .content {
  198. height: 100%;
  199. .empty-content {
  200. background-color: #ffffff;
  201. }
  202. }
  203. .btn-box {
  204. width: 674rpx;
  205. height: 88rpx;
  206. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  207. border-radius: 44rpx;
  208. font-size: 36rpx;
  209. font-family: PingFang SC;
  210. font-weight: 500;
  211. color: #ffffff;
  212. text-align: center;
  213. line-height: 88rpx;
  214. position: fixed;
  215. bottom: 48rpx;
  216. left: 0;
  217. right: 0;
  218. margin: 0 auto;
  219. }
  220. </style>