From 31c32afd520773cba392003c8e2743827fb9ccac Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 27 一月 2026 09:55:39 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_new' into dev_new

---
 src/pages/sales/salesAccount/detail.vue | 1889 ++++++++++++++++++++++++++++------------------------------
 1 files changed, 923 insertions(+), 966 deletions(-)

diff --git a/src/pages/sales/salesAccount/detail.vue b/src/pages/sales/salesAccount/detail.vue
index 0938814..6e7f811 100644
--- a/src/pages/sales/salesAccount/detail.vue
+++ b/src/pages/sales/salesAccount/detail.vue
@@ -1,989 +1,946 @@
 <template>
   <view class="account-detail">
     <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
-		<PageHeader title="鍙拌处璇︽儏" @back="goBack" />
-
-         <!-- 琛ㄥ崟鍖哄煙 -->
-		<up-form @submit="onSubmit" label-width="110" ref="formRef" :rules="rules" :model="form">
-
-			<up-form-item label="閿�鍞悎鍚屽彿" prop="salesContractNo" >
-				<up-input v-model="form.salesContractNo" placeholder="鑷姩鐢熸垚" disabled />
-			</up-form-item>
-			<up-form-item
-				label="涓氬姟鍛�"
-				prop="salesman"
-				required
-				@click="showPicker = true"
-			>
-				<up-input
-					v-model="form.salesman"
-					readonly
-					@click="showPicker = true"
-					placeholder="鐐瑰嚮閫夋嫨涓氬姟鍛�"
-				/>
-				<template #right>
-					<up-icon
-						name="arrow-right"
-						@click="showPicker = true"
-					></up-icon>
-				</template>
-			</up-form-item>
-			<up-form-item label="瀹㈡埛鍚堝悓鍙�" prop="customerContractNo" required >
-				<up-input
-					v-model="form.customerContractNo"
-					placeholder="璇疯緭鍏ュ鎴峰悎鍚屽彿"
-				/>
-			</up-form-item>
-			<up-form-item
-				label="瀹㈡埛鍚嶇О"
-				prop="customerName"
-				required
-			>
-				<up-input
-					v-model="form.customerName"
-					readonly
-					placeholder="鐐瑰嚮閫夋嫨瀹㈡埛"
-					@click="showCustomerPicker = true"
-				/>
-				<template #right>
-					<up-icon
-						name="arrow-right"
-						@click="showCustomerPicker = true"
-					></up-icon>
-				</template>
-			</up-form-item>
-			<up-form-item label="椤圭洰鍚嶇О" prop="projectName" required >
-				<up-input v-model="form.projectName" placeholder="璇疯緭鍏ラ」鐩悕绉�" />
-			</up-form-item>
-			<up-form-item
-				label="绛捐鏃ユ湡"
-				prop="executionDate"
-				required
-			>
-				<up-input
-					v-model="form.executionDate"
-					readonly
-					placeholder="鐐瑰嚮閫夋嫨鏃堕棿"
-					@click="showDatePicker = true"
-				/>
-				<template #right>
-					<up-icon
-						name="arrow-right"
-						@click="showDatePicker = true"
-					></up-icon>
-				</template>
-			</up-form-item>
-			<up-form-item label="浠樻鏂瑰紡" prop="paymentMethod" >
-				<up-input v-model="form.paymentMethod" placeholder="璇疯緭鍏ヤ粯娆炬柟寮�" />
-			</up-form-item>
-			<up-form-item label="褰曞叆浜�" prop="entryPersonName" >
-				<up-input v-model="form.entryPersonName" placeholder="璇疯緭鍏�" disabled />
-			</up-form-item>
-			<up-form-item label="褰曞叆鏃ユ湡" prop="entryDate" >
-				<up-input v-model="form.entryDate" placeholder="璇疯緭鍏�" disabled />
-			</up-form-item>
-			<!-- 涓氬姟鍛橀�夋嫨 -->
-			<up-action-sheet
-				:show="showPicker"
-				:actions="userActionList"
-				title="閫夋嫨涓氬姟鍛�"
-				@select="onSalesmanSelect"
-				@close="showPicker = false"
-			/>
-			
-			<!-- 鏃ユ湡閫夋嫨 -->
-			<up-popup :show="showDatePicker" mode="bottom" @close="showDatePicker = false">
-				<up-datetime-picker
-					:show="true"
-					v-model="pickerDateValue"
-					@confirm="onDateConfirm"
-					@cancel="showDatePicker = false"
-					mode="date"
-				/>
-			</up-popup>
-			<!-- 瀹㈡埛閫夋嫨 -->
-			<up-action-sheet 
-				:show="showCustomerPicker"
-				:actions="customerActionList"
-				title="閫夋嫨瀹㈡埛"
-				@select="onCustomerSelect"
-				@close="showCustomerPicker = false"
-			/>
-			
-			<!-- 浜у搧澶х被閫夋嫨鍣� -->
-			<up-popup :show="showCategoryPicker" mode="bottom">
-				<!-- 澶撮儴鎸夐挳鍖哄煙 -->
-				<view class="popup-header">
-					<view @click="showCategoryPicker = false" class="cancelButton">鍙栨秷</view>
-					<view @click="confirmCategorySelection" class="confirmButton">纭畾</view>
-				</view>
-				<u-tree
-					:data="productOptions"
-					:props="defaultProps"
-					show-checkbox
-					default-expand-all
-					check-strictly
-					@check-change="onCategoryConfirm"
-				/>
-			</up-popup>
-			
-			<!-- 瑙勬牸鍨嬪彿閫夋嫨鍣� -->
-			<up-action-sheet
-				:show="showSpecificationPicker"
-				:actions="specificationActionList"
-				title="閫夋嫨瑙勬牸鍨嬪彿"
-				@select="onSpecificationSelect"
-				@close="showSpecificationPicker = false"
-			/>
-			
-			<!-- 绋庣巼閫夋嫨鍣� -->
-			<up-action-sheet
-				:show="showTaxRatePicker"
-				:actions="taxRateActionList"
-				title="閫夋嫨绋庣巼"
-				@select="onTaxRateSelect"
-				@close="showTaxRatePicker = false"
-			/>
-			
-			<!-- 鍙戠エ绫诲瀷閫夋嫨鍣� -->
-			<up-action-sheet
-				:show="showInvoiceTypePicker"
-				:actions="invoiceTypeActionList"
-				title="閫夋嫨鍙戠エ绫诲瀷"
-				@select="onInvoiceTypeSelect"
-				@close="showInvoiceTypePicker = false"
-			/>
-			<!-- 浜у搧淇℃伅 -->
-			<view class="product-section">
-				<view class="section-header">
-					<view>
-						<text class="section-title">浜у搧淇℃伅</text>
-					</view>
-					<view>
-						<up-button type="primary" size="small" @click="addProduct" class="add-btn" v-if="operationType !== 'view'">
-							鏂板
-						</up-button>
-					</view>
-				</view>
-				<view class="product-card" v-for="(product, idx) in productData" :key="idx">
-					<!-- 浜у搧绫� -->
-					<view class="product-header">
-						<view class="product-title">
-							<view class="document-icon">
-								<up-icon name="file-text" size="16" color="#ffffff"></up-icon>
-							</view>
-							<text class="product-productCategory">浜у搧 {{ idx + 1 }}</text>
-						</view>
-						<!-- 鎿嶄綔鎸夐挳 -->
-						<view class="product-actions" v-if="operationType !== 'view'">
-							<up-button type="error" size="mini" @click="removeProduct(idx)" class="del-btn">
-								鍒犻櫎
-							</up-button>
-						</view>
-					</view>
-					
-					<!-- 浜у搧淇℃伅琛ㄥ崟 -->
-					<view class="product-form">
-						<!-- 浜у搧澶х被 -->
-						<up-form-item
-							label="浜у搧澶х被"
-							prop="productCategory"
+    <PageHeader title="鍙拌处璇︽儏"
+                @back="goBack" />
+    <!-- 琛ㄥ崟鍖哄煙 -->
+    <up-form @submit="onSubmit"
+             label-width="110"
+             ref="formRef"
+             :rules="rules"
+             :model="form">
+      <up-form-item label="閿�鍞悎鍚屽彿"
+                    prop="salesContractNo">
+        <up-input v-model="form.salesContractNo"
+                  placeholder="鑷姩鐢熸垚"
+                  disabled />
+      </up-form-item>
+      <up-form-item label="涓氬姟鍛�"
+                    prop="salesman"
+                    required
+                    @click="showPicker = true">
+        <up-input v-model="form.salesman"
+                  readonly
+                  @click="showPicker = true"
+                  placeholder="鐐瑰嚮閫夋嫨涓氬姟鍛�" />
+        <template #right>
+          <up-icon name="arrow-right"
+                   @click="showPicker = true"></up-icon>
+        </template>
+      </up-form-item>
+      <up-form-item label="瀹㈡埛鍚堝悓鍙�"
+                    prop="customerContractNo"
+                    required>
+        <up-input v-model="form.customerContractNo"
+                  placeholder="璇疯緭鍏ュ鎴峰悎鍚屽彿" />
+      </up-form-item>
+      <up-form-item label="瀹㈡埛鍚嶇О"
+                    prop="customerName"
+                    required>
+        <up-input v-model="form.customerName"
+                  readonly
+                  placeholder="鐐瑰嚮閫夋嫨瀹㈡埛"
+                  @click="showCustomerPicker = true" />
+        <template #right>
+          <up-icon name="arrow-right"
+                   @click="showCustomerPicker = true"></up-icon>
+        </template>
+      </up-form-item>
+      <up-form-item label="椤圭洰鍚嶇О"
+                    prop="projectName"
+                    required>
+        <up-input v-model="form.projectName"
+                  placeholder="璇疯緭鍏ラ」鐩悕绉�" />
+      </up-form-item>
+      <up-form-item label="绛捐鏃ユ湡"
+                    prop="executionDate"
+                    required>
+        <up-input v-model="form.executionDate"
+                  readonly
+                  placeholder="鐐瑰嚮閫夋嫨鏃堕棿"
+                  @click="showDatePicker = true" />
+        <template #right>
+          <up-icon name="arrow-right"
+                   @click="showDatePicker = true"></up-icon>
+        </template>
+      </up-form-item>
+      <up-form-item label="浠樻鏂瑰紡"
+                    prop="paymentMethod">
+        <up-input v-model="form.paymentMethod"
+                  placeholder="璇疯緭鍏ヤ粯娆炬柟寮�" />
+      </up-form-item>
+      <up-form-item label="褰曞叆浜�"
+                    prop="entryPersonName">
+        <up-input v-model="form.entryPersonName"
+                  placeholder="璇疯緭鍏�"
+                  disabled />
+      </up-form-item>
+      <up-form-item label="褰曞叆鏃ユ湡"
+                    prop="entryDate">
+        <up-input v-model="form.entryDate"
+                  placeholder="璇疯緭鍏�"
+                  disabled />
+      </up-form-item>
+      <!-- 涓氬姟鍛橀�夋嫨 -->
+      <up-action-sheet :show="showPicker"
+                       :actions="userActionList"
+                       title="閫夋嫨涓氬姟鍛�"
+                       @select="onSalesmanSelect"
+                       @close="showPicker = false" />
+      <!-- 鏃ユ湡閫夋嫨 -->
+      <up-popup :show="showDatePicker"
+                mode="bottom"
+                @close="showDatePicker = false">
+        <up-datetime-picker :show="true"
+                            v-model="pickerDateValue"
+                            @confirm="onDateConfirm"
+                            @cancel="showDatePicker = false"
+                            mode="date" />
+      </up-popup>
+      <!-- 瀹㈡埛閫夋嫨 -->
+      <up-action-sheet :show="showCustomerPicker"
+                       :actions="customerActionList"
+                       title="閫夋嫨瀹㈡埛"
+                       @select="onCustomerSelect"
+                       @close="showCustomerPicker = false" />
+      <!-- 浜у搧澶х被閫夋嫨鍣� -->
+      <up-popup :show="showCategoryPicker"
+                mode="bottom">
+        <!-- 澶撮儴鎸夐挳鍖哄煙 -->
+        <view class="popup-header">
+          <view @click="showCategoryPicker = false"
+                class="cancelButton">鍙栨秷</view>
+          <view @click="confirmCategorySelection"
+                class="confirmButton">纭畾</view>
+        </view>
+        <u-tree :data="productOptions"
+                :props="defaultProps"
+                show-checkbox
+                default-expand-all
+                check-strictly
+                @check-change="onCategoryConfirm" />
+      </up-popup>
+      <!-- 瑙勬牸鍨嬪彿閫夋嫨鍣� -->
+      <up-action-sheet :show="showSpecificationPicker"
+                       :actions="specificationActionList"
+                       title="閫夋嫨瑙勬牸鍨嬪彿"
+                       @select="onSpecificationSelect"
+                       @close="showSpecificationPicker = false" />
+      <!-- 绋庣巼閫夋嫨鍣� -->
+      <up-action-sheet :show="showTaxRatePicker"
+                       :actions="taxRateActionList"
+                       title="閫夋嫨绋庣巼"
+                       @select="onTaxRateSelect"
+                       @close="showTaxRatePicker = false" />
+      <!-- 鍙戠エ绫诲瀷閫夋嫨鍣� -->
+      <up-action-sheet :show="showInvoiceTypePicker"
+                       :actions="invoiceTypeActionList"
+                       title="閫夋嫨鍙戠エ绫诲瀷"
+                       @select="onInvoiceTypeSelect"
+                       @close="showInvoiceTypePicker = false" />
+      <!-- 浜у搧淇℃伅 -->
+      <view class="product-section">
+        <view class="section-header">
+          <view>
+            <text class="section-title">浜у搧淇℃伅</text>
+          </view>
+          <view>
+            <up-button type="primary"
+                       size="small"
+                       @click="addProduct"
+                       class="add-btn"
+                       v-if="operationType !== 'view'">
+              鏂板
+            </up-button>
+          </view>
+        </view>
+        <view class="product-card"
+              v-for="(product, idx) in productData"
+              :key="idx">
+          <!-- 浜у搧绫� -->
+          <view class="product-header">
+            <view class="product-title">
+              <view class="document-icon">
+                <up-icon name="file-text"
+                         size="16"
+                         color="#ffffff"></up-icon>
+              </view>
+              <text class="product-productCategory">浜у搧 {{ idx + 1 }}</text>
+            </view>
+            <!-- 鎿嶄綔鎸夐挳 -->
+            <view class="product-actions"
+                  v-if="operationType !== 'view'">
+              <up-button type="error"
+                         size="mini"
+                         @click="removeProduct(idx)"
+                         class="del-btn">
+                鍒犻櫎
+              </up-button>
+            </view>
+          </view>
+          <!-- 浜у搧淇℃伅琛ㄥ崟 -->
+          <view class="product-form">
+            <!-- 浜у搧澶х被 -->
+            <up-form-item label="浜у搧澶х被"
+                          prop="productCategory"
+                          required>
+              <up-input v-model="product.productCategory"
+                        readonly
+                        placeholder="璇烽�夋嫨"
+                        @click="openCategoryPicker(idx)" />
+              <template #right>
+                <up-icon name="arrow-right"
+                         @click="showCategoryPicker = true"></up-icon>
+              </template>
+            </up-form-item>
+            <!-- 瑙勬牸鍨嬪彿 -->
+            <up-form-item label="瑙勬牸鍨嬪彿"
+                          prop="specificationModel"
+                          required>
+              <up-input v-model="product.specificationModel"
+                        readonly
+                        placeholder="璇烽�夋嫨"
+                        @click="openSpecificationPicker(idx)" />
+              <template #right>
+                <up-icon name="arrow-right"
+                         @click="showSpecificationPicker = true"></up-icon>
+              </template>
+            </up-form-item>
+            <!-- 缁戝畾鏈哄櫒 -->
+            <!-- <up-form-item
+							label="缁戝畾鏈哄櫒"
+							prop="speculativeTradingName"
 							required
