Forráskód Böngészése

feat(销售订单审批): 对账单明细新增差异数量、差异金额与异常处置展示

lucw 2 napja
szülő
commit
ee9d6aed82

+ 84 - 0
src/views/bpm/handleTask/components/saleOrder/accountstatement/accountDetailTable.vue

@@ -137,6 +137,28 @@
               <span>{{ scope.row.statementAmount }}</span>
             </template>
 
+            <template v-slot:diffQty="scope">
+              <span>{{ formatDiffQty(scope.row) }}</span>
+            </template>
+
+            <template v-slot:diffAmount="scope">
+              <span>{{ formatDiffAmount(scope.row) }}</span>
+            </template>
+
+            <template v-slot:exceptionDetermine="scope">
+              <span>{{ determineLabel(scope.row) }}</span>
+            </template>
+
+            <template v-slot:exceptionStatus="scope">
+              <el-tag :type="hasException(scope.row) ? 'danger' : 'success'" size="small">
+                {{ hasException(scope.row) ? '有差异' : '一致' }}
+              </el-tag>
+            </template>
+
+            <template v-slot:exceptionRemark="scope">
+              <span>{{ scope.row.exceptionRemark || '--' }}</span>
+            </template>
+
             <template v-slot:headerRequired="{ column }">
               <span class="is-required">{{ column.label }}</span>
             </template>
@@ -454,6 +476,41 @@
                 ?.name;
             }
           },
+          {
+            minWidth: 120,
+            prop: 'diffQty',
+            label: '差异数量',
+            align: 'center',
+            slot: 'diffQty'
+          },
+          {
+            minWidth: 120,
+            prop: 'diffAmount',
+            label: '差异金额',
+            align: 'center',
+            slot: 'diffAmount'
+          },
+          {
+            minWidth: 150,
+            prop: 'exceptionDetermine',
+            label: '处置类型',
+            align: 'center',
+            slot: 'exceptionDetermine'
+          },
+          {
+            minWidth: 100,
+            prop: 'exceptionStatus',
+            label: '异常状态',
+            align: 'center',
+            slot: 'exceptionStatus'
+          },
+          {
+            minWidth: 180,
+            prop: 'exceptionRemark',
+            label: '异常说明',
+            align: 'center',
+            slot: 'exceptionRemark'
+          },
         ]
       },
       // 物品明细表的 cacheKey:与主表列配置隔离,避免两张表互相覆盖
@@ -649,6 +706,33 @@
         const text = String(value);
         if (!list.includes(text)) list.push(text);
       },
+      // 差异数量
+      formatDiffQty(row) {
+        const statementCount = Math.abs(Number(row.statementCount) || 0);
+        const totalCount = Number(row.totalCount) || 0;
+        return Math.round(Math.abs(statementCount - totalCount) * 10000) / 10000;
+      },
+      // 差异金额
+      formatDiffAmount(row) {
+        if (row.diffAmount != null) return row.diffAmount;
+        return Math.round(Math.abs((Number(row.statementAmount) || 0)
+          - (Number(row.discountTotalPrice) || 0)) * 10000) / 10000;
+      },
+      // 异常状态
+      hasException(row) {
+        return Math.abs(Number(this.formatDiffQty(row)) || 0) > 0
+          || Math.abs(Number(this.formatDiffAmount(row)) || 0) > 0;
+      },
+      // 处置类型标签
+      determineLabel(row) {
+        const code = row.exceptionDetermine;
+        if (!code) return '--';
+        const purchase = this.queryDimension == 3;
+        const map = purchase
+          ? { 1: '多收', 2: '少收', 3: '错收', 5: '质量不良', 6: '丢失' }
+          : { 1: '多发', 2: '少发', 3: '错发', 5: '质量不良', 6: '丢失' };
+        return map[code] || code;
+      },
       // 数值收敛到 4 位小数
       roundNumber(value) {
         const num = +value || 0;