yyb
2026-02-02 d909ca171564419745daf3bf730f119802873833
pages/wareHouse/nuclearScale/nuclearscalerecord.vue
@@ -31,6 +31,13 @@
          >- {{ getPrintStatusText() }}</text
        >
      </view>
      <!-- 核磅重量总和展示 -->
      <view class="total-weight-indicator">
        <text class="total-weight-label">核磅重量总和:</text>
        <text class="total-weight-value">{{ totalVerificationWeight.toFixed(2) }}</text>
      </view>
      <scroll-view
        class="finishProductIn-locno-scroll-list"
        scroll-y="true"
@@ -226,7 +233,7 @@
      // 5:透明纸
      printMode: 2, // 默认打印模式
      //   1:热敏
      //    2:热转印
      //  2:热转印
      connectedDevice: null,
      connectionStatus: "disconnected",
      printStatus: "idle", // 打印状态: idle, printing, error
@@ -234,6 +241,26 @@
      verificationNo: "",
      failedPrintJobs: [],
    };
  },
  computed: {
    // 计算核磅重量总和
totalVerificationWeight() {
  const processedBatches = new Set(); // 用于记录已经处理过的batchNo
  return this.list.reduce((sum, item) => {
    // 如果这个batchNo已经处理过,直接返回当前总和(跳过)
    if (processedBatches.has(item.batchNo)) {
      return sum;
    }
    // 标记这个batchNo为已处理
    processedBatches.add(item.batchNo);
    // 计算权重并累加
    const weight = parseFloat(item.verificationWeight) || 0;
    return sum + weight;
  }, 0);
}
  },
  onLoad(options) {
    this.verificationNo = JSON.parse(
@@ -1171,4 +1198,26 @@
    font-size: 22rpx;
  }
}
/* 核磅重量总和展示 */
.total-weight-indicator {
  padding: 12rpx 20rpx;
  font-size: 26rpx;
  text-align: center;
  background-color: #e8f3ff;
  border-bottom: 1rpx solid #d1e5ff;
  margin-bottom: 16rpx;
  .total-weight-label {
    font-weight: 500;
    color: #333;
    margin-right: 8rpx;
  }
  .total-weight-value {
    font-weight: bold;
    color: #07c160;
    font-size: 28rpx;
  }
}
</style>