import {View, Text, Textarea} from '@tarojs/components';
import {Switch} from '@antmjs/vantui';
import classNames from 'classnames';

export default function Exception({checked, onChange, note, onNoteChange}) {
  return (
    <>
      <View className='flex items-center'>
        <Switch
          activeColor='#58C6EA'
          checked={checked}
          onChange={e => onChange(e.detail)}
          size='20px'
        />
        <Text className='text-sm text-[#999] ml-2'>异常订单</Text>
      </View>

      <Textarea
        value={note}
        onInput={e => onNoteChange(e.detail.value)}
        className={classNames(
          'border border-solid border-gray-200 rounded-md mt-3 w-[calc(100%-32px)] p-4 text-sm',
          {hidden: !checked},
        )}
        placeholder='请输入异常原因'
      />
    </>
  );
}
