import { View } from '@tarojs/components'
import { useEffect, useState } from 'react'
import AddressList from '../AddressList'
import styles from './index.module.scss'
import Popup from '@/components/popup'

interface Params {
  show: boolean
  onClose: (val: boolean) => void
  onSelect: (val: any) => void
}
export default (props: Params) => {
  const [show, setShow] = useState(false)
  useEffect(() => {
    setShow(props.show)
  }, [props.show])
  const getSelect = (e) => {
    props.onSelect(e)
    props.onClose(false)
  }
  return <Popup show={show} showTitle={false} onClose={() => props.onClose(false)}>
    <View className={styles.order_address_list}>
      <View className={styles.order_address_title}>请选择收货地址2</View>
      <View className={styles.addressList_con}>
        <AddressList onSelect={getSelect} />
      </View>
    </View>
  </Popup>
}
