mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 12:01:57 +08:00
Fix Pos (#977)
* Fixe POs * fixes Currency * delete comment Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
parent
62f59c4a9b
commit
427469e12f
@ -24,6 +24,7 @@ export default [
|
|||||||
columnName: 'PayAmt',
|
columnName: 'PayAmt',
|
||||||
isFromDictionary: true,
|
isFromDictionary: true,
|
||||||
overwriteDefinition: {
|
overwriteDefinition: {
|
||||||
|
sequence: 0,
|
||||||
handleContentSelection: true,
|
handleContentSelection: true,
|
||||||
handleActionPerformed: true,
|
handleActionPerformed: true,
|
||||||
size: 24,
|
size: 24,
|
||||||
@ -32,20 +33,6 @@ export default [
|
|||||||
isMandatory: true
|
isMandatory: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Currency
|
|
||||||
{
|
|
||||||
tableName: 'C_Order',
|
|
||||||
columnName: 'C_Currency_ID',
|
|
||||||
isFromDictionary: true,
|
|
||||||
overwriteDefinition: {
|
|
||||||
size: 24,
|
|
||||||
handleActionKeyPerformed: true,
|
|
||||||
handleActionPerformed: true,
|
|
||||||
validationCode: 'C_Currency.C_Currency_ID = 100 OR C_Currency.C_Currency_ID = 50001',
|
|
||||||
isActiveLogics: true,
|
|
||||||
isMandatory: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// TenderType
|
// TenderType
|
||||||
{
|
{
|
||||||
tableName,
|
tableName,
|
||||||
@ -54,6 +41,7 @@ export default [
|
|||||||
isFromDictionary: true,
|
isFromDictionary: true,
|
||||||
overwriteDefinition: {
|
overwriteDefinition: {
|
||||||
defaultValue: 'X',
|
defaultValue: 'X',
|
||||||
|
sequence: 1,
|
||||||
handleActionKeyPerformed: true,
|
handleActionKeyPerformed: true,
|
||||||
handleContentSelection: true,
|
handleContentSelection: true,
|
||||||
handleActionPerformed: true,
|
handleActionPerformed: true,
|
||||||
@ -62,16 +50,18 @@ export default [
|
|||||||
isMandatory: true
|
isMandatory: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// Currency
|
||||||
// Bank
|
// Bank
|
||||||
{
|
{
|
||||||
tableName,
|
tableName,
|
||||||
columnName: 'C_Bank_ID',
|
columnName: 'C_Bank_ID',
|
||||||
isFromDictionary: true,
|
isFromDictionary: true,
|
||||||
overwriteDefinition: {
|
overwriteDefinition: {
|
||||||
|
sequence: 3,
|
||||||
handleActionKeyPerformed: true,
|
handleActionKeyPerformed: true,
|
||||||
handleActionPerformed: true,
|
handleActionPerformed: true,
|
||||||
handleContentSelection: true,
|
handleContentSelection: true,
|
||||||
displayLogic: `@TenderType@=='D'`,
|
displayLogic: `@TenderType@<>'X'`,
|
||||||
size: 24,
|
size: 24,
|
||||||
isActiveLogics: true,
|
isActiveLogics: true,
|
||||||
isMandatory: true
|
isMandatory: true
|
||||||
@ -83,6 +73,7 @@ export default [
|
|||||||
elementColumnName: 'DateTrx',
|
elementColumnName: 'DateTrx',
|
||||||
isFromDictionary: true,
|
isFromDictionary: true,
|
||||||
overwriteDefinition: {
|
overwriteDefinition: {
|
||||||
|
sequence: 4,
|
||||||
handleFocusGained: true,
|
handleFocusGained: true,
|
||||||
handleFocusLost: true,
|
handleFocusLost: true,
|
||||||
handleKeyPressed: true,
|
handleKeyPressed: true,
|
||||||
@ -102,6 +93,7 @@ export default [
|
|||||||
columnName: 'ReferenceNo',
|
columnName: 'ReferenceNo',
|
||||||
isFromDictionary: true,
|
isFromDictionary: true,
|
||||||
overwriteDefinition: {
|
overwriteDefinition: {
|
||||||
|
sequence: 5,
|
||||||
handleActionKeyPerformed: true,
|
handleActionKeyPerformed: true,
|
||||||
handleContentSelection: true,
|
handleContentSelection: true,
|
||||||
handleActionPerformed: true,
|
handleActionPerformed: true,
|
||||||
@ -118,6 +110,7 @@ export default [
|
|||||||
columnName: 'CreditCardType',
|
columnName: 'CreditCardType',
|
||||||
isFromDictionary: true,
|
isFromDictionary: true,
|
||||||
overwriteDefinition: {
|
overwriteDefinition: {
|
||||||
|
sequence: 6,
|
||||||
defaultValue: 'M',
|
defaultValue: 'M',
|
||||||
handleActionKeyPerformed: true,
|
handleActionKeyPerformed: true,
|
||||||
handleContentSelection: true,
|
handleContentSelection: true,
|
||||||
@ -135,6 +128,7 @@ export default [
|
|||||||
columnName: 'CreditCardNumber',
|
columnName: 'CreditCardNumber',
|
||||||
isFromDictionary: true,
|
isFromDictionary: true,
|
||||||
overwriteDefinition: {
|
overwriteDefinition: {
|
||||||
|
sequence: 7,
|
||||||
handleActionKeyPerformed: true,
|
handleActionKeyPerformed: true,
|
||||||
handleContentSelection: true,
|
handleContentSelection: true,
|
||||||
handleActionPerformed: true,
|
handleActionPerformed: true,
|
||||||
@ -151,6 +145,7 @@ export default [
|
|||||||
columnName: 'AccountNo',
|
columnName: 'AccountNo',
|
||||||
isFromDictionary: true,
|
isFromDictionary: true,
|
||||||
overwriteDefinition: {
|
overwriteDefinition: {
|
||||||
|
sequence: 8,
|
||||||
handleActionKeyPerformed: true,
|
handleActionKeyPerformed: true,
|
||||||
handleContentSelection: true,
|
handleContentSelection: true,
|
||||||
handleActionPerformed: true,
|
handleActionPerformed: true,
|
||||||
|
@ -62,25 +62,25 @@
|
|||||||
<p class="total">
|
<p class="total">
|
||||||
<b>{{ $t('form.pos.collect.dayRate') }}:</b>
|
<b>{{ $t('form.pos.collect.dayRate') }}:</b>
|
||||||
<!-- Conversion rate to date -->
|
<!-- Conversion rate to date -->
|
||||||
<b v-if="!isEmptyValue(dateRate)" style="float: right;">
|
<b v-if="!isEmptyValue(dayRate)" style="float: right;">
|
||||||
<span v-if="!isEmptyValue(dateRate.divideRate)">
|
<span v-if="!isEmptyValue(dayRate.divideRate)">
|
||||||
<span v-if="formatConversionCurrenty(dateRate.divideRate) > 1">
|
<span v-if="formatConversionCurrenty(dayRate.divideRate) > 1">
|
||||||
{{
|
{{
|
||||||
formatPrice(formatConversionCurrenty(dateRate.divideRate), dateRate.currencyTo.iSOCode)
|
formatPrice(formatConversionCurrenty(dayRate.divideRate), dayRate.currencyTo.iSOCode)
|
||||||
}}
|
}}
|
||||||
</span>
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{
|
{{
|
||||||
dateRate.currencyTo.iSOCode
|
dayRate.currencyTo.iSOCode
|
||||||
}}
|
}}
|
||||||
{{
|
{{
|
||||||
formatConversionCurrenty(dateRate.divideRate)
|
formatConversionCurrenty(dayRate.divideRate)
|
||||||
}}
|
}}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{
|
{{
|
||||||
formatPrice(1, dateRate.iSOCode)
|
formatPrice(1, dayRate.iSOCode)
|
||||||
}}
|
}}
|
||||||
</span>
|
</span>
|
||||||
</b>
|
</b>
|
||||||
@ -100,11 +100,10 @@
|
|||||||
<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 -->
|
<!-- Add selected currency symbol -->
|
||||||
<field-definition
|
<field-definition
|
||||||
v-if="field.columnName === 'PayAmt' || field.columnName === 'TenderType'"
|
v-if="field.sequence <= 1"
|
||||||
:key="field.columnName"
|
|
||||||
:metadata-field="field.columnName === 'PayAmt' ? {
|
:metadata-field="field.columnName === 'PayAmt' ? {
|
||||||
...field,
|
...field,
|
||||||
labelCurrency: isEmptyValue(dateRate.divideRate) ? dateRate : dateRate.currencyTo
|
labelCurrency: isEmptyValue(dayRate.divideRate) ? dayRate : dayRate.currencyTo
|
||||||
} : field"
|
} : field"
|
||||||
/>
|
/>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -124,14 +123,12 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col v-for="(field, index) in fieldsList" :key="index" :span="8">
|
<el-col v-for="(field, key) in fieldsList" :key="key" :span="8">
|
||||||
<!-- Add selected currency symbol -->
|
|
||||||
<field-definition
|
<field-definition
|
||||||
v-if="field.columnName !== 'PayAmt' && field.columnName !== 'TenderType' && field.columnName !== 'C_Currency_ID'"
|
v-if="field.sequence > 2"
|
||||||
:key="field.columnName"
|
|
||||||
:metadata-field="field.columnName === 'PayAmt' ? {
|
:metadata-field="field.columnName === 'PayAmt' ? {
|
||||||
...field,
|
...field,
|
||||||
labelCurrency: isEmptyValue(dateRate.divideRate) ? dateRate : dateRate.currencyTo
|
labelCurrency: isEmptyValue(dayRate.divideRate) ? dayRate : dayRate.currencyTo
|
||||||
} : field"
|
} : field"
|
||||||
/>
|
/>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -314,7 +311,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
listCurrency() {
|
listCurrency() {
|
||||||
return this.$store.state['pointOfSales/point/index'].listCurrency
|
return this.$store.state['pointOfSales/point/index'].currenciesList
|
||||||
},
|
},
|
||||||
convertionList() {
|
convertionList() {
|
||||||
return this.$store.state['pointOfSales/point/index'].conversionsList
|
return this.$store.state['pointOfSales/point/index'].conversionsList
|
||||||
@ -530,19 +527,41 @@ export default {
|
|||||||
updateOrderPaymentPos() {
|
updateOrderPaymentPos() {
|
||||||
return this.$store.getters.getUpdatePaymentPos
|
return this.$store.getters.getUpdatePaymentPos
|
||||||
},
|
},
|
||||||
dateRate() {
|
convertionsList() {
|
||||||
const convertion = this.convertionList.find(currency => {
|
return this.$store.state['pointOfSales/point/index'].conversionsList
|
||||||
if ((currency.currencyTo.iSOCode === this.currentFieldCurrency) && (this.pointOfSalesCurrency.iSOCode !== currency.currencyTo.iSOCode)) {
|
},
|
||||||
return currency
|
currentConvertion() {
|
||||||
|
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 (!this.isEmptyValue(convertion)) {
|
if (convert) {
|
||||||
return convertion
|
return convert
|
||||||
|
}
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
dayRate() {
|
||||||
|
const currency = this.listCurrency.find(currency => currency.key === this.currentFieldCurrency)
|
||||||
|
const convert = this.convertionsList.find(convert => {
|
||||||
|
if (!this.isEmptyValue(currency) && !this.isEmptyValue(convert.currencyTo) && currency.id === convert.currencyTo.id && this.currentPointOfSales.currentPriceList.currency.id !== currency.id) {
|
||||||
|
return convert
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (!this.isEmptyValue(convert)) {
|
||||||
|
return convert
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
currencyTo: this.currentPointOfSales.currentPriceList.currency,
|
||||||
|
divideRate: 1,
|
||||||
|
iSOCode: this.currentPointOfSales.currentPriceList.currency.iSOCode
|
||||||
}
|
}
|
||||||
return this.pointOfSalesCurrency
|
|
||||||
},
|
},
|
||||||
fieldsPaymentType() {
|
fieldsPaymentType() {
|
||||||
return this.fieldsList[2]
|
return this.fieldsList[1]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -553,21 +572,6 @@ export default {
|
|||||||
value: value
|
value: value
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 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
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
convertAllPayment(value) {
|
convertAllPayment(value) {
|
||||||
if (!this.isEmptyValue(value)) {
|
if (!this.isEmptyValue(value)) {
|
||||||
this.allPayCurrency = this.pay / value
|
this.allPayCurrency = this.pay / value
|
||||||
@ -583,7 +587,7 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dateRate(value) {
|
dayRate(value) {
|
||||||
if (!this.isEmptyValue(value.divideRate)) {
|
if (!this.isEmptyValue(value.divideRate)) {
|
||||||
this.$store.commit('updateValueOfField', {
|
this.$store.commit('updateValueOfField', {
|
||||||
containerUuid: this.containerUuid,
|
containerUuid: this.containerUuid,
|
||||||
@ -618,6 +622,13 @@ export default {
|
|||||||
this.defaultValueCurrency()
|
this.defaultValueCurrency()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
amountConvert(currency) {
|
||||||
|
this.$store.dispatch('searchConversion', {
|
||||||
|
conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
|
||||||
|
currencyFromUuid: this.currentPointOfSales.priceList.currency.uuid,
|
||||||
|
currencyToUuid: currency.uuid
|
||||||
|
})
|
||||||
|
},
|
||||||
formatNumber({ displayType, number }) {
|
formatNumber({ displayType, number }) {
|
||||||
let fixed = 0
|
let fixed = 0
|
||||||
// Amount, Costs+Prices, Number
|
// Amount, Costs+Prices, Number
|
||||||
@ -668,18 +679,7 @@ export default {
|
|||||||
containerUuid,
|
containerUuid,
|
||||||
columnName: 'ReferenceNo'
|
columnName: 'ReferenceNo'
|
||||||
})
|
})
|
||||||
const currencyUuid = this.$store.getters.getValueOfField({
|
this.amontSend = this.dayRate.divideRate * this.amontSend
|
||||||
containerUuid,
|
|
||||||
columnName: 'C_Currency_ID_UUID'
|
|
||||||
})
|
|
||||||
const currencyId = this.$store.getters.getValueOfField({
|
|
||||||
containerUuid,
|
|
||||||
columnName: 'C_Currency_ID'
|
|
||||||
})
|
|
||||||
const currencyToPay = this.isEmptyValue(currencyUuid) ? currencyId : currencyUuid
|
|
||||||
if (this.isEmptyValue(this.currencyDisplay(currencyToPay)) && this.currencyDisplay(currencyToPay).currencyUuid !== this.pointOfSalesCurrency.uuid) {
|
|
||||||
this.amontSend = this.convert.divideRate * this.amontSend
|
|
||||||
}
|
|
||||||
if (this.sendToServer) {
|
if (this.sendToServer) {
|
||||||
this.$store.dispatch('setPaymentBox', {
|
this.$store.dispatch('setPaymentBox', {
|
||||||
posUuid,
|
posUuid,
|
||||||
@ -689,7 +689,7 @@ export default {
|
|||||||
amount: this.amontSend * this.convertion,
|
amount: this.amontSend * this.convertion,
|
||||||
paymentDate,
|
paymentDate,
|
||||||
tenderTypeCode,
|
tenderTypeCode,
|
||||||
currencyUuid
|
currencyUuid: this.dayRate.currencyTo.uuid
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.$store.dispatch('createPayments', {
|
this.$store.dispatch('createPayments', {
|
||||||
@ -700,7 +700,7 @@ export default {
|
|||||||
amount: this.amontSend * this.convertion,
|
amount: this.amontSend * this.convertion,
|
||||||
paymentDate,
|
paymentDate,
|
||||||
tenderTypeCode,
|
tenderTypeCode,
|
||||||
currencyUuid: this.currencyDisplay(currencyToPay)
|
currencyUuid: this.dayRate.currencyTo.uuid
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.addCollect()
|
this.addCollect()
|
||||||
@ -838,14 +838,6 @@ export default {
|
|||||||
}
|
}
|
||||||
return currency
|
return currency
|
||||||
},
|
},
|
||||||
convertCurrency() {
|
|
||||||
const convertCurrency = this.currencyDisplay(100)
|
|
||||||
this.$store.dispatch('convertionPayment', {
|
|
||||||
conversionTypeUuid: this.currentPointOfSales,
|
|
||||||
currencyFromUuid: this.pointOfSalesCurrency.uuid,
|
|
||||||
currencyToUuid: convertCurrency.currencyUuid
|
|
||||||
})
|
|
||||||
},
|
|
||||||
undoPatment() {
|
undoPatment() {
|
||||||
const list = this.listPayments[this.listPayments.length - 1]
|
const list = this.listPayments[this.listPayments.length - 1]
|
||||||
const orderUuid = list.orderUuid
|
const orderUuid = list.orderUuid
|
||||||
@ -918,14 +910,13 @@ export default {
|
|||||||
changeCurrency(value) {
|
changeCurrency(value) {
|
||||||
this.currentFieldCurrency = value
|
this.currentFieldCurrency = value
|
||||||
const currency = this.listCurrency.find(currency => currency.key === value)
|
const currency = this.listCurrency.find(currency => currency.key === value)
|
||||||
const findCoventionList = this.convertionList.find(convertion => convertion.currencyTo.iSOCode === value)
|
const convert = this.convertionsList.find(convert => {
|
||||||
if (!this.isEmptyValue(currency) && this.isEmptyValue(findCoventionList) && (value !== this.pointOfSalesCurrency.iSOCode)) {
|
if (!this.isEmptyValue(currency) && !this.isEmptyValue(convert.currencyTo) && currency.id === convert.currencyTo.id && this.currentPointOfSales.currentPriceList.currency.id !== currency.id) {
|
||||||
this.$store.dispatch('searchConversion', {
|
return convert
|
||||||
conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
|
}
|
||||||
currencyFromUuid: this.pointOfSalesCurrency.uuid,
|
})
|
||||||
conversionDate: this.formatDate(new Date()),
|
if (!this.isEmptyValue(currency) && this.isEmptyValue(convert) && currency.uuid !== this.currentPointOfSales.currentPriceList.currency.uuid) {
|
||||||
currencyToUuid: currency.uuid
|
this.amountConvert(currency)
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,10 +68,7 @@
|
|||||||
style="padding-bottom: 20px;"
|
style="padding-bottom: 20px;"
|
||||||
>
|
>
|
||||||
<p class="total">
|
<p class="total">
|
||||||
<b v-if="!isEmptyValue(value.multiplyRate)" style="float: right;">
|
<b 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>
|
||||||
@ -152,9 +149,12 @@ export default {
|
|||||||
conevertionAmount() {
|
conevertionAmount() {
|
||||||
return this.$store.getters.getConvertionPayment
|
return this.$store.getters.getConvertionPayment
|
||||||
},
|
},
|
||||||
|
currentPointOfSales() {
|
||||||
|
return this.$store.getters.posAttributes.currentPointOfSales
|
||||||
|
},
|
||||||
// Validate if there is a payment in a different type of currency to the point
|
// Validate if there is a payment in a different type of currency to the point
|
||||||
paymentCurrency() {
|
paymentCurrency() {
|
||||||
return this.$store.getters.posAttributes.currentPointOfSales.currentOrder.listPayments.payments.find(pay => pay.currencyUuid !== this.currency.uuid)
|
return this.currentPointOfSales.currentOrder.listPayments.payments.find(pay => pay.currencyUuid !== this.currency.uuid)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -165,11 +165,16 @@ export default {
|
|||||||
query: value.reference.query
|
query: value.reference.query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
labelTypesPayment(value) {
|
||||||
|
console.log(value)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.convertingPaymentMethods()
|
if (!this.isEmptyValue(this.isAddTypePay)) {
|
||||||
if (this.isEmptyValue(this.labelTypesPayment.reference) && !this.isEmptyValue(this.listPaymentType.reference)) {
|
this.convertingPaymentMethods()
|
||||||
|
}
|
||||||
|
if (!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
|
||||||
@ -189,9 +194,10 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.$store.getters.posAttributes.currentPointOfSales.currentOrder.listPayments.payments.forEach(element => {
|
this.$store.getters.posAttributes.currentPointOfSales.currentOrder.listPayments.payments.forEach(element => {
|
||||||
|
console.log({ response, element })
|
||||||
if (element.currencyUuid !== this.pointOfSalesCurrency.uuid) {
|
if (element.currencyUuid !== this.pointOfSalesCurrency.uuid) {
|
||||||
element.multiplyRate = element.amount / response.multiplyRate
|
element.multiplyRate = element.amount / response.multiplyRate
|
||||||
element.amountConvertion = element.multiplyRate / response.divideRate
|
element.amountConvertion = element.amount / response.divideRate
|
||||||
element.divideRate = response.multiplyRate
|
element.divideRate = response.multiplyRate
|
||||||
element.currencyConvertion = response.currencyTo
|
element.currencyConvertion = response.currencyTo
|
||||||
}
|
}
|
||||||
@ -267,6 +273,7 @@ export default {
|
|||||||
query
|
query
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
console.log(response)
|
||||||
this.labelTypesPayment = response
|
this.labelTypesPayment = response
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -162,24 +162,19 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.isReadyFromGetData) {
|
if (this.isReadyFromGetData ||
|
||||||
this.loadKeyLayout()
|
(!this.isEmptyValue(this.$store.getters.getKeyLayout.uuid) &&
|
||||||
|
this.currentPointOfSales.keyLayoutUuid !== this.$store.getters.getKeyLayout.uuid)
|
||||||
|
) {
|
||||||
|
this.loadKeyLayout(this.currentPointOfSales.keyLayoutUuid)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
formatQuantity,
|
formatQuantity,
|
||||||
loadKeyLayout(uuid = null) {
|
loadKeyLayout(uuid = null) {
|
||||||
const currentPOS = this.currentPointOfSales
|
const KeyLayoutUuid = this.isEmptyValue(uuid) ? this.currentPointOfSales.keyLayoutUuid : uuid
|
||||||
if (this.isEmptyValue(currentPOS) || this.isEmptyValue(currentPOS.uuid)) {
|
|
||||||
this.$message({
|
|
||||||
type: 'warn',
|
|
||||||
message: 'Without POS Terminal',
|
|
||||||
shosClose: true
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$store.dispatch('getKeyLayoutFromServer', uuid)
|
this.$store.dispatch('getKeyLayoutFromServer', KeyLayoutUuid)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.isLoadedKeyLayout = true
|
this.isLoadedKeyLayout = true
|
||||||
})
|
})
|
||||||
|
@ -45,9 +45,11 @@ export default [
|
|||||||
isFromDictionary: true,
|
isFromDictionary: true,
|
||||||
overwriteDefinition: {
|
overwriteDefinition: {
|
||||||
size: 24,
|
size: 24,
|
||||||
|
handleFocusGained: true,
|
||||||
handleActionPerformed: true,
|
handleActionPerformed: true,
|
||||||
handleContentSelection: true,
|
handleContentSelection: true,
|
||||||
handleActionKeyPerformed: true
|
handleActionKeyPerformed: true,
|
||||||
|
isReadOnly: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// {
|
// {
|
||||||
|
@ -54,16 +54,43 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="5" :style="styleTab">
|
<el-col :span="5" :style="styleTab">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<template
|
<el-popover
|
||||||
v-for="(field) in fieldsList"
|
v-model="visible"
|
||||||
|
placement="right"
|
||||||
>
|
>
|
||||||
<field
|
<el-form label-position="top" label-width="10px" @submit.native.prevent="notSubmitForm">
|
||||||
v-if="field.columnName === 'C_DocTypeTarget_ID'"
|
<el-form-item :label="$t('form.pos.tableProduct.pin')">
|
||||||
:key="field.columnName"
|
<el-input
|
||||||
:metadata-field="field"
|
v-model="pin"
|
||||||
:v-model="field.value"
|
type="password"
|
||||||
/>
|
:placeholder="$t('form.pos.tableProduct.pin')"
|
||||||
</template>
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span style="float: right;">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
icon="el-icon-close"
|
||||||
|
@click="closePin"
|
||||||
|
/>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-check"
|
||||||
|
@click="openPin(pin)"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
<el-button slot="reference" type="text">
|
||||||
|
<field
|
||||||
|
:key="fieldsList[2].columnName"
|
||||||
|
:metadata-field="{
|
||||||
|
...fieldsList[2],
|
||||||
|
isReadOnly: validatePin
|
||||||
|
}"
|
||||||
|
:v-model="fieldsList[2].value"
|
||||||
|
/>
|
||||||
|
</el-button>
|
||||||
|
</el-popover>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="isEmptyValue(currentOrder) ? 1 : 4" :style="isShowedPOSKeyLayout ? 'padding: 0px; margin-top: 3.%;' : 'padding: 0px; margin-top: 2.4%;'">
|
<el-col :span="isEmptyValue(currentOrder) ? 1 : 4" :style="isShowedPOSKeyLayout ? 'padding: 0px; margin-top: 3.%;' : 'padding: 0px; margin-top: 2.4%;'">
|
||||||
@ -105,20 +132,22 @@
|
|||||||
@current-change="handleCurrentLineChange"
|
@current-change="handleCurrentLineChange"
|
||||||
@shortkey.native="shortcutKeyMethod"
|
@shortkey.native="shortcutKeyMethod"
|
||||||
>
|
>
|
||||||
<el-table-column
|
<template v-for="(valueOrder, item, key) in orderLineDefinition">
|
||||||
v-for="(valueOrder, item, key) in orderLineDefinition"
|
<el-table-column
|
||||||
:key="key"
|
v-if="(valueOrder.columnName === 'ConvertedAmount' && !isEmptyValue(currentPointOfSales.displayCurrency)) || valueOrder.columnName !== 'ConvertedAmount'"
|
||||||
:column-key="valueOrder.columnName"
|
:key="key"
|
||||||
:label="valueOrder.label"
|
:column-key="valueOrder.columnName"
|
||||||
:width="!valueOrder.isNumeric ? valueOrder.size : valueOrder.size"
|
:label="valueOrder.label"
|
||||||
:align="valueOrder.isNumeric ? 'right' : 'left'"
|
:width="!valueOrder.isNumeric ? valueOrder.size : valueOrder.size"
|
||||||
>
|
:align="valueOrder.isNumeric ? 'right' : 'left'"
|
||||||
<template slot-scope="scope">
|
>
|
||||||
<span>
|
<template slot-scope="scope">
|
||||||
{{ displayValue(scope.row, valueOrder) }}
|
<span>
|
||||||
</span>
|
{{ displayValue(scope.row, valueOrder) }}
|
||||||
</template>
|
</span>
|
||||||
</el-table-column>
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</template>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
:label="$t('form.pos.tableProduct.options')"
|
:label="$t('form.pos.tableProduct.options')"
|
||||||
width="180"
|
width="180"
|
||||||
@ -394,6 +423,7 @@ import {
|
|||||||
formatPrice,
|
formatPrice,
|
||||||
formatQuantity
|
formatQuantity
|
||||||
} from '@/utils/ADempiere/valueFormat.js'
|
} from '@/utils/ADempiere/valueFormat.js'
|
||||||
|
import { validatePin } from '@/api/ADempiere/form/point-of-sales.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Order',
|
name: 'Order',
|
||||||
@ -411,7 +441,10 @@ export default {
|
|||||||
return {
|
return {
|
||||||
fieldsList: fieldsListOrder,
|
fieldsList: fieldsListOrder,
|
||||||
seeConversion: false,
|
seeConversion: false,
|
||||||
showFieldLine: false
|
showFieldLine: false,
|
||||||
|
pin: '',
|
||||||
|
validatePin: true,
|
||||||
|
visible: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -604,6 +637,16 @@ export default {
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
numberOfLines(value) {
|
||||||
|
if (value > 0) {
|
||||||
|
this.convertedAmount()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
currentOrder(value) {
|
||||||
|
this.validatePin = true
|
||||||
|
}
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (!this.isEmptyValue(this.$route.query.action)) {
|
if (!this.isEmptyValue(this.$route.query.action)) {
|
||||||
this.$store.dispatch('reloadOrder', { orderUuid: this.$route.query.action })
|
this.$store.dispatch('reloadOrder', { orderUuid: this.$route.query.action })
|
||||||
@ -613,6 +656,32 @@ export default {
|
|||||||
formatDate,
|
formatDate,
|
||||||
formatPrice,
|
formatPrice,
|
||||||
formatQuantity,
|
formatQuantity,
|
||||||
|
openPin(pin) {
|
||||||
|
validatePin({
|
||||||
|
posUuid: this.currentPointOfSales.uuid,
|
||||||
|
pin
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
this.validatePin = false
|
||||||
|
this.pin = ''
|
||||||
|
this.visible = false
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error(error.message)
|
||||||
|
this.$message({
|
||||||
|
type: 'error',
|
||||||
|
message: error.message,
|
||||||
|
showClose: true
|
||||||
|
})
|
||||||
|
this.pin = ''
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.closePing()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
closePin() {
|
||||||
|
this.visible = false
|
||||||
|
},
|
||||||
closeConvertion() {
|
closeConvertion() {
|
||||||
this.seeConversion = false
|
this.seeConversion = false
|
||||||
},
|
},
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<el-form-item :label="$t('form.pos.tableProduct.pin')">
|
<el-form-item :label="$t('form.pos.tableProduct.pin')">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="pin"
|
v-model="pin"
|
||||||
|
type="password"
|
||||||
:placeholder="$t('form.pos.tableProduct.pin')"
|
:placeholder="$t('form.pos.tableProduct.pin')"
|
||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
|
@ -20,7 +20,6 @@ import {
|
|||||||
deleteOrderLine
|
deleteOrderLine
|
||||||
} from '@/api/ADempiere/form/point-of-sales.js'
|
} from '@/api/ADempiere/form/point-of-sales.js'
|
||||||
import { formatPercent } from '@/utils/ADempiere/valueFormat.js'
|
import { formatPercent } from '@/utils/ADempiere/valueFormat.js'
|
||||||
import { showMessage } from '@/utils/ADempiere/notification.js'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'OrderLineMixin',
|
name: 'OrderLineMixin',
|
||||||
@ -80,11 +79,20 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
totalAmountConverted() {
|
||||||
},
|
const conversionsList = this.$store.state['pointOfSales/point/index'].conversionsList
|
||||||
created() {
|
if (this.isEmptyValue(conversionsList) && !this.isEmptyValue(this.currentPointOfSales.conversionTypeUuid)) {
|
||||||
if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.displayCurrency)) {
|
return 1
|
||||||
this.convertedAmountAsTotal(this.$store.getters.posAttributes.currentPointOfSales.displayCurrency)
|
}
|
||||||
|
const converted = conversionsList.find(converted => {
|
||||||
|
if (converted.conversionTypeUuid === this.currentPointOfSales.conversionTypeUuid) {
|
||||||
|
return converted
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (!this.isEmptyValue(converted)) {
|
||||||
|
return converted.divideRate
|
||||||
|
}
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -184,7 +192,6 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
deleteOrderLine(lineSelection) {
|
deleteOrderLine(lineSelection) {
|
||||||
console
|
|
||||||
deleteOrderLine({
|
deleteOrderLine({
|
||||||
orderLineUuid: lineSelection.uuid
|
orderLineUuid: lineSelection.uuid
|
||||||
})
|
})
|
||||||
@ -200,39 +207,14 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
convertedAmountAsTotal(value) {
|
convertedAmount() {
|
||||||
this.$store.dispatch('conversionDivideRate', {
|
if (!this.isEmptyValue(this.currentPointOfSales.displayCurrency) && this.totalAmountConverted === 1) {
|
||||||
conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
|
this.$store.dispatch('searchConversion', {
|
||||||
currencyFromUuid: this.pointOfSalesCurrency.uuid,
|
conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
|
||||||
currencyToUuid: value.uuid
|
currencyFromUuid: this.currentPointOfSales.currentPriceList.currency.uuid,
|
||||||
})
|
currencyToUuid: this.currentPointOfSales.displayCurrency.uuid
|
||||||
.then(response => {
|
|
||||||
if (!this.isEmptyValue(response.currencyTo)) {
|
|
||||||
const currency = {
|
|
||||||
...response.currencyTo,
|
|
||||||
amountConvertion: response.divideRate,
|
|
||||||
multiplyRate: response.multiplyRate
|
|
||||||
}
|
|
||||||
this.totalAmountConvertedLine = currency
|
|
||||||
} else {
|
|
||||||
this.totalAmountConvertedLine.multiplyRate = '1'
|
|
||||||
this.totalAmountConvertedLine.iSOCode = value.iSOCode
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
|
||||||
console.warn(`conversionDivideRate: ${error.message}. Code: ${error.code}.`)
|
|
||||||
showMessage({
|
|
||||||
type: 'error',
|
|
||||||
message: error.message,
|
|
||||||
showClose: true
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getTotalAmount(basePrice, multiplyRate) {
|
|
||||||
if (this.isEmptyValue(basePrice) || this.isEmptyValue(multiplyRate)) {
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
return (basePrice * multiplyRate)
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Show the correct display format
|
* Show the correct display format
|
||||||
@ -241,6 +223,7 @@ export default {
|
|||||||
*/
|
*/
|
||||||
displayValue(row, orderLine) {
|
displayValue(row, orderLine) {
|
||||||
const { columnName } = orderLine
|
const { columnName } = orderLine
|
||||||
|
// const iSOCode = this.isEmptyValue(this.currentPointOfSales.displayCurrency) ? '' : this.currentPointOfSales.displayCurrency.iSOCode
|
||||||
if (columnName === 'LineDescription') {
|
if (columnName === 'LineDescription') {
|
||||||
return row.lineDescription
|
return row.lineDescription
|
||||||
}
|
}
|
||||||
@ -254,7 +237,7 @@ export default {
|
|||||||
} else if (columnName === 'GrandTotal') {
|
} else if (columnName === 'GrandTotal') {
|
||||||
return this.formatPrice(row.grandTotal, currency)
|
return this.formatPrice(row.grandTotal, currency)
|
||||||
} else if (columnName === 'ConvertedAmount') {
|
} else if (columnName === 'ConvertedAmount') {
|
||||||
return this.formatPrice(this.getTotalAmount(row.grandTotal, this.totalAmountConvertedLine.multiplyRate), this.totalAmountConvertedLine.iSOCode)
|
return this.formatPrice(row.grandTotal / this.totalAmountConverted)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
productPrice(price, discount) {
|
productPrice(price, discount) {
|
||||||
|
@ -435,7 +435,7 @@ export default {
|
|||||||
|
|
||||||
case 'C_BPartner_ID_UUID': {
|
case 'C_BPartner_ID_UUID': {
|
||||||
const bPartnerValue = mutation.payload.value
|
const bPartnerValue = mutation.payload.value
|
||||||
if (!this.isEmptyValue(this.currentPointOfSales)) {
|
if (!this.isEmptyValue(this.currentPointOfSales.templateBusinessPartner)) {
|
||||||
const bPartnerPOS = this.currentPointOfSales.templateBusinessPartner.uuid
|
const bPartnerPOS = this.currentPointOfSales.templateBusinessPartner.uuid
|
||||||
// Does not send values to server, when empty values are set or
|
// Does not send values to server, when empty values are set or
|
||||||
// if BPartner set equal to BPartner POS template
|
// if BPartner set equal to BPartner POS template
|
||||||
|
@ -32,6 +32,7 @@ export default {
|
|||||||
if (this.addMargin) {
|
if (this.addMargin) {
|
||||||
return 'margin-left: -20px;'
|
return 'margin-left: -20px;'
|
||||||
}
|
}
|
||||||
|
return ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,10 @@ export default {
|
|||||||
|
|
||||||
if (isEmptyValue(keyLayoutUuid)) {
|
if (isEmptyValue(keyLayoutUuid)) {
|
||||||
console.info('not load key layout')
|
console.info('not load key layout')
|
||||||
|
commit('setKeyLayout', {
|
||||||
|
isLoaded: false,
|
||||||
|
isReload: true
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getKeyLayout({
|
getKeyLayout({
|
||||||
|
@ -171,36 +171,6 @@ export default {
|
|||||||
addRateConvertion({ commit, state, getters }, currency) {
|
addRateConvertion({ commit, state, getters }, currency) {
|
||||||
commit('conversionRate', currency)
|
commit('conversionRate', currency)
|
||||||
},
|
},
|
||||||
conversionMultiplyRate({ commit }, {
|
|
||||||
containerUuid,
|
|
||||||
conversionTypeUuid,
|
|
||||||
currencyFromUuid,
|
|
||||||
currencyToUuid
|
|
||||||
// conversionDate
|
|
||||||
}) {
|
|
||||||
requestGetConversionRate({
|
|
||||||
conversionTypeUuid,
|
|
||||||
currencyFromUuid,
|
|
||||||
currencyToUuid
|
|
||||||
// conversionDate
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
const multiplyRate = isEmptyValue(response.multiplyRate) ? 1 : response.multiplyRate
|
|
||||||
if (containerUuid === 'Collection') {
|
|
||||||
commit('currencyMultiplyRateCollection', multiplyRate)
|
|
||||||
} else {
|
|
||||||
commit('currencyMultiplyRate', multiplyRate)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.warn(`conversionMultiplyRate: ${error.message}. Code: ${error.code}.`)
|
|
||||||
showMessage({
|
|
||||||
type: 'error',
|
|
||||||
message: error.message,
|
|
||||||
showClose: true
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
changeMultiplyRate({ commit }, params) {
|
changeMultiplyRate({ commit }, params) {
|
||||||
commit('currencyMultiplyRate', params)
|
commit('currencyMultiplyRate', params)
|
||||||
},
|
},
|
||||||
@ -321,27 +291,5 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
commit('setCurrencyDisplaye', displaycurrency)
|
commit('setCurrencyDisplaye', displaycurrency)
|
||||||
},
|
|
||||||
convertionPayment({ commit }, {
|
|
||||||
conversionTypeUuid,
|
|
||||||
currencyFromUuid,
|
|
||||||
currencyToUuid
|
|
||||||
}) {
|
|
||||||
requestGetConversionRate({
|
|
||||||
conversionTypeUuid,
|
|
||||||
currencyFromUuid,
|
|
||||||
currencyToUuid
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
commit('setConvertionPayment', response)
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.warn(`ConvertionPayment: ${error.message}. Code: ${error.code}.`)
|
|
||||||
showMessage({
|
|
||||||
type: 'error',
|
|
||||||
message: error.message,
|
|
||||||
showClose: true
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
setCurrentPOS({ commit, dispatch, rootGetters }, posToSet) {
|
setCurrentPOS({ commit, dispatch, state, rootGetters }, posToSet) {
|
||||||
commit('setCurrentPointOfSales', posToSet)
|
commit('setCurrentPointOfSales', posToSet)
|
||||||
const oldRoute = router.app._route
|
const oldRoute = router.app._route
|
||||||
router.push({
|
router.push({
|
||||||
@ -122,6 +122,7 @@ export default {
|
|||||||
pos: posToSet.id
|
pos: posToSet.id
|
||||||
}
|
}
|
||||||
}, () => {})
|
}, () => {})
|
||||||
|
state.currenciesList = []
|
||||||
dispatch('listWarehouseFromServer', posToSet.uuid)
|
dispatch('listWarehouseFromServer', posToSet.uuid)
|
||||||
dispatch('listCurrenciesFromServer', posToSet.uuid)
|
dispatch('listCurrenciesFromServer', posToSet.uuid)
|
||||||
dispatch('listPricesFromServer', posToSet)
|
dispatch('listPricesFromServer', posToSet)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user