商家端列表页缓存

This commit is contained in:
mabo
2021-07-31 15:49:54 +08:00
parent ad17d8b743
commit 8cec0e6ab8
30 changed files with 279 additions and 493 deletions

View File

@@ -39,9 +39,12 @@
</div>
<div class="single-page-con">
<div class="single-page">
<keep-alive :include="cachePage">
<router-view></router-view>
<!-- <keep-alive :include="cachePage"> -->
<!-- </keep-alive> -->
<keep-alive>
<router-view v-if="$route.meta.keepAlive"></router-view>
</keep-alive>
<router-view v-if="!$route.meta.keepAlive"></router-view>
</div>
</div>
<!-- 全局加载动画 -->
@@ -65,7 +68,7 @@ export default {
data() {
return {
sliceNum: 5, // 展示nav数量
userInfo: "", // 用户信息
userInfo: {}, // 用户信息
navType: 1, // nav类型
};
},

View File

@@ -35,7 +35,7 @@
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10,20,50]" size="small" show-total show-elevator show-sizer></Page>
</Row>
</Card>

View File

@@ -12,7 +12,7 @@
</Form>
<Table class="mt_10" :loading="loading" border :columns="columns" :data="data" ref="table"></Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10,20,50]" size="small"
show-total show-elevator show-sizer></Page>
</Row>

View File

@@ -60,7 +60,7 @@
class="mt_10"
sortable="custom"
></Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page
:current="searchForm.pageNumber"
:total="total"
@@ -106,7 +106,7 @@ export default {
{
title: "商品原图",
key: "original",
width: 150,
width: 120,
align: "center",
render: (h, params) => {
return h("img", {

View File

@@ -64,7 +64,7 @@
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small"
show-total show-elevator show-sizer></Page>
</Row>
@@ -664,7 +664,7 @@ export default {
mounted() {
this.init();
},
activated() {
mounted() {
this.init();
},
};

View File

@@ -50,7 +50,6 @@ export default {
// 监听路由变化
$route: {
handler: function (val, oldVal) {
console.log(val);
if (val.meta.firstRouterName && val.meta.firstRouterName !== this.currNav) {
this.selectNav(val.meta.firstRouterName)
}

View File

@@ -49,7 +49,7 @@
ref="table"
class="mt_10"
></Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page
:current="searchForm.pageNumber"
:total="total"
@@ -369,7 +369,7 @@ export default {
});
},
},
activated() {
mounted() {
this.init();
},
};

View File

@@ -54,7 +54,7 @@
</Poptip>
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page
:current="searchForm.pageNumber"
:total="total"
@@ -243,9 +243,14 @@
});
},
},
activated() {
mounted() {
this.init();
},
// 页面缓存处理从该页面离开时修改KeepAlive为false保证进入该页面是刷新
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false
next()
}
};
</script>
<style lang="scss">

View File

@@ -371,13 +371,20 @@ export default {
});
},
},
activated () {
mounted () {
this.id = this.$route.query.id;
this.getDetail();
this.accessToken = {
accessToken: this.getStore("accessToken"),
};
},
// 如果是从详情页返回列表页修改列表页keepAlive为true确保不刷新页面
beforeRouteLeave(to, from, next){
if(to.name === 'orderComplaint') {
to.meta.keepAlive = true
}
next()
}
};
</script>
<style lang="scss" scoped>

View File

@@ -77,7 +77,7 @@
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page
:current="searchForm.pageNumber"
:total="total"
@@ -279,9 +279,14 @@
},
},
activated () {
mounted () {
this.init();
},
// 页面缓存处理从该页面离开时修改KeepAlive为false保证进入该页面是刷新
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false
next()
}
};
</script>
<style lang="scss">

View File

