import { View, ScrollView, Image, Input } from '@tarojs/components'
import { useCallback, useEffect, useMemo, useRef, useState, memo } from 'react'
import styles from "./index.module.scss"
import classnames from "classnames";

interface props {
    clickAdd: (any) => void,
    onInputEven: (a: any, c: any) => void,
    value: {
        showInput?: boolean,
        nums?: string
    }
}


export default memo((props: props) => {



    return (
        <View className={styles.goodsBox}>
            <Image className={styles.pic} mode={'aspectFill'} src={'https://test.cdn.zzfzyc.com/mall/no_img.png'}></Image>
            <View className={styles.rightGoodbox}>
                <View className={styles.leftFontsbox}>
                    <View className={styles.title}>001# 环保黑</View>
                    <View className={styles.productName}>0681# 26S全棉平纹</View>
                    <View className={styles.productNums}>剩:109件</View>
                </View>
                <View className={styles.rightFontsbox}>
                    <View className={styles.money}>¥37.50/kg</View>
                    {
                        props.value.showInput && <View className={styles.inputBox}>
                            <View className={styles.reduceBox}>
                                <View className={styles.reduce}>
                                </View>
                            </View>
                            <View className={styles.numsBox}>
                                <Input type='number' value={props.value.nums} onInput={($event) => props.onInputEven($event, props)}></Input>
                            </View>
                            <View className={styles.addBox}>
                                +
                            </View>
                        </View>
                    }
                    {
                        !props.value.showInput && <View className={styles.addtine} onClick={() => props.clickAdd(props.value)}>+</View>
                    }
                </View>
            </View>
        </View>
    )
})