mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 12:01:57 +08:00
Feature/rename pos objects (#922)
* Rename POS attributres and mutations to set * Add list warehouse from cache
This commit is contained in:
parent
5211bc3ef5
commit
64d38b59a7
@ -317,7 +317,7 @@ export default {
|
|||||||
return this.$store.state['pointOfSales/point/index'].listCurrency
|
return this.$store.state['pointOfSales/point/index'].listCurrency
|
||||||
},
|
},
|
||||||
convertionList() {
|
convertionList() {
|
||||||
return this.$store.state['pointOfSales/point/index'].conversionList
|
return this.$store.state['pointOfSales/point/index'].conversionsList
|
||||||
},
|
},
|
||||||
validateCompleteCollection() {
|
validateCompleteCollection() {
|
||||||
let collection
|
let collection
|
||||||
|
@ -218,14 +218,14 @@
|
|||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<br>
|
<br>
|
||||||
<el-dropdown
|
<el-dropdown
|
||||||
v-if="!isEmptyValue(curretnWarehouse)"
|
v-if="!isEmptyValue(currentWarehouse)"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
class="info-pos"
|
class="info-pos"
|
||||||
@command="changeWarehouse"
|
@command="changeWarehouse"
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
<svg-icon icon-class="tree" />
|
<svg-icon icon-class="tree" />
|
||||||
{{ $t('route.warehouse') }}: <b style="cursor: pointer"> {{ curretnWarehouse.name }} </b>
|
{{ $t('route.warehouse') }}: <b style="cursor: pointer"> {{ currentWarehouse.name }} </b>
|
||||||
</span>
|
</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
@ -239,14 +239,14 @@
|
|||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<br>
|
<br>
|
||||||
<el-dropdown
|
<el-dropdown
|
||||||
v-if="!isEmptyValue(curretnPriceList)"
|
v-if="!isEmptyValue(currentPriceList)"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
class="info-pos"
|
class="info-pos"
|
||||||
@command="changePriceList"
|
@command="changePriceList"
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
<svg-icon icon-class="tree-table" />
|
<svg-icon icon-class="tree-table" />
|
||||||
{{ $t('form.pos.priceList') }}: <b style="cursor: pointer"> {{ curretnPriceList.name }} </b>
|
{{ $t('form.pos.priceList') }}: <b style="cursor: pointer"> {{ currentPriceList.name }} </b>
|
||||||
</span>
|
</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
@ -523,7 +523,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
listPointOfSales() {
|
listPointOfSales() {
|
||||||
return this.$store.getters.posAttributes.listPointOfSales
|
return this.$store.getters.posAttributes.pointOfSalesList
|
||||||
},
|
},
|
||||||
ordersList() {
|
ordersList() {
|
||||||
if (this.isEmptyValue(this.currentPointOfSales)) {
|
if (this.isEmptyValue(this.currentPointOfSales)) {
|
||||||
@ -562,28 +562,28 @@ export default {
|
|||||||
const line = this.$store.state['pointOfSales/orderLine/index'].line
|
const line = this.$store.state['pointOfSales/orderLine/index'].line
|
||||||
return line
|
return line
|
||||||
},
|
},
|
||||||
curretnPriceList() {
|
currentPriceList() {
|
||||||
if (!this.isEmptyValue(this.$store.getters.currentPriceList)) {
|
if (!this.isEmptyValue(this.$store.getters.currentPriceList)) {
|
||||||
return this.$store.getters.currentPriceList
|
return this.$store.getters.currentPriceList
|
||||||
}
|
}
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
pointPriceList() {
|
pointPriceList() {
|
||||||
const list = this.$store.getters.posAttributes.currentPointOfSales.listPrices
|
const list = this.$store.getters.posAttributes.currentPointOfSales.pricesList
|
||||||
if (this.isEmptyValue(list)) {
|
if (this.isEmptyValue(list)) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
return list
|
return list
|
||||||
},
|
},
|
||||||
curretnWarehouse() {
|
currentWarehouse() {
|
||||||
if (!this.isEmptyValue(this.$store.getters['user/getWarehouse'])) {
|
if (!this.isEmptyValue(this.$store.getters['user/getWarehouse'])) {
|
||||||
return this.$store.getters['user/getWarehouse']
|
return this.$store.getters['user/getWarehouse']
|
||||||
}
|
}
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
listWarehouse() {
|
listWarehouse() {
|
||||||
if (!this.isEmptyValue(this.$store.getters.currentWarehouse)) {
|
if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.warehousesList)) {
|
||||||
return this.$store.getters.currentWarehouse
|
return this.$store.getters.posAttributes.currentPointOfSales.warehousesList
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
@ -667,15 +667,15 @@ export default {
|
|||||||
this.$store.dispatch('listOrderLine', [])
|
this.$store.dispatch('listOrderLine', [])
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
changePos(posElement) {
|
changePos(pointOfSales) {
|
||||||
this.$store.dispatch('setCurrentPOS', posElement)
|
this.$store.dispatch('setCurrentPOS', pointOfSales)
|
||||||
this.newOrder()
|
this.newOrder()
|
||||||
},
|
},
|
||||||
changeWarehouse(warehouse) {
|
changeWarehouse(warehouse) {
|
||||||
this.$store.commit('currentWarehouse', warehouse)
|
this.$store.commit('setCurrentWarehouse', warehouse)
|
||||||
},
|
},
|
||||||
changePriceList(priceList) {
|
changePriceList(priceList) {
|
||||||
this.$store.commit('currentPriceList', priceList)
|
this.$store.commit('setCurrentPriceList', priceList)
|
||||||
},
|
},
|
||||||
arrowTop() {
|
arrowTop() {
|
||||||
if (this.currentTable > 0) {
|
if (this.currentTable > 0) {
|
||||||
|
@ -86,7 +86,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
listPointOfSales() {
|
listPointOfSales() {
|
||||||
return this.$store.getters.posAttributes.listPointOfSales
|
return this.$store.getters.posAttributes.pointOfSalesList
|
||||||
},
|
},
|
||||||
curretnPriceList() {
|
curretnPriceList() {
|
||||||
if (!this.isEmptyValue(this.$store.getters.currentPriceList)) {
|
if (!this.isEmptyValue(this.$store.getters.currentPriceList)) {
|
||||||
@ -95,14 +95,14 @@ export default {
|
|||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
priceListPointOfSales() {
|
priceListPointOfSales() {
|
||||||
const list = this.$store.getters.posAttributes.currentPointOfSales.listPrices
|
const list = this.$store.getters.posAttributes.currentPointOfSales.pricesList
|
||||||
if (this.isEmptyValue(list)) {
|
if (this.isEmptyValue(list)) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
return list
|
return list
|
||||||
},
|
},
|
||||||
warehousesListPointOfSales() {
|
warehousesListPointOfSales() {
|
||||||
const list = this.$store.getters.posAttributes.currentPointOfSales.listWarehouses
|
const list = this.$store.getters.posAttributes.currentPointOfSales.warehousesList
|
||||||
if (this.isEmptyValue(list)) {
|
if (this.isEmptyValue(list)) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ export default {
|
|||||||
return this.$store.getters.getShowCollectionPos
|
return this.$store.getters.getShowCollectionPos
|
||||||
},
|
},
|
||||||
listPointOfSales() {
|
listPointOfSales() {
|
||||||
return this.$store.getters.posAttributes.listPointOfSales
|
return this.$store.getters.posAttributes.pointOfSalesList
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -125,7 +125,7 @@ export default {
|
|||||||
return this.$store.getters.getShowCollectionPos
|
return this.$store.getters.getShowCollectionPos
|
||||||
},
|
},
|
||||||
listPointOfSales() {
|
listPointOfSales() {
|
||||||
return this.$store.getters.posAttributes.listPointOfSales
|
return this.$store.getters.posAttributes.pointOfSalesList
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -50,12 +50,13 @@ export default {
|
|||||||
*/
|
*/
|
||||||
posAttributes: (state) => {
|
posAttributes: (state) => {
|
||||||
return {
|
return {
|
||||||
listPointOfSales: state.listPointOfSales,
|
pointOfSalesList: state.pointOfSalesList,
|
||||||
currentPointOfSales: {
|
currentPointOfSales: {
|
||||||
...state.currentPointOfSales,
|
...state.currentPointOfSales,
|
||||||
listOrder: state.listOrder,
|
listOrder: state.listOrder,
|
||||||
listWarehouses: state.listWarehouses,
|
warehousesList: state.warehousesList,
|
||||||
listPrices: state.listPrices,
|
pricesList: state.pricesList,
|
||||||
|
currentPriceList: state.currentPriceList,
|
||||||
currentOrder: {
|
currentOrder: {
|
||||||
...state.order,
|
...state.order,
|
||||||
lineOrder: state.listOrderLine,
|
lineOrder: state.listOrderLine,
|
||||||
|
@ -119,7 +119,7 @@ export default {
|
|||||||
conversionDate: params.conversionDate
|
conversionDate: params.conversionDate
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
commit('conversionList', response)
|
commit('addConversionToList', response)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn(`conversionDivideRate: ${error.message}. Code: ${error.code}.`)
|
console.warn(`conversionDivideRate: ${error.message}. Code: ${error.code}.`)
|
||||||
|
@ -34,22 +34,22 @@ export default {
|
|||||||
*/
|
*/
|
||||||
listPointOfSalesFromServer({ commit, getters, dispatch }, posToSet = null) {
|
listPointOfSalesFromServer({ commit, getters, dispatch }, posToSet = null) {
|
||||||
const userUuid = getters['user/getUserUuid']
|
const userUuid = getters['user/getUserUuid']
|
||||||
let pos, listPos
|
let pos, pontOfSalesList
|
||||||
listPointOfSales({
|
listPointOfSales({
|
||||||
userUuid
|
userUuid
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
listPos = response.sellingPointsList
|
pontOfSalesList = response.sellingPointsList
|
||||||
if (!isEmptyValue(posToSet)) {
|
if (!isEmptyValue(posToSet)) {
|
||||||
pos = listPos.find(itemPOS => itemPOS.id === parseInt(posToSet))
|
pos = pontOfSalesList.find(itemPOS => itemPOS.id === parseInt(posToSet))
|
||||||
}
|
}
|
||||||
if (isEmptyValue(pos) && isEmptyValue(posToSet)) {
|
if (isEmptyValue(pos) && isEmptyValue(posToSet)) {
|
||||||
pos = listPos.find(itemPOS => itemPOS.salesRepresentative.uuid === userUuid)
|
pos = pontOfSalesList.find(itemPOS => itemPOS.salesRepresentative.uuid === userUuid)
|
||||||
}
|
}
|
||||||
if (isEmptyValue(pos)) {
|
if (isEmptyValue(pos)) {
|
||||||
pos = listPos[0]
|
pos = pontOfSalesList[0]
|
||||||
}
|
}
|
||||||
commit('listPointOfSales', listPos)
|
commit('setPointOfSalesList', pontOfSalesList)
|
||||||
dispatch('setCurrentPOS', pos)
|
dispatch('setCurrentPOS', pos)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@ -66,7 +66,7 @@ export default {
|
|||||||
posUuid
|
posUuid
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
commit('listWarehouses', response.records)
|
commit('setWarehousesList', response.records)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn(`listWarehouseFromServer: ${error.message}. Code: ${error.code}.`)
|
console.warn(`listWarehouseFromServer: ${error.message}. Code: ${error.code}.`)
|
||||||
@ -82,7 +82,7 @@ export default {
|
|||||||
posUuid: point.uuid
|
posUuid: point.uuid
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
commit('listPrices', response.records)
|
commit('setPricesList', response.records)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn(`listPricesFromServer: ${error.message}. Code: ${error.code}.`)
|
console.warn(`listPricesFromServer: ${error.message}. Code: ${error.code}.`)
|
||||||
@ -98,7 +98,7 @@ export default {
|
|||||||
posUuid
|
posUuid
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
commit('listCurrencies', response.records)
|
commit('setCurrenciesList', response.records)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn(`listPricesFromServer: ${error.message}. Code: ${error.code}.`)
|
console.warn(`listPricesFromServer: ${error.message}. Code: ${error.code}.`)
|
||||||
@ -110,7 +110,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
setCurrentPOS({ commit, dispatch, rootGetters }, posToSet) {
|
setCurrentPOS({ commit, dispatch, rootGetters }, posToSet) {
|
||||||
commit('currentPointOfSales', posToSet)
|
commit('setCurrentPointOfSales', posToSet)
|
||||||
const oldRoute = router.app._route
|
const oldRoute = router.app._route
|
||||||
router.push({
|
router.push({
|
||||||
name: oldRoute.name,
|
name: oldRoute.name,
|
||||||
@ -125,8 +125,8 @@ export default {
|
|||||||
dispatch('listWarehouseFromServer', posToSet.uuid)
|
dispatch('listWarehouseFromServer', posToSet.uuid)
|
||||||
dispatch('listCurrenciesFromServer', posToSet.uuid)
|
dispatch('listCurrenciesFromServer', posToSet.uuid)
|
||||||
dispatch('listPricesFromServer', posToSet)
|
dispatch('listPricesFromServer', posToSet)
|
||||||
commit('currentPriceList', posToSet.priceList)
|
commit('setCurrentPriceList', posToSet.priceList)
|
||||||
commit('currentWarehouse', rootGetters['user/getWarehouse'])
|
commit('setCurrentWarehouse', rootGetters['user/getWarehouse'])
|
||||||
commit('resetConversionRate', [])
|
commit('resetConversionRate', [])
|
||||||
commit('setIsReloadKeyLayout')
|
commit('setIsReloadKeyLayout')
|
||||||
commit('setIsReloadProductPrice')
|
commit('setIsReloadProductPrice')
|
||||||
|
@ -16,31 +16,31 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Pos Mutations
|
* Pos Mutations
|
||||||
* @author Elsio Sanchez <elsiosanches@gmail.com>
|
* All related to global store of Point of Sales
|
||||||
*/
|
*/
|
||||||
export default {
|
export default {
|
||||||
listPointOfSales(state, listPointOfSales) {
|
setPointOfSalesList(state, pointOfSalesList) {
|
||||||
state.listPointOfSales = listPointOfSales
|
state.pointOfSalesList = pointOfSalesList
|
||||||
},
|
},
|
||||||
listWarehouses(state, listWarehouses) {
|
setWarehousesList(state, warehousesList) {
|
||||||
state.listWarehouses = listWarehouses
|
state.warehousesList = warehousesList
|
||||||
},
|
},
|
||||||
currentPriceList(state, priceList) {
|
setCurrentPriceList(state, currentPriceList) {
|
||||||
state.currentPriceList = priceList
|
state.currentPriceList = currentPriceList
|
||||||
},
|
},
|
||||||
currentWarehouse(state, warehouse) {
|
setCurrentWarehouse(state, warehouse) {
|
||||||
state.currentWarehouse = warehouse
|
state.currentWarehouse = warehouse
|
||||||
},
|
},
|
||||||
listPrices(state, listPrices) {
|
setPricesList(state, pricesList) {
|
||||||
state.listPrices = listPrices
|
state.pricesList = pricesList
|
||||||
},
|
},
|
||||||
listCurrencies(state, listCurrency) {
|
setCurrenciesList(state, currenciesList) {
|
||||||
state.listCurrency = listCurrency
|
state.currenciesList = currenciesList
|
||||||
},
|
},
|
||||||
conversionList(state, conversion) {
|
addConversionToList(state, conversion) {
|
||||||
state.conversionList.push(conversion)
|
state.conversionsList.push(conversion)
|
||||||
},
|
},
|
||||||
currentPointOfSales(state, currentPointOfSales) {
|
setCurrentPointOfSales(state, currentPointOfSales) {
|
||||||
state.currentPointOfSales = currentPointOfSales
|
state.currentPointOfSales = currentPointOfSales
|
||||||
},
|
},
|
||||||
setShowPOSOptions(state, isShowedOptions) {
|
setShowPOSOptions(state, isShowedOptions) {
|
||||||
|
@ -27,13 +27,13 @@ export default {
|
|||||||
pointOfSales: {
|
pointOfSales: {
|
||||||
...withoutResponse
|
...withoutResponse
|
||||||
},
|
},
|
||||||
listPointOfSales: {},
|
pointOfSalesList: {},
|
||||||
listWarehouses: {},
|
warehousesList: {},
|
||||||
listPrices: {},
|
pricesList: {},
|
||||||
currentPriceList: {},
|
currentPriceList: {},
|
||||||
currentWarehouse: {},
|
currentWarehouse: {},
|
||||||
listCurrency: [],
|
listCurrency: [],
|
||||||
conversionList: [],
|
conversionsList: [],
|
||||||
currentPointOfSales: {},
|
currentPointOfSales: {},
|
||||||
showPOSOptions: false,
|
showPOSOptions: false,
|
||||||
showPOSKeyLayout: false,
|
showPOSKeyLayout: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user