1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 20:39:48 +08:00

fix point-of-sale options (#1036)

* fix point-of-sale options

* minimal change

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-08-09 21:39:59 -04:00 committed by GitHub
parent e41e56b3a0
commit d39553bcd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 62 deletions

View File

@ -33,7 +33,7 @@
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;"> <el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
<el-card shadow="hover"> <el-card shadow="hover">
<p <p
:style="isEmptyValue($route.query.action) ? 'cursor: not-allowed; text-align: center !important; color: gray;' : blockOption" style="cursor: pointer; text-align: center !important; color: black;min-height: 50px;"
@click="newOrder" @click="newOrder"
> >
<i class="el-icon-news" /> <i class="el-icon-news" />
@ -381,7 +381,7 @@ export default {
} }
}, },
blockOption() { blockOption() {
if (!this.isEmptyValue(this.$route.query.pos)) { if (!this.isEmptyValue(this.currentOrder.uuid)) {
return 'cursor: pointer; text-align: center !important; color: black;min-height: 50px;' return 'cursor: pointer; text-align: center !important; color: black;min-height: 50px;'
} }
return 'cursor: not-allowed; text-align: center !important; color: gray;min-height: 50px;' return 'cursor: not-allowed; text-align: center !important; color: gray;min-height: 50px;'
@ -457,6 +457,9 @@ export default {
}) })
}, },
completePreparedOrder() { completePreparedOrder() {
if (this.isEmptyValue(this.currentOrder.uuid)) {
return ''
}
const posUuid = this.currentPointOfSales.uuid const posUuid = this.currentPointOfSales.uuid
this.$store.dispatch('updateOrderPos', true) this.$store.dispatch('updateOrderPos', true)
this.$store.dispatch('updatePaymentPos', true) this.$store.dispatch('updatePaymentPos', true)
@ -495,6 +498,9 @@ export default {
}) })
}, },
reverseSalesTransaction() { reverseSalesTransaction() {
if (this.isEmptyValue(this.currentOrder.uuid)) {
return ''
}
const process = this.$store.getters.getProcess(posProcess[0].uuid) const process = this.$store.getters.getProcess(posProcess[0].uuid)
this.showModal(process) this.showModal(process)
const parametersList = [ const parametersList = [
@ -544,6 +550,9 @@ export default {
}) })
}, },
copyOrder() { copyOrder() {
if (this.isEmptyValue(this.currentOrder.uuid)) {
return ''
}
this.processPos = posProcess[1].uuid this.processPos = posProcess[1].uuid
const posUuid = this.currentPointOfSales.uuid const posUuid = this.currentPointOfSales.uuid
const parametersList = [{ const parametersList = [{
@ -596,6 +605,9 @@ export default {
}) })
}, },
deleteOrder() { deleteOrder() {
if (this.isEmptyValue(this.currentOrder.uuid)) {
return ''
}
this.$store.dispatch('updateOrderPos', true) this.$store.dispatch('updateOrderPos', true)
deleteOrder({ deleteOrder({
orderUuid: this.$route.query.action orderUuid: this.$route.query.action
@ -630,9 +642,49 @@ export default {
}, },
changePos(posElement) { changePos(posElement) {
this.$store.dispatch('setCurrentPOS', posElement) this.$store.dispatch('setCurrentPOS', posElement)
this.newOrder() this.clearOrder()
}, },
newOrder() { newOrder() {
const posUuid = this.currentPointOfSales.uuid
let customerUuid = this.$store.getters.getValueOfField({
containerUuid: this.$route.meta.uuid,
columnName: 'C_BPartner_ID_UUID'
})
const id = this.$store.getters.getValueOfField({
containerUuid: this.$route.meta.uuid,
columnName: 'C_BPartner_ID'
})
const documentTypeUuid = this.$store.getters.getValueOfField({
containerUuid: this.$route.meta.uuid,
columnName: 'C_DocTypeTarget_ID_UUID'
})
if (this.isEmptyValue(customerUuid) || id === 1000006) {
customerUuid = this.currentPointOfSales.templateBusinessPartner.uuid
}
this.$store.dispatch('createOrder', {
posUuid,
customerUuid,
salesRepresentativeUuid: this.currentPointOfSales.salesRepresentative.uuid,
documentTypeUuid
})
.then(response => {
this.$store.dispatch('reloadOrder', { orderUuid: response.uuid })
this.$router.push({
params: {
...this.$route.params
},
query: {
...this.$route.query,
action: response.uuid
}
}).then(() => {
this.$store.dispatch('listOrdersFromServer', {
posUuid: this.currentPointOfSales.uuid
})
}).catch(() => {})
})
},
clearOrder() {
this.$router.push({ this.$router.push({
params: { params: {
...this.$route.params ...this.$route.params

View File

@ -91,7 +91,7 @@
</el-tag> </el-tag>
</el-col> </el-col>
<el-col :span="14" style="padding-left: 0px; padding-right: 0px;"> <el-col :span="14" style="padding-left: 0px; padding-right: 0px;">
<el-button type="primary" plain :disabled="isEmptyValue(currentOrder.documentNo)" @click="newOrder"> <el-button type="primary" plain @click="newOrder">
{{ $t('form.pos.optionsPoinSales.salesOrder.newOrder') }} {{ $t('form.pos.optionsPoinSales.salesOrder.newOrder') }}
</el-button> </el-button>
</el-col> </el-col>
@ -139,6 +139,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover <el-popover
v-if="!isEmptyValue(listOrderLine)" v-if="!isEmptyValue(listOrderLine)"
popper-class="el-popper-info"
placement="right-start" placement="right-start"
trigger="click" trigger="click"
:title="$t('form.productInfo.productInformation')" :title="$t('form.productInfo.productInformation')"
@ -635,7 +636,7 @@ export default {
}, },
currentWarehouse() { currentWarehouse() {
if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.warehouse)) { if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.warehouse)) {
return this.$store.getters.getCurrentWarehousePos return this.$store.getters.posAttributes.currentPointOfSales.warehouse
} }
return {} return {}
}, },
@ -744,60 +745,11 @@ export default {
return this.formatPrice(this.currentOrder.grandTotal - this.currentOrder.totalLines, currency) return this.formatPrice(this.currentOrder.grandTotal - this.currentOrder.totalLines, currency)
}, },
newOrder() { newOrder() {
this.$router.push({ this.createOrder({ withLine: false, newOrder: true })
params: {
...this.$route.params
},
query: {
pos: this.currentPointOfSales.id
}
}).catch(() => {
}).finally(() => {
this.$store.commit('setListPayments', [])
const { templateBusinessPartner } = this.currentPointOfSales
this.$store.commit('updateValuesOfContainer', {
containerUuid: this.metadata.containerUuid,
attributes: [{
columnName: 'UUID',
value: undefined
},
{
columnName: 'ProductValue',
value: undefined
},
{
columnName: 'C_BPartner_ID',
value: templateBusinessPartner.id
},
{
columnName: 'DisplayColumn_C_BPartner_ID',
value: templateBusinessPartner.name
},
{
columnName: ' C_BPartner_ID_UUID',
value: templateBusinessPartner.uuid
}]
})
this.$store.dispatch('setOrder', {
documentType: {},
documentStatus: {
value: ''
},
totalLines: 0,
grandTotal: 0,
salesRepresentative: {},
businessPartner: {
value: '',
uuid: ''
}
})
this.$store.commit('setShowPOSCollection', false)
this.$store.dispatch('listOrderLine', [])
})
}, },
changePos(pointOfSales) { changePos(pointOfSales) {
this.$store.dispatch('setCurrentPOS', pointOfSales) this.$store.dispatch('setCurrentPOS', pointOfSales)
this.newOrder() this.clearOrder()
}, },
changeWarehouse(warehouse) { changeWarehouse(warehouse) {
this.attributePin = { this.attributePin = {
@ -1050,7 +1002,7 @@ export default {
</style> </style>
<style> <style>
.el-popper { .el-popper-info {
margin-left: 12px; margin-left: 12px;
max-width: 65%; max-width: 65%;
min-width: 50%; min-width: 50%;

View File

@ -351,7 +351,7 @@ export default {
}) })
.then(productPrice => { .then(productPrice => {
this.product = productPrice.product this.product = productPrice.product
this.createOrder(true) this.createOrder({ withLine: true })
}) })
.catch(error => { .catch(error => {
console.warn(error.message) console.warn(error.message)
@ -371,12 +371,12 @@ export default {
}) })
}) })
}, },
createOrder(withLine) { createOrder({ withLine = false, newOrder = false }) {
if (this.withoutPOSTerminal()) { if (this.withoutPOSTerminal()) {
return return
} }
const orderUuid = this.$route.query.action const orderUuid = this.$route.query.action
if (this.isEmptyValue(orderUuid)) { if (this.isEmptyValue(orderUuid) || newOrder) {
const posUuid = this.currentPointOfSales.uuid const posUuid = this.currentPointOfSales.uuid
let customerUuid = this.$store.getters.getValueOfField({ let customerUuid = this.$store.getters.getValueOfField({
containerUuid: this.metadata.containerUuid, containerUuid: this.metadata.containerUuid,
@ -583,7 +583,7 @@ export default {
break break
} }
}, },
newOrder() { clearOrder() {
this.$router.push({ this.$router.push({
params: { params: {
...this.$route.params ...this.$route.params
@ -637,7 +637,7 @@ export default {
}, },
changePos(posElement) { changePos(posElement) {
this.$store.dispatch('setCurrentPOS', posElement) this.$store.dispatch('setCurrentPOS', posElement)
this.newOrder() this.clearOrder()
} }
} }
} }

View File

@ -61,6 +61,10 @@ export default {
form = import('@/components/ADempiere/Form/VMatch') form = import('@/components/ADempiere/Form/VMatch')
break break
case 'VPOS': case 'VPOS':
this.$store.dispatch('settings/changeSetting', {
key: 'showContextMenu',
value: false
})
form = import('@/components/ADempiere/Form/VPOS') form = import('@/components/ADempiere/Form/VPOS')
break break
case 'VGetWeight': case 'VGetWeight':