mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +08:00
Supporte Pin Point Of Sales (#978)
* Fixe POs * fixes Currency * Supporte Pin Point Of Sales * focus ping Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
parent
3bb6a7880a
commit
4f567fc95c
@ -54,43 +54,11 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="5" :style="styleTab">
|
<el-col :span="5" :style="styleTab">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-popover
|
<field
|
||||||
v-model="visible"
|
:key="fieldsList[2].columnName"
|
||||||
placement="right"
|
:metadata-field="fieldsList[2]"
|
||||||
>
|
:v-model="fieldsList[2].value"
|
||||||
<el-form label-position="top" label-width="10px" @submit.native.prevent="notSubmitForm">
|
/>
|
||||||
<el-form-item :label="$t('form.pos.tableProduct.pin')">
|
|
||||||
<el-input
|
|
||||||
v-model="pin"
|
|
||||||
type="password"
|
|
||||||
:placeholder="$t('form.pos.tableProduct.pin')"
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<span style="float: right;">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
icon="el-icon-close"
|
|
||||||
@click="closePin"
|
|
||||||
/>
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
icon="el-icon-check"
|
|
||||||
@click="openPin(pin)"
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
<el-button slot="reference" type="text">
|
|
||||||
<field
|
|
||||||
:key="fieldsList[2].columnName"
|
|
||||||
:metadata-field="{
|
|
||||||
...fieldsList[2],
|
|
||||||
isReadOnly: validatePin
|
|
||||||
}"
|
|
||||||
:v-model="fieldsList[2].value"
|
|
||||||
/>
|
|
||||||
</el-button>
|
|
||||||
</el-popover>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="isEmptyValue(currentOrder) ? 1 : 4" :style="isShowedPOSKeyLayout ? 'padding: 0px; margin-top: 3.%;' : 'padding: 0px; margin-top: 2.4%;'">
|
<el-col :span="isEmptyValue(currentOrder) ? 1 : 4" :style="isShowedPOSKeyLayout ? 'padding: 0px; margin-top: 3.%;' : 'padding: 0px; margin-top: 2.4%;'">
|
||||||
@ -221,6 +189,29 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-main>
|
</el-main>
|
||||||
|
<el-dialog ref="dialog" :title="$t('form.pos.tableProduct.pin')" width="30%" :visible.sync="visible">
|
||||||
|
<el-input
|
||||||
|
id="pin"
|
||||||
|
ref="pin"
|
||||||
|
v-model="pin"
|
||||||
|
:autofocus="true"
|
||||||
|
type="password"
|
||||||
|
:placeholder="$t('form.pos.tableProduct.pin')"
|
||||||
|
:focus="true"
|
||||||
|
/>
|
||||||
|
<span style="float: right;">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
icon="el-icon-close"
|
||||||
|
@click="closePin"
|
||||||
|
/>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-check"
|
||||||
|
@click="openPin(pin)"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
<el-footer :class="classOrderFooter">
|
<el-footer :class="classOrderFooter">
|
||||||
<div class="keypad">
|
<div class="keypad">
|
||||||
<span id="toolPoint">
|
<span id="toolPoint">
|
||||||
@ -412,6 +403,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import formMixin from '@/components/ADempiere/Form/formMixin.js'
|
import formMixin from '@/components/ADempiere/Form/formMixin.js'
|
||||||
import orderLineMixin from './orderLineMixin.js'
|
import orderLineMixin from './orderLineMixin.js'
|
||||||
|
import posMixin from '@/components/ADempiere/Form/VPOS/posMixin.js'
|
||||||
import fieldsListOrder from './fieldsListOrder.js'
|
import fieldsListOrder from './fieldsListOrder.js'
|
||||||
import BusinessPartner from '@/components/ADempiere/Form/VPOS/BusinessPartner'
|
import BusinessPartner from '@/components/ADempiere/Form/VPOS/BusinessPartner'
|
||||||
import fieldLine from '@/components/ADempiere/Form/VPOS/Order/line/index'
|
import fieldLine from '@/components/ADempiere/Form/VPOS/Order/line/index'
|
||||||
@ -435,7 +427,8 @@ export default {
|
|||||||
},
|
},
|
||||||
mixins: [
|
mixins: [
|
||||||
formMixin,
|
formMixin,
|
||||||
orderLineMixin
|
orderLineMixin,
|
||||||
|
posMixin
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -625,8 +618,8 @@ export default {
|
|||||||
return list
|
return list
|
||||||
},
|
},
|
||||||
currentWarehouse() {
|
currentWarehouse() {
|
||||||
if (!this.isEmptyValue(this.$store.getters['user/getWarehouse'])) {
|
if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.warehouse)) {
|
||||||
return this.$store.getters['user/getWarehouse']
|
return this.$store.getters.getcurrentWarehousePos
|
||||||
}
|
}
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
@ -645,6 +638,13 @@ export default {
|
|||||||
},
|
},
|
||||||
currentOrder(value) {
|
currentOrder(value) {
|
||||||
this.validatePin = true
|
this.validatePin = true
|
||||||
|
},
|
||||||
|
visible(value) {
|
||||||
|
if (value && !this.isEmptyValue(this.$refs)) {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.focusPin()
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -656,6 +656,10 @@ export default {
|
|||||||
formatDate,
|
formatDate,
|
||||||
formatPrice,
|
formatPrice,
|
||||||
formatQuantity,
|
formatQuantity,
|
||||||
|
focusPin() {
|
||||||
|
console.log(this.$refs)
|
||||||
|
this.$refs.pin.focus()
|
||||||
|
},
|
||||||
openPin(pin) {
|
openPin(pin) {
|
||||||
validatePin({
|
validatePin({
|
||||||
posUuid: this.currentPointOfSales.uuid,
|
posUuid: this.currentPointOfSales.uuid,
|
||||||
@ -757,10 +761,20 @@ export default {
|
|||||||
this.newOrder()
|
this.newOrder()
|
||||||
},
|
},
|
||||||
changeWarehouse(warehouse) {
|
changeWarehouse(warehouse) {
|
||||||
this.$store.commit('setCurrentWarehouse', warehouse)
|
this.attributePin = {
|
||||||
|
...warehouse,
|
||||||
|
action: 'changeWarehouse',
|
||||||
|
type: 'actionPos'
|
||||||
|
}
|
||||||
|
this.visible = true
|
||||||
},
|
},
|
||||||
changePriceList(priceList) {
|
changePriceList(priceList) {
|
||||||
this.$store.commit('setCurrentPriceList', priceList)
|
this.attributePin = {
|
||||||
|
...priceList,
|
||||||
|
action: 'changePriceList',
|
||||||
|
type: 'actionPos'
|
||||||
|
}
|
||||||
|
this.visible = true
|
||||||
},
|
},
|
||||||
arrowTop() {
|
arrowTop() {
|
||||||
if (this.currentTable > 0) {
|
if (this.currentTable > 0) {
|
||||||
|
@ -22,7 +22,6 @@ export default [
|
|||||||
overwriteDefinition: {
|
overwriteDefinition: {
|
||||||
size: 24,
|
size: 24,
|
||||||
sequence: 8,
|
sequence: 8,
|
||||||
isReadOnly: true,
|
|
||||||
handleActionPerformed: true,
|
handleActionPerformed: true,
|
||||||
handleContentSelection: true,
|
handleContentSelection: true,
|
||||||
handleFocusGained: true,
|
handleFocusGained: true,
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
:metadata-field="{
|
:metadata-field="{
|
||||||
...field,
|
...field,
|
||||||
labelCurrency: currencyPointOfSales,
|
labelCurrency: currencyPointOfSales,
|
||||||
isReadOnly: !isModifyPrice
|
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
<field
|
<field
|
||||||
@ -40,45 +39,11 @@
|
|||||||
:key="field.columnName"
|
:key="field.columnName"
|
||||||
:metadata-field="field"
|
:metadata-field="field"
|
||||||
/>
|
/>
|
||||||
<el-popover
|
|
||||||
v-if="columnNameVisible === field.columnName && visible"
|
|
||||||
ref="ping"
|
|
||||||
v-model="visible"
|
|
||||||
placement="right"
|
|
||||||
trigger="click"
|
|
||||||
>
|
|
||||||
<el-form label-position="top" label-width="10px" @submit.native.prevent="notSubmitForm">
|
|
||||||
<el-form-item :label="$t('form.pos.tableProduct.pin')">
|
|
||||||
<el-input
|
|
||||||
v-model="pin"
|
|
||||||
type="password"
|
|
||||||
:placeholder="$t('form.pos.tableProduct.pin')"
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<span style="float: right;">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
icon="el-icon-close"
|
|
||||||
@click="closePing"
|
|
||||||
/>
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
icon="el-icon-check"
|
|
||||||
@click="checkclosePin(pin, field.columnName)"
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
<el-button slojt="reference" type="text" disabled />
|
|
||||||
</el-popover>
|
|
||||||
<field
|
<field
|
||||||
v-if="field.columnName === 'Discount'"
|
v-if="field.columnName === 'Discount'"
|
||||||
:ref="field.columnName"
|
:ref="field.columnName"
|
||||||
:key="field.columnName"
|
:key="field.columnName"
|
||||||
:metadata-field="{
|
:metadata-field="field"
|
||||||
...field,
|
|
||||||
isReadOnly: !isModifyPrice
|
|
||||||
}"
|
|
||||||
/>
|
/>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -132,10 +97,7 @@ export default {
|
|||||||
isLoadedField: false,
|
isLoadedField: false,
|
||||||
panelType: 'custom',
|
panelType: 'custom',
|
||||||
fieldsListLine,
|
fieldsListLine,
|
||||||
fieldsList: [],
|
fieldsList: []
|
||||||
pin: '',
|
|
||||||
visible: false,
|
|
||||||
columnNameVisible: ''
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -24,6 +24,7 @@ import {
|
|||||||
formatQuantity
|
formatQuantity
|
||||||
} from '@/utils/ADempiere/valueFormat.js'
|
} from '@/utils/ADempiere/valueFormat.js'
|
||||||
import orderLineMixin from './Order/orderLineMixin.js'
|
import orderLineMixin from './Order/orderLineMixin.js'
|
||||||
|
import { validatePin } from '@/api/ADempiere/form/point-of-sales.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'POSMixin',
|
name: 'POSMixin',
|
||||||
@ -46,7 +47,11 @@ export default {
|
|||||||
quantityAvailable: 0
|
quantityAvailable: 0
|
||||||
},
|
},
|
||||||
edit: false,
|
edit: false,
|
||||||
displayType: ''
|
displayType: '',
|
||||||
|
pin: '',
|
||||||
|
attributePin: {},
|
||||||
|
validatePin: false,
|
||||||
|
visible: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -140,6 +145,13 @@ export default {
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
return this.currentOrder.lineOrder
|
return this.currentOrder.lineOrder
|
||||||
|
},
|
||||||
|
isPosRequiredPin() {
|
||||||
|
const pos = this.$store.getters.posAttributes.currentPointOfSales
|
||||||
|
if (!this.isEmptyValue(pos.isPosRequiredPin)) {
|
||||||
|
return pos.isPosRequiredPin
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -183,6 +195,66 @@ export default {
|
|||||||
formatDate,
|
formatDate,
|
||||||
formatPrice,
|
formatPrice,
|
||||||
formatQuantity,
|
formatQuantity,
|
||||||
|
openPin(pin) {
|
||||||
|
validatePin({
|
||||||
|
posUuid: this.currentPointOfSales.uuid,
|
||||||
|
pin
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
this.validatePin = true
|
||||||
|
this.pin = ''
|
||||||
|
this.visible = false
|
||||||
|
this.pinAction(this.attributePin)
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error(error.message)
|
||||||
|
this.$message({
|
||||||
|
type: 'error',
|
||||||
|
message: error.message,
|
||||||
|
showClose: true
|
||||||
|
})
|
||||||
|
this.pin = ''
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.visible = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
pinAction(action) {
|
||||||
|
if (action.type === 'updateOrder') {
|
||||||
|
switch (action.columnName) {
|
||||||
|
case 'QtyEntered':
|
||||||
|
case 'PriceEntered':
|
||||||
|
case 'Discount':
|
||||||
|
this.updateOrderLine(action)
|
||||||
|
break
|
||||||
|
case 'C_DocTypeTarget_ID': {
|
||||||
|
const documentTypeUuid = this.$store.getters.getValueOfField({
|
||||||
|
containerUuid: this.$route.meta.uuid,
|
||||||
|
columnName: 'C_DocTypeTarget_ID_UUID'
|
||||||
|
})
|
||||||
|
this.$store.dispatch('updateOrder', {
|
||||||
|
orderUuid: this.$route.query.action,
|
||||||
|
posUuid: this.currentPointOfSales.uuid,
|
||||||
|
documentTypeUuid
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (action.type === 'actionPos') {
|
||||||
|
switch (action.action) {
|
||||||
|
case 'changeWarehouse':
|
||||||
|
this.$store.commit('setCurrentWarehousePos', action)
|
||||||
|
break
|
||||||
|
case 'changePriceList':
|
||||||
|
this.$store.commit('setCurrentPriceList', action)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
closePin() {
|
||||||
|
this.visible = false
|
||||||
|
this.setDocumentType(this.currentOrder.documentType)
|
||||||
|
},
|
||||||
withoutPOSTerminal() {
|
withoutPOSTerminal() {
|
||||||
if (this.isEmptyValue(this.currentPointOfSales)) {
|
if (this.isEmptyValue(this.currentPointOfSales)) {
|
||||||
this.$message({
|
this.$message({
|
||||||
@ -371,6 +443,7 @@ export default {
|
|||||||
this.$store.dispatch('reloadOrder', { orderUuid })
|
this.$store.dispatch('reloadOrder', { orderUuid })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.setDocumentType(this.currentOrder.documentType)
|
||||||
},
|
},
|
||||||
fillOrder(order, setToStore = true) {
|
fillOrder(order, setToStore = true) {
|
||||||
const orderToPush = {
|
const orderToPush = {
|
||||||
@ -408,7 +481,13 @@ export default {
|
|||||||
case 'QtyEntered':
|
case 'QtyEntered':
|
||||||
case 'PriceEntered':
|
case 'PriceEntered':
|
||||||
case 'Discount':
|
case 'Discount':
|
||||||
if (!this.isEmptyValue(this.$store.state['pointOfSales/orderLine/index'].line)) {
|
if (this.isPosRequiredPin && !this.isEmptyValue(this.$store.state['pointOfSales/orderLine/index'].line)) {
|
||||||
|
this.attributePin = {
|
||||||
|
...mutation.payload,
|
||||||
|
type: 'updateOrder'
|
||||||
|
}
|
||||||
|
this.visible = true
|
||||||
|
} else if (!this.isEmptyValue(this.$store.state['pointOfSales/orderLine/index'].line)) {
|
||||||
this.updateOrderLine(mutation.payload)
|
this.updateOrderLine(mutation.payload)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@ -417,7 +496,13 @@ export default {
|
|||||||
containerUuid: mutation.payload.containerUuid,
|
containerUuid: mutation.payload.containerUuid,
|
||||||
columnName: 'C_DocTypeTarget_ID_UUID'
|
columnName: 'C_DocTypeTarget_ID_UUID'
|
||||||
})
|
})
|
||||||
if (!this.isEmptyValue(documentTypeUuid) && !this.isEmptyValue(this.currentOrder.documentType.uuid) && this.currentOrder.documentType.uuid !== documentTypeUuid) {
|
if (this.isPosRequiredPin && !this.isEmptyValue(documentTypeUuid) && !this.isEmptyValue(this.currentOrder.documentType.uuid)) {
|
||||||
|
this.attributePin = {
|
||||||
|
...mutation.payload,
|
||||||
|
type: 'updateOrder'
|
||||||
|
}
|
||||||
|
this.visible = true
|
||||||
|
} else if (!this.isEmptyValue(documentTypeUuid) && !this.isEmptyValue(this.currentOrder.documentType.uuid)) {
|
||||||
this.$store.dispatch('updateOrder', {
|
this.$store.dispatch('updateOrder', {
|
||||||
orderUuid: this.$route.query.action,
|
orderUuid: this.$route.query.action,
|
||||||
posUuid: this.currentPointOfSales.uuid,
|
posUuid: this.currentPointOfSales.uuid,
|
||||||
|
@ -124,9 +124,9 @@ export default {
|
|||||||
/**
|
/**
|
||||||
* Current Warehouse
|
* Current Warehouse
|
||||||
*/
|
*/
|
||||||
currentWarehouse: (state) => {
|
getcurrentWarehousePos: (state) => {
|
||||||
if (!isEmptyValue(state.currentWarehouse)) {
|
if (!isEmptyValue(state.currentWarehousePos)) {
|
||||||
return state.currentWarehouse
|
return state.currentWarehousePos
|
||||||
}
|
}
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ export default {
|
|||||||
dispatch('listCurrenciesFromServer', posToSet.uuid)
|
dispatch('listCurrenciesFromServer', posToSet.uuid)
|
||||||
dispatch('listPricesFromServer', posToSet)
|
dispatch('listPricesFromServer', posToSet)
|
||||||
commit('setCurrentPriceList', posToSet.priceList)
|
commit('setCurrentPriceList', posToSet.priceList)
|
||||||
commit('setCurrentWarehouse', rootGetters['user/getWarehouse'])
|
commit('setCurrentWarehousePos', rootGetters['user/getWarehouse'])
|
||||||
commit('resetConversionRate', [])
|
commit('resetConversionRate', [])
|
||||||
commit('setIsReloadKeyLayout')
|
commit('setIsReloadKeyLayout')
|
||||||
commit('setIsReloadProductPrice')
|
commit('setIsReloadProductPrice')
|
||||||
|
@ -28,8 +28,8 @@ export default {
|
|||||||
setCurrentPriceList(state, currentPriceList) {
|
setCurrentPriceList(state, currentPriceList) {
|
||||||
state.currentPriceList = currentPriceList
|
state.currentPriceList = currentPriceList
|
||||||
},
|
},
|
||||||
setCurrentWarehouse(state, warehouse) {
|
setCurrentWarehousePos(state, warehouse) {
|
||||||
state.currentWarehouse = warehouse
|
state.currentWarehousePos = warehouse
|
||||||
},
|
},
|
||||||
setPricesList(state, pricesList) {
|
setPricesList(state, pricesList) {
|
||||||
state.pricesList = pricesList
|
state.pricesList = pricesList
|
||||||
|
@ -31,7 +31,7 @@ export default {
|
|||||||
warehousesList: {},
|
warehousesList: {},
|
||||||
pricesList: {},
|
pricesList: {},
|
||||||
currentPriceList: {},
|
currentPriceList: {},
|
||||||
currentWarehouse: {},
|
currentWarehousePos: {},
|
||||||
listCurrency: [],
|
listCurrency: [],
|
||||||
conversionsList: [],
|
conversionsList: [],
|
||||||
currentPointOfSales: {},
|
currentPointOfSales: {},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user