iceRaft.vue 6.4 KB

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