Browse Source

Merge branch 'dev' of http://git.ycjcjy.com/shigongli/miniapp-v2 into dev

张延森 3 years ago
parent
commit
bd197dc91e

+ 2
- 2
src/components/List/index.jsx View File

32
     }
32
     }
33
   }
33
   }
34
 
34
 
35
-  const fetchList = (queryParams) => {
35
+  const fetchList = (params) => {
36
     if (!request) return;
36
     if (!request) return;
37
 
37
 
38
     Taro.showLoading()
38
     Taro.showLoading()
39
     loadingRef.current = true
39
     loadingRef.current = true
40
-    request(queryParams).then((res) => {
40
+    request(params).then((res) => {
41
       const { records, ...pageInfo } = res || {}
41
       const { records, ...pageInfo } = res || {}
42
       const lst = pageInfo.current === 1 ? records || [] : list.concat(records || [])
42
       const lst = pageInfo.current === 1 ? records || [] : list.concat(records || [])
43
       setList(lst)
43
       setList(lst)

+ 2
- 4
src/components/foodCards/foodCards.jsx View File

14
 
14
 
15
 //套餐卡片
15
 //套餐卡片
16
 export default (props) => {
16
 export default (props) => {
17
-  const { item } = props
17
+  const { item,star } = props
18
   const { shopId } = props.item
18
   const { shopId } = props.item
19
   const [isSaved, toggleSave] = useSave(item.isSaved, 'shop_package', item.packageId)
19
   const [isSaved, toggleSave] = useSave(item.isSaved, 'shop_package', item.packageId)
20
   const [city, setCity] = useState({})
20
   const [city, setCity] = useState({})
21
-  const [detail, setDetail] = useState({})
21
+  // const [detail, setDetail] = useState({})
22
 
22
 
23
 
23
 
24
 
24
 
39
 
39
 
40
   useEffect(() => {
40
   useEffect(() => {
41
     getShopDetail(item.shopId).then((res) => {
41
     getShopDetail(item.shopId).then((res) => {
42
-      setDetail(res)
43
       getShopcity(res.cityId).then((res2) => {
42
       getShopcity(res.cityId).then((res2) => {
44
         setCity(res2)
43
         setCity(res2)
45
       })
44
       })
46
     })
45
     })
47
   }, [])
46
   }, [])
48
-  const star = parseFloat(((detail.sweetScore + detail.environmentScore + detail.serviceScore) / 3).toFixed(1));
49
 
47
 
50
   return (
48
   return (
51
     <view className='foodCard'>
49
     <view className='foodCard'>

+ 1
- 1
src/hotel/components/HouseManage/houseManage.jsx View File

88
       setShowCard(false)
88
       setShowCard(false)
89
       return {
89
       return {
90
         title: room.roomName,
90
         title: room.roomName,
91
-        path: `/pages/index/index?tab=1&roomId=${room.roomId}&roomOrderId=${roomOrderId}`,
91
+        path: `/pages/index/index?tab=1&roomId=${room.roomId}&roomOrderId=${roomOrderId}&fromType=hotel&recommender=${hotel.hotelId}`,
92
         imageUrl: shareImage,
92
         imageUrl: shareImage,
93
       }
93
       }
94
     }
94
     }

+ 7
- 13
src/pages/details/foodDetails/foodDetails.jsx View File

38
   }, [id, subOrderId]);
38
   }, [id, subOrderId]);
39
 
39
 
40
   useEffect(() => {
40
   useEffect(() => {
41
-
42
     if (id && scene) {
41
     if (id && scene) {
43
       getVerifyTargetList({
42
       getVerifyTargetList({
44
         shopId: id,
43
         shopId: id,
45
         isMine: true,
44
         isMine: true,
46
         isVerified: 0,
45
         isVerified: 0,
47
       }).then((res) => {
46
       }).then((res) => {
48
-        if(res?.records?.length>0){
47
+        if (res?.records?.length > 0) {
49
           Taro.navigateTo({
48
           Taro.navigateTo({
50
             url: `/pages/TobeShop/index?id=${id}`,
49
             url: `/pages/TobeShop/index?id=${id}`,
51
           });
50
           });
52
         }
51
         }
53
-       
54
       });
52
       });
55
     }
53
     }
56
   }, [id, scene]);
54
   }, [id, scene]);
57
-  
55
+
58
   //商铺基础信息
56
   //商铺基础信息
59
   const [detail, setDetail] = useState({});
57
   const [detail, setDetail] = useState({});
60
   //商铺套餐
58
   //商铺套餐
112
 
110
 
113
   useEffect(() => {
111
   useEffect(() => {
114
     getShopDetail(id).then((res) => {
112
     getShopDetail(id).then((res) => {
113
+      console.log(res)
115
       setDetail(res);
114
       setDetail(res);
116
       log.current = res.locaton.toString().split(",")[0];
115
       log.current = res.locaton.toString().split(",")[0];
117
       lat.current = res.locaton.toString().split(",")[1];
116
       lat.current = res.locaton.toString().split(",")[1];
130
   }, []);
129
   }, []);
131
   const star = parseFloat(
130
   const star = parseFloat(
132
     (
131
     (
133
-      (detail.sweetScore + detail.environmentScore + detail.serviceScore) /
134
-      3
135
-    ).toFixed(1)
132
+      (detail.sweetScore + detail.environmentScore + detail.serviceScore) / 3).toFixed(1)
136
   );
133
   );
137
 
134
 
138
   // 分享
135
   // 分享
150
         <CustomNav title="十公里" />
147
         <CustomNav title="十公里" />
151
       </view>
148
       </view>
152
       <view
149
       <view
153
-        style={{ overflow: "auto", padding: "0 30rpx", background: "#F8F8F8" }}
150
+        style={{ overflow: "hidden", padding: "0 30rpx", height: '100%', background: "#F8F8F8" }}
154
       >
151
       >
155
         <scroll-view
152
         <scroll-view
156
           scroll-y="true"
153
           scroll-y="true"
157
-          scroll-view="true"
158
-          bindscrolltoupper="upper"
159
-          bindscrolltolower="lower"
160
-          bindscroll="scroll"
154
+          style={{ height: '100%' }}
161
         >
155
         >
162
           <view className="storeDetails">
156
           <view className="storeDetails">
163
             <Swiper
157
             <Swiper
232
               <text>返现套餐</text>
226
               <text>返现套餐</text>
233
             </view>
227
             </view>
234
             {(spackage || []).map((item) => (
228
             {(spackage || []).map((item) => (
235
-              <Cards star={star} item={item} />
229
+              <Cards star={star} item={item} detail={detail} />
236
             ))}
230
             ))}
237
             <view
231
             <view
238
               className="showMore"
232
               className="showMore"

+ 18
- 22
src/pages/details/mjDetails/sceneryDetails.jsx View File

11
 import withLayout from '@/layouts'
11
 import withLayout from '@/layouts'
12
 import { useState, useEffect, useRef } from 'react'
12
 import { useState, useEffect, useRef } from 'react'
13
 import { getTouristDetail, getExtendContent, getRecommendList } from '@/services/home'
13
 import { getTouristDetail, getExtendContent, getRecommendList } from '@/services/home'
14
-import { Swiper, SwiperItem,Button } from '@tarojs/components';
14
+import { Swiper, SwiperItem, Button } from '@tarojs/components';
15
 import useSave from "@/utils/hooks/useSave"
15
 import useSave from "@/utils/hooks/useSave"
16
 import useLike from "@/utils/hooks/useLike"
16
 import useLike from "@/utils/hooks/useLike"
17
 import Cards from '@/components/foodCards/foodCards.jsx'
17
 import Cards from '@/components/foodCards/foodCards.jsx'
18
-import Taro,{ useShareAppMessage } from '@tarojs/taro'
18
+import Taro, { useShareAppMessage } from '@tarojs/taro'
19
 import { getTouristDistance } from '@/services/home'
19
 import { getTouristDistance } from '@/services/home'
20
 import Extend from '../components/Extend/extend'
20
 import Extend from '../components/Extend/extend'
21
 import './sceneryDetails.less'
21
 import './sceneryDetails.less'
23
 
23
 
24
 
24
 
25
 export default withLayout((props) => {
25
 export default withLayout((props) => {
26
-  const { router, person ,location } = props
27
-  const { id} = props.router.params
26
+  const { router, person, location } = props
27
+  const { id } = props.router.params
28
   const [detail, setDetail] = useState({})
28
   const [detail, setDetail] = useState({})
29
   const [isSaved, toggleSave] = useSave(detail.isSaved, 'tourist', id)
29
   const [isSaved, toggleSave] = useSave(detail.isSaved, 'tourist', id)
30
   const [isLike, toggleLike] = useLike(detail.isLike, 'tourist', id)
30
   const [isLike, toggleLike] = useLike(detail.isLike, 'tourist', id)
31
-  const [distance,setDistance]=useState()
32
-  const [tslocation,setTsLocation]=useState('')
31
+  const [distance, setDistance] = useState()
33
   //banner图集数组
32
   //banner图集数组
34
   const [imglist, setimglist] = useState([])
33
   const [imglist, setimglist] = useState([])
35
   const [index, setIndex] = useState(0)
34
   const [index, setIndex] = useState(0)
73
       lat.current = (res.locaton).toString().split(',')[1]
72
       lat.current = (res.locaton).toString().split(',')[1]
74
       setDetail(res)
73
       setDetail(res)
75
       setimglist(res.imageList || [])
74
       setimglist(res.imageList || [])
76
-
77
     })
75
     })
78
     getExtendContent('tourist', id).then((res) => {
76
     getExtendContent('tourist', id).then((res) => {
79
       setExtend(res.records || [])
77
       setExtend(res.records || [])
80
       setAllextNum(res.total)
78
       setAllextNum(res.total)
81
       setNewextNum(res.records.length)
79
       setNewextNum(res.records.length)
82
     })
80
     })
83
-    getTouristDistance('tourist',id,{location:location}).then((res)=>{
81
+    getTouristDistance('tourist', id, { location: location }).then((res) => {
84
       setDistance((res.distance / 1000).toFixed(2))
82
       setDistance((res.distance / 1000).toFixed(2))
85
-      setTsLocation(res.lng + ',' + res.lat)
86
-    })    
87
-    getRecommendList({ location: tslocation }).then((res) => {
88
-      setRecommend(res || [])
83
+      getRecommendList({ location: res.lng + ',' + res.lat }).then((res2) => {
84
+        setRecommend(res2 || [])
85
+      })
89
     })
86
     })
90
-  }, []) 
87
+  }, [])
91
   // 分享
88
   // 分享
92
-  useShareAppMessage(()=>{
89
+  useShareAppMessage(() => {
93
     return {
90
     return {
94
       title: detail.touristName,
91
       title: detail.touristName,
95
       path: `/pages/details/mjDetails/sceneryDetails?id=${id}`,
92
       path: `/pages/details/mjDetails/sceneryDetails?id=${id}`,
96
       imageUrl: detail.poster,
93
       imageUrl: detail.poster,
97
     }
94
     }
98
-  
99
-})
95
+
96
+  })
100
   return (
97
   return (
101
     <view className='page-index'>
98
     <view className='page-index'>
102
       <view className='index-navbar'>
99
       <view className='index-navbar'>
103
         <CustomNav title='十公里' />
100
         <CustomNav title='十公里' />
104
       </view>
101
       </view>
105
-      <view style={{ overflow: 'auto', padding: '0 30rpx', background: '#F8F8F8' }}>
106
-        <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll">
102
+      <view style={{ overflow: 'hidden', padding: '0 30rpx', height: '100%', background: '#F8F8F8' }}>
103
+        <scroll-view scroll-y="true" style={{ height: '100%' }}>
107
           <view className='storeDetails'>
104
           <view className='storeDetails'>
108
             <Swiper
105
             <Swiper
109
               className='.swiper'
106
               className='.swiper'
150
             <view className='title'>
147
             <view className='title'>
151
               <image src={titlejd} />景点介绍
148
               <image src={titlejd} />景点介绍
152
             </view>
149
             </view>
153
-            {(extend||[]).map((item) => <Extend item={item} />)}
150
+            {(extend || []).map((item) => <Extend item={item} />)}
154
             <view className='showMore' style={{ display: newextNum == AllextNum ? 'none' : '' }} onClick={extendMore}>
151
             <view className='showMore' style={{ display: newextNum == AllextNum ? 'none' : '' }} onClick={extendMore}>
155
               <view>点击查看更多</view>
152
               <view>点击查看更多</view>
156
               <image src={showMore} className='moreTip' />
153
               <image src={showMore} className='moreTip' />
160
             <view className='title'>
157
             <view className='title'>
161
               <image src={titlems} />老板推荐好吃的
158
               <image src={titlems} />老板推荐好吃的
162
             </view>
159
             </view>
163
-            {(recommend||[]).map((item) => <Cards item={item} />)}
160
+            {(recommend || []).map((item) => <Cards item={item} />)}
164
           </view>
161
           </view>
165
           <view className='bottom'>已经到底了~</view>
162
           <view className='bottom'>已经到底了~</view>
166
         </scroll-view>
163
         </scroll-view>
167
       </view>
164
       </view>
168
       <view className='bottomTab'>
165
       <view className='bottomTab'>
169
-      <Button openType='share' className='sharebtn'>分享</Button>
166
+        <Button openType='share' className='sharebtn'>分享</Button>
170
         <view className='tab'>
167
         <view className='tab'>
171
           <image className='share' src={share} />分享
168
           <image className='share' src={share} />分享
172
         </view>
169
         </view>
177
           <image className='collection' src={isSaved > 0 ? ax : good} />{isSaved > 0 ? '已收藏' : '加入收藏'}
174
           <image className='collection' src={isSaved > 0 ? ax : good} />{isSaved > 0 ? '已收藏' : '加入收藏'}
178
         </view>
175
         </view>
179
       </view>
176
       </view>
180
-
181
     </view>
177
     </view>
182
   )
178
   )
183
 })
179
 })

+ 14
- 0
src/pages/index/tabs/Recommend.jsx View File

75
         </scroll-view>
75
         </scroll-view>
76
       </view>
76
       </view>
77
 
77
 
78
+
79
+
80
+      {/* <ScrollView
81
+      scrollY
82
+      onScrollToLower={handleScrollToLower}
83
+    >
84
+      
85
+      
86
+    </ScrollView> */}
87
+
88
+
89
+
90
+
91
+
78
       <List
92
       <List
79
         style={{ height: 'calc(100% - 145px)' }}
93
         style={{ height: 'calc(100% - 145px)' }}
80
         request={getResourceList}
94
         request={getResourceList}