件数大写

dev
lilu 2 years ago
parent c1f9678d5c
commit 86aec3886f

@ -31,6 +31,7 @@
:details="bookingDetails" :details="bookingDetails"
@changeDetail="changeDetailFun" @changeDetail="changeDetailFun"
@spliceMore="spliceMorefun" @spliceMore="spliceMorefun"
@pkgsEnCapital="pkgsEnCapitalFun"
></mailingInfo> ></mailingInfo>
<!-- 货物信息 --> <!-- 货物信息 -->
<cargoInfo :details="bookingDetails" :moreStr="moreStr" @changeDetail="changeDetailFun"></cargoInfo> <cargoInfo :details="bookingDetails" :moreStr="moreStr" @changeDetail="changeDetailFun"></cargoInfo>
@ -875,6 +876,9 @@ export default {
} else if (type === 'totalCbm') { } else if (type === 'totalCbm') {
this.bookingDetails.cbm = val || this.bookingDetails.cbm this.bookingDetails.cbm = val || this.bookingDetails.cbm
} }
},
pkgsEnCapitalFun (data) {
this.bookingDetails.totalno = data
} }
} }
} }

@ -562,9 +562,10 @@ export default {
// - start // - start
prepardatSelect(value) { prepardatSelect(value) {
this.details.prepardat = value // this.details.prepardat = value
const index = this.prepardatDataArr.indexOf(value) const index = this.prepardatDataArr.indexOf(value)
this.details.prepardatid = this.prepardatData[index].ediCode this.details.prepardatid = this.prepardatData[index].ediCode
this.details.prepardat = this.prepardatData[index].enName
}, },
prepardatChange(value) { prepardatChange(value) {
if (!value) { if (!value) {
@ -590,9 +591,10 @@ export default {
}) })
}, },
payableatSelect(value) { payableatSelect(value) {
this.details.payableat = value // this.details.payableat = value
const index = this.payableatDataArr.indexOf(value) const index = this.payableatDataArr.indexOf(value)
this.details.payableatid = this.payableatData[index].ediCode this.details.payableatid = this.payableatData[index].ediCode
this.details.payableat = this.payableatData[index].enName
}, },
payableatChange(value) { payableatChange(value) {
if (!value) { if (!value) {

@ -505,7 +505,7 @@
:wrapperCol="wrapperCol" :wrapperCol="wrapperCol"
has-feedback 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-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
@ -933,6 +933,7 @@ export default {
}, },
created() { created() {
this.init() this.init()
// this.SetTOTALNO()
}, },
mounted() { mounted() {
const shipperScroll = document.getElementById('shipper-scroll') const shipperScroll = document.getElementById('shipper-scroll')
@ -1463,6 +1464,127 @@ export default {
}, },
textareaChange(e, type) { textareaChange(e, type) {
this.details[type] = e.target.value 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
} }
} }
} }

Loading…
Cancel
Save