1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-07 18:25:45 +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-card shadow="hover">
<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"
>
<i class="el-icon-news" />
@ -381,7 +381,7 @@ export default {
}
},
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: not-allowed; text-align: center !important; color: gray;min-height: 50px;'
@ -457,6 +457,9 @@ export default {
})
},
completePreparedOrder() {
if (this.isEmptyValue(this.currentOrder.uuid)) {
return ''
}
const posUuid = this.currentPointOfSales.uuid
this.$store.dispatch('updateOrderPos', true)
this.$store.dispatch('updatePaymentPos', true)
@ -495,6 +498,9 @@ export default {
})
},
reverseSalesTransaction() {
if (this.isEmptyValue(this.currentOrder.uuid)) {
return ''
}
const process = this.$store.getters.getProcess(posProcess[0].uuid)
this.showModal(process)
const parametersList = [
@ -544,6 +550,9 @@ export default {
})
},
copyOrder() {
if (this.isEmptyValue(this.currentOrder.uuid)) {
return ''
}
this.processPos = posProcess[1].uuid
const posUuid = this.currentPointOfSales.uuid
const parametersList = [{
@ -596,6 +605,9 @@ export default {
})
},
deleteOrder() {
if (this.isEmptyValue(this.currentOrder.uuid)) {
return ''
}
this.$store.dispatch('updateOrderPos', true)
deleteOrder({
orderUuid: this.$route.query.action
@ -630,9 +642,49 @@ export default {
},
changePos(posElement) {
this.$store.dispatch('setCurrentPOS', posElement)
this.newOrder()
this.clearOrder()
},
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({
params: {
...this.$route.params

View File

@ -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(currentOrder.documentNo)" @click="newOrder">
<el-button type="primary" plain @click="newOrder">
{{ $t('form.pos.optionsPoinSales.salesOrder.newOrder') }}
</el-button>
</el-col>
@ -139,6 +139,7 @@
<template slot-scope="scope">
<el-popover
v-if="!isEmptyValue(listOrderLine)"
popper-class="el-popper-info"
placement="right-start"
trigger="click"
:title="$t('form.productInfo.productInformation')"
@ -635,7 +636,7 @@ export default {
},
currentWarehouse() {
if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.warehouse)) {
return this.$store.getters.getCurrentWarehousePos
return this.$store.getters.posAttributes.currentPointOfSales.warehouse
}
return {}
},
@ -744,60 +745,11 @@ export default {
return this.formatPrice(this.currentOrder.grandTotal - this.currentOrder.totalLines, currency)
},
newOrder() {
this.$router.push({
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', [])
})
this.createOrder({ withLine: false, newOrder: true })
},
changePos(pointOfSales) {
this.$store.dispatch('setCurrentPOS', pointOfSales)
this.newOrder()
this.clearOrder()
},
changeWarehouse(warehouse) {
this.attributePin = {
@ -1050,7 +1002,7 @@ export default {
</style>
<style>
.el-popper {
.el-popper-info {
margin-left: 12px;
max-width: 65%;
min-width: 50%;

View File

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

View File

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