@@ -79,7 +79,7 @@
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page
:current="searchForm.pageNumber"
:total="total"
@@ -260,7 +260,6 @@
this.loading = false;
if (res.success) {
this.data = res.result.records;
console.log(this.data)
this.total = res.result.total;
}
});
@@ -277,9 +276,14 @@
},
},
activated() {
mounted() {
this.init();
},
// 页面缓存处理从该页面离开时修改KeepAlive为false保证进入该页面是刷新
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false
next()
}
};
</script>
<style lang="scss">

View File

@@ -522,6 +522,13 @@ export default {
this.sn = this.$route.query.sn;
this.getDetail();
},
// 如果是从详情页返回列表页修改列表页keepAlive为true确保不刷新页面
beforeRouteLeave(to, from, next){
if(to.name === 'returnGoodsOrder' || to.name === 'returnMoneyOrder') {
to.meta.keepAlive = true
}
next()
}
};
</script>
<style lang="scss" scoped>

View File

@@ -817,6 +817,13 @@ export default {
this.sn = this.$route.query.sn;
this.getDataDetail();
},
// 如果是从详情页返回列表页修改列表页keepAlive为true确保不刷新页面
beforeRouteLeave(to, from, next){
if(to.name === 'orderList' || to.name === 'virtualOrderList') {
to.meta.keepAlive = true
}
next()
}
};
</script>
<style lang="scss" scoped>

View File

@@ -43,7 +43,7 @@
</download-excel>
</div>
<Table class="mt_10" :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom"></Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small"
show-total show-elevator show-sizer></Page>
</Row>
@@ -298,9 +298,14 @@ export default {
});
},
},
activated() {
mounted() {
this.init();
},
// 页面缓存处理从该页面离开时修改KeepAlive为false保证进入该页面是刷新
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false
next()
}
};
</script>
<style lang="scss">

View File

@@ -41,7 +41,7 @@
</div>
<Table class="mt_10" :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom" @on-sort-change="changeSort" @on-selection-change="changeSelect"></Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small"
show-total show-elevator show-sizer></Page>
</Row>
@@ -261,9 +261,14 @@ export default {
});
},
},
activated() {
mounted() {
this.init();
},
// 页面缓存处理从该页面离开时修改KeepAlive为false保证进入该页面是刷新
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false
next()
}
};
</script>
<style lang="scss">

View File

@@ -28,7 +28,7 @@
<a @click="$router.push({name: 'order-detail',query: {sn: scope.row.orderSn}})">{{scope.row.orderSn}}</a>
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small"
show-total show-elevator show-sizer></Page>
</Row>
@@ -264,7 +264,7 @@ export default {
});
},
},
activated() {
mounted() {
this.init();
},
};

View File

@@ -29,10 +29,9 @@
<template slot-scope="{ row }" slot="action">
<Button v-if="row.promotionStatus === 'NEW' || row.promotionStatus === 'CLOSE'" type="info" size="small" :style="{'marginRight': row.promotionStatus !== 'CLOSE'?'5px':'0'}" @click="edit(row)">编辑</Button>
<Button v-if="row.promotionStatus !== 'CLOSE'" type="error" size="small" @click="remove(row)">下架</Button>
<!-- <Button v-if="row.promotionStatus === 'CLOSE' || row.promotionStatus === 'NEW'" type="success" size="small" @click="open(row)">上架</Button> -->
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
size="small" show-total show-elevator show-sizer></Page>
</Row>
@@ -337,7 +336,7 @@ export default {
});
},
},
activated() {
mounted() {
this.init();
},
};

View File

@@ -296,8 +296,13 @@ export default {
});
},
},
activated () {
mounted () {
this.init();
},
// 页面缓存处理从该页面离开时修改KeepAlive为false保证进入该页面是刷新
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false
next()
}
};
</script>

View File

@@ -25,7 +25,7 @@
</Tabs>
<Table :columns="liveColumns" :data="liveData"></Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePageNumber" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
size="small" show-total show-elevator show-sizer></Page>
</Row>

View File

