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

corrections of errors in post services (#859)

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-05-20 10:22:48 -04:00 committed by GitHub
parent 97287f160c
commit 09c9bea77d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 127 additions and 57 deletions

View File

@ -171,8 +171,8 @@ export function requestListOrders({
isProcessed, isProcessed,
isAisleSeller, isAisleSeller,
isInvoiced, isInvoiced,
// dateOrderedFrom, dateOrderedFrom,
// dateOrderedTo, dateOrderedTo,
salesRepresentativeUuid, salesRepresentativeUuid,
pageSize, pageSize,
pageToken pageToken
@ -233,6 +233,8 @@ export function requestListOrders({
is_processed: isProcessed, is_processed: isProcessed,
is_aisle_seller: isAisleSeller, is_aisle_seller: isAisleSeller,
is_invoiced: isInvoiced, is_invoiced: isInvoiced,
date_ordered_from: dateOrderedFrom,
date_ordered_to: dateOrderedTo,
page_size: pageSize, page_size: pageSize,
page_token: pageToken page_token: pageToken
} }

View File

@ -109,7 +109,7 @@
</template> </template>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<el-menu v-else class="el-menu-demo" mode="horizontal" :unique-opened="true" style="z-index: 0" :menu-trigger="triggerMenu" @open="handleOpen" @close="handleClose" @select="handleSelect"> <el-menu v-else-if="field.panelType !== 'form' && !isMobile" class="el-menu-demo" mode="horizontal" :unique-opened="true" style="z-index: 0" :menu-trigger="triggerMenu" @open="handleOpen" @close="handleClose" @select="handleSelect">
<el-submenu index="menu"> <el-submenu index="menu">
<template slot="title"> <template slot="title">
<div :style="isMobile ? 'display: flex;width: auto;' : 'display: block;'"> <div :style="isMobile ? 'display: flex;width: auto;' : 'display: block;'">
@ -179,6 +179,9 @@
</el-menu-item> </el-menu-item>
</el-submenu> </el-submenu>
</el-menu> </el-menu>
<span v-else>
{{ field.name }}
</span>
</template> </template>
<el-popover <el-popover
v-if="openOptionField && !isEmptyValue(optionColumnName) && (optionColumnName === field.columnName) && showPopoverPath" v-if="openOptionField && !isEmptyValue(optionColumnName) && (optionColumnName === field.columnName) && showPopoverPath"
@ -737,7 +740,6 @@ export default {
} }
}, },
handleCommand(command) { handleCommand(command) {
console.log({ command })
this.$store.commit('setRecordAccess', false) this.$store.commit('setRecordAccess', false)
if (command.name === this.$t('table.ProcessActivity.zoomIn')) { if (command.name === this.$t('table.ProcessActivity.zoomIn')) {
this.redirect({ window: command.fieldAttributes.reference.zoomWindows[0] }) this.redirect({ window: command.fieldAttributes.reference.zoomWindows[0] })

View File

@ -107,8 +107,14 @@
<i class="el-icon-arrow-down el-icon--right" /> <i class="el-icon-arrow-down el-icon--right" />
</span> </span>
<el-dropdown-menu slot="dropdown" style="padding-bottom: 0px;"> <el-dropdown-menu slot="dropdown" style="padding-bottom: 0px;">
<el-dropdown-item :command="scope.row"> <el-dropdown-item
:command="{
...scope.row,
option: $t('form.productInfo.productInformation')
}"
>
<el-popover <el-popover
v-if="!isEmptyValue(currentLineOrder)"
placement="right" placement="right"
trigger="click" trigger="click"
:title="$t('form.productInfo.productInformation')" :title="$t('form.productInfo.productInformation')"
@ -131,20 +137,20 @@
</div> </div>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
{{ $t('form.productInfo.code') }}: <b>{{ currentOrderLine.product.value }}</b><br> {{ $t('form.productInfo.code') }}: <b>{{ currentLineOrder.product.value }}</b><br>
{{ $t('form.productInfo.name') }}: <b>{{ currentOrderLine.product.name }}</b><br> {{ $t('form.productInfo.name') }}: <b>{{ currentLineOrder.product.name }}</b><br>
{{ $t('form.productInfo.description') }}: <b>{{ currentOrderLine.product.description }}</b><br> {{ $t('form.productInfo.description') }}: <b>{{ currentLineOrder.product.description }}</b><br>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
<div style="float: right"> <div style="float: right">
{{ $t('form.productInfo.price') }}: {{ $t('form.productInfo.price') }}:
<b>{{ formatPrice(currentOrderLine.product.priceStandard, pointOfSalesCurrency.iSOCode) }}</b> <b>{{ formatPrice(currentLineOrder.product.priceStandard, pointOfSalesCurrency.iSOCode) }}</b>
<br> <br>
{{ $t('form.productInfo.taxAmount') }}: {{ $t('form.productInfo.taxAmount') }}:
<b>{{ currentOrderLine.taxIndicator }}</b> <b>{{ currentLineOrder.taxIndicator }}</b>
<br> <br>
{{ $t('form.productInfo.quantityAvailable') }}: {{ $t('form.productInfo.quantityAvailable') }}:
<b>{{ formatQuantity(currentOrderLine.quantityOrdered) }}</b> <b>{{ formatQuantity(currentLineOrder.quantityOrdered) }}</b>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
@ -154,7 +160,12 @@
</el-button> </el-button>
</el-popover> </el-popover>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item :command="$t('form.pos.tableProduct.editQuantities')"> <el-dropdown-item
:command="{
...scope.row,
option: $t('form.pos.tableProduct.editQuantities')
}"
>
<el-popover <el-popover
placement="right" placement="right"
trigger="click" trigger="click"
@ -452,6 +463,10 @@ export default {
return [] return []
} }
return this.currentOrder.lineOrder return this.currentOrder.lineOrder
},
currentLineOrder() {
console.log(this.$store.state['pointOfSales/orderLine/index'].line)
return this.$store.state['pointOfSales/orderLine/index'].line
} }
}, },
mounted() { mounted() {

View File

@ -25,6 +25,7 @@ export default [
isReadOnly: true, isReadOnly: true,
handleActionPerformed: true, handleActionPerformed: true,
handleContentSelection: true, handleContentSelection: true,
handleFocusGained: true,
handleActionKeyPerformed: true handleActionKeyPerformed: true
} }
}, },
@ -49,6 +50,7 @@ export default [
sequence: 10, sequence: 10,
handleActionPerformed: true, handleActionPerformed: true,
handleContentSelection: true, handleContentSelection: true,
handleFocusGained: true,
handleActionKeyPerformed: true handleActionKeyPerformed: true
} }
} }

