fix order create
This commit is contained in:
@@ -257,9 +257,11 @@ async function applyProduct(index: number, value?: { productId: string; productU
|
||||
const product = productCache.get(value.productId) || await ProductAPI.detail(value.productId);
|
||||
productCache.set(value.productId, product);
|
||||
const item = items.value[index];
|
||||
const selectionChanged = item.productId !== value.productId || item.productUnitId !== value.productUnitId;
|
||||
const saleableUnits = (product.unitList || []).filter(unit => unit.allowSale !== false && unit.id);
|
||||
const productUnitId = saleableUnits.length < 2 ? saleableUnits[0]?.id || "" : value.productUnitId;
|
||||
const selectionChanged = item.productId !== value.productId || item.productUnitId !== productUnitId;
|
||||
item.productId = value.productId;
|
||||
item.productUnitId = value.productUnitId;
|
||||
item.productUnitId = productUnitId;
|
||||
item.productName = product.name;
|
||||
if (selectionChanged) {
|
||||
item.unitPriceText = "";
|
||||
|
||||
Reference in New Issue
Block a user