From a2299a6d4a6f99e9c11132138f5d3e9ec68f03ea Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 06 六月 2025 19:19:34 +0800
Subject: [PATCH] 开发更新

---
 h5/pages/inventory/detail.vue |  192 ++++++++++++++++++++++++++++-------------------
 1 files changed, 115 insertions(+), 77 deletions(-)

diff --git a/h5/pages/inventory/detail.vue b/h5/pages/inventory/detail.vue
index 02fec9f..268f979 100644
--- a/h5/pages/inventory/detail.vue
+++ b/h5/pages/inventory/detail.vue
@@ -2,42 +2,42 @@
 	<view class="main_app">
 		<view class="main_head">
 			<view class="tabs">
-				<view class="tab" :class="{active: activeTab == 0}" @click="tabsClick(0)">
-					<text>鏈洏({{info.unFinishAmount || 0}})</text>
+				<view class="tab" :class="{ active: activeTab == 0 }" @click="tabsClick(0)">
+					<text>鏈洏({{ info.unFinishAmount || 0 }})</text>
 					<text class="border"></text>
 				</view>
-				<view class="tab" :class="{active: activeTab == 1}" @click="tabsClick(1)">
-					<text>宸茬洏({{info.finishAmount || 0}})</text>
+				<view class="tab" :class="{ active: activeTab == 1 }" @click="tabsClick(1)">
+					<text>宸茬洏({{ info.finishAmount || 0 }})</text>
 					<text class="border"></text>
 				</view>
 			</view>
 			<view class="head_wrap">
 				<view class="search_wrap">
 					<image class="mr12 search" src="@/static/home/ic_search@2x.png" mode="widthFix"></image>
-					<input v-model="param.materialCode" @confirm="handleQuery" type="text" placeholder="鎼滅储璧勪骇缂栫爜/璧勪骇鍚嶇О"
+					<input v-model="param.materialCode" @confirm="handleQuery()" type="text" placeholder="鎼滅储鐗╂枡缂栫爜/鐗╂枡鍚嶇О"
 						placeholder-class="placeholder9" />
 				</view>
 			</view>
 			<!--  -->
 			<scroll-view scroll-y="true" class="scroll_Y" @scrolltolower="scrolltolower">
 				<view class="list">
-					<view class="item" v-for="item in list">
-						<view class="line">
-							<view class="title">{{item.materialName}}</view>
+					<view class="item" v-for="item in list" @click="itemClick(item)">
+						<view class="head">
+							<view class="title">{{ item.materialName }}</view>
 							<view class="status red" v-if="item.type == 1">鐩樹簭</view>
 							<view class="status primaryColor" v-if="item.type == 2">鐩樼泩</view>
 						</view>
-						<view class="line">璧勪骇缂栫爜锛歿{item.materialCode}}</view>
-						<view class="line">鏉$爜锛歿{item.materialQrcode}}</view>
-						<view class="line">瑙勬牸鍨嬪彿锛歿{item.materialAttr}}</view>
-						<view class="line">
-							<view class="">璐﹂潰鏁伴噺锛歿{item.stock}}{{item.materialUnitName}}</view>
-							<view v-if="item.status == 0" @click="openEheck(item)" class="btn">鎵ц鐩樼偣</view>
+						<view class="line">鐗╂枡缂栫爜锛歿{ item.materialCode }}</view>
+						<view class="line">鏉$爜锛歿{ item.materialQrcode }}</view>
+						<view class="line">瑙勬牸鍨嬪彿锛歿{ item.materialAttr }}</view>
+						<view class="line" v-if="item.status == 0">
+							<view class="">璐﹂潰鏁伴噺锛歿{ item.stock }}{{ item.materialUnitName }}</view>
+							<view v-if="info.status == 1" @click.stop="openEheck(item)" class="btn">鎵ц鐩樼偣</view>
 						</view>
 						<view class="static" v-if="item.status == 1">
 							<view class="ite">
 								<view class="la">璐﹂潰鏁伴噺锛�</view>
-								<view class="val">{{item.stock}}</view>
+								<view class="val">{{ item.stock }}</view>
 							</view>
 							<view class="spi"></view>
 							<view class="ite">
@@ -45,18 +45,18 @@
 								<view class="val" :class="{
 									primaryColor: item.type == 2,
 									red: item.type == 1,
-								}">{{item.actStock}}</view>
+								}">{{ item.actStock }}</view>
 							</view>
 						</view>
 					</view>
 				</view>
 			</scroll-view>
 			<view class="footer_btn">
-				<view @click="openQrcode" v-if="activeTab== 0" class="sweep">
+				<view @click="openQrcode" v-if="activeTab == 0 && info.status == 1" class="sweep">
 					<image src="@/static/side/ic_saoma@2x.png" mode=""></image>
 					<view class="">鎵爜鐩樼偣</view>
 				</view>
