浏览代码

Merge branch 'master' of http://git.ycjcjy.com/shigongli/client-miniapp

张延森 4 年前
父节点
当前提交
ddb2489be2

+ 2
- 2
config/dev.js 查看文件

4
     NODE_ENV: '"development"'
4
     NODE_ENV: '"development"'
5
   },
5
   },
6
   defineConstants: {
6
   defineConstants: {
7
-    HOST: '"http://localhost:7080"',
7
+    // HOST: '"http://localhost:7080"',
8
     // HOST: '"https://sgl.ycjcjy.com"',
8
     // HOST: '"https://sgl.ycjcjy.com"',
9
     // HOST: '"http://192.168.31.68:7080"',
9
     // HOST: '"http://192.168.31.68:7080"',
10
-    // HOST: '"http://192.168.211.181:7080"',
10
+    HOST: '"http://192.168.211.181:7080"',
11
  
11
  
12
     // OSS_PATH: "https://njcj.oss-cn-shanghai.aliyuncs.com/",
12
     // OSS_PATH: "https://njcj.oss-cn-shanghai.aliyuncs.com/",
13
     // OSS_FAST_PATH: "https://njcj.oss-accelerate.aliyuncs.com/",
13
     // OSS_FAST_PATH: "https://njcj.oss-accelerate.aliyuncs.com/",

+ 11
- 7
src/pages/customer/index.js 查看文件

27
   }
27
   }
28
 
28
 
29
   useEffect(() => {
29
   useEffect(() => {
30
+    
30
     if(props.orderId){
31
     if(props.orderId){
31
-      request({url: `/taHouseOrder/{props.orderId}`,}).then(res=>{
32
+      request({url: `/taHouseOrder/${props.orderId}`,}).then(res=>{
32
         const data = res.data.data
33
         const data = res.data.data
34
+        console.log(data,'props.orderId')
33
         setOrderInfo(data)
35
         setOrderInfo(data)
34
-        regUnFinished(data.status !== 1)
36
+        setRegUnFinished(data.status !== 1)
35
       })
37
       })
36
     }
38
     }
37
   }, [props.orderId])
39
   }, [props.orderId])
43
   }, [props.orderId, regUnFinished])
45
   }, [props.orderId, regUnFinished])
44
   
46
   
