gaoluyang
4 天以前 89cd3efd5dc533e6c8129d7d86dc74e1adf3d84c
src/pages/sales/salesAccount/detail.vue
@@ -1,10 +1,14 @@
<template>
  <view class="account-detail">
    <!-- 顶部标题栏 -->
    <view class="header">
      <up-icon name="arrow-left" size="20" color="#333" @click="goBack" />
      <text class="title">台账详情</text>
    </view>
      <van-nav-bar
         title="台账详情"
         left-text="返回"
         left-arrow
         @click-left="goBack"
         fixed
         placeholder
      />
         <!-- 表单区域 -->
      <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 +62,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 +133,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 +143,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 +262,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 +347,9 @@
]);
const addProduct = () => {
   if (productData.value === null) {
      productData.value = []
   }
   productData.value.push({
    productCategory: '',
    specificationModel: '',
@@ -596,6 +603,7 @@
         title: '请添加产品信息',
         icon: 'none'
      });
      return
   }
   form.value.type = 1;
   addOrUpdateSalesLedger(form.value).then((res) => {
@@ -608,7 +616,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 +732,7 @@
      try {
         editData.value = JSON.parse(editDataStr);
         // 如果是编辑模式,等待数据加载完成后填充表单数据
         if (operationType.value === 'edit' && editData.value) {
         if (operationType.value !== 'add' && editData.value) {
            // 使用 nextTick 确保数据加载完成后再填充
            setTimeout(() => {
               fillFormData();