mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 12:01:57 +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>
|
<span>
|
||||||
<b>
|
<b>
|
||||||
{{ $t('form.pos.collect.convertAmount') }}:
|
{{ $t('form.pos.collect.convertAmount') }}:
|
||||||
{{ formatPrice(amount * convert, displayCurrency) }}
|
{{ formatPrice(amountConvertionTotal, displayCurrency) }}
|
||||||
</b>
|
</b>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@ -80,11 +80,16 @@ export default {
|
|||||||
containerUuid: 'Collection-Convert-Amount'
|
containerUuid: 'Collection-Convert-Amount'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
isOpen: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
fieldsList: fieldsListConvertAmountCollection
|
fieldsList: fieldsListConvertAmountCollection,
|
||||||
|
amountConvertionTotal: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -105,6 +110,55 @@ export default {
|
|||||||
containerUuid: 'Collection-Convert-Amount',
|
containerUuid: 'Collection-Convert-Amount',
|
||||||
columnName: 'C_Currency_ID_UUID'
|
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() {
|
created() {
|
||||||
@ -112,6 +166,18 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formatPrice,
|
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() {
|
defaultValueCurrency() {
|
||||||
this.$store.commit('updateValueOfField', {
|
this.$store.commit('updateValueOfField', {
|
||||||
containerUuid: this.containerUuid,
|
containerUuid: this.containerUuid,
|
||||||
|
@ -545,7 +545,10 @@ export default {
|
|||||||
columnName: 'DisplayColumn_PaymentType'
|
columnName: 'DisplayColumn_PaymentType'
|
||||||
})
|
})
|
||||||
if (!this.isEmptyValue(value.reference) && this.isEmptyValue(displayPaymentType)) {
|
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() {
|
created() {
|
||||||
this.convertingPaymentMethods()
|
this.convertingPaymentMethods()
|
||||||
if (this.isEmptyValue(this.labelTypesPayment)) {
|
if (this.isEmptyValue(this.labelTypesPayment.reference) && !this.isEmptyValue(this.listPaymentType.reference)) {
|
||||||
this.tenderTypeDisplaye({
|
this.tenderTypeDisplaye({
|
||||||
tableName: this.listPaymentType.reference.tableName,
|
tableName: this.listPaymentType.reference.tableName,
|
||||||
query: this.listPaymentType.reference.query
|
query: this.listPaymentType.reference.query
|
||||||
@ -182,7 +182,9 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.isAddTypePay.forEach(element => {
|
this.isAddTypePay.forEach(element => {
|
||||||
|
console.log({ element })
|
||||||
if (element.currencyUuid !== this.pointOfSalesCurrency.uuid) {
|
if (element.currencyUuid !== this.pointOfSalesCurrency.uuid) {
|
||||||
|
element.amount = element.amount / response.multiplyRate
|
||||||
element.amountConvertion = element.amount / response.divideRate
|
element.amountConvertion = element.amount / response.divideRate
|
||||||
element.currencyConvertion = response.currencyTo
|
element.currencyConvertion = response.currencyTo
|
||||||
} else {
|
} else {
|
||||||
|
@ -228,6 +228,7 @@
|
|||||||
:convert="multiplyRate"
|
:convert="multiplyRate"
|
||||||
:amount="currentOrder.grandTotal"
|
:amount="currentOrder.grandTotal"
|
||||||
:currency="pointOfSalesCurrency"
|
:currency="pointOfSalesCurrency"
|
||||||
|
:is-open="seeConversion"
|
||||||
/>
|
/>
|
||||||
<el-button slot="reference" type="text" style="color: #000000;font-weight: 604!important;font-size: 100%;" @click="seeConversion = !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) }}
|
{{ formatPrice(currentOrder.grandTotal, pointOfSalesCurrency.iSOCode) }}
|
||||||
|
@ -81,7 +81,7 @@ export default {
|
|||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error(error.message)
|
console.error(error.message)
|
||||||
this.$message({
|
showMessage({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: error.message,
|
message: error.message,
|
||||||
showClose: true
|
showClose: true
|
||||||
@ -114,7 +114,6 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(orderLine => {
|
.then(orderLine => {
|
||||||
dispatch('updateOrderLines', orderLine)
|
dispatch('updateOrderLines', orderLine)
|
||||||
// this.fillOrderLine(orderLine)
|
|
||||||
this.reloadOrder(true, orderUuid)
|
this.reloadOrder(true, orderUuid)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user