|
|
@@ -17,7 +17,7 @@
|
|
|
</view>
|
|
|
|
|
|
<!-- 状态标签 -->
|
|
|
- <view class="status-tabs">
|
|
|
+ <scroll-view class="status-tabs" scroll-x="true">
|
|
|
<view
|
|
|
class="status-tab"
|
|
|
:class="{ 'active': currentStatus === '' }"
|
|
|
@@ -25,6 +25,13 @@
|
|
|
>
|
|
|
<text class="status-tab-text" :class="{ 'active-text': currentStatus === '' }">全部</text>
|
|
|
</view>
|
|
|
+ <view
|
|
|
+ class="status-tab status-pending-receive"
|
|
|
+ :class="{ 'active': currentStatus === 'PENDING_RECEIVE' }"
|
|
|
+ @tap="handleStatusChange('PENDING_RECEIVE')"
|
|
|
+ >
|
|
|
+ <text class="status-tab-text" :class="{ 'active-text': currentStatus === 'PENDING_RECEIVE' }">待领取</text>
|
|
|
+ </view>
|
|
|
<view
|
|
|
class="status-tab"
|
|
|
:class="{ 'active': currentStatus === 'PREPARE' }"
|
|
|
@@ -53,7 +60,7 @@
|
|
|
>
|
|
|
<text class="status-tab-text" :class="{ 'active-text': currentStatus === 'APPROVED' }">已审批</text>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </scroll-view>
|
|
|
</view>
|
|
|
|
|
|
<!-- 列表内容 -->
|
|
|
@@ -86,12 +93,22 @@
|
|
|
</view>
|
|
|
<view class="info-row">
|
|
|
<view class="info-item">
|
|
|
- <text class="info-label">已完成</text>
|
|
|
- <text class="info-value success">{{ getFinishedCount(item) }}</text>
|
|
|
+ <text class="info-label">待审核</text>
|
|
|
+ <text class="info-value warning">{{ getPendingAuditCount(item) }}</text>
|
|
|
+ </view>
|
|
|
+ <view class="info-item">
|
|
|
+ <text class="info-label">待领取</text>
|
|
|
+ <text class="info-value primary">{{ getPendingReceiveCount(item) }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="info-row">
|
|
|
+ <view class="info-item">
|
|
|
+ <text class="info-label">待采购</text>
|
|
|
+ <text class="info-value warning">{{ getPendingPurchaseCount(item) }}</text>
|
|
|
</view>
|
|
|
<view class="info-item">
|
|
|
- <text class="info-label">未完成</text>
|
|
|
- <text class="info-value warning">{{ getUnfinishedCount(item) }}</text>
|
|
|
+ <text class="info-label">已完成</text>
|
|
|
+ <text class="info-value success">{{ getFinishedCount(item) }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -104,7 +121,7 @@
|
|
|
|
|
|
<script setup lang="uts">
|
|
|
import { ref, onShow } from 'vue'
|
|
|
- import { getPurchaseApplyList } from '../../api/apply/index'
|
|
|
+ import { getPurchaseApplyList, getPendingReceiveApplyCount } from '../../api/apply/index'
|
|
|
import { getUserInfo } from '../../utils/storage'
|
|
|
|
|
|
let currentUserId: string = ''
|
|
|
@@ -120,6 +137,19 @@
|
|
|
const loading = ref<boolean>(false)
|
|
|
const refreshing = ref<boolean>(false)
|
|
|
const showRight = ref<boolean>(false)
|
|
|
+ const pendingReceiveCount = ref<number>(0)
|
|
|
+
|
|
|
+ // 加载待领取数量
|
|
|
+ const loadPendingReceiveCount = (): void => {
|
|
|
+ if (currentUserId.length === 0) return
|
|
|
+ getPendingReceiveApplyCount(currentUserId).then((res: any) => {
|
|
|
+ const result = res as UTSJSONObject
|
|
|
+ const count = result['data']
|
|
|
+ pendingReceiveCount.value = count != null ? parseInt(count.toString()) : 0
|
|
|
+ }).catch((e) => {
|
|
|
+ console.error('加载待领取数量失败:', e)
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
// 获取申请单号
|
|
|
const getApplyCode = (item: any | null): string => {
|
|
|
@@ -178,11 +208,27 @@
|
|
|
return val != null ? val.toString() : '0'
|
|
|
}
|
|
|
|
|
|
- // 获取未完成数量
|
|
|
- const getUnfinishedCount = (item: any | null): string => {
|
|
|
+ // 获取待审核数量 (status=1)
|
|
|
+ const getPendingAuditCount = (item: any | null): string => {
|
|
|
+ if (item == null) return '0'
|
|
|
+ const jsonItem = item as UTSJSONObject
|
|
|
+ const val = jsonItem['pendingAuditCount']
|
|
|
+ return val != null ? val.toString() : '0'
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取待领取数量 (status=2 + status=4)
|
|
|
+ const getPendingReceiveCount = (item: any | null): string => {
|
|
|
if (item == null) return '0'
|
|
|
const jsonItem = item as UTSJSONObject
|
|
|
- const val = jsonItem['unfinishedCount']
|
|
|
+ const val = jsonItem['pendingReceiveCount']
|
|
|
+ return val != null ? val.toString() : '0'
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取待采购数量 (status=3 + status=4)
|
|
|
+ const getPendingPurchaseCount = (item: any | null): string => {
|
|
|
+ if (item == null) return '0'
|
|
|
+ const jsonItem = item as UTSJSONObject
|
|
|
+ const val = jsonItem['pendingPurchaseCount']
|
|
|
return val != null ? val.toString() : '0'
|
|
|
}
|
|
|
|
|
|
@@ -198,11 +244,15 @@
|
|
|
}
|
|
|
|
|
|
const searchKeyword = keyword.value != null ? keyword.value : ''
|
|
|
- const statusParam = currentStatus.value != null ? currentStatus.value : ''
|
|
|
- const result = await getPurchaseApplyList(page.value, pageSize, searchKeyword, statusParam, currentUserId)
|
|
|
+ const isPendingReceive = currentStatus.value === 'PENDING_RECEIVE'
|
|
|
+ const statusParam = isPendingReceive ? '' : (currentStatus.value != null ? currentStatus.value : '')
|
|
|
+ console.log('loadData - statusParam:', statusParam, 'isPendingReceive:', isPendingReceive)
|
|
|
+ const result = await getPurchaseApplyList(page.value, pageSize, searchKeyword, statusParam, currentUserId, isPendingReceive)
|
|
|
+ console.log('getPurchaseApplyList result:', result)
|
|
|
const resultObj = result as UTSJSONObject
|
|
|
const rows = resultObj['rows']
|
|
|
const total = resultObj['total'] as number
|
|
|
+ console.log('rows:', rows, 'total:', total)
|
|
|
|
|
|
if (rows != null) {
|
|
|
const newData = rows as any[]
|
|
|
@@ -285,6 +335,7 @@
|
|
|
// 页面显示时刷新列表
|
|
|
onShow(() => {
|
|
|
loadData(true)
|
|
|
+ loadPendingReceiveCount()
|
|
|
})
|
|
|
|
|
|
onMounted(() => {
|
|
|
@@ -315,6 +366,38 @@
|
|
|
background-color: #ffffff;
|
|
|
}
|
|
|
|
|
|
+ .pending-receive-bar {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: center;
|
|
|
+ padding: 20rpx 30rpx;
|
|
|
+ background-color: #fff7e6;
|
|
|
+ border-left: 6rpx solid #fa8c16;
|
|
|
+ margin: 0 30rpx;
|
|
|
+ border-radius: 8rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .pending-receive-label {
|
|
|
+ font-size: 28rpx;
|
|
|
+ color: #fa8c16;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+
|
|
|
+ .pending-receive-count {
|
|
|
+ margin-left: 16rpx;
|
|
|
+ padding: 4rpx 16rpx;
|
|
|
+ background-color: #fa8c16;
|
|
|
+ color: #ffffff;
|
|
|
+ font-size: 24rpx;
|
|
|
+ border-radius: 20rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .pending-receive-arrow {
|
|
|
+ margin-left: auto;
|
|
|
+ color: #999999;
|
|
|
+ font-size: 28rpx;
|
|
|
+ }
|
|
|
+
|
|
|
.search-bar {
|
|
|
padding: 20rpx 30rpx;
|
|
|
}
|
|
|
@@ -324,12 +407,17 @@
|
|
|
flex-direction: row;
|
|
|
padding: 0rpx 30rpx 20rpx;
|
|
|
background-color: #ffffff;
|
|
|
+ white-space: nowrap;
|
|
|
+ width: 100%;
|
|
|
}
|
|
|
|
|
|
.status-tab {
|
|
|
- flex: 1;
|
|
|
- padding: 16rpx 0;
|
|
|
+ display: inline-flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: center;
|
|
|
+ padding: 16rpx 24rpx;
|
|
|
text-align: center;
|
|
|
+ position: relative;
|
|
|
margin-right: 16rpx;
|
|
|
border-radius: 8rpx;
|
|
|
background-color: #f5f5f5;
|
|
|
@@ -354,6 +442,22 @@
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .tab-badge {
|
|
|
+ margin-left: 8rpx;
|
|
|
+ min-width: 32rpx;
|
|
|
+ height: 32rpx;
|
|
|
+ padding: 0 8rpx;
|
|
|
+ background-color: #ff3b30;
|
|
|
+ border-radius: 16rpx;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .tab-badge-text {
|
|
|
+ font-size: 20rpx;
|
|
|
+ color: #ffffff;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.search-box {
|
|
|
@@ -501,6 +605,9 @@
|
|
|
&.warning {
|
|
|
color: #faad14;
|
|
|
}
|
|
|
+ &.primary {
|
|
|
+ color: #007aff;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|