<template name="second-price">
	<!-- 商品详情价格判断 -->
	<view class="wrap-main">
		<template v-if="!hasLogin">
			<view class="p-login grade tui-skeleton-fillet">
				<view class="floor-item-btn" v-if="product.detailTalkFlag !=2">
					<view class="btn-none" v-if="product.sold == 1"></view>
					<view class="btn" @click.stop="loginClick" v-else>登录查看价格></view>
				</view>
				<template  v-else>
					<text v-if="product.sold == 1"></text>
					<text v-else><text class="txt sm">￥</text>价格详聊</text>
				</template>
			</view>
		</template>
		<template v-else>
			<view class="wrap-main-item" v-if="identity == 1">
				<view class="p-price tui-skeleton-fillet">
					<text class="txt sm">￥</text>
					<text class="txt big">{{product.price | NumFormat}}</text>
				</view>
			</view>
			<view class="wrap-main-item" v-else>
				<view class="p-price tui-skeleton-fillet">
					<text class="txt big" v-if="product.detailTalkFlag==2">
						<text v-if="product.sold == 1"></text>
						<text v-else><text class="txt sm">￥</text>价格详聊</text>
					</text>
					<text class="txt big" v-else>
						<text v-if="product.sold == 1"></text>
						<text v-else><text class="txt sm">￥</text>{{product.price | NumFormat}}</text>
					</text>
				</view>
			</view>
		</template>
	</view>
</template>

<script>
	import { mapState,mapMutations } from 'vuex'
	export default{
		name:'second-price',
		props:{
			product:{
				type:Object,
			},
		},
		data() {
			return{
				
			}
		},
		filters: {
			NumFormat:function(text) {//处理金额
				return Number(text).toFixed(2);
			},
		},
		created() {
			console.log(this.product)
		},
		computed: {
			...mapState(['hasLogin','isWxAuthorize','identity'])
		},
		methods:{
			loginClick(){
				// 友盟埋点二手商品详情登录查看价格
				if(process.env.NODE_ENV != 'development'){
					this.$uma.trackEvent('Um_Event_SecondListLoginSubmit', {
						Um_Key_ProductId: `${this.product.productId}`,
						Um_Key_PageName: '二手详情登录查看价格',
						Um_Key_SourcePage: '二手商品详情',
					})
				}
				this.$api.navigateTo('/pages/login/login')
			},
		},
		
	}
</script>

<style lang="scss">	

</style>





















