import { moneyFormat } from '@/helpers/utils'
import { formateAttr } from '@/views/cart/cart'
import { Card } from 'vant'
import { defineComponent } from 'vue'
import styles from './index.module.less'

export default defineComponent({
  name: 'shop-item',
  props: {
    item: {
      type: Object,
      default: {
        productPic: '',
        productName: '',
        productAttr: '',
        productPrice: 0,
        productQuantity: 0
      }
    }
  },
  setup({ item }) {
    return () => (
      <Card
        class={styles.item}
        thumb={item.productPic}
        title={item.productName}
        desc={formateAttr(item.productAttr)}
        price={moneyFormat(item.productPrice)}
        num={item.productQuantity}
      ></Card>
    )
  }
})
