diff --git a/src/views/AppStoresTable.vue b/src/views/AppStoresTable.vue index 92cca7a..b5e0d3b 100644 --- a/src/views/AppStoresTable.vue +++ b/src/views/AppStoresTable.vue @@ -65,8 +65,12 @@ export default { }, watch: { search: { - immediate: true, deep: true, handler(v) { - this.getData().then(() => { + immediate: true, deep: true, handler(v, old) { + if (old) { + delete v.t + old?.t && delete old.t + } + (old && JSON.stringify(v) == JSON.stringify(old) ? this.refreshData() : this.getData()).then(() => { if (v.interval > 0 && v.changeWay == '1') { this.$refs.carousel?.$forceUpdate() } @@ -164,6 +168,14 @@ export default { } else if (e.code == "ArrowRight") { this.$refs.carousel.next() } + }, + async refreshData() { + return Promise.all([this.getStoreKeyGoods(), this.getCategorySales()]).then(() => { + this.stores.map(store => { + store.keyGoods = this.storeKeyGoods.filter(e => e.storeCode == store.storeCode) || [] + store.categorySale = this.categorySales.filter(e => e.storeCode == store.storeCode) || [] + }) + }) } }, mounted() {