更改分享链接首页返回

This commit is contained in:
2022-03-16 19:10:41 +08:00
parent dd4c5f4dfd
commit ef0d060731
9 changed files with 153 additions and 48 deletions
+49 -21
View File
@@ -14,13 +14,13 @@
<span>已有{{data.details.sales || 0}}人参与</span>
</div>
</div>
<div class="temple-info">
<img class="temple-img" :src="data.temple.picture" alt="">
<div class="temple-name">
<h4 class="name">{{data.temple.unit_name}}</h4>
<p class="visitor">已有 <span>{{data.temple.visit}}</span> 人到访过</p>
</div>
</div>
<!-- <div class="temple-info">-->
<!-- <img class="temple-img" :src="data.temple.picture" alt="">-->
<!-- <div class="temple-name">-->
<!-- <h4 class="name">{{data.temple.unit_name}}</h4>-->
<!-- <p class="visitor">已有 <span>{{data.temple.visit}}</span> 人到访过</p>-->
<!-- </div>-->
<!-- </div>-->
<div class="divider"></div>
<div class="panel">
<div class="panel-head">
@@ -33,15 +33,18 @@
<div class="support-head">
<span class="label">感恩功德</span>
<ul class="external">
<li :class="[listType === lType.id && 'active']" v-for="lType in listTypes" :key="lType.id" @click="getPayRecords(lType)">{{lType.name}}</li>
<li :class="[listType === lType.id && 'active']" v-for="lType in listTypes" :key="lType.id" @click="getPayRecords(lType, 1)">{{lType.name}}</li>
</ul>
</div>
<div>
<user-merit v-for="pay in payList" :key="pay.id" :data="pay"></user-merit>
<div class="read-more" v-if="noMore">没有更多了</div>
<div class="read-more" v-else @click="loadMoreFn">查看更多</div>
</div>
</div>
<fixed-bottom ref="fixedBottom">
<button class="iconfont icon-home" v-if="query.no_login === '1'" @click="backHome"></button>
<button class="merit-button" @click="onLightAction">点击供灯</button>
</fixed-bottom>
@@ -62,7 +65,7 @@
<div class="light-group">
<van-swipe :loop="false">
<van-swipe-item v-for="(item, index) in lights" :key="index">
<van-grid :border="false" class="home-grid-nav" column-num="5">
<van-grid :border="false" class="home-grid-nav" column-num="4">
<van-grid-item icon="photo-o" :text="nav.name" v-for="(nav, _index) in item" :key="_index" @click="onSelectLight(nav)">
<div class="light" :class="[currentLight.id === nav.id && 'current-light']">
<img :src="nav.picture" class="light-icon" />
@@ -139,11 +142,13 @@ export default {
{ id: 2, name: '月榜', },
{ id: 3, name: '总榜', },
],
page: 1,
payList: [],
currentLight: null,
currentLightPrice: 0,
currentLightSize: 53,
buy_quantity: 1, // 购买数量
noMore: false,
}
},
computed: {
@@ -156,10 +161,11 @@ export default {
const data = this.data;
if(!data) return [];
const { goods } = data;
const len = Math.ceil(goods.length / 15);
const sliceNumber = 16;
const len = Math.ceil(goods.length / sliceNumber);
const lights = [];
for(let i = 0; i < len; i++){
lights.push(goods.slice(15 * i, i * 15 + 15))
lights.push(goods.slice(sliceNumber * i, i * sliceNumber + sliceNumber))
}
return lights;
},
@@ -172,6 +178,11 @@ export default {
this.getGoodsLightDetail('common');
},
methods: {
backHome(){
const { query } = this.$router.currentRoute;
const name = query.temple_id === '1' ? 'home': 'temple-home'
this.$router.replace({ name, query: { temple_id: query.temple_id }})
},
async onLightAction(){
await hasLogin();
this.showSpec = true
@@ -201,6 +212,11 @@ export default {
this.onToFillMeritName();
}
},
// 获取更多感恩功德1
loadMoreFn(){
this.page += 1;
this.getPayRecords({id: this.listType}, this.page)
},
onToFillMeritName(){
this.$router.push({
name: 'fill-name',
@@ -223,7 +239,7 @@ export default {
this.data = response;
this.currentLight = response.goods[0];
this.currentLightSize = this.currentLight.children[0].id
await this.getPayRecords({ id: 1});
await this.getPayRecords({ id: 1}, 1);
this.$nextTick(() => {
this.paddingBottom = this.$refs.fixedBottom.getOffsetHeight()
})
@@ -233,17 +249,22 @@ export default {
})
},
// 获取感恩功德
async getPayRecords(lType){
async getPayRecords(lType, page){
this.listType = lType.id;
const res = await getOrderCompare(this.query.temple_id, this.listType, '', 5 );
this.payList = res.list;
this.page = page;
const res = await getOrderCompare(this.query.temple_id, this.page, this.listType, '', 5 );
if(this.page === 1){
this.payList = [];
}
this.payList = this.payList.concat(res.list);
this.noMore = res.list.length < 3;
},
}
}
</script>
<style lang="scss">
$lightWidth: 1.5rem;
$lightWidth: 1.15rem;
.goods-detail{
.goods-content{
padding-left: .3rem;
@@ -261,9 +282,9 @@ $lightWidth: 1.5rem;
.light-wrapper{
border-top: 1px solid #ddd;
h1{
font-size: .4rem;
font-size: .35rem;
margin-top: .4rem;
margin-bottom: 3px;
margin-bottom: .5rem;
}
.light-group{
.light{
@@ -299,6 +320,9 @@ $lightWidth: 1.5rem;
white-space: nowrap;
overflow: hidden;
}
.van-grid-item__content{
padding-top: .1rem;
}
}
.van-swipe__indicators {
bottom: 0rem;
@@ -333,9 +357,13 @@ $lightWidth: 1.5rem;
font-size: .35rem;
}
.van-radio__icon .van-icon{
width: .5rem;
height: .5rem;
line-height: .5rem;
width: .45rem;
height: .45rem;
line-height: .45rem;
}
.van-radio__icon--checked .van-icon{
background: #CF9E3B;
border-color: #CF9E3B;
}
}
.light-count{