浏览代码

Merge branch 'master' of http://120.46.159.163:7400/ezhizao/ezhizao_dms_app

ezhizao_zx 1 年之前
父节点
当前提交
6ae2fd1f80
共有 3 个文件被更改,包括 57 次插入43 次删除
  1. 1 1
      pages/dashboard/index.vue
  2. 9 24
      pages/processInspection/index.vue
  3. 47 18
      pages/processInspection/scan.vue

+ 1 - 1
pages/dashboard/index.vue

@@ -222,7 +222,7 @@
 	// 工序检查
 	function handleToProcessInspection() {
 		uni.navigateTo({
-			url: '/pages/productionPlan/index'
+			url: '/pages/processInspection/index'
 		})
 	}
 

+ 9 - 24
pages/processInspection/index.vue

@@ -1,11 +1,11 @@
 <template>
 	<view class="page-container uni-column">
 		<view class="search-container uni-row">
-			<input type="text" v-model="keywords" placeholder="请输入箱号" />
+			<input type="text" v-model="keywords" placeholder="请输入关键字" />
 			<view class="btn uni-row">搜索</view>
 			<!-- <uni-icons type="scan" size="24" /> -->
 		</view>
-		<view class="scan-btn uni-row" @click.stop="handleScanCode">扫描箱号</view>
+		<view class="scan-btn uni-row" @click.stop="handleAddProcessInspection">新增序检</view>
 		<view class="daywork-item uni-column" v-for="(item, index) in dayworkList" :key="index">
 			<view class="lot-code uni-row">
 				<text>批次号:{{ item.lot_code }}</text>
@@ -68,31 +68,16 @@
 	}
 	
 	/***************************** 定义了一些事件 *****************************/
-	// 扫码
-	const handleScanCode = () => {
-		uni.scanCode({
-			onlyFromCamera: true,
-			success: function (res) {
-				if (res.scanType !== 'QR_CODE') {
-					uni.showToast({
-						icon: 'none',
-						title: '二维码未识别成功',
-						duration: 2000
-					})
-					return
-				}
-				console.log(res)
-				const result = JSON.parse(res.result)
-				uni.navigateTo({
-					url: '/pages/processInspection/scan?carrierId=' + result.carrierId + '&carrierCode=' + result.carrierCode
-				})
-			}
-		});
+	// 新增序检
+	const handleAddProcessInspection = () => {
+		uni.navigateTo({
+			url: '/pages/processInspection/scan'
+		})
 	}
 	// 添加不合格信息
 	const handleShowUnfit = () => {
 		uni.navigateTo({
-			url: "/pages/processInspection/form"
+			url: '/pages/processInspection/form'
 		})
 	}
 </script>
@@ -131,7 +116,7 @@
 		height: 64rpx;
 		margin: 32rpx 32rpx 0 32rpx;
 		color: #ffffff;
-		background-color: #00D068;
+		background-color: #f47c3c;
 		align-items: center;
 		justify-content: center;
 		border-radius: 8rpx;

+ 47 - 18
pages/processInspection/scan.vue

@@ -18,8 +18,12 @@
 				<view class="label">投产数量</view>
 				<view class="value">{{ data.production_quantity }}</view>
 			</view>
-			<view class="btn uni-row" style="background-color: #ff5555; margin-top: 48rpx;" @click.stop="handleSubmit('err')">填写序检不合格结果</view>
-			<view class="btn uni-row" @click.stop="handleSubmit('ok')">合格,无异常</view>
+			<input type="text" v-model="carrierCode" placeholder="请输入箱号" />
+			<view class="btn uni-row" style="background-color: #ff5555;" @click.stop="handleScanCode">
+				<uni-icons type="scan" size="16" style="color: #ffffff; margin-right: 8rpx;" />
+				<text>扫描箱码</text>
+			</view>
+			<view class="btn uni-row" style="margin-top: 48rpx;" @click.stop="handleConfirm">确定</view>
 		</view>
 	</view>
 </template>
@@ -28,6 +32,7 @@
 	import { ref } from 'vue'
 	import { onLoad, onReady, onUnload, onShow } from '@dcloudio/uni-app'
 	
+	const carrierCode = ref('')
 	const data = ref({
 		carrier_id: '',
 		carrier_code: '',
@@ -39,21 +44,39 @@
 	})
 	
 	// 页面生命周期函数
-	onLoad((option) => {
-		console.log(option)
-		data.value.carrier_id = option.carrierId
-		data.value.carrier_code = option.carrierCode
-	})
+	onLoad(() => {})
 	
-	const handleSubmit = (type) => {
-		if (type === 'err') {
-			uni.navigateTo({
-				url: '/pages/processInspection/form?lotId=' + data.value.lot_id + '&lotCode=' + data.value.lot_code
-			})
-		}
-		if (type === 'ok') {
-			uni.navigateBack()
-		}
+	// 扫码
+	const handleScanCode = () => {
+		uni.scanCode({
+			onlyFromCamera: true,
+			success: function (res) {
+				if (res.scanType !== 'QR_CODE') {
+					uni.showToast({
+						icon: 'none',
+						title: '二维码未识别成功',
+						duration: 2000
+					})
+					return
+				}
+				const result = JSON.parse(res.result)
+				console.log(result)
+				// 此处根据拿到的箱子id,获取到相对应的【 lot_id 】,【 lot_code 】,以及该批次关联的其它箱号
+				// 需要定义一个请求方法,从后端获取
+				data.value.carrier_id = result.carrierId
+				data.value.carrier_code = result.carrierCode
+			}
+		});
+	}
+	
+	// 确定后,将批次id,批次号,传递过去
+	const handleConfirm = () => {
+		uni.navigateTo({
+			url: '/pages/processInspection/form?lotId=' + data.value.lot_id + '&lotCode=' + data.value.lot_code
+		})
+		// if (type === 'ok') {
+		// 	uni.navigateBack()
+		// }
 	}
 </script>
 
@@ -94,13 +117,19 @@
 		}
 		
 		.btn {
-			background-color: #00D068;
+			background-color: #1684fc;
 			color: #ffffff;
 			border-radius: 8rpx;
-			margin: 0 24rpx 24rpx 24rpx;
+			margin: 4rpx 24rpx 24rpx 24rpx;
 			height: 64rpx;
 			justify-content: center;
 			align-items: center;
 		}
+		input {
+			margin: 48rpx 24rpx 0 24rpx;
+			height: 64rpx;
+			border: 1px solid #888888;
+			text-align: center;
+		}
 	}
 </style>