mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 12:01:57 +08:00
Add Day Rate (#936)
* validate displayCurrency * Add Day Rate * minimal changes * add tax to the converted amount * add translation Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
parent
8f0903dd4d
commit
79e9e6659b
@ -21,19 +21,21 @@
|
|||||||
style="height: 100% !important;"
|
style="height: 100% !important;"
|
||||||
@click="focusProductValue"
|
@click="focusProductValue"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<img
|
||||||
|
fit="contain"
|
||||||
|
:src="backgroundForm"
|
||||||
|
class="background-price-checking"
|
||||||
|
style="z-index: 5;"
|
||||||
|
>
|
||||||
<el-container style="height: 100% !important;">
|
<el-container style="height: 100% !important;">
|
||||||
<img
|
|
||||||
fit="contain"
|
|
||||||
:src="backgroundForm"
|
|
||||||
class="background-price-checking"
|
|
||||||
style="z-index: 2;"
|
|
||||||
>
|
|
||||||
<el-main>
|
<el-main>
|
||||||
<el-form
|
<el-form
|
||||||
key="form-loaded"
|
key="form-loaded"
|
||||||
class="inquiry-form"
|
class="inquiry-form"
|
||||||
label-position="top"
|
label-position="top"
|
||||||
label-width="10px"
|
label-width="10px"
|
||||||
|
style="z-index: -1;"
|
||||||
@submit.native.prevent="notSubmitForm"
|
@submit.native.prevent="notSubmitForm"
|
||||||
>
|
>
|
||||||
<field
|
<field
|
||||||
@ -48,13 +50,11 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<div class="inquiry-product" style="z-index: 4;">
|
<div class="inquiry-product" style="z-index: 4;">
|
||||||
|
<div class="product-description">
|
||||||
|
<b> {{ productPrice.productName }} </b> <br> {{ productPrice.productDescription }}
|
||||||
|
</div>
|
||||||
<el-row v-if="!isEmptyValue(productPrice)" :gutter="20">
|
<el-row v-if="!isEmptyValue(productPrice)" :gutter="20">
|
||||||
<el-col style="padding-left: 0px; padding-right: 0%;">
|
<el-col :span="24" style="padding-left: 0px; padding-right: 0%;">
|
||||||
<div class="product-description">
|
|
||||||
{{ productPrice.productName }} {{ productPrice.productDescription }}
|
|
||||||
</div>
|
|
||||||
<br><br><br>
|
|
||||||
|
|
||||||
<div class="product-price-base">
|
<div class="product-price-base">
|
||||||
{{ $t('form.priceChecking.basePrice') }}
|
{{ $t('form.priceChecking.basePrice') }}
|
||||||
<span class="amount">
|
<span class="amount">
|
||||||
@ -70,10 +70,9 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<br><br><br>
|
<br><br><br>
|
||||||
|
|
||||||
<div class="product-price amount">
|
<div class="product-price amount">
|
||||||
<span style="float: right;"> {{ formatPrice(productPrice.grandTotal, productPrice.currency.iSOCode) }} </span> <br>
|
<span style="float: right;"> {{ formatPrice(productPrice.grandTotal, productPrice.currency.iSOCode) }} </span> <br>
|
||||||
<span v-if="!isEmptyValue(currentPointOfSales.displayCurrency)"> {{ formatPrice(productPrice.grandTotalConverted, currentPointOfSales.displayCurrency.iSOCode) }}</span>
|
<span v-if="!isEmptyValue(currentPointOfSales.displayCurrency) && !isEmptyValue(convertionsList)"> {{ formatPrice(productPrice.grandTotal / converted, currentPointOfSales.displayCurrency.iso_code) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -87,6 +86,18 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="!isEmptyValue(productPrice) && !isEmptyValue(currentPointOfSales.displayCurrency) && !isEmptyValue(convertionsList)" class="inquiry-product" style="z-index: 4;">
|
||||||
|
<el-row>
|
||||||
|
<el-col>
|
||||||
|
<div v-if="!isEmptyValue(currentConvertion)" class="rate-date">
|
||||||
|
{{ $t('form.pos.collect.dayRate') }}: {{ formatQuantity(currentConvertion.multiplyRate) }} ~ ({{ formatPrice(1, productPrice.currency.iSOCode) }} = {{ formatPrice(currentConvertion.multiplyRate) }} {{ currentPointOfSales.displayCurrency.iso_code }})
|
||||||
|
</div>
|
||||||
|
<div v-else class="rate-date">
|
||||||
|
{{ $t('form.pos.collect.noDayRate') }} {{ currentPointOfSales.displayCurrency.description }}
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
</div>
|
</div>
|
||||||
@ -105,7 +116,7 @@
|
|||||||
import formMixin from '@/components/ADempiere/Form/formMixin.js'
|
import formMixin from '@/components/ADempiere/Form/formMixin.js'
|
||||||
import fieldsList from './fieldsList.js'
|
import fieldsList from './fieldsList.js'
|
||||||
import { getProductPrice } from '@/api/ADempiere/form/price-checking.js'
|
import { getProductPrice } from '@/api/ADempiere/form/price-checking.js'
|
||||||
import { formatPercent, formatPrice } from '@/utils/ADempiere/valueFormat.js'
|
import { formatPercent, formatPrice, formatQuantity } from '@/utils/ADempiere/valueFormat.js'
|
||||||
import { getImagePath } from '@/utils/ADempiere/resource.js'
|
import { getImagePath } from '@/utils/ADempiere/resource.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -143,7 +154,31 @@ export default {
|
|||||||
return this.$store.state['pointOfSales/point/index'].conversionsList
|
return this.$store.state['pointOfSales/point/index'].conversionsList
|
||||||
},
|
},
|
||||||
currentConvertion() {
|
currentConvertion() {
|
||||||
return this.convertionsList.find(convert => convert.currencyTo.id === this.currentPointOfSales.displayCurrency.id)
|
if (this.isEmptyValue(this.currentPointOfSales.displayCurrency)) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
const convert = this.convertionsList.find(convert => {
|
||||||
|
if (!this.isEmptyValue(convert.currencyTo) && !this.isEmptyValue(this.currentPointOfSales.displayCurrency) && convert.currencyTo.id === this.currentPointOfSales.displayCurrency.id) {
|
||||||
|
return convert
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (convert) {
|
||||||
|
return convert
|
||||||
|
}
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
converted() {
|
||||||
|
if (!this.isEmptyValue(this.convertionsList)) {
|
||||||
|
const convertion = this.convertionsList.find(convert => {
|
||||||
|
if (!this.isEmptyValue(convert.currencyTo) && !this.isEmptyValue(this.currentPointOfSales.displayCurrency) && convert.currencyTo.id === this.currentPointOfSales.displayCurrency.id) {
|
||||||
|
return convert
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (!this.isEmptyValue(convertion)) {
|
||||||
|
return convertion.divideRate
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -155,13 +190,6 @@ export default {
|
|||||||
if (this.isEmptyValue(this.pointOfSalesList)) {
|
if (this.isEmptyValue(this.pointOfSalesList)) {
|
||||||
this.$store.dispatch('listPointOfSalesFromServer')
|
this.$store.dispatch('listPointOfSalesFromServer')
|
||||||
}
|
}
|
||||||
if (!this.isEmptyValue(this.pointOfSalesList) && this.isEmptyValue(this.currentConvertion)) {
|
|
||||||
this.$store.dispatch('searchConversion', {
|
|
||||||
conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
|
|
||||||
currencyFromUuid: this.currentPointOfSales.priceList.currency.uuid,
|
|
||||||
currencyToUuid: this.currentPointOfSales.displayCurrency.uuid
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.unsubscribe()
|
this.unsubscribe()
|
||||||
@ -169,6 +197,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
formatPercent,
|
formatPercent,
|
||||||
formatPrice,
|
formatPrice,
|
||||||
|
formatQuantity,
|
||||||
focusProductValue() {
|
focusProductValue() {
|
||||||
if (!this.isEmptyValue(this.$refs.ProductValue[0])) {
|
if (!this.isEmptyValue(this.$refs.ProductValue[0])) {
|
||||||
this.$refs.ProductValue[0].$children[0].$children[0].$children[1].$children[0].focus()
|
this.$refs.ProductValue[0].$children[0].$children[0].$children[1].$children[0].focus()
|
||||||
@ -180,14 +209,19 @@ export default {
|
|||||||
}
|
}
|
||||||
const image = getImagePath({
|
const image = getImagePath({
|
||||||
file: fileName,
|
file: fileName,
|
||||||
width: 250,
|
width: 900,
|
||||||
height: 280
|
height: 900
|
||||||
})
|
})
|
||||||
this.backgroundForm = image.uri
|
this.backgroundForm = image.uri
|
||||||
},
|
},
|
||||||
amountConvert(price, currency) {
|
amountConvert() {
|
||||||
const convertion = this.convertionsList.find(convert => convert.currencyTo.id === currency.id)
|
if (!this.isEmptyValue(this.currentPointOfSales) && this.isEmptyValue(this.currentConvertion) && !this.isEmptyValue(this.currentPointOfSales.displayCurrency)) {
|
||||||
return price / convertion.divideRate
|
this.$store.dispatch('searchConversion', {
|
||||||
|
conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
|
||||||
|
currencyFromUuid: this.currentPointOfSales.priceList.currency.uuid,
|
||||||
|
currencyToUuid: this.currentPointOfSales.displayCurrency.uuid
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
subscribeChanges() {
|
subscribeChanges() {
|
||||||
return this.$store.subscribe((mutation, state) => {
|
return this.$store.subscribe((mutation, state) => {
|
||||||
@ -218,7 +252,6 @@ export default {
|
|||||||
priceStandard: productPrice.priceStandard,
|
priceStandard: productPrice.priceStandard,
|
||||||
priceList: productPrice.priceList,
|
priceList: productPrice.priceList,
|
||||||
priceLimit: productPrice.priceLimit,
|
priceLimit: productPrice.priceLimit,
|
||||||
grandTotalConverted: this.amountConvert(productPrice.priceStandard, this.currentPointOfSales.displayCurrency),
|
|
||||||
taxRate: rate,
|
taxRate: rate,
|
||||||
taxName: taxRate.name,
|
taxName: taxRate.name,
|
||||||
taxIndicator: taxRate.taxIndicator,
|
taxIndicator: taxRate.taxIndicator,
|
||||||
@ -232,6 +265,7 @@ export default {
|
|||||||
this.productPrice = {}
|
this.productPrice = {}
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
this.amountConvert()
|
||||||
this.$store.commit('updateValueOfField', {
|
this.$store.commit('updateValueOfField', {
|
||||||
containerUuid: this.containerUuid,
|
containerUuid: this.containerUuid,
|
||||||
columnName: 'ProductValue',
|
columnName: 'ProductValue',
|
||||||
@ -271,7 +305,6 @@ export default {
|
|||||||
priceList: productPrice.priceList,
|
priceList: productPrice.priceList,
|
||||||
priceLimit: productPrice.priceLimit,
|
priceLimit: productPrice.priceLimit,
|
||||||
schemaCurrency: productPrice.schemaCurrency,
|
schemaCurrency: productPrice.schemaCurrency,
|
||||||
grandTotalConverted: this.amountConvert(productPrice.priceStandard, this.currentPointOfSales.displayCurrency),
|
|
||||||
schemaPriceStandard: productPrice.schemaPriceStandard,
|
schemaPriceStandard: productPrice.schemaPriceStandard,
|
||||||
schemaPriceList: productPrice.schemaPriceList,
|
schemaPriceList: productPrice.schemaPriceList,
|
||||||
schemaPriceLimit: productPrice.schemaPriceLimit,
|
schemaPriceLimit: productPrice.schemaPriceLimit,
|
||||||
@ -287,6 +320,7 @@ export default {
|
|||||||
this.productPrice = {}
|
this.productPrice = {}
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
this.amountConvert()
|
||||||
this.$store.commit('updateValueOfField', {
|
this.$store.commit('updateValueOfField', {
|
||||||
containerUuid: this.containerUuid,
|
containerUuid: this.containerUuid,
|
||||||
columnName: 'ProductValue',
|
columnName: 'ProductValue',
|
||||||
@ -340,7 +374,9 @@ export default {
|
|||||||
color: #32363a;
|
color: #32363a;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
float: right;
|
float: right;
|
||||||
padding-bottom: 0px;
|
padding-bottom: 1%;
|
||||||
|
text-align: end;
|
||||||
|
|
||||||
}
|
}
|
||||||
.product-price-base, .product-tax {
|
.product-price-base, .product-tax {
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
@ -351,7 +387,14 @@ export default {
|
|||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
.rate-date {
|
||||||
|
padding-top: 30%;
|
||||||
|
font-size: 50px;
|
||||||
|
float: right;
|
||||||
|
color: black;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: end;
|
||||||
|
}
|
||||||
.inquiry-form {
|
.inquiry-form {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 5%;
|
right: 5%;
|
||||||
@ -361,8 +404,7 @@ export default {
|
|||||||
}
|
}
|
||||||
.inquiry-product {
|
.inquiry-product {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 20%;
|
right: 10%;
|
||||||
width: 100%;
|
|
||||||
top: 33%;
|
top: 33%;
|
||||||
.amount {
|
.amount {
|
||||||
color: black;
|
color: black;
|
||||||
|
@ -477,6 +477,7 @@ export default {
|
|||||||
convertedAmount: 'Converted Amount',
|
convertedAmount: 'Converted Amount',
|
||||||
fullPayment: 'Full Payment',
|
fullPayment: 'Full Payment',
|
||||||
dayRate: 'Day Rate',
|
dayRate: 'Day Rate',
|
||||||
|
noDayRate: 'No daily rate has been generated for the currency.',
|
||||||
TenderType: {
|
TenderType: {
|
||||||
directDeposit: 'Direct Deposit',
|
directDeposit: 'Direct Deposit',
|
||||||
creditCard: 'Credit Card',
|
creditCard: 'Credit Card',
|
||||||
|
@ -452,6 +452,7 @@ export default {
|
|||||||
convertedAmount: 'Monto Convertido',
|
convertedAmount: 'Monto Convertido',
|
||||||
fullPayment: 'Cobro Completo',
|
fullPayment: 'Cobro Completo',
|
||||||
dayRate: 'Tasa del Día',
|
dayRate: 'Tasa del Día',
|
||||||
|
noDayRate: 'No se a generado una tasa del día para la moneda',
|
||||||
TenderType: {
|
TenderType: {
|
||||||
directDeposit: 'Depósito Directo',
|
directDeposit: 'Depósito Directo',
|
||||||
creditCard: 'Tarjeta de Crédito',
|
creditCard: 'Tarjeta de Crédito',
|
||||||
|
@ -112,7 +112,7 @@ export default {
|
|||||||
payment.splice(0)
|
payment.splice(0)
|
||||||
},
|
},
|
||||||
searchConversion({ commit }, params) {
|
searchConversion({ commit }, params) {
|
||||||
requestGetConversionRate({
|
return requestGetConversionRate({
|
||||||
conversionTypeUuid: params.conversionTypeUuid,
|
conversionTypeUuid: params.conversionTypeUuid,
|
||||||
currencyFromUuid: params.currencyFromUuid,
|
currencyFromUuid: params.currencyFromUuid,
|
||||||
currencyToUuid: params.currencyToUuid,
|
currencyToUuid: params.currencyToUuid,
|
||||||
@ -120,6 +120,7 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
commit('addConversionToList', response)
|
commit('addConversionToList', response)
|
||||||
|
return response
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn(`conversionDivideRate: ${error.message}. Code: ${error.code}.`)
|
console.warn(`conversionDivideRate: ${error.message}. Code: ${error.code}.`)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user