gaoluyang
14 小时以前 e449a5408265e4bd1f6c66f5be28a42efac444ee
src/pages/sales/salesAccount/view.vue
@@ -28,8 +28,46 @@
          <text class="info-value">{{ form.executionDate }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">年份</text>
          <text class="info-value">{{ form.year || "-" }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">付款方式</text>
          <text class="info-value">{{ form.paymentMethod }}</text>
          <text class="info-value">{{ dictLabel(form.paymentMethod) }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">交货日期</text>
          <text class="info-value">{{ form.deliveryDate || "-" }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">签单单位</text>
          <text class="info-value">{{ deptName(form.signingUnitId) }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">办事处</text>
          <text class="info-value">{{ deptName(form.officeId) }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">组负责人</text>
          <text class="info-value">{{ userName(form.groupLeaderId) }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">是否开发票</text>
          <text class="info-value">{{ form.isInvoice === 1 ? "是" : "否" }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">是否中标</text>
          <text class="info-value">{{ form.isBid === 1 ? "是" : "否" }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">{{ form.isBid === 1 ? "中标价" : "未中标原因" }}</text>
          <text class="info-value">
            {{ form.isBid === 1 ? form.bidPrice ?? "-" : form.unbidReason || "-" }}
          </text>
        </view>
        <view class="info-item">
          <text class="info-label">合同原件约定回传日期</text>
          <text class="info-value">{{ form.contractOriginalReturnDate || "-" }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">录入人</text>
@@ -38,6 +76,11 @@
        <view class="info-item">
          <text class="info-label">录入日期</text>
          <text class="info-value">{{ form.entryDate }}</text>
        </view>
        <view v-if="form.remarks"
              class="info-item remarks-item">
          <text class="info-label">备注</text>
          <text class="info-value">{{ form.remarks }}</text>
        </view>
      </view>
    </view>
@@ -107,13 +150,30 @@
          class="no-product">
      <text>暂无产品信息</text>
    </view>
    <!-- 需求五.4:签约金额 = 含税单价 × 数量,按产品行汇总(对齐管理端 summarizeMainTable) -->
    <view v-if="productData.length > 0"
          class="product-summary">
      <view class="summary-row">
        <text class="summary-label">签约金额合计(元)</text>
        <text class="summary-value highlight">{{ productTotals.taxInclusive }}</text>
      </view>
      <view class="summary-row">
        <text class="summary-label">不含税总价合计(元)</text>
        <text class="summary-value">{{ productTotals.taxExclusive }}</text>
      </view>
    </view>
  </view>
</template>
<script setup>
  import { onMounted, ref } from "vue";
  import { computed, onMounted, ref } from "vue";
  import { getSalesLedgerWithProducts } from "@/api/salesManagement/salesLedger";
  import { getDept } from "@/api/collaborativeApproval/approvalProcess";
  import { userListNoPageByTenantId } from "@/api/system/user";
  import { useDict } from "@/utils/dict";
  import PageHeader from "@/components/PageHeader.vue";
  const { checkout_payment } = useDict("checkout_payment");
  // 获取页面参数
  const editData = ref(null);
@@ -134,6 +194,35 @@
  // 产品数据
  const productData = ref([]);
  const deptOptions = ref([]);
  const userOptions = ref([]);
  const dictLabel = value => {
    if (value === undefined || value === null || value === "") return "-";
    const matched = (checkout_payment.value || []).find(
      item => String(item.value) === String(value)
    );
    return matched ? matched.label : String(value);
  };
  // 后端只存 id,只读页需要自己反查部门 / 员工名称
  const deptName = id =>
    deptOptions.value.find(item => String(item.value) === String(id))?.name ||
    "-";
  const userName = id =>
    userOptions.value.find(item => String(item.value) === String(id))?.name ||
    "-";
  const productTotals = computed(() => {
    const sumBy = key =>
      (productData.value || [])
        .reduce((sum, row) => sum + (Number(row?.[key]) || 0), 0)
        .toFixed(2);
    return {
      taxInclusive: sumBy("taxInclusiveTotalPrice"),
      taxExclusive: sumBy("taxExclusiveTotalPrice"),
    };
  });
  // 返回上一页
  const goBack = () => {
@@ -153,7 +242,24 @@
    });
  };
  const loadOrgOptions = async () => {
    const [depts, users] = await Promise.all([
      getDept().catch(() => ({})),
      userListNoPageByTenantId().catch(() => ({})),
    ]);
    deptOptions.value = (depts?.data || []).map(item => ({
      name: item.deptName,
      value: item.deptId,
    }));
    const rows = users?.data || [];
    userOptions.value = (Array.isArray(rows) ? rows : []).map(item => ({
      name: item.nickName || item.userName || `用户${item.userId}`,
      value: item.userId,
    }));
  };
  onMounted(() => {
    loadOrgOptions();
    // 获取编辑数据并填充表单
    const editDataStr = uni.getStorageSync("editData");
    if (editDataStr) {
@@ -290,4 +396,40 @@
    color: #999;
    font-size: 0.875rem;
  }
  .remarks-item {
    grid-column: 1 / -1;
  }
  .product-summary {
    background: #fff;
    margin: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
  .summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .summary-label {
    font-size: 0.8125rem;
    color: #666;
  }
  .summary-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #333;
  }
  .summary-value.highlight {
    color: #2979ff;
  }
</style>