Browse Source

物料申请

wuhb 2 months ago
parent
commit
c4c9c55dbf
3 changed files with 129 additions and 32 deletions
  1. 68 7
      pages/apply/applyInfo.uvue
  2. 59 23
      pages/apply/index.uvue
  3. 2 2
      utils/request.uts

+ 68 - 7
pages/apply/applyInfo.uvue

@@ -1,7 +1,7 @@
 <template>
 	<uni-navbar-lite :showRight=false title="申请详情"></uni-navbar-lite>
     <view class="page-container">
-        <scroll-view class="page-content" :scroll-y="true">
+        <scroll-view class="page-content" :class="{ 'has-bottom-buttons': applyStatus != null && applyStatus.trim() == 'PREPARE' }" :scroll-y="true">
             <!-- 申请单信息 -->
             <view class="section">
                 <view class="section-header">
@@ -17,6 +17,10 @@
                         <text class="info-label">状态</text>
                         <text class="info-value status-text" :class="'status-' + applyStatus">{{ applyStatusText }}</text>
                     </view>
+                    <view class="info-row">
+                        <text class="info-label">申购状态</text>
+                        <text class="info-value status-text" :class="'purchase-status-' + purchaseStatus">{{getPurchaseStatusText(purchaseStatus)}}</text>
+                    </view>
                     <view class="info-row">
                         <text class="info-label">申请时间</text>
                         <text class="info-value">{{ createTime }}</text>
@@ -49,12 +53,22 @@
                         <!--    <text class="material-spec">{{ getSpecification(item) }}</text> -->
                         </view>
                         <view class="material-detail">
-                            <view class="detail-row">
+                            <view class="detail-row detail-row-left">
                                 <text class="detail-label">数量</text>
                                 <text class="detail-value quantity-value">{{ getQuantity(item) }}</text>
                                 <text class="detail-value">{{ getMeasureName(item) }}</text>
                             </view>
-                            <view class="detail-row">
+                            <view class="detail-row detail-row-right">
+                                <text class="detail-label">已出库</text>
+                                <text class="detail-value">{{ getQuantityOutTotal(item) }}</text>
+								<text class="detail-value">{{ getMeasureName(item) }}</text>
+							</view>
+                            <view class="detail-row detail-row-left">
+                                <text class="detail-label">库存</text>
+                                <text class="detail-value">{{ getCurrentStock(item) }}</text>
+								<text class="detail-value">{{ getMeasureName(item) }}</text>
+							</view>
+                            <view class="detail-row detail-row-right">
                                 <text class="detail-label">状态</text>
                                 <text class="detail-value status-text" :class="'line-status-' + getLineStatus(item)">{{ getLineStatusText(item) }}</text>
                             </view>
@@ -79,6 +93,7 @@
     const applyId = ref<string>("")
     const applyCode = ref<string>("")
     const applyStatus = ref<string>("")
+    const purchaseStatus = ref<string>("")
     const createTime = ref<string>("")
     const nickName = ref<string>("")
     const lineList = ref<UTSJSONObject[]>([])
@@ -91,11 +106,20 @@
             case 'APPROVING': return '审批中'
             case 'APPROVED': return '已审批'
             case 'FINISHED': return '已完成'
+			case 'WAITOUT': return '待出库'
             case 'CANCEL': return '已取消'
             default: return status
         }
     })
 
+    const getPurchaseStatusText = (status: string): string => {
+        switch (status) {
+            case '0': return '未申购'
+            case '1': return '已申购'
+            default: return ''
+        }
+    }
+
     const getItemName = (item: UTSJSONObject): string => {
         if (item == null) return ''
         const val = item['itemName']
@@ -136,10 +160,23 @@
             case '4': return '已申请采购/出库'
             case '5': return '已完成'
             case '6': return '已取消'
+			case '7': return '部分出库'
             default: return status
         }
     }
 
