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

Correct Point Of Sale Alerts (#718)

* correct point of sale alerts

* minimal changes
This commit is contained in:
Elsio Sanchez 2021-04-07 15:07:16 -04:00 committed by GitHub
parent af96cc5d53
commit af8e927b5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 59 additions and 15 deletions

View File

@ -241,14 +241,21 @@ export default {
},
indexTable(value) {
this.setCurrent(this.listWithPrice[value])
},
currentPoint(value) {
if (!this.isEmptyValue(value)) {
this.loadProductsPricesList()
}
}
},
created() {
this.unsubscribe = this.subscribeChanges()
if (this.isReadyFromGetData) {
this.loadProductsPricesList()
}
this.$store.commit('setListProductPrice', {
isLoaded: false
})
this.timeOut = setTimeout(() => {
this.validatePos(this.currentPoint)
}, 3000)
},
beforeDestroy() {
this.unsubscribe()
@ -374,6 +381,25 @@ export default {
}, 1000)
}
})
},
/**
* @param {object} PointOfSales
*/
validatePos(PointOfSales) {
console.log(this.isEmptyValue(PointOfSales), this.isReadyFromGetData)
if (this.isEmptyValue(PointOfSales)) {
const message = this.$t('notifications.errorPointOfSale')
this.$store.commit('setListProductPrice', {
isLoaded: true,
productPricesList: []
})
this.$message({
type: 'info',
message,
duration: 1500,
showClose: true
})
}
}
}
}

View File

@ -132,21 +132,21 @@ export default {
if (isToLoad) {
this.loadProductsPricesList()
}
},
currentPoint(value) {
if (!this.isEmptyValue(value)) {
this.loadProductsPricesList()
}
}
},
created() {
this.unsubscribe = this.subscribeChanges()
if (this.isReadyFromGetData) {
this.loadProductsPricesList()
}
if (this.isEmptyValue(this.listWithPrice)) {
this.$store.dispatch('listProductPriceFromServer', {
containerUuid: 'Products-Price-List',
pageNumber: 1,
searchValue: ''
})
}
this.$store.commit('setListProductPrice', {
isLoaded: false
})
this.timeOut = setTimeout(() => {
this.validatePos(this.currentPoint)
}, 3000)
},
beforeDestroy() {
this.unsubscribe()
@ -209,6 +209,24 @@ export default {
}, 1000)
}
})
},
/**
* @param {object} PointOfSales
*/
validatePos(PointOfSales) {
if (this.isEmptyValue(PointOfSales)) {
const message = this.$t('notifications.errorPointOfSale')
this.$store.commit('setListProductPrice', {
isLoaded: true,
productPricesList: []
})
this.$message({
type: 'info',
message,
duration: 1500,
showClose: true
})
}
}
}
}