Browse Source

fix(订单表单): 修复导入时单价未正确使用折扣价的问题

yz 3 weeks ago
parent
commit
27bfb6d1a0
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/components/order-form/material-detail-mixin.js

+ 7 - 1
src/components/order-form/material-detail-mixin.js

@@ -458,7 +458,13 @@ export default {
             mainItemCategoryName: item.goodsTypeName || '',
             mainItemCategoryId: item.goodsTypeId,
             mainItemCategoryCode: '',
-            unitPrice: '0',
+            // 使用 rebatePrice 作为单价来源,保证导入时价格带入
+            unitPrice: (() => {
+              const raw = (typeof item.rebatePrice === 'number') ? String(item.rebatePrice) : (item.rebatePrice || '0')
+              const sanitized = String(raw).replace(/[^\d.-]/g, '')
+              const parsed = parseFloat(sanitized)
+              return isNaN(parsed) ? 0 : parsed
+            })(),
             description: item.productDescription || '',
             warehouseId: item.storageId,
             warehouseCode: '',