-							:rules="productRules.productCategory"
 						>
 							<up-input
-								v-model="product.productCategory"
-								readonly
-								placeholder="璇烽�夋嫨"
-								@click="openCategoryPicker(idx)"
-							/>
-							<template #right>
-								<up-icon
-									name="arrow-right"
-									@click="showCategoryPicker = true"
-								></up-icon>
-							</template>
-						</up-form-item>
-						
-						<!-- 瑙勬牸鍨嬪彿 -->
-						<up-form-item
-							label="瑙勬牸鍨嬪彿"
-							prop="specificationModel"
-							required
-							:rules="productRules.specificationModel"
-						>
-							<up-input
-								v-model="product.specificationModel"
-								readonly
-								placeholder="璇烽�夋嫨"
-								@click="openSpecificationPicker(idx)"
-							/>
-							<template #right>
-								<up-icon
-									name="arrow-right"
-									@click="showSpecificationPicker = true"
-								></up-icon>
-							</template>
-						</up-form-item>
-						
-						<!-- 鍗曚綅 -->
-						<up-form-item
-							label="鍗曚綅"
-							prop="unit"
-							required
-							:rules="productRules.unit"
-						>
-							<up-input
-								v-model="product.unit"
+							disabled
+								v-model="product.speculativeTradingName"
 								placeholder="璇疯緭鍏�"
 							/>