+    const getQuantityOutTotal = (item: UTSJSONObject): string => {
+        if (item == null) return '0'
+        const val = item['quantityOutTotal']
+        return val != null ? val.toString() : '0'
+    }
+
+    const getCurrentStock = (item: UTSJSONObject): string => {
+        if (item == null) return '0'
+        const val = item['quantityStock']
+        return val != null ? val.toString() : '0'
+    }
+
     const loadDetail = (): void => {
         if (applyId.value.length === 0) return
         getPurchaseApplyById(applyId.value).then((res: any) => {
@@ -147,6 +184,7 @@
 			const data = res["data"] as UTSJSONObject
             applyCode.value = data['applyCode'] != null ? data['applyCode'].toString() : ''
             applyStatus.value = data['status'] != null ? data['status'].toString() : ''
+			purchaseStatus.value = data['applyStatus'] != null ? data['applyStatus'].toString() : ''
             createTime.value = data['createTime'] != null ? data['createTime'].toString() : ''
             nickName.value = data['nickName'] != null ? data['nickName'].toString() : ''    
             const lines = data['wmPurchaseApplyLineList']
@@ -229,7 +267,10 @@
     .page-content {
         flex: 1;
         padding: 20rpx;
-        padding-bottom: 150rpx;
+    }
+    
+    .page-content.has-bottom-buttons {
+        padding-bottom: 130rpx;
     }
 
     .section {
@@ -292,7 +333,7 @@
         &.status-CONFIRMED {
             color: #1890ff;
         }
-        &.status-APPROVING {
+        &.status-WAITOUT {
             color: #fa8c16;
         }
         &.status-APPROVED {
@@ -313,7 +354,7 @@
         &.line-status-3 {
             color: #722ed1;
         }
-        &.line-status-4 {
+        &.line-status-7 {
             color: #fa8c16;
         }
         &.line-status-5 {
@@ -322,6 +363,14 @@
         &.line-status-6 {
             color: #ff4d4f;
         }
+        
+        &.purchase-status-0 {
+            color: #faad14;
+        }
+        
+        &.purchase-status-1 {
+            color: #52c41a;
+        }
     }
 
     .material-list {
@@ -369,11 +418,23 @@
 
     .material-detail {
         flex-direction: row;
-        justify-content: space-between;
+        flex-wrap: wrap;
+        margin: -8rpx;
     }
 
     .detail-row {
         flex-direction: row;
+        width: 50%;
+        padding: 8rpx;
+        box-sizing: border-box;
+    }
+    
+    .detail-row-left {
+        justify-content: flex-start;
+    }
+    
+    .detail-row-right {
+        justify-content: flex-end;
     }
 
     .detail-label {

+ 59 - 23
pages/apply/index.uvue

@@ -25,13 +25,6 @@
                 >
                     <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' }" 
@@ -48,17 +41,17 @@
                 </view>
                 <view 
                     class="status-tab" 
-                    :class="{ 'active': currentStatus === 'APPROVING' }" 
-                    @tap="handleStatusChange('APPROVING')"
+                    :class="{ 'active': currentStatus === 'WAITOUT' }" 
+                    @tap="handleStatusChange('WAITOUT')"
                 >
-                    <text class="status-tab-text" :class="{ 'active-text': currentStatus === 'APPROVING' }">审批中</text>
+                    <text class="status-tab-text" :class="{ 'active-text': currentStatus === 'WAITOUT' }">待出库</text>
                 </view>
                 <view 
                     class="status-tab" 
-                    :class="{ 'active': currentStatus === 'APPROVED' }" 
-                    @tap="handleStatusChange('APPROVED')"
+                    :class="{ 'active': currentStatus === 'FINISHED' }" 
+                    @tap="handleStatusChange('FINISHED')"
                 >
-                    <text class="status-tab-text" :class="{ 'active-text': currentStatus === 'APPROVED' }">已审批</text>
+                    <text class="status-tab-text" :class="{ 'active-text': currentStatus === 'FINISHED' }">已完成</text>
                 </view>
             </scroll-view>
         </view>
@@ -93,22 +86,18 @@
                             </view>
                             <view class="info-row">
                                 <view class="info-item">
-                                    <text class="info-label">待审核</text>
-                                    <text class="info-value warning">{{ getPendingAuditCount(item) }}</text>
+                                    <text class="info-label">申请数</text>
+                                    <text class="info-value warning">{{ getApplyCount(item) }}</text>
                                 </view>
                                 <view class="info-item">
-                                    <text class="info-label">待领取</text>
-                                    <text class="info-value primary">{{ getPendingReceiveCount(item) }}</text>
+                                    <text class="info-label">已出库</text>
+                                    <text class="info-value primary">{{ getOutCount(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 success">{{ getFinishedCount(item) }}</text>
+                                    <text class="info-label">申购状态</text>
+                                    <text class="info-value" :class="'purchase-status-' + getPurchaseStatus(item)">{{ getPurchaseStatusText(item) }}</text>
                                 </view>
                             </view>
                         </view>
@@ -180,9 +169,31 @@
             case 'CANCEL': return '已取消'
 			case 'APPROVED': return '已审批'
 			case 'APPROVING': return '审批中'
+			case 'WAITOUT': return '待出库'
             default: return status
         }
     }
+    
+    // 获取申购状态
+    const getPurchaseStatus = (item: any | null): string => {
+        if (item == null) return ''
+        const jsonItem = item as UTSJSONObject
+        const val = jsonItem['applyStatus']
+        return val != null ? val.toString() : ''
+    }
+    
+    // 获取申购状态文本
+    const getPurchaseStatusText = (item: any | null): string => {
+        if (item == null) return ''
+        const jsonItem = item as UTSJSONObject
+        const val = jsonItem['applyStatus']
+        const status = val != null ? val.toString() : ''
+        switch (status) {
+            case '0': return '未申购'
+            case '1': return '已申购'
+            default: return ''
+        }
+    }
 
     // 获取创建时间
     const getCreateTime = (item: any | null): string => {
@@ -200,6 +211,22 @@
         return val != null ? val.toString() : ''
     }
 
+    // 获取申请数量
+    const getApplyCount = (item: any | null): string => {
+        if (item == null) return '0'
+        const jsonItem = item as UTSJSONObject
+        const val = jsonItem['applyQuantity']
+        return val != null ? val.toString() : '0'
+    }
+	
+	// 获取已出库数量
+	const getOutCount = (item: any | null): string => {
+	    if (item == null) return '0'
+	    const jsonItem = item as UTSJSONObject
+	    const val = jsonItem['outQuantity']
+	    return val != null ? val.toString() : '0'
+	}
+	
     // 获取已完成数量
     const getFinishedCount = (item: any | null): string => {
         if (item == null) return '0'
@@ -556,6 +583,9 @@
 			    background-color: #d1f5f8;
 			    color: #ff007f;
 			}
+			&.status-WAITOUT {
+			    color: #fa8c16;
+			}
 			&.status-APPROVED {
 			    background-color: #ebfffd;
 			    color: #55ff00;
@@ -608,6 +638,12 @@
                     &.primary {
                         color: #007aff;
                     }
+                    &.purchase-status-0 {
+                        color: #faad14;
+                    }
+                    &.purchase-status-1 {
+                        color: #52c41a;
+                    }
                 }
             }
         }

+ 2 - 2
utils/request.uts

@@ -14,9 +14,9 @@ export type RequestConfig = {
 
 // 基础 URL
 // const BASE_URL = "http://192.168.2.26:83";
-// const BASE_URL = "http://192.168.189.43:83";
+const BASE_URL = "http://192.168.189.43:83";
 // const BASE_URL = "http://222.243.138.146:8150/prod-api" //测试服务器;
-const BASE_URL = "http://222.243.138.146:880/prod-api" //正式服务器;
+// const BASE_URL = "http://222.243.138.146:880/prod-api" //正式服务器;
 
 /**
  * 获取基础 URL