iceRaft.vue 6.0 KB

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