mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-07 18:25:45 +08:00
fixe Point of Sales (#894)
Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
parent
906ff72abc
commit
f8b6eadf09
@ -21,7 +21,7 @@
|
||||
<span>
|
||||
<b>
|
||||
{{ $t('form.pos.collect.convertAmount') }}:
|
||||
{{ formatPrice(amount * convert, displayCurrency) }}
|
||||
{{ formatPrice(amountConvertionTotal, displayCurrency) }}
|
||||
</b>
|
||||
</span>
|
||||
</div>
|
||||
@ -80,11 +80,16 @@ export default {
|
||||
containerUuid: 'Collection-Convert-Amount'
|
||||
}
|
||||
}
|
||||
},
|
||||
isOpen: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fieldsList: fieldsListConvertAmountCollection
|
||||
fieldsList: fieldsListConvertAmountCollection,
|
||||
amountConvertionTotal: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -105,6 +110,55 @@ export default {
|
||||
containerUuid: 'Collection-Convert-Amount',
|
||||
columnName: 'C_Currency_ID_UUID'
|
||||
})
|
||||
},
|
||||
currentPointOfSales() {
|
||||
return this.$store.getters.posAttributes.currentPointOfSales
|
||||
},
|
||||
pointOfSalesCurrency() {
|
||||
// const currency = this.currentPointOfSales
|
||||
if (!this.isEmptyValue(this.currentPointOfSales.priceList)) {
|
||||
return {
|
||||
...this.currentPointOfSales.priceList.currency,
|
||||
amountConvertion: 1
|
||||
}
|
||||
}
|
||||
return {
|
||||
uuid: '',
|
||||
iSOCode: '',
|
||||
curSymbol: '',
|
||||
amountConvertion: 1
|
||||
}
|
||||
},
|
||||
dateRate() {
|
||||
return this.$store.getters.getConvertionRate.find(currency => {
|
||||
if (currency.id === this.typeCurrency) {
|
||||
return currency
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dateRate(value) {
|
||||
if (value && !this.isEmptyValue(value.amountConvertion)) {
|
||||
this.amountConvertionTotal = this.amount / value.amountConvertion
|
||||
} else {
|
||||
this.amountConvertionTotal = this.amount
|
||||
}
|
||||
},
|
||||
currencyUuid(value) {
|
||||
const listCurrency = this.$store.getters.getConvertionRate.find(currency => {
|
||||
if (currency.uuid === value) {
|
||||
return currency
|
||||
}
|
||||
})
|
||||
if (listCurrency === undefined) {
|
||||
this.$store.dispatch('conversionDivideRate', {
|
||||
conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
|
||||
currencyFromUuid: this.pointOfSalesCurrency.uuid,
|
||||
conversionDate: this.formatDate(new Date()),
|
||||
currencyToUuid: value
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -112,6 +166,18 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
formatPrice,
|
||||
formatDate(date) {
|
||||
let month = '' + (date.getMonth() + 1)
|
||||
let day = '' + date.getDate()
|
||||
const year = date.getFullYear()
|
||||
if (month.length < 2) {
|
||||
month = '0' + month
|
||||
}
|
||||
if (day.length < 2) {
|
||||
day = '0' + day
|
||||
}
|
||||
return [year, month, day].join('-')
|
||||
},
|
||||
defaultValueCurrency() {
|
||||
this.$store.commit('updateValueOfField', {
|
||||
containerUuid: this.containerUuid,
|
||||
|
@ -545,7 +545,10 @@ export default {
|
||||
columnName: 'DisplayColumn_PaymentType'
|
||||
})
|
||||
if (!this.isEmptyValue(value.reference) && this.isEmptyValue(displayPaymentType)) {
|
||||
value.reference.directQuery = value.reference.query
|
||||
this.$store.dispatch('getLookupListFromServer', {
|
||||
tableName: value.reference.tableName,
|
||||
query: value.reference.query
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -162,7 +162,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.convertingPaymentMethods()
|
||||
if (this.isEmptyValue(this.labelTypesPayment)) {
|
||||
if (this.isEmptyValue(this.labelTypesPayment.reference) && !this.isEmptyValue(this.listPaymentType.reference)) {
|
||||
this.tenderTypeDisplaye({
|
||||
tableName: this.listPaymentType.reference.tableName,
|
||||
query: this.listPaymentType.reference.query
|
||||
@ -182,7 +182,9 @@ export default {
|
||||
})
|
||||
.then(response => {
|
||||
this.isAddTypePay.forEach(element => {
|
||||
console.log({ element })
|
||||
if (element.currencyUuid !== this.pointOfSalesCurrency.uuid) {
|
||||
element.amount = element.amount / response.multiplyRate
|
||||
element.amountConvertion = element.amount / response.divideRate
|
||||
element.currencyConvertion = response.currencyTo
|
||||
} else {
|
||||
|
@ -228,6 +228,7 @@
|
||||
:convert="multiplyRate"
|
||||
:amount="currentOrder.grandTotal"
|
||||
:currency="pointOfSalesCurrency"
|
||||
:is-open="seeConversion"
|
||||
/>
|
||||
<el-button slot="reference" type="text" style="color: #000000;font-weight: 604!important;font-size: 100%;" @click="seeConversion = !seeConversion">
|
||||
{{ formatPrice(currentOrder.grandTotal, pointOfSalesCurrency.iSOCode) }}
|
||||
|
@ -81,7 +81,7 @@ export default {
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error.message)
|
||||
this.$message({
|
||||
showMessage({
|
||||
type: 'error',
|
||||
message: error.message,
|
||||
showClose: true
|
||||
@ -114,7 +114,6 @@ export default {
|
||||
})
|
||||
.then(orderLine => {
|
||||
dispatch('updateOrderLines', orderLine)
|
||||
// this.fillOrderLine(orderLine)
|
||||
this.reloadOrder(true, orderUuid)
|
||||
})
|
||||
.catch(error => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user