Explorar el Código

fix:859【入库详情】入库单详情,需要增加不含税单价、金额

mlchen hace 6 días
padre
commit
b124a40eea
Se han modificado 1 ficheros con 63 adiciones y 0 borrados
  1. 63 0
      src/BIZComponents/innerdetails.vue

+ 63 - 0
src/BIZComponents/innerdetails.vue

@@ -232,6 +232,27 @@
                 {{ row.totalMoney ? row.totalMoney : 0 }}
               </template>
             </el-table-column>
+            <el-table-column
+              label="不含税单价"
+              prop="notaxUnitPrice"
+              width="140"
+              align="center"
+            >
+              <template slot-scope="{ row }">
+                {{ formatNotaxUnitPrice(row) }}
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="不含税金额"
+              prop="notaxTotalMoney"
+              width="120"
+              align="center"
+              :show-overflow-tooltip="true"
+            >
+              <template slot-scope="{ row }">
+                {{ formatNotaxTotalMoney(row) }}
+              </template>
+            </el-table-column>
             <el-table-column
               v-if="clientEnvironmentId == 4"
               label="采购原因"
@@ -711,6 +732,48 @@
           return { dictCode: item.id, dictValue: item.name };
         });
       },
+      // 不含税口径:含税值 ÷ (1 + 税率/100),税率由后端按采购收货明细下发
+      isBlank(value) {
+        return value === null || value === undefined || value === '';
+      },
+      notaxRate(row) {
+        const taxRate = Number(row.taxRate);
+        if (!row.taxRate || Number.isNaN(taxRate)) {
+          return null;
+        }
+        return 1 + taxRate / 100;
+      },
+      // 单价为空时按 金额 ÷ 计价数量 还原含税单价:保存入库时金额即由该乘积得出
+      deriveUnitPrice(row) {
+        const quantity =
+          Number(row.pricingWay) === 2 ? row.weight : row.measureQuantity;
+        const qty = Number(quantity);
+        if (this.isBlank(quantity) || this.isBlank(row.totalMoney) || !qty) {
+          return null;
+        }
+        return Number(row.totalMoney) / qty;
+      },
+      formatNotaxUnitPrice(row) {
+        const rate = this.notaxRate(row);
+        if (rate === null) {
+          return '';
+        }
+        const unitPrice = this.isBlank(row.unitPrice)
+          ? this.deriveUnitPrice(row)
+          : row.unitPrice;
+        if (this.isBlank(unitPrice)) {
+          return '';
+        }
+        const price = (Number(unitPrice) / rate).toFixed(4);
+        return price + '元/' + (row.measureUnit || '');
+      },
+      formatNotaxTotalMoney(row) {
+        const rate = this.notaxRate(row);
+        if (rate === null || this.isBlank(row.totalMoney)) {
+          return '';
+        }
+        return (Number(row.totalMoney) / rate).toFixed(2);
+      },
       async _getInfo(sourceBizNo) {
         if (!sourceBizNo) {
           return;