-				<view @click="showTip = true" v-if="activeTab== 1" class="sweep sub_result">
+				<view @click="showTip = true" v-if="activeTab == 1 && info.status == 1" class="sweep sub_result">
 					<view class="">鎻愪氦鐩樼偣缁撴灉</view>
 				</view>
 			</view>
@@ -64,39 +64,44 @@
 			<u-popup :show="showModal" :round="10" @close="showModal = false" closeOnClickOverlay>
 				<view class="modal_wrap">
 					<view class="modal_title">鎵ц鐩樼偣</view>
-					<view class="title">{{modalForm.materialName}}</view>
-					<view class="item">璧勪骇缂栫爜锛歿{modalForm.materialCode}}</view>
-					<view class="item">鏉$爜锛歿{modalForm.materialQrcode}}</view>
-					<view class="item">鍝佺墝锛歿{modalForm.materialBrand}}</view>
-					<view class="item">瑙勬牸鍨嬪彿锛歿{modalForm.materialAttr}}</view>
-					<view class="item">鎵�鍦ㄤ粨搴擄細{{modalForm.warehouseName}}</view>
+					<view class="title">{{ modalForm.materialName }}</view>
+					<view class="item">鐗╂枡缂栫爜锛歿{ modalForm.materialCode }}</view>
+					<view class="item">鏉$爜锛歿{ modalForm.materialQrcode }}</view>
+					<view class="item">鍝佺墝锛歿{ modalForm.materialBrand }}</view>
+					<view class="item">瑙勬牸鍨嬪彿锛歿{ modalForm.materialAttr }}</view>
+					<view class="item">鎵�鍦ㄤ粨搴擄細{{ modalForm.warehouseName }}</view>
 					<view class="content">
 						<view class="line">
 							<view class="la">璐﹂潰鏁伴噺锛�</view>
 							<view class="val">
-								<view class="wrap">{{modalForm.stock}}</view>
-								<view class="unit">{{modalForm.materialUnitName}}</view>
+								<view class="wrap">{{ modalForm.stock }}</view>
+								<view class="unit">{{ modalForm.materialUnitName }}</view>
 							</view>
 						</view>
 						<view class="line">
 							<view class="la">鐩樼偣鏁伴噺锛�</view>
 							<view class="val">
 								<view class="wrap">
-									<image v-if="!modalForm.actStock" src="@/static/side/btn_jian_grey@2x.png" mode=""></image>
-									<image v-else @click="changeAct(-1)" src="@/static/side/btn_jian@3x.png" mode=""></image>
-									<input type="number" v-model="modalForm.actStock"></input>
-									<image @click="changeAct(1)" src="@/static/side/btn_jia@3x.png" mode=""></image>
+									<template v-if="!modalForm.handleType">
+										<image v-if="!modalForm.actStock" src="@/static/side/btn_jian_grey@2x.png" mode=""></image>
+										<image v-else @click="changeAct(-1)" src="@/static/side/btn_jian@3x.png" mode=""></image>
+									</template>
+									<input :disabled="Boolean(modalForm.handleType && modalForm.handleType == 'detail')" type="digit"
+										v-model="modalForm.actStock"></input>
+									<image v-if="!modalForm.handleType" @click="changeAct(1)" src="@/static/side/btn_jia@3x.png" mode="">
+									</image>
 								</view>
-								<view class="unit">{{modalForm.materialUnitName}}</view>
+								<view class="unit">{{ modalForm.materialUnitName }}</view>
 							</view>
 						</view>
 					</view>
 					<view class="remark">
 						<view class="la">澶囨敞锛�</view>
-						<textarea v-model="modalForm.remark" placeholder="璇峰~鍐欏娉�" :maxlength="-1" placeholder-class="placeholder9"
-							cols="30" rows="10"></textarea>
+						<textarea v-model="modalForm.remark"
+							:disabled="Boolean(modalForm.handleType && modalForm.handleType == 'detail')" placeholder="璇峰~鍐欏娉�"
+							:maxlength="-1" placeholder-class="placeholder9" cols="30" rows="10"></textarea>
 					</view>
-					<view class="btns">
+					<view v-if="!modalForm.handleType" class="btns">
 						<view class="btn" @click="showModal = false">鍙栨秷</view>
 						<view class="btn sub" @click="onSubmit">鎻愪氦</view>
 					</view>