View File

@ -28,7 +28,10 @@
<field <field
v-if="field.columnName === 'PriceEntered'" v-if="field.columnName === 'PriceEntered'"
:key="field.columnName" :key="field.columnName"
:metadata-field="field" :metadata-field="{
...field,
isReadOnly: !isModifyPrice
}"
/> />
<field <field
v-if="field.columnName === 'QtyEntered'" v-if="field.columnName === 'QtyEntered'"
@ -36,7 +39,9 @@
:metadata-field="field" :metadata-field="field"
/> />
<el-popover <el-popover
v-if="columnNameVisible === field.columnName"
ref="ping" ref="ping"
v-model="visible"
placement="right" placement="right"
trigger="click" trigger="click"
> >
@ -58,21 +63,19 @@
<el-button <el-button
type="primary" type="primary"
icon="el-icon-check" icon="el-icon-check"
@click="checkclosePing"
/> />
{{
isPosRequiredPin
}}
</span> </span>
<field <el-button slot="reference" type="text" disabled @click="visible = !visible" />
v-if="field.columnName === 'Discount'"
slot="reference"
:key="field.columnName"
:metadata-field="{
...field,
isReadOnly: !isModifyPrice || isPosRequiredPin
}"
/>
</el-popover> </el-popover>
<field
v-if="field.columnName === 'Discount'"
:key="field.columnName"
:metadata-field="{
...field,
isReadOnly: !isModifyPrice
}"
/>
</el-form> </el-form>
</el-col> </el-col>
</template> </template>
@ -127,21 +130,23 @@ export default {
fieldsListLine, fieldsListLine,
fieldsList: [], fieldsList: [],
input: '', input: '',
visible: false visible: false,
columnNameVisible: '',
validatePing: false
} }
}, },
computed: { computed: {
isModifyPrice() { isModifyPrice() {
const pos = this.$store.getters.getCurrentPOS const pos = this.$store.getters.posAttributes.currentPointOfSales
if (!this.isEmptyValue(pos.isModifyPrice)) { if (!this.isEmptyValue(pos.isModifyPrice)) {
return this.$store.getters.getCurrentPOS.isModifyPrice return pos.isModifyPrice
} }
return false return false
}, },
isPosRequiredPin() { isPosRequiredPin() {
const pos = this.$store.getters.getCurrentPOS const pos = this.$store.getters.posAttributes.currentPointOfSales
if (!this.isEmptyValue(pos.isPosRequiredPin)) { if (!this.isEmptyValue(pos.isPosRequiredPin) && !this.validatePing) {
return this.$store.getters.getCurrentPOS.isPosRequiredPin return pos.isPosRequiredPin
} }
return false return false
} }
@ -163,6 +168,12 @@ export default {
} }
} }
}, },
beforeMount() {
this.unsubscribe = this.subscribeChanges()
},
beforeDestroy() {
this.unsubscribe()
},
methods: { methods: {
createFieldFromDictionary, createFieldFromDictionary,
notSubmitForm(event) { notSubmitForm(event) {
@ -217,6 +228,18 @@ export default {
}, },
closePing() { closePing() {
this.$refs.ping[this.$refs.ping.length - 1].showPopper = false this.$refs.ping[this.$refs.ping.length - 1].showPopper = false
},
checkclosePing() {
this.validatePing = true
this.closePing()
},
subscribeChanges() {
return this.$store.subscribe((mutation, state) => {
if (mutation.type === 'addFocusGained' && this.isPosRequiredPin) {
this.columnNameVisible = mutation.payload.columnName
this.visible = true
}
})
} }
} }
} }

