index.jsx 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import React, { useState } from 'react'
  2. import Taro from '@tarojs/taro'
  3. import { Input, Button, View, Label } from '@tarojs/components'
  4. import Popup from '@/components/Popup'
  5. import { newTravelMine } from '@/services/travel'
  6. import './style.less'
  7. export default (props) => {
  8. const { showCutover, onClose, onFinish } = props
  9. const [roomNum, setRoomNum] = useState('')
  10. const [loading, setLoading] = useState(false)
  11. const day = new Date();
  12. const y = day.getFullYear();
  13. const m = day.getMonth() + 1;
  14. const d = day.getDate();
  15. const handelShare = () => {
  16. onClose()
  17. newTravelMine({ title: `我的行程三日游 ${y}-${m}-${d}`, dayNum: 3 }).then(res => {
  18. Taro.showToast({
  19. title: '创建成功',
  20. icon: 'none',
  21. duration: 2000
  22. })
  23. Taro.navigateTo({ url: `/pages/Travel/Edit/index?id=${res.travelId}&dayNum=${res.dayNum}` })
  24. })
  25. }
  26. const handelClose = () => {
  27. setRoomNum()
  28. onClose()
  29. }
  30. const goIndex = () => {
  31. Taro.navigateTo({ url: '/pages/index/index' })
  32. }
  33. return (
  34. <Popup show={showCutover} maskClosable={showCutover} onClose={handelClose}>
  35. <View className='from-room srl'>
  36. <View>
  37. <View className='rzline' /><Label className='srl mg'>温馨提示</Label><View className='rzline' />
  38. </View>
  39. <View className='tips'>
  40. <View>看看周边推荐</View>
  41. <View className='goindex' onClick={goIndex}>戳我快速查看
  42. <View className='arrow'><View className='v1'></View><View className='v2'></View></View></View>
  43. </View>
  44. <View>
  45. <Button className='cancel' onClick={handelClose}>取消</Button>
  46. <Button className='btn' onClick={handelShare} loading={loading} disabled={loading}>确定</Button>
  47. </View>
  48. </View>
  49. </Popup>
  50. )
  51. }