<template name="cm-price">
	<!-- 商品详情价格判断 -->
	<view class="wrap-main">
		<template v-if="!hasLogin">
			<view class="p-login grade tui-skeleton-fillet">
				<text class="p-no">￥</text>
				<uni-grader :grade="Number(product.priceGrade)"></uni-grader>
				<view class="floor-item-btn"> <view class="btn" @click.stop="loginClick">登录查看价格</view> </view>
			</view>
		</template>
		<template v-else>
			<view class="wrap-main-item">
				<view class="p-price tui-skeleton-fillet">
					<text class="txt sm">￥</text>
					<text class="txt big">{{ product.price | NumFormat}}</text>
				</view>
			</view>
		</template>
	</view>
</template>

<script>
import { mapState, mapMutations } from 'vuex'
import uniGrader from '@/components/uni-grade/uni-grade.vue'
export default {
	name: 'cm-price',
	components: {
		uniGrader
	},
	props: {
		product: {
			type: Object
		}
	},
	data() {
		return {
			popupShow: false,
			isIphoneX: this.$store.state.isIphoneX,
		}
	},
	filters: {
		NumFormat: function(text) {
			//处理金额
			return Number(text).toFixed(2)
		}
	},
	created() {
	},
	computed: {
		...mapState(['hasLogin', 'clubType']),
	},
	methods: {
		hidePopup() {
			this.popupShow = false
		},
		loginClick() {
			this.$api.navigateTo('/pages/login/login')
		}
	}
}
</script>

<style lang="scss">
.tui-flex-1 {
	flex: 1;
}
</style>
