123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494 |
- <template>
- <view class="container">
- <view id="topnav" class="topnav flex-between" :style="{'height':`${topbarOffsetHeight-statusBarHeight}px`,'padding-top':`${statusBarHeight}px`}">
- <view class="nav-item flex-center" @click="back">
- <image :src="`${assetsUrl}back.png`" mode="widthFix" class="nav-img"></image>
- </view>
- <view class="nav-text font32 fw600">
- {{topbarTitle}}
- </view>
- <view class="nav-item"></view>
- </view>
- <scroll-view
- scroll-y="true"
- :style="{'height': `${scrollHeight}px`,'padding-top':`${topNavHeight}px`}"
- v-if="scrollHeight>0"
- lower-threshold="200"
- refresher-enabled="true"
- :refresher-triggered="scrollTriggered"
- :refresher-threshold="45"
- refresher-default-style="white"
- refresher-background="#151126"
- @refresherrefresh="scrollRefresh"
- @refresherpulling="scrollPulling"
- @refresherrestore="scrollRestore"
- @refresherabort="scrollAbort"
- @scrolltolower="scrollToBottom"
- class="scroll-view"
- >
- <view class="top flex-between">
- <view class="top-left">
- <view class="user-box flex-start">
- <image :src="userInfo.iconThumbnail" mode="aspectFit" class="head-img"></image>
- <view class="user-info flex-center">
- <view class="name font32 fw600">
- {{userInfo.nick}}
- </view>
- <view class="phone font22 fw400">
- {{userInfo.phone}}
- </view>
- </view>
- </view>
- <view class="tip font28 fw400">
- 开通会员享更多惊喜特权
- </view>
- </view>
- <image :src="`${assetsUrl}vip-bg.png`" mode="aspectFit" class="top-right"></image>
- </view>
- <scroll-view scroll-x="true" class="tabs flex-start">
- <view class="tab" :class="tabIndex===index?'active-tab':'no-active'" v-for="(item,index) in priceDatas.prices2" :key="index" @click="tabClick(index)">
- <view class="tab-time font28 fw600">
- {{item.name}}
- </view>
- <view class="tab-price">
- <span style="font-size: 72rpx;">{{item.priceFenPerMonth/100}}</span><span class="font22 fw500">元/月</span>
- </view>
- <view class="tab-under font24 fw400">
- {{item.originalPriceFenPerMonth/100}}元/月
- </view>
- <view class="tab-tag font20 fw600" v-if="tabIndex===index">
- {{item.tags}}
- </view>
- </view>
- </scroll-view>
- <swiper :indicator-dots="false" :disable-touch="true" :vertical="true" :circular="true" :autoplay="true" :interval="2000" :duration="500" class="swiper">
- <view class="swiper-model" @touchmove.stop="catchTouchMove">
- <swiper-item class="swiper-item flex-start" v-for="(item,index) in promotions" :key="index" >
- <view class="item-box flex-start">
- <image :src="item.headImg" mode="aspectFit" class="item-img"></image>
- <view class="item-text font24 fw400">
- {{item.nick}}刚刚开通了会员
- </view>
- </view>
- </swiper-item>
- </view>
-
- </swiper>
- <view class="prot font22 fw400">
- 成为会员及代表同意<span style="color: #FFDDBD;" @click="toAddedService">《增值服务协议》</span>
- </view>
- <image :src="`${assetsUrl}vip-action.png`" mode="widthFix" class="action"></image>
- <view class="qustion-title font30 fw500">
- 支付遇到问题
- </view>
- <view class="qustions font24 fw400">
- 1.如果支付成功,但是没有开通VIP,请<span style="color: #FFDDBD; margin-left: 4rpx;" @click="toService">联系客服</span>
- </view>
-
- </scroll-view>
- <view class="btn flex-between">
- <view class="btn-left">
- <view class="bl-total font24 fw500">
- 合计:<span style="font-size:24rpx;font-weight: bold;color: #FFDDBD;margin-left: 4rpx;">¥</span><span style="font-size:40rpx;font-weight: bold;color: #FFDDBD;">{{totalPrice/100}}</span>
- </view>
- <!-- <view class="bl-tip font20 fw400">
- 每月自动续费
- </view> -->
- </view>
- <view class="btn-right" @click="pay">
- <image :src="`${assetsUrl}vip-btn.png`" mode="aspectFit" class="br-img"></image>
- <view class="br-text font32 fw600">
- 立即支付
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import TopBar from '@/components/TopBar/TopBar.vue';
- export default {
- components:{TopBar},
- data() {
- return {
- topbarIcon:'back',
- topbarTitle:'会员中心',
- assetsUrl:this.$util.assetsUrl,
- scrollRefreshing:false,
- scrollTriggered:true,
- scrollHeight:0,
- topNavHeight:0,
- tabIndex:0,
- priceDatas:{},
- promotions:[],
- totalPrice:0,
- priceConfig:{
- feeFen: null,
- sceneId: null,
- scene: null,
- body : null,
- userId: null,
- pkgCate:'JyPark'
- }
- };
- },
- mounted() {
- this.computedScollviewHeight();
- this.getConfigData();
- this.getPromotionsData();
- },
- computed: {
- statusBarHeight() {
- return this.$store.state.statusBarHeight;
- },
- topbarOffsetHeight() {
- return this.$store.state.topbarOffsetHeight;
- },
- userInfo(){
- return this.$store.state.userInfo||JSON.parse(uni.getStorageSync('userInfo'))
- }
- },
- methods:{
- catchTouchMove(){
- return false;
- },
- back(){
- uni.navigateBack({
- delta:1
- })
- },
- toAddedService(){
- uni.navigateTo({
- url:`/pages/webview/webview?url=${this.$util.protocal.addedService}`
- })
- },
- /**
- * 计算scroll高度
- */
- computedScollviewHeight() {
- let query = uni.createSelectorQuery().in(this);
- let heightLeaf =0;
- query.select('#topnav').boundingClientRect(data => {
- this.topNavHeight=data.height;
- heightLeaf += data.height;
- }).exec(() => {
- let sysInfo = uni.getSystemInfoSync();
- this.scrollHeight = sysInfo.windowHeight - heightLeaf;
- });
-
- },
- /**
- * 推荐下拉刷新、加载更多
- */
- scrollRefresh(){
- if (this.scrollRefreshing)
- {
- return;
- }
- this.scrollRefreshing = true;
- setTimeout(() => {
- this.scrollTriggered = false;
- this.scrollRefreshing = false;
- }, 1000)
- this.getConfigData();
- },
- scrollPulling(e) {},
- scrollRestore() {this.scrollTriggered = true;},
- scrollAbort() {},
- scrollToBottom(){},
- getConfigData(){
- let user=JSON.parse(uni.getStorageSync('user'));
- this.$api.public.priceBySceneConfigs({
- completeUser:user,
- scene:'Member'
- }).then(res=>{
- this.priceDatas=res.data;
- this.totalPrice=this.priceDatas.prices2[this.tabIndex].priceFen;
- this.priceConfig.feeFen=this.priceDatas.prices2[this.tabIndex].priceFen;
- this.priceConfig.scene=this.priceDatas.prices2[this.tabIndex].sceneCate;
- this.priceConfig.sceneId=this.priceDatas.prices2[this.tabIndex].sceneId;
- this.priceConfig.body=this.priceDatas.prices2[this.tabIndex].name;
- this.priceConfig.userId=(this.$store.state.userInfo||JSON.parse(uni.getStorageSync('userInfo'))).id;
- })
- },
- getPromotionsData(){
- this.$api.public.vipPromotions({}).then(res=>{
- this.promotions=res.data;
- })
- },
- tabClick(index){
- this.tabIndex=index;
- this.totalPrice=this.priceDatas.prices2[index].priceFen;
- this.priceConfig.feeFen=this.priceDatas.prices2[index].priceFen;
- this.priceConfig.scene=this.priceDatas.prices2[index].sceneCate;
- this.priceConfig.sceneId=this.priceDatas.prices2[index].sceneId;
- this.priceConfig.body=this.priceDatas.prices2[index].name;
- this.priceConfig.userId=(this.$store.state.userInfo||JSON.parse(uni.getStorageSync('userInfo'))).id;
- },
- pay(){
- uni.getProvider({
- service:'payment',
- success:(provider)=>{
- console.log(provider.provider)
- this.$api.pay.creatWxOrder(this.priceConfig).then(res=>{
- if(res.data.succ){
- uni.requestPayment({
- provider:provider.provider[0],
- timeStamp: String(res.data.timeStamp),
- nonceStr: res.data.nonceStr,
- package: `prepay_id=${res.data.wxUniPrePayId}`,
- signType: 'MD5',
- paySign: res.data.paySign,
- success:(result)=>{
- console.log(result)
- if(result.errMsg==='requestPayment:ok'){
- uni.showToast({
- icon:'success',
- title:'支付成功'
- })
- }
- },
- fail:(err)=>{console.log(err)}
- })
- }
- })
- }
- })
-
- },
- toService(){
- uni.openCustomerServiceChat({
- extInfo:{
- url:'https://work.weixin.qq.com/kfid/kfca1b21d2f7e8a18e9',//客服链接
- },
- corpId:'wwa8f2a0d8a6dc0950',//企业ID
- fail(res){
- console.log(res)
- wx.showToast({
- title: '客服联系失败',
- icon:'none'
- })
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container{
- width: 100vw;
- height: 100vh;
- background-color: $bgcolor1;
- overflow: hidden;
- .topnav {
- padding: 0 10rpx;
- position: fixed;
- top: 0;
- left: 0;
- width: 100vw;
- z-index: 100;
- background-color: $bgcolor1;
- .nav-item{
- width: 40rpx;
- height: 40rpx;
- margin-left: 16rpx;
-
- .nav-img{
- width: 40rpx;
- height: 40rpx;
- }
- }
- .nav-text{
- flex: 1;
- color: $fontcolor5;
- height: 40rpx;
- text-align: center;
- }
- }
- .scroll-view{
-
- .top{
- .top-left{
- padding-left: 44rpx;
- .user-box{
- .head-img{
- width: 88rpx;
- height: 88rpx;
- border-radius: 88rpx;
- background-color: #ffffff;
- }
- .user-info{
- flex-direction: column;
- margin-left: 16rpx;
- align-items: flex-start;
- .name{
- color: #ffffff;
- }
- .phone{
- color: #FFDDBD;
- margin-top: 10rpx;
- }
- }
- }
- .tip{
- color: #79726B;
- margin-top: 40rpx;
- }
- }
- .top-right{
- width: 300rpx;
- height: 260rpx;
- }
- }
- .tabs{
- white-space:nowrap;
- .tab{
- position: relative;
- margin-right: 12rpx;
-
- border-radius: 40rpx;
- display: inline-block;
- transition: all .1s;
- overflow: hidden;
- &:nth-of-type(1){
- margin-left: 32rpx;
- }
- &:nth-last-of-type(1){
- margin-right: 32rpx;
- }
- .tab-time{
- color: #FFDDBD;
- }
- .tab-price{
- color: #FFDDBD;
- margin-top: 24rpx;
- }
- .tab-under{
- color: #FFDDBD;
- text-decoration: line-through;
- margin-top: 24rpx;
- }
- .tab-tag{
- color: #201F1E;
- background: #FFDDBD;
- border-radius: 0rpx 40rpx 0px 16rpx;
- width: 88rpx;
- height: 36rpx;
- line-height: 36rpx;
- text-align: center;
- position: absolute;
- right: -1rpx;
- top: -1rpx;
- }
- }
- .no-active{
- border: 1rpx solid #79726B;
- padding: 40rpx 24rpx;
- width: 188rpx;
- }
- .active-tab{
- padding: 40rpx 24rpx;
- width: 182rpx;
- border: 4rpx solid #FFDDBD !important;
- background-color: #221F1C !important;
- }
- }
- .swiper{
- margin: 48rpx 32rpx 16rpx 32rpx;
- height: 80rpx;
- position: relative;
- .swiper-model{
- position: absolute;
- z-index: 100;
- width: 100%;
- height: 80rpx;
- }
- .swiper-item{
- height: 80rpx;
- .item-box{
- padding: 20rpx 24rpx;
- height: 80rpx;
- .item-img{
- width: 40rpx;
- height: 40rpx;
- border-radius: 40rpx;
- background-color: #ffffff;
- }
- .item-text{
- color: #ffffff;
- margin-left: 16rpx;
- }
- }
- }
- }
- .prot{
- margin: 0 32rpx;
- color: #ffffff;
- }
- .action{
- margin: 64rpx 32rpx;
- width: 686rpx;
- }
- .qustion-title{
- color: #ffffff;
- margin: 0 32rpx;
- }
- .qustions{
- color: #79726B;
- margin: 20rpx 32rpx 80rpx 32rpx;
- padding-bottom: 284rpx;
- }
- }
-
- .btn{
- position: fixed;
- bottom: 0;
- left: 0;
- z-index: 100;
- width: 686rpx;
- height: 128rpx;
- margin: 0rpx 32rpx;
- margin-bottom: 76rpx;
- background: linear-gradient(133deg, #1B1A1D 0%, #000000 100%);
- border-radius: 64rpx;
- border: 2rpx solid #979797;
- .btn-left{
- padding-left:48rpx;
- .bl-total{
- color: #ffffff;
- }
- .bl-tip{
- color: #79726B;
- }
- }
- .btn-right{
- position: relative;
- width: 208rpx;
- height: 96rpx;
- padding-right: 20rpx;
-
- .br-img{
- position: absolute;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- margin: 0 auto;
- width: 208rpx;
- height: 96rpx;
- z-index: 0;
- }
- .br-text{
- color: #000000;
- position: relative;
- z-index: 1;
- width: 208rpx;
- height: 96rpx;
- text-align: center;
- line-height: 96rpx;
- }
- }
- }
- }
- </style>
|