Files
lucky_shop/pages_tool/member/invite_friends.vue
ZF sun 2e535b9d93 refactor(member pages): unify onShow login redirect logic
1. extract common onShow login check to dedicated method redirectTologinOnShowLifecycle
2. add fallback callback for login failure to navigate back on wechat mini program
3. update all page login redirect calls to use the new unified method
4. add debug logs for redirect and auth flow tracing
2026-06-27 18:25:53 +08:00

278 lines
9.8 KiB
Vue

<template>
<view :style="themeColor">
<view v-if="info" style="background-color: #fff;">
<view class="invite_adv">
<image :src="$util.img('public/uniapp/member/invite/top_bg.png')" mode="widthFix"></image>
<view class="desc" @click="openRulePopup" v-if="info.remark != ''">
<text class="iconfont icon-bangzhu"></text>
{{ $lang('activityDescription') }}
</view>
<image class="font" :src="$util.img('public/uniapp/member/invite/top_font.png')" mode="widthFix" show-menu-by-longpress />
<view class="time">
{{ $lang('activityTime', { startTime: $util.timeStampTurnTime(info.start_time, 1), endTime: $util.timeStampTurnTime(info.end_time, 1) }) }}
</view>
<view class="btn" :style="{ 'background-image': 'url(' + $util.img('public/uniapp/member/invite/top_btn.png') + ')' }" @click="openSharePopup">{{ $lang('inviteNow') }}</view>
</view>
<view class="content invite-list">
<view class="title">{{ $lang('myFriends') }}</view>
<block v-if="inviteList.length > 0">
<view class="invitelist_block">
<view class="invitelist">
<view class="list-item" v-for="(item, index) in inviteList" :key="index">
<view class="img color-base-border">
<image mode="aspectFit" :src="item.headimg == '' ? $util.img($util.getDefaultImage().head) : $util.img(item.headimg)" show-menu-by-longpress />
</view>
<view class="list-left">
<view class="info">
<view class="name font-size-tag">{{ item.source_member_nickname }}</view>
<view class="time font-size-activity-tag color-tip">
{{ $util.timeStampTurnTime(item.create_time) }}
</view>
</view>
<view class="prize color-base-text font-size-activity-tag">
<block v-if="item.balance > 0">{{ $lang('cashRedPacketAmount', { amount: item.balance }) }}</block>
<block v-if="(item.point > 0 || item.coupon_num) && item.balance > 0">+</block>
<block v-if="item.point > 0">{{ $lang('pointsAmount', { amount: parseInt(item.point) }) }}</block>
<block v-if="item.point > 0 && item.balance > 0 && item.coupon_num > 0">+
</block>
<block v-if="item.coupon_num > 0">{{ $lang('couponsAmount', { count: item.coupon_num }) }}</block>
</view>
</view>
</view>
</view>
<view class="more_invite color-tip font-size-tag " @click="moreList" v-if="isClick && total_num > page">
{{ $lang('viewMore') }}
<text class="iconfont icon-iconangledown"></text>
</view>
<view class="more_invite color-tip font-size-tag " @click="moreList" v-if="!isClick && inviteList.length > 5 && total_num <= page">{{ $lang('noMoreData') }}</view>
</view>
</block>
<block v-else>
<view class="empty">
<view class="tip">{{ $lang('noInvitedFriendsTip') }}</view>
<view class="tip">{{ $lang('inviteTip') }}</view>
</view>
</block>
</view>
<view class="content">
<view class="title">{{ $lang('inviteRewards') }}</view>
<view class="invite_active">
<view class="list">
<view class="item" v-if="$util.inArray('balance', info.type) != -1">
<image :src="$util.img('public/uniapp/member/invite/coupon_bg.png')" mode="aspectFill"/>
<view class="desc">
<view class="price">
<text class="font-size-base">{{ $lang('common.currencySymbol') }}</text>
<text>{{ info.balance }}</text>
</view>
<view class="type">{{ $lang('cashRedPacket') }}</view>
</view>
</view>
<view class="item" v-if="$util.inArray('point', info.type) != -1">
<image :src="$util.img('public/uniapp/member/invite/coupon_bg.png')" mode="aspectFill"/>
<view class="desc">
<view class="price">
<text>{{ parseInt(info.point) }}</text>
</view>
<view class="type">{{ $lang('points') }}</view>
</view>
</view>
<view class="item margin_right_none" v-if="$util.inArray('coupon', info.type) != -1">
<image :src="$util.img('public/uniapp/member/invite/coupon_bg.png')" mode="aspectFill">
</image>
<view class="desc">
<view class="price">
<text>{{ info.coupon.split(',').length }}</text>
{{ $lang('couponUnit') }}
</view>
<view class="type">{{ $lang('coupon') }}</view>
</view>
</view>
</view>
<view class="desc">
<view class="title_desc color-tip">{{ $lang('shareDesc') }}</view>
<view class="desc_list">
<view class="" v-if="$util.inArray('balance', info.type) != -1">
<text>●</text>
{{ $lang('balanceReward', { amount: info.balance }) }}
</view>
<view class="" v-if="$util.inArray('point', info.type) != -1">
<text>●</text>
{{ $lang('pointReward', { amount: info.point }) }}
</view>
<view class="" v-if="$util.inArray('coupon', info.type) != -1">
<text>●</text>
{{ $lang('couponReward', { count: info.coupon.split(',').length }) }}
</view>
<view class="" v-if="info.max_fetch == 0">
<text>●</text>
{{ $lang('unlimitedReward') }}
</view>
<view class="" v-else>
<text>●</text>
{{ $lang('rewardLimit', { max: info.max_fetch }) }}
</view>
</view>
</view>
</view>
</view>
<view class="content">
<view class="title">{{ $lang('howToInvite') }}</view>
<view class="invite_active">
<view class="step">
<view>
<view class="img">
<image :src="$util.img('public/uniapp/member/invite/fenxiang.png')" mode="aspectFit" show-menu-by-longpress />
</view>
<view class="text">{{ $lang('stepShareLink') }}</view>
</view>
<view>
<image :src="$util.img('public/uniapp/member/invite/jiantou.png')" class="jiantou" show-menu-by-longpress ></image>
</view>
<view>
<view class="img">
<image :src="$util.img('public/uniapp/member/invite/shouji.png')" mode="aspectFit" show-menu-by-longpress />
</view>
<view class="text">{{ $lang('stepFriendEnter') }}</view>
</view>
<view>
<image :src="$util.img('public/uniapp/member/invite/jiantou.png')" class="jiantou" show-menu-by-longpress ></image>
</view>
<view>
<view class="img">
<image :src="$util.img('public/uniapp/member/invite/hongbao.png')" mode="aspectFit" show-menu-by-longpress />
</view>
<view class="text">{{ $lang('stepFriendRegister') }}</view>
</view>
</view>
</view>
</view>
<!-- 海报 -->
<view @touchmove.prevent.stop>
<uni-popup ref="posterPopup" type="bottom" class="poster-layer">
<template v-if="poster != '-1'">
<view>
<view class="image-wrap">
<image :src="$util.img(poster)" mode="widthFix" show-menu-by-longpress />
</view>
<!-- #ifdef MP || APP-PLUS -->
<view class="save" @click="savePoster()">{{ $lang('saveImage') }}</view>
<!-- #endif -->
<!-- #ifdef H5 -->
<view class="save">{{ $lang('longPressSaveImage') }}</view>
<!-- #endif -->
</view>
<view class="close iconfont icon-close" @click="closePosterPopup()"></view>
</template>
<view v-else class="msg">{{ posterMsg }}</view>
</uni-popup>
</view>
<!-- 分享弹窗 -->
<view @touchmove.prevent.stop>
<uni-popup ref="sharePopup" type="bottom" class="share-popup">
<view>
<view class="share-title">{{ $lang('share') }}</view>
<view class="share-content">
<!-- #ifdef MP -->
<view class="share-box">
<button class="share-btn" :plain="true" open-type="share">
<view class="iconfont icon-share-friend"></view>
<text>{{ $lang('shareToFriends') }}</text>
</button>
</view>
<!-- #endif -->
<view class="share-box" @click="openPosterPopup">
<button class="share-btn" :plain="true">
<view class="iconfont icon-pengyouquan"></view>
<text>{{ $lang('generatePoster') }}</text>
</button>
</view>
<!-- #ifdef H5 -->
<view class="share-box" @click="copyUrl">
<button class="share-btn" :plain="true">
<view class="iconfont icon-fuzhilianjie"></view>
<text>{{ $lang('copyLink') }}</text>
</button>
</view>
<!-- #endif -->
</view>
<view class="share-footer" @click="closeSharePopup"><text>{{ $lang('cancelShare') }}</text></view>
</view>
</uni-popup>
</view>
<!-- 弹出规则 -->
<view @touchmove.prevent.stop>
<uni-popup ref="rulePopup" type="bottom">
<view class="tips-layer">
<view class="head" @click="closeRulePopup()">
<view class="title">{{ $lang('activityDescription') }}</view>
<text class="iconfont icon-close"></text>
</view>
<view class="body">
<view class="detail margin-bottom">{{ info.remark }}</view>
</view>
</view>
</uni-popup>
</view>
</view>
<ns-empty v-else :text="$lang('noData')"></ns-empty>
<ns-login ref="login"></ns-login>
<loading-cover ref="loadingCover"></loading-cover>
</view>
</template>
<script>
import inviteFriends from './public/js/invite_friends.js';
export default {
data() {
return {
inviteList: [],
info: null,
page: 1,
page_size: 5,
total_num: 0,
isClick: true,
poster: '-1', //海报
posterMsg: '' //海报错误信息
};
},
onLoad(option) {},
onShow() {
if (!this.storeToken) {
this.redirectTologinOnShowLifecycle('/pages_tool/member/invite_friends');
return;
}
this.getBaseInfo();
this.getList();
},
mixins: [inviteFriends],
onReady() {}
};
</script>
<style lang="scss">
@import './public/css/invite_friends.scss';
</style>
<style lang="scss" scoped>
::v-deep .uni-popup__wrapper.bottom {
border-radius: 24rpx 24rpx 0 0;
}
</style>
<style scoped>
.poster-layer>>>.uni-popup__wrapper-box {
max-height: initial !important;
}
</style>