1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-07 18:25:45 +08:00

Add service create a customer account (#1117)

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-08-24 18:11:33 -04:00 committed by GitHub
parent d95f55fb90
commit 2312711de4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 77 additions and 4 deletions

View File

@ -920,3 +920,30 @@ export function listTenderTypes({
return listTenderType
})
}
/**
* Create Customer Account
* @param {string} posUuidd - POS UUID reference
*/
export function createCustomerAccount({
posUuid,
orderUuid,
customerAccount,
tenderTypeCode,
currencyUuid
}) {
return request({
url: `${config.pointOfSales.endpoint}/available-payment-methods`,
method: 'post',
data: {
pos_uuid: posUuid,
order_uuid: orderUuid,
customer_account: customerAccount,
tender_type_code: tenderTypeCode,
currency_uuid: currencyUuid
}
})
.then(responseCustomerAccount => {
return responseCustomerAccount
})
}

View File

@ -370,6 +370,11 @@ export default {
},
watch: {
option(value) {
this.$store.commit('updateValueOfField', {
containerUuid: this.renderComponentContainer,
columnName: 'PayAmt',
value: this.change
})
this.selectionTypeRefund = {}
}
},
@ -418,9 +423,15 @@ export default {
containerUuid: this.renderComponentContainer,
format: 'object'
})
values.tenderType = this.selectionTypeRefund.name
const customer = {
customerAccount: values,
currencyUuid: this.$store.getters.getCurrencyRedund.uuid,
orderUuid: this.currentOrder.uuid,
posUuid: this.currentPointOfSales.uuid,
tenderTypeCode: this.selectionTypeRefund.tender_type
}
const emptyMandatoryFields = this.$store.getters.getFieldsListEmptyMandatory({ containerUuid: this.renderComponentContainer, formatReturn: 'name' })
if (!this.isEmptyValue(emptyMandatoryFields)) {
if (!this.isEmptyValue(emptyMandatoryFields) && this.isEmptyValue(this.$store.getters.getCurrencyRedund.uuid)) {
this.$message({
type: 'warning',
message: this.$t('notifications.mandatoryFieldMissing') + emptyMandatoryFields,
@ -437,6 +448,7 @@ export default {
})
})
this.$store.dispatch('addRefundLoaded', values)
this.$store.dispatch('sendCreateCustomerAccount', customer)
this.selectionTypeRefund = {}
this.success()
},
@ -512,7 +524,6 @@ export default {
}
break
default:
console.log(this.$store.getters.posAttributes.currentPointOfSales.isPosRequiredPin)
if (this.$store.getters.posAttributes.currentPointOfSales.isPosRequiredPin) {
const attributePin = {
posUuid,

View File

@ -167,6 +167,8 @@ export default {
},
changeCurrency(value) {
this.currentFieldCurrency = value
const currency = this.listCurrency.find(currency => currency.key === value)
this.$store.dispatch('currencyRedund', currency)
},
changePaymentType(value) {
this.$store.commit('currentTenderChange', value)

View File

@ -203,6 +203,8 @@ export default {
},
changeCurrency(value) {
this.currentFieldCurrency = value
const currency = this.listCurrency.find(currency => currency.key === value)
this.$store.dispatch('currencyRedund', currency)
},
changePaymentType(value) {
this.$store.commit('currentTenderChange', value)

View File

@ -167,6 +167,8 @@ export default {
},
changeCurrency(value) {
this.currentFieldCurrency = value
const currency = this.listCurrency.find(currency => currency.key === value)
this.$store.dispatch('currencyRedund', currency)
},
changePaymentType(value) {
this.$store.commit('currentTenderChange', value)

View File

@ -19,7 +19,8 @@ import {
createPayment,
deletePayment,
updatePayment,
getPaymentsList
getPaymentsList,
createCustomerAccount
} from '@/api/ADempiere/form/point-of-sales.js'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
import { showMessage } from '@/utils/ADempiere/notification.js'
@ -316,5 +317,26 @@ export default {
const addRefund = state.refundLoaded
addRefund.push(refund)
commit('setRefundLoaded', addRefund)
},
currencyRedund({ commit }, currency) {
commit('setCurrencyRedund', currency)
},
sendCreateCustomerAccount({ commit }, {
posUuid,
orderUuid,
customerAccount,
tenderTypeCode,
currencyUuid
}) {
createCustomerAccount({
posUuid,
orderUuid,
customerAccount,
tenderTypeCode,
currencyUuid
})
.then(response => {
console.log(response)
})
}
}

View File

@ -51,5 +51,8 @@ export default {
},
getRefundLoaded: (state) => {
return state.refundLoaded
},
getCurrencyRedund: (state) => {
return state.currentFieldCurrencyRedund
}
}

View File

@ -67,5 +67,8 @@ export default {
},
setRefundLoaded(state, refund) {
state.refundLoaded = refund
},
setCurrencyRedund(state, currency) {
state.currentFieldCurrencyRedund = currency
}
}

View File

@ -32,6 +32,7 @@ export default {
fieldCurrency: {},
convertionRate: [],
refundLoaded: [],
currentFieldCurrencyRedund: {},
dialogoInvoce: {
show: false,
type: 0,