<template>
	<view>

		
		<view class="list-item">
		
			<view class="item fx-r fx-bc fx-ac" style="padding: 20px 0;" @tap="tapTransfer">
				<view class="label">群主转让</view>
				<view class="fx-g1"></view>
				<image class="pve" src="/static/chat/ic_next.png" mode="widthFix"></image>
			</view>
			
			<view class="item fx-r fx-bc fx-ac" style="padding: 20px 0;" @tap="tapAdmin">
				<view class="label">群管理员</view>
				<view class="fx-g1"></view>
				<image class="pve" src="/static/chat/ic_next.png" mode="widthFix"></image>
			</view>
			
			<view class="item fx-r fx-bc fx-ac" style="padding: 20px 0;" @tap="tapRed">
				<view class="label">未领取红包</view>
				<view class="fx-g1"></view>
				<image class="pve" src="/static/chat/ic_next.png" mode="widthFix"></image>
			</view>
			
		</view>
		
		
		<view class="list-item" style="margin-top: 10px;">
			<view class="item fx-r fx-bc fx-ac" style="padding: 20px 0;" @tap="tapDelGroup">
				<view class="label" style="color: red;">解散群聊</view>
			</view>
			
		</view>
		

		
	</view>
</template>


<script>
	import {mapState,mapMutations} from 'vuex'
	export default {
		computed: mapState(['user']),
		data() {
			return {
				groupId : 0
			}
		},
		onLoad(options) {
			this.groupId = options.groupId || 0;
			
		},
		methods: {		
			tapTransfer:function(){
				uni.navigateTo({
					url:"transfer?groupId=" + this.groupId
				})
			},
			/**
			 * 群管理员
			 */
			tapAdmin:function(){
				uni.navigateTo({
					url: "adminInfo?groupId=" + this.groupId
				})
			},
			
			tapDelGroup:function(){
				this.utils.showModal("你确定要解散群聊吗，解散之后，将无法恢复？", ()=>{
					uni.showLoading({ title:"提交数据中..." });
					this
						.request
						.post("GroupDissolve",{groupId:this.groupId})
						.then(res=>{
							uni.hideLoading();
							if(res.code == 200) {
								this.utils.Tip("移除成功");
								setTimeout(()=>{
									uni.navigateBack();
								},200);
							} else {
								this.utils.Tip(res.msg);
							}
						})
						.catch(err=>{
							uni.hideLoading();
							this.utils.Tip("加载失败，请重新尝试");
						});
				});
			},
			/**
			 * 未领取红包
			 */
			tapRed:function(){
				uni.navigateTo({
					url:"not_receive?groupId=" + this.groupId
				});
			}
			
		}
	}
</script>


<style lang="scss">
	.list-item{background: #fff;padding: 0px 20px;margin-top: 10px;}
	.list-item .item{padding: 10px 0;border-bottom: 1px solid #f1f1f1;}
	.list-item .item:last-child{border-bottom: 0;}
	.list-item .item .label{font-size: 16px;color:$ic-default-text;}
	.list-item .item .pve{width: 20px;}
	.tag{color:$ic-default-text ;font-size: 14px;}
</style>