import { Icon, Image } from 'vant' import { defineComponent } from 'vue' import styles from './index.module.less' import iconAddCart from '../../images/icon-add-cart.png' import iconSellOut from '../../images/icon-sell-out.png' import { moneyFormat } from '@/helpers/utils' export default defineComponent({ name: 'goods', props: { showAdd: { type: Boolean, default: true }, item: { type: Object, default: {} }, onItemClick: { type: Function, default: (item: any) => {} }, onBuyClick: { type: Function, default: (item: any) => {} } }, render() { const item = this.item return (
this.onItemClick(item)}>
{item.stock <= 0 && (
)}
{item.name}
{/* ¥{moneyFormat(item.originalPrice)} */}

{moneyFormat(item.price)}

{this.showAdd && ( { e.stopPropagation() item.stock > 0 && this.onBuyClick(item) }} /> )}
) } })