瀏覽代碼

新增入库扫码页面

huang_an 1 年之前
父節點
當前提交
c44e4efed2

+ 9 - 0
api/warehouseManagement/index.js

@@ -391,3 +391,12 @@ export async function savePickgoods(data) {
 	}
 	return Promise.reject(new Error(res.message))
 }
+
+// 通过物品编码查询物品详情
+export async function getDetailsByCode(code) {
+	const res = await get(Vue.prototype.apiUrl + `/main/category/getByCode/${code}`)
+	if (res.code == 0) {
+		return res.data
+	}
+	return Promise.reject(new Error(res.message))
+}

+ 9 - 2
pages.json

@@ -226,8 +226,7 @@
 				"navigationBarTextStyle": "white"
 			}
 		},
-	    
-	
+
 		// {
 		// 	"path": "pages/home/wt/components/feeApplication/taskForm",
 		// 	"style": {
@@ -878,6 +877,14 @@
 				"navigationBarTextStyle": "white"
 			}
 		},
+		{
+			"path": "pages/warehouse/enterHouse/components/scanCodeList",
+			"style": {
+				"navigationBarTitleText": "扫码列表",
+				"navigationStyle": "custom",
+				"navigationBarTextStyle": "white"
+			}
+		},
 		//出库台账
 		{
 			"path": "pages/warehouse/outHouse/index",

+ 6 - 1
pages/warehouse/enterHouse/addStock.vue

@@ -53,7 +53,7 @@
 								<text data-v-41027c34="" class="uni-collapse-item__title-text"><text>入库明细</text></text>
 							</view>
 						</view>
-						<!-- <u-button type="primary" size="small" text="扫码添加" @click.native.stop="selectType"></u-button> -->
+						<u-button type="primary" size="small" text="扫码添加" @click.native.stop="goToScanCodeList"></u-button>
 						<u-button type="success" size="small" class="selectEnterType" text="手动添加" @click.native.stop="selectType"></u-button>
 					</view>
 				</template>
@@ -598,6 +598,11 @@
 			}
 		},
 		methods: {
+			goToScanCodeList() {
+				uni.navigateTo({
+					url: '/pages/warehouse/enterHouse/components/scanCodeList'
+				})
+			},
 			goToRequisition() {
 				uni.navigateTo({
 					url: '/pages/warehouse/components/requisitionList?type=' + 1

+ 446 - 0
pages/warehouse/enterHouse/components/scanCodeList.vue

@@ -0,0 +1,446 @@
+<template>
+	<view class="mainBox">
+		<view class="main">
+			<uni-nav-bar fixed="true" statusBar="true" left-icon="back" right-icon="scan" title="扫码列表" @clickLeft="backAdd" @clickRight="HandlScanCode"></uni-nav-bar>
+			<view class="wrapper">
+				<u-list class="listContent">
+					<checkbox-group v-for="(item, index) in listData" :key="index" @change.stop="e => selectVal(e, item, index)">
+						<label>
+							<view class="listBox">
+								<view class="listBox-sel">
+									<checkbox :value="item.code" color="#fff" :disabled="item.disabled" :checked="item.checked" />
+								</view>
+								<view class="listBox-con">
+									<view class="listBox-top">
+										<view class="listBox-name">
+											{{ item.name }}
+										</view>
+									</view>
+									<view class="listBox-top">
+										<view class="listBox-code">
+											{{ item.code }}
+										</view>
+									</view>
+									<view class="listBox-bottom">
+										<view>牌号:{{ item.brandNum }}</view>
+										<view>型号:{{ item.modelType }}</view>
+										<view>规格:{{ item.specification }}</view>
+										<view>批次号:{{ item.batchNo }}</view>
+										<view>计量数量:{{ item.measureQuantity }}({{ item.measuringUnit }})</view>
+										<view class="w100">包装编码:{{ item.packageNo }}</view>
+										<view>包装数量:{{ item.packingQuantity }}({{ item.packingUnit }})</view>
+										<!-- <view>重量:{{ item.weight }}({{ item.weightUnit }})</view>
+										<view>发货条码:{{ item.barcodes }}</view>
+										<view>物料代号:{{ item.materielDesignation }}</view>
+										<view>客户代号:{{ item.clientCode }}</view>
+										<view>刻码:{{ item.engrave }}</view>
+										<view class="w100">仓库:{{ item.warehouseName }}</view>
+										<view class="w100">区域:{{ getLocation(item) }}</view> -->
+									</view>
+								</view>
+							</view>
+						</label>
+					</checkbox-group>
+					<u-empty class="noDate" style="margin-top: 20vh" v-if="!listData.length"></u-empty>
+				</u-list>
+			</view>
+
+			<view class="footer">
+				<view class="bottom">
+					<checkbox v-if="!seletedAll" color="#fff" :checked="seletedAll" @tap="_seletedAll">全选</checkbox>
+					<checkbox class="select-all" color="#fff" v-else :checked="seletedAll" @tap="_seletedAll">取消全选</checkbox>
+				</view>
+				<u-button type="success" size="small" class="u-reset-button" :disabled="!checkListLen" @click="jumpAdd">
+					<view class="selBtn">选择( {{ checkListLen }} )</view>
+				</u-button>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import { getDetailsByCode } from '@/api/warehouseManagement'
+	import { sceneState, outputSceneState } from '../../common'
+	export default {
+		data() {
+			return {
+				type: null,
+				statusOpt: ['待处理', '已处理', '已撤销'],
+				curItem: null, //当前选中项
+				page: 1,
+				size: 20,
+				sceneState,
+				seletedAll: false, //全选状态
+				outputSceneState,
+				isEnd: true,
+				searchVal: '',
+				listData: [] //列表数据
+			}
+		},
+		//选择的列表长度
+		computed: {
+			checkListLen() {
+				return this.listData.filter(el => el.checked).length
+			}
+		},
+		onLoad({ type }) {
+			this.type = type
+		},
+		onShow() {
+			// this.getList()
+		},
+		methods: {
+			getLocation(item) {
+				if (item.areaName && item.goodsShelfName && item.goodsAllocationName) {
+					return item.areaName + '/' + item.goodsShelfName + '/' + item.goodsAllocationName
+				} else if (item.areaName && item.goodsShelfName) {
+					return item.areaName + '/' + item.goodsShelfName
+				} else if (item.areaName) {
+					return item.areaName
+				} else {
+					return ''
+				}
+			},
+			// 相机扫码
+			HandlScanCode() {
+				uni.scanCode({
+					success: res => {
+						console.log('res------------------------')
+						let arr = res.result.split('/')
+						console.log('arr------------------------', arr)
+						if (this.listData.find(item => item.packageNo == arr[0])) {
+							uni.showToast({
+								title: '请勿重复扫码!',
+								icon: 'none'
+							})
+							return
+						}
+						getDetailsByCode(arr[1]).then(res => {
+							console.log('res-------------', res)
+							console.log(res)
+							res.packageNo = arr[0]
+							res.packingQuantity = arr[2]
+							res.measureQuantity = arr[3]
+							res.batchNo = arr[3]
+							this.listData = this.listData.concat(res)
+						})
+					}
+				})
+			},
+			//勾选
+			selectVal(e, val, index) {
+				this.$set(this.listData[index], 'checked', !this.listData[index].checked)
+				this.seletedAll = !this.listData.some(item => !item.checked)
+			},
+			//全选按钮
+			_seletedAll() {
+				if (!this.seletedAll) {
+					this.seletedAll = true
+					this.listData.map(item => {
+						this.$set(item, 'checked', true)
+					})
+				} else {
+					this.seletedAll = false
+					//this.checkListLen = 0;
+					this.listData.map(item => {
+						this.$set(item, 'checked', false)
+					})
+				}
+			},
+			//跳转回添加页面
+			async jumpAdd() {
+				uni.$emit(
+					'setSelectList',
+					this.listData.filter(item => item.checked)
+				)
+				uni.navigateBack()
+			},
+			//返回添加页
+			backAdd() {
+				uni.navigateBack()
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.mainBox {
+		height: 100vh;
+		.main {
+			height: 100%;
+			display: flex;
+			flex-direction: column;
+		}
+		.wrapper {
+			flex: 1;
+			overflow: hidden;
+		}
+		.searchBox {
+			padding: 10rpx 0;
+			box-sizing: border-box;
+			background-color: #dedede;
+			height: 90rpx;
+			width: 100%;
+			line-height: 90rpx;
+			display: flex;
+			justify-content: space-around;
+			align-items: center;
+
+			input {
+				height: 78rpx;
+				width: 65%;
+				background: #f9f9f9 !important;
+				margin: 0 10rpx;
+				padding: 0 10rpx;
+				box-sizing: border-box;
+				border-radius: 5rpx;
+			}
+
+			.searchBtn {
+				height: 80rpx;
+				background: #f9f9f9 !important;
+				color: #676767;
+				font-size: 28rpx;
+				padding: 0 42rpx;
+				box-sizing: border-box;
+				outline: none;
+				border: none;
+				width: 260rpx;
+				.icon-sousuo {
+					font-size: 22px;
+				}
+
+				.text {
+					font-size: 16px;
+					margin-left: 10px;
+				}
+			}
+			.search-icon {
+				display: flex;
+				align-items: center;
+				justify-content: space-around;
+				font-size: 28rpx;
+				white-space: nowrap;
+				margin-left: 10rpx;
+				image {
+					width: 30rpx;
+					height: 30rpx;
+				}
+			}
+		}
+
+		.tab-title {
+			position: fixed;
+			top: 190rpx;
+			z-index: 99;
+			width: 100%;
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			height: $tab-height;
+			line-height: $tab-height;
+			background-color: #ffffff;
+			border-bottom: 2rpx solid #f2f2f2;
+			box-sizing: border-box;
+
+			.tab-item {
+				width: 25%;
+				text-align: center;
+				font-size: 32rpx;
+				color: $uni-text-color-grey;
+			}
+
+			.tab-item.active {
+				color: $j-primary-border-green;
+				border-bottom: 1px solid $j-primary-border-green;
+				font-weight: bold;
+			}
+
+			.tab-item.filter {
+				flex: 1;
+				padding: 0px 30rpx;
+
+				.uni-icons {
+					display: flex;
+					padding-top: 5px;
+				}
+			}
+
+			.screenIcon {
+				display: flex;
+				width: 80px;
+				justify-content: center;
+
+				.screenText {
+					font-size: 32rpx;
+					color: $uni-text-color-grey;
+				}
+			}
+		}
+
+		.listContent {
+			height: 100% !important;
+			.listBox {
+				display: flex;
+				// height: 180rpx;
+				padding: 20rpx 0;
+				border-bottom: 2rpx solid #e5e5e5;
+
+				.listBox-sel {
+					height: 90rpx;
+					width: 80rpx;
+					// line-height: 90rpx;
+					text-align: center;
+
+					checkbox {
+						transform: scale(1.2);
+					}
+				}
+
+				.listBox-con {
+					width: 100%;
+					// display: flex;
+					// flex-wrap: wrap;
+					// justify-content: space-between;
+					align-items: center;
+					padding: 0 18rpx 0 0;
+
+					.listBox-top {
+						width: 100%;
+						display: flex;
+						justify-content: space-between;
+						padding-bottom: 10rpx;
+
+						.listBox-name,
+						.listBox-code {
+							display: inline-block;
+							font-size: $uni-font-size-sm;
+							font-weight: bold;
+						}
+					}
+
+					.listBox-bottom {
+						width: 100%;
+						display: flex;
+						justify-content: space-between;
+						font-size: $uni-font-size-sm;
+						flex-wrap: wrap;
+						> view {
+							width: 50%;
+							overflow: hidden;
+							white-space: nowrap;
+							text-overflow: ellipsis;
+						}
+						.input_view {
+							display: flex;
+							align-items: center;
+							justify-content: center;
+							.u-input {
+								height: 36rpx;
+								padding: 0 !important;
+								margin-right: 10rpx;
+								border: 1px solid #ddd;
+							}
+						}
+						.w100 {
+							width: 100%;
+						}
+					}
+				}
+			}
+			.noDate {
+				height: 100%;
+			}
+		}
+
+		//底部按钮
+		.footer {
+			height: 90rpx;
+			position: relative;
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			bottom: 0;
+			width: 100%;
+			height: 100rpx;
+			border-top: 1rpx solid #eeecec;
+			background-color: #ffffff;
+			z-index: 999;
+
+			.bottom {
+				margin-left: 10rpx;
+			}
+
+			.u-reset-button {
+				position: absolute;
+				right: 10rpx;
+				top: 20rpx;
+				width: 150rpx;
+			}
+		}
+		.search-container {
+			width: 70vw;
+			padding: 30rpx 36rpx;
+			.footer {
+				position: absolute;
+				bottom: 0;
+				left: 0;
+				width: 100%;
+				display: flex;
+				box-shadow: 0 10rpx 30rpx 0 #000;
+				.btn {
+					width: 50%;
+					height: 80rpx;
+					border-radius: 0 !important;
+					flex: 1;
+					display: flex;
+					justify-content: center;
+					align-items: center;
+					&.reset {
+						color: $j-primary-border-green;
+					}
+				}
+			}
+		}
+		.title {
+			font-weight: bold;
+			font-size: 30rpx;
+		}
+		.status-wrapper {
+			display: flex;
+			align-items: center;
+			justify-content: space-between;
+			view {
+				background-color: rgba(242, 242, 242, 1);
+				height: 60rpx;
+				border-radius: 30rpx;
+				line-height: 60rpx;
+				text-align: center;
+				width: 160rpx;
+				border: 1rpx solid rgba(242, 242, 242, 1);
+				&.active {
+					color: #157a2c;
+					border-color: rgba(21, 122, 44, 1);
+				}
+			}
+		}
+		/deep/.uni-date {
+			.uni-icons {
+				display: none;
+			}
+			.uni-date-x {
+				padding: 0;
+				view {
+					margin: 0 20rpx;
+				}
+			}
+		}
+		/deep/.uni-date__x-input,
+		/deep/.uni-easyinput__content-input {
+			height: 60rpx;
+			border-radius: 30rpx;
+			overflow: hidden;
+			background-color: rgba(242, 242, 242, 1);
+		}
+	}
+</style>