fix order create
This commit is contained in:
@@ -25,7 +25,7 @@ async function detail(id: string): Promise<SalesOrder> {
|
||||
return await axios.post(`${ORDER_URI}/detail`, undefined, { params: { id } });
|
||||
}
|
||||
async function createDirectProduct(request: DirectProductOrderCreateRequest): Promise<SalesOrder> {
|
||||
return await axios.post(`${ORDER_URI}/direct-product/create`, request);
|
||||
return await axios.post(`${ORDER_URI}/direct-product/create`, withCurrentStoreId(request));
|
||||
}
|
||||
async function cancel(request: SalesOrderCancelRequest): Promise<SalesOrder> {
|
||||
return await axios.post(`${ORDER_URI}/cancel`, request);
|
||||
|
||||
@@ -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