From d2e176fbee4edcca177301374baee508c67b9b45 Mon Sep 17 00:00:00 2001
From: DESKTOP-LMJ82IJ\Eno <creaycat@gmail.com>
Date: 星期六, 19 四月 2025 15:04:50 +0800
Subject: [PATCH] 新增入库上架功能

---
 pages/phyz/inStock/inStock.vue |  287 +++++++++++++++++++++++++++++++++++++++++++++++
 pages/home/index.vue           |    8 +
 pages.json                     |    7 +
 common/request.js              |    3 
 4 files changed, 303 insertions(+), 2 deletions(-)

diff --git a/common/request.js b/common/request.js
index 7e0a192..2b08766 100644
--- a/common/request.js
+++ b/common/request.js
@@ -15,7 +15,8 @@
 	return new Promise((resolve, reject) => {
 		const token = uni.getStorageSync('token');
 		// const URL = 'http://47.76.147.249:8080/rsf-server/pda' + url;
-		const URL = 'http://192.168.4.24:8080/rsf-server/pda' + url;
+		// const URL = 'http://192.168.4.24:8080/rsf-server/pda' + url;
+		const URL = 'http://127.0.0.1:8080/rsf-server/pda' + url;
 		uni.request({
 			url: URL,
 			data: postData,
diff --git a/pages.json b/pages.json
index 1b9e8c2..d492730 100644
--- a/pages.json
+++ b/pages.json
@@ -524,6 +524,13 @@
 			"style": {
 				"navigationBarTitleText": "鍑哄簱纭"
 			}
+		},
+		{
+			"path" : "pages/phyz/inStock/inStock",
+			"style" : 
+			{
+				"navigationBarTitleText" : "鍏ュ簱涓婃灦"
+			}
 		}
 
 	],
diff --git a/pages/home/index.vue b/pages/home/index.vue
index 11fef82..7b28a66 100644
--- a/pages/home/index.vue
+++ b/pages/home/index.vue
@@ -91,8 +91,14 @@
 					<text>涓婃灦</text>
 				</navigator>
 			</view>
+			<view class="cu-item">
+				<navigator hover-class='none' url="/pages/phyz/inStock/inStock" navigateTo>
+					<view class="cuIcon-punch text-blue">
+					</view>
+					<text>鍏ュ簱涓婃灦</text>
+				</navigator>
+			</view>
 		</view>
-
 
 		<view class="padding flex flex-direction">
 			<view class="cu-btn bg-red margin-tb-sm lg round" @click="equit">閫�鍑虹櫥褰�</view>
diff --git a/pages/phyz/inStock/inStock.vue b/pages/phyz/inStock/inStock.vue
new file mode 100644
index 0000000..ce7b76b
--- /dev/null
+++ b/pages/phyz/inStock/inStock.vue
@@ -0,0 +1,287 @@
+<template>
+	<view class="has-foot">
+		<form>
+			<view class="cu-form-group margin-top">
+				<view class="title">瀹瑰櫒缂栧彿</view>
+				<input placeholder="璇锋壂瀹瑰櫒缂栧彿" v-model="barcode"></input>
+				<text class='cuIcon-search text-blue' @click="search"></text>
+			</view>
+			<view class="cu-form-group margin-bottom">
+				<view class="title">鐩爣绔欑偣</view>
+				<uni-data-select v-model="value" :localdata="range" placement="bottom"
+					@change="selChange"></uni-data-select>
+			</view>
+			<view class="cu-form-group ">
+				<view class="title">鐩爣搴撲綅</view>
+				<input placeholder="璇烽�夋嫨鐩爣搴撲綅" v-model="curCode"></input>
+				<text class='cu-btn  bg-red tj' @click="open">鎺ㄨ崘</text>
+			</view>
+		</form>
+		<view class="cu-list det menu sm-border  padding">
+			<block v-for="(item, index) in list" :key="index">
+				<view class="cu-bar bg-white solid-bottom margin-top-sm">
+					<view class="action">
+						<view class="index">
+							{{index+1}}
+						</view>
+						<view class="text-blue">
+							{{`${item.maktx}`}}
+						</view>
+					</view>
+					<!-- 	<view class="action" >
+						<text @click="remove(index)" class="cuIcon-close text-red" style="font-size: 24px;"></text>
+					</view> -->
+				</view>
+				<view class="cu-item">
+					<view class="content">
+						<text class="text-black">ASN:</text>
+					</view>
+					<view class="action">
+						<text class="text-grey ">{{item.asnCode}}</text>
+					</view>
+				</view>
+				<view class="cu-item">
+					<view class="content">
+						<text class="text-black">渚涘簲鍟嗘壒娆�:</text>
+					</view>
+					<view class="action">
+						<text class="text-grey">{{item.splrBatch}}</text>
+					</view>
+				</view>
+				<view class="cu-item">
+					<view class="content">
+						<text class="text-black">搴撳瓨鎵规:</text>
+					</view>
+					<view class="action">
+						<text class="text-grey ">{{item.batch}}</text>
+					</view>
+				</view>
+				<view class="cu-item">
+					<view class="content">
+						<text class="text-black">鏀惰揣鏁伴噺:</text>
+					</view>
+					<view class="action">
+						<text class="text-grey ">{{item.anfme}}</text>
+					</view>
+				</view>
+
+			</block>
+		</view>
+		<view class="cu-bar btn-group foot">
+			<button class="cu-btn text-blue line-blue shadow" @click="clear">娓呯┖</button>
+			<button class="cu-btn bg-blue shadow-blur" @click="confirm">涓婃灦</button>
+		</view>
+		<uni-popup ref="popup" class="cu-popup">
+			<view class="popup-content">
+				<view class="head">
+					<text>鎺ㄨ崘</text>
+					<text class='cuIcon-close text-red close' @click="close"></text>
+				</view>
+				<div class="body">
+					<view class="cu-list grid col-3 no-border">
+						<view class="item" v-for="el in locs">
+							<view class="cu-btn round  sm" :class="[el===curCode?'bg-blue':'line-blue']"
+								@click="itemChange(el)">{{el.text}}</view>
+						</view>
+					</view>
+				</div>
+<!-- 				<view class="cu-bar btn-group ">
+					<button class="cu-btn bg-blue shadow-blur" @click="popupSubmit">鎻愪氦</button>
+				</view> -->
+			</view>
+		</uni-popup>
+	</view>
+</template>
+
+<script>
+	import {
+		request
+	} from '../../../common/request.js'
+	import {
+		mapState,
+		mapMutations,
+		mapActions,
+		mapGetters
+	} from 'vuex';
+	export default {
+		data() {
+			return {
+				barcode: '',
+				areaName: '',
+				locCode: '',
+				container: '',
+				list: [],
+				range: [],
+				locs: [],
+				curCode: '',
+				selectSite: '',
+			}
+		},
+		computed: {
+			...mapState('user', ['dynamicFields']),
+		},
+		mounted() {
+			this.getRece();
+			this.getLocs();
+			// this.whAreaId = uni.getStorageSync('whAreaId')
+			
+		},
+		methods: {
+			async search() {
+				const {
+					code,
+					data,
+					msg
+				} = await request(`/pakin/info/${this.barcode}`)
+				if (code === 200) {
+					this.list = data;
+					// this.range = data.locArea.locs.map(el => el.code)
+					// this.curCode = this.range[0]
+					// this.areaName = data.locArea.areaName
+				} else {
+					uni.showToast({
+						title: msg,
+						icon: "none",
+					})
+				}
+			},
+
+			remove(index) {
+				this.list.splice(index, 1);
+			},
+			clear() {
+				this.list = []
+				this.range = []
+				this.locs = []
+				this.curCode = ''
+				this.areaName = ''
+				this.barcode = ''
+			},
+
+			open() {
+				this.$refs.popup.open()
+			},
+
+			close() {
+				this.$refs.popup.close()
+			},
+
+			popupSubmit() {
+				this.$refs.popup.close()
+			},
+			itemChange(el) {
+				this.$refs.popup.close()
+				this.curCode = el.text
+			},
+			
+			selChange(e) {
+				this.selectSite = e
+			},
+
+			async confirm() {
+				const {
+					code,
+					data,
+					msg
+				} = await request(`/pakin/task/`
+					, {
+						site: this.selectSite,
+						locCode: this.curCode,
+						barcode: this.barcode
+					}
+				)
+				if (code === 200) {
+					uni.showToast({
+						title: '涓婃灦鎴愬姛'
+					})
+					this.clear()
+				} else {
+					uni.showToast({
+						title: msg,
+						icon: "none",
+					})
+				}
+			},
+			async getRece() {
+				const {
+					code,
+					data,
+					msg
+				} = await request('/inStock/sites', {}, 'get')
+				if (code === 200) {
+					this.range = data.map(item => ({
+						value: item.id,
+						text: item.name + " -- " + item.site
+					}));
+				}
+			},
+			async getLocs() {
+				const {
+					code,
+					data,
+					msg
+				} = await request('/locs/list', {}, 'get')
+				if (code === 200) {
+					
+					this.locs = data.map(item => ({
+						value: item.id,
+						text: item.code
+					}));
+				}
+			},
+
+		}
+	}
+</script>
+
+<style>
+	.index {
+		border: 1px solid #e54d42;
+		color: #e54d42;
+		border-radius: 50%;
+		display: block;
+		width: 50rpx;
+		height: 50rpx;
+		line-height: 48rpx;
+		text-align: center;
+		margin-right: 20rpx;
+		font-size: 30rpx;
+	}
+
+	.text-blue {
+		color: #0081ff !important;
+
+	}
+
+	.item {
+		position: relative;
+		display: flex;
+		min-height: 80upx;
+		align-items: center;
+	}
+
+	.uni-file-picker {
+		width: 100%;
+		margin-bottom: 10px;
+	}
+
+	.uni-select__selector {
+		z-index: 999;
+	}
+
+	.tj {
+		height: auto;
+		padding: 6px 8px;
+		display: inline-block;
+		border-radius: 6px;
+	}
+
+	.item {
+		display: flex;
+		justify-content: center;
+	}
+
+	.item .cu-btn {
+		font-size: 26upx;
+	}
+</style>
\ No newline at end of file

--
Gitblit v1.9.1