1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 12:01:57 +08:00

Validate collection (#568)

* correcting field title errors

* Validate collection

* add translation

* add traslation

* remove the function displayTenderType

* correcting translation

* remove unnecessary code
This commit is contained in:
Elsio Sanchez 2021-01-25 15:06:00 -04:00 committed by GitHub
parent ae46494f20
commit c4f3e500d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 184 additions and 102 deletions

View File

@ -6,7 +6,7 @@
<el-collapse v-model="activeAccordion" accordion>
<el-collapse-item name="query-criteria">
<template slot="title">
Business Partner
{{ $t('form.pos.order.BusinessPartnerCreate.businessPartner') }}
<template v-if="!isEmptyValue(parentMetadata.name)">
({{ parentMetadata.name }})
</template>
@ -38,33 +38,27 @@
@current-change="handleCurrentChange"
>
<el-table-column
label="Key"
:label="$t('form.productInfo.code')"
prop="value"
width="180"
width="100"
/>
<el-table-column
label="ID"
:label="$t('form.productInfo.id')"
prop="id"
width="100"
width="90"
/>
<el-table-column
prop="name"
label="Name"
:label="$t('form.productInfo.name')"
/>
<el-table-column
label="Last Name"
:label="$t('form.productInfo.lastName')"
prop="lastName"
/>
<el-table-column
label="NAICS"
prop="naics"
width="100"
/>
<el-table-column
label="Tax ID"
:label="$t('form.pos.order.BusinessPartnerCreate.taxId')"
prop="taxId"
align="right"
width="100"
/>
</el-table>
<custom-pagination
@ -183,8 +177,7 @@ export default {
containerUuid: mutation.payload.containerUuid,
format: 'object'
})
this.searchBPartnerList(values)
this.searchBPartnerList({ contactName: values.Name2 })
}
})
},
@ -192,7 +185,6 @@ export default {
if (isConvert && !this.isEmptyValue(values)) {
values = this.convertValuesToSend(values)
}
return this.$store.dispatch('listBPartnerFromServer', values)
.then(response => {
return response

View File

@ -18,15 +18,15 @@ export default [
isCustomField: true
}
},
{
elementColumnName: 'Name2',
columnName: 'Name2',
tableName: 'C_BPartner',
isFromDictionary: true,
definition: {
isCustomField: true
}
},
// {
// elementColumnName: 'Name2',
// columnName: 'Name2',
// tableName: 'C_BPartner',
// isFromDictionary: true,
// definition: {
// isCustomField: true
// }
// },
{
elementColumnName: 'EMail',
columnName: 'EMail',

View File

@ -24,7 +24,7 @@ export default [
handleActionKeyPerformed: true,
handleContentSelection: true,
handleActionPerformed: true,
size: 8,
size: 24,
isActiveLogics: true,
isMandatory: true
}
@ -39,7 +39,7 @@ export default [
handleActionPerformed: true,
handleContentSelection: true,
displayLogic: `@TenderType@=='D'`,
size: 8,
size: 24,
isActiveLogics: true,
isMandatory: true
}
@ -50,9 +50,13 @@ export default [
elementColumnName: 'DateTrx',
isFromDictionary: true,
overwriteDefinition: {
handleFocusGained: true,
handleFocusLost: true,
handleKeyPressed: true,
handleKeyReleased: true,
handleActionKeyPerformed: true,
handleActionPerformed: true,
size: 8,
size: 24,
displayLogic: `@TenderType@=='K'`,
isActiveLogics: true,
isMandatory: true
@ -64,7 +68,7 @@ export default [
columnName: 'C_Currency_ID',
isFromDictionary: true,
overwriteDefinition: {
size: 8,
size: 24,
handleActionKeyPerformed: true,
handleActionPerformed: true,
validationCode: 'C_Currency.C_Currency_ID = 100',
@ -82,7 +86,7 @@ export default [
handleContentSelection: true,
handleActionPerformed: true,
displayLogic: `@TenderType@<>'X'&@TenderType@<>'C' `,
size: 8,
size: 24,
isActiveLogics: true,
isMandatory: true
}
@ -97,7 +101,7 @@ export default [
handleActionKeyPerformed: true,
handleContentSelection: true,
handleActionPerformed: true,
size: 8,
size: 24,
displayLogic: `@TenderType@=='C'`,
isActiveLogics: true,
isMandatory: true
@ -112,7 +116,7 @@ export default [
handleActionKeyPerformed: true,
handleContentSelection: true,
handleActionPerformed: true,
size: 8,
size: 24,
displayLogic: `@TenderType@=='C'`,
isActiveLogics: true,
isMandatory: true
@ -127,7 +131,7 @@ export default [
handleActionKeyPerformed: true,
handleContentSelection: true,
handleActionPerformed: true,
size: 8,
size: 24,
displayLogic: `@TenderType@=='M'`,
isActiveLogics: true,
isMandatory: true

View File

@ -63,8 +63,19 @@
</div>
</el-card>
<samp style="float: right;padding-right: 10px;">
<el-checkbox v-show="fullCopper" v-model="checked">
<el-link
type="danger"
class="stylefullPayment"
>
<b>
{{ $t('form.pos.collect.fullPayment') }}
</b>
</el-link>
</el-checkbox>
<el-button type="danger" icon="el-icon-close" @click="cancel" />
<el-button type="primary" :disabled="isValidForPay || validateConvertion" icon="el-icon-plus" @click="addCollectToList(paymentBox)" />
<el-button type="primary" :disabled="validPay || addPay" icon="el-icon-plus" @click="addCollectToList(paymentBox)" />
<el-button type="success" :disabled="validateCompleteCollection" icon="el-icon-shopping-cart-full" />
</samp>
</el-header>
<el-main style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;">
@ -211,16 +222,45 @@ export default {
data() {
return {
isCustomForm: true,
checked: false,
currencyConversion: 1,
convertAllPayment: 1,
allPayCurrency: 0,
labelTenderType: '',
defaultLabel: '',
fieldsList: fieldsListCollection
}
},
computed: {
validateCompleteCollection() {
if (this.order.grandTotal === this.pay) {
return false
} else if (this.isCashAmt >= this.change) {
return false
} else if (this.pay >= this.order.grandTotal && this.checked) {
return false
}
return true
},
fullCopper() {
if ((this.change > this.isCashAmt) && this.pay > this.order.grandTotal) {
return true
}
return false
},
isPaymentBox() {
return this.$store.getters.getPaymentBox
},
addPay() {
const amount = this.$store.getters.getValueOfField({
containerUuid: this.containerUuid,
columnName: 'PayAmt'
})
if (amount <= 0) {
return true
}
return false
},
paymentBox() {
const payment = this.isPaymentBox.filter(pay => {
return pay.isVisible
@ -253,7 +293,7 @@ export default {
}
return false
}
const cash = this.pending === 0 ? true : this.isMandatory
const cash = this.isMandatory
return cash
},
turned() {
@ -325,6 +365,14 @@ export default {
}
return true
},
validPay() {
const containerUuid = this.containerUuid
const fieldsEmpty = this.$store.getters.getFieldsListEmptyMandatory({
containerUuid,
fieldsList: this.fieldsList
})
return !this.isEmptyValue(fieldsEmpty)
},
change() {
const missing = this.pay - this.order.grandTotal
if (this.pay > 0 && this.pay > this.order.grandTotal) {
@ -392,20 +440,19 @@ export default {
return false
}
return true
},
fieldpending() {
return this.pending * this.multiplyRate
}
// fieldpending() {
// return this.pending / this.divideRate
// }
},
watch: {
// fieldpending(value) {
// this.$store.commit('updateValueOfField', {
// containerUuid: this.containerUuid,
// columnName: 'PayAmt',
// value: value
// })
// },
fieldpending(value) {
this.$store.commit('updateValueOfField', {
containerUuid: this.containerUuid,
columnName: 'PayAmt',
value: value
})
},
pending(value) {
this.$store.commit('updateValueOfField', {
containerUuid: this.containerUuid,
@ -418,10 +465,18 @@ export default {
this.$store.dispatch('conversionDivideRate', {
conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid,
currencyFromUuid: this.currencyPoint.uuid,
currencyToUuid: value,
conversionDate: this.currentOrder.dateOrdered
currencyToUuid: value
})
}
if (!this.isEmptyValue(value)) {
this.$store.dispatch('conversionMultiplyRate', {
conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid,
currencyFromUuid: this.currencyPoint.uuid,
currencyToUuid: value
})
} else {
this.$store.commit('currencyMultiplyRate', 1)
}
},
convertAllPayment(value) {
if (!this.isEmptyValue(value)) {
@ -434,8 +489,7 @@ export default {
this.$store.dispatch('conversionMultiplyRate', {
conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid,
currencyFromUuid: this.currencyPoint.uuid,
currencyToUuid: value,
conversionDate: this.currentOrder.dateOrdered
currencyToUuid: value
})
} else {
this.$store.commit('currencyMultiplyRate', 1)
@ -452,6 +506,7 @@ export default {
}
},
created() {
this.unsubscribe = this.subscribeChanges()
this.defaultValueCurrency()
},
methods: {
@ -468,39 +523,6 @@ export default {
event.preventDefault()
return false
},
displayTenderType(type) {
let label
switch (type) {
case 'A':
label = 'Depósito directo'
break
case 'C':
label = 'Tarjeta de crédito'
break
case 'D':
label = 'Débito directo'
break
case 'K':
label = 'Cheque'
break
case 'M':
label = 'Nota de crédito'
break
case 'P':
label = 'Pago móvil interbancario'
break
case 'T':
label = 'Cuenta'
break
case 'X':
label = 'Efectivo'
break
case 'Z':
label = 'Zelle'
break
}
return label
},
addCollectToList() {
const containerUuid = this.containerUuid
const amount = this.$store.getters.getValueOfField({
@ -531,7 +553,7 @@ export default {
currency = this.currencyPoint.iSOCode
}
const displayType = this.displayTenderType(typePay)
const displayType = this.labelTenderType
this.$store.dispatch('setPaymentBox', {
isVisible: true,
quantityCahs: amount,
@ -566,6 +588,12 @@ export default {
columnName: 'C_Currency_ID',
value: this.currencyPoint.id
})
this.$store.commit('updateValueOfField', {
parentUuid: '',
containerUuid: 'Collection',
columnName: 'DisplayColumn_TenderType',
value: this.defaultLabel
})
this.$store.commit('updateValueOfField', {
containerUuid: this.containerUuid,
columnName: 'PayAmt',
@ -574,6 +602,8 @@ export default {
})
this.defaultValueCurrency()
this.$store.dispatch('conversionDivideRate', 1)
this.$store.commit('currencyMultiplyRate', 1)
this.cancel()
},
cancel() {
this.fieldsList.forEach(element => {
@ -600,6 +630,7 @@ export default {
})
this.defaultValueCurrency()
this.$store.dispatch('conversionDivideRate', 1)
this.$store.commit('currencyMultiplyRate', 1)
},
getPriceApplyingDiscount(price, discount) {
if (this.isEmptyValue(price)) {
@ -639,12 +670,33 @@ export default {
columnName: 'C_Currency_ID_UUID',
value: this.currencyPoint.uuid
})
},
defaulTenderType() {
this.$store.commit('updateValueOfField', {
parentUuid: '',
containerUuid: 'Collection',
columnName: 'DisplayColumn_TenderType',
value: this.$t('form.pos.collect.TenderType.cash')
})
},
subscribeChanges() {
return this.$store.subscribe((mutation, state) => {
if (mutation.type === 'updateValueOfField') {
if (mutation.payload.columnName === 'DisplayColumn_TenderType') {
this.labelTenderType = mutation.payload.value
}
}
})
}
}
}
</script>
<style scoped>
.stylefullPayment {
font-size: 15px;
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif
}
.el-button--text {
border-color: transparent;
color: #1890ff;

View File

@ -10,8 +10,7 @@
</el-collapse-transition>
<el-form-item>
<template slot="label">
Código Producto
<!-- Ver Lista de Productos Y Precios -->
{{ $t('form.productInfo.codeProduct') }}
<el-button
v-popover:productsList
type="text"

View File

@ -83,7 +83,7 @@ export default {
<style>
.setting {
z-index: 3;
width: 5%;
width: 2.5%;
height: 10%;
right: 0%;
position: absolute;

View File

@ -83,7 +83,7 @@ export default {
<style>
.setting {
z-index: 3;
width: 5%;
width: 2.5%;
height: 10%;
right: 0%;
position: absolute;

View File

@ -382,7 +382,8 @@ export default {
collect: 'Collect',
BusinessPartnerCreate: {
businessPartner: 'Business Partner',
successfullyCreated: 'Successful Business Partner'
successfullyCreated: 'Socio de Negocio Creado Exitosamente',
taxId: 'Tax Identification'
}
},
collect: {
@ -390,7 +391,19 @@ export default {
pending: 'Pending',
payment: 'Payment',
change: 'Change',
convertAmount: 'Convert Quantity'
convertAmount: 'Convert Quantity',
fullPayment: 'Full Payment',
TenderType: {
directDeposit: 'Direct Deposit',
creditCard: 'Credit Card',
directDebit: 'Direct Debit',
check: 'Check',
creditNote: 'Credit Note',
mobilePayment: 'Interbank mobile payment',
account: 'Account',
cash: 'Cash',
zelle: 'Zelle'
}
},
keyLayout: {
noProducto: 'No product available. Back to top'
@ -402,9 +415,12 @@ export default {
},
productInfo: {
product: 'Product',
codeProduct: 'Códe Product',
productInformation: 'Product information',
code: 'Code',
name: 'Name',
lastName: 'Nombre2',
id: 'ID',
description: 'Description',
price: 'Price',
quantityOnHand: 'Quantity On Hand',

View File

@ -345,7 +345,7 @@ export default {
order: {
order: 'Orden',
seller: 'Vendedor',
date: 'Date',
date: 'Fecha',
subTotal: 'Sub-Total',
type: 'Tipo',
discount: 'Descuento',
@ -357,7 +357,8 @@ export default {
collect: 'Cobrar',
BusinessPartnerCreate: {
businessPartner: 'Socio de Negocios',
successfullyCreated: 'Socio de Negocio Creado Exitosamente'
successfullyCreated: 'Socio de Negocio Creado Exitosamente',
taxId: 'Identificación Fiscal'
}
},
collect: {
@ -365,7 +366,19 @@ export default {
pending: 'Pendiente',
payment: 'Pago',
change: 'Cambio',
convertAmount: 'Convertir Cantidad'
convertAmount: 'Convertir Cantidad',
fullPayment: 'Cobro Completo',
TenderType: {
directDeposit: 'Depósito Directo',
creditCard: 'Tarjeta de Crédito',
directDebit: 'Débito Directo',
check: 'Cheque',
creditNote: 'Nota de crédito',
mobilePayment: 'Pago Móvil Interbancario',
account: 'Cuenta',
cash: 'Efectivo',
zelle: 'Zelle'
}
},
keyLayout: {
noProducto: 'No hay producto disponible Regresar al Principio'
@ -377,9 +390,12 @@ export default {
},
productInfo: {
product: 'Producto',
codeProduct: 'Código de Producto',
productInformation: 'Información de Producto',
code: 'Código',
name: 'Nombre',
id: 'ID',
lastName: 'Nombre2',
description: 'Descripción',
quantityOnHand: 'Existencia',
price: 'Precio',

View File

@ -25,11 +25,7 @@ const collection = {
* creating boxes with the payment list
*/
setPaymentBox({ state, commit, getters }, params) {
const payments = getters.getPaymentBox.find(element => {
if (element.tenderType === params.tenderType && element.currency.id === params.currency.id) {
return element
}
})
const payments = undefined
if (isEmptyValue(payments)) {
commit('addPaymentBox', params)
} else {
@ -58,8 +54,7 @@ const collection = {
requestGetConversionRate({
conversionTypeUuid: params.conversionTypeUuid,
currencyFromUuid: params.currencyFromUuid,
currencyToUuid: params.currencyToUuid,
conversionDate: params.conversionDate
currencyToUuid: params.currencyToUuid
})
.then(response => {
const divideRate = isEmptyValue(response.divideRate) ? 1 : response.divideRate

View File

@ -1,3 +1,4 @@
import { isEmptyValue } from '../valueUtils'
export function convertContextInfo(contextInfoToConvert) {
if (contextInfoToConvert) {
@ -154,12 +155,19 @@ export function convertBusinessPartner(businessPartnerToConvert) {
export function convertConversionRate(conversionRateToConvert) {
const { id, uuid } = conversionRateToConvert
if (isEmptyValue(conversionRateToConvert.currency_from) && isEmptyValue(conversionRateToConvert.currency_from)) {
return {
uuid,
id,
multiplyRate: conversionRateToConvert.multiply_rate,
divideRate: conversionRateToConvert.divide_rate
}
}
return {
uuid,
id,
conversionTypeUuid: conversionRateToConvert.conversion_type_uuid,
validFrom: conversionRateToConvert.valid_from,
validTo: conversionRateToConvert.valid_to,
currencyFrom: convertCurrency(
conversionRateToConvert.currency_from
),