1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 12:01:57 +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() { created() {
@ -749,13 +752,14 @@ export default {
containerUuid, containerUuid,
columnName: 'ReferenceNo' columnName: 'ReferenceNo'
}) })
if (this.sendToServer) { if (this.sendToServer) {
this.$store.dispatch('setPaymentBox', { this.$store.dispatch('setPaymentBox', {
posUuid, posUuid,
orderUuid, orderUuid,
bankUuid, bankUuid,
referenceNo, referenceNo,
amount: this.amontSend, amount: this.round(this.amontSend, this.precision),
convertedAmount: this.amontSend * this.dayRate.divideRate, convertedAmount: this.amontSend * this.dayRate.divideRate,
paymentDate, paymentDate,
tenderTypeCode, tenderTypeCode,
@ -767,7 +771,7 @@ export default {
orderUuid, orderUuid,
bankUuid, bankUuid,
referenceNo, referenceNo,
amount: this.amontSend, amount: this.round(this.amontSend, this.precision),
convertedAmount: this.amontSend * this.dayRate.divideRate, convertedAmount: this.amontSend * this.dayRate.divideRate,
paymentDate, paymentDate,
tenderTypeCode, tenderTypeCode,

View File

@ -97,22 +97,6 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </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 <el-col
v-for="field in hiddenFieldsList" v-for="field in hiddenFieldsList"
:key="field.sequence" :key="field.sequence"

View File

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

View File

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