Files
lucky_shop/pages_tool/member/index.vue

231 lines
6.0 KiB
Vue

<template>
<view :style="themeColor">
<view :style="{ backgroundColor: bgColor, minHeight: openBottomNav ? 'calc(100vh - 55px)' : '' }"
class="page-img">
<view class="page-header" v-if="diyData.global && diyData.global.navBarSwitch"
:style="{ backgroundImage: bgImg }">
<ns-navbar :title-color="textNavColor" :data="diyData.global" :scrollTop="scrollTop" :isBack="true" />
</view>
<diy-index-page v-if="topIndexValue" ref="indexPage" :value="topIndexValue" :bgUrl="bgUrl"
:scrollTop="scrollTop" :diyGlobal="diyData.global" class="diy-index-page">
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop"
:haveTopCategory="true" />
<ns-copyright v-show="isShowCopyRight" />
</diy-index-page>
<view v-else class="bg-index"
:style="{ backgroundImage: backgroundUrl, paddingTop: paddingTop, marginTop: marginTop }">
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop" />
<ns-copyright v-show="isShowCopyRight" />
<view class="foot">
<view class="item" @click="tourl('/pages_tool/agreement/contenr?type=0')">{{
$lang('privacyPolicy') }}</view>
<view class="item" @click="tourl('/pages_tool/agreement/contenr?type=1')">{{
$lang('registrationAgreement') }}</view>
</view>
<!-- 退出登录和账号注销按钮 -->
<view class="action-buttons" v-if="storeToken">
<view class="action-btn cancel-btn" @click="cancellation">{{ $lang('cancellation') }}</view>
<view class="action-btn logout-btn" @click="logout">{{ $lang('logout') }}</view>
</view>
</view>
<template
v-if="diyData.global && diyData.global.popWindow && diyData.global.popWindow.count != -1 && diyData.global.popWindow.imageUrl">
<view @touchmove.prevent.stop>
<uni-popup ref="uniPopupWindow" type="center" class="wap-floating" :maskClick="false">
<view class="image-wrap">
<image :src="$util.img(diyData.global.popWindow.imageUrl)" :style="popWindowStyle"
@click="uniPopupWindowFn()" mode="aspectFit" />
</view>
<text class="iconfont icon-round-close" @click="closePopupWindow"></text>
</uni-popup>
</view>
</template>
<!-- 底部tabBar -->
<view id="tab-bar" :class="{ hide: bottomNavHidden }" v-if="openBottomNav">
<diy-bottom-nav @callback="callback" />
</view>
<!-- 收藏 -->
<uni-popup ref="collectPopupWindow" type="top" class="wap-floating wap-floating-collect">
<view v-if="showTip" class="collectPopupWindow"
:style="{ marginTop: (collectTop + statusBarHeight) * 2 + 'rpx' }">
<image :src="$util.img('public/uniapp/index/collect2.png')" mode="aspectFit" />
<text @click="closeCollectPopupWindow">我知道了</text>
</view>
</uni-popup>
<ns-birthday-gift ref="birthdayGift"></ns-birthday-gift>
<ns-new-gift ref="nsNewGift"></ns-new-gift>
<hover-nav></hover-nav>
<!-- #ifdef MP-WEIXIN -->
<!-- 小程序隐私协议 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
<!-- #endif -->
</view>
</view>
</template>
<script>
import diyJs from '@/common/js/diy.js';
import indexJs from './public/js/index.js';
import nsBirthdayGift from '../_components/ns-birthday-gift/ns-birthday-gift.vue';
import nsNewGift from '../_components/ns-new-gift/ns-new-gift.vue';
export default {
components: {
nsBirthdayGift,
nsNewGift
},
mixins: [diyJs, indexJs],
methods: {
tourl(url) {
this.$util.redirectTo(url);
},
onShow() {
this.setPublicShare();
// 调用API隐藏返回首页按钮
wx.hideHomeButton();
},
// 退出登录
logout() {
uni.showModal({
title: this.$lang('logoutTitle'),
content: this.$lang('logoutContent'),
success: (res) => {
if (res.confirm) {
this.$store.commit('setToken', '');
this.$store.commit('setMemberInfo', '');
this.$store.dispatch('emptyCart');
uni.removeStorageSync('authInfo');
uni.removeStorageSync('privacyAgreed');
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
}
}
});
},
// 账号注销
cancellation() {
uni.showModal({
title: this.$lang('cancellationTitle'),
content: this.$lang('cancellationContent'),
confirmColor: '#000000',
success: res => {
if (res.confirm) {
this.$api.sendRequest({
url: '/membercancel/api/membercancel/apply',
success: rres => {
if (rres.code >= 0) {
this.$store.commit('setToken', '');
this.$store.commit('setMemberInfo', '');
this.$store.dispatch('emptyCart');
uni.removeStorageSync('authInfo');
uni.removeStorageSync('privacyAgreed');
this.$util.redirectTo(this.$util.MEMBER_PAGE_URL);
} else {
this.$util.showToast({
title: rres.message
});
}
}
});
}
}
});
}
}
};
</script>
<style lang="scss">
@import '@/common/css/diy.scss';
.foot {
display: flex;
// position: absolute;
width: 100%;
margin-bottom: 40rpx;
.item {
width: 50%;
text-align: center;
color: #F4391c
}
}
</style>
<style scoped>
.wap-floating>>>.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
background: none !important;
}
::v-deep .diy-index-page .uni-popup .uni-popup__wrapper-box {
border-radius: 0;
}
.choose-store>>>.goodslist-uni-popup-box {
width: 80%;
}
::v-deep .placeholder {
height: 0;
}
::v-deep ::-webkit-scrollbar {
width: 0;
height: 0;
background-color: transparent;
display: none;
}
.hide {
display: none;
}
::v-deep .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
max-height: unset !important;
}
.action-buttons {
display: flex;
flex-direction: column;
align-items: center;
margin: 20rpx 30rpx 40rpx;
gap: 20rpx;
}
.action-btn {
width: 80%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
border-radius: 40rpx;
font-size: 28rpx;
font-weight: 500;
}
.logout-btn {
background-color: var(--main-color);
color: #fff;
border: 1rpx solid #ddd;
}
.cancel-btn {
background-color:var(--main-color);
color: #fff;
}
</style>