gaoluyang
2026-09-08 a4c5c3a4da2be3e9151de6ca6e919e7c749cec67
src/pages/procurementManagement/procurementLedger/index.vue
@@ -50,6 +50,10 @@
              <text class="detail-value">{{ item.salesContractNo }}</text>
            </view> -->
            <view class="detail-row">
              <text class="detail-label">销售合同号</text>
              <text class="detail-value">{{ item.salesContractNo || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">供应商名称</text>
              <text class="detail-value">{{ item.supplierName }}</text>
            </view>
@@ -62,8 +66,28 @@
              <text class="detail-value">{{ item.paymentMethod }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">入库状态</text>
              <view class="detail-value">
                <u-tag :type="getStockInStatusType(item.stockInStatus)">
                  {{ item.stockInStatus || '-' }}
                </u-tag>
              </view>
            </view>
            <view class="detail-row">
              <text class="detail-label">合同金额(元)</text>
              <text class="detail-value highlight">{{ item.contractAmount }}</text>
              <text class="detail-value highlight">{{ formattedNumber(item.contractAmount) }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">实际合同金额(元)</text>
              <text class="detail-value highlight">{{ formattedNumber(item.netContractAmount) }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">签订日期</text>
              <text class="detail-value">{{ item.executionDate || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">备注</text>
              <text class="detail-value">{{ item.remarks || '-' }}</text>
            </view>
            <up-divider></up-divider>
            <view class="detail-info">
@@ -77,20 +101,16 @@
              </view>
            </view>
            <!-- 仅非“审批通过”的台账展示删除按钮 -->
            <view
              class="detail-row"
              v-if="item.approvalStatus !== 3"
              style="justify-content: flex-end; margin-top: 8px;"
            >
              <up-button
                type="error"
                size="small"
                plain
                @click.stop="handleDelete(item)"
              >
            <!-- <view class="detail-row"
                  v-if="item.approvalStatus !== 3"
                  style="justify-content: flex-end; margin-top: 8px;">
              <up-button type="error"
                         size="small"
                         plain
                         @click.stop="handleDelete(item)">
                删除
              </up-button>
            </view>
            </view> -->
          </view>
        </view>
      </view>
@@ -100,12 +120,12 @@
      <text>暂无采购台账数据</text>
    </view>
    <!-- 浮动操作按钮 -->
    <view class="fab-button"
    <!-- <view class="fab-button"
          @click="handleInfo('add')">
      <up-icon name="plus"
               size="24"
               color="#ffffff"></up-icon>
    </view>
    </view> -->
  </view>
</template>
@@ -114,7 +134,10 @@
  import { onShow } from "@dcloudio/uni-app";
  import useUserStore from "@/store/modules/user";
  import PageHeader from "@/components/PageHeader.vue";
  import { purchaseListPage, delPurchase } from "@/api/procurementManagement/procurementLedger";
  import {
    purchaseListPage,
    delPurchase,
  } from "@/api/procurementManagement/procurementLedger";
  const userStore = useUserStore();
  const approvalStatusText = {
    1: "待审核",
@@ -131,6 +154,31 @@
      4: "error", // 审批失败 - 红色
    };
    return typeMap[status] || "";
  };
  const getStockInStatusType = status => {
    const typeMap = {
      待入库: "info",
      入库中: "warning",
      完全入库: "success",
    };
    return typeMap[status] || "info";
  };
  const getStockInApprovalStatusType = status => {
    const typeMap = {
      待入库: "info",
      入库中: "warning",
      完全入库: "success",
    };
    return typeMap[status] || "info";
  };
  const formattedNumber = value => {
    if (value === undefined || value === null || value === "") {
      return "0.00";
    }
    return parseFloat(value).toFixed(2);
  };
  // 搜索关键词
  const purchaseContractNumber = ref("");
@@ -154,7 +202,7 @@
      purchaseContractNumber: purchaseContractNumber.value,
    })
      .then(res => {
        ledgerList.value = res.data.records;
        ledgerList.value = res?.data?.records || [];
        closeToast();
      })
      .catch(() => {
@@ -180,6 +228,7 @@
    try {
      // 设置操作类型
      uni.setStorageSync("operationType", type);
      uni.removeStorageSync("editData");
      // 如果是查看或编辑操作
      if (type !== "add") {
@@ -265,7 +314,10 @@
              // 只有在真正异常时,才在这里兜底提示
              const msg =
                (error && error.msg) ||
                (error && error.response && error.response.data && error.response.data.msg) ||
                (error &&
                  error.response &&
                  error.response.data &&
                  error.response.data.msg) ||
                (error && error.message) ||
                "删除失败";
              uni.showToast({