index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <!-- 我的钢瓶 -->
  3. <view>
  4. <view class="head_sticky">
  5. <view class="head_mine_title">我的钢瓶</view>
  6. <view style="width: 100%;">
  7. <u-tabs :list="bottleList" lineWidth="40" :scrollable="false" @click="bottleClick"></u-tabs>
  8. </view>
  9. </view>
  10. <!-- 在这里放置可滚动的内容 -->
  11. <view style="width: 100%;" v-if="list.length > 0">
  12. <view class="card_dinay" v-for="(item,index) in list" :key="index">
  13. <view style="display: flex;align-items: center;">
  14. <view class="item_current">{{index + 1}}</view>
  15. <view class="item_title1">{{item.inner_code}}</view>
  16. </view>
  17. <view class="iconfont icon-yehuaqiping icon_cylinder" :style="{color:getColor()}"></view>
  18. </view>
  19. <view style="width: 100%;height: 150rpx;"></view>
  20. </view>
  21. <view class="empty_information" v-else>
  22. <u-empty mode="list" text="暂无钢瓶"></u-empty>
  23. </view>
  24. <view class="card_button_bottom">
  25. <view class="bottom_btn_flex">
  26. <view class="but_allot center_in" @click="addCylinder">添加</view>
  27. </view>
  28. <view class="bottom_btn_flex">
  29. <view class="but_allot center_in" @click="transferCylinders">调拨</view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. list: [],
  39. bottleList: [{
  40. name: '重瓶区',
  41. }, {
  42. name: '空瓶区',
  43. }, {
  44. name: '不合格瓶区'
  45. }],
  46. current: 1,
  47. Pagination: {
  48. PageIndex: 1,
  49. PageSize: 20,
  50. Total: 0,
  51. },
  52. loadingMore: true,
  53. }
  54. },
  55. mounted() {
  56. uni.$on('refresh', () => {
  57. this.list = []
  58. this.Pagination.PageIndex = 1
  59. this.getList()
  60. })
  61. this.getList()
  62. },
  63. methods: {
  64. // 触底事件
  65. bottomingEvent() {
  66. if (!this.loadingMore) {
  67. this.getList()
  68. }
  69. },
  70. bottleClick(value) {
  71. this.current = value.index + 1
  72. this.Pagination.PageIndex = 1
  73. this.list = []
  74. this.getList()
  75. },
  76. // 获取列表
  77. getList() {
  78. this.loadingMore = true;
  79. this.$api.get('/api/gas-cylinder-status', {
  80. page: this.Pagination.PageIndex,
  81. pageSize: this.Pagination.PageSize,
  82. status: this.current,
  83. }).then(res => {
  84. if (res.code == 200) {
  85. const data = res.data.list
  86. if (this.loadingMore == true && data) {
  87. this.list = this.list.concat(data);
  88. }
  89. if (data.length < this.Pagination.PageSize) {
  90. this.loadingMore = true
  91. } else {
  92. this.loadingMore = false
  93. this.Pagination.PageIndex++
  94. }
  95. }
  96. })
  97. },
  98. getColor() {
  99. if (this.current == 1) {
  100. return '#19be6b'
  101. } else if (this.current == 2) {
  102. return '#ff9900'
  103. } else if (this.current == 3) {
  104. return '#fa3534'
  105. }
  106. },
  107. // 添加钢瓶
  108. addCylinder() {
  109. uni.navigateTo({
  110. url: '/pages/information/cylinder?status=' + this.current
  111. });
  112. },
  113. // 调拨钢瓶
  114. transferCylinders() {
  115. uni.navigateTo({
  116. url: '/pages/information/transfer?status=' + this.current
  117. });
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="scss" scoped>
  123. .head_mine_title {
  124. display: flex;
  125. align-items: center;
  126. justify-content: center;
  127. padding-top: 20rpx;
  128. font-size: 36rpx;
  129. font-weight: 600;
  130. }
  131. .head_sticky {
  132. position: -webkit-sticky;
  133. position: sticky;
  134. top: 0;
  135. /* 设置吸顶的位置 */
  136. background: #fff;
  137. z-index: 1000;
  138. padding-top: var(--status-bar-height);
  139. }
  140. .card_dinay {
  141. display: flex;
  142. align-items: center;
  143. justify-content: space-between;
  144. width: calc(100% - 40rpx);
  145. margin-top: 20rpx;
  146. border-bottom: 1rpx solid #d7d7d7;
  147. padding: 30rpx 20rpx;
  148. }
  149. .item_current {
  150. min-width: 40rpx;
  151. color: #82848a;
  152. }
  153. .item_title1 {
  154. margin-left: 10rpx;
  155. }
  156. .icon_cylinder {
  157. font-size: 50rpx;
  158. }
  159. .card_button_bottom {
  160. position: fixed;
  161. bottom: 20rpx;
  162. left: 0;
  163. right: 0;
  164. background-color: #fff;
  165. height: 120rpx;
  166. margin-bottom: 80rpx;
  167. padding-bottom: constant(safe-area-inset-bottom); //兼容 IOS<11.2
  168. padding-bottom: env(safe-area-inset-bottom); //兼容 IOS>11.2
  169. display: flex;
  170. align-items: flex-start;
  171. }
  172. .bottom_btn_flex {
  173. margin-top: 20rpx;
  174. flex: 1;
  175. display: flex;
  176. align-items: center;
  177. justify-content: center;
  178. }
  179. .but_allot {
  180. width: 80%;
  181. background-color: #3C9CFE;
  182. padding: 20rpx;
  183. color: #fff;
  184. border-radius: 10rpx;
  185. }
  186. .empty_information {
  187. margin-top: 30%;
  188. }
  189. </style>