import { View, Text, Image } from '@tarojs/components'
import Taro from '@tarojs/taro'
import './index.less'

const ProductCard = ({ product }) => {
  return (
    <View onClick={() => Taro.navigateTo({ url: `/pages/indexSub/productDetail/index?id=${product.id}` })} className='product-card'>
      <Image className='product-img' src={product.image_url} mode='aspectFill' />
      <View className='product-content'>
        <Text className='title'>{product.item_title}</Text>
        <View className='price-row'>
          <Text className='price'>
            <Text className='currency'>¥</Text>
            {product.reserve_price}
          </Text>
          {
            product.original_price!='0.00'&&<Text className='original-price'>¥{product.original_price}</Text>
          }
        </View>
      </View>
    </View>
  )
}

export default ProductCard