|
|
|
@ -505,7 +505,7 @@
|
|
|
|
|
:wrapperCol="wrapperCol"
|
|
|
|
|
has-feedback
|
|
|
|
|
>
|
|
|
|
|
<a-input :allowClear="true" v-model="details.pkgs" type="number" />
|
|
|
|
|
<a-input :allowClear="true" v-model="details.pkgs" type="number" @change="changePkgs"/>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :span="12">
|
|
|
|
@ -933,6 +933,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.init()
|
|
|
|
|
// this.SetTOTALNO()
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
const shipperScroll = document.getElementById('shipper-scroll')
|
|
|
|
@ -1463,6 +1464,127 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
textareaChange(e, type) {
|
|
|
|
|
this.details[type] = e.target.value
|
|
|
|
|
},
|
|
|
|
|
changePkgs () {
|
|
|
|
|
console.log(this.details.pkgs)
|
|
|
|
|
let enCapitalRes = this.SetTOTALNO(this.details.pkgs)
|
|
|
|
|
this.$emit('pkgsEnCapital', enCapitalRes)
|
|
|
|
|
},
|
|
|
|
|
SetTOTALNO (SS) {
|
|
|
|
|
let i = SS.indexOf('\n');
|
|
|
|
|
let num = 0;
|
|
|
|
|
let strKind = ''
|
|
|
|
|
let enCapital = ''
|
|
|
|
|
if (i > 0) {
|
|
|
|
|
let slist = SS.split('\n');
|
|
|
|
|
for (let i = 0; i < slist.length; i += 1) {
|
|
|
|
|
let member = slist[i];
|
|
|
|
|
let strNum = this.GetStringNum(member);
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
strKind = member.substring(strNum.length);
|
|
|
|
|
}
|
|
|
|
|
num = parseFloat(num).add(parseFloat(strNum));
|
|
|
|
|
}
|
|
|
|
|
if (strKind !== '') {
|
|
|
|
|
enCapital = strKind
|
|
|
|
|
} else {
|
|
|
|
|
strKind = this.details.kindpkgs
|
|
|
|
|
enCapital = this.ToEn(num).toUpperCase() +
|
|
|
|
|
' ' +
|
|
|
|
|
strKind +
|
|
|
|
|
' ONLY.'
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// const strNum = Number(SS);
|
|
|
|
|
const strNum = this.GetStringNum(SS);
|
|
|
|
|
console.log(strNum)
|
|
|
|
|
strKind = SS.substring(strNum.length);
|
|
|
|
|
if (strKind !== '') {
|
|
|
|
|
console.log(strKind)
|
|
|
|
|
enCapital = strKind
|
|
|
|
|
} else {
|
|
|
|
|
strKind = this.details.kindpkgs
|
|
|
|
|
enCapital = 'SAY:' +
|
|
|
|
|
this.ToEn(strNum).toUpperCase() +
|
|
|
|
|
' ' +
|
|
|
|
|
strKind +
|
|
|
|
|
' ONLY.'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return enCapital
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
GetStringNum (str) {
|
|
|
|
|
var num = 0;
|
|
|
|
|
if (str == null || str == '') return num;
|
|
|
|
|
if (str.length == 0) return num;
|
|
|
|
|
var if_find = false;
|
|
|
|
|
var str_num = '';
|
|
|
|
|
for (var i = 0; i < str.length; i += 1) {
|
|
|
|
|
var member = str.substr(i, 1);
|
|
|
|
|
if ((member == '0') || (member == '1') || (member == '2') || (member == '3')
|
|
|
|
|
|| (member == '4') || (member == '5') || (member == '6') || (member == '7')
|
|
|
|
|
|| (member == '8') || (member == '9') || (member == '.') || (member == '-')) {
|
|
|
|
|
if (!if_find) {
|
|
|
|
|
str_num = str_num + member;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if_find = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return str_num;
|
|
|
|
|
},
|
|
|
|
|
ToEn(a) {
|
|
|
|
|
// eslint-disable-next-line no-array-constructor
|
|
|
|
|
const arr1 = new Array('', ' thousand', ' million', ' billion');
|
|
|
|
|
const b = a.length
|
|
|
|
|
let f = null
|
|
|
|
|
let h = 0
|
|
|
|
|
let g = ''
|
|
|
|
|
const e = Math.ceil(b / 3)
|
|
|
|
|
const k = b - e * 3
|
|
|
|
|
g = ''
|
|
|
|
|
for (f = k; f < b; f += 3) {
|
|
|
|
|
++h;
|
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
|
const num3 = f >= 0 ? a.substring(f, f + 3) : a.substring(0, k + 3);
|
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
|
const strEng = this.English(num3);
|
|
|
|
|
// eslint-disable-next-line eqeqeq
|
|
|
|
|
if (strEng != '') {
|
|
|
|
|
// eslint-disable-next-line eqeqeq
|
|
|
|
|
if (g != '') g += ' ';
|
|
|
|
|
g += this.English(num3) + arr1[e - h]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return g
|
|
|
|
|
},
|
|
|
|
|
English(a) {
|
|
|
|
|
var arr1 = new Array('', ' thousand', ' million', ' billion');
|
|
|
|
|
var arr2 = new Array("zero", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", 'eighty', 'ninety');
|
|
|
|
|
var arr3 = new Array("zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine");
|
|
|
|
|
var arr4 = new Array("ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen");
|
|
|
|
|
|
|
|
|
|
let strRet = '';
|
|
|
|
|
// eslint-disable-next-line eqeqeq
|
|
|
|
|
if (a.length == 3 && a.substr(0, 3) != '000') {
|
|
|
|
|
if (a.substr(0, 1) != '0') {
|
|
|
|
|
strRet += arr3[a.substr(0, 1)] + ' hundred';
|
|
|
|
|
if (a.substr(1, 2) != '00') strRet += ' and '
|
|
|
|
|
} else {
|
|
|
|
|
strRet += ' and '
|
|
|
|
|
}
|
|
|
|
|
a = a.substring(1)
|
|
|
|
|
}
|
|
|
|
|
if (a.length == 2) if (a.substr(0, 1) == "0") a = a.substring(1);
|
|
|
|
|
else if (a.substr(0, 1) == "1") strRet += arr4[a.substr(1, 2)];
|
|
|
|
|
else {
|
|
|
|
|
strRet += arr2[a.substr(0, 1)];
|
|
|
|
|
if (a.substr(1, 1) != "0") strRet += "-";
|
|
|
|
|
a = a.substring(1)
|
|
|
|
|
}
|
|
|
|
|
if (a.length == 1 && a.substr(0, 1) != "0") strRet += arr3[a.substr(0, 1)];
|
|
|
|
|
return strRet
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|