267 lines
5.4 KiB
Plaintext
267 lines
5.4 KiB
Plaintext
<template>
|
||
<view class="wrap__giftPanel" v-if="showGiftView">
|
||
<view class="wrapgift-mask" @tap="close"></view>
|
||
<view class="pop__ui_child anim-footer" @tap.stop="">
|
||
<scroll-view class="wrapgift-body">
|
||
<view class="wrap_giftlist">
|
||
<view class="gift-head">
|
||
<view class="gift-menu"><text class="gm-item gm-item-on">礼物</text></view>
|
||
<view class="gift-coins"><text class="gc-coin">{{giftName}}:</text><text class="gc-num">{{userInfo.gift_money}}</text><text class="gc-recharge" @tap="PlanFunc">充值</text></view>
|
||
</view>
|
||
<swiper class="gift-swiper" :indicator-dots="true" :duration="200" indicator-color="#dbdbdb" indicator-active-color="#999">
|
||
<swiper-item v-for="(group, num) in giftList" :key="num">
|
||
<view class="gift__cells">
|
||
<block v-for="(item, index) in group" :key="index">
|
||
<view v-if="item.gift_id!=isGift" class="giftitem" @tap="chooseGift(item)">
|
||
<view class="giftitem-rect">
|
||
<image class="giftimg" :src="item.file_path" mode="aspectFill" />
|
||
</view><text class="giftname">{{item.gift_name}}</text><text class="giftcoin">{{item.price}}{{giftName}}</text>
|
||
</view>
|
||
<view class="giftitem" v-if="item.gift_id==isGift">
|
||
<view class="giftitem_active">
|
||
<view class="giftitem-rect">
|
||
<image class="giftimg_active" :src="item.file_path" mode="aspectFill" />
|
||
</view>
|
||
<text class="giftcoin">{{item.price}}{{giftName}}</text>
|
||
<text class="btntext" @tap="sendGift(item)">发送</text>
|
||
</view>
|
||
</view>
|
||
</block>
|
||
</view>
|
||
</swiper-item>
|
||
</swiper>
|
||
</view>
|
||
</scroll-view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
showGiftView: false,
|
||
/*是否打开充值*/
|
||
open_plan: false,
|
||
/*个人信息*/
|
||
userInfo:{},
|
||
isGift:0
|
||
}
|
||
},
|
||
props: ['giftName', 'giftList','room_id'],
|
||
methods: {
|
||
show() {
|
||
this.showGiftView = true;
|
||
this.getUser();
|
||
},
|
||
/*请求对象*/
|
||
getRequest(){
|
||
let self = this;
|
||
// #ifdef APP-PLUS
|
||
return getApp().globalData.vueObj;
|
||
// #endif
|
||
// #ifndef APP-PLUS
|
||
return self;
|
||
// #endif
|
||
},
|
||
/*获取用户信息*/
|
||
getUser() {
|
||
let self = this;
|
||
self.getRequest()._get('user.user/detail', {
|
||
}, function(res) {
|
||
self.userInfo=res.data.userInfo;
|
||
});
|
||
},
|
||
chooseGift(item){
|
||
this.isGift=item.gift_id
|
||
},
|
||
sendGift(item) {
|
||
let self = this;
|
||
console.log('发送礼物')
|
||
self.getRequest()._post(
|
||
'plus.live.room/send_gift',
|
||
{
|
||
room_id: self.room_id,
|
||
gift_id: item.gift_id
|
||
},
|
||
function(res) {
|
||
console.log(res)
|
||
uni.showToast({
|
||
title:res.msg
|
||
});
|
||
self.userInfo.gift_money = res.data.gift_money;
|
||
self.$emit('sendGift', item.gift_id + "," + res.data.gift_num);
|
||
}
|
||
);
|
||
},
|
||
PlanFunc(){
|
||
this.showGiftView = false;
|
||
this.$emit('openPlan');
|
||
},
|
||
close() {
|
||
this.showGiftView = false;
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
.nlv_borT {
|
||
border-color: #ebebeb;
|
||
border-style: solid;
|
||
border-top-width: 1upx;
|
||
}
|
||
|
||
.wrapgift-mask {
|
||
background-color: #000;
|
||
opacity: .1;
|
||
position: fixed;
|
||
left: 0;
|
||
right: 0;
|
||
top: 0;
|
||
bottom: 0;
|
||
z-index: 201910;
|
||
}
|
||
|
||
.wrapgift-body {
|
||
overflow: hidden;
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
right: 0;
|
||
z-index: 201911;
|
||
}
|
||
|
||
.gift-head {
|
||
border-color: rgba(255, 255, 255, .3);
|
||
border-style: solid;
|
||
border-bottom-width: 1upx;
|
||
flex-direction: row;
|
||
align-items: center;
|
||
height: 100upx;
|
||
}
|
||
|
||
.gift-menu {
|
||
flex: 1;
|
||
flex-direction: row;
|
||
}
|
||
|
||
.gm-item {
|
||
color: #999;
|
||
font-size: 32upx;
|
||
margin-left: 40upx;
|
||
line-height: 100upx;
|
||
}
|
||
|
||
.gm-item-on {
|
||
color: #fff;
|
||
border-color: #ff0f33;
|
||
border-style: solid;
|
||
border-bottom-width: 2px;
|
||
}
|
||
|
||
.gift-coins {
|
||
color: #fff;
|
||
font-size: 28upx;
|
||
flex-direction: row;
|
||
align-items: center;
|
||
padding-right: 30upx;
|
||
}
|
||
|
||
.gc-coin {
|
||
color: #ffffff;
|
||
font-size: 25rpx;
|
||
}
|
||
|
||
.gc-num {
|
||
color: #feb719;
|
||
font-size: 12px;
|
||
}
|
||
|
||
.gc-recharge {
|
||
color: #ff0f33;
|
||
font-size: 12px;
|
||
margin-left: 30upx;
|
||
}
|
||
|
||
.wrap_giftlist {
|
||
background-color: rgba(31, 37, 62, 1);
|
||
border-top-left-radius: 12px;
|
||
border-top-right-radius: 12px;
|
||
height: 700upx;
|
||
position: relative;
|
||
}
|
||
|
||
.gift-swiper {
|
||
flex: 1;
|
||
}
|
||
|
||
.gift__cells {
|
||
flex-direction: row;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.giftitem {
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-top: 20upx;
|
||
width: 186upx;
|
||
}
|
||
|
||
.giftitem-rect {
|
||
align-items: center;
|
||
justify-content: center;
|
||
height: 150upx;
|
||
width: 150upx;
|
||
position: relative;
|
||
}
|
||
|
||
.giftimg {
|
||
height: 100rpx;
|
||
width: 100rpx;
|
||
}
|
||
.giftimg_active{
|
||
height: 100rpx;
|
||
width: 100rpx;
|
||
transform: scale(1.2);
|
||
}
|
||
.giftname {
|
||
color: #fff;
|
||
font-size: 30upx;
|
||
}
|
||
|
||
.giftcoin {
|
||
color: rgba(255, 255, 255, .3);
|
||
font-size: 22upx;
|
||
margin-top: 2px;
|
||
}
|
||
.sendbtn{
|
||
|
||
}
|
||
.btntext{
|
||
width: 150rpx;
|
||
height: 40rpx;
|
||
background-color: red;
|
||
border-radius: 20rpx;
|
||
text-align: center;
|
||
padding: 0;
|
||
border-width: 0;
|
||
font-size: 22rpx;
|
||
color: #FFFFFF;
|
||
line-height: 40rpx;
|
||
}
|
||
.giftitem_active{
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
background-image: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.3));
|
||
border-radius: 20rpx;
|
||
}
|
||
.giftitem_active .giftcoin{
|
||
margin-top: -6rpx;
|
||
margin-bottom: 6rpx;
|
||
}
|
||
|
||
</style>
|