格式化:Prettier统一代码风格(仅格式,无逻辑变化)

仅为 npm run format 的输出;黄金对照、旧库兼容、浏览器流程与单元测试全部通过且零差异。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
黄健铭andClaude Opus 5.5 committed 2026-12-04 08:58:53 -08:00
1 parent 3743d687e7
commit 28c64814f0
221 files changed
+116943 -26708

No files matched your search

+15 -14
View File
@@ -1,19 +1,20 @@
'use strict';
// 手续费预览使用整数分;真实费用由服务端按每笔客户付款生成。
(function(root){
const isAccount=account=>['助理信用卡','助理1信用卡','麦麦信用卡','助理2信用卡'].includes(account);
const ratePermille=6;
function rate(value=ratePermille){
if(!Number.isSafeInteger(value)||value<0||value>1000)throw new Error('信用卡手续费率须为0~1000的整数‰');
(function (root) {
const isAccount = account => ['助理信用卡', '助理1信用卡', '麦麦信用卡', '助理2信用卡'].includes(account);
const ratePermille = 6;
function rate(value = ratePermille) {
if (!Number.isSafeInteger(value) || value < 0 || value > 1000) throw new Error('信用卡手续费率须为0~1000的整数‰');
return value;
}
const normalizeAccount=account=>isAccount(account)?'麦麦信用卡':account;
const note=(value=ratePermille)=>`信用卡手续费(${rate(value)}‰)`;
const isFee=item=>item?.system==='credit_card'||String(item?.key||'').startsWith('card_fee:');
function amount(cents,value=ratePermille){
if(!Number.isSafeInteger(cents)||cents<0||cents>100000000000)throw new Error('客户付款金额无效');
return Number((BigInt(cents)*BigInt(rate(value))+500n)/1000n);
const normalizeAccount = account => (isAccount(account) ? '麦麦信用卡' : account);
const note = (value = ratePermille) => `信用卡手续费(${rate(value)}‰)`;
const isFee = item => item?.system === 'credit_card' || String(item?.key || '').startsWith('card_fee:');
function amount(cents, value = ratePermille) {
if (!Number.isSafeInteger(cents) || cents < 0 || cents > 100000000000) throw new Error('客户付款金额无效');
return Number((BigInt(cents) * BigInt(rate(value)) + 500n) / 1000n);
}
const api={isAccount,isFee,amount,rate,ratePermille,normalizeAccount,note};
if(typeof module==='object'&&module.exports)module.exports=api;else root.CreditCardFees=api;
})(typeof globalThis==='object'?globalThis:this);
const api = { isAccount, isFee, amount, rate, ratePermille, normalizeAccount, note };
if (typeof module === 'object' && module.exports) module.exports = api;
else root.CreditCardFees = api;
})(typeof globalThis === 'object' ? globalThis : this);