You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong_qianduan/pages/invite/index.vue

436 lines
9.3 KiB

10 months ago
<template>
<view class="invite">
<view class="invite-notice">
<u-notice-bar mode="horizontal" :list="list" color="#fff" bg-color="rgba(255,255,255,0.22)"></u-notice-bar>
10 months ago
</view>
<view class="invite-hd">
9 months ago
<!-- <image :src="$picUrl+'/static/news/invite-bg.png'"></image> -->
<view class="btn" @click="openPage(3)"></view>
<view class="rule" @click="openPage(4)"></view>
</view>
<view class="invite-bd">
<view class="invite-bd-a">
<view class="a">
<view class="l">
累计邀请好友(
10 months ago
<view class="p">{{info.count_people}}</view>
10 months ago
</view>
9 months ago
<view class="l" style="border: none;">
累计现金奖励(
10 months ago
<view class="p">{{info.money}}</view>
10 months ago
</view>
</view>
<view class="b" @click="openPage(1)">
我的邀请<u-icon name="arrow-right"></u-icon>
</view>
<view class="c" @click="openPage(2)">
立即提现<u-icon name="arrow-right"></u-icon>
</view>
</view>
<view class="invite-bd-b">
10 months ago
<image :src="$picUrl+'/static/news/invite-bg2.png'"></image>
<view class="a">
9 months ago
<view class="l">
可得188积分
<!-- 可得{{info.integral}}积分
<br />{{info.coupon_name}} -->
</view>
9 months ago
<view class="l">
可返现3-5%
<!-- 可返现{{info.one_order_rate}}% -->
</view>
9 months ago
<view class="l">
新人首单礼
<!-- {{info.one_order_rate}}{{info.coupon_name}} -->
</view>
</view>
</view>
<view class="invite-bd-c">
10 months ago
<image :src="$picUrl+'/static/news/invite-bg3.png'"></image>
<view class="a">
9 months ago
<view class="l">
优惠券
<!-- {{info.one_order_rate}}{{info.coupon_name}} -->
</view>
9 months ago
<view class="l">
积分
<!-- {{info.integral}}积分 -->
</view>
9 months ago
<view class="l">
长期返现
<!-- 首单返{{info.one_order_rate}}% -->
</view>
</view>
</view>
<!-- <view class="invite-bd-d">
10 months ago
<image :src="$picUrl+'/static/news/invite-bg4.png'"></image>
<view class="p" @click="openPage(3)">立即邀请</view>
</view> -->
10 months ago
</view>
<!-- -->
<view class="invite-popup" v-if="isPopup">
9 months ago
<view class="popup" @click="download()">
<image class="bg" :src="qrcode"></image>
<view class="tips">保存海报图</view>
<view class="close">
9 months ago
</view>
</view>
</view>
10 months ago
</view>
</template>
<script>
import { createQrCodeImg } from '@/utils/qrcode'
10 months ago
import * as newFunApi from '@/api/newFun'
10 months ago
export default{
data(){
return{
qrcode: "",
userInfo: {},
backgroundBg: {
"background": "rgba(255,255,255,0.22)"
},
backgroundBg1: {
"background-color": "transparent"
},
isPopup: false,
10 months ago
info: {},
list: ["邀请更多好友,获得更多奖金"]
10 months ago
}
},
10 months ago
onReady() {
this.getList();
},
onShow() {
if(uni.getStorageSync("AccessToken")){
this.userInfo = uni.getStorageSync("userInfo");
9 months ago
// this.qrcode = createQrCodeImg(this.userInfo.user_id, { 'size': 500 });
}else{
this.userInfo = {}
9 months ago
// this.qrcode = ""
}
},
9 months ago
methods: {
//生成海报
async InviteUserPoster() {
const {status, data} = await newFunApi.InviteUserPoster({});
if(status == 200){
console.log(data)
this.qrcode = data.imageUrl
}
},
9 months ago
download() {
const app = this
app.isPopup = false;
uni.showLoading({ title: '加载中' })
// 下载海报图片
uni.downloadFile({
url: app.qrcode,
success(res) {
console.log(res)
uni.hideLoading()
// 图片保存到相册
app.onSaveImage(res.tempFilePath)
},
fail(res) {
console.log('fail', res)
uni.hideLoading()
app.$toast('很抱歉,自动保存失败 请点击图片后长按手动保存', 3000)
}
})
},
// 图片保存到相册
onSaveImage(tempFilePath) {
const app = this
// #ifndef H5
uni.saveImageToPhotosAlbum({
filePath: tempFilePath,
success(data) {
app.$success('保存成功')
},
fail(err) {
if (err.errMsg === 'saveImageToPhotosAlbum:fail auth deny') {
app.$toast('请允许访问相册后重试 (右上角菜单 - 设置 - 相册)', 3000)
}
}
})
// #endif
// #ifdef H5
const names = tempFilePath.split('/')
const fileName = names[names.length - 1]
app.fileDownLoadForH5({ name: fileName, blob: tempFilePath })
// #endif
},
// 兼容H5端下载图片
// #ifdef H5
fileDownLoadForH5({ name, blob }) {
const linkElement = document.createElement('a')
linkElement.setAttribute('href', blob)
linkElement.setAttribute('downLoad', name)
linkElement.click()
},
// #endif
10 months ago
async getList() {
uni.showLoading({
title:"加载中"
})
const {status, data} = await newFunApi.inviteInit({});
if(status == 200){
uni.hideLoading();
this.info = data;
console.log(this.info)
}
},
openPage(index){
if(!uni.getStorageSync("AccessToken")){
uni.navigateTo({
url: "/pages/login/index"
})
return ;
}
if(index == 1){
uni.navigateTo({
url: "/pages/invite/list"
})
}else if(index == 2){
uni.navigateTo({
9 months ago
url: "/pages/news/user/withdrawal?balance="+ this.userInfo.pay_money
})
}else if(index == 3){
9 months ago
this.isPopup = true;
this.InviteUserPoster();
}else if(index == 4){
uni.navigateTo({
url: "/pages/invite/rule"
})
}
},
10 months ago
}
}
</script>
<style lang="scss" scoped>
.invite{
9 months ago
background: url(https://www.royaum.com.cn/static/news/invite-bg.png?t=2) center top no-repeat;
background-size: 100% auto;
&-popup{
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.6);
position: fixed;
left: 0;
top: 0;
z-index: 55;
.popup{
width: 672rpx;
height: 912rpx;
position: absolute;
left: 50%;
margin-left: -336rpx;
top: 50%;
margin-top: -456rpx;
z-index: 2;
.bg{
width: 672rpx;
9 months ago
height: 100%;
border-radius: 26rpx;
}
.qrcode{
width: 200rpx;
height: 200rpx;
position: absolute;
right: 25rpx;
top: 670rpx;
border: 8rpx solid #FFFFFF;
z-index: 2;
border-radius: 5rpx;
}
.tips{
width: 100%;
height: 30rpx;
position: absolute;
text-align: center;
font-size: 30rpx;
color: #FFFFFF;
left: 0;
bottom: -50rpx;
z-index: 2;
}
.close{
width: 60rpx;
height: 60rpx;
position: absolute;
left: 50%;
bottom: -150rpx;
color: #FFFFFF;
z-index: 2;
}
}
}
&-notice{
9 months ago
// background-color: #FF5554;
10 months ago
}
&-hd{
width: 100%;
text-align: center;
9 months ago
// background-color: #FF5554;
height: 436rpx;
position: relative;
.rule{
width: 130rpx;
height: 50rpx;
position: absolute;
right: 0;
top: 208rpx;
z-index: 2;
}
.btn{
width: 396rpx;
height: 88rpx;
position: absolute;
left: 50%;
margin-left: -205rpx;
9 months ago
bottom:0rpx;
z-index: 2;
}
10 months ago
}
&-bd{
9 months ago
padding: 0 32rpx 60rpx 32rpx;
// background: linear-gradient(181deg, #FF5F55 0%, #FAC39D 100%);
overflow: hidden;
&-a{
width: 100%;
height: 366rpx;
background: #FFFFFF;
border-radius: 12rpx;
9 months ago
margin-top: 40rpx;
.a{
padding: 50rpx 0 30rpx;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
.l{
flex: 1;
border-right: 1px solid #DDDDDD;
font-size: 28rpx;
font-weight: 500;
color: #414141;
.p{
font-size: 54rpx;
font-weight: 500;
color: #FF5251;
margin-top: 20rpx;
}
10 months ago
}
}
.b{
width: 396rpx;
height: 88rpx;
background: linear-gradient(180deg, #FD5B54 0%, #FFC277 100%);
border-radius: 106rpx;
border: 1px solid #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
color: #FFFFFF;
margin: 0 auto;
}
.c{
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
color: #FF5251;
margin-top: 20rpx;
}
}
&-b{
width: 100%;
height: 515rpx;
margin-top: 20rpx;
position: relative;
image{
width: 100%;
height: 100%;
}
.a{
width: 100%;
10 months ago
bottom: 40rpx;
padding: 0 25rpx;
box-sizing: border-box;
z-index: 1;
left: 0;
position: absolute;
display: flex;
align-items: center;
justify-content: center;
.l{
flex: 1;
text-align: center;
font-size: 28rpx;
font-weight: 500;
color: #FF4D4C;
}
}
}
&-c{
width: 100%;
height: 375rpx;
margin-top: 20rpx;
position: relative;
image{
width: 100%;
height: 100%;
}
.a{
width: 260rpx;
10 months ago
bottom: -60rpx;
box-sizing: border-box;
z-index: 1;
right: 0;
position: absolute;
display: flex;
flex-wrap: wrap;
.l{
width: 130rpx;
height: 135rpx;
text-align: center;
font-size: 22rpx;
font-weight: 500;
color: #414141;
10 months ago
}
}
}
&-d{
width: 100%;
height: 108rpx;
position: relative;
margin-top: 20rpx;
image{
width: 100%;
height: 100%;
}
.p{
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 2;
text-align: center;
line-height: 105rpx;
font-size: 36rpx;
font-weight: 500;
color: #FF5251;
}
}
10 months ago
}
}
10 months ago
</style>