View File

@ -51,13 +51,27 @@ export default {
label: 'Total', label: 'Total',
isNumeric: true isNumeric: true
} }
},
currentOrderLine: {
product: {
value: 0,
name: '',
description: '',
priceStandard: 0
},
taxIndicator: 0,
quantityOrdered: 0,
uuid: ''
} }
} }
},
computed: {
}, },
methods: { methods: {
formatPercent, formatPercent,
changeLine(command) { changeLine(command) {
switch (command) { switch (command.option) {
case 'Eliminar': case 'Eliminar':
// this.deleteOrderLine() // this.deleteOrderLine()
break break
@ -68,6 +82,7 @@ export default {
quantityOrdered: this.currentOrderLine.quantityOrdered, quantityOrdered: this.currentOrderLine.quantityOrdered,
discount: this.currentOrderLine.discount discount: this.currentOrderLine.discount
}) })
this.currentOrderLine.uuid = command.uuid
this.edit = true this.edit = true
break break
// //
@ -113,22 +128,32 @@ export default {
switch (line.columnName) { switch (line.columnName) {
case 'QtyEntered': case 'QtyEntered':
quantity = line.value quantity = line.value
price = line.line.price
discountRate = line.line.discountRate
break break
case 'PriceEntered': case 'PriceEntered':
price = line.value price = line.value
quantity = line.line.quantity
discountRate = line.line.discountRate
break break
case 'Discount': case 'Discount':
discountRate = line.value discountRate = line.value
price = line.line.price
quantity = line.line.quantity
break break
} }
requestUpdateOrderLine({ requestUpdateOrderLine({
orderLineUuid: this.currentOrderLine.uuid, orderLineUuid: line.line.uuid,
quantity, quantity,
price, price,
discountRate discountRate
}) })
.then(response => { .then(response => {
this.fillOrderLineQuantities({
currentPrice: response.price,
quantityOrdered: response.quantity,
discount: response.discountRate
})
this.fillOrderLine(response) this.fillOrderLine(response)
this.reloadOrder(true) this.reloadOrder(true)
}) })
@ -173,12 +198,13 @@ export default {
} else if (columnName === 'QtyOrdered') { } else if (columnName === 'QtyOrdered') {
return this.formatQuantity(row.quantityOrdered) return this.formatQuantity(row.quantityOrdered)
} else if (columnName === 'Discount') { } else if (columnName === 'Discount') {
return this.formatPercent(row.discount) return this.formatPercent(row.discount / 100)
} else if (columnName === 'GrandTotal') { } else if (columnName === 'GrandTotal') {
return this.formatPrice(row.grandTotal, currency) return this.formatPrice(row.grandTotal, currency)
} }
}, },
handleCurrentLineChange(rowLine) { handleCurrentLineChange(rowLine) {
this.$store.dispatch('currentLine', rowLine)
if (!this.isEmptyValue(rowLine)) { if (!this.isEmptyValue(rowLine)) {
this.currentOrderLine = rowLine this.currentOrderLine = rowLine
this.currentTable = this.listOrderLine.findIndex(item => item.uuid === rowLine.uuid) this.currentTable = this.listOrderLine.findIndex(item => item.uuid === rowLine.uuid)
@ -192,25 +218,25 @@ export default {
quantityOrdered, quantityOrdered,
discount discount
}) { }) {
const containerUuid = this.formUuid // const containerUuid = this.formUuid
// Editable fields // Editable fields
if (!this.isEmptyValue(quantityOrdered)) { if (!this.isEmptyValue(quantityOrdered)) {
this.$store.commit('updateValueOfField', { this.$store.commit('updateValueOfField', {
containerUuid, containerUuid: 'line',
columnName: 'QtyEntered', columnName: 'QtyEntered',
value: quantityOrdered value: quantityOrdered
}) })
} }
if (!this.isEmptyValue(currentPrice)) { if (!this.isEmptyValue(currentPrice)) {
this.$store.commit('updateValueOfField', { this.$store.commit('updateValueOfField', {
containerUuid, containerUuid: 'line',
columnName: 'PriceEntered', columnName: 'PriceEntered',
value: currentPrice value: currentPrice
}) })
} }
if (!this.isEmptyValue(discount)) { if (!this.isEmptyValue(discount)) {
this.$store.commit('updateValueOfField', { this.$store.commit('updateValueOfField', {
containerUuid, containerUuid: 'line',
columnName: 'Discount', columnName: 'Discount',
value: discount value: discount
}) })

View File

@ -40,16 +40,6 @@ export default {
return { return {
product: {}, product: {},
currentTable: 0, currentTable: 0,
currentOrderLine: {
product: {
value: 0,
name: '',
description: '',
priceStandard: 0
},
taxIndicator: 0,
quantityOrdered: 0
},
orderLines: [], orderLines: [],
products: { products: {
uuid: '', uuid: '',
@ -64,7 +54,7 @@ export default {
return this.$store.getters['user/getWarehouse'] return this.$store.getters['user/getWarehouse']
}, },
isSetTemplateBP() { isSetTemplateBP() {
const currentPOS = this.currentPoint const currentPOS = this.currentPointOfSales
if (!this.isEmptyValue(currentPOS) && if (!this.isEmptyValue(currentPOS) &&
!this.isEmptyValue(currentPOS.templateBusinessPartner) && !this.isEmptyValue(currentPOS.templateBusinessPartner) &&
this.isEmptyValue(this.$route.query.action)) { this.isEmptyValue(this.$route.query.action)) {
@ -200,10 +190,10 @@ export default {
}, },
updateOrder(update) { updateOrder(update) {
// user session // user session
if (update.value !== this.currentOrder.businessPartner.uuid && !this.isEmptyValue(this.currentPoint)) { if (!this.isEmptyValue(update.value) && update.value !== this.currentOrder.businessPartner.uuid && !this.isEmptyValue(this.currentPointOfSales)) {
this.$store.dispatch('updateOrder', { this.$store.dispatch('updateOrder', {
orderUuid: this.$route.query.action, orderUuid: this.$route.query.action,
posUuid: this.currentPoint.uuid, posUuid: this.currentPointOfSales.uuid,
customerUuid: update.value customerUuid: update.value
}) })
} }
@ -312,7 +302,7 @@ export default {
this.createOrderLine(response.uuid) this.createOrderLine(response.uuid)
} }
this.$store.dispatch('listOrdersFromServer', { this.$store.dispatch('listOrdersFromServer', {
posUuid: this.currentPoint.uuid posUuid: this.currentPointOfSales.uuid
}) })
}).catch(() => {}) }).catch(() => {})
}) })
@ -375,7 +365,10 @@ export default {
case 'PriceEntered': case 'PriceEntered':
case 'Discount': case 'Discount':
if (!this.isEmptyValue(this.currentOrderLine)) { if (!this.isEmptyValue(this.currentOrderLine)) {
this.updateOrderLine(mutation.payload) this.updateOrderLine({
...mutation.payload,
line: this.$store.state['pointOfSales/orderLine/index'].line
})
} }
break break
} }
@ -387,8 +380,8 @@ export default {
case 'C_BPartner_ID_UUID': { case 'C_BPartner_ID_UUID': {
const bPartnerValue = mutation.payload.value const bPartnerValue = mutation.payload.value
if (!this.isEmptyValue(this.currentPoint)) { if (!this.isEmptyValue(this.currentPointOfSales)) {
const bPartnerPOS = this.currentPoint.templateBusinessPartner.uuid const bPartnerPOS = this.currentPointOfSales.templateBusinessPartner.uuid
// Does not send values to server, when empty values are set or // Does not send values to server, when empty values are set or
// if BPartner set equal to BPartner POS template // if BPartner set equal to BPartner POS template
if (this.isEmptyValue(bPartnerValue) || bPartnerValue === bPartnerPOS) { if (this.isEmptyValue(bPartnerValue) || bPartnerValue === bPartnerPOS) {

View File

@ -84,5 +84,8 @@ export default {
} }
}) })
commit('setListOrderLine', found) commit('setListOrderLine', found)
},
currentLine({ commit }, currentLine) {
commit('setLine', currentLine)
} }
} }

View File

@ -21,5 +21,8 @@
export default { export default {
setListOrderLine(state, listOrderLine) { setListOrderLine(state, listOrderLine) {
state.listOrderLine = listOrderLine state.listOrderLine = listOrderLine
},
setLine(state, line) {
state.line = line
} }
} }

View File

@ -19,5 +19,6 @@
*/ */
export default { export default {
listOrderLine: [] listOrderLine: [],
line: {}
} }