iceRaft.vue 6.8 KB

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