-						</up-form-item>
-						
-						<!-- 绋庣巼 -->
-						<up-form-item
-							label="绋庣巼(%)"
-							prop="taxRate"
-							required
-							:rules="productRules.taxRate"
-						>
-							<up-input
-								v-model="product.taxRate"
-								readonly
-								placeholder="璇烽�夋嫨"
-								@click="openTaxRatePicker(idx)"
-							/>
-							<template #right>
-								<up-icon
-									name="arrow-right"
-									@click="showTaxRatePicker = true"
-								></up-icon>
-							</template>
-						</up-form-item>
-						
-						<!-- 鍚◣鍗曚环 -->
-						<up-form-item
-							label="鍚◣鍗曚环(鍏�)"
-							prop="taxInclusiveUnitPrice"
-							required
-							:rules="productRules.taxInclusiveUnitPrice"
-						>
-							<up-input
-								v-model="product.taxInclusiveUnitPrice"
-								type="number"
-								placeholder="璇疯緭鍏�"
-								@blur="formatTaxPrice(idx)"
-							/>
-						</up-form-item>
-						
-						<!-- 鏁伴噺 -->
-						<up-form-item
-							label="鏁伴噺"
-							prop="quantity"
-							required
-							:rules="productRules.quantity"
-						>
-							<up-input
-								v-model="product.quantity"
-								type="number"
-								placeholder="璇疯緭鍏�"
-								@blur="formatAmount(idx)"
-							/>
-						</up-form-item>
-						
-						<!-- 鍚◣鎬讳环 -->
-						<up-form-item
-							label="鍚◣鎬讳环(鍏�)"
-							prop="taxInclusiveTotalPrice"
-							required
-							:rules="productRules.taxInclusiveTotalPrice"
-						>
-							<up-input
-								v-model="product.taxInclusiveTotalPrice"
-								type="number"
-								placeholder="璇疯緭鍏�"
-								@blur="formatTaxTotal(idx)"
-							/>
-						</up-form-item>
-						
-						<!-- 涓嶅惈绋庢�讳环 -->
-						<up-form-item
-							label="涓嶅惈绋庢�讳环(鍏�)"
-							prop="taxExclusiveTotalPrice"
-							required
-							:rules="productRules.taxExclusiveTotalPrice"
-						>
-							<up-input
-								v-model="product.taxExclusiveTotalPrice"
-								type="number"
-								placeholder="璇疯緭鍏�"
-								@blur="formatNoTaxTotal(idx)"
-							/>
-						</up-form-item>
-						
-						<!-- 鍙戠エ绫诲瀷 -->
-						<up-form-item
-							label="鍙戠エ绫诲瀷"
-							prop="invoiceType"
-							required
-							:rules="productRules.invoiceType"
-						>
-							<up-input
-								v-model="product.invoiceType"
-								readonly
-								placeholder="璇烽�夋嫨"
-								@click="openInvoiceTypePicker(idx)"
-							/>
-							<template #right>
-								<up-icon
-									name="arrow-right"
-									@click="showInvoiceTypePicker = true"
-								></up-icon>
-							</template>
-						</up-form-item>
-					</view>
-				</view>
-			</view>
-		</up-form>
-		
-		<!-- 浣跨敤鍏叡搴曢儴鎸夐挳缁勪欢 -->
-		<FooterButtons
-			:show="operationType !== 'view'"
-			cancelText="鍙栨秷"
-			confirmText="淇濆瓨"
-			@cancel="goBack"
-			@confirm="onSubmit"
-		/>
+						</up-form-item> -->
+            <!-- 鍗曚綅 -->
+            <up-form-item label="鍗曚綅"
+                          prop="unit"
+                          required>
+              <up-input v-model="product.unit"
+                        placeholder="璇疯緭鍏�" />
+            </up-form-item>
+            <!-- 绋庣巼 -->
+            <up-form-item label="绋庣巼(%)"
+                          prop="taxRate"
+                          required>
+              <up-input v-model="product.taxRate"
+                        readonly
+                        placeholder="璇烽�夋嫨"
+                        @click="openTaxRatePicker(idx)" />
+              <template #right>
+                <up-icon name="arrow-right"
+                         @click="showTaxRatePicker = true"></up-icon>
+              </template>
+            </up-form-item>
+            <!-- 鍚◣鍗曚环 -->
+            <up-form-item label="鍚◣鍗曚环(鍏�)"
+                          prop="taxInclusiveUnitPrice"
+                          required>
+              <up-input v-model="product.taxInclusiveUnitPrice"
+                        type="number"
+                        placeholder="璇疯緭鍏�"
+                        @blur="formatTaxPrice(idx)" />
+            </up-form-item>
+            <!-- 鏁伴噺 -->
+            <up-form-item label="鏁伴噺"
+                          prop="quantity"
+                          required>
+              <up-input v-model="product.quantity"
+                        type="number"
+                        placeholder="璇疯緭鍏�"
+                        @blur="formatAmount(idx)" />
+            </up-form-item>
+            <!-- 鍚◣鎬讳环 -->
+            <up-form-item label="鍚◣鎬讳环(鍏�)"
+                          prop="taxInclusiveTotalPrice"
+                          required>
+              <up-input v-model="product.taxInclusiveTotalPrice"
+                        type="number"
+                        placeholder="璇疯緭鍏�"
+                        @blur="formatTaxTotal(idx)" />
+            </up-form-item>
+            <!-- 涓嶅惈绋庢�讳环 -->
+            <up-form-item label="涓嶅惈绋庢�讳环(鍏�)"
+                          prop="taxExclusiveTotalPrice"
+                          required>
+              <up-input v-model="product.taxExclusiveTotalPrice"
+                        type="number"
+                        placeholder="璇疯緭鍏�"
+                        @blur="formatNoTaxTotal(idx)" />
+            </up-form-item>
+            <!-- 鍙戠エ绫诲瀷 -->
+            <up-form-item label="鍙戠エ绫诲瀷"
+                          prop="invoiceType"
+                          required>
+              <up-input v-model="product.invoiceType"
+                        readonly
+                        placeholder="璇烽�夋嫨"
+                        @click="openInvoiceTypePicker(idx)" />
+              <template #right>
+                <up-icon name="arrow-right"
+                         @click="showInvoiceTypePicker = true"></up-icon>
+              </template>
+            </up-form-item>
+          </view>
+        </view>
+      </view>
+    </up-form>
+    <!-- 浣跨敤鍏叡搴曢儴鎸夐挳缁勪欢 -->
+    <FooterButtons :show="operationType !== 'view'"
+                   cancelText="鍙栨秷"
+                   confirmText="淇濆瓨"
+                   @cancel="goBack"
+                   @confirm="onSubmit" />
   </view>
 </template>
 
 <script setup>
-import {onMounted, ref, computed} from 'vue';
-import {userListNoPage} from "@/api/system/user";
-import { formatDateToYMD } from '@/utils/ruoyi'
-import {
-	addOrUpdateSalesLedger,
-	customerList,
-	getSalesLedgerWithProducts,
-	modelList,
-	productTreeList
-} from "@/api/salesManagement/salesLedger";
-import useUserStore from "@/store/modules/user";
-import {calculateTaxExclusiveTotalPrice} from "@/utils/summarizeTable";
-import PageHeader from '@/components/PageHeader.vue';
-import FooterButtons from '@/components/FooterButtons.vue';
+  import { onMounted, ref, computed } from "vue";
+  import { userListNoPage } from "@/api/system/user";
+  import { formatDateToYMD } from "@/utils/ruoyi";
+  import {
+    addOrUpdateSalesLedger,
+    customerList,
+    getSalesLedgerWithProducts,
+    modelList,
+    productTreeList,
+  } from "@/api/salesManagement/salesLedger";
+  import useUserStore from "@/store/modules/user";
+  import { calculateTaxExclusiveTotalPrice } from "@/utils/summarizeTable";
+  import PageHeader from "@/components/PageHeader.vue";
+  import FooterButtons from "@/components/FooterButtons.vue";
 
-// 鑾峰彇椤甸潰鍙傛暟
-const operationType = ref('');
-const editData = ref(null);
-const formRef = ref(null);
+  // 鑾峰彇椤甸潰鍙傛暟
+  const operationType = ref("");
+  const editData = ref(null);
+  const formRef = ref(null);
 
