xhplist.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <view class="content">
  3. <view class="navbar">
  4. <view v-for="(item, index) in navlist" :key="index" class="nav-item"
  5. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.title }}</view>
  6. </view>
  7. <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300" disable-touch>
  8. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navlist" :key="tabIndex">
  9. <scroll-view scroll-y="true" :style="{'height': height}" class="swiper-box" @scrolltolower="loadData"
  10. v-for="">
  11. <u-empty text="暂无数据" mode="list" v-if="tabItem.loaded && tabItem.list.length == 0"></u-empty>
  12. <view class="gq-list">
  13. <view class="gq-item" v-for="item in tabItem.list">
  14. <view class="gq-logo">
  15. <image :src="item.image" mode="" class=""></image>
  16. </view>
  17. <view class="info">
  18. <view class="info-tit">
  19. 名称:
  20. </view>
  21. <view class="info-val">
  22. {{item.name}}
  23. </view>
  24. </view>
  25. <view class="info">
  26. <view class="info-tit">
  27. ID:
  28. </view>
  29. <view class="info-val">
  30. {{item.id}}
  31. </view>
  32. </view>
  33. <view class="info">
  34. <view class="info-tit">
  35. 出仓时间:
  36. </view>
  37. <view class="info-val">
  38. {{$utils.formatDate(item.createTime).split(' ')[0]}}
  39. </view>
  40. </view>
  41. <view class="info">
  42. <view class="info-tit">
  43. 门店:
  44. </view>
  45. <view class="info-val">
  46. {{item.shop_name}}
  47. </view>
  48. </view>
  49. <view class="info">
  50. <view class="info-tit">
  51. 调拨人:
  52. </view>
  53. <view class="info-val">
  54. {{item.mobile}}
  55. </view>
  56. </view>
  57. <view class="info" v-if="tabCurrentIndex == 1">
  58. <view class="info-tit">
  59. 核销人:
  60. </view>
  61. <view class="info-val">
  62. {{item.write_mobile}}
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <u-loadmore :status="tabItem.loadingType" />
  68. </scroll-view>
  69. </swiper-item>
  70. </swiper>
  71. </view>
  72. </template>
  73. <script>
  74. export default {
  75. data() {
  76. return {
  77. tabCurrentIndex: 0,
  78. height: '',
  79. navlist: [{
  80. status: 1,
  81. title: '使用中',
  82. list: [],
  83. page: 1,
  84. pageSize: 10,
  85. loaded: false,
  86. loadingType: 'loadmore'
  87. },
  88. {
  89. status: 2,
  90. title: '已使用',
  91. list: [],
  92. page: 1,
  93. pageSize: 10,
  94. loaded: false,
  95. loadingType: 'loadmore'
  96. }
  97. ]
  98. }
  99. },
  100. onLoad() {
  101. },
  102. onShow() {
  103. this.loadData()
  104. },
  105. onReachBottom() {
  106. },
  107. onReady() {
  108. var _this = this;
  109. uni.getSystemInfo({
  110. success: resu => {
  111. const query = uni.createSelectorQuery();
  112. query.select('.swiper-box').boundingClientRect();
  113. query.exec(function(res) {
  114. _this.height = resu.windowHeight - res[0].top + 'px';
  115. console.log('打印页面的剩余高度', _this.height);
  116. });
  117. },
  118. fail: res => {}
  119. });
  120. },
  121. methods: {
  122. tabClick(index) {
  123. this.tabCurrentIndex = index;
  124. this.loadData('tab');
  125. },
  126. loadData(type) {
  127. let that = this;
  128. let index = that.tabCurrentIndex;
  129. let item = that.navlist[index];
  130. if (type == 'reload') {
  131. item.loaded = false;
  132. item.loadingType = 'loadmore';
  133. item.page = 1;
  134. item.list = [];
  135. }
  136. if (type == 'tab' && item.loaded) {
  137. return;
  138. }
  139. if (item.loadingType == 'loading' || item.loadingType == 'nomore') {
  140. return;
  141. }
  142. item.loadingType = 'loading';
  143. that.$u.api.getXhpList({
  144. page: item.page, //分页页码,数字类型
  145. pageSize: item.pageSize,
  146. status: item.status, //状态 1正常0禁用
  147. }).then(({data})=> {
  148. console.log(data);
  149. item.list = item.list.concat(data);
  150. item.page++;
  151. if(data.length == item.pageSize) {
  152. item.loadingType = 'loadmore';
  153. }else {
  154. item.loadingType = 'nomore';
  155. }
  156. item.loaded = true;
  157. })
  158. },
  159. }
  160. }
  161. </script>
  162. <style lang="scss">
  163. .navbar {
  164. // margin-top: 20rpx;
  165. display: flex;
  166. height: 88rpx;
  167. padding: 0 5px;
  168. background: #fff;
  169. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  170. position: relative;
  171. z-index: 10;
  172. .nav-item {
  173. flex: 1;
  174. display: flex;
  175. justify-content: center;
  176. align-items: center;
  177. height: 100%;
  178. font-size: 15px;
  179. color: #999999;
  180. position: relative;
  181. &.current {
  182. color: #000;
  183. &:after {
  184. content: '';
  185. position: absolute;
  186. left: 50%;
  187. bottom: 0;
  188. transform: translateX(-50%);
  189. width: 44px;
  190. height: 0;
  191. border-bottom: 2px solid #fe5b38;
  192. }
  193. }
  194. }
  195. }
  196. .swiper-box {
  197. .gq-list {
  198. display: flex;
  199. flex-wrap: wrap;
  200. justify-content: flex-start;
  201. // justify-content: space-between;
  202. padding: 20rpx 0 20rpx 20rpx;
  203. }
  204. .gq-item {
  205. margin: 0 0 20rpx 14rpx;
  206. width: 227rpx;
  207. // height: 351rpx;
  208. background: #FFFFFF;
  209. box-shadow: 0px 5rpx 5rpx 0px rgba(35, 24, 21, 0.06);
  210. border-radius: 10rpx;
  211. display: flex;
  212. flex-direction: column;
  213. align-items: center;
  214. justify-content: space-between;
  215. padding: 30rpx 14rpx 20rpx;
  216. .gq-logo {
  217. width: 193rpx;
  218. height: 193rpx;
  219. background: #EEEFF1;
  220. border-radius: 15px;
  221. display: flex;
  222. justify-content: center;
  223. align-items: center;
  224. image {
  225. width: 193rpx;
  226. height: 193rpx;
  227. }
  228. }
  229. .store-name {
  230. padding-top: 10rpx;
  231. text-align: center;
  232. width: 100%;
  233. font-size: 26rpx;
  234. font-weight: 500;
  235. color: #262261;
  236. overflow: hidden;
  237. }
  238. .info {
  239. width: 100%;
  240. display: flex;
  241. padding: 5rpx 0;
  242. .info-tit {
  243. font-size: 18rpx;
  244. flex-shrink: 0;
  245. }
  246. .info-val {
  247. text-align: center;
  248. font-size: 20rpx;
  249. width: 140rpx;
  250. border-bottom: 1px #C7C7C7 solid;
  251. }
  252. }
  253. }
  254. }
  255. </style>