|
|
@@ -50,7 +50,7 @@ import OrderInfoAuction from '../../components/order/OrderInfoAuction.vue';
|
|
|
import list from '../../mixins/list';
|
|
|
export default {
|
|
|
name: 'discover',
|
|
|
- inject: ['bar'],
|
|
|
+ inject: ['bar', 'setKeeps', 'scrollWrapper', 'changeScroll'],
|
|
|
mixins: [list],
|
|
|
components: {
|
|
|
OrderInfoAuction
|
|
|
@@ -90,7 +90,8 @@ export default {
|
|
|
status: 'AIR_DROP,',
|
|
|
name: '已完成'
|
|
|
}
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ scrollTop: 0
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
@@ -103,7 +104,7 @@ export default {
|
|
|
if (this.paymentType === 'FIXED_PRICE') {
|
|
|
return '/auctionOrder/all';
|
|
|
} else {
|
|
|
- return '/auctionRecord/recordInfos';
|
|
|
+ return '/auctionRecord/userRecord';
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -121,18 +122,55 @@ export default {
|
|
|
};
|
|
|
} else {
|
|
|
return {
|
|
|
- query: {
|
|
|
- userId: this.$store.state.userInfo.id,
|
|
|
- type: this.paymentType,
|
|
|
- // // status: this.status,
|
|
|
- auctionType: this.type
|
|
|
- // hide: false,
|
|
|
- // del: false
|
|
|
- },
|
|
|
- sort: 'id,desc'
|
|
|
+ type: this.type
|
|
|
};
|
|
|
}
|
|
|
},
|
|
|
+ getData(isFirst = false, scrollTop = 0) {
|
|
|
+ if (isFirst) {
|
|
|
+ this.page = 0;
|
|
|
+ this.list = [];
|
|
|
+ this.$root.$el.scrollTop = scrollTop;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.loading = true;
|
|
|
+ this.finished = false;
|
|
|
+ this.empty = false;
|
|
|
+ let data = { page: this.page, size: this.size, sort: 'createdAt,desc' };
|
|
|
+ if (this.beforeData) {
|
|
|
+ data = {
|
|
|
+ ...data,
|
|
|
+ ...this.beforeData()
|
|
|
+ };
|
|
|
+ }
|
|
|
+ let url = this.url;
|
|
|
+
|
|
|
+ if (this.paymentType !== 'FIXED_PRICE') {
|
|
|
+ data = {};
|
|
|
+ url += '?type=' + this.type;
|
|
|
+ }
|
|
|
+
|
|
|
+ return this.$http.post(url, data, { body: 'json' }).then(res => {
|
|
|
+ if (this.paymentType !== 'FIXED_PRICE') {
|
|
|
+ this.list = res;
|
|
|
+ this.empty = res.length === 0;
|
|
|
+ this.finished = true;
|
|
|
+ this.loading = false;
|
|
|
+ } else {
|
|
|
+ if (res.first) {
|
|
|
+ this.list = [];
|
|
|
+ }
|
|
|
+ this.list = [...this.list, ...res.content];
|
|
|
+ this.empty = res.empty;
|
|
|
+ this.loading = false;
|
|
|
+ this.finished = res.last;
|
|
|
+ if (!this.finished) {
|
|
|
+ this.page = this.page + 1;
|
|
|
+ }
|
|
|
+ this.totalElements = Number(res.totalElements);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
delFn() {
|
|
|
console.log('删除成功');
|
|
|
this.getData(true);
|
|
|
@@ -164,6 +202,21 @@ export default {
|
|
|
this.isLoading = false;
|
|
|
});
|
|
|
}
|
|
|
+ },
|
|
|
+ activated() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.changeScroll(this.scrollTop);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ beforeRouteLeave(to, from, next) {
|
|
|
+ if (!to.meta.menuPage) {
|
|
|
+ this.scrollTop = this.scrollWrapper.value.scrollTop;
|
|
|
+ this.setKeeps(['index', 'discover']);
|
|
|
+ } else {
|
|
|
+ this.scrollTop = 0;
|
|
|
+ this.setKeeps(['index', 'discover'], false);
|
|
|
+ }
|
|
|
+ next();
|
|
|
}
|
|
|
};
|
|
|
</script>
|