mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-07 18:25:45 +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 :span="5" :style="styleTab">
|
||||
<el-form-item>
|
||||
<el-popover
|
||||
v-model="visible"
|
||||
placement="right"
|
||||
>
|
||||
<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>
|
||||
<field
|
||||
:key="fieldsList[2].columnName"
|
||||
:metadata-field="fieldsList[2]"
|
||||
:v-model="fieldsList[2].value"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<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>
|
||||
</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">
|
||||
<div class="keypad">
|
||||
<span id="toolPoint">
|
||||
@ -412,6 +403,7 @@
|
||||
<script>
|
||||
import formMixin from '@/components/ADempiere/Form/formMixin.js'
|
||||
import orderLineMixin from './orderLineMixin.js'
|
||||
import posMixin from '@/components/ADempiere/Form/VPOS/posMixin.js'
|
||||
import fieldsListOrder from './fieldsListOrder.js'
|
||||
import BusinessPartner from '@/components/ADempiere/Form/VPOS/BusinessPartner'
|
||||
import fieldLine from '@/components/ADempiere/Form/VPOS/Order/line/index'
|
||||
@ -435,7 +427,8 @@ export default {
|
||||
},
|
||||
mixins: [
|
||||
formMixin,
|
||||
orderLineMixin
|
||||
orderLineMixin,
|
||||
posMixin
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
@ -625,8 +618,8 @@ export default {
|
||||
return list
|
||||
},
|
||||
currentWarehouse() {
|
||||
if (!this.isEmptyValue(this.$store.getters['user/getWarehouse'])) {
|
||||
return this.$store.getters['user/getWarehouse']
|
||||
if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.warehouse)) {
|
||||
return this.$store.getters.getcurrentWarehousePos
|
||||
}
|
||||
return {}
|
||||
},
|
||||
@ -645,6 +638,13 @@ export default {
|
||||
},
|
||||
currentOrder(value) {
|
||||
this.validatePin = true
|
||||
},
|
||||
visible(value) {
|
||||
if (value && !this.isEmptyValue(this.$refs)) {
|
||||
setTimeout(() => {
|
||||
this.focusPin()
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -656,6 +656,10 @@ export default {
|
||||
formatDate,
|
||||
formatPrice,
|
||||
formatQuantity,
|
||||
focusPin() {
|
||||
console.log(this.$refs)
|
||||
this.$refs.pin.focus()
|
||||
},
|
||||
openPin(pin) {
|
||||
validatePin({
|
||||
posUuid: this.currentPointOfSales.uuid,
|
||||
@ -757,10 +761,20 @@ export default {
|
||||
this.newOrder()
|
||||
},
|
||||
changeWarehouse(warehouse) {
|
||||
this.$store.commit('setCurrentWarehouse', warehouse)
|
||||
this.attributePin = {
|
||||
...warehouse,
|
||||
action: 'changeWarehouse',
|
||||
type: 'actionPos'
|
||||
}
|
||||
this.visible = true
|
||||
},
|
||||
changePriceList(priceList) {
|
||||
this.$store.commit('setCurrentPriceList', priceList)
|
||||
this.attributePin = {
|
||||
...priceList,
|
||||
action: 'changePriceList',
|
||||
type: 'actionPos'
|
||||
}
|
||||
this.visible = true
|
||||
},
|
||||
arrowTop() {
|
||||
if (this.currentTable > 0) {
|
||||
|
@ -22,7 +22,6 @@ export default [
|
||||
overwriteDefinition: {
|
||||
size: 24,
|
||||
sequence: 8,
|
||||
isReadOnly: true,
|
||||
handleActionPerformed: true,
|
||||
handleContentSelection: true,
|
||||
handleFocusGained: true,
|
||||
|
@ -32,7 +32,6 @@
|
||||
:metadata-field="{
|
||||
...field,
|
||||
labelCurrency: currencyPointOfSales,
|
||||
isReadOnly: !isModifyPrice
|
||||
}"
|
||||
/>
|
||||
<field
|
||||
@ -40,45 +39,11 @@
|
||||
:key="field.columnName"
|
||||
: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
|
||||
v-if="field.columnName === 'Discount'"
|
||||
:ref="field.columnName"
|
||||
:key="field.columnName"
|
||||
:metadata-field="{
|
||||
...field,
|
||||
isReadOnly: !isModifyPrice
|
||||
}"
|
||||
:metadata-field="field"
|
||||
/>
|
||||
</el-form>
|
||||
</el-col>
|
||||
@ -132,10 +97,7 @@ export default {
|
||||
isLoadedField: false,
|
||||
panelType: 'custom',
|
||||
fieldsListLine,
|
||||
fieldsList: [],
|
||||
pin: '',
|
||||
visible: false,
|
||||
columnNameVisible: ''
|
||||
fieldsList: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -24,6 +24,7 @@ import {
|
||||
formatQuantity
|
||||
} from '@/utils/ADempiere/valueFormat.js'
|
||||
import orderLineMixin from './Order/orderLineMixin.js'
|
||||
import { validatePin } from '@/api/ADempiere/form/point-of-sales.js'
|
||||
|
||||
export default {
|
||||
name: 'POSMixin',
|
||||
@ -46,7 +47,11 @@ export default {
|
||||
quantityAvailable: 0
|
||||
},
|
||||
edit: false,
|
||||
displayType: ''
|
||||
displayType: '',
|
||||
pin: '',
|
||||
attributePin: {},
|
||||
validatePin: false,
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -140,6 +145,13 @@ export default {
|
||||
return []
|
||||
}
|
||||
return this.currentOrder.lineOrder
|
||||
},
|
||||
isPosRequiredPin() {
|
||||
const pos = this.$store.getters.posAttributes.currentPointOfSales
|
||||
if (!this.isEmptyValue(pos.isPosRequiredPin)) {
|
||||
return pos.isPosRequiredPin
|
||||
}
|
||||
return false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -183,6 +195,66 @@ export default {
|
||||
formatDate,
|
||||
formatPrice,
|
||||
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() {
|
||||
if (this.isEmptyValue(this.currentPointOfSales)) {
|
||||
this.$message({
|
||||
@ -371,6 +443,7 @@ export default {
|
||||
this.$store.dispatch('reloadOrder', { orderUuid })
|
||||
}
|
||||
}
|
||||
this.setDocumentType(this.currentOrder.documentType)
|
||||
},
|
||||
fillOrder(order, setToStore = true) {
|
||||
const orderToPush = {
|
||||
@ -408,7 +481,13 @@ export default {
|
||||
case 'QtyEntered':
|
||||
case 'PriceEntered':
|
||||
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)
|
||||
}
|
||||
break
|
||||
@ -417,7 +496,13 @@ export default {
|
||||
containerUuid: mutation.payload.containerUuid,
|
||||
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', {
|
||||
orderUuid: this.$route.query.action,
|
||||
posUuid: this.currentPointOfSales.uuid,
|
||||
|
@ -124,9 +124,9 @@ export default {
|
||||
/**
|
||||
* Current Warehouse
|
||||
*/
|
||||
currentWarehouse: (state) => {
|
||||
if (!isEmptyValue(state.currentWarehouse)) {
|
||||
return state.currentWarehouse
|
||||
getcurrentWarehousePos: (state) => {
|
||||
if (!isEmptyValue(state.currentWarehousePos)) {
|
||||
return state.currentWarehousePos
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ export default {
|
||||
dispatch('listCurrenciesFromServer', posToSet.uuid)
|
||||
dispatch('listPricesFromServer', posToSet)
|
||||
commit('setCurrentPriceList', posToSet.priceList)
|
||||
commit('setCurrentWarehouse', rootGetters['user/getWarehouse'])
|
||||
commit('setCurrentWarehousePos', rootGetters['user/getWarehouse'])
|
||||
commit('resetConversionRate', [])
|
||||
commit('setIsReloadKeyLayout')
|
||||
commit('setIsReloadProductPrice')
|
||||
|
@ -28,8 +28,8 @@ export default {
|
||||
setCurrentPriceList(state, currentPriceList) {
|
||||
state.currentPriceList = currentPriceList
|
||||
},
|
||||
setCurrentWarehouse(state, warehouse) {
|
||||
state.currentWarehouse = warehouse
|
||||
setCurrentWarehousePos(state, warehouse) {
|
||||
state.currentWarehousePos = warehouse
|
||||
},
|
||||
setPricesList(state, pricesList) {
|
||||
state.pricesList = pricesList
|
||||
|
@ -31,7 +31,7 @@ export default {
|
||||
warehousesList: {},
|
||||
pricesList: {},
|
||||
currentPriceList: {},
|
||||
currentWarehouse: {},
|
||||
currentWarehousePos: {},
|
||||
listCurrency: [],
|
||||
conversionsList: [],
|
||||
currentPointOfSales: {},
|
||||
|
Loading…
x
Reference in New Issue
Block a user