@@ -128,12 +133,12 @@
 	import {
 		ywStocktakingDetail,
 		getYwStocktakingRecord,
-		takingDataOpen,
+		takingDataOpen,
 		ywStocktaFinishById
 	} from '@/api'
 	import {
 		Html5Qrcode
-	} from 'html5-qrcode';
+	} from 'html5-qrcode'
 	export default {
 		data() {
 			return {
@@ -153,7 +158,7 @@
 				html5Qrcode: null,
 				isScaning: false,
 
-			};
+			}
 		},
 		onLoad(op) {
 			this.id = op.id
@@ -161,11 +166,18 @@
 			this.getList()
 		},
 		methods: {
-			checkSub() {
-				const {
-					modalForm
-				} = this
-				// let str = modalForm.unFinishAmount > 0 ? '杩樻湁涓夐」鐗╂枡'
+			itemClick(item) {
+				if (item.status == 1) {
+					this.showItem(item)
+				}
+			},
+			showItem(item) {
+				this.showModal = true
+				this.modalForm = {
+					...item,
+					handleType: this.info.status != 1 ? 'detail' : ''
+				}
+				console.log('modalForm', this.modalForm);
 			},
 			getDetail() {
 				const {
@@ -196,28 +208,38 @@
 						stocktakingId: id,
 						...param
 					}
-				}).then(res => {
-					this.list = [...this.list, ...res.data.records]
-					this.total = res.data.total
-					if(this.param.materialQrcode && this.list.length == 1){
-						this.openEheck(this.list[0])
-						this.$set(this.param, 'materialQrcode', null)
-					}
-					
-					
+				}).then(res => {
+					this.list = [...this.list, ...res.data.records || []]
+					this.total = res.data.total
+					if (this.param.materialQrcode && this.total == 1) {
+						this.openEheck(this.list[0])
+						this.param = {}
+					} else if (this.param.materialQrcode && this.total == 0) {
+						this.param = {}
+						uni.showModal({
+							content: '鏈尮閰嶅埌鐗╂枡锛岃閲嶆柊鎵爜',
+							showCancel: false,
+							success: (res) => {
+								if (res.confirm) {
+									this.getList()
+								}
+							}
+						});
+					}
+
 				})
-			},
-			scrolltolower() {
-				const {
-					total,
-					list
-				} = this
-				if (list.length < total) {
-					this.page = this.page + 1
-					this.getList()
-				} else {
-					this.showToast('鏆傛棤鏇村鏁版嵁')
-				}
+			},
+			scrolltolower() {
+				const {
+					total,
+					list
+				} = this
+				if (list.length < total) {
+					this.page = this.page + 1
+					this.getList()
+				} else {
+					this.showToast('鏆傛棤鏇村鏁版嵁')
+				}
 			},
 			openEheck(item) {
 				this.modalForm = {
@@ -251,19 +273,21 @@
 				this.list = []
 				this.getList()
 			},
-			tipSub() {
-				const { info } = this
-				ywStocktaFinishById(info.id).then(res => {
-					this.showTip = false
-					uni.navigateBack()
+			tipSub() {
+				const {
+					info
+				} = this
+				ywStocktaFinishById(info.id).then(res => {
+					this.showTip = false
+					uni.navigateBack()
 				})
-				
+
 			},
 			openQrcode() {
-				this.isScaning = true;
+				this.isScaning = true
 				Html5Qrcode.getCameras().then((devices) => {
 					if (devices && devices.length) {
-						this.html5Qrcode = new Html5Qrcode('reader');
+						this.html5Qrcode = new Html5Qrcode('reader')
 						this.html5Qrcode.start({
 								facingMode: 'environment'
 							}, {
@@ -272,8 +296,8 @@
 								qrbox: 280 //璁剧疆浜岀淮鐮佹壂鎻忔澶у皬
 							},
 							(decodeText, decodeResult) => {
-								if (decodeText) { //杩欓噷decodeText灏辨槸閫氳繃鎵弿浜岀淮鐮佸緱鍒扮殑鍐呭
-									this.stopScan()
+								if (decodeText) { //杩欓噷decodeText灏辨槸閫氳繃鎵弿浜岀淮鐮佸緱鍒扮殑鍐呭
+									this.stopScan()
 									this.$set(this.param, 'materialQrcode', decodeText)
 									this.handleQuery()
 								}
@@ -281,16 +305,16 @@
 							(err) => {
 								// console.log(err);  //閿欒淇℃伅
 							}
-						);
+						)
 					}
-				});
+				})
 			},
 
 			stopScan() {
 				console.log('鍋滄鎵爜')
-				this.isScaning = false;
+				this.isScaning = false
 				if (this.html5Qrcode) {
-					this.html5Qrcode.stop();
+					this.html5Qrcode.stop()
 				}
 			}
 		}
@@ -388,6 +412,20 @@
 				font-size: 34rpx;
 				color: #222222;
 				margin-bottom: 10rpx;
+				flex: 1;
+			}
+
+			.head {
+				display: flex;
+				// align-items: center;
+				justify-content: space-between;
+				color: #666666;
+
+				.status {
+					width: 76rpx;
+					text-align: right;
+					padding-top: 3rpx;
+				}
 			}
 
 			.line {

--
Gitblit v1.9.3