iceRaft.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <!-- 冰排管理、 -->
  3. <view>
  4. <u-navbar autoBack placeholder @rightClick="rightClick">
  5. <view class="u-nav-slot" slot="right">
  6. <u-icon name="plus-circle" size="20"></u-icon>
  7. <span>添加</span>
  8. </view>
  9. </u-navbar>
  10. <u-sticky :customNavHeight="navbarHeight()">
  11. <view class="search_card">
  12. <u-search :showAction="false" v-model="keyword" @change="searchChange"
  13. placeholder="输入关键字快速查找"></u-search>
  14. </view>
  15. </u-sticky>
  16. <view class="card_incubator" v-if="orderList.length > 0">
  17. <view class="item_bator" v-for="(item,index) in orderList" :key="index">
  18. <span class="iconfont imagebwx icon-bingpaiguanli"></span>
  19. <view style="width: 100%;">
  20. <view class="space_between">
  21. <view class="title_ice">{{item.code}}</view>
  22. <view :style="{color:geticeColor(item.status)}">{{geticeState(item.status)}}</view>
  23. </view>
  24. <view class="space_between">
  25. <view class="title_ice1">冷冻要求:{{item.freezeClaim}}</view>
  26. <view class="card_btn_emit center_in" @click="selectIncubator(item)">
  27. 编辑<u-icon name="edit-pen" size="26"></u-icon>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view style="width: 100%;">
  33. <u-loadmore lineColor="#ffffff" :status="loadStatus" :key="Math.random()" />
  34. </view>
  35. </view>
  36. <view style="margin-top: 20%;" v-else>
  37. <u-empty mode="list" text="暂无冰排"></u-empty>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. keyword: '',
  46. currentPage: 1,
  47. pageSize: 10,
  48. loadingMore: true,
  49. loadStatus: 'loadmore', //loading 、nomore
  50. incubatorValue: '',
  51. orderList: [],
  52. detailsFlag: false,
  53. }
  54. },
  55. onReachBottom() {
  56. if (!this.loadingMore) {
  57. this.getIncubator()
  58. }
  59. },
  60. mounted() {
  61. this.getIncubator()
  62. },
  63. methods: {
  64. rightClick() {
  65. uni.navigateTo({
  66. url: '/pages/order/addIceRaft'
  67. });
  68. },
  69. // 搜索
  70. searchChange(value) {
  71. this.currentPage = 1
  72. this.orderList = []
  73. this.loadingMore = true
  74. this.getIncubator()
  75. },
  76. // 获取冰排
  77. getIncubator() {
  78. this.loadStatus = 'loading'
  79. this.loadingMore = true
  80. this.$api.get('/api/ice-raft', {
  81. page: this.currentPage,
  82. pageSize: this.pageSize,
  83. code: this.keyword,
  84. }).then(res => {
  85. if (res.code == 200) {
  86. const data = res.data.list
  87. if (this.loadingMore == true && data) {
  88. this.orderList = this.orderList.concat(data);
  89. }
  90. if (data.length < this.pageSize) {
  91. this.loadingMore = true
  92. this.loading = '没有更多了'
  93. this.loadStatus = 'nomore'
  94. } else {
  95. this.loading = '加载中'
  96. this.loadStatus = 'loading'
  97. this.loadingMore = false
  98. this.currentPage++
  99. }
  100. }
  101. })
  102. },
  103. // 选择冰排
  104. selectIncubator(value) {
  105. let arr = {
  106. id: value.id,
  107. code: value.code,
  108. status: value.status,
  109. freezeClaim: value.freezeClaim,
  110. }
  111. uni.navigateTo({
  112. url: '/pages/order/addIceRaft?list=' + JSON.stringify(arr)
  113. });
  114. console.log(value, '详情')
  115. },
  116. geticeState(event) {
  117. let title = ''
  118. if (event == '2') {
  119. title = '正常'
  120. } else {
  121. title = '停用'
  122. }
  123. return title
  124. },
  125. geticeColor(event) {
  126. let color = ''
  127. if (event == '2') {
  128. color = '#19be6b'
  129. } else {
  130. color = '#fa3534'
  131. }
  132. return color
  133. },
  134. navbarHeight() {
  135. let systemInfo = uni.getSystemInfoSync();
  136. /* (750 / systemInfo.windowWidth) */
  137. /* 在uview navBar组件中有一个默认高度,当这个默认高度加上状态栏高度后就是吸顶的位置,由于这两者相加是px,所以最后还需要转为rpx */
  138. let topHeight = 0
  139. // #ifdef APP-PLUS
  140. topHeight = 44 + systemInfo.statusBarHeight;
  141. // #endif
  142. // #ifdef MP
  143. let height = systemInfo.platform == 'ios' ? 44 : 48;
  144. topHeight = height + systemInfo.statusBarHeight
  145. // #endif
  146. /* 最后一步将px转为rpx */
  147. return topHeight * (750 / systemInfo.windowWidth) / 2
  148. },
  149. },
  150. }
  151. </script>
  152. <style lang="scss" scoped>
  153. .card_incubator {
  154. display: flex;
  155. flex-direction: column;
  156. margin-top: 10rpx;
  157. }
  158. .search_card {
  159. background-color: #fff;
  160. padding: 20rpx;
  161. }
  162. .item_bator {
  163. display: flex;
  164. align-items: center;
  165. background-color: #fff;
  166. border-radius: 10rpx;
  167. padding: 30rpx;
  168. margin: 10rpx 20rpx;
  169. }
  170. .imagebwx {
  171. color: #19be6b;
  172. font-size: 80rpx;
  173. margin-right: 20rpx;
  174. }
  175. .title_ice {
  176. font-size: 32rpx;
  177. }
  178. .title_ice1 {
  179. font-size: 30rpx;
  180. }
  181. .space_between {
  182. display: flex;
  183. justify-content: space-between;
  184. align-items: center;
  185. width: 100%;
  186. }
  187. .u-nav-slot {
  188. display: flex;
  189. align-items: center;
  190. span {
  191. font-size: 32rpx;
  192. margin-left: 5rpx;
  193. }
  194. }
  195. .card_btn_emit {
  196. margin-top: 4rpx;
  197. display: flex;
  198. justify-content: flex-end;
  199. width: 150rpx;
  200. color: #606266;
  201. font-size: 30rpx;
  202. border-radius: 40rpx;
  203. }
  204. </style>