|
@@ -1,16 +1,19 @@
|
|
|
<template>
|
|
|
<view class='container uni-column'>
|
|
|
<view class='nav uni-row'>
|
|
|
- <text :class='pendingClass' @click='selectPending'>待周转</text>
|
|
|
- <text :class='turnoverClass' @click='selectTurnover'>周转中</text>
|
|
|
+ <view v-for="(item,index) in statusList" :key="index" :class="{'selecter':singleSelectd(item)}">
|
|
|
+ <!-- <text :class='pendingClass' @click='selectPending'>带周转</text>
|
|
|
+ <text :class='turnoverClass' @click='selectTurnover'>周转中</text> -->
|
|
|
<!-- <image class='img' src="../../static/screen.png"></image> -->
|
|
|
+ <text @click='selectedStatus(item)'> {{item['name']}}</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<!-- 待周转页面 -->
|
|
|
- <view class="padding-container" v-if='pendingShow'>
|
|
|
+ <view class="padding-container" v-if='selectedInfo.id == 4'>
|
|
|
<view class="scroll-container" >
|
|
|
<view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
|
|
|
<text>暂无待周转批次</text>
|
|
|
- </view>
|
|
|
+ </view>
|
|
|
<view v-else v-for="(item, index) in listData" :key="index"
|
|
|
:class="{'list-item':true,'selected':isSelected(item)}">
|
|
|
<!-- @click="handleSelection(item)" -->
|
|
@@ -55,7 +58,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 周转中页面 -->
|
|
|
- <view class='turnover-container' v-if='turnoverShow'>
|
|
|
+ <view class='turnover-container' v-if='selectedInfo.id == 5'>
|
|
|
<view class="scroll-container" >
|
|
|
<view v-if="lotList.length == 0" style="color: #999;margin: 50% auto;">
|
|
|
<text>暂无周转中批次</text>
|
|
@@ -99,12 +102,97 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <view class='bottom-btn-container uni-row' >
|
|
|
+ <button type='primary' class='bottom-btn' @click="handleConfirmDelivery" >确认送达</button>
|
|
|
+ <button type='primary' class='bottom-btn' @click="handleBackturnover" style="margin-left: 24rpx;" >退回上一级</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <!-- 已送达页面 -->
|
|
|
+ <view class='turnover-container' v-if='selectedInfo.id == 6'>
|
|
|
+ <view class="scroll-container" >
|
|
|
+ <view v-if="deliveredList.length == 0" style="color: #999;margin: 50% auto;">
|
|
|
+ <text>暂无已送达批次</text>
|
|
|
+ </view>
|
|
|
+ <!-- 循环已送达的数据 -->
|
|
|
+ <view v-else class='item-container'>
|
|
|
+ <view :class="{'list-container':true,'selected':isSelected(item)}" v-for="(item,index) in deliveredList"
|
|
|
+ @click="handleSelection(item)" :key='index'>
|
|
|
+ <view class="turnover-title uni-row">
|
|
|
+ <view class="uni-row" style="align-items: center;">
|
|
|
+ <view><text class='title-color'>{{ item[0]['totalCarrier'] }}箱</text></view>
|
|
|
+ <view><text class="second-info">{{item[0].preDeptName + '→' + item[0].deptName }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view v-for="(lot,index) in item" :key="index" style="margin-bottom: 10rpx;">
|
|
|
+ <view class="list-container-item product-description uni-row">
|
|
|
+ <text class="label left-value">产品描述</text>
|
|
|
+ <text class="label right-value">{{lot['productDescription']}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="list-container-item uni-row">
|
|
|
+ <text class="label left-value">批次</text>
|
|
|
+ <text class="label right-value">{{lot['lotCode']}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="list-container-item uni-row">
|
|
|
+ <text class="label left-value">箱数</text>
|
|
|
+ <text class="label right-value">{{lot['carrierName'].split('、').length}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="list-container-item uni-row">
|
|
|
+ <text class="label left-value">箱号</text>
|
|
|
+ <text class="label right-value">{{lot['carrierName']}}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class='bottom-btn-container uni-row'>
|
|
|
+ <button type='primary' class='bottom-btn' @click="handleConfirmDelivery">确认送达</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <!-- 已接收页面 -->
|
|
|
+ <view class='turnover-container' v-if='selectedInfo.id == 7'>
|
|
|
+ <view class="scroll-container" >
|
|
|
+ <view v-if="receivedList.length == 0" style="color: #999;margin: 50% auto;">
|
|
|
+ <text>暂无已接收批次</text>
|
|
|
+ </view>
|
|
|
+ <!-- 循环已接收的数据 -->
|
|
|
+ <view v-else class='item-container'>
|
|
|
+ <view :class="{'list-container':true,'selected':isSelected(item)}" v-for="(item,index) in receivedList"
|
|
|
+ @click="handleSelection(item)" :key='index'>
|
|
|
+ <view class="turnover-title uni-row">
|
|
|
+ <view class="uni-row" style="align-items: center;">
|
|
|
+ <view><text class='title-color'>{{ item[0]['totalCarrier'] }}箱</text></view>
|
|
|
+ <view><text class="second-info">{{item[0].preDeptName + '→' + item[0].deptName }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view v-for="(lot,index) in item" :key="index" style="margin-bottom: 10rpx;">
|
|
|
+ <view class="list-container-item product-description uni-row">
|
|
|
+ <text class="label left-value">产品描述</text>
|
|
|
+ <text class="label right-value">{{lot['productDescription']}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="list-container-item uni-row">
|
|
|
+ <text class="label left-value">批次</text>
|
|
|
+ <text class="label right-value">{{lot['lotCode']}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="list-container-item uni-row">
|
|
|
+ <text class="label left-value">箱数</text>
|
|
|
+ <text class="label right-value">{{ lot['carrierName'] ? lot['carrierName'].split('、').length : 0 }}</text>
|
|
|
+ </view>
|
|
|
+ <view class="list-container-item uni-row">
|
|
|
+ <text class="label left-value">箱号</text>
|
|
|
+ <text class="label right-value">{{lot['carrierName']}}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<view class='bottom-btn-container uni-row'>
|
|
|
<button type='primary' class='bottom-btn' @click="handleConfirmDelivery">确认送达</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <dialog-confirm ref="confirm" @submit="handleConfirmUnbind" @reflush="reflush"></dialog-confirm>
|
|
|
+ <dialog-confirm ref="confirm" @submit="handleConfirmUnbind" @backTurnover="handleConfirmBack" @reflush="reflush"></dialog-confirm>
|
|
|
<dialog-turnoverTask ref="turnoverTask"></dialog-turnoverTask>
|
|
|
</template>
|
|
|
|
|
@@ -138,6 +226,7 @@
|
|
|
selecter: false
|
|
|
})
|
|
|
const selection = ref([])
|
|
|
+ const selectedInfo = ref({})
|
|
|
const pendingShow = ref(true)
|
|
|
const turnoverShow = ref(false)
|
|
|
const listData = ref([])
|
|
@@ -145,15 +234,25 @@
|
|
|
const confirm = ref(null) // 弹窗组件
|
|
|
const turnoverTask = ref(null) // 弹窗组件
|
|
|
const lotList = ref([])
|
|
|
+ const deliveredList = ref([])
|
|
|
+ const receivedList = ref([])
|
|
|
+ const statusList = ref([
|
|
|
+ {"id": 4,"name": "待周转"},
|
|
|
+ {"id": 5,"name": "周转中"},
|
|
|
+ {"id": 6,"name": "已送达"},
|
|
|
+ {"id": 7,"name": "已接收"}
|
|
|
+ ])
|
|
|
|
|
|
onLoad(() => {
|
|
|
uni.$once('confirmDelivery', function() {
|
|
|
init();
|
|
|
})
|
|
|
init()
|
|
|
+ selectedInfo.value = statusList.value[0]
|
|
|
})
|
|
|
|
|
|
function init() {
|
|
|
+ //待周转
|
|
|
getItemList({
|
|
|
status: 4
|
|
|
}).then(res => {
|
|
@@ -166,6 +265,7 @@
|
|
|
console.log(res)
|
|
|
}
|
|
|
})
|
|
|
+ //周转中
|
|
|
getItemList({
|
|
|
status: 5
|
|
|
}).then(res => {
|
|
@@ -193,6 +293,66 @@
|
|
|
console.log(lotList.value)
|
|
|
}
|
|
|
})
|
|
|
+ //已送达
|
|
|
+ getItemList({
|
|
|
+ status: 6
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ // 通过dayworkId再分组
|
|
|
+ const groupedRows = res.rows.reduce((acc, item) => {
|
|
|
+ const dept = item.deptId;
|
|
|
+ if (acc.hasOwnProperty(dept)) {
|
|
|
+ acc[dept].push(item);
|
|
|
+ } else {
|
|
|
+ acc[dept] = [item];
|
|
|
+ }
|
|
|
+ return acc;
|
|
|
+ }, {});
|
|
|
+ // groupedRows 是一个对象,其键是dayworkId,值是具有相同dayworkId的对象数组
|
|
|
+ // 如果需要将它转换为二维数组,您可以使用 Object.values 方法
|
|
|
+ deliveredList.value = Object.values(groupedRows);
|
|
|
+ // 设置箱数
|
|
|
+ for (let i = 0; i < deliveredList.value.length; i++) {
|
|
|
+ deliveredList.value[i][0].totalCarrier = 0;
|
|
|
+ for (let j = 0; j < deliveredList.value[i].length; j++) {
|
|
|
+ deliveredList.value[i][0].totalCarrier += deliveredList.value[i][j].carrierName.split('、').length;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ //已接收
|
|
|
+ getItemList({
|
|
|
+ status: 7
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ // 通过dayworkId再分组
|
|
|
+ const groupedRows = res.rows.reduce((acc, item) => {
|
|
|
+ const dept = item.deptId;
|
|
|
+ if (acc.hasOwnProperty(dept)) {
|
|
|
+ acc[dept].push(item);
|
|
|
+ } else {
|
|
|
+ acc[dept] = [item];
|
|
|
+ }
|
|
|
+ return acc;
|
|
|
+ }, {});
|
|
|
+ // groupedRows 是一个对象,其键是dayworkId,值是具有相同dayworkId的对象数组
|
|
|
+ // 如果需要将它转换为二维数组,您可以使用 Object.values 方法
|
|
|
+ receivedList.value = Object.values(groupedRows);
|
|
|
+ // 设置箱数
|
|
|
+ for (let i = 0; i < receivedList.value.length; i++) {
|
|
|
+ receivedList.value[i][0].totalCarrier = 0;
|
|
|
+ for (let j = 0; j < receivedList.value[i].length; j++) {
|
|
|
+ if (receivedList.value[i][j].carrierName) {
|
|
|
+ receivedList.value[i][0].totalCarrier += receivedList.value[i][j].carrierName.split('、').length;
|
|
|
+ } else {
|
|
|
+ receivedList.value[i][0].totalCarrier += 0;
|
|
|
+ }
|
|
|
+ // receivedList.value[i][0].totalCarrier += receivedList.value[i][j].carrierName.split('、').length;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(receivedList.value)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
function reflush() {
|
|
@@ -228,6 +388,12 @@
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
+ function handleBackturnover() {
|
|
|
+ if(selection.value.length>0) {
|
|
|
+ let msg ='是否返回待周转?'
|
|
|
+ confirm.value.open(msg);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
function handleDoTurn() {
|
|
|
// 设置周转状态
|
|
@@ -253,6 +419,32 @@
|
|
|
// 清空选中数组
|
|
|
selection.value = [];
|
|
|
}
|
|
|
+ //回退状态
|
|
|
+ function handleConfirmBack() {
|
|
|
+ // 设置周转状态
|
|
|
+ for (let i = 0; i < selection.value.length; i++) {
|
|
|
+ selection.value[i].status = '4';
|
|
|
+ }
|
|
|
+ // updateBackDayWorkItemBatch(selection.value).then(res => {
|
|
|
+ // if (res.code === 200) {
|
|
|
+ // uni.showToast({
|
|
|
+ // icon: 'success',
|
|
|
+ // title: '操作成功',
|
|
|
+ // duration: 2000
|
|
|
+ // });
|
|
|
+ // reflush();
|
|
|
+ // } else {
|
|
|
+ // uni.showToast({
|
|
|
+ // icon: 'error',
|
|
|
+ // title: '操作失败',
|
|
|
+ // duration: 2000
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // // 清空选中数组
|
|
|
+ // selection.value = [];
|
|
|
+ console.log(selection.value)
|
|
|
+ }
|
|
|
|
|
|
function isSelected(item) {
|
|
|
//单选
|
|
@@ -293,6 +485,13 @@
|
|
|
pendingShow.value = false;
|
|
|
turnoverShow.value = true;
|
|
|
}
|
|
|
+ function selectedStatus(item) {
|
|
|
+ console.log(item)
|
|
|
+ selectedInfo.value = item
|
|
|
+ }
|
|
|
+ function singleSelectd(item) {
|
|
|
+ return selectedInfo.value == item
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|