<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-stars :stars="parseInt(product.price1Grade)" :font-size='36' :width-info="180"></uni-stars>
				<view class="p-minBuy">起订量:<text class="min-text">{{minBuyNumber}}</text></view>
			</view>
			<view class="wrap-main-act">
				<view v-if="product.actStatus==1" class="floor-item-act">
					<view v-if="product.promotions.type == 1 && product.promotions.mode==1"  class="floor-tags" @click.stop="click">
						{{product.promotions.name}}<text v-if="hasLogin">:￥{{ product.price | NumFormat }}</text>
					</view>
					<view  v-else  class="floor-tags" @click.stop="click">{{product.promotions.name}}</view>	
				</view>
				<view v-if="product.actStatus ==0  &&  product.ladderPriceFlag==1" class="floor-item-act">
					<view class="floor-tags" @click.stop="click">阶梯价格</view>	
				</view>
				<view class="floor-item-btn">
					<view class="btn" @click.stop="loginClick">登录查看价格</view>
				</view>
			</view>
		</template>
		<template v-else>
			<view   v-if="userIdentity == 1" class="wrap-main-price">
				<view class="p-main">
					<view class="p-price tui-skeleton-fillet">
						<text class="txt sm">￥</text>
						<text class="txt big">{{retailPrice | NumFormat}}</text>
					</view>
					<view class="p-minBuy">起订量:<text class="min-text">{{minBuyNumber}}</text></view>
				</view>				
			</view>	
			<view v-if="userIdentity == 4">
				<view v-if="product.price1TextFlag == '1'" class="wrap-main-pricenone">
					<text class="wrap-main-text">￥未公开价格</text>
				</view>
				<view v-if="product.price1TextFlag == '2'" class="wrap-main-pricenone">
					<text class="wrap-main-text">￥价格仅会员可见</text>
				</view>
				<view  v-if="product.price1TextFlag == '0'" class="wrap-main-price">
					<view class="p-main">
						<view class="p-price tui-skeleton-fillet">
							<text class="txt sm">￥</text>
							<text class="txt big">{{retailPrice | NumFormat}}</text>
						</view>
					</view>
				</view>		
				<view class="p-minBuy">起订量:<text class="min-text">{{minBuyNumber}}</text></view>
			</view>
			<view v-if="userIdentity == 2">
				<view v-if="product.price1TextFlag == '1'" class="wrap-main-pricenone">
					<text class="wrap-main-text">￥未公开价格</text>
				</view>
				<view v-else class="wrap-main-price">
					<view class="p-main">
						<view class="p-price tui-skeleton-fillet">
							<text class="txt sm">￥</text>
							<text class="txt big">{{retailPrice | NumFormat}}</text>
						</view>
					</view>
				</view>	
				<view class="p-minBuy">起订量:<text class="min-text">{{minBuyNumber}}</text></view>
			</view>
			<view class="wrap-main-act">
				<view v-if="product.actStatus==1" class="floor-item-act">
					<view v-if="product.promotions.type == 1 && product.promotions.mode==1"  class="floor-tags" @click.stop="click">
						{{product.promotions.name}}<text v-if="hasLogin">:￥{{ product.price | NumFormat }}</text>
					</view>
					<view v-else class="floor-tags" @click.stop="click">{{product.promotions.name}}</view>	
				</view>
				<view  v-if="product.actStatus ==0  &&  product.ladderPriceFlag==1" class="floor-item-act">
					<view class="floor-tags" @click.stop="click">阶梯价格</view>	
				</view>
				<view v-if="userIdentity == 4" class="floor-item-btn">
					<view class="btn" @click.stop="goUpgradeApply">去升级会员查看价格</view>
				</view>
			</view>
		</template>
	</view>
</template>

<script>
	import { mapState,mapMutations } from 'vuex'
	export default{
		name:'cm-price',
		props:{
			product:{
				type:Object,
			},
			userIdentity: {
				type: Number,
				default: 2
			},
			ladderPriceList:{
				type: Array,
			},
			retailPrice:{
				type:String,
			},
			minBuyNumber:{
				type: Number,
				default: 1
			}
		},
		data() {
			return{
				
			}
		},
		filters: {
			NumFormat:function(text) {//处理金额
				return Number(text).toFixed(2);
			},
		},
		created() {
			
		},
		computed: {
			...mapState(['hasLogin','isWxAuthorize'])
		},
		methods:{
			goUpgradeApply(){
				this.$api.navigateTo('/pages/login/apply')
			},
			loginClick(){
				this.$api.navigateTo('/pages/login/login')
			}
		},
		
	}
</script>

<style lang="scss">	

</style>





















