index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <!-- 我的钢瓶 -->
  3. <view class="card_information">
  4. <view class="head_mine_title">我的钢瓶</view>
  5. <view style="width: 100%;">
  6. <u-tabs :list="bottleList" lineWidth="40" :scrollable="false" @click="bottleClick"></u-tabs>
  7. </view>
  8. <view style="width: 100%;" v-if="list.length > 0">
  9. <view class="card_dinay" v-for="(item,index) in list" :key="index">
  10. <view style="display: flex;align-items: center;">
  11. <view class="item_current">{{index + 1}}</view>
  12. <view class="item_title1">{{item.inner_code}}</view>
  13. </view>
  14. <view class="iconfont icon-yehuaqiping icon_cylinder"></view>
  15. </view>
  16. </view>
  17. <view class="empty_information" v-else>
  18. <u-empty mode="message"></u-empty>
  19. </view>
  20. <view class="card_button_bottom">
  21. <view class="bottom_btn_flex">
  22. <view class="but_allot center_in" @click="addCylinder">添加</view>
  23. </view>
  24. <view class="bottom_btn_flex">
  25. <view class="but_allot center_in" @click="transferCylinders">调拨</view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. data() {
  33. return {
  34. list: [],
  35. bottleList: [{
  36. name: '重瓶区',
  37. }, {
  38. name: '空瓶区',
  39. }, {
  40. name: '不合格瓶区'
  41. }],
  42. current: 1,
  43. }
  44. },
  45. mounted() {
  46. uni.$on('refresh', () => {
  47. this.getList()
  48. })
  49. this.getList()
  50. },
  51. methods: {
  52. bottleClick(value) {
  53. this.current = value.index + 1
  54. this.list = []
  55. this.getList()
  56. },
  57. // 获取列表
  58. getList() {
  59. this.$api.get('/api/gas-cylinder-status', {
  60. status: this.current,
  61. }).then(res => {
  62. if (res.code == 200) {
  63. this.list = res.data.list
  64. }
  65. })
  66. },
  67. // 添加钢瓶
  68. addCylinder() {
  69. uni.navigateTo({
  70. url: '/pages/information/cylinder?status=' + this.current
  71. });
  72. },
  73. // 调拨钢瓶
  74. transferCylinders() {
  75. uni.navigateTo({
  76. url: '/pages/information/transfer?status=' + this.current
  77. });
  78. }
  79. }
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. .head_mine_title {
  84. margin: 20rpx;
  85. }
  86. .card_information {
  87. padding-top: var(--status-bar-height);
  88. margin: 0rpx 20rpx;
  89. display: flex;
  90. flex-direction: column;
  91. align-items: center;
  92. }
  93. .card_dinay {
  94. display: flex;
  95. align-items: center;
  96. justify-content: space-between;
  97. width: calc(100% - 40rpx);
  98. margin-top: 20rpx;
  99. border-bottom: 1rpx solid #d7d7d7;
  100. padding: 30rpx 20rpx;
  101. }
  102. .item_current {
  103. width: 40rpx;
  104. color: #82848a;
  105. }
  106. .item_title1 {
  107. margin-left: 10rpx;
  108. }
  109. .icon_cylinder {
  110. font-size: 50rpx;
  111. }
  112. .card_button_bottom {
  113. position: absolute;
  114. bottom: 20rpx;
  115. left: 0;
  116. right: 0;
  117. background-color: #fff;
  118. margin-bottom: 100rpx;
  119. padding-bottom: constant(safe-area-inset-bottom); //兼容 IOS<11.2
  120. padding-bottom: env(safe-area-inset-bottom); //兼容 IOS>11.2
  121. display: flex;
  122. align-items: center;
  123. }
  124. .bottom_btn_flex {
  125. flex: 1;
  126. display: flex;
  127. align-items: center;
  128. justify-content: center;
  129. }
  130. .but_allot {
  131. width: 80%;
  132. background-color: #3C9CFE;
  133. padding: 20rpx;
  134. color: #fff;
  135. border-radius: 10rpx;
  136. }
  137. </style>