1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-07 18:25:45 +08:00

Add function for number formatting in decimals (#1088)

* Add function for number formatting in decimals

* minimal changes

* rename function

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-08-20 03:08:10 -04:00 committed by GitHub
parent 37eb7240f9
commit 54a4612e7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 18 deletions

View File

@ -670,6 +670,9 @@ export default {
}
})
}
},
precision() {
return this.$store.getters.getCurrency.standardPrecision
}
},
created() {
@ -749,13 +752,14 @@ export default {
containerUuid,
columnName: 'ReferenceNo'
})
if (this.sendToServer) {
this.$store.dispatch('setPaymentBox', {
posUuid,
orderUuid,
bankUuid,
referenceNo,
amount: this.amontSend,
amount: this.round(this.amontSend, this.precision),
convertedAmount: this.amontSend * this.dayRate.divideRate,
paymentDate,
tenderTypeCode,
@ -767,7 +771,7 @@ export default {
orderUuid,
bankUuid,
referenceNo,
amount: this.amontSend,
amount: this.round(this.amontSend, this.precision),
convertedAmount: this.amontSend * this.dayRate.divideRate,
paymentDate,
tenderTypeCode,

View File

@ -97,22 +97,6 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item v-if="displayeCurrency" :label="$t('form.pos.collect.Currency')">
<el-select
v-model="currentFieldCurrency"
style="width: -webkit-fill-available;"
@change="changeCurrency"
>
<el-option
v-for="item in listCurrency"
:key="item.id"
:label="item.name"
:value="item.key"
/>
</el-select>
</el-form-item>
</el-col>
<el-col
v-for="field in hiddenFieldsList"
:key="field.sequence"

View File

@ -24,6 +24,7 @@ export {
currencyFind,
tenderTypeFind,
formatConversionCurrenty,
round,
convertValuesToSend,
typeValue
} from '@/utils/ADempiere/valueUtils.js'

View File

@ -114,6 +114,13 @@ export function extractPagingToken(token) {
return onlyToken
}
/**
* @param {number} number
*/
export function round(number, standardPrecision) {
const amount = number.toFixed(standardPrecision)
return Number(amount)
}
/**
* zero pad
* @author EdwinBetanc0urt <EdwinBetanc0urt@oulook.com>