1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 20:39:48 +08:00

fixe errors at the point of sale (#902)

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-06-02 22:14:45 -04:00 committed by GitHub
parent c6cc1df91f
commit 6436b33479
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 51 additions and 29 deletions

View File

@ -19,6 +19,7 @@
<el-container style="background: white; height: 100% !important;"> <el-container style="background: white; height: 100% !important;">
<el-main style="background: white; padding: 0px; height: 100% !important; overflow: hidden"> <el-main style="background: white; padding: 0px; height: 100% !important; overflow: hidden">
<el-container style="background: white; padding: 0px; height: 100% !important;"> <el-container style="background: white; padding: 0px; height: 100% !important;">
<!-- Collection container top panel -->
<el-header style="height: auto; padding-bottom: 10px; padding-right: 0px; padding-left: 0px"> <el-header style="height: auto; padding-bottom: 10px; padding-right: 0px; padding-left: 0px">
<el-card class="box-card" style="padding-left: 0px; padding-right: 0px"> <el-card class="box-card" style="padding-left: 0px; padding-right: 0px">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
@ -59,14 +60,22 @@
</b> </b>
</p> </p>
<p class="total"> <p class="total">
<b>Tasa del Día: </b> <b>{{ $t('form.pos.collect.dayRate') }}:</b>
<!-- Conversion rate to date -->
<b v-if="!isEmptyValue(dateRate)" style="float: right;"> <b v-if="!isEmptyValue(dateRate)" style="float: right;">
{{ <span v-if="formatConversionCurrenty(dateRate.amountConvertion) > 100">
dateRate.iSOCode {{
}} formatPrice(formatConversionCurrenty(dateRate.amountConvertion), dateRate.iSOCode)
{{ }}
formatConversionCurrenty(dateRate.amountConvertion) </span>
}} <span v-else>
{{
dateRate.iSOCode
}}
{{
formatConversionCurrenty(dateRate.amountConvertion)
}}
</span>
</b> </b>
</p> </p>
</div> </div>
@ -82,11 +91,12 @@
> >
<el-row> <el-row>
<el-col v-for="(field, index) in fieldsList" :key="index" :span="8"> <el-col v-for="(field, index) in fieldsList" :key="index" :span="8">
<!-- Add selected currency symbol -->
<field-definition <field-definition
:key="field.columnName" :key="field.columnName"
:metadata-field="field.columnName === 'PayAmt' ? { :metadata-field="field.columnName === 'PayAmt' ? {
...field, ...field,
labelCurrency: isEmptyValue($store.getters.getFieldCuerrency) ? pointOfSalesCurrency : $store.getters.getFieldCuerrency labelCurrency: dateRate
} : field" } : field"
/> />
</el-col> </el-col>
@ -101,6 +111,7 @@
<el-button type="success" :disabled="validateCompleteCollection || isDisabled" icon="el-icon-shopping-cart-full" @click="completePreparedOrder(listPayments)" /> <el-button type="success" :disabled="validateCompleteCollection || isDisabled" icon="el-icon-shopping-cart-full" @click="completePreparedOrder(listPayments)" />
</samp> </samp>
</el-header> </el-header>
<!-- Panel where they show the payments registered from the collection container -->
<el-main style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;"> <el-main style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;">
<type-collection <type-collection
v-if="!updateOrderPaymentPos" v-if="!updateOrderPaymentPos"
@ -120,7 +131,7 @@
class="view-loading" class="view-loading"
/> />
</el-main> </el-main>
<!-- Collection container bottom panel -->
<el-footer height="auto" style="padding-left: 0px; padding-right: 0px;"> <el-footer height="auto" style="padding-left: 0px; padding-right: 0px;">
<el-row :gutter="24" style="background-color: rgb(245, 247, 250);"> <el-row :gutter="24" style="background-color: rgb(245, 247, 250);">
<el-col :span="24"> <el-col :span="24">
@ -571,7 +582,11 @@ export default {
let sum = 0 let sum = 0
if (cash) { if (cash) {
cash.forEach((pay) => { cash.forEach((pay) => {
sum += pay.amount if (!this.isEmptyValue(pay.divideRate)) {
sum += pay.amountConvertion / pay.divideRate
} else {
sum += pay.amount
}
}) })
} }
return sum return sum

View File

@ -68,7 +68,10 @@
style="padding-bottom: 20px;" style="padding-bottom: 20px;"
> >
<p class="total"> <p class="total">
<b style="float: right;"> <b v-if="!isEmptyValue(value.multiplyRate)" style="float: right;">
{{ formatPrice(value.multiplyRate, currency.iSOCode) }}
</b>
<b v-else style="float: right;">
{{ formatPrice(value.amount, currency.iSOCode) }} {{ formatPrice(value.amount, currency.iSOCode) }}
</b> </b>
</p> </p>
@ -148,6 +151,10 @@ export default {
}, },
conevertionAmount() { conevertionAmount() {
return this.$store.getters.getConvertionPayment return this.$store.getters.getConvertionPayment
},
// Validate if there is a payment in a different type of currency to the point
paymentCurrency() {
return this.$store.getters.posAttributes.currentPointOfSales.currentOrder.listPayments.payments.find(pay => pay.currencyUuid !== this.currency.uuid)
} }
}, },
watch: { watch: {
@ -172,23 +179,21 @@ export default {
methods: { methods: {
formatDate, formatDate,
formatPrice, formatPrice,
// If there are payments in another currency, search for conversion
convertingPaymentMethods() { convertingPaymentMethods() {
const currencyUuid = this.isAddTypePay.find(pay => pay.currencyUuid !== this.currency.uuid) if (!this.isEmptyValue(this.paymentCurrency)) {
if (!this.isEmptyValue(currencyUuid)) {
requestGetConversionRate({ requestGetConversionRate({
conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid, conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
currencyFromUuid: this.currency.uuid, currencyFromUuid: this.currency.uuid,
currencyToUuid: currencyUuid.currencyUuid currencyToUuid: this.paymentCurrency.currencyUuid
}) })
.then(response => { .then(response => {
this.isAddTypePay.forEach(element => { this.$store.getters.posAttributes.currentPointOfSales.currentOrder.listPayments.payments.forEach(element => {
console.log({ element })
if (element.currencyUuid !== this.pointOfSalesCurrency.uuid) { if (element.currencyUuid !== this.pointOfSalesCurrency.uuid) {
element.amount = element.amount / response.multiplyRate element.multiplyRate = element.amount / response.multiplyRate
element.amountConvertion = element.amount / response.divideRate element.amountConvertion = element.multiplyRate / response.divideRate
element.divideRate = response.multiplyRate
element.currencyConvertion = response.currencyTo element.currencyConvertion = response.currencyTo
} else {
element.currencyConvertion = {}
} }
}) })
this.$store.commit('setListPayments', { this.$store.commit('setListPayments', {
@ -251,6 +256,7 @@ export default {
paymentUuid paymentUuid
}) })
}, },
// Payment card label
tenderTypeDisplaye({ tenderTypeDisplaye({
tableName, tableName,
query query

View File

@ -389,8 +389,8 @@ export default {
processOrder({ processOrder({
posUuid, posUuid,
orderUuid: this.$route.query.action, orderUuid: this.$route.query.action,
createPayments: !this.isEmptyValue(this.currentOrder.listPayments), createPayments: false,
payments: this.currentOrder.listPayments payments: []
}) })
.then(response => { .then(response => {
this.$store.dispatch('reloadOrder', response.uuid) this.$store.dispatch('reloadOrder', response.uuid)

View File

@ -371,18 +371,18 @@ export default {
return 12 return 12
} }
if (this.isEmptyValue(this.currentOrder)) { if (this.isEmptyValue(this.currentOrder)) {
return 14 return 9
} }
return 11 return 7
}, },
colFieldProductCode() { colFieldProductCode() {
if (this.isMobile) { if (this.isMobile) {
return 12 return 12
} }
if (this.isEmptyValue(this.currentOrder)) { if (this.isEmptyValue(this.currentOrder)) {
return 9 return 14
} }
return 7 return 11
}, },
shortsKey() { shortsKey() {
return { return {

View File

@ -472,6 +472,7 @@ export default {
change: 'Change', change: 'Change',
convertAmount: 'Convert Quantity', convertAmount: 'Convert Quantity',
fullPayment: 'Full Payment', fullPayment: 'Full Payment',
dayRate: 'Day Rate',
TenderType: { TenderType: {
directDeposit: 'Direct Deposit', directDeposit: 'Direct Deposit',
creditCard: 'Credit Card', creditCard: 'Credit Card',

View File

@ -447,6 +447,7 @@ export default {
change: 'Cambio', change: 'Cambio',
convertAmount: 'Convertir Cantidad', convertAmount: 'Convertir Cantidad',
fullPayment: 'Cobro Completo', fullPayment: 'Cobro Completo',
dayRate: 'Tasa del Día',
TenderType: { TenderType: {
directDeposit: 'Depósito Directo', directDeposit: 'Depósito Directo',
creditCard: 'Tarjeta de Crédito', creditCard: 'Tarjeta de Crédito',

View File

@ -732,7 +732,6 @@ const actions = {
sqlStatement sqlStatement
}) { }) {
// const contextInforField = getters.getContextInfoField(contextInfoUuid, sqlStatement) // const contextInforField = getters.getContextInfoField(contextInfoUuid, sqlStatement)
// console.log({ contextInforField })
// if (contextInforField) { // if (contextInforField) {
// return contextInforField // return contextInforField
// } // }
@ -742,7 +741,6 @@ const actions = {
query: sqlStatement query: sqlStatement
}) })
.then(contextInfoResponse => { .then(contextInfoResponse => {
console.log({ contextInfoResponse })
commit('setContextInfoField', { commit('setContextInfoField', {
contextInfoUuid, contextInfoUuid,
sqlStatement, sqlStatement,

View File

@ -123,7 +123,8 @@ export default {
if (!isEmptyValue(response.currencyTo)) { if (!isEmptyValue(response.currencyTo)) {
const currency = { const currency = {
...response.currencyTo, ...response.currencyTo,
amountConvertion: response.divideRate amountConvertion: response.divideRate,
multiplyRate: response.multiplyRate
} }
dispatch('addRateConvertion', currency) dispatch('addRateConvertion', currency)
} }