mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-07 18:25:45 +08:00
Fixed syntax errors and deleting console.log (#1012)
* Overdrawn Invoice * rename computed * add service Overdrawn Invoice * Duplicate key error and deleting console.log * fixe minor errors * add params to router * fixe pin * fixe Price Checking * fix constants Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
parent
12c3aef872
commit
553d08b353
@ -615,6 +615,72 @@ export function processOrder({
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Overdrawn Invoice
|
||||
* This request allows you to process an order if the payment is more or less than the invoice.
|
||||
*
|
||||
* req.query.token - user token
|
||||
* Body:
|
||||
* req.body.pos_uuid - POS UUID reference
|
||||
* req.body.order_uuid - Order UUID reference
|
||||
* req.body.create_payments - Optional create payments (if is true then hope payments array)
|
||||
* req.body.payments
|
||||
* [
|
||||
* invoice_uuid - Invoice UUID reference
|
||||
* bank_uuid - Bank UUID reference
|
||||
* reference_no - Reference no
|
||||
* description - Description for Payment
|
||||
* amount - Payment Amount
|
||||
* tender_type_code - Tender Type
|
||||
* payment_date - Payment Date (default now)
|
||||
* currency_uuid - Currency UUID reference
|
||||
* ]
|
||||
* req.body.customer_details [
|
||||
* key - columnName
|
||||
* value - value
|
||||
* ] - customer data in case of refund or voucher card
|
||||
* req.body.option - reimbursement rate
|
||||
*/
|
||||
|
||||
export function overdrawnInvoice({
|
||||
posUuid,
|
||||
orderUuid,
|
||||
createPayments,
|
||||
payments,
|
||||
customerDetails,
|
||||
option
|
||||
}) {
|
||||
if (!isEmptyValue(payments)) {
|
||||
payments = payments.map(parameter => {
|
||||
return {
|
||||
invoice_uuid: parameter.invoiceUuid,
|
||||
bank_uuid: parameter.bankUuid,
|
||||
reference_no: parameter.referenceNo,
|
||||
description: parameter.description,
|
||||
amount: parameter.amount,
|
||||
tender_type_code: parameter.tenderTypeCode,
|
||||
payment_ate: parameter.paymentDate,
|
||||
currency_uid: parameter.currencyUuid
|
||||
}
|
||||
})
|
||||
}
|
||||
return request({
|
||||
url: '/form/addons/point-of-sales/overdrawn-invoice',
|
||||
method: 'post',
|
||||
data: {
|
||||
pos_uuid: posUuid,
|
||||
order_uuid: orderUuid,
|
||||
create_payments: createPayments,
|
||||
payments: payments,
|
||||
customer_details: customerDetails,
|
||||
option: option
|
||||
}
|
||||
})
|
||||
.then(processOrderResponse => {
|
||||
return processOrderResponse
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate Ping
|
||||
* @param {string} posUuidd - POS UUID reference
|
||||
|
@ -90,7 +90,7 @@
|
||||
<el-row>
|
||||
<el-col>
|
||||
<div v-if="!isEmptyValue(currentConvertion)" class="rate-date">
|
||||
{{ $t('form.pos.collect.dayRate') }}: {{ formatQuantity(currentConvertion.multiplyRate) }} ~ ({{ formatPrice(1, productPrice.currency.iSOCode) }} = {{ formatPrice(currentConvertion.multiplyRate) }} {{ currentPointOfSales.displayCurrency.iso_code }})
|
||||
{{ $t('form.pos.collect.dayRate') }}: {{ formatQuantity(currentConvertion.divideRate) }} ~ ({{ formatPrice(1, productPrice.currency.iSOCode) }} = {{ formatPrice(currentConvertion.divideRate) }} {{ currentPointOfSales.displayCurrency.iso_code }})
|
||||
</div>
|
||||
<div v-else class="rate-date">
|
||||
{{ $t('form.pos.collect.noDayRate') }} {{ currentPointOfSales.displayCurrency.description }}
|
||||
@ -163,6 +163,7 @@ export default {
|
||||
}
|
||||
})
|
||||
if (convert) {
|
||||
console.log(convert)
|
||||
return convert
|
||||
}
|
||||
return {}
|
||||
|
@ -57,7 +57,7 @@ export default [
|
||||
columnName: 'C_Bank_ID',
|
||||
isFromDictionary: true,
|
||||
overwriteDefinition: {
|
||||
sequence: 3,
|
||||
sequence: 2,
|
||||
handleActionKeyPerformed: true,
|
||||
handleActionPerformed: true,
|
||||
handleContentSelection: true,
|
||||
@ -67,6 +67,20 @@ export default [
|
||||
isMandatory: true
|
||||
}
|
||||
},
|
||||
// Code
|
||||
{
|
||||
elementColumnName: 'Value',
|
||||
columnName: 'Value',
|
||||
isFromDictionary: true,
|
||||
tabindex: '0',
|
||||
overwriteDefinition: {
|
||||
sequence: 3,
|
||||
isCustomField: true,
|
||||
size: 24,
|
||||
isMandatory: true,
|
||||
displayLogic: `@TenderType@=='P'&@TenderType@=='C'&@TenderType@=='D'`
|
||||
}
|
||||
},
|
||||
// Date
|
||||
{
|
||||
tableName,
|
||||
|
@ -19,6 +19,14 @@
|
||||
<el-container style="background: white; height: 100% !important;">
|
||||
<el-main style="background: white; padding: 0px; height: 100% !important; overflow: hidden">
|
||||
<el-container style="background: white; padding: 0px; height: 100% !important;">
|
||||
<!-- Invoice Overdrawn at time of collection -->
|
||||
<overdrawn-invoice
|
||||
:change="change"
|
||||
:pay="pay"
|
||||
:pending="pending"
|
||||
:total-order="currentOrder.grandTotal"
|
||||
:currency="pointOfSalesCurrency"
|
||||
/>
|
||||
<!-- Collection container top panel -->
|
||||
<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">
|
||||
@ -97,10 +105,12 @@
|
||||
:disabled="isDisabled"
|
||||
>
|
||||
<el-row id="fieldListCollection">
|
||||
<el-col v-for="(field, index) in fieldsList" :key="index" :span="8">
|
||||
<!-- Add selected currency symbol -->
|
||||
<el-col
|
||||
v-for="field in primaryFieldsList"
|
||||
:key="field.sequence"
|
||||
:span="8"
|
||||
>
|
||||
<field-definition
|
||||
v-if="field.sequence <= 1"
|
||||
:metadata-field="field.columnName === 'PayAmt' ? {
|
||||
...field,
|
||||
labelCurrency: isEmptyValue(dayRate.divideRate) ? dayRate : dayRate.currencyTo
|
||||
@ -108,10 +118,9 @@
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="fieldsList[1].name">
|
||||
<el-form-item :label="$t('form.pos.collect.Currency')">
|
||||
<el-select
|
||||
v-model="currentFieldCurrency"
|
||||
:placeholder="fieldsList[1].help"
|
||||
@change="changeCurrency"
|
||||
>
|
||||
<el-option
|
||||
@ -123,13 +132,13 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-for="(field, key) in fieldsList" :key="key" :span="8">
|
||||
<el-col
|
||||
v-for="field in hiddenFieldsList"
|
||||
:key="field.sequence"
|
||||
:span="8"
|
||||
>
|
||||
<field-definition
|
||||
v-if="field.sequence > 2"
|
||||
:metadata-field="field.columnName === 'PayAmt' ? {
|
||||
...field,
|
||||
labelCurrency: isEmptyValue(dayRate.divideRate) ? dayRate : dayRate.currencyTo
|
||||
} : field"
|
||||
:metadata-field="field"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -140,7 +149,7 @@
|
||||
<el-button type="danger" icon="el-icon-close" @click="exit" />
|
||||
<el-button type="info" icon="el-icon-minus" :disabled="isDisabled" @click="undoPatment" />
|
||||
<el-button type="primary" :disabled="validPay || addPay || isDisabled" icon="el-icon-plus" @click="addCollectToList(paymentBox)" />
|
||||
<el-button type="success" :disabled="validateCompleteCollection || isDisabled" icon="el-icon-shopping-cart-full" @click="completePreparedOrder(listPayments)" />
|
||||
<el-button type="success" :disabled="isDisabled || isDisabled" icon="el-icon-shopping-cart-full" @click="validateOrder(listPayments)" />
|
||||
</samp>
|
||||
</el-header>
|
||||
<!-- Panel where they show the payments registered from the collection container -->
|
||||
@ -263,12 +272,14 @@ import convertAmount from '@/components/ADempiere/Form/VPOS/Collection/convertAm
|
||||
import { formatPrice } from '@/utils/ADempiere/valueFormat.js'
|
||||
import { processOrder } from '@/api/ADempiere/form/point-of-sales.js'
|
||||
import { FIELDS_DECIMALS } from '@/utils/ADempiere/references'
|
||||
import overdrawnInvoice from '@/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice'
|
||||
|
||||
export default {
|
||||
name: 'Collection',
|
||||
components: {
|
||||
typeCollection,
|
||||
convertAmount
|
||||
convertAmount,
|
||||
overdrawnInvoice
|
||||
},
|
||||
mixins: [
|
||||
formMixin,
|
||||
@ -562,6 +573,15 @@ export default {
|
||||
},
|
||||
fieldsPaymentType() {
|
||||
return this.fieldsList[1]
|
||||
},
|
||||
primaryFieldsList() {
|
||||
return this.fieldsList.filter(field => field.sequence <= 1)
|
||||
},
|
||||
hiddenFieldsList() {
|
||||
return this.fieldsList.filter(field => field.sequence > 1)
|
||||
},
|
||||
overUnderPayment() {
|
||||
return this.$store.state['pointOfSales/payments/index'].dialogoInvoce.success
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -658,7 +678,7 @@ export default {
|
||||
addCollectToList() {
|
||||
const containerUuid = this.containerUuid
|
||||
const posUuid = this.currentPointOfSales.uuid
|
||||
const orderUuid = this.$route.query.action
|
||||
const orderUuid = this.$store.getters.posAttributes.currentPointOfSales.currentOrder.uuid
|
||||
const bankUuid = this.$store.getters.getValueOfField({
|
||||
containerUuid,
|
||||
columnName: 'C_Bank_ID_UUID'
|
||||
@ -847,6 +867,16 @@ export default {
|
||||
paymentUuid
|
||||
})
|
||||
},
|
||||
validateOrder(payment) {
|
||||
this.porcessInvoce = true
|
||||
if (this.pay > this.currentOrder.grandTotal) {
|
||||
this.$store.commit('dialogoInvoce', { show: true, type: 1 })
|
||||
} else if (this.pay < this.currentOrder.grandTotal) {
|
||||
this.$store.commit('dialogoInvoce', { show: true, type: 2 })
|
||||
} else {
|
||||
this.completePreparedOrder(payment)
|
||||
}
|
||||
},
|
||||
completePreparedOrder(payment) {
|
||||
const posUuid = this.currentPointOfSales.uuid
|
||||
const orderUuid = this.$route.query.action
|
||||
|
@ -0,0 +1,177 @@
|
||||
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
|
||||
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
|
||||
// Contributor(s): Yamel Senih ysenih@erpya.com www.erpya.com
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
const tableName = 'C_Payment'
|
||||
|
||||
export default [
|
||||
// Name
|
||||
{
|
||||
elementColumnName: 'Name',
|
||||
columnName: 'Name',
|
||||
tableName: 'C_BPartner',
|
||||
tabindex: '1',
|
||||
isFromDictionary: true,
|
||||
overwriteDefinition: {
|
||||
sequence: 0,
|
||||
isCustomField: true,
|
||||
size: 24,
|
||||
isMandatory: true
|
||||
}
|
||||
},
|
||||
// Code
|
||||
{
|
||||
elementColumnName: 'Value',
|
||||
columnName: 'Value',
|
||||
isFromDictionary: true,
|
||||
tabindex: '0',
|
||||
overwriteDefinition: {
|
||||
sequence: 1,
|
||||
isCustomField: true,
|
||||
size: 24,
|
||||
isMandatory: true
|
||||
}
|
||||
},
|
||||
// Phone
|
||||
{
|
||||
elementColumnName: 'Phone',
|
||||
columnName: 'Phone',
|
||||
tableName: 'AD_user',
|
||||
tabindex: '4',
|
||||
isFromDictionary: true,
|
||||
overwriteDefinition: {
|
||||
sequence: 2,
|
||||
isCustomField: true,
|
||||
size: 24,
|
||||
isMandatory: true
|
||||
}
|
||||
},
|
||||
// TenderType
|
||||
{
|
||||
tableName,
|
||||
elementColumnName: 'TenderType',
|
||||
columnName: 'TenderType',
|
||||
isFromDictionary: true,
|
||||
overwriteDefinition: {
|
||||
defaultValue: 'X',
|
||||
sequence: 3,
|
||||
handleActionKeyPerformed: true,
|
||||
handleContentSelection: true,
|
||||
handleActionPerformed: true,
|
||||
size: 24,
|
||||
isActiveLogics: true,
|
||||
isMandatory: true
|
||||
}
|
||||
},
|
||||
{
|
||||
elementColumnName: 'EMail',
|
||||
columnName: 'EMail',
|
||||
tableName: 'AD_user',
|
||||
tabindex: '3',
|
||||
isFromDictionary: true,
|
||||
overwriteDefinition: {
|
||||
sequence: 4,
|
||||
isCustomField: true,
|
||||
displayLogic: `@TenderType@=='D'`,
|
||||
size: 24
|
||||
}
|
||||
},
|
||||
{
|
||||
tableName,
|
||||
elementColumnName: 'DateTrx',
|
||||
isFromDictionary: true,
|
||||
overwriteDefinition: {
|
||||
sequence: 5,
|
||||
handleFocusGained: true,
|
||||
handleFocusLost: true,
|
||||
handleKeyPressed: true,
|
||||
handleKeyReleased: true,
|
||||
handleActionKeyPerformed: true,
|
||||
handleActionPerformed: true,
|
||||
size: 24,
|
||||
displayLogic: `@TenderType@=='K'`,
|
||||
isActiveLogics: true,
|
||||
isMandatory: true
|
||||
}
|
||||
},
|
||||
// Bank
|
||||
{
|
||||
tableName,
|
||||
columnName: 'C_Bank_ID',
|
||||
isFromDictionary: true,
|
||||
overwriteDefinition: {
|
||||
sequence: 6,
|
||||
handleActionKeyPerformed: true,
|
||||
handleActionPerformed: true,
|
||||
handleContentSelection: true,
|
||||
displayLogic: `@TenderType@<>'X'`,
|
||||
size: 24,
|
||||
isActiveLogics: true,
|
||||
isMandatory: true
|
||||
}
|
||||
},
|
||||
// type credit card
|
||||
{
|
||||
tableName,
|
||||
elementColumnName: 'CreditCardType',
|
||||
columnName: 'CreditCardType',
|
||||
isFromDictionary: true,
|
||||
overwriteDefinition: {
|
||||
sequence: 7,
|
||||
defaultValue: 'M',
|
||||
handleActionKeyPerformed: true,
|
||||
handleContentSelection: true,
|
||||
handleActionPerformed: true,
|
||||
size: 24,
|
||||
displayLogic: `@TenderType@=='C'`,
|
||||
isActiveLogics: true,
|
||||
isMandatory: true
|
||||
}
|
||||
},
|
||||
// number credit card
|
||||
{
|
||||
tableName,
|
||||
elementColumnName: 'CreditCardNumber',
|
||||
columnName: 'CreditCardNumber',
|
||||
isFromDictionary: true,
|
||||
overwriteDefinition: {
|
||||
sequence: 8,
|
||||
handleActionKeyPerformed: true,
|
||||
handleContentSelection: true,
|
||||
handleActionPerformed: true,
|
||||
size: 24,
|
||||
displayLogic: `@TenderType@=='C'`,
|
||||
isActiveLogics: true,
|
||||
isMandatory: true
|
||||
}
|
||||
},
|
||||
// accountno
|
||||
{
|
||||
tableName,
|
||||
elementColumnName: 'AccountNo',
|
||||
columnName: 'AccountNo',
|
||||
isFromDictionary: true,
|
||||
overwriteDefinition: {
|
||||
sequence: 9,
|
||||
handleActionKeyPerformed: true,
|
||||
handleContentSelection: true,
|
||||
handleActionPerformed: true,
|
||||
size: 24,
|
||||
displayLogic: `@TenderType@=='M'`,
|
||||
isActiveLogics: true,
|
||||
isMandatory: true
|
||||
}
|
||||
}
|
||||
]
|
@ -0,0 +1,425 @@
|
||||
<!--
|
||||
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
|
||||
Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
|
||||
Contributor(s): Elsio Sanchez elsiosanches@gmail.com www.erpya.com
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https:www.gnu.org/licenses/>.
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
:title="$t('form.pos.collect.overdrawnInvoice.title')"
|
||||
:visible.sync="showDialogo"
|
||||
:before-close="close"
|
||||
width="70%"
|
||||
@close="close"
|
||||
>
|
||||
<div v-if="caseOrder === 1">
|
||||
<el-form>
|
||||
<el-form-item>
|
||||
<el-radio v-model="option" :label="1"> {{ $t('form.pos.collect.overdrawnInvoice.returned') }} {{ formatPrice(change, currency.iSOCode) }} </el-radio>
|
||||
<el-radio v-model="option" :label="2"> {{ $t('form.pos.collect.overdrawnInvoice.coupon') }}</el-radio>
|
||||
<el-radio v-model="option" :label="3"> {{ $t('form.pos.collect.overdrawnInvoice.returnMoney') }}</el-radio>
|
||||
<el-radio v-model="option" :label="4"> {{ $t('form.pos.collect.overdrawnInvoice.adjustDocument') }}</el-radio>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-card v-if="option === 2" class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>{{ $t('form.pos.collect.overdrawnInvoice.above') }}</span>
|
||||
</div>
|
||||
<div class="text item">
|
||||
<el-form
|
||||
label-position="top"
|
||||
label-width="10px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col
|
||||
v-for="field in primaryFieldsList"
|
||||
:key="field.sequence"
|
||||
:span="8"
|
||||
>
|
||||
<field-definition
|
||||
v-if="field.sequence < 3"
|
||||
:key="field.columnName"
|
||||
:metadata-field="field"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card v-if="option === 3" class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>{{ $t('form.pos.collect.overdrawnInvoice.above') }}</span>
|
||||
</div>
|
||||
<div class="text item">
|
||||
<el-form
|
||||
label-position="top"
|
||||
label-width="10px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col
|
||||
v-for="field in primaryFieldsList"
|
||||
:key="field.sequence"
|
||||
:span="8"
|
||||
>
|
||||
<field-definition
|
||||
:key="field.columnName"
|
||||
:metadata-field="field"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item v-if="displayeCurrency" :label="$t('form.pos.collect.Currency')">
|
||||
<el-select
|
||||
v-model="currentFieldCurrency"
|
||||
style="width: -webkit-fill-available;"
|
||||
@change="changeCurrency"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in listCurrency"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.key"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col
|
||||
v-for="field in hiddenFieldsList"
|
||||
:key="field.sequence"
|
||||
:span="8"
|
||||
>
|
||||
<field-definition
|
||||
:metadata-field="field"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
<div v-if="caseOrder === 2">
|
||||
<el-card>
|
||||
<div slot="header" class="clearfix">
|
||||
<span> {{ $t('form.pos.collect.overdrawnInvoice.below') }} </span>
|
||||
<el-radio v-model="option" :label="1" style="float: right; padding: 3px 0">
|
||||
{{ $t('form.pos.collect.overdrawnInvoice.adjustDocument') }}
|
||||
</el-radio>
|
||||
</div>
|
||||
<el-form label-width="120px">
|
||||
<el-form-item>
|
||||
<p>
|
||||
<b> {{ $t('form.pos.collect.orderTotal') }} </b> {{ formatPrice(totalOrder, currency.iSOCode) }}
|
||||
<el-divider direction="vertical" />
|
||||
<b> {{ $t('form.pos.collect.totalInvoiced') }} </b> {{ formatPrice(pay, currency.iSOCode) }}
|
||||
<el-divider direction="vertical" />
|
||||
<b> {{ $t('form.pos.collect.pending') }} </b> {{ formatPrice(pending, currency.iSOCode) }}
|
||||
</p>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button
|
||||
type="danger"
|
||||
class="custom-button-create-bp"
|
||||
icon="el-icon-close"
|
||||
@click="close"
|
||||
/>
|
||||
<el-button
|
||||
type="primary"
|
||||
class="custom-button-create-bp"
|
||||
icon="el-icon-check"
|
||||
@click="success"
|
||||
/>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { formatPrice } from '@/utils/ADempiere/valueFormat.js'
|
||||
import formMixin from '@/components/ADempiere/Form/formMixin'
|
||||
import posMixin from '@/components/ADempiere/Form/VPOS/posMixin.js'
|
||||
import fieldsListOverdrawnInvoice from './fieldsListOverdrawnInvoice.js'
|
||||
import { overdrawnInvoice } from '@/api/ADempiere/form/point-of-sales.js'
|
||||
import { processOrder } from '@/api/ADempiere/form/point-of-sales.js'
|
||||
|
||||
export default {
|
||||
name: 'OverdrawnInvoice',
|
||||
mixins: [
|
||||
formMixin,
|
||||
posMixin
|
||||
],
|
||||
props: {
|
||||
change: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
pay: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
pending: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
totalOrder: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
currency: {
|
||||
type: Object,
|
||||
default: undefined
|
||||
},
|
||||
metadata: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
uuid: 'OverdrawnInvoice',
|
||||
containerUuid: 'OverdrawnInvoice'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
option: 1,
|
||||
fieldsList: fieldsListOverdrawnInvoice,
|
||||
currentFieldCurrency: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
showDialogo() {
|
||||
return this.$store.state['pointOfSales/payments/index'].dialogoInvoce.show
|
||||
},
|
||||
caseOrder() {
|
||||
return this.$store.state['pointOfSales/payments/index'].dialogoInvoce.type
|
||||
},
|
||||
displayeCurrency() {
|
||||
const tenderType = this.$store.getters.getValueOfField({
|
||||
containerUuid: 'OverdrawnInvoice',
|
||||
columnName: 'TenderType'
|
||||
})
|
||||
if (tenderType === 'D' && tenderType === 'P') {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
primaryFieldsList() {
|
||||
return this.fieldsList.filter(field => field.sequence <= 3)
|
||||
},
|
||||
hiddenFieldsList() {
|
||||
return this.fieldsList.filter(field => field.sequence > 4)
|
||||
},
|
||||
listCurrency() {
|
||||
return this.$store.getters.getCurrenciesList
|
||||
},
|
||||
emptyFieldGiftCard() {
|
||||
const empty = this.fieldsList.filter(field => {
|
||||
if (field.sequence < 3 && this.isEmptyValue(
|
||||
this.$store.getters.getValueOfField({
|
||||
containerUuid: 'OverdrawnInvoice',
|
||||
columnName: field.columnName
|
||||
})
|
||||
)) {
|
||||
return field
|
||||
}
|
||||
})
|
||||
return empty.map(empty => empty.name)
|
||||
},
|
||||
emptyMandatoryFields() {
|
||||
return this.$store.getters.getFieldsListEmptyMandatory({ containerUuid: 'OverdrawnInvoice', formatReturn: 'name' })
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatPrice,
|
||||
success() {
|
||||
const customerDetails = []
|
||||
this.fieldsList.forEach(element => {
|
||||
const value = this.$store.getters.getValueOfField({
|
||||
containerUuid: 'OverdrawnInvoice',
|
||||
columnName: element.columnName
|
||||
})
|
||||
customerDetails.push({
|
||||
label: element.columnName,
|
||||
value
|
||||
})
|
||||
})
|
||||
this.optionSelected({
|
||||
posUuid: this.currentPointOfSales.uuid,
|
||||
orderUuid: this.currentOrder.uuid,
|
||||
customerDetails,
|
||||
payments: this.currentOrder.listPayments.payments
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$store.commit('dialogoInvoce', { show: false })
|
||||
},
|
||||
changeCurrency(value) {
|
||||
this.currentFieldCurrency = value
|
||||
},
|
||||
optionSelected({ posUuid, orderUuid, customerDetails, payments }) {
|
||||
switch (this.option) {
|
||||
case 2:
|
||||
if (this.isEmptyValue(this.emptyFieldGiftCard)) {
|
||||
this.completePreparedOrder(posUuid, orderUuid, payments)
|
||||
this.$store.commit('dialogoInvoce', { show: false, success: true })
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'warn',
|
||||
message: this.$t('notifications.mandatoryFieldMissing') + this.emptyFieldGiftCard,
|
||||
duration: 1500,
|
||||
showClose: true
|
||||
})
|
||||
}
|
||||
break
|
||||
case 3:
|
||||
if (this.isEmptyValue(this.emptyMandatoryFields)) {
|
||||
overdrawnInvoice({
|
||||
posUuid,
|
||||
orderUuid,
|
||||
createPayments: !this.isEmptyValue(this.currentOrder.listPayments.payments),
|
||||
payments: this.currentOrder.listPayments.payments,
|
||||
customerDetails,
|
||||
option: this.option
|
||||
})
|
||||
.then(response => {
|
||||
this.$store.dispatch('reloadOrder', response.uuid)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('notifications.completed'),
|
||||
showClose: true
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: error.message,
|
||||
showClose: true
|
||||
})
|
||||
})
|
||||
this.$store.commit('dialogoInvoce', { show: false, success: true })
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'warn',
|
||||
message: this.$t('notifications.mandatoryFieldMissing') + this.emptyMandatoryFields,
|
||||
duration: 1500,
|
||||
showClose: true
|
||||
})
|
||||
}
|
||||
break
|
||||
default:
|
||||
this.completePreparedOrder(posUuid, orderUuid, payments)
|
||||
this.$store.commit('dialogoInvoce', { show: false, success: true })
|
||||
break
|
||||
}
|
||||
},
|
||||
completePreparedOrder(posUuid, orderUuid, payments) {
|
||||
this.$store.dispatch('updateOrderPos', true)
|
||||
this.$store.dispatch('updatePaymentPos', true)
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: this.$t('notifications.processing'),
|
||||
showClose: true
|
||||
})
|
||||
processOrder({
|
||||
posUuid,
|
||||
orderUuid,
|
||||
createPayments: !this.isEmptyValue(payments),
|
||||
payments: payments
|
||||
})
|
||||
.then(response => {
|
||||
this.$store.dispatch('reloadOrder', response.uuid)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('notifications.completed'),
|
||||
showClose: true
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: error.message,
|
||||
showClose: true
|
||||
})
|
||||
})
|
||||
.finally(() => {
|
||||
this.$store.dispatch('listOrdersFromServer', {
|
||||
posUuid: this.currentPointOfSales.uuid
|
||||
})
|
||||
this.$store.dispatch('updateOrderPos', false)
|
||||
this.$store.dispatch('updatePaymentPos', false)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-image {
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
}
|
||||
.el-card__header {
|
||||
padding: 18px 20px;
|
||||
border-bottom: 1px solid #e6ebf5;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
background-color: rgb(245, 247, 250);
|
||||
}
|
||||
.el-card__body {
|
||||
padding-top: 0px !important;
|
||||
padding-right: 0px!important;
|
||||
padding-bottom: 20px;
|
||||
padding-left: 10px!important;
|
||||
height: 100%!important;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
margin-top: 0px!important;
|
||||
line-height: 1px;
|
||||
}
|
||||
|
||||
.button {
|
||||
padding: 0;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
display: block;
|
||||
height: 9vh;
|
||||
}
|
||||
|
||||
.clearfix:before,
|
||||
.clearfix:after {
|
||||
display: table;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.clearfix:after {
|
||||
clear: both
|
||||
}
|
||||
.el-header {
|
||||
background: 'white';
|
||||
color: #333;
|
||||
line-height: 10px;
|
||||
}
|
||||
.el-aside {
|
||||
color: #333;
|
||||
}
|
||||
.el-row {
|
||||
margin: 0px!important;
|
||||
}
|
||||
</style>
|
@ -165,9 +165,6 @@ export default {
|
||||
query: value.reference.query
|
||||
})
|
||||
}
|
||||
},
|
||||
labelTypesPayment(value) {
|
||||
console.log(value)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -194,7 +191,6 @@ 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.amount / response.divideRate
|
||||
@ -273,7 +269,6 @@ export default {
|
||||
query
|
||||
})
|
||||
.then(response => {
|
||||
console.log(response)
|
||||
this.labelTypesPayment = response
|
||||
})
|
||||
}
|
||||
|
@ -91,7 +91,7 @@
|
||||
</el-tag>
|
||||
</el-col>
|
||||
<el-col :span="14" style="padding-left: 0px; padding-right: 0px;">
|
||||
<el-button type="primary" plain :disabled="isEmptyValue(this.$route.query.action)" @click="newOrder">
|
||||
<el-button type="primary" plain :disabled="isEmptyValue(currentOrder.documentNo)" @click="newOrder">
|
||||
{{ $t('form.pos.optionsPoinSales.salesOrder.newOrder') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
@ -452,6 +452,7 @@ export default {
|
||||
seeConversion: false,
|
||||
showFieldLine: false,
|
||||
pin: '',
|
||||
attributePin: {},
|
||||
validatePin: true,
|
||||
visible: false
|
||||
}
|
||||
@ -678,6 +679,17 @@ export default {
|
||||
if (!this.isEmptyValue(this.$route.query.action)) {
|
||||
this.$store.dispatch('reloadOrder', { orderUuid: this.$route.query.action })
|
||||
}
|
||||
if (this.isEmptyValue(this.$route.query.action) && !this.isEmptyValue(this.currentOrder.uuid)) {
|
||||
this.$router.push({
|
||||
params: {
|
||||
...this.$route.params
|
||||
},
|
||||
query: {
|
||||
...this.$route.query,
|
||||
action: this.currentOrder.uuid
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate,
|
||||
@ -695,6 +707,7 @@ export default {
|
||||
this.validatePin = false
|
||||
this.pin = ''
|
||||
this.visible = false
|
||||
this.pinAction(this.attributePin)
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error.message)
|
||||
@ -706,7 +719,7 @@ export default {
|
||||
this.pin = ''
|
||||
})
|
||||
.finally(() => {
|
||||
this.closePing()
|
||||
this.closePin()
|
||||
})
|
||||
},
|
||||
closePin() {
|
||||
@ -828,6 +841,41 @@ export default {
|
||||
this.$refs.linesTable.setCurrentRow(this.listOrderLine[this.currentTable])
|
||||
this.currentOrderLine = this.listOrderLine[this.currentTable]
|
||||
}
|
||||
},
|
||||
pinAction(action) {
|
||||
if (action.type === 'updateOrder') {
|
||||
switch (action.columnName) {
|
||||
case 'QtyEntered':
|
||||
case 'PriceEntered':
|
||||
case 'Discount':
|
||||
this.updateOrderLine(action)
|
||||
break
|
||||
case 'C_DocTypeTarget_ID': {
|
||||
const documentTypeUuid = this.$store.getters.getValueOfField({
|
||||
containerUuid: this.$route.meta.uuid,
|
||||
columnName: 'C_DocTypeTarget_ID_UUID'
|
||||
})
|
||||
this.$store.dispatch('updateOrder', {
|
||||
orderUuid: this.$route.query.action,
|
||||
posUuid: this.currentPointOfSales.uuid,
|
||||
documentTypeUuid
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
} else if (action.type === 'actionPos') {
|
||||
switch (action.action) {
|
||||
case 'changeWarehouse':
|
||||
this.$store.commit('setCurrentWarehousePos', action)
|
||||
break
|
||||
case 'changeDocumentType':
|
||||
this.$store.commit('setCurrentDocumentTypePos', action)
|
||||
break
|
||||
case 'changePriceList':
|
||||
this.$store.commit('setCurrentPriceList', action)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ export default {
|
||||
reloadOrder(requery, orderUuid) {
|
||||
if (requery) {
|
||||
if (this.isEmptyValue(orderUuid)) {
|
||||
orderUuid = this.$route.query.action
|
||||
orderUuid = this.currentOrder.uuid
|
||||
// if (this.isEmptyValue(orderUuid)) {
|
||||
// orderUuid = this.$store.getters.currentOrder.uuid // this.currentOrder.uuid
|
||||
// }
|
||||
|
@ -473,11 +473,13 @@ export default {
|
||||
pending: 'Pending',
|
||||
payment: 'Payment',
|
||||
change: 'Change',
|
||||
totalInvoiced: 'Total Invoiced',
|
||||
convertAmount: 'Convert Quantity',
|
||||
convertedAmount: 'Converted Amount',
|
||||
fullPayment: 'Full Payment',
|
||||
dayRate: 'Day Rate',
|
||||
noDayRate: 'No daily rate has been generated for the currency.',
|
||||
Currency: 'Currency',
|
||||
TenderType: {
|
||||
directDeposit: 'Direct Deposit',
|
||||
creditCard: 'Credit Card',
|
||||
@ -488,6 +490,15 @@ export default {
|
||||
account: 'Account',
|
||||
cash: 'Cash',
|
||||
zelle: 'Zelle'
|
||||
},
|
||||
overdrawnInvoice: {
|
||||
title: 'OverdrawnInvoice',
|
||||
below: 'Would you like to leave the Invoice with an Open balance',
|
||||
above: 'Customer Details',
|
||||
returned: 'Your change is',
|
||||
coupon: 'Generate a Gift Card or Vale',
|
||||
returnMoney: 'Return money in another form of payment',
|
||||
adjustDocument: 'You want to Adjust Document'
|
||||
}
|
||||
},
|
||||
keyLayout: {
|
||||
|
@ -449,9 +449,11 @@ export default {
|
||||
pending: 'Pendiente',
|
||||
payment: 'Pago',
|
||||
change: 'Cambio',
|
||||
totalInvoiced: 'Total Facturado',
|
||||
convertAmount: 'Convertir Cantidad',
|
||||
convertedAmount: 'Monto Convertido',
|
||||
fullPayment: 'Cobro Completo',
|
||||
Currency: 'Moneda',
|
||||
dayRate: 'Tasa del Día',
|
||||
noDayRate: 'No se a generado una tasa del día para la moneda',
|
||||
TenderType: {
|
||||
@ -464,6 +466,15 @@ export default {
|
||||
account: 'Cuenta',
|
||||
cash: 'Efectivo',
|
||||
zelle: 'Zelle'
|
||||
},
|
||||
overdrawnInvoice: {
|
||||
title: 'Factura Sobregirada',
|
||||
below: 'Desea dejar la Factura con un saldo Abierto',
|
||||
above: 'Datos del Cliente',
|
||||
returned: 'Su vuelto es',
|
||||
coupon: 'Generar una Tarjeta de Regalo o Vale',
|
||||
returnMoney: 'Devolver dinero en otra forma de pago',
|
||||
adjustDocument: 'Desea Ajustar Documento'
|
||||
}
|
||||
},
|
||||
keyLayout: {
|
||||
|
@ -57,5 +57,12 @@ export default {
|
||||
},
|
||||
setFieldCurrency(state, currency) {
|
||||
state.fieldCurrency = currency
|
||||
},
|
||||
dialogoInvoce(state, { show, type, success }) {
|
||||
state.dialogoInvoce = {
|
||||
show,
|
||||
type,
|
||||
success
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,5 +30,10 @@ export default {
|
||||
currency: [],
|
||||
convertion: {},
|
||||
fieldCurrency: {},
|
||||
convertionRate: []
|
||||
convertionRate: [],
|
||||
dialogoInvoce: {
|
||||
show: false,
|
||||
type: 0,
|
||||
success: false
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user