<template>
	<view class="app">
		<view class="red_envelope_tip fx-r fx-bc fx-ac" v-if="item.type == 'red_envelope_tip'">
			<image src="/static/img/chat-red-v2.svg"></image>
			<text v-if="user.uid == inItem.lq.uid">
				你领取{{inItem.send.name}}
			</text>
			<text v-else>
				{{inItem.lq.name}} 领取您的
			</text>
			<text class="red" @tap="tapRed">红包</text>
			<text v-if="inItem.is_completed">，你的红包已被领完。</text>
		</view>
		
		<view class="red_envelope_tip fx-r fx-bc fx-ac" v-if="item.type == 'tip'">
			{{item.data}}
		</view>
		
		<view class="red_envelope_tip fx-r fx-bc fx-ac" v-if="item.type == 'group_del'">
			{{inItem.nickname}}已被移除群聊
		</view>
		
		<view class="red_envelope_tip fx-r fx-bc fx-ac" v-if="item.type == 'withdraw'">
				<text v-if="item.sendUser.uid == user.uid">你撤回了一条消息</text>
				<text v-else>{{item.sendUser.nickname}}撤回了一条消息</text>
		</view>
		
		
	</view>
</template>

<style lang="scss">
	.red_envelope_tip{color:$ic-default-text ;font-size: 14px;padding: 10px;}
	.red_envelope_tip image{width: 15px;height: 15px;}
	.red_envelope_tip .red{color: #f25642;}
</style>


<script>
	import {mapState,mapMutations } from 'vuex';
	export default {
		computed: mapState(['user','sysData']),
		name: 'tip',
		props:{
			item : {
				type: Object,
				default: ()=>{return {data:{}} }
			}
		},
		
		watch:{
			item:{
				immediate:true,
				handler(val) {
					if(val.type == 'red_envelope_tip'){
						this.inItem = JSON.parse(val.data);
					}
					
					
						
					if(val.type == 'group_del')
						this.inItem = JSON.parse(val.data);
					
				}
			}
			
		},
		
		data() {
			return{ 
				inItem:{}
			}
		},
		created() { 
			
		},
		mounted() {
			
		},
		methods: {
			tapRed:function(){
				uni.navigateTo({ url:"/pages/chat/redpack/look?id=" + this.inItem.id});
			}
		}
	}
</script>  

<style>
</style>