lowMoneyToUp : function(money){//小写数字金额
var u = App.base.Utils,
cnNums = new Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"),
cnIntRadice = new Array("", "拾", "佰", "仟"), //基本单位
cnIntUnits = new Array("", "万", "亿", "兆"), //对应整数部分扩展单位
cnDecUnits = new Array("角", "分", "毫", "厘"), //对应小数部分单位
cnInteger = "整", //整数金额时后面跟的字符
cnIntLast = "圆", //整型完以后的单位
maxNum = , //最大处理的数字
IntegerNum, //金额整数部分
DecimalNum,//金额小数部分
ChineseStr = "", //输出的中文金额字符串
parts; //分离金额后用的数组,预定义
if(!!money)
money = parseFloat(money);
else
return "";
if (money >= maxNum) {
u.toast('超出最大处理数字');
return "";
}
if (money == ) {
ChineseStr = cnNums[] + cnIntLast + cnInteger;
return ChineseStr;
}
money = money.toString(); //转换为字符串
if (money.indexOf(".") == -) {
IntegerNum = money;
DecimalNum = '';
} else {
parts = money.split(".");
IntegerNum = parts[];
DecimalNum = parts[].substr(, );
}
if (parseInt(IntegerNum, ) > ) { //获取整型部分转换
var zeroCount = ,
IntLen = IntegerNum.length;
for (var i = ; i < IntLen; i++) {
var n = IntegerNum.substr(i, );
var p = IntLen - i - ;
var q = p / ;
var m = p % ;
if (n == "0") {
zeroCount++;
} else {
if (zeroCount > ) {
ChineseStr += cnNums[];
}
zeroCount = ; //归零
ChineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
}
if (m == && zeroCount < ) {
ChineseStr += cnIntUnits[q];
}
}
ChineseStr += cnIntLast;
//整型部分处理完毕
}
if (DecimalNum != '') { //小数部分
var decLen = DecimalNum.length;
for (var i = ; i < decLen; i++) {
var n = DecimalNum.substr(i, );
if (n != '0') {
ChineseStr += cnNums[Number(n)] + cnDecUnits[i];
}
}
}
if (ChineseStr == '') {
ChineseStr += cnNums[] + cnIntLast + cnInteger;
} else if (DecimalNum == '') {
ChineseStr += cnInteger;
}
return ChineseStr;//返回大写人民币金额
}