|
@@ -0,0 +1,443 @@
|
|
|
+<template>
|
|
|
+ <!-- 冷冻柜冰排 -->
|
|
|
+ <view>
|
|
|
+ <u-navbar :title="headline" autoBack placeholder></u-navbar>
|
|
|
+ <u-sticky :customNavHeight="navbarHeight()">
|
|
|
+ <view class="search_card">
|
|
|
+ <u-search :showAction="false" v-model="keyword" @change="searchChange"
|
|
|
+ placeholder="请输入冰排编号查找"></u-search>
|
|
|
+ <view style="margin-left: 10rpx;" @click="sweep">
|
|
|
+ <u-icon name="scan" color="#606266" size="35"></u-icon>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="card_tab_freezer">
|
|
|
+ <view :style="{width:isIceInfo.isIceReleaseCold ? '50%':'100%'}">
|
|
|
+ <u-subsection :list="iceStateList" :current="current" @change="sectionChange"></u-subsection>
|
|
|
+ </view>
|
|
|
+ <view class="select_freezer" v-if="isIceInfo.isIceReleaseCold">
|
|
|
+ <view style="display: flex;align-items: center;margin-right: 10rpx;">
|
|
|
+ <view class="title_num blue_color">总数:{{Total}}</view>
|
|
|
+ <view class="title_num green_color">已选:{{selectedList.length}}</view>
|
|
|
+ </view>
|
|
|
+ <view style="display: flex;align-items: center;">
|
|
|
+ <view class="select_title blue_color" @click="checkAll">全选</view>
|
|
|
+ <view class="select_title orange_color" @click="Inverse">反选</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </u-sticky>
|
|
|
+ <view style="display: flex;flex-direction: column;" v-if="list.length > 0">
|
|
|
+ <view class="card_item_iceraft" v-for="(item,index) in list" :key="index" @click="choiceIce(item)">
|
|
|
+ <view class="top_title space_between">
|
|
|
+ <view class="title_Icecode">编号: {{item.code}}</view>
|
|
|
+ <view :style="{color: filterColor(item.iceRaftRecord.status)}">
|
|
|
+ {{matchingType(item.iceRaftRecord.status)}}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="title_itemIce">冰排备注:{{item.label}}</view>
|
|
|
+ <view class="title_itemIce" v-if="item.iceRaftRecord.inStorageTime">入库时间:
|
|
|
+ {{item.iceRaftRecord.inStorageTime}}
|
|
|
+ </view>
|
|
|
+ <view class="title_itemIce" v-if="item.iceRaftRecord.outStorageTime">出库时间:
|
|
|
+ {{item.iceRaftRecord.outStorageTime}}
|
|
|
+ </view>
|
|
|
+ <view class="title_itemIce"
|
|
|
+ v-if="item.iceRaftRecord.outStorageTime == '' && item.iceRaftRecord.iceLocker.name">所在位置:
|
|
|
+ {{item.iceRaftRecord.iceLocker.name}}
|
|
|
+ </view>
|
|
|
+ <view class="title_itemIce"
|
|
|
+ v-else-if="item.iceRaftRecord.outStorageTime != '' && item.iceRaftRecord.coolerBox.name">所在位置:
|
|
|
+ {{item.iceRaftRecord.coolerBox.name}}
|
|
|
+ </view>
|
|
|
+ <view class="title_itemIce" v-if="item.iceRaftRecord.status != ''">冷冻要求:
|
|
|
+ <span>≥{{item.iceRaftRecord.freezeClaim}}h</span>
|
|
|
+ </view>
|
|
|
+ <view class="title_itemIce" v-if="item.iceRaftRecord.status != ''">冷冻时间:
|
|
|
+ <span>{{formatMinutes(item.iceRaftRecord.freezeDuration)}}</span>
|
|
|
+ </view>
|
|
|
+ <view class="position-triangle" v-if="item.whetherFlag">
|
|
|
+ <span>已选</span>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view style="width: 100%;">
|
|
|
+ <u-loadmore lineColor="#ffffff" :status="loadStatus" :key="Math.random()" />
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view style="margin-top: 20%;" v-else>
|
|
|
+ <u-empty mode="list" text="暂无冰排信息"></u-empty>
|
|
|
+ </view>
|
|
|
+ <view style="width: 100%;height: 120rpx;" class="env_padding" v-if="isIceInfo.isIceReleaseCold"></view>
|
|
|
+ <view class="card_btn_freezer" v-if="isIceInfo.isIceReleaseCold">
|
|
|
+ <u-button style="margin-bottom: 20rpx;" type="primary" @click="coolingRelease">出库释冷</u-button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ headline: '',
|
|
|
+ list: [],
|
|
|
+ typeList: [{
|
|
|
+ bgcolor: '#fa3534',
|
|
|
+ label: '冷冻中',
|
|
|
+ value: '1',
|
|
|
+ }, {
|
|
|
+ bgcolor: '#67C23A',
|
|
|
+ label: '待使用',
|
|
|
+ value: '2',
|
|
|
+ }],
|
|
|
+ iceState: null,
|
|
|
+ iceStateList: ['全部', '冷冻中', '待使用'],
|
|
|
+ current: 0,
|
|
|
+ PageIndex: 1,
|
|
|
+ PageSize: 15,
|
|
|
+ loadStatus: 'loadmore', //loading 、nomore
|
|
|
+ loadingMore: true,
|
|
|
+ keyword: '',
|
|
|
+ freezerId: null,
|
|
|
+ Total: 0,
|
|
|
+ selectedNum: 0,
|
|
|
+ selectedList: [],
|
|
|
+ isIceInfo: {},
|
|
|
+ searchShow: true,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onReachBottom() {
|
|
|
+ if (!this.loadingMore) {
|
|
|
+ this.getIceraftList()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad(option) {
|
|
|
+ this.headline = option.name
|
|
|
+ this.freezerId = option.freezerId
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ var userInfo = this.$cache.getCache('userInfo')
|
|
|
+ this.isIceInfo = userInfo.dept
|
|
|
+ this.getIceraftList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 搜索
|
|
|
+ searchChange(value) {
|
|
|
+ var that = this
|
|
|
+ if (that.searchShow) {
|
|
|
+ that.searchShow = false
|
|
|
+ const timer = setTimeout(function() {
|
|
|
+ clearTimeout(timer);
|
|
|
+ that.PageIndex = 1
|
|
|
+ that.list = []
|
|
|
+ that.loadingMore = true
|
|
|
+ that.getIceraftList()
|
|
|
+ }, 300);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取冰排列表
|
|
|
+ getIceraftList() {
|
|
|
+ this.loadStatus = 'loading'
|
|
|
+ this.loadingMore = true
|
|
|
+ this.$api.get('/api/ice-locker/geticelocker', {
|
|
|
+ page: this.PageIndex,
|
|
|
+ pageSize: this.PageSize,
|
|
|
+ code: this.keyword,
|
|
|
+ status: this.iceState,
|
|
|
+ LockerId: this.freezerId,
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ const data = res.data.list
|
|
|
+ this.Total = res.data.count
|
|
|
+ if (this.loadingMore == true && data) {
|
|
|
+ this.list = this.list.concat(data);
|
|
|
+ }
|
|
|
+ this.getRecord()
|
|
|
+ if (data.length < this.PageSize) {
|
|
|
+ this.loadingMore = true
|
|
|
+ this.loadStatus = 'nomore'
|
|
|
+ } else {
|
|
|
+ this.loadStatus = 'loading'
|
|
|
+ this.loadingMore = false
|
|
|
+ this.PageIndex++
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.searchShow = true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 判断冰排是否选择
|
|
|
+ getRecord() {
|
|
|
+ this.list.forEach(item => {
|
|
|
+ let index = this.selectedList.findIndex((event) => event === item.id);
|
|
|
+ if (index !== -1) {
|
|
|
+ item.whetherFlag = true
|
|
|
+ } else {
|
|
|
+ item.whetherFlag = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.$forceUpdate()
|
|
|
+ },
|
|
|
+ // 选择冰排
|
|
|
+ choiceIce(event) {
|
|
|
+ let index = this.selectedList.findIndex((item) => item === event.id);
|
|
|
+ // 如果有就替换,没有就添加
|
|
|
+ if (index !== -1) {
|
|
|
+ this.selectedList.splice(index, 1);
|
|
|
+ } else {
|
|
|
+ this.selectedList.push(event.id);
|
|
|
+ }
|
|
|
+ if (this.isIceInfo.isIceReleaseCold) {
|
|
|
+ this.getRecord()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 全选
|
|
|
+ checkAll() {
|
|
|
+ this.selectedList = []
|
|
|
+ for (let i = 0; i < this.list.length; i++) {
|
|
|
+ this.$set(this.list[i], 'whetherFlag', true)
|
|
|
+ }
|
|
|
+ this.list.forEach(item => {
|
|
|
+ if (item.whetherFlag) {
|
|
|
+ this.selectedList.push(item.id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.getRecord()
|
|
|
+ },
|
|
|
+ // 反选
|
|
|
+ Inverse() {
|
|
|
+ this.selectedList = []
|
|
|
+ for (let i = 0; i < this.list.length; i++) {
|
|
|
+ let flag = this.list[i].whetherFlag;
|
|
|
+ this.$set(this.list[i], 'whetherFlag', !flag)
|
|
|
+ }
|
|
|
+ this.list.forEach(item => {
|
|
|
+ if (item.whetherFlag) {
|
|
|
+ this.selectedList.push(item.id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.getRecord()
|
|
|
+ },
|
|
|
+ // 出库释冷
|
|
|
+ coolingRelease() {
|
|
|
+ if (this.selectedList.length > 0) {
|
|
|
+ let arrID = this.selectedList.map(item => item.toString())
|
|
|
+ this.$api.post('/api/ice-raft-record/start-for-cold', {
|
|
|
+ id: arrID,
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ uni.$u.toast('操作成功')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.$u.toast('请先选择释冷冰排')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ matchingType(type) {
|
|
|
+ let list = this.typeList
|
|
|
+ let name = ''
|
|
|
+ if (list) {
|
|
|
+ list.forEach(item => {
|
|
|
+ if (type === item.value) {
|
|
|
+ name = item.label
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return name
|
|
|
+ },
|
|
|
+ // tag颜色获取
|
|
|
+ filterColor(type) {
|
|
|
+ let list = this.typeList
|
|
|
+ let color = ''
|
|
|
+ if (list) {
|
|
|
+ list.forEach(item => {
|
|
|
+ if (type === item.value) {
|
|
|
+ color = item.bgcolor
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return color
|
|
|
+ },
|
|
|
+ // 总分钟格式化
|
|
|
+ formatMinutes(totalMinutes) {
|
|
|
+ const hours = Math.floor(totalMinutes / 60); // 计算小时
|
|
|
+ const minutes = totalMinutes % 60; // 计算分钟(余数)
|
|
|
+ return `${hours}h${minutes}m`;
|
|
|
+ },
|
|
|
+ // 扫一扫
|
|
|
+ sweep() {
|
|
|
+ // 允许从相机和相册扫码
|
|
|
+ uni.scanCode({
|
|
|
+ scanType: ['barCode'],
|
|
|
+ // scanType: ['qrCode'],
|
|
|
+ autoZoom: false,
|
|
|
+ success: (res) => {
|
|
|
+ // console.log(res);
|
|
|
+ if (res.result) {
|
|
|
+ let url = res.result;
|
|
|
+ this.keyword = url
|
|
|
+ } else {
|
|
|
+ console.log('请重新扫描');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: (res) => {
|
|
|
+ console.log('未识别到二维码');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ sectionChange(index) {
|
|
|
+ this.current = index
|
|
|
+ if (index == 0) {
|
|
|
+ this.iceState = null
|
|
|
+ } else {
|
|
|
+ this.iceState = String(index)
|
|
|
+ }
|
|
|
+ this.searchChange()
|
|
|
+ },
|
|
|
+ navbarHeight() {
|
|
|
+ let systemInfo = uni.getSystemInfoSync();
|
|
|
+ /* (750 / systemInfo.windowWidth) */
|
|
|
+ /* 在uview navBar组件中有一个默认高度,当这个默认高度加上状态栏高度后就是吸顶的位置,由于这两者相加是px,所以最后还需要转为rpx */
|
|
|
+ let topHeight = 0
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ topHeight = 44 + systemInfo.statusBarHeight;
|
|
|
+ // #endif
|
|
|
+ // #ifdef MP
|
|
|
+ let height = systemInfo.platform == 'ios' ? 44 : 48;
|
|
|
+ topHeight = height + systemInfo.statusBarHeight
|
|
|
+ // #endif
|
|
|
+ /* 最后一步将px转为rpx */
|
|
|
+ return topHeight * (750 / systemInfo.windowWidth) / 2
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+ .search_card {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ background-color: #fff;
|
|
|
+ padding: 20rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .card_tab_freezer {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 0rpx 20rpx 20rpx 20rpx;
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
+
|
|
|
+ .select_freezer {
|
|
|
+ display: flex;
|
|
|
+ align-items: flex-end;
|
|
|
+ // flex-direction: column;
|
|
|
+ }
|
|
|
+
|
|
|
+ .title_num {
|
|
|
+ font-size: 26rpx;
|
|
|
+ margin-left: 10rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .select_title {
|
|
|
+ font-size: 30rpx;
|
|
|
+ margin-left: 15rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .blue_color {
|
|
|
+ color: #2979ff;
|
|
|
+ }
|
|
|
+
|
|
|
+ .green_color {
|
|
|
+ color: #19be6b;
|
|
|
+ }
|
|
|
+
|
|
|
+ .orange_color {
|
|
|
+ color: #ff9900;
|
|
|
+ }
|
|
|
+
|
|
|
+ .card_item_iceraft {
|
|
|
+ position: relative;
|
|
|
+ padding: 20rpx;
|
|
|
+ margin: 20rpx;
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+
|
|
|
+ .position-triangle {
|
|
|
+ position: absolute;
|
|
|
+ bottom: 0;
|
|
|
+ right: 0;
|
|
|
+ overflow: hidden;
|
|
|
+ height: 35px;
|
|
|
+ width: 35px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .position-triangle span {
|
|
|
+ position: absolute;
|
|
|
+ font-size: 20rpx;
|
|
|
+ bottom: 8rpx;
|
|
|
+ right: 3rpx;
|
|
|
+ z-index: 1;
|
|
|
+ color: #fff;
|
|
|
+ transform: rotate(-45deg);
|
|
|
+ }
|
|
|
+
|
|
|
+ .position-triangle::after {
|
|
|
+ content: "";
|
|
|
+ font-size: 20rpx;
|
|
|
+ position: absolute;
|
|
|
+ width: 70px;
|
|
|
+ height: 70px;
|
|
|
+ background-color: #19be6b;
|
|
|
+ transform: rotate(45deg);
|
|
|
+ transform-origin: center;
|
|
|
+ top: 50%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .top_title {
|
|
|
+ display: flex;
|
|
|
+ }
|
|
|
+
|
|
|
+ .title_Icecode {
|
|
|
+ color: #000000;
|
|
|
+ font-size: 32rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .title_itemIce {
|
|
|
+ color: #000000;
|
|
|
+ font-size: 30rpx;
|
|
|
+ margin-top: 10rpx;
|
|
|
+
|
|
|
+ span {
|
|
|
+ color: #19be6b;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .card_input_fa {
|
|
|
+ margin: 20rpx;
|
|
|
+ padding: 12rpx 20rpx;
|
|
|
+ line-height: 48rpx;
|
|
|
+ border: 1rpx solid #e7e6e4;
|
|
|
+ border-radius: 40rpx;
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
+
|
|
|
+ .card_btn_freezer {
|
|
|
+ position: fixed;
|
|
|
+ z-index: 2;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ padding: 20rpx 30rpx 20rpx 30rpx;
|
|
|
+ background-color: #fff;
|
|
|
+ padding-bottom: constant(safe-area-inset-bottom); //兼容 IOS<11.2
|
|
|
+ padding-bottom: env(safe-area-inset-bottom); //兼容 IOS>11.2
|
|
|
+ border-top: 1rpx solid #E4E7ED;
|
|
|
+ }
|
|
|
+
|
|
|
+ .env_padding {
|
|
|
+ padding-bottom: constant(safe-area-inset-bottom); //兼容 IOS<11.2
|
|
|
+ padding-bottom: env(safe-area-inset-bottom); //兼容 IOS>11.2
|
|
|
+ }
|
|
|
+</style>
|