import React, { useState } from 'react' import Taro from '@tarojs/taro' import { Input, Button, View, Label } from '@tarojs/components' import Popup from '@/components/Popup' import { newTravelMine } from '@/services/travel' import './style.less' export default (props) => { const { showCutover, onClose, onFinish } = props const [roomNum, setRoomNum] = useState('') const [loading, setLoading] = useState(false) const day = new Date(); const y = day.getFullYear(); const m = day.getMonth() + 1; const d = day.getDate(); const handelShare = () => { onClose() newTravelMine({ title: `我的行程三日游 ${y}-${m}-${d}`, dayNum: 3 }).then(res => { Taro.showToast({ title: '创建成功', icon: 'none', duration: 2000 }) Taro.navigateTo({ url: `/pages/Travel/Edit/index?id=${res.travelId}&dayNum=${res.dayNum}` }) }) } const handelClose = () => { setRoomNum() onClose() } const goIndex = () => { Taro.navigateTo({ url: '/pages/index/index' }) } return ( <Popup show={showCutover} maskClosable={showCutover} onClose={handelClose}> <View className='from-room srl'> <View> <View className='rzline' /><Label className='srl mg'>温馨提示</Label><View className='rzline' /> </View> <View className='tips'> <View>看看周边推荐</View> <View className='goindex' onClick={goIndex}>戳我快速查看 <View className='arrow'><View className='v1'></View><View className='v2'></View></View></View> </View> <View> <Button className='cancel' onClick={handelClose}>取消</Button> <Button className='btn' onClick={handelShare} loading={loading} disabled={loading}>确定</Button> </View> </View> </Popup> ) }