提交merge1.3
This commit is contained in:
@@ -501,4 +501,36 @@ export function getGroupMarkers(tableData) {
|
||||
}
|
||||
});
|
||||
return tableData;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化库存数量显示(大单位情况) 示例 1盒5片
|
||||
* @param quantity 小单位库存数量
|
||||
* @param partPercent 拆零比
|
||||
* @param unitCode 大单位label
|
||||
* @param minUnitCode 小单位label
|
||||
*/
|
||||
export function formatInventory(quantity, partPercent, unitCode, minUnitCode) {
|
||||
// 处理负数情况
|
||||
const isNegative = quantity < 0;
|
||||
const absQuantity = Math.abs(quantity);
|
||||
|
||||
if (absQuantity % partPercent !== 0) {
|
||||
const integerPart = Math.floor(absQuantity / partPercent);
|
||||
const decimalPart = absQuantity % partPercent;
|
||||
|
||||
let result = integerPart.toString() + ' ' + unitCode;
|
||||
if (decimalPart > 0) {
|
||||
result += decimalPart.toString() + ' ' + minUnitCode;
|
||||
}
|
||||
|
||||
return isNegative ? '-' + result : result;
|
||||
}
|
||||
|
||||
// 整除情况
|
||||
const result = absQuantity / partPercent;
|
||||
return isNegative ? '-' + result : result + ' ' + unitCode;
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
Reference in New Issue
Block a user