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