From f1bcbcb10006807787247219df78e0408742604b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 22 八月 2025 10:59:09 +0800
Subject: [PATCH] 1.采购台账开发联调

---
 src/pages/sales/salesAccount/detail.vue |   34 +++++++++++++++-------------------
 1 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/src/pages/sales/salesAccount/detail.vue b/src/pages/sales/salesAccount/detail.vue
index 56c92a9..bca5e36 100644
--- a/src/pages/sales/salesAccount/detail.vue
+++ b/src/pages/sales/salesAccount/detail.vue
@@ -1,10 +1,7 @@
 <template>
   <view class="account-detail">
-    <!-- 椤堕儴鏍囬鏍� -->
-    <view class="header">
-      <up-icon name="arrow-left" size="20" color="#333" @click="goBack" />
-      <text class="title">鍙拌处璇︽儏</text>
-    </view>
+    <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+		<PageHeader title="鍙拌处璇︽儏" @back="goBack" />
 
          <!-- 琛ㄥ崟鍖哄煙 -->
 		<van-form @submit="onSubmit" label-width="110px" input-align="right" style="margin-top: 10px" error-message-align="right" scroll-to-error scroll-to-error-position="center">
@@ -58,9 +55,9 @@
 			</van-popup>
 			<van-field label="浠樻鏂瑰紡" name="paymentMethod" borderBottom="true" v-model="form.paymentMethod" placeholder="璇疯緭鍏ヤ粯娆炬柟寮�">
 			</van-field>
-			<van-field label="褰曞叆浜�" name="entryPersonName" borderBottom="true" v-model="form.entryPersonName" placeholder="璇疯緭鍏�" readonly>
+			<van-field label="褰曞叆浜�" name="entryPersonName" borderBottom="true" v-model="form.entryPersonName" placeholder="璇疯緭鍏�" disabled>
 			</van-field>
-			<van-field label="褰曞叆鏃ユ湡" name="entryDate" borderBottom="true" v-model="form.entryDate" placeholder="璇疯緭鍏�" readonly>
+			<van-field label="褰曞叆鏃ユ湡" name="entryDate" borderBottom="true" v-model="form.entryDate" placeholder="璇疯緭鍏�" disabled>
 			</van-field>
 			<van-popup v-model:show="showPicker" destroy-on-close position="bottom">
 				<van-picker
@@ -129,7 +126,7 @@
 			<view class="product-section">
 				<view class="section-header">
 					<text class="section-title">浜у搧淇℃伅</text>
-					<van-button type="primary" size="small" @click="addProduct" class="add-btn" icon="plus">鏂板</van-button>
+					<van-button type="primary" size="small" @click="addProduct" class="add-btn" icon="plus"  v-if="operationType !== 'view'">鏂板</van-button>
 				</view>
 				<view class="product-card" v-for="(product, idx) in productData" :key="idx">
 					<!-- 浜у搧绫� -->
@@ -139,7 +136,7 @@
 							<text class="product-productCategory">浜у搧 {{ idx + 1 }}</text>
 						</view>
 						<!-- 鎿嶄綔鎸夐挳 -->
-						<view class="product-actions">
+						<view class="product-actions"  v-if="operationType !== 'view'">
 							<van-button type="danger" size="mini" @click="removeProduct(idx)" class="del-btn" icon="delete">鍒犻櫎</van-button>
 						</view>
 					</view>
@@ -258,7 +255,7 @@
 					</view>
 				</view>
 			</view>
-			<view class="footer-btns">
+			<view class="footer-btns" v-if="operationType !== 'view'">
 				<van-button class="cancel-btn" @click="goBack">鍙栨秷</van-button>
 				<van-button class="save-btn" native-type="submit" form-type="submit">淇濆瓨</van-button>
 			</view>
@@ -343,6 +340,9 @@
 ]);
 
 const addProduct = () => {
+	if (productData.value === null) {
+		productData.value = []
+	}
 	productData.value.push({
     productCategory: '',
     specificationModel: '',
@@ -425,7 +425,8 @@
 	modelList({ id: value }).then((res) => {
 		modelOptions.value = res.map(user => ({
 			text: user.model,
-			value: user.id
+			value: user.id,
+			unit: user.unit,
 		}));
 	});
 };
@@ -596,6 +597,7 @@
 			title: '璇锋坊鍔犱骇鍝佷俊鎭�',
 			icon: 'none'
 		});
+		return
 	}
 	form.value.type = 1;
 	addOrUpdateSalesLedger(form.value).then((res) => {
@@ -608,7 +610,7 @@
 };
 const setUserInfo = () => {
 	form.value.entryPerson = userStore.id;
-	form.value.entryPersonName = userStore.name;
+	form.value.entryPersonName = userStore.nickName;
 	// 璁剧疆褰撳ぉ鏃ユ湡
 	const today = new Date()
 	const year = today.getFullYear()
@@ -724,7 +726,7 @@
 		try {
 			editData.value = JSON.parse(editDataStr);
 			// 濡傛灉鏄紪杈戞ā寮忥紝绛夊緟鏁版嵁鍔犺浇瀹屾垚鍚庡~鍏呰〃鍗曟暟鎹�
-			if (operationType.value === 'edit' && editData.value) {
+			if (operationType.value !== 'add' && editData.value) {
 				// 浣跨敤 nextTick 纭繚鏁版嵁鍔犺浇瀹屾垚鍚庡啀濉厖
 				setTimeout(() => {
 					fillFormData();
@@ -788,9 +790,6 @@
   font-weight: 600;
   color: #333;
 }
-.add-btn {
-  border-radius: 0.25rem;
-}
 .product-card {
 	background: #FFFFFF;
 	box-shadow: 0 0 1.25rem 0 rgba(0,57,117,0.08);
@@ -838,9 +837,6 @@
 }
 .product-form {
   margin-bottom: 1rem;
-}
-.del-btn {
-  border-radius: 0.25rem;
 }
 .footer-btns {
   position: fixed;

--
Gitblit v1.9.3