@@ -98,7 +98,7 @@
</div>
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page
:current="searchForm.pageNumber + 1"
:total="total"
@@ -329,9 +329,14 @@ export default {
});
},
},
activated() {
mounted() {
this.init();
},
// 页面缓存处理从该页面离开时修改KeepAlive为false保证进入该页面是刷新
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false
next()
}
};
</script>
<style lang="scss">

View File

@@ -285,6 +285,13 @@ export default {
mounted () {
this.init();
},
// 如果是从详情页返回列表页修改列表页keepAlive为true确保不刷新页面
beforeRouteLeave(to, from, next){
if(to.name === 'pintuan') {
to.meta.keepAlive = true
}
next()
}
};
</script>
<style lang="scss" scoped>

View File

@@ -56,7 +56,7 @@
>
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber + 1" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
size="small" show-total show-elevator show-sizer></Page>
</Row>
@@ -206,8 +206,13 @@ export default {
return hourArr;
},
},
activated() {
mounted() {
this.init();
},
// 页面缓存处理从该页面离开时修改KeepAlive为false保证进入该页面是刷新
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false
next()
}
};
</script>
@@ -223,11 +228,5 @@ export default {
.select-clear {
margin-left: 10px;
}
.page {
margin-top: 2vh;
}
.drop-down {
margin-left: 5px;
}
}
</style>

View File

@@ -395,6 +395,13 @@ export default {
mounted() {
this.init();
},
// 如果是从详情页返回列表页修改列表页keepAlive为true确保不刷新页面
beforeRouteLeave(to, from, next){
if(to.name === 'seckill') {
to.meta.keepAlive = true
}
next()
}
};
</script>
<style lang="scss" scoped>

View File

@@ -42,7 +42,7 @@
:data="data"
ref="table"
></Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page
:current="searchForm.pageNumber"
:total="total"
@@ -213,9 +213,14 @@
},
},
activated() {
mounted() {
this.init();
},
// 页面缓存处理从该页面离开时修改KeepAlive为false保证进入该页面是刷新
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false
next()
}
};
</script>
<style lang="scss" scoped>

View File

@@ -40,7 +40,7 @@
:data="orderData"
ref="table"
></Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page
:current="orderParam.pageNumber"
:total="orderTotal"
@@ -61,7 +61,7 @@
:data="refundData"
ref="table"
></Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page
:current="refundParam.pageNumber"
:total="refundTotal"
@@ -82,7 +82,7 @@
:data="distributionData"
ref="table"
></Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page
:current="distributionParam.pageNumber"
:total="distributionTotal"
@@ -604,6 +604,13 @@ export default {
mounted() {
this.init();
},
// 如果是从详情页返回列表页修改列表页keepAlive为true确保不刷新页面
beforeRouteLeave(to, from, next){
if(to.name === 'accountStatementBill' || to.name === 'storeBill') {
to.meta.keepAlive = true
}
next()
}
};
</script>

View File

@@ -48,7 +48,7 @@
ref="table"
class="mt_10"
></Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page
:current="searchForm.pageNumber"
:total="total"
@@ -179,6 +179,7 @@
},
// 分页 改变页数
changePageSize(v) {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = v;
this.getDataList();
},
@@ -218,9 +219,14 @@
},
},
activated () {
mounted () {
this.init();
},
// 页面缓存处理从该页面离开时修改KeepAlive为false保证进入该页面是刷新
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false
next()
}
};
</script>
<style lang="scss" scoped>

View File

@@ -152,7 +152,7 @@
<div>
<Table stripe :columns="columns" :data="data"></Table>
</div>
<Page @on-change="(index)=>{refundParams.pageNumber = index}" @on-page-size-change="(size)=>{refundParams.pageSize= size}" class="page" show-total show-elevator :total="total" />
<Page @on-change="(index)=>{refundParams.pageNumber = index}" @on-page-size-change="(size)=>{refundParams.pageSize= size}" class="mt_10" show-total show-elevator :total="total" />
</div>
</Card>