李志伟 3 年之前
父節點
當前提交
1a7291dbf6

+ 7
- 21
src/pages/Travel/customizedTravel/components/CustomDay/index.jsx 查看文件

@@ -8,7 +8,7 @@ import './style.less'
8 8
 
9 9
 
10 10
 export default (props) => {
11
-  const { showCutover, onClose, onFinish } = props
11
+  const { showCutover, onClose } = props
12 12
   const [datNum, setDayNum] = useState('')
13 13
   const [loading, setLoading] = useState(false)
14 14
 
@@ -19,42 +19,28 @@ export default (props) => {
19 19
   const d = day.getDate();
20 20
 
21 21
   const handelShare = (e) => {
22
-    onClose()
23
-
22
+    setLoading(true)
24 23
     newTravelMine({ title: `我的自定义行程 ${y}-${m}-${d}`, dayNum: datNum }).then(res => {
25
-      Taro.showToast({
26
-        title: '创建成功',
27
-        icon: 'none',
28
-        duration: 2000
29
-      })
30 24
       Taro.navigateTo({ url: `/pages/Travel/Edit/index?id=${res.travelId}&dayNum=${res.dayNum}` })
31
-
25
+      setLoading(false)
26
+      onClose()
32 27
     })
33
-
34
-
35
-    // Taro.navigateTo({url:'/pages/Travel/Edit/index'})
36 28
   }
37
-  const handelClose = (e) => {
38
-
39
-    onClose()
40
-  }
41
-
42 29
   const handelChangle = (e) => {
43 30
     setDayNum(e)
44
-
45 31
   }
46 32
   return (
47
-    <Popup show={showCutover} maskClosable={showCutover} onClose={handelClose}>
33
+    <Popup show={showCutover} maskClosable={showCutover} onClose={onClose}>
48 34
       <View className='from-room srl'>
49 35
         <View style={{ marginBottom: '25px' }}>
50 36
           <View className='rzline' /><Label className='srl mg'>温馨提示</Label><View className='rzline' />
51 37
         </View>
52 38
         <View className='srleft'>
53 39
           <Label>出行天数:</Label>
54
-          <Input onInput={(e) => handelChangle(e.detail.value)} value={datNum} type='number' maxlength='2' min='1' max='10' placeholder='请输入出行天数' />
40
+          <Input onInput={(e) => handelChangle(e.detail.value)} value={datNum} type='number' maxlength='1' min='1' placeholder='请输入出行天数' />
55 41
         </View>
56 42
         <View>
57
-          <Button className='cancel' onClick={handelClose}>取消</Button>
43
+          <Button className='cancel' onClick={onClose}>取消</Button>
58 44
           <Button className='btn' onClick={handelShare} loading={loading} disabled={loading}>确定</Button>
59 45
         </View>
60 46
       </View>

+ 0
- 57
src/pages/Travel/customizedTravel/components/ThreeModel/index.jsx 查看文件

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

+ 0
- 73
src/pages/Travel/customizedTravel/components/ThreeModel/style.less 查看文件

@@ -1,73 +0,0 @@
1
-.from-room{
2
-  padding-top: 60px;
3
-}
4
-.srl{
5
-  font-size: 30px;
6
-  font-weight: bold;
7
-  color: #202020;  
8
-  .mg{
9
-    font-size: 38px;
10
-    margin: 0 20px 50px 20px;
11
-  }
12
-  .rzline{
13
-    border-top: 2px #999 dashed;
14
-    height: 2px;
15
-    width: 80px;
16
-    display: inline-block;
17
-    margin-bottom: 8px;
18
-  }
19
-   .tips{
20
-    font-size: 30px;
21
-    font-weight: bold;
22
-    color: #333333;
23
-    letter-spacing: 5px; 
24
-    line-height: 50px;   
25
-    margin: 40px 0;
26
-    .goindex{
27
-      color: #274291;
28
-      position: relative;
29
-    }
30
-    .arrow{
31
-      position: absolute;
32
-      right: 150px;
33
-      top: 12px;  
34
-      .v1{
35
-        width: 0;
36
-        height: 0;
37
-        border: 15px solid transparent;
38
-        border-left-color: #274291;
39
-      }
40
-      .v2{
41
-        width: 0;
42
-        height: 0;
43
-        border: 15px solid transparent;
44
-        border-left-color: #fff;
45
-        position: absolute;
46
-        bottom: 0;
47
-        left: -5px;
48
-      }
49
-    }
50
-   }
51
-  .cancel{
52
-    color: #274290;
53
-    display: inline-block;
54
-    margin: 20px 20px 0 0;
55
-    width: 236px;
56
-    height: 78px;
57
-    line-height: 78px;
58
-    border: 2px solid #274190;
59
-    border-radius: 12px;
60
-  }
61
-  .btn {
62
-    width: 236px;
63
-    height: 78px;
64
-    line-height: 78px;
65
-    background: #274291;
66
-    border-radius: 12px;
67
-    display: inline-block;
68
-    color: #fff;
69
-  }
70
-}
71
-
72
-  
73
-  

+ 0
- 57
src/pages/Travel/customizedTravel/components/TipModel/index.jsx 查看文件

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

+ 0
- 73
src/pages/Travel/customizedTravel/components/TipModel/style.less 查看文件

@@ -1,73 +0,0 @@
1
-.from-room{
2
-  padding-top: 60px;
3
-}
4
-.srl{
5
-  font-size: 30px;
6
-  font-weight: bold;
7
-  color: #202020;  
8
-  .mg{
9
-    font-size: 38px;
10
-    margin: 0 20px 50px 20px;
11
-  }
12
-  .rzline{
13
-    border-top: 2px #999 dashed;
14
-    height: 2px;
15
-    width: 80px;
16
-    display: inline-block;
17
-    margin-bottom: 8px;
18
-  }
19
-   .tips{
20
-    font-size: 30px;
21
-    font-weight: bold;
22
-    color: #333333;
23
-    letter-spacing: 5px; 
24
-    line-height: 50px;   
25
-    margin: 40px 0;
26
-    .goindex{
27
-      color: #274291;
28
-      position: relative;
29
-    }
30
-    .arrow{
31
-      position: absolute;
32
-      right: 150px;
33
-      top: 12px;  
34
-      .v1{
35
-        width: 0;
36
-        height: 0;
37
-        border: 15px solid transparent;
38
-        border-left-color: #274291;
39
-      }
40
-      .v2{
41
-        width: 0;
42
-        height: 0;
43
-        border: 15px solid transparent;
44
-        border-left-color: #fff;
45
-        position: absolute;
46
-        bottom: 0;
47
-        left: -5px;
48
-      }
49
-    }
50
-   }
51
-  .cancel{
52
-    color: #274290;
53
-    display: inline-block;
54
-    margin: 20px 20px 0 0;
55
-    width: 236px;
56
-    height: 78px;
57
-    line-height: 78px;
58
-    border: 2px solid #274190;
59
-    border-radius: 12px;
60
-  }
61
-  .btn {
62
-    width: 236px;
63
-    height: 78px;
64
-    line-height: 78px;
65
-    background: #274291;
66
-    border-radius: 12px;
67
-    display: inline-block;
68
-    color: #fff;
69
-  }
70
-}
71
-
72
-  
73
-  

+ 7
- 19
src/pages/Travel/customizedTravel/components/TwoModel/index.jsx 查看文件

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

+ 22
- 35
src/pages/Travel/customizedTravel/index.jsx 查看文件

@@ -1,5 +1,5 @@
1 1
 import Taro from '@tarojs/taro'
2
-import { Image, Button, View, Text } from '@tarojs/components'
2
+import { Image, View } from '@tarojs/components'
3 3
 import React, { useState } from 'react'
4 4
 import CustomNav from '@/components/CustomNav'
5 5
 import oneDay from '@/assets/icons/Travel/oneDay.png'
@@ -7,66 +7,53 @@ import twoDay from '@/assets/icons/Travel/twoDay.png'
7 7
 import threeDay from '@/assets/icons/Travel/threeDay.png'
8 8
 import custom from '@/assets/icons/Travel/custom.png'
9 9
 import CustomDay from './components/CustomDay/index.jsx'
10
-import TipModel from './components/TipModel/index.jsx'
11 10
 import TwoModel from './components/TwoModel/index.jsx'
12
-import ThreeModel from './components/ThreeModel/index.jsx'
13 11
 import './style.less'
14 12
 
15 13
 export default (props) => {
14
+  //自定义弹窗标识位
16 15
   const [showCutover, setShowCutover] = useState(false)
17
-  const [showCutoverTip, setShowCutoverTip] = useState(false)
16
+  //标准天数弹窗标识位
18 17
   const [showCutoverTwo, setShowCutoverTwo] = useState(false)
19
-  const [showCutoverThree, setShowCutoverThree] = useState(false)
18
+  //汉字天数
19
+  const [dayNum1,setDayNum1]=useState()
20
+  //数字天数
21
+  const [dayNum2,setDayNum2]=useState()
22
+
20 23
   const onClose = () => {
21 24
     setShowCutover(false)
22
-  }
23
-  const handleFinish = (val) => {
24
-
25
-  }
26
-
27
-  const handleFinish2 = (val) => {
28
-
29 25
   }
30 26
   const handelCustom = () => {
31 27
     setShowCutover(true)
32 28
   }
33
-  const onCloseTip = () => {
34
-    //关闭一日游
35
-    setShowCutoverTip(false)
36
-  }
37 29
   const handelDay = () => {
38 30
     //打开一日游
39
-    setShowCutoverTip(true)
40
-  }
41
-  // ------------------
42
-  const onCloseTwo = () => {
43
-    //关闭二日游
44
-    setShowCutoverTwo(false)
45
-  }
31
+    setDayNum1('一')
32
+    setDayNum2(1)
33
+    setShowCutoverTwo(true)
34
+  }  
46 35
   const handelTowDay = () => {
47 36
     //打开二日游
37
+    setDayNum1('二')
38
+    setDayNum2(2)
48 39
     setShowCutoverTwo(true)
49 40
   }
50
-  // ------------------
51
-
52
-  const onCloseThree = () => {
53
-    //关闭三日游
54
-    setShowCutoverThree(false)
55
-  }
56 41
   const handelThreeDay = () => {
57 42
     //打开三日游
58
-    setShowCutoverThree(true)
43
+    setDayNum1('三')
44
+    setDayNum2(3)
45
+    setShowCutoverTwo(true)
46
+  }
47
+  const onCloseTwo = () => {    
48
+    setShowCutoverTwo(false)
59 49
   }
60 50
   return (
61 51
     <View className='page-index'>
62 52
       <View className='index-navbar'>
63 53
         <CustomNav title='定制行程' />
64 54
       </View>
65
-      <CustomDay showCutover={showCutover} onClose={onClose} onFinish={handleFinish} />
66
-      <TipModel showCutover={showCutoverTip} onClose={onCloseTip} />
67
-      <TwoModel showCutover={showCutoverTwo} onClose={onCloseTwo} />
68
-      <ThreeModel showCutover={showCutoverThree} onClose={onCloseThree} />
69
-
55
+      <CustomDay showCutover={showCutover} onClose={onClose} />
56
+      <TwoModel showCutover={showCutoverTwo} onClose={onCloseTwo} dayNum2={dayNum2} dayNum1={dayNum1}/>
70 57
       <View className='index-container custom'>
71 58
         <View className='selectbtn'>
72 59
           <Image src={oneDay} className='img' onClick={handelDay}></Image>