-const userStore = useUserStore()
-const form = ref({
-	id: '',
-  salesContractNo: '',
-	customerContractNo: '',
-	customerId: '',
-	customerName: '',
-	projectName: '',
-	executionDate: '',
-  paymentMethod: '',
-	entryPerson: '',
-	entryPersonName: '',
-	entryDate: '',
-});
-const showPicker = ref(false);
-const showDatePicker = ref(false);
-const pickerDateValue = ref(Date.now());
-const showCustomerPicker = ref(false);
-const userList = ref([]);
-const customerOption = ref([]);
-const userActionList = computed(() => {
-	return userList.value.map(user => ({
-		name: user.text,
-		value: user.value
-	}))
-})
-const formatter = (type, value) => {
-	if (type === 'year') {
-		return `${value}`;
-	}
-	if (type === 'month') {
-		return `${value}`;
-	}
-	if (type === 'day') {
-		return `${value}`;
-	}
-	return value;
-};
-const customerActionList = computed(() => {
-	return customerOption.value.map(customer => ({
-		name: customer.text,
-		value: customer.value
-	}))
-})
-
-// 鏃ユ湡閫夋嫨鍒楄〃宸茬Щ闄わ紝鏀圭敤 up-datetime-picker
-
-// 浜у搧澶х被閫夋嫨鍒楄〃
-const categoryActionList = computed(() => {
-	const flattenCategories = (categories, result = []) => {
-		categories.forEach(category => {
-			result.push({
-				name: category.label,
-				value: category.id
-			})
-			if (category.children && category.children.length > 0) {
-				flattenCategories(category.children, result)
-			}
-		})
-		return result
-	}
-	return flattenCategories(productOptions.value)
-})
-
-// 瑙勬牸鍨嬪彿閫夋嫨鍒楄〃
-const specificationActionList = computed(() => {
-	return modelOptions.value.map(model => ({
-		name: model.text,
-		value: model.value,
-		unit: model.unit
-	}))
-})
-
-// 绋庣巼閫夋嫨鍒楄〃
-const taxRateActionList = computed(() => {
-	return taxRateOptions.value.map(rate => ({
-		name: rate.text,
-		value: rate.value
-	}))
-})
-
-// 鍙戠エ绫诲瀷閫夋嫨鍒楄〃
-const invoiceTypeActionList = computed(() => {
-	return invoiceTypeOptions.value.map(type => ({
-		name: type.text,
-		value: type.value
-	}))
-})
-const productData = ref([]);
-
-// 閫夋嫨鍣ㄧ浉鍏冲彉閲�
-const showCategoryPicker = ref(false);
-const showSpecificationPicker = ref(false);
-const showTaxRatePicker = ref(false);
-const showInvoiceTypePicker = ref(false);
-// 閫夋嫨鍣ㄦ樉绀虹姸鎬佸彉閲忓凡鍦ㄤ笂闈㈠畾涔�
-
-// 涓存椂鍙橀噺宸蹭笉鍐嶉渶瑕�
-const currentProductIndex = ref(0);
-
-// 閫夐」鏁版嵁
-const productOptions = ref([]);
-const selectedCategoryNode = ref(null);
-const defaultProps = ref({
-	children: 'children',
-	label: 'label',
-	nodeKey: 'id'
-});
-
-const modelOptions = ref([]);
-// 闃叉寰幆璁$畻鐨勬爣蹇�
-// const isCalculating = ref(false);
-const taxRateOptions = ref([
-  { text: '1', value: '1' },
-  { text: '6', value: '6' },
-  { text: '13', value: '13' },
-]);
-
-const invoiceTypeOptions = ref([
-  { text: '澧炴櫘绁�', value: '澧炴櫘绁�' },
-  { text: '澧炰笓绁�', value: '澧炰笓绁�' },
-]);
-
-// 琛ㄥ崟鏍¢獙瑙勫垯
-const rules = {
-	salesman: [
-		{ required: true, message: '璇烽�夋嫨涓氬姟鍛�', trigger: 'change' }
-	],
-	customerContractNo: [
-		{ required: true, message: '璇疯緭鍏ュ鎴峰悎鍚屽彿', trigger: 'blur' }
-	],
-	customerName: [
-		{ required: true, message: '璇烽�夋嫨瀹㈡埛鍚嶇О', trigger: 'change' }
-	],
-	projectName: [
-		{ required: true, message: '璇疯緭鍏ラ」鐩悕绉�', trigger: 'blur' }
-	],
-	executionDate: [
-		{ required: true, message: '璇烽�夋嫨绛捐鏃ユ湡', trigger: 'change' }
-	]
-};
-
-// 浜у搧淇℃伅鏍¢獙瑙勫垯
-const productRules = {
-	productCategory: [
-		{ required: true, message: '璇烽�夋嫨浜у搧澶х被', trigger: 'change' }
-	],
-	specificationModel: [
-		{ required: true, message: '璇烽�夋嫨瑙勬牸鍨嬪彿', trigger: 'change' }
-	],
-	unit: [
-		{ required: true, message: '璇疯緭鍏ュ崟浣�', trigger: 'blur' }
-	],
-	taxRate: [
-		{ required: true, message: '璇烽�夋嫨绋庣巼', trigger: 'change' }
-	],
-	taxInclusiveUnitPrice: [
-		{ required: true, message: '璇疯緭鍏ュ惈绋庡崟浠�', trigger: 'blur' },
-		{ type: 'number', min: 0, message: '鍚◣鍗曚环蹇呴』澶т簬0', trigger: 'blur' }
-	],
-	quantity: [
-		{ required: true, message: '璇疯緭鍏ユ暟閲�', trigger: 'blur' },
-		{ type: 'number', min: 0, message: '鏁伴噺蹇呴』澶т簬0', trigger: 'blur' }
-	],
-	taxInclusiveTotalPrice: [
-		{ required: true, message: '璇疯緭鍏ュ惈绋庢�讳环', trigger: 'blur' },
-		{ type: 'number', min: 0, message: '鍚◣鎬讳环蹇呴』澶т簬0', trigger: 'blur' }
-	],
-	taxExclusiveTotalPrice: [
-		{ required: true, message: '璇疯緭鍏ヤ笉鍚◣鎬讳环', trigger: 'blur' },
-		{ type: 'number', min: 0, message: '涓嶅惈绋庢�讳环蹇呴』澶т簬0', trigger: 'blur' }
-	],
-	invoiceType: [
-		{ required: true, message: '璇烽�夋嫨鍙戠エ绫诲瀷', trigger: 'change' }
-	]
-};
-
-const addProduct = () => {
-	if (productData.value === null) {
-		productData.value = []
-	}
-	productData.value.push({
-    productCategory: '',
-    specificationModel: '',
-		productModelId: '',
-    unit: '',
-    taxRate: '',
-    taxInclusiveUnitPrice: '',
-    quantity: '',
-    taxInclusiveTotalPrice: '',
-    taxExclusiveTotalPrice: '',
-    invoiceType: ''
+  const userStore = useUserStore();
+  const form = ref({
+    id: "",
+    salesContractNo: "",
+    customerContractNo: "",
+    customerId: "",
+    customerName: "",
+    projectName: "",
+    executionDate: "",
+    paymentMethod: "",
+    entryPerson: "",
+    entryPersonName: "",
+    entryDate: "",
   });
-};
-// 涓氬姟鍛橀�夋嫨浜嬩欢
-const onSalesmanSelect = (item) => {
-	form.value.salesman = item.name
-}
-
-// 鏃ユ湡纭浜嬩欢
-const onDateConfirm = (e) => {
-	form.value.executionDate = formatDateToYMD(e.value)
-	// 淇濇寔pickerDateValue涓烘椂闂存埑鏍煎紡锛岃�屼笉鏄牸寮忓寲鐨勫瓧绗︿覆
-	pickerDateValue.value = e.value
-	showDatePicker.value = false;
-}
-
-// 瀹㈡埛閫夋嫨浜嬩欢
-const onCustomerSelect = (item) => {
-	form.value.customerName = item.name
-	form.value.customerId = item.value
-}
-
-// 鍘熸湁鐨勭‘璁ゆ柟娉曞凡琚柊鐨刟ction-sheet閫夋嫨鏂规硶鏇夸唬
-const removeProduct = (idx) => {
-	productData.value.splice(idx, 1);
-};
-
-// 鏄剧ず閫夋嫨鍣�
-const openCategoryPicker = (idx) => {
-  currentProductIndex.value = idx;
-  showCategoryPicker.value = true;
-};
-
-const openSpecificationPicker = (idx) => {
-  currentProductIndex.value = idx;
-  showSpecificationPicker.value = true;
-};
-
-const openTaxRatePicker = (idx) => {
-  currentProductIndex.value = idx;
-  showTaxRatePicker.value = true;
-};
-
-const openInvoiceTypePicker = (idx) => {
-  currentProductIndex.value = idx;
-  showInvoiceTypePicker.value = true;
-};
-
-// 閫夋嫨鍣ㄧ‘璁や簨浠�
-const onCategoryConfirm = (node) => {
-	// 鑾峰彇閫変腑鐨勮妭鐐逛俊鎭�
-	console.log('selected node---', node);
-	// 瀛樺偍閫変腑鐨勮妭鐐癸紝鐢ㄤ簬纭鏃惰幏鍙栨暟鎹�
-	selectedCategoryNode.value = node;
-};
-
-// 纭浜у搧澶х被閫夋嫨
-const confirmCategorySelection = () => {
-	if (selectedCategoryNode.value) {
-		// 璁剧疆閫変腑鐨勪骇鍝佸ぇ绫�
-		productData.value[currentProductIndex.value].productCategory = selectedCategoryNode.value.label;
-		const id = selectedCategoryNode.value.id
-		// 閲嶇疆閫変腑鐨勮妭鐐�
-		selectedCategoryNode.value = null;
-		productData.value[currentProductIndex.value].specificationModel = ''
-		productData.value[currentProductIndex.value].productModelId = ''
-		getModels(id)
-	}
-	showCategoryPicker.value = false;
-};
-// 鑾峰彇瑙勬牸鍨嬪彿
-const getModels = (value) => {
-	modelList({ id: value }).then((res) => {
-		modelOptions.value = res.map(user => ({
-			text: user.model,
-			value: user.id,
-			unit: user.unit,
-		}));
-	});
-};
-// 瑙勬牸鍨嬪彿閫夋嫨浜嬩欢
-const onSpecificationSelect = (item) => {
-	productData.value[currentProductIndex.value].specificationModel = item.name
-	productData.value[currentProductIndex.value].productModelId = item.value
-	productData.value[currentProductIndex.value].unit = item.unit
-}
-// 绋庣巼閫夋嫨浜嬩欢
-const onTaxRateSelect = (item) => {
-	productData.value[currentProductIndex.value].taxRate = item.value
-	// 閲嶆柊璁$畻涓嶅惈绋庢�讳环
-	const inclusiveTotalPrice = parseFloat(productData.value[currentProductIndex.value].taxInclusiveTotalPrice)
-	const taxRate = parseFloat(item.value)
-	if (inclusiveTotalPrice && taxRate) {
-		productData.value[currentProductIndex.value].taxExclusiveTotalPrice =
-			calculateTaxExclusiveTotalPrice(inclusiveTotalPrice, taxRate)
-	}
-};
-
-// 鍙戠エ绫诲瀷閫夋嫨浜嬩欢
-const onInvoiceTypeSelect = (item) => {
-	productData.value[currentProductIndex.value].invoiceType = item.name
-};
-
-// 鏍煎紡鍖栧嚱鏁� - 鍥哄畾涓や綅灏忔暟
-const formatTaxPrice = (idx) => {
-  if (productData.value[idx].taxInclusiveUnitPrice) {
-    const value = parseFloat(productData.value[idx].taxInclusiveUnitPrice);
-    if (!isNaN(value)) {
-			productData.value[idx].taxInclusiveUnitPrice = value.toFixed(2);
+  const showPicker = ref(false);
+  const showDatePicker = ref(false);
+  const pickerDateValue = ref(Date.now());
+  const showCustomerPicker = ref(false);
+  const userList = ref([]);
+  const customerOption = ref([]);
+  const userActionList = computed(() => {
+    return userList.value.map(user => ({
+      name: user.text,
+      value: user.value,
+    }));
+  });
+  const formatter = (type, value) => {
+    if (type === "year") {
+      return `${value}`;
     }
-  }
-	if (!productData.value[currentProductIndex.value].taxRate) {
-		uni.showToast({
-			title: '璇峰厛閫夋嫨绋庣巼',
-			icon: 'none'
-		});
-		return;
-	}
-	const quantity = parseFloat(productData.value[currentProductIndex.value].quantity);
-	const unitPrice = parseFloat(productData.value[currentProductIndex.value].taxInclusiveUnitPrice);
-	
-	if (!quantity || quantity <= 0 || !unitPrice) {
-		return;
-	}
-	// 璁$畻鍚◣鎬讳环
-	productData.value[currentProductIndex.value].taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
-	
-	// 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
-	if (productData.value[currentProductIndex.value].taxRate) {
-		productData.value[currentProductIndex.value].taxExclusiveTotalPrice =
-			calculateTaxExclusiveTotalPrice(
-				productData.value[currentProductIndex.value].taxInclusiveTotalPrice,
-				productData.value[currentProductIndex.value].taxRate
-			);
-	}
-};
-// 鏁伴噺杈撳叆妗嗗け鐒�
-const formatAmount = (idx) => {
-  if (productData.value[idx].quantity) {
-    const value = parseFloat(productData.value[idx].quantity);
-    if (!isNaN(value)) {
-			productData.value[idx].quantity = value.toFixed(2);
+    if (type === "month") {
+      return `${value}`;
     }
-  }
-	if (!productData.value[currentProductIndex.value].taxRate) {
-		uni.showToast({
-			title: '璇峰厛閫夋嫨绋庣巼',
-			icon: 'none'
-		});
-		return;
-	}
-	const quantity = parseFloat(productData.value[currentProductIndex.value].quantity);
-	const unitPrice = parseFloat(productData.value[currentProductIndex.value].taxInclusiveUnitPrice);
-	
-	if (!quantity || quantity <= 0 || !unitPrice) {
-		return;
-	}
-	// 璁$畻鍚◣鎬讳环
-	productData.value[currentProductIndex.value].taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
-	// 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
-	if (productData.value[currentProductIndex.value].taxRate) {
-		productData.value[currentProductIndex.value].taxExclusiveTotalPrice =
-			calculateTaxExclusiveTotalPrice(
-				productData.value[currentProductIndex.value].taxInclusiveTotalPrice,
-				productData.value[currentProductIndex.value].taxRate
-			);
-	}
-};
-// 鍚◣鎬讳环澶辩劍锛屾牴鎹惈绋庢�讳环璁$畻鍚◣鍗曚环鍜屾暟閲�
-const formatTaxTotal = (idx) => {
-  if (productData.value[idx].taxInclusiveTotalPrice) {
-    const value = parseFloat(productData.value[idx].taxInclusiveTotalPrice);
-    if (!isNaN(value)) {
-			productData.value[idx].taxInclusiveTotalPrice = value.toFixed(2);
+    if (type === "day") {
+      return `${value}`;
     }
-  }
-	const totalPrice = parseFloat(productData.value[currentProductIndex.value].taxInclusiveTotalPrice);
-	const quantity = parseFloat(productData.value[currentProductIndex.value].quantity);
-	
-	if (!totalPrice || !quantity || quantity <= 0) {
-		return;
-	}
-	// 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
-	productData.value[currentProductIndex.value].taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(2);
-	// 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
-	if (productData.value[currentProductIndex.value].taxRate) {
-		productData.value[currentProductIndex.value].taxExclusiveTotalPrice =
-			calculateTaxExclusiveTotalPrice(
-				totalPrice,
-				productData.value[currentProductIndex.value].taxRate
-			);
-	}
-};
-// 涓嶅惈绋庢�讳环澶辩劍, 鏍规嵁涓嶅惈绋庢�讳环璁$畻鍚◣鍗曚环鍜屾暟閲�
-const formatNoTaxTotal = (idx) => {
-  if (productData.value[idx].taxExclusiveTotalPrice) {
-    const value = parseFloat(productData.value[idx].taxExclusiveTotalPrice);
-    if (!isNaN(value)) {
-			productData.value[idx].taxExclusiveTotalPrice = value.toFixed(2);
-    }
-  }
-	if (!productData.value[currentProductIndex.value].taxRate) {
-		uni.showToast({
-			title: '璇峰厛閫夋嫨绋庣巼',
-			icon: 'none'
-		});
-		return;
-	}
-	const exclusiveTotalPrice = parseFloat(productData.value[currentProductIndex.value].taxExclusiveTotalPrice);
-	const quantity = parseFloat(productData.value[currentProductIndex.value].quantity);
-	const taxRate = parseFloat(productData.value[currentProductIndex.value].taxRate);
-	if (!exclusiveTotalPrice || !quantity || quantity <= 0 || !taxRate) {
-		return;
-	}
-	// 鍏堣绠楀惈绋庢�讳环 = 涓嶅惈绋庢�讳环 / (1 - 绋庣巼/100)
-	const taxRateDecimal = taxRate / 100;
-	const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal);
-	productData.value[currentProductIndex.value].taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2);
-	// 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
-	productData.value[currentProductIndex.value].taxInclusiveUnitPrice = (inclusiveTotalPrice / quantity).toFixed(2);
-};
-const goBack = () => {
-	// 娓呯悊鏈湴瀛樺偍鐨勬暟鎹�
-	uni.removeStorageSync('operationType');
-	uni.removeStorageSync('editData');
-	uni.navigateBack();
-};
-const onSubmit = async () => {
-	// 棣栧厛鏍¢獙鍩烘湰琛ㄥ崟
-	const formValid = await formRef.value.validate().catch(() => false);
-	if (!formValid) {
-		return;
-	}
-	
-	// 鏍¢獙浜у搧淇℃伅
-	if (!productData.value || productData.value.length === 0) {
-		uni.showToast({
-			title: '璇锋坊鍔犱骇鍝佷俊鎭�',
-			icon: 'none'
-		});
-		return;
-	}
-	
-	// 妫�鏌ユ瘡涓骇鍝佹槸鍚﹀~鍐欏畬鏁�
-	for (let i = 0; i < productData.value.length; i++) {
-		const errors = validateProduct(productData.value[i], i);
-		if (errors.length > 0) {
-			uni.showToast({
-				title: errors[0],
-				icon: 'none'
-			});
-			return;
-		}
-	}
-	
-	// 琛ㄥ崟鏍¢獙閫氳繃锛屾彁浜ゆ暟鎹�
-	form.value.productData = JSON.parse(JSON.stringify(productData.value));
-	form.value.type = 1;
-	addOrUpdateSalesLedger(form.value).then((res) => {
-		uni.showToast({
-			title: '鎻愪氦鎴愬姛',
-			icon: 'success',
-		});
-		goBack();
-	});
-};
-const setUserInfo = () => {
-	form.value.entryPerson = userStore.id;
-	form.value.entryPersonName = userStore.nickName;
-	// 璁剧疆褰撳ぉ鏃ユ湡
-	const today = new Date()
-	const year = today.getFullYear()
-	const month = String(today.getMonth() + 1).padStart(2, '0')
-	const day = String(today.getDate()).padStart(2, '0')
-	form.value.entryDate = `${year}-${month}-${day}`
-	// 璁剧疆鏃ユ湡閫夋嫨鍣ㄩ粯璁ゅ�间负浠婂ぉ
-	pickerDateValue.value = `${year}-${month}-${day}`
-}
-// 濉厖琛ㄥ崟鏁版嵁锛堢紪杈戞ā寮忥級
-const fillFormData = () => {
-  if (!editData.value) return;
-	getSalesLedgerWithProducts({ id: editData.value.id, type: 1 }).then((res) => {
-		productData.value = res.productData;
-	});
-	console.log(editData.value)
-  // 濉厖鍩烘湰淇℃伅
-  form.value.salesContractNo = editData.value.salesContractNo || '';
-  form.value.customerContractNo = editData.value.customerContractNo || '';
-  form.value.customerName = editData.value.customerName || '';
-  form.value.projectName = editData.value.projectName || '';
-  form.value.executionDate = editData.value.executionDate || '';
-  form.value.paymentMethod = editData.value.paymentMethod || '';
-  form.value.salesman = editData.value.salesman || '';
-  form.value.entryPerson = editData.value.entryPerson || '';
-  form.value.entryPersonName = editData.value.entryPersonName || '';
-  form.value.entryDate = editData.value.entryDate || '';
-  form.value.id = editData.value.id || '';
-  form.value.customerId = editData.value.customerId || '';
-  
-  // 璁剧疆鏃ユ湡閫夋嫨鍣ㄧ殑鍊�
-  if (editData.value.executionDate) {
-		pickerDateValue.value = editData.value.executionDate
-	}
-};
-const getUserList = () => {
-	userListNoPage().then((res) => {
-		// 绉婚櫎澶氫綑鐨勬暟缁勫寘瑁�
-		userList.value = res.data.map(user => ({
-			text: user.nickName,
-			value: user.nickName
-		}));
-	})
-};
-const getCustomerList = () => {
-	customerList().then((res) => {
-		// 绉婚櫎澶氫綑鐨勬暟缁勫寘瑁�
-		customerOption.value = res.map(item => ({
-			text: item.customerName,
-			value: item.id
-		}));
-	})
-};
-const convertIdToValue = (data) => {
-	// 濡傛灉浼犲叆鐨勪笉鏄暟缁勶紝鍒欒繑鍥炵┖鏁扮粍
-	if (!Array.isArray(data)) {
-		return [];
-	}
-	// 閫掑綊鏄犲皠鍑芥暟
-	return data.map(item => {
-		// 鍒涘缓鏂板璞★紝鏄犲皠瀛楁
-		const mappedItem = {
-			label: item.label, // 鍏抽敭锛氬皢 label 鏄犲皠涓� text
-			id: item.id,       // 淇濈暀 id
-		};
-		// 濡傛灉瀛樺湪 children 鏁扮粍锛屽垯閫掑綊澶勭悊
-		if (item.children && Array.isArray(item.children) && item.children.length > 0) {
-			mappedItem.children = convertIdToValue(item.children);
-		}
-		return mappedItem;
-	});
-};
-// 鑾峰彇浜у搧澶х被tree鏁版嵁
-const getProductOptions = () => {
-	productTreeList().then((res) => {
-		productOptions.value = convertIdToValue(res);
-	});
-};
-// 鍗曚釜浜у搧琛ㄥ崟楠岃瘉鍑芥暟
-const validateProduct = (product, index) => {
-	const errors = [];
-	
-	if (!product.productCategory) {
-		errors.push(`浜у搧${index + 1}锛氳閫夋嫨浜у搧澶х被`);
-	}
-	if (!product.specificationModel) {
-		errors.push(`浜у搧${index + 1}锛氳閫夋嫨瑙勬牸鍨嬪彿`);
-	}
-	if (!product.unit) {
-		errors.push(`浜у搧${index + 1}锛氳杈撳叆鍗曚綅`);
-	}
-	if (!product.taxRate) {
-		errors.push(`浜у搧${index + 1}锛氳閫夋嫨绋庣巼`);
-	}
-	if (!product.taxInclusiveUnitPrice || parseFloat(product.taxInclusiveUnitPrice) <= 0) {
-		errors.push(`浜у搧${index + 1}锛氳杈撳叆鏈夋晥鐨勫惈绋庡崟浠穈);
-	}
-	if (!product.quantity || parseFloat(product.quantity) <= 0) {
-		errors.push(`浜у搧${index + 1}锛氳杈撳叆鏈夋晥鐨勬暟閲廯);
-	}
-	if (!product.taxInclusiveTotalPrice || parseFloat(product.taxInclusiveTotalPrice) <= 0) {
-		errors.push(`浜у搧${index + 1}锛氳杈撳叆鏈夋晥鐨勫惈绋庢�讳环`);
-	}
-	if (!product.taxExclusiveTotalPrice || parseFloat(product.taxExclusiveTotalPrice) <= 0) {
-		errors.push(`浜у搧${index + 1}锛氳杈撳叆鏈夋晥鐨勪笉鍚◣鎬讳环`);
-	}
-	if (!product.invoiceType) {
-		errors.push(`浜у搧${index + 1}锛氳閫夋嫨鍙戠エ绫诲瀷`);
-	}
-	
-	return errors;
-};
+    return value;
+  };
+  const customerActionList = computed(() => {
+    return customerOption.value.map(customer => ({
+      name: customer.text,
+      value: customer.value,
+    }));
+  });
 
-onMounted(() => {
-	// 鑾峰彇椤甸潰鍙傛暟
-	operationType.value = uni.getStorageSync('operationType') || '';
-	
-	// 鑾峰彇浜哄憳鍒楄〃
-	getUserList()
-	// 鑾峰彇瀹㈡埛鍒楄〃
-	getCustomerList()
-	// 鑾峰彇浜у搧澶х被tree鏁版嵁
-	getProductOptions()
-	// 璧嬪�奸粯璁や俊鎭�
-	if (operationType.value === 'add') {
-		setUserInfo()
-	}
-	
-	// 鑾峰彇缂栬緫鏁版嵁骞跺~鍏呰〃鍗�
-	const editDataStr = uni.getStorageSync('editData');
-	if (editDataStr) {
-		try {
-			editData.value = JSON.parse(editDataStr);
-			// 濡傛灉鏄紪杈戞ā寮忥紝绛夊緟鏁版嵁鍔犺浇瀹屾垚鍚庡~鍏呰〃鍗曟暟鎹�
-			if (operationType.value !== 'add' && editData.value) {
-				// 浣跨敤 nextTick 纭繚鏁版嵁鍔犺浇瀹屾垚鍚庡啀濉厖
-				setTimeout(() => {
-					fillFormData();
-				}, 100);
-			}
-		} catch (error) {
-			console.error('瑙f瀽缂栬緫鏁版嵁澶辫触:', error);
-		}
-	}
-});
+  // 鏃ユ湡閫夋嫨鍒楄〃宸茬Щ闄わ紝鏀圭敤 up-datetime-picker
+
+  // 浜у搧澶х被閫夋嫨鍒楄〃
+  const categoryActionList = computed(() => {
+    const flattenCategories = (categories, result = []) => {
+      categories.forEach(category => {
+        result.push({
+          name: category.label,
+          value: category.id,
+        });
+        if (category.children && category.children.length > 0) {
+          flattenCategories(category.children, result);
+        }
+      });
+      return result;
+    };
+    return flattenCategories(productOptions.value);
+  });
+
+  // 瑙勬牸鍨嬪彿閫夋嫨鍒楄〃
+  const specificationActionList = computed(() => {
+    return modelOptions.value.map(model => ({
+      name: model.text,
+      value: model.value,
+      unit: model.unit,
+      speculativeTradingName: model.speculativeTradingName,
+    }));
+  });
+
+  // 绋庣巼閫夋嫨鍒楄〃
+  const taxRateActionList = computed(() => {
+    return taxRateOptions.value.map(rate => ({
+      name: rate.text,
+      value: rate.value,
+    }));
+  });
+
+  // 鍙戠エ绫诲瀷閫夋嫨鍒楄〃
+  const invoiceTypeActionList = computed(() => {
+    return invoiceTypeOptions.value.map(type => ({
+      name: type.text,
+      value: type.value,
+    }));
+  });
+  const productData = ref([]);
+
+  // 閫夋嫨鍣ㄧ浉鍏冲彉閲�
+  const showCategoryPicker = ref(false);
+  const showSpecificationPicker = ref(false);
+  const showTaxRatePicker = ref(false);
+  const showInvoiceTypePicker = ref(false);
+  // 閫夋嫨鍣ㄦ樉绀虹姸鎬佸彉閲忓凡鍦ㄤ笂闈㈠畾涔�
+
+  // 涓存椂鍙橀噺宸蹭笉鍐嶉渶瑕�
+  const currentProductIndex = ref(0);
+
+  // 閫夐」鏁版嵁
+  const productOptions = ref([]);
+  const selectedCategoryNode = ref(null);
+  const defaultProps = ref({
+    children: "children",
+    label: "label",
+    nodeKey: "id",
+  });
+
+  const modelOptions = ref([]);
+  // 闃叉寰幆璁$畻鐨勬爣蹇�
+  // const isCalculating = ref(false);
+  const taxRateOptions = ref([
+    { text: "1", value: "1" },
+    { text: "6", value: "6" },
+    { text: "13", value: "13" },
+  ]);
+
+  const invoiceTypeOptions = ref([
+    { text: "澧炴櫘绁�", value: "澧炴櫘绁�" },
+    { text: "澧炰笓绁�", value: "澧炰笓绁�" },
+  ]);
+
+  // 琛ㄥ崟鏍¢獙瑙勫垯
+  const rules = {
+    salesman: [{ required: true, message: "璇烽�夋嫨涓氬姟鍛�", trigger: "change" }],
+    customerContractNo: [
+      { required: true, message: "璇疯緭鍏ュ鎴峰悎鍚屽彿", trigger: "blur" },
+    ],
+    customerName: [
+      { required: true, message: "璇烽�夋嫨瀹㈡埛鍚嶇О", trigger: "change" },
+    ],
+    projectName: [{ required: true, message: "璇疯緭鍏ラ」鐩悕绉�", trigger: "blur" }],
+    executionDate: [
+      { required: true, message: "璇烽�夋嫨绛捐鏃ユ湡", trigger: "change" },
+    ],
+  };
+
+  const addProduct = () => {
+    if (productData.value === null) {
+      productData.value = [];
+    }
+    productData.value.push({
+      productCategory: "",
+      specificationModel: "",
+      productModelId: "",
+      unit: "",
+      speculativeTradingName: "",
+      taxRate: "",
+      taxInclusiveUnitPrice: "",
+      quantity: "",
+      taxInclusiveTotalPrice: "",
+      taxExclusiveTotalPrice: "",
+      invoiceType: "",
+    });
+  };
+  // 涓氬姟鍛橀�夋嫨浜嬩欢
+  const onSalesmanSelect = item => {
+    form.value.salesman = item.name;
+  };
+
+  // 鏃ユ湡纭浜嬩欢
+  const onDateConfirm = e => {
+    form.value.executionDate = formatDateToYMD(e.value);
+    // 淇濇寔pickerDateValue涓烘椂闂存埑鏍煎紡锛岃�屼笉鏄牸寮忓寲鐨勫瓧绗︿覆
+    pickerDateValue.value = e.value;
+    showDatePicker.value = false;
+  };
+
+  // 瀹㈡埛閫夋嫨浜嬩欢
+  const onCustomerSelect = item => {
+    form.value.customerName = item.name;
+    form.value.customerId = item.value;
+  };
+
+  // 鍘熸湁鐨勭‘璁ゆ柟娉曞凡琚柊鐨刟ction-sheet閫夋嫨鏂规硶鏇夸唬
+  const removeProduct = idx => {
+    productData.value.splice(idx, 1);
+  };
+
+  // 鏄剧ず閫夋嫨鍣�
+  const openCategoryPicker = idx => {
+    currentProductIndex.value = idx;
+    showCategoryPicker.value = true;
+  };
+
+  const openSpecificationPicker = idx => {
+    currentProductIndex.value = idx;
+    showSpecificationPicker.value = true;
+  };
+
+  const openTaxRatePicker = idx => {
+    currentProductIndex.value = idx;
+    showTaxRatePicker.value = true;
+  };
+
+  const openInvoiceTypePicker = idx => {
+    currentProductIndex.value = idx;
+    showInvoiceTypePicker.value = true;
+  };
+
+  // 閫夋嫨鍣ㄧ‘璁や簨浠�
+  const onCategoryConfirm = node => {
+    // 鑾峰彇閫変腑鐨勮妭鐐逛俊鎭�
+    console.log("selected node---", node);
+    // 瀛樺偍閫変腑鐨勮妭鐐癸紝鐢ㄤ簬纭鏃惰幏鍙栨暟鎹�
+    selectedCategoryNode.value = node;
+  };
+
+  // 纭浜у搧澶х被閫夋嫨
+  const confirmCategorySelection = () => {
+    if (selectedCategoryNode.value) {
+      // 璁剧疆閫変腑鐨勪骇鍝佸ぇ绫�
+      productData.value[currentProductIndex.value].productCategory =
+        selectedCategoryNode.value.label;
+      const id = selectedCategoryNode.value.id;
+      // 閲嶇疆閫変腑鐨勮妭鐐�
+      selectedCategoryNode.value = null;
+      productData.value[currentProductIndex.value].specificationModel = "";
+      productData.value[currentProductIndex.value].productModelId = "";
+      getModels(id);
+    }
+    showCategoryPicker.value = false;
+  };
+  // 鑾峰彇瑙勬牸鍨嬪彿
+  const getModels = value => {
+    modelList({ id: value }).then(res => {
+      modelOptions.value = res.map(user => ({
+        text: user.model,
+        value: user.id,
+        unit: user.unit,
+        speculativeTradingName: user.speculativeTradingName,
+      }));
+    });
+  };
+  // 瑙勬牸鍨嬪彿閫夋嫨浜嬩欢
+  const onSpecificationSelect = item => {
+    console.log("selected item---", item);
+    productData.value[currentProductIndex.value].specificationModel = item.name;
+    productData.value[currentProductIndex.value].productModelId = item.value;
+    productData.value[currentProductIndex.value].unit = item.unit;
+    productData.value[currentProductIndex.value].speculativeTradingName =
+      item.speculativeTradingName;
+  };
+  // 绋庣巼閫夋嫨浜嬩欢
+  const onTaxRateSelect = item => {
+    productData.value[currentProductIndex.value].taxRate = item.value;
+    // 閲嶆柊璁$畻涓嶅惈绋庢�讳环
+    const inclusiveTotalPrice = parseFloat(
+      productData.value[currentProductIndex.value].taxInclusiveTotalPrice
+    );
+    const taxRate = parseFloat(item.value);
+    if (inclusiveTotalPrice && taxRate) {
+      productData.value[currentProductIndex.value].taxExclusiveTotalPrice =
+        calculateTaxExclusiveTotalPrice(inclusiveTotalPrice, taxRate);
+    }
+  };
+
+  // 鍙戠エ绫诲瀷閫夋嫨浜嬩欢
+  const onInvoiceTypeSelect = item => {
+    productData.value[currentProductIndex.value].invoiceType = item.name;
+  };
+
+  // 鏍煎紡鍖栧嚱鏁� - 鍥哄畾涓や綅灏忔暟
+  const formatTaxPrice = idx => {
+    if (productData.value[idx].taxInclusiveUnitPrice) {
+      const value = parseFloat(productData.value[idx].taxInclusiveUnitPrice);
+      if (!isNaN(value)) {
+        productData.value[idx].taxInclusiveUnitPrice = value.toFixed(2);
+      }
+    }
+    if (!productData.value[idx].taxRate) {
+      uni.showToast({
+        title: "璇峰厛閫夋嫨绋庣巼",
+        icon: "none",
+      });
+      return;
+    }
+    const quantity = parseFloat(productData.value[idx].quantity);
+    const unitPrice = parseFloat(productData.value[idx].taxInclusiveUnitPrice);
+
+    if (!quantity || quantity <= 0 || !unitPrice) {
+      return;
+    }
+    // 璁$畻鍚◣鎬讳环
+    productData.value[idx].taxInclusiveTotalPrice = (
+      unitPrice * quantity
+    ).toFixed(2);
+
+    // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
+    if (productData.value[idx].taxRate) {
+      productData.value[idx].taxExclusiveTotalPrice =
+        calculateTaxExclusiveTotalPrice(
+          productData.value[idx].taxInclusiveTotalPrice,
+          productData.value[idx].taxRate
+        );
+    }
+  };
+  // 鏁伴噺杈撳叆妗嗗け鐒�
+  const formatAmount = idx => {
+    if (productData.value[idx].quantity) {
+      const value = parseFloat(productData.value[idx].quantity);
+      if (!isNaN(value)) {
+        productData.value[idx].quantity = value.toFixed(2);
+      }
+    }
+    if (!productData.value[idx].taxRate) {
+      uni.showToast({
+        title: "璇峰厛閫夋嫨绋庣巼",
+        icon: "none",
+      });
+      return;
+    }
+    const quantity = parseFloat(productData.value[idx].quantity);
+    const unitPrice = parseFloat(productData.value[idx].taxInclusiveUnitPrice);
+
+    if (!quantity || quantity <= 0 || !unitPrice) {
+      return;
+    }
+    // 璁$畻鍚◣鎬讳环
+    productData.value[idx].taxInclusiveTotalPrice = (
+      unitPrice * quantity
+    ).toFixed(2);
+    // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
+    if (productData.value[idx].taxRate) {
+      productData.value[idx].taxExclusiveTotalPrice =
+        calculateTaxExclusiveTotalPrice(
+          productData.value[idx].taxInclusiveTotalPrice,
+          productData.value[idx].taxRate
+        );
+    }
+  };
+  // 鍚◣鎬讳环澶辩劍锛屾牴鎹惈绋庢�讳环璁$畻鍚◣鍗曚环鍜屾暟閲�
+  const formatTaxTotal = idx => {
+    if (productData.value[idx].taxInclusiveTotalPrice) {
+      const value = parseFloat(productData.value[idx].taxInclusiveTotalPrice);
+      if (!isNaN(value)) {
+        productData.value[idx].taxInclusiveTotalPrice = value.toFixed(2);
+      }
+    }
+    const totalPrice = parseFloat(productData.value[idx].taxInclusiveTotalPrice);
+    const quantity = parseFloat(productData.value[idx].quantity);
+
+    if (!totalPrice || !quantity || quantity <= 0) {
+      return;
+    }
+    // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
+    productData.value[idx].taxInclusiveUnitPrice = (
+      totalPrice / quantity
+    ).toFixed(2);
+    // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
+    if (productData.value[idx].taxRate) {
+      productData.value[idx].taxExclusiveTotalPrice =
+        calculateTaxExclusiveTotalPrice(
+          totalPrice,
+          productData.value[idx].taxRate
+        );
+    }
+  };
+  // 涓嶅惈绋庢�讳环澶辩劍, 鏍规嵁涓嶅惈绋庢�讳环璁$畻鍚◣鍗曚环鍜屾暟閲�
+  const formatNoTaxTotal = idx => {
+    if (productData.value[idx].taxExclusiveTotalPrice) {
+      const value = parseFloat(productData.value[idx].taxExclusiveTotalPrice);
+      if (!isNaN(value)) {
+        productData.value[idx].taxExclusiveTotalPrice = value.toFixed(2);
+      }
+    }
+    if (!productData.value[idx].taxRate) {
+      uni.showToast({
+        title: "璇峰厛閫夋嫨绋庣巼",
+        icon: "none",
+      });
+      return;
+    }
+    const exclusiveTotalPrice = parseFloat(
+      productData.value[idx].taxExclusiveTotalPrice
+    );
+    const quantity = parseFloat(productData.value[idx].quantity);
+    const taxRate = parseFloat(productData.value[idx].taxRate);
+    if (!exclusiveTotalPrice || !quantity || quantity <= 0 || !taxRate) {
+      return;
+    }
+    // 鍏堣绠楀惈绋庢�讳环 = 涓嶅惈绋庢�讳环 / (1 - 绋庣巼/100)
+    const taxRateDecimal = taxRate / 100;
+    const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal);
+    productData.value[idx].taxInclusiveTotalPrice =
+      inclusiveTotalPrice.toFixed(2);
+    // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
+    productData.value[idx].taxInclusiveUnitPrice = (
+      inclusiveTotalPrice / quantity
+    ).toFixed(2);
+  };
+  const goBack = () => {
+    // 娓呯悊鏈湴瀛樺偍鐨勬暟鎹�
+    uni.removeStorageSync("operationType");
+    uni.removeStorageSync("editData");
+    uni.navigateBack();
+  };
+  const onSubmit = async () => {
+    // 棣栧厛鏍¢獙鍩烘湰琛ㄥ崟
+    const formValid = await formRef.value.validate().catch(() => false);
+    if (!formValid) {
+      return;
+    }
+
+    // 鏍¢獙浜у搧淇℃伅
+    if (!productData.value || productData.value.length === 0) {
+      uni.showToast({
+        title: "璇锋坊鍔犱骇鍝佷俊鎭�",
+        icon: "none",
+      });
+      return;
+    }
+
+    // 妫�鏌ユ瘡涓骇鍝佹槸鍚﹀~鍐欏畬鏁�
+    for (let i = 0; i < productData.value.length; i++) {
+      const product = productData.value[i];
+      // 浼樺寲鏁板瓧瀛楁楠岃瘉锛屽鐞嗗彲鑳界殑瀛楃涓叉牸寮忔暟鍊�
+      const taxInclusiveUnitPrice = parseFloat(product.taxInclusiveUnitPrice);
+      const quantity = parseFloat(product.quantity);
+      const taxInclusiveTotalPrice = parseFloat(product.taxInclusiveTotalPrice);
+      const taxExclusiveTotalPrice = parseFloat(product.taxExclusiveTotalPrice);
+
+      if (!product.productCategory) {
+        uni.showToast({
+          title: `浜у搧${i + 1}锛氳閫夋嫨浜у搧澶х被`,
+          icon: "none",
+        });
+        return;
+      }
+      if (!product.specificationModel) {
+        uni.showToast({
+          title: `浜у搧${i + 1}锛氳閫夋嫨瑙勬牸鍨嬪彿`,
+          icon: "none",
+        });
+        return;
+      }
+      if (!product.unit) {
+        uni.showToast({
+          title: `浜у搧${i + 1}锛氳杈撳叆鍗曚綅`,
+          icon: "none",
+        });
+        return;
+      }
+      if (!product.taxRate) {
+        uni.showToast({
+          title: `浜у搧${i + 1}锛氳閫夋嫨绋庣巼`,
+          icon: "none",
+        });
+        return;
+      }
+      if (isNaN(taxInclusiveUnitPrice) || taxInclusiveUnitPrice <= 0) {
+        uni.showToast({
+          title: `浜у搧${i + 1}锛氳杈撳叆鏈夋晥鐨勫惈绋庡崟浠穈,
+          icon: "none",
+        });
+        return;
+      }
+      if (isNaN(quantity) || quantity <= 0) {
+        uni.showToast({
+          title: `浜у搧${i + 1}锛氳杈撳叆鏈夋晥鐨勬暟閲廯,
+          icon: "none",
+        });
+        return;
+      }
+      if (isNaN(taxInclusiveTotalPrice) || taxInclusiveTotalPrice <= 0) {
+        uni.showToast({
+          title: `浜у搧${i + 1}锛氳杈撳叆鏈夋晥鐨勫惈绋庢�讳环`,
+          icon: "none",
+        });
+        return;
+      }
+      if (isNaN(taxExclusiveTotalPrice) || taxExclusiveTotalPrice <= 0) {
+        uni.showToast({
+          title: `浜у搧${i + 1}锛氳杈撳叆鏈夋晥鐨勪笉鍚◣鎬讳环`,
+          icon: "none",
+        });
+        return;
+      }
+      if (!product.invoiceType) {
+        uni.showToast({
+          title: `浜у搧${i + 1}锛氳閫夋嫨鍙戠エ绫诲瀷`,
+          icon: "none",
+        });
+        return;
+      }
+    }
+
+    // 琛ㄥ崟鏍¢獙閫氳繃锛屾彁浜ゆ暟鎹�
+    form.value.productData = JSON.parse(JSON.stringify(productData.value));
+    form.value.type = 1;
+    addOrUpdateSalesLedger(form.value).then(res => {
+      uni.showToast({
+        title: "鎻愪氦鎴愬姛",
+        icon: "success",
+      });
+      goBack();
+    });
+  };
+  const setUserInfo = () => {
+    form.value.entryPerson = userStore.id;
+    form.value.entryPersonName = userStore.nickName;
+    // 璁剧疆褰撳ぉ鏃ユ湡
+    const today = new Date();
+    const year = today.getFullYear();
+    const month = String(today.getMonth() + 1).padStart(2, "0");
+    const day = String(today.getDate()).padStart(2, "0");
+    form.value.entryDate = `${year}-${month}-${day}`;
+    // 璁剧疆鏃ユ湡閫夋嫨鍣ㄩ粯璁ゅ�间负浠婂ぉ
+    pickerDateValue.value = `${year}-${month}-${day}`;
+  };
+  // 濉厖琛ㄥ崟鏁版嵁锛堢紪杈戞ā寮忥級
+  const fillFormData = () => {
+    if (!editData.value) return;
+    getSalesLedgerWithProducts({ id: editData.value.id, type: 1 }).then(res => {
+      productData.value = res.productData;
+    });
+    console.log(editData.value);
+    // 濉厖鍩烘湰淇℃伅
+    form.value.salesContractNo = editData.value.salesContractNo || "";
+    form.value.customerContractNo = editData.value.customerContractNo || "";
+    form.value.customerName = editData.value.customerName || "";
+    form.value.projectName = editData.value.projectName || "";
+    form.value.executionDate = editData.value.executionDate || "";
+    form.value.paymentMethod = editData.value.paymentMethod || "";
+    form.value.salesman = editData.value.salesman || "";
+    form.value.entryPerson = editData.value.entryPerson || "";
+    form.value.entryPersonName = editData.value.entryPersonName || "";
+    form.value.entryDate = editData.value.entryDate || "";
+    form.value.id = editData.value.id || "";
+    form.value.customerId = editData.value.customerId || "";
+
+    // 璁剧疆鏃ユ湡閫夋嫨鍣ㄧ殑鍊�
+    if (editData.value.executionDate) {
+      pickerDateValue.value = editData.value.executionDate;
+    }
+  };
+  const getUserList = () => {
+    userListNoPage().then(res => {
+      // 绉婚櫎澶氫綑鐨勬暟缁勫寘瑁�
+      userList.value = res.data.map(user => ({
+        text: user.nickName,
+        value: user.nickName,
+      }));
+    });
+  };
+  const getCustomerList = () => {
+    customerList().then(res => {
+      // 绉婚櫎澶氫綑鐨勬暟缁勫寘瑁�
+      customerOption.value = res.map(item => ({
+        text: item.customerName,
+        value: item.id,
+      }));
+    });
+  };
+  const convertIdToValue = data => {
+    // 濡傛灉浼犲叆鐨勪笉鏄暟缁勶紝鍒欒繑鍥炵┖鏁扮粍
+    if (!Array.isArray(data)) {
+      return [];
+    }
+    // 閫掑綊鏄犲皠鍑芥暟
+    return data.map(item => {
+      // 鍒涘缓鏂板璞★紝鏄犲皠瀛楁
+      const mappedItem = {
+        label: item.label, // 鍏抽敭锛氬皢 label 鏄犲皠涓� text
+        id: item.id, // 淇濈暀 id
+      };
+      // 濡傛灉瀛樺湪 children 鏁扮粍锛屽垯閫掑綊澶勭悊
+      if (
+        item.children &&
+        Array.isArray(item.children) &&
+        item.children.length > 0
+      ) {
+        mappedItem.children = convertIdToValue(item.children);
+      }
+      return mappedItem;
+    });
+  };
+  // 鑾峰彇浜у搧澶х被tree鏁版嵁
+  const getProductOptions = () => {
+    productTreeList().then(res => {
+      productOptions.value = convertIdToValue(res);
+    });
+  };
+
+  onMounted(() => {
+    // 鑾峰彇椤甸潰鍙傛暟
+    operationType.value = uni.getStorageSync("operationType") || "";
+
+    // 鑾峰彇浜哄憳鍒楄〃
+    getUserList();
+    // 鑾峰彇瀹㈡埛鍒楄〃
+    getCustomerList();
+    // 鑾峰彇浜у搧澶х被tree鏁版嵁
+    getProductOptions();
+    // 璧嬪�奸粯璁や俊鎭�
+    if (operationType.value === "add") {
+      setUserInfo();
+    }
+
+    // 鑾峰彇缂栬緫鏁版嵁骞跺~鍏呰〃鍗�
+    const editDataStr = uni.getStorageSync("editData");
+    if (editDataStr) {
+      try {
+        editData.value = JSON.parse(editDataStr);
+        // 濡傛灉鏄紪杈戞ā寮忥紝绛夊緟鏁版嵁鍔犺浇瀹屾垚鍚庡~鍏呰〃鍗曟暟鎹�
+        if (operationType.value !== "add" && editData.value) {
+          // 浣跨敤 nextTick 纭繚鏁版嵁鍔犺浇瀹屾垚鍚庡啀濉厖
+          setTimeout(() => {
+            fillFormData();
+          }, 100);
+        }
+      } catch (error) {
+        console.error("瑙f瀽缂栬緫鏁版嵁澶辫触:", error);
+      }
+    }
+  });
 </script>
 
 <style lang="scss">
-@import '@/static/scss/form-common.scss';
+  @import "@/static/scss/form-common.scss";
 </style>

--
Gitblit v1.9.3