jlDetil.vue 5.2 KB

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