require("../../../../_virtual/_rolldown/runtime.js");
const require_storeTypes = require("../types/storeTypes.js");
let _pisell_utils = require("@pisell/utils");
//#region src/components/pay/toB/store/utils.ts
/**
* 处理支付方式列表
* @param payMethodList 支付方式列表
* @returns 处理后的支付方式列表
*/
const handlePayMethodList = (payMethodList) => {
	if (payMethodList.length <= 0) return [];
	const list = [];
	const normalPay = {
		title: _pisell_utils.locales.getText("tobPay.text.group.normalPay"),
		list: []
	};
	const thirdPay = {
		title: _pisell_utils.locales.getText("tobPay.text.group.thirdPay"),
		list: []
	};
	for (const item of payMethodList) if ((item === null || item === void 0 ? void 0 : item.status) === 1) {
		if (item.code === require_storeTypes.PayMethodCode.CASHMANUAL) normalPay.list.push(item);
		else if (item.code === require_storeTypes.PayMethodCode.CUSTOMMANUAL || item.type === "custom") normalPay.list.push(item);
		else if (item.type === "eftpos") thirdPay.list.push(item);
	}
	if (normalPay.list.length > 0) list.push(normalPay);
	if (thirdPay.list.length > 0) list.push(thirdPay);
	return list;
};
/**
* inputNumber过滤
* @param value
* @returns string
*/
const limitDecimals = (value) => {
	const reg = /^(\-)*(\d+)\.(\d\d).*$/;
	if (typeof value === "string") return !isNaN(Number(value)) ? value.replace(reg, "$1$2.$3") : "";
	else if (typeof value === "number") return !isNaN(value) ? String(value).replace(reg, "$1$2.$3") : "";
	else return "";
};
//#endregion
exports.handlePayMethodList = handlePayMethodList;
exports.limitDecimals = limitDecimals;