45
   useEffect(() => {
47
   useEffect(() => {
48
+    console.log(props.houseId && (!props.orderId || !regUnFinished),'data')
46
     if(props.houseId && (!props.orderId || !regUnFinished)){
49
     if(props.houseId && (!props.orderId || !regUnFinished)){
47
       request({url: `/taHouse/${props.houseId}`,}).then(res=>{
50
       request({url: `/taHouse/${props.houseId}`,}).then(res=>{
48
         const data = res.data.data
51
         const data = res.data.data
52
+        console.log(data,'data')
49
         setHouseInfo(data)
53
         setHouseInfo(data)
50
         setPageState('2')
54
         setPageState('2')
51
       })
55
       })
59
   }, [props.houseId, props.orderId, regUnFinished])
63
   }, [props.houseId, props.orderId, regUnFinished])
60
  
64
  
61
   return (
65
   return (
62
-    <View className='index'>
66
+    <View className='index' >
63
       {pageState=='1'&&<Register oderId={orderId} dataSource={orderInfo} onFinished={handleRegisterFinished}></Register>}
67
       {pageState=='1'&&<Register oderId={orderId} dataSource={orderInfo} onFinished={handleRegisterFinished}></Register>}
64
 
68
 
65
-      <Layout>
69
+      {pageState!='1'&&<Layout>
66
         {pageState=='2'&&<Guide houseId={houseId} dataSource={houseInfo}></Guide>  }
70
         {pageState=='2'&&<Guide houseId={houseId} dataSource={houseInfo}></Guide>  }
67
         {pageState=='3'&&<Recommend houseId={houseId} dataSource={surroundList}></Recommend>  }
71
         {pageState=='3'&&<Recommend houseId={houseId} dataSource={surroundList}></Recommend>  }
68
-      </Layout>
69
-    
70
-      {!!houseId && (
72
+      </Layout>}
73
+    {/* !!houseId&& */}
74
+      {pageState!='1' && (
71
         <Tab
75
         <Tab
72
           value={['入住指引','房东推荐']}
76
           value={['入住指引','房东推荐']}
73
           pageState={pageState}
77
           pageState={pageState}

+ 3
- 5
src/pages/customer/register/index.jsx 查看文件

2
 import './register.scss'
2
 import './register.scss'
3
 import { View, Text, Input } from '@tarojs/components'
3
 import { View, Text, Input } from '@tarojs/components'
4
 import ContainerLayout from '../../../compents/container/index'
4
 import ContainerLayout from '../../../compents/container/index'
5
-import { AtInput } from 'taro-ui'
5
+// import { AtInput } from 'taro-ui'
6
 import Tab from '../../../compents/tab'
6
 import Tab from '../../../compents/tab'
7
 import Layout from '../../../layout'
7
 import Layout from '../../../layout'
8
 import request from '@/util/request'
8
 import request from '@/util/request'
55
 
55
 
56
   return (
56
   return (
57
     <View className='register-user'>
57
     <View className='register-user'>
58
-      <Text>入住人{props.index}</Text>
58
+      <Text>入住人{props.index+1}</Text>
59
       <ContainerLayout className='register-user-from'>
59
       <ContainerLayout className='register-user-from'>
60
         {console.log(name,phone,'name,phone')}
60
         {console.log(name,phone,'name,phone')}
61
         <Input name="name" className='register-user-from-input' value={name} onInput={handeNameChange} placeholder='姓名' type='text' />
61
         <Input name="name" className='register-user-from-input' value={name} onInput={handeNameChange} placeholder='姓名' type='text' />
67
 
67
 
68
 const register = (props) => {
68
 const register = (props) => {
69
 
69
 
70
-  const { orderId } = props
71
-
72
   let [list, setList] = useState([])
70
   let [list, setList] = useState([])
73
   useEffect(() => {
71
   useEffect(() => {
74
     if (props.dataSource) {
72
     if (props.dataSource) {
116
     setList([...list])
114
     setList([...list])
117
   }
115
   }
118
 
116
 
119
-  return <View className='register'>
117
+  return <View className='register' >
120
     <Layout>
118
     <Layout>
121
       {list.map((x, index) => {
119
       {list.map((x, index) => {
122
         let inx = index
120
         let inx = index

+ 67
- 42
src/pages/house/household/index.jsx 查看文件

1
-import React, { useEffect, useMemo, useState,useRef } from 'react'
2
-import Taro from '@tarojs/taro'
1
+import React, { useEffect, useMemo, useState } from 'react'
2
+import Taro, { useRouter } from '@tarojs/taro'
3
 import './index.scss'
3
 import './index.scss'
4
-import { View, Text, Input,Image } from '@tarojs/components'
4
+import { View, Text, Input, Image } from '@tarojs/components'
5
 import ContainerLayout from '../../../compents/container/index'
5
 import ContainerLayout from '../../../compents/container/index'
6
 import radio from '../../../assets/radio.png'
6
 import radio from '../../../assets/radio.png'
7
 import Layout from '../../../layout/index'
7
 import Layout from '../../../layout/index'
8
+import request from '../../../util/request'
9
+import groupby from 'lodash.groupby';
10
+
8
 const house = (props) => {
11
 const house = (props) => {
9
 
12
 
10
-  const [list, setList] = useState([])
11
-  const [radioHouse, setRadioHouse] = useState()
12
-  
13
-    const ref = useRef();
14
-    useEffect(() => {
15
-      ref.current = 3;
16
-    });
17
-  
18
-  
19
-
20
-  const radioHouseState = useMemo(()=>props.radioHouseState,[props.radioHouseState])
21
-  wx.setNavigationBarTitle({
22
-    title: '民宿房源管理'
23
-  })
24
-console.log(props,radioHouseState)
13
+  const router = useRouter()
14
+  const { houseId } = router.params
15
+
16
+  const [list, setList] = useState({})
17
+
18
+
19
+
25
   useEffect(() => {
20
   useEffect(() => {
26
-    setList([
27
-      {
28
-        id:1,
29
-        name: 'zhou',
30
-        phone: '177'
31
-      },
32
-      {
33
-        id:2,
34
-        name: 'zhou',
35
-        phone: '177'
36
-      },
37
-      {
38
-        id:3,
39
-        name: 'zhou',
40
-        phone: '177'
41
-      }
42
-    ])
21
+    getList()
43
   }, [])
22
   }, [])
44
 
23
 
45
-  const onShare = () => {
46
-    Taro.navigateTo({ url: "/pages/share/index" })
24
+  const getList = () => {
25
+    request({ url: '/taHousePerson',params:{houseId:houseId,pageSize:9999} }).then((res) => {
26
+      const { records, ...page } = res.data.data
27
+      console.log(groupby(records, item => item.orderId))
28
+      setList(groupby(records, item => item.orderId))
29
+      //   {
30
+      //   const [date,_] = item.createDate.split('T')
31
+      //   return date
32
+      // }))
33
+    })
47
   }
34
   }
48
 
35
 
36
+  // {
49
 
37
 
38
+  //   Object.keys(list).map((item) => {
39
+  //       console.log(list[item], item, 'list[item]11')
50
 
40
 
41
+  //       return <View className='imglist-card'>
42
+  //           <View className='imglist-card-tags' style={{ display: 'flex' }}>
43
+  //               {/* imageimageimageimage34 */}
44
+  //               {list[item].map((x) => {
45
+  //                   return <View className='tag' s>{x.tagName}</View>
46
+  //               })}
47
+  //           </View>
48
+  //           <Image src={list[item][0].image} style={{ width: '100%' }} onClick={() => { setData(list[item]); setIsOpened(true) }}></Image>
49
+  //       </View>
50
+  //   })
51
+  // }
51
   return <View className='household'>
52
   return <View className='household'>
52
 
53
 
53
     <Layout>
54
     <Layout>
54
-      <View className='household-text'>vjoaphepionvodashvoia</View>
55
-    {list.map((x, index) => {
55
+      {/* <View className='household-text'>vjoaphepionvodashvoia</View> */}
56
+
57
+      {
58
+        Object.keys(list).map((item) => {
59
+          return <View className='household-view'>
60
+            {/* {index + 1} */}
61
+            <Text className='household-view-title'>订单编号:{item}</Text>
62
+            <ContainerLayout className='household-view-card'>
63
+              {list[item].map((x) => {
64
+                return <view>{x.name}: {x.phone}</view>  
65
+              })}
66
+              {list[item].length == 0 && '暂无入住人信息'}
67
+
68
+            </ContainerLayout>
69
+
70
+          </View>
71
+        })
72
+
73
+      }
74
+      {
75
+        Object.keys(list).length === 0 && <view style={{textAlign:'center',paddingTop:30}}>
76
+           暂无入住信息
77
+        </view>
78
+      }
79
+
80
+      {/* {list.map((x, index) => {
56
       return <View className='household-view'>
81
       return <View className='household-view'>
57
 
82
 
58
         <Text className='household-view-title'>入住日期:{index + 1}</Text>
83
         <Text className='household-view-title'>入住日期:{index + 1}</Text>
63
 
88
 
64
       </View>
89
       </View>
65
 
90
 
66
-    })}
91
+    })} */}
67
     </Layout>
92
     </Layout>
68
-   
69
-   
93
+
94
+
70
   </View>
95
   </View>
71
 }
96
 }
72
 
97
 

+ 1
- 1
src/pages/house/household/index.scss 查看文件

24
       margin-top: 26.67px;
24
       margin-top: 26.67px;
25
       position: relative;
25
       position: relative;
26
       min-height: 150px;
26
       min-height: 150px;
27
-
27
+line-height: 45px;
28
  text-align: center;
28
  text-align: center;
29
 background-color:#274291;
29
 background-color:#274291;
30
 
30
 

+ 26
- 19
src/pages/house/index.jsx 查看文件

20
     const [userRole, setUserRole] = useState('1')
20
     const [userRole, setUserRole] = useState('1')
21
     const [pageState, setPageState] = useState('2')
21
     const [pageState, setPageState] = useState('2')
22
     const [list, setList] = useState([])
22
     const [list, setList] = useState([])
23
-    useEffect(() => {
24
-
25
-        setList([
26
-            {
27
-                name: 'zhou',
28
-                phone: '177'
29
-            },
30
-            {
31
-                name: 'zhou',
32
-                phone: '177'
33
-            },
34
-            {
35
-                name: 'zhou',
36
-                phone: '177'
37
-            }
38
-        ])
39
-    }, [])
23
+    const [dataSource, setDataSource] = useState([])
24
+    const [imgSource, setImgSource] = useState([])
25
+    useDidShow(() => {
26
+        if (houseId) {
27
+            getDetail()
28
+            getImageList()
29
+        }
30
+    })
31
+
32
+    const getImageList=()=>{
33
+        request({url:'/taHouseSurround',params:{houseId:houseId}}).then((res)=>{
34
+            const {records,...page} =res.data.data  
35
+            setImgSource(records)
36
+        })
37
+    }
38
+
39
+    const getDetail = () => {
40
+        request({ url: `/taHouse/${houseId}` }).then((res) => {
41
+            setDataSource(res.data.data)
40
 
42
 
43
+            wx.setNavigationBarTitle({
44
+                title: res.data.data.title
45
+            })
46
+        })
47
+    }
41
     
48
     
42
 
49
 
43
     const onTabClick = (e) => {
50
     const onTabClick = (e) => {
56
         <View >
63
         <View >
57
 
64
 
58
             <Layout>
65
             <Layout>
59
-                {pageState == '2' && <Guide houseId={houseId}></Guide>}
60
-                {pageState == '3' && <Recommend houseId={houseId}></Recommend>}
66
+                {pageState == '2' && <Guide houseId={houseId} dataSource={dataSource}></Guide>}
67
+                {pageState == '3' && <Recommend houseId={houseId} dataSource={imgSource}></Recommend>}
61
             </Layout>
68
             </Layout>
62
             {pageState != '1' && <Tab value={['入住指引', '房东推荐']} pageState={pageState} onClick={[(e) => setPageState('2'), (e) => setPageState('3')]}></Tab>}
69
             {pageState != '1' && <Tab value={['入住指引', '房东推荐']} pageState={pageState} onClick={[(e) => setPageState('2'), (e) => setPageState('3')]}></Tab>}
63
 
70
 

+ 52
- 40
src/pages/share/index.jsx 查看文件

2
 // import { useEffect, useLayoutEffect, useReducer, useState, useContext, useRef, useCallback, useMemo } from '@tarojs/taro'
2
 // import { useEffect, useLayoutEffect, useReducer, useState, useContext, useRef, useCallback, useMemo } from '@tarojs/taro'
3
 import Taro, { useShareAppMessage, useRouter } from "@tarojs/taro";
3
 import Taro, { useShareAppMessage, useRouter } from "@tarojs/taro";
4
 import { useSelector, } from 'react-redux'
4
 import { useSelector, } from 'react-redux'
5
-import { View, Input, Text, Image ,Picker } from '@tarojs/components'
5
+import { View, Input, Text, Image, Picker } from '@tarojs/components'
6
 import Layout from '../../layout/index'
6
 import Layout from '../../layout/index'
7
 import Tab from '../../compents/tab/index'
7
 import Tab from '../../compents/tab/index'
8
 import Container from '../../compents/container/index'
8
 import Container from '../../compents/container/index'
30
     const [userRole, setUserRole] = useState('1')
30
     const [userRole, setUserRole] = useState('1')
31
     const [pageState, setPageState] = useState('1')
31
     const [pageState, setPageState] = useState('1')
32
     const [list, setList] = useState([])
32
     const [list, setList] = useState([])
33
-    const [number,setNumber] = useState()
34
-    const [startTime,setStartTime]=useState('')
35
-    const [endTime,setEndTime]=useState('')
33
+    const [personNum, setPersonNum] = useState()
34
+    const [startTime, setStartTime] = useState('')
35
+    const [endTime, setEndTime] = useState('')
36
     useEffect(() => {
36
     useEffect(() => {
37
 
37
 
38
         // console.log(page, 'page')
38
         // console.log(page, 'page')
52
         ])
52
         ])
53
     }, [])
53
     }, [])
54
     useShareAppMessage(res => {
54
     useShareAppMessage(res => {
55
-        console.log('3333')
55
+        Taro.showLoading({
56
+            title: '分享中',
57
+          })
56
         if (res.from === 'button') {
58
         if (res.from === 'button') {
57
             // 来自页面内转发按钮
59
             // 来自页面内转发按钮
58
             console.log(res.target)
60
             console.log(res.target)
59
         }
61
         }
60
-        const response =  syncAddOrder()
61
-        // /api/ma/taHouseSetting method:'post'
62
-        return {
63
-            title: '分享到微信',
64
-            path: `/pages/index/index?houseId=${houseId}&number=${number}&startTime=${startTime}&endTime=${endTime}`
62
+
63
+        const data = {
64
+            houseId,
65
+            personNum,
66
+            startDate: startTime,
67
+            endDate: endTime
65
         }
68
         }
69
+        return request({ url: '/taHouseSetting', method: 'post', data }).then(res => {
70
+            const { data } = res.data
71
+            if (res.data.data) {
72
+                console.log(data.taHouseOrder.orderId)
73
+                const { orderId } = data.taHouseOrder
74
+                return request({ url: `/taHouse/${houseId}/share` }).then(res => {
75
+                    Taro.hideLoading()
76
+                    return {
77
+                        title: '分享到微信',
78
+                        path: `/pages/index/index?houseId=${houseId}&personNum=${personNum}&startTime=${startTime}&endTime=${endTime}&orderId=${orderId}`
79
+                    }
80
+                })
81
+            } else {
82
+                Taro.showModal({
83
+                    title: '输入信息有误',
84
+                    content: '请重新输入',
85
+                    showCancel: false,
86
+                    success: function (res) {
87
+                        if (res.confirm) {
88
+                            console.log('用户点击确定')
89
+                        } else if (res.cancel) {
90
+                            console.log('用户点击取消')
91
+                        }
92
+                    }
93
+                })
94
+            }
95
+
96
+        })
97
+
98
+
99
+
66
     })
100
     })
67
 
101
 
68
     async function syncAddOrder() {
102
     async function syncAddOrder() {
69
-        const data={
70
-            houseId,
71
-            number,
72
-            startTime,
73
-            endTime
74
-        }
75
-      return  request({url:'/taHouseSetting',method:'post',data})
76
-      }   
103
+
104
+
105
+    }
77
 
106
 
78
     const onTimeChange = (e) => {
107
     const onTimeChange = (e) => {
79
         console.log(e, '111')
108
         console.log(e, '111')
82
 
111
 
83
 
112
 
84
     return <View className='share'>
113
     return <View className='share'>
85
-
86
-
87
-        {/* <View className='page-section'>
88
-            <Text>时间选择器</Text>
89
-            <View>
90
-              <Picker mode='time' onChange={this.onTimeChange}>
91
-                <View className='picker'>
92
-                  当前选择:{this.state.timeSel}
93
-                </View>
94
-              </Picker>
95
-            </View>
96
-          </View> */}
97
-
98
         <Layout>
114
         <Layout>
99
             <View className='inputstyle-view'>
115
             <View className='inputstyle-view'>
100
                 <Text className='title'>入住人数</Text>
116
                 <Text className='title'>入住人数</Text>
101
                 <Container className='inputstyle-view-card ' style={{ borderRadius: '20rpx', padding: '0 40rpx' }} >
117
                 <Container className='inputstyle-view-card ' style={{ borderRadius: '20rpx', padding: '0 40rpx' }} >
102
-                    <Input type='number' onInput={()=>setLngLat(e.detail.value)} placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
118
+                    <Input type='number' value={personNum} onInput={(e) => setPersonNum(e.detail.value)} placeholderClass='placeholderinput' className='input' type='text' placeholder='' />
103
                 </Container>
119
                 </Container>
104
             </View>
120
             </View>
105
             <View className='inputstyle-view'>
121
             <View className='inputstyle-view'>
107
                 <Container className='inputstyle-view-card ' style={{ borderRadius: '20rpx', padding: '0 40rpx' }} >
123
                 <Container className='inputstyle-view-card ' style={{ borderRadius: '20rpx', padding: '0 40rpx' }} >
108
 
124
 
109
                     <Picker mode='date' onChange={onTimeChange}>
125
                     <Picker mode='date' onChange={onTimeChange}>
110
-                        <View className='input' style={{height: '44rpx',lineHeight: '44rpx',fontsize: '28rpx'}}>
126
+                        <View className='input' style={{ height: '44rpx', lineHeight: '44rpx', fontsize: '28rpx' }}>
111
                             {startTime}
127
                             {startTime}
112
                         </View>
128
                         </View>
113
                     </Picker>
129
                     </Picker>
118
             <View className='inputstyle-view'>
134
             <View className='inputstyle-view'>
119
                 <Text className='title'>离店日期</Text>
135
                 <Text className='title'>离店日期</Text>
120
                 <Container className='inputstyle-view-card ' style={{ borderRadius: '20rpx', padding: '0 40rpx' }} >
136
                 <Container className='inputstyle-view-card ' style={{ borderRadius: '20rpx', padding: '0 40rpx' }} >
121
-                <Picker mode='date' onChange={(e)=>{setEndTime(e.detail.value)}}>
122
-                        <View className='input' style={{height: '44rpx',lineHeight: '44rpx',fontsize: '28rpx'}}>
137
+                    <Picker mode='date' onChange={(e) => { setEndTime(e.detail.value) }}>
138
+                        <View className='input' style={{ height: '44rpx', lineHeight: '44rpx', fontsize: '28rpx' }}>
123
                             {endTime}
139
                             {endTime}
124
                         </View>
140
                         </View>
125
                     </Picker>
141
                     </Picker>
126
                 </Container>
142
                 </Container>
127
             </View>
143
             </View>
128
         </Layout>
144
         </Layout>
129
-        <Tab openType="share" className='addhousetab' color='#ffffff' pageState='3' onClick={(e) => console.log(33)} value={['分享到微信']} ></Tab> 
130
-
131
-
132
-        {/* onClick={[(e) => setPageState('2'),style={{ display: 'contents' }} (e) => setPageState('1')]} */}
145
+        <Tab openType="share" className='addhousetab' color='#ffffff' pageState='3' onClick={(e) => console.log(33)} value={['分享到微信']} ></Tab>
133
 
146
 
134
-        {/* <Tab className='addhousetab' color='#ffffff' pageState='3' value={['分享到微信']} ></Tab> */}
135
 
147
 
136
     </View>
148
     </View>
137
 }
149
 }