<template>
	<view>
		<block v-if="isPoint">
			<text class="text-price lf-font-48 lf-font-bold lf-color-price">{{ showPrice(1) }}</text>
			<text class="lf-font-28 lf-font-bold lf-color-price">.{{ showPrice(2) }}</text>
		</block>
		<block v-else>
			<text class="text-price lf-font-48 lf-font-bold lf-color-price">{{ showPrice() }} <text class="lf-font-24 lf-color-777 lf-m-l-10"><text v-if="iftext">起</text></text> </text>
		</block>
	</view>
</template>

<script>
	export default {
		props: {
			price: {
				type: [Number, String],
				default: ''
			},
			iftext: {
				type: Boolean,
				default: true
			}
		},
		computed: {
			// 是否存在小数点
			isPoint(){
				let price = parseFloat(this.$props.price).toString();
				return price.indexOf('.') >= 0;
			},
			showPrice(){
				let price = parseFloat(this.$props.price).toString(); // 过滤价格出现.00的情况
				return function(type){
					let price_arr = price.split('.');
					if(type == 1){
						return price_arr[0];
					}else if(type == 2){
						return price_arr[1];
					}else{
						return price_arr[0];
					}
				}
			}
		}
	}
</script>

<style lang="scss" scoped="scoped">
	
</style>
