123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469 |
- <template>
- <view class='container uni-column'>
- <view class='nav uni-row'>
- <text :class='pendingClass' @click='selectPending'>{{pendingTitle}}</text>
- <text :class='turnoverClass' @click='selectTurnover'>{{turnoverTitle}}</text>
- <image class='img' src="../../static/screen.png"></image>
- </view>
- <!-- 待周转页面 -->
- <view class="padding-container" v-if='pendingShow'>
- <view class="scroll-container" scroll-y>
- <view v-for="(item, index) in listData" :key="index"
- :class="{'list-item':true,'selected':isSelected(item)}">
- <!-- @click="handleSelection(item)" -->
- <view class="title-container uni-row">
- <view class="title uni-row">
- <text class="label">{{ item['dictDataLabel'] }}</text>
- <text class="label code">{{ item['deptName'] }}</text>
- <text class="label code" style="margin-left: 16rpx;">→</text>
- <text class="label code" style="margin-left: 16rpx;">{{ item['deptName'] }}</text>
- </view>
- <view class="right-info uni-row">
- <view class="uni-row"><text class="label right">待周转</text></view>
- </view>
- </view>
- <view class="item-info uni-row"> <text class="label ">批次</text>
- <text class="label right">{{ item['lotCode'] }}</text>
- </view>
- <view class="item-info uni-row"> <text class="label">箱数</text>
- <text class="label right ">{{ item['carriers'] }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">数量</text>
- <text class="label right">{{ item['qualifiedNum'] }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">箱号</text>
- <text class="label right">{{ item['carrierName']}}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">申请时间</text>
- <text class="label right">{{ item['startTime']}}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">申请人</text>
- <text class="label right">{{ item['nickName']}}</text>
- </view>
- </view>
- </view>
- <view class="bottom-btn-container uni-row">
- <button class="bottom-btn" @click="handleStartTurn">开始周转</button>
- </view>
- </view>
- <!-- 周转中页面 -->
- <view class='turnover-container' v-if='turnoverShow'>
- <view class="scroll-container" scroll-y>
- <!-- 循环周转中的数据 -->
- <view class='item-container'>
- <view v-if="products.length > 0" class="turnover-title uni-row">
- <view class="uni-row" style="align-items: center;">
- <view><text class='title-color'>{{turnoverContentTitle}}箱</text></view>
- <view><text class="second-info">{{turnoverSecondTitle}}</text></view>
- </view>
- <view><text class="label">周转中</text></view>
- </view>
- <view :class="{'list-container':true,'selected':isSelected(item)}" v-for="(item,index) in products"
- @click="handleSelection(item)" :key='index'>
- <!-- @click="handleSelection(item)" -->
- <view class="list-container-item product-description uni-row">
- <text class="label left-value">产品描述</text>
- <text class="label right-value">{{item['productDescription']}}</text>
- </view>
- <view class="list-container-item uni-row">
- <text class="label left-value">批次</text>
- <text class="label right-value">{{item['lotCode']}}</text>
- </view>
- <view class="list-container-item uni-row">
- <text class="label left-value">箱数</text>
- <text class="label right-value">{{item['carriers']}}</text>
- </view>
- <view class="list-container-item uni-row">
- <text class="label left-value">箱号</text>
- <text class="label right-value">{{item['carrierName']}}</text>
- </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-turnoverTask ref="turnoverTask"></dialog-turnoverTask>
- </template>
- <script setup>
- import {
- ref
- } from 'vue'
- import {
- onLoad
- } from '@dcloudio/uni-app'
- // import pending from './pending';
- // import turnover from './turnover';
- import {
- getDayWorkItemList
- } from '@/api/business/dayWorkItem.js'
- import {
- updateDayWorkItem,
- updateDayWorkItemBatch
- } from '@/api/business/dayWorkItem.js'
- import {
- getDictInfoByType
- } from '@/api/dict/dict.js'
- const pendingTitle = ref('待周转')
- const turnoverTitle = ref('周转中')
- const turnoverContentTitle = ref(0)
- const turnoverSecondTitle = ref('')
- const sum = ref(0)
- const pendingClass = ref({
- selecter: true
- })
- const turnoverClass = ref({
- selecter: false
- })
- const selection = ref([])
- const pendingShow = ref(true)
- const turnoverShow = ref(false)
- const listData = ref([])
- const products = ref([])
- const confirm = ref(null) // 弹窗组件
- const turnoverTask = ref(null) // 弹窗组件
- onLoad(() => {
- uni.$once('confirmDelivery', function() {
- init();
- })
- init()
- })
- function init() {
- getDayWorkItemList({
- status: 4
- }).then(res => {
- if (res.code == 200) {
- listData.value = res.rows;
- // 设置箱数
- for (var i = 0; i < listData.value.length; i++) {
- listData.value[i].carriers = listData.value[i].carrierName.split('、').length;
- }
- console.log(res)
- }
- })
- getDayWorkItemList({
- status: 5
- }).then(res => {
- if (res.code == 200) {
- products.value = res.rows;
- // 设置箱数
- for (let i = 0; i < products.value.length; i++) {
- products.value[i].carriers = products.value[i].carrierName.split('、').length;
- turnoverContentTitle.value += products.value[i].carriers;
- turnoverSecondTitle.value = 'A' + " → " + products.value[i].deptName;
- }
- // 设置总数和目标
- console.log(res)
- }
- })
- }
- function reflush() {
- init();
- }
- function handleConfirmUnbind() {
- handleDoTurn();
- }
- function handleStartTurn() {
- // if(selection.value.length > 0){
- // let msg = '是否确认周转?';
- // confirm.value.open(msg);
- // }
- // turnoverTask.value.open(selection.value);
- uni.navigateTo({
- url: "/pages/startTurnover/index"
- })
- }
- function handleConfirmDelivery() {
- if (products.value.length > 0) {
- let msg = '是否确认送达?';
- confirm.value.open(msg);
- }
- }
- function handleDoTurn() {
- // 设置周转状态
- for (var i = 0; i < products.value.length; i++) {
- products.value[i].status = '6';
- }
- updateDayWorkItemBatch(products.value).then(res => {
- if (res.code === 200) {
- uni.showToast({
- icon: 'success',
- title: '操作成功',
- duration: 2000
- });
- init();
- } else {
- uni.showToast({
- icon: 'error',
- title: '操作失败',
- duration: 2000
- });
- }
- })
- // 清空选中数组
- selection.value = [];
- }
- function isSelected(item) {
- return selection.value.includes(item);
- }
- function handleSelection(item) {
- const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
- if (buttonIndex > -1) {
- selection.value.splice(buttonIndex, 1); // 取消选中
- } else {
- selection.value.push(item); // 选中
- }
- console.log(selection.value, "selection");
- }
- function selectPending() {
- pendingClass.value['selecter'] = true;
- turnoverClass.value['selecter'] = false;
- pendingShow.value = true;
- turnoverShow.value = false;
- }
- function selectTurnover() {
- pendingClass.value['selecter'] = false;
- turnoverClass.value['selecter'] = true;
- pendingShow.value = false;
- turnoverShow.value = true;
- }
- </script>
- <style lang="scss">
- $navHeight: 48rpx;
- /* 导航栏样式 */
- .container {
- height: calc(100% - $navHeight);
- position: relative;
- top: $navHeight;
- background-color: #f5f5f5;
- }
- .selected {
- border: 1px solid #1684fc;
- }
- .nav {
- justify-content: space-around;
- // position: fixed;
- // top:0;
- width: 100%;
- height: $navHeight;
- border-bottom: 3rpx solid rgba(228, 231, 237, 1);
- background-color: rgba(255, 255, 255, 1);
- .img {
- width: 24rpx;
- height: 24rpx;
- position: fixed;
- right: 10rpx;
- top: 0;
- }
- }
- .selecter {
- height: 48rpx;
- color: rgba(25, 137, 250, 1);
- border-bottom: 3rpx solid rgba(25, 137, 250, 1);
- }
- /* 待周转样式 */
- .padding-container,
- .turnover-container {
- position: absolute;
- top: 56rpx;
- right: 0;
- bottom: 0rpx;
- left: 0;
- background-color: #f5f5f5;
- .scroll-container {
- position: absolute;
- top: 24rpx;
- right: 0;
- bottom: 136rpx;
- left: 0;
- }
- .bottom-btn-container {
- height: 10%;
- position: fixed;
- right: 0;
- bottom: 0;
- left: 0;
- height: 80rpx;
- border-top: 1px solid #999999;
- padding: 16rpx 32rpx;
- align-items: center;
- background-color: #fff;
- .bottom-btn {
- // padding-left: 0;
- // padding-top: 4rpx;
- flex: 1;
- font-size: 28rpx;
- color: #FFFFFF;
- background-color: #1684fc;
- }
- }
- }
- .padding-container {
- .scroll-container {
- .list-item {
- background-color: #fff;
- padding: 0 24rpx;
- padding-bottom: 24rpx;
- margin: 0 24rpx;
- margin-bottom: 24rpx;
- border-radius: 8rpx;
- .title-container {
- justify-content: space-between;
- margin-top: 8rpx;
- margin-bottom: 16rpx;
- .title {
- height: 48rpx;
- align-items: center;
- .label {
- color: #1684fc;
- font-size: 32rpx;
- font-weight: bold;
- &.code {
- color: #000000;
- margin-left: 32rpx;
- }
- }
- }
- }
- .item-info {
- margin-bottom: 16rpx;
- .label {
- font-size: 28rpx;
- width: 160rpx;
- color: #808080;
- &.right {
- flex: 1;
- color: #000000;
- }
- }
- }
- .right-info {
- justify-content: flex-end;
- margin-top: 2rpx;
- .label {
- font-size: 28rpx;
- color: #808080;
- }
- }
- }
- }
- }
- /* 周转中样式 */
- .turnover-container {
- .scroll-container {
- .item-container {
- // height: 90%;
- // padding: 8rpx 0 32rpx 0;
- margin: 0 24rpx;
- margin-bottom: 24rpx;
- background-color: rgba(255, 255, 255, 1);
- border-radius: 8rpx;
- .turnover-title {
- width: auto;
- justify-content: space-between;
- margin: 16rpx;
- font-weight: bold;
- .label {
- font-size: 28rpx;
- color: #808080;
- }
- }
- .list-container {
- margin: 0 24rpx 16rpx 24rpx;
- .list-container-item {
- border-bottom: 1px solid #999999;
- padding: 12rpx 8rpx;
- background-color: #EEF0F5;
- &.product-description {
- background-color: #ECF5FF;
- }
- .label {
- font-size: 28rpx;
- color: #999999;
- &.left-value {
- width: 152rpx;
- }
- &.right-value {
- flex: 1;
- color: #000000;
- }
- }
- }
- }
- .title-color {
- color: rgba(22, 132, 252, 1);
- font-size: 36rpx;
- font-weight: bold;
- }
- .second-info {
- font-size: 36rpx;
- font-weight: bold;
- margin-left: 32rpx;
- }
- .turnover-info {
- color: rgba(128, 128, 128, 1);
- position: absolute;
- top: 10rpx;
- right: 40rpx;
- font-size: 30rpx;
- }
- }
- }
- }
- </style>
|