import React, { useState } from 'react';
import { View, Image, Text } from '@tarojs/components';
import Price from '.././../components/price';
import Label from '../../components/label';
import Stepper from '../../components/stepper';
import { CompDefault, MetaProps } from '../data-channel';
import connect from '../connect';

export interface Props extends MetaProps {}

export interface State {}

const defaultValue: CompDefault<Props, State> = {
  props: {},
  state: {},
  meta: {},
};

/**
 * 列表项-一行两个
 */
const ListItemHalf: React.FC<Props> = () => {
  const [param1, setParam1] = useState(28);
  const imgUrl =
    'https://wanmi-b2b.oss-cn-shanghai.aliyuncs.com/fda56711d8ff081499c038b812692600.png';
  return (
    <View className='wm-list-item wm-list-item-half'>
      <Image src={imgUrl} className='img-bar img'></Image>
      <View className='info-box'>
        <View className='info-head'>
          <View className='title-box'>
            <Label name='自营' type='gold' />
            <Text className='title'>
              大戏哈hgjhjzv哈哈哈哈谢谢和先上课积极思红红火火恍恍惚惚h红红火火恍恍惚惚h
            </Text>
          </View>
          <View className='type-box desc'>
            <Text className='type-color'>灰色</Text>
            <Text className='size'>66CM</Text>
            <Text className='weight'>100g</Text>
          </View>
          <View className='label-box'>
            <Label name='女神节' type='red' />
            <Label name='满减' type='default' />
            <Label name='满减' type='default' />
          </View>
        </View>
        <View className='info-footer'>
          <View className='num-box'>
            <Price price={990.98} />
          </View>
          <View className='comments-box desc'>
            <Text className='comments'>17销量</Text>
            <Text className='comments-num'>8评论</Text>
            <Text className='comments'>100%好评</Text>
          </View>
          <View className='stepper-box'>
            <Stepper count={param1} getNum={(num) => setParam1(num)} />
          </View>
        </View>
      </View>
    </View>
  );
};
export default connect(ListItemHalf, defaultValue);
