|
|
@@ -1,7 +1,7 @@
|
|
|
<!--
|
|
|
* @Author: your name
|
|
|
* @Date: 2021-03-18 11:16:06
|
|
|
- * @LastEditTime: 2021-03-18 15:43:42
|
|
|
+ * @LastEditTime: 2021-03-19 15:44:14
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
* @Description: In User Settings Edit
|
|
|
* @FilePath: \rebatedine-mini\src\pagesSub\commission\invite.vue
|
|
|
@@ -10,9 +10,18 @@
|
|
|
<view class="main">
|
|
|
<network-error />
|
|
|
<view class="top">
|
|
|
- <feed class="top-feed"></feed>
|
|
|
+
|
|
|
+ <feed class="top-feed"
|
|
|
+ v-show="feedContent"
|
|
|
+ :content="feedContent"></feed>
|
|
|
+
|
|
|
<view class="container">
|
|
|
- <button class="button">立即邀请</button>
|
|
|
+ <button class="button"
|
|
|
+ v-if="!userInfo"
|
|
|
+ @click="jumpToLogin">立即邀请</button>
|
|
|
+ <button class="button"
|
|
|
+ open-type="share"
|
|
|
+ v-if="userInfo">立即邀请</button>
|
|
|
<button class="button-disable">面对面扫码 敬请期待</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -20,25 +29,34 @@
|
|
|
<view class="middle-top">
|
|
|
<view class="middle-top-left">
|
|
|
<view class="middle-top-left-top">
|
|
|
- <text class="number">0</text>
|
|
|
+ <text class="number">{{(userInfo.total_amount/100).toFixed(0)}}</text>
|
|
|
<text class="unit">元</text>
|
|
|
</view>
|
|
|
<text class="tips">累计收益</text>
|
|
|
</view>
|
|
|
<view class="middle-top-right">
|
|
|
<view class="middle-top-right-top">
|
|
|
- <text class="number">0</text>
|
|
|
+ <text class="number">{{userInfo.invite_count}}</text>
|
|
|
<text class="unit">位</text>
|
|
|
</view>
|
|
|
<text class="tips">成功邀请</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="middle-middle">
|
|
|
- <view class="middle-middle-button">
|
|
|
+ <button class="middle-middle-button"
|
|
|
+ v-if="!userInfo"
|
|
|
+ @click="jumpToLogin">
|
|
|
<text class="text">立即邀请好友</text>
|
|
|
<image class="icon"
|
|
|
src="~@/static/icon/icon_commission_go.png"></image>
|
|
|
- </view>
|
|
|
+ </button>
|
|
|
+ <button class="middle-middle-button"
|
|
|
+ open-type="share"
|
|
|
+ v-if="userInfo">
|
|
|
+ <text class="text">立即邀请好友</text>
|
|
|
+ <image class="icon"
|
|
|
+ src="~@/static/icon/icon_commission_go.png"></image>
|
|
|
+ </button>
|
|
|
<view class="middle-middle-money"
|
|
|
@click="jumpToCommission">
|
|
|
<image class="icon"
|
|
|
@@ -55,11 +73,83 @@
|
|
|
|
|
|
<script>
|
|
|
import Feed from '../../components/feed'
|
|
|
+import * as userApi from '../../api/userApi'
|
|
|
+import * as commissionApi from '../../api/commissionApi'
|
|
|
export default {
|
|
|
components: {
|
|
|
Feed
|
|
|
},
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ feeds: [],
|
|
|
+ feedContent: null,
|
|
|
+ feedTimer: null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onUnload () {
|
|
|
+ if (this.feedTimer) {
|
|
|
+ clearInterval(this.feedTimer)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onShow () {
|
|
|
+ userApi.getUserInfoByToken().then(({ code, data }) => {
|
|
|
+ if (code === 200) {
|
|
|
+ this.$store.commit('updateUserInfo', data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.feedTimer = setInterval(() => {
|
|
|
+ if (this.feeds.length === 0) {
|
|
|
+ commissionApi.getCommissionFeedList().then(({ code, data }) => {
|
|
|
+ if (code === 200) {
|
|
|
+ this.feeds = data
|
|
|
+ if (this.feeds.length > 0) {
|
|
|
+ const item = this.feeds.pop()
|
|
|
+ this.feedContent = item.content
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ const item = this.feeds.pop()
|
|
|
+ this.feedContent = item.content
|
|
|
+ }
|
|
|
+ }, 3000)
|
|
|
+ },
|
|
|
+ onHide () {
|
|
|
+ if (this.feedTimer) {
|
|
|
+ clearInterval(this.feedTimer)
|
|
|
+ this.feedTimer = null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onShareAppMessage (res) {
|
|
|
+ const title = '亲爱的,我请你趣吃霸王餐啦!赶紧查收!'
|
|
|
+ return {
|
|
|
+ title: title,
|
|
|
+ path: this.getShareUrl(),
|
|
|
+ imageUrl: 'https://image.qcbwc.cn/share/invite-share.png'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onShareTimeline (res) {
|
|
|
+ const title = '亲爱的,我请你趣吃霸王餐啦!赶紧查收!'
|
|
|
+ return {
|
|
|
+ title: title,
|
|
|
+ path: this.getShareUrl(),
|
|
|
+ imageUrl: 'https://image.qcbwc.cn/share/invite-share.png'
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ change () {
|
|
|
+ this.show = !this.show
|
|
|
+ },
|
|
|
+ getShareUrl () {
|
|
|
+ let url = '/pages/index'
|
|
|
+ if (this.userInfo) {
|
|
|
+ url += '?invite_id=' + this.userInfo.id
|
|
|
+ }
|
|
|
+ return url
|
|
|
+ },
|
|
|
+ jumpToLogin () {
|
|
|
+ uni.navigateTo({ url: '/pagesSub/other/login' })
|
|
|
+ },
|
|
|
jumpToCommission () {
|
|
|
uni.navigateTo({
|
|
|
url: '/pagesSub/commission/commission'
|
|
|
@@ -69,6 +159,9 @@ export default {
|
|
|
computed: {
|
|
|
awardUrl () {
|
|
|
return 'https://image.qcbwc.cn/background/invite_bottom.png?t=' + new Date().getTime()
|
|
|
+ },
|
|
|
+ userInfo () {
|
|
|
+ return this.$store.state.userInfo
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -95,6 +188,7 @@ export default {
|
|
|
margin-top: 956rpx;
|
|
|
.button {
|
|
|
height: 88rpx;
|
|
|
+ line-height: 88rpx;
|
|
|
width: 65%;
|
|
|
background: linear-gradient(
|
|
|
180deg,
|
|
|
@@ -112,6 +206,7 @@ export default {
|
|
|
.button-disable {
|
|
|
height: 88rpx;
|
|
|
width: 65%;
|
|
|
+ line-height: 88rpx;
|
|
|
border-radius: 44rpx;
|
|
|
margin-bottom: 32rpx;
|
|
|
font-size: 32rpx;
|
|
|
@@ -131,8 +226,12 @@ export default {
|
|
|
&-top {
|
|
|
position: absolute;
|
|
|
display: flex;
|
|
|
- width: 100%;
|
|
|
+ width: 90%;
|
|
|
+ margin-left: 5%;
|
|
|
margin-top: 130rpx;
|
|
|
+ &-left {
|
|
|
+ border-right: 2rpx solid #d3d4d5;
|
|
|
+ }
|
|
|
&-left,
|
|
|
&-right {
|
|
|
flex: 1;
|
|
|
@@ -147,11 +246,13 @@ export default {
|
|
|
color: #ed2701;
|
|
|
.number {
|
|
|
font-size: 80rpx;
|
|
|
+ font-weight: 600;
|
|
|
}
|
|
|
.unit {
|
|
|
margin-bottom: 14rpx;
|
|
|
font-size: 28rpx;
|
|
|
margin-left: 4rpx;
|
|
|
+ font-weight: 600;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -174,6 +275,7 @@ export default {
|
|
|
display: flex;
|
|
|
width: 65%;
|
|
|
height: 88rpx;
|
|
|
+ line-height: 88rpx;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
background: linear-gradient(
|
|
|
@@ -186,6 +288,7 @@ export default {
|
|
|
border-radius: 44rpx;
|
|
|
.text {
|
|
|
font-size: 32rpx;
|
|
|
+ font-weight: 600;
|
|
|
color: #fcebc6;
|
|
|
}
|
|
|
.icon {
|