wuhb il y a 1 semaine
Parent
commit
12a80e48e6
1 fichiers modifiés avec 32 ajouts et 7 suppressions
  1. 32 7
      pages/apply/applyNew.uvue

+ 32 - 7
pages/apply/applyNew.uvue

@@ -172,6 +172,10 @@
 		            <text class="modal-title">新增物料</text>
 		            <text class="modal-close" @click="showAddMaterialModal = false">取消</text>
 		        </view>
+				<view v-if="addMaterialError.length > 0" class="error-tip">
+					<text class="error-tip-text">{{ addMaterialError }}</text>
+					<text class="error-tip-close" @click="addMaterialError = ''">×</text>
+				</view>
 				<view class="form-item-input">
 				    <text class="label-picker">物料名称</text>
 				    <view class="view-input-picker">
@@ -331,6 +335,7 @@ const currentUserName = ref<string>('')
 
 // 新增物料相关
 const showAddMaterialModal = ref<boolean>(false)
+const addMaterialError = ref<string>('')
 const showMeasurePicker = ref<boolean>(false)
 const measureList = ref<UTSJSONObject[]>([])
 const showDeleteConfirm = ref<boolean>(false)
@@ -827,16 +832,11 @@ const handleAddMaterial = async (): Promise<void> => {
 	} catch (e) {
 		const error = e as UTSError
 		const errMsg = error?.message
-		uni.showModal({
-			title: '提示',
-			content: errMsg.toString(),
-			showCancel: false,
-			confirmText: '确定'
-		})
+		// 显示错误提示
+		addMaterialError.value = errMsg.toString()
 	}
 }
 
-// 处理删除物料
 const handleDeleteMaterial = (item: Item): void => {
 	uni.showModal({
 		title: '确认删除',
@@ -1428,6 +1428,31 @@ onMounted(() => {
 			justify-content: center;
 		}
 
+		.error-tip {
+			display: flex;
+			flex-direction: row;
+			align-items: center;
+			justify-content: space-between;
+			margin: 20rpx;
+			padding: 16rpx 20rpx;
+			background-color: #fff2f0;
+			border: 1rpx solid #ffccc7;
+			border-radius: 8rpx;
+		}
+
+		.error-tip-text {
+			flex: 1;
+			font-size: 26rpx;
+			color: #ff4d4f;
+		}
+
+		.error-tip-close {
+			margin-left: 16rpx;
+			font-size: 32rpx;
+			color: #999999;
+			font-weight: bold;
+		}
+
 		.btn-primary {
 			width: 100%;
 			height: 80rpx;