Bläddra i källkod

商铺详情v1

李志伟 3 år sedan
förälder
incheckning
fca4a567f5

Binär
src/assets/icons/housemantj/mj3.jpg Visa fil


+ 16
- 0
src/components/Star/Star.jsx Visa fil

1
+
2
+import hongxin from '@/assets/icons/housemantj/已收藏.png'
3
+import baixin from '@/assets/icons/housemantj/收藏.png'
4
+import './Star.less'
5
+export default (props) => {
6
+  const {star}=props
7
+  return (
8
+    <>
9
+      <image className='star' src={star >= 1 ? hongxin : baixin}></image>
10
+      <image className='star' src={star >= 2 ? hongxin : baixin}></image>
11
+      <image className='star' src={star >= 3 ? hongxin : baixin}></image>
12
+      <image className='star' src={star >= 4 ? hongxin : baixin}></image>
13
+      <image className='star' src={star >= 5 ? hongxin : baixin}></image>
14
+    </>
15
+  )
16
+}

+ 5
- 0
src/components/Star/Star.less Visa fil

1
+image{
2
+  width: 24px;
3
+  height: 24px;
4
+  margin-right: 10px;
5
+}

+ 56
- 0
src/components/foodCards/foodCards.jsx Visa fil

1
+import Star from '@/components/Star/Star.jsx'
2
+import pay from '@/assets/icons/housemantj/pay.png'
3
+import msTip from '@/assets/icons/housemantj/foodtip.png'
4
+import wz from '@/assets/icons/housemantj/location.png'
5
+import hongxin from '@/assets/icons/housemantj/已收藏.png'
6
+import baixin from '@/assets/icons/housemantj/收藏.png'
7
+import './style.less'
8
+import useSave from "@/utils/hooks/useSave"
9
+
10
+
11
+//套餐卡片
12
+export default (props) => {
13
+  const { star, item, city } = props
14
+  const [isSaved, toggleSave] = useSave(item.isSaved,'shop_package', item.packageId)
15
+  return (
16
+      <view className='foodCard'>
17
+        <view className='fCleft'>
18
+          <view className='backMoney'>
19
+            返现¥{item.cashback}
20
+          </view>
21
+          <view className='appraise'>
22
+            <Star star={star} />
23
+            <text className='storezf'>{star}</text>
24
+          </view>
25
+          <view>
26
+            <view className='contentImg'>
27
+              <image src={item.poster} className='img1' ></image>
28
+              <image src={msTip} className='mstip'></image>
29
+            </view>
30
+            <view className='neirong'>
31
+              <view className='textword'>{item.description}</view>
32
+              <view className='jiage'>
33
+                <text className='rmb' >¥&nbsp;&nbsp;</text>
34
+                <text className='p1'><text className='price' >{item.actualPrice}</text>元&nbsp;&nbsp;</text>
35
+                <text className='p2'>门市价<text className='oldprice' >{item.standardPrice}</text>元</text>
36
+              </view>
37
+              <view className='address'>
38
+                <image className='dw' src={wz} />
39
+                <text className='wz'>{city.areaPName}/{city.areaName}</text>
40
+                <view style={{display:'inline-block'}} onClick={toggleSave}>
41
+                <image className='star' src={isSaved>0?hongxin:baixin}></image>
42
+                <text className='collection'>{isSaved>0?'已收藏':'加入收藏'}</text>
43
+              </view>
44
+              </view>
45
+            </view>
46
+          </view>
47
+        </view>
48
+        <view className='fCright'>
49
+          <image src={pay} />
50
+          <view>支付</view>
51
+        </view>
52
+        <view className='columnLine'></view>
53
+      </view>
54
+    
55
+  )
56
+}

+ 135
- 0
src/components/foodCards/style.less Visa fil

1
+.foodCard{
2
+  background: #FFF;
3
+  box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.12);
4
+  border-radius: 12px;
5
+  position: relative;
6
+  margin-bottom: 30px;
7
+  overflow: hidden;
8
+  background: radial-gradient(circle at 82% top,transparent 20px,#fff 0) top,
9
+              radial-gradient(circle at 82% bottom,transparent 20px,#fff 0) bottom;
10
+  background-repeat: no-repeat;
11
+  background-size: auto 50%;
12
+  .fCleft{
13
+    float: left;
14
+    width: 82%;
15
+    .backMoney{
16
+      font-size: 24px;
17
+      font-weight: bold;
18
+      color: #FFF;
19
+      margin: 22px 40px 20px 0;        
20
+      padding: 12px 17px 9px 6px;
21
+      background:url('../../assets/icons/housemantj/fximg.png') no-repeat;    
22
+      display: inline-block;
23
+      background-size: 100% 100%;
24
+    }
25
+    .appraise{
26
+      display: inline-block;
27
+      image{
28
+        width: 21px;
29
+        height: 21px;
30
+        margin-right: 10px;
31
+      }
32
+      text{
33
+        font-size: 24px;           
34
+        font-weight: bold;
35
+        color: #020200;
36
+      }
37
+    }
38
+    .contentImg{
39
+      margin: 0 20px 43px 20px;
40
+      position: relative;
41
+      display: inline-block;
42
+      .img1{
43
+        width: 144px;
44
+        height: 144px;
45
+        border-radius: 24px;
46
+      }
47
+      .mstip{
48
+          width:99px;
49
+          height:37px;
50
+          position: absolute;
51
+          left: 0;          
52
+      }
53
+    }
54
+    .neirong{
55
+      display: inline-block;
56
+      width: 65%;
57
+      .textword{
58
+        font-size: 24px;           
59
+        color: #333;
60
+        margin: 0 21px 0 0;
61
+        height: 84px;
62
+      }
63
+      .jiage{
64
+        line-height: 20px;
65
+        font-weight: bold;
66
+        color: #333;
67
+        .rmb{
68
+          font-size: 20px;             
69
+          margin: 0 8px 0 7px;
70
+        }
71
+        .p1{
72
+          font-size: 24px;     
73
+        }
74
+        .p2{
75
+          font-size: 18px;             
76
+          text-decoration: line-through;
77
+          color: #666;
78
+        }
79
+      }
80
+      .address{
81
+        line-height: 0;
82
+        margin-top: 18px;
83
+        .dw{
84
+          width: 16px;
85
+          height: 20px;
86
+          position: relative;
87
+          top:3px;
88
+          margin-right: 10px;
89
+        }
90
+        .wz{
91
+          font-size: 20px;             
92
+          color: #333;
93
+        }
94
+        .star{
95
+          width: 21px;
96
+          height: 21px;
97
+          margin: 0 10px 0 40px;
98
+          position: relative;
99
+          top: 3px;
100
+        }
101
+        .collection{
102
+          font-size: 20px;             
103
+          color: #333333;
104
+        }
105
+      }
106
+    }
107
+  }
108
+  .fCright{
109
+    float: right;
110
+    width: 18%;
111
+    line-height: 0;
112
+    image{
113
+      width:35px;
114
+      height:32px;
115
+      margin-top: 120%;
116
+      margin-left:calc(50% - 15px)
117
+    }
118
+    view{
119
+      font-size: 24px;
120
+      line-height: 23px;
121
+      font-weight: bold;
122
+      color: #202020;
123
+      margin-top: 19px;
124
+      text-align: center;
125
+    }
126
+  }
127
+  .columnLine{
128
+    height: 50%;
129
+    border-right: 2px dashed #595959;
130
+    opacity: 0.12;
131
+    position: absolute;
132
+    right: 18%;
133
+    bottom:15%;
134
+  }
135
+}

+ 33
- 0
src/components/tip/index.jsx Visa fil

1
+import { Swiper, SwiperItem,View} from '@tarojs/components';
2
+import { getTipList} from '@/services/home'
3
+import { useState,useEffect } from 'react';
4
+import icontip from '@/assets/icons/housemantj/tip.png'
5
+import './index.less'
6
+
7
+export default ()=>{  
8
+  const [tips,setTips]=useState([])
9
+  useEffect(() => {
10
+    getTipList(1).then((res)=>{
11
+      setTips(res.records||[])
12
+    })
13
+  },[])
14
+    return (      
15
+      <view className='tip'>
16
+        <image className='tipicon' src={icontip} />
17
+      <Swiper
18
+      className='swp'
19
+        vertical
20
+        circular        
21
+        interval="3000"        
22
+        autoplay>
23
+          {
24
+            tips.map((item)=>
25
+              <SwiperItem>
26
+                <View>Tip:{item.content}</View>
27
+              </SwiperItem>
28
+            )
29
+          }        
30
+      </Swiper>
31
+      </view>
32
+    )  
33
+}

+ 19
- 0
src/components/tip/index.less Visa fil

1
+.tip{
2
+  padding:23px 0 22px 31px;
3
+  height: 70px;
4
+
5
+  .tipicon{
6
+    width: 17px;
7
+    height: 19px;
8
+    margin-right: 10px;
9
+    margin-bottom: 25px;
10
+  }
11
+  .swp{
12
+    width:90%;
13
+    display:inline-block;
14
+    line-height: 70px;
15
+    height: 70px;
16
+    font-size: 24px;
17
+    color: #999;
18
+  }
19
+}

+ 18
- 0
src/pages/details/components/extend.jsx Visa fil

1
+import { Video} from '@tarojs/components';
2
+
3
+export default (props) => {
4
+  const { item } = props
5
+  return (
6
+    <>{
7
+      item.contentType == 'image' ?
8
+        <image src={item.content} mode="widthFix" style={{width:'100%'}}/> :
9
+        item.contentType == 'text' ?
10
+          <view className='storezn'>{item.content}</view> :
11
+          <Video controls={true}
12
+          autoplay={false}
13
+          loop={false}
14
+          muted={false} style={{width:"100%",height:'200px'} } src={item.content} ></Video>
15
+    }
16
+    </>
17
+  )
18
+}

+ 120
- 256
src/pages/details/foodDetails/foodDetails.jsx Visa fil

1
 import CustomNav from '@/components/CustomNav'
1
 import CustomNav from '@/components/CustomNav'
2
-import { Icon } from '@tarojs/components'
3
-import Taro from '@tarojs/taro'
4
-import fd from '../../../assets/icons/housemantj/fd.jpg'
5
-import ax from '../../../assets/icons/housemantj/onlove.png'
6
-import huangxin from '../../../assets/icons/housemantj/已收藏.png'
7
-import baixin from '../../../assets/icons/housemantj/收藏.png'
8
-import yysj from '../../../assets/icons/housemantj/营业时间.png'
9
-import dw from '../../../assets/icons/housemantj/地址.png'
10
-import zhuandao from '../../../assets/icons/housemantj/backTop.png'
11
-import titlezs from '../../../assets/icons/housemantj/标题装饰.png'
12
-import pay from '../../../assets/icons/housemantj/pay.png'
13
-import ms2 from '../../../assets/icons/housemantj/ms2.jpg'
14
-import msTip from '../../../assets/icons/housemantj/foodtip.png'
15
-import wz from '../../../assets/icons/housemantj/location.png'
16
-import showMore from '../../../assets/icons/housemantj/查看更多.png'
17
-import dp from '../../../assets/icons/housemantj/dp.jpg'
18
-import znz from '../../../assets/icons/housemantj/znz.png'
19
-import location from '../../../assets/icons/housemantj/location.png'
20
-import mjImage from '../../../assets/icons/housemantj/mj.jpg'
21
-import glImage from '../../../assets/icons/housemantj/gl.jpg'
22
-import glTip from '../../../assets/icons/housemantj/gltip.png'
23
-import onlove from '../../../assets/icons/housemantj/爱心.png'
24
-import './foodDetails.less'
25
 import withLayout from '@/layouts'
2
 import withLayout from '@/layouts'
26
-
3
+import {getShopDetail,getShopPackage,getShopcity,getExtendContent} from '@/services/home'
4
+import { useState,useEffect } from 'react'
5
+import { Swiper, SwiperItem } from '@tarojs/components';
6
+import Star from '@/components/Star/Star.jsx'
7
+import Cards from '@/components/foodCards/foodCards.jsx'
8
+import ax from '@/assets/icons/housemantj/onlove.png'
9
+import yysj from '@/assets/icons/housemantj/营业时间.png'
10
+import dw from '@/assets/icons/housemantj/地址.png'
11
+import zhuandao from '@/assets/icons/housemantj/backTop.png'
12
+import titlezs from '@/assets/icons/housemantj/标题装饰.png'
13
+import showMore from '@/assets/icons/housemantj/查看更多.png'
14
+import './foodDetails.less'
15
+import Extend from '../components/extend'
27
 
16
 
28
 export default withLayout((props) => {
17
 export default withLayout((props) => {
29
   const { router, person } = props
18
   const { router, person } = props
19
+  const {id}=props.router.params
20
+  //商铺基础信息
21
+  const [detail,setDetail]=useState({})
22
+  //商铺套餐
23
+  const [spackage,setPackage]=useState([])
24
+  const [city,setCity]=useState({})
25
+  //banner图集数组
26
+  const [imlist,setimlist]=useState([])
27
+  const [index, setIndex] = useState(0)
28
+  const handchange = (e) => {
29
+    setIndex(e.detail.current)
30
+  }
31
+
32
+  //当前套餐总数
33
+  const [newpgNum,setNewpgNum]=useState(0)
34
+  //全部套餐个数
35
+  const [AllpgNum,setAllpgNum]=useState(0)
36
+  //套餐当前页数
37
+  const [page,setpage]=useState(2)
38
+  const pgMore=()=>{
39
+    setpage(page+1)
40
+    getShopPackage(id,{pageNum:page}).then((res)=>{
41
+      setPackage([...spackage,...res.records])
42
+      setNewpgNum(newpgNum+res.records.length)
43
+    })
44
+  }
45
+  //本店指南
46
+  const [extend,setExtend]=useState([])
30
 
47
 
31
-  return (
48
+  //当前指南总数
49
+  const [newextNum,setNewextNum]=useState(0)
50
+  //全部指南个数
51
+  const [AllextNum,setAllextNum]=useState(0)
52
+  //指南当前页数
53
+  const [epage,setepage]=useState(2)
54
+  const extendMore=()=>{
55
+    setepage(epage+1)
56
+    getExtendContent('shop',id,{pageNum:epage}).then((res)=>{
57
+      setExtend([...extend,...res.records])
58
+      setNewextNum(newextNum+res.records.length)
59
+    })
60
+  }
61
+  useEffect(()=>{
62
+    getShopDetail(id).then((res)=>{
63
+      setDetail(res)
64
+      setimlist(res.imageList||[])
65
+      getShopcity(res.cityId).then((res2)=>{
66
+        setCity(res2)
67
+      })
68
+    })
69
+    getShopPackage(id).then((res)=>{
70
+      setPackage(res.records||[])
71
+      setNewpgNum(res.records.length)
72
+      setAllpgNum(res.total)
73
+    })
74
+    getExtendContent('shop',id).then((res)=>{
75
+      setExtend(res.records||[])
76
+      setAllextNum(res.total)
77
+      setNewextNum(res.records.length)
78
+    })
79
+  },[])
80
+  const star=parseFloat(((detail.sweetScore+detail.environmentScore+detail.serviceScore)/3).toFixed(1)); 
81
+return (
32
     <view className='page-index'>
82
     <view className='page-index'>
33
       <view className='index-navbar'>
83
       <view className='index-navbar'>
34
         <CustomNav title='十公里' />
84
         <CustomNav title='十公里' />
35
       </view>
85
       </view>
36
       <view style={{overflow: 'auto', padding: '0 30rpx', background: '#F8F8F8' }}>
86
       <view style={{overflow: 'auto', padding: '0 30rpx', background: '#F8F8F8' }}>
37
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll">
87
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll">
38
-          <view className='storeDetails'>
39
-            <image src={fd} className='storeImage' >
40
-              <view className='tpPage'>
41
-                <text>1</text><text>/</text><text>64</text>
42
-              </view>
43
-            </image>
88
+          <view className='storeDetails'>           
89
+            <Swiper
90
+              className='.swiper'
91
+              circular
92
+              current={index}
93
+              onChange={handchange}
94
+            >
95
+              {
96
+                imlist.map((item) =>
97
+                  <SwiperItem>
98
+                    <image src={item.url} className='storeImage' >
99
+                      <view className='tpPage'>
100
+                        <text>{index + 1}</text><text>/</text><text>{imlist.length}</text>
101
+                      </view>
102
+                    </image>
103
+                  </SwiperItem>
104
+                )
105
+              }
106
+            </Swiper>                        
44
             <view className='storeJs'>
107
             <view className='storeJs'>
45
               <view style={{ overflow: 'hidden' }}>
108
               <view style={{ overflow: 'hidden' }}>
46
-                <view className='introduce'>
47
-                  <text className='storeName'>clip coffee</text>
48
-                  <text>¥</text><text className='price'><text>88</text>/人</text>
49
-                </view>
50
-                <view className='bz'>
51
-                  <image src={ax} style={{ width: '15px', height: '15px', marginRight: '11rpx', marginBottom: '-2px' }} />
52
-                  <text className='bzRight'>爆赞<text>9999+</text></text>
53
-                </view>
109
+                  <view className='storeName'>{detail.shopName}</view>
110
+                  <view className='sprice'>
111
+                    <text className='t1'>¥</text>
112
+                    {detail.averagePrice}/人                
113
+                    <view className='bzRight'>
114
+                      <image src={ax} style={{ width: '15px', height: '15px', marginRight: '11rpx', marginBottom: '-2px' }} />
115
+                    爆赞{detail.likeNum}</view>
116
+                  </view>
54
               </view>
117
               </view>
55
               <view className='appraise'>
118
               <view className='appraise'>
56
-                <image className='star' src={huangxin}></image>
57
-                <image className='star' src={huangxin}></image>
58
-                <image className='star' src={huangxin}></image>
59
-                <image className='star' src={huangxin}></image>
60
-                <image className='star' src={baixin}></image>
61
-                <text className='storezf'>4.5</text>
119
+                <Star star={star}/>
120
+                <text className='storezf'>{star}</text>
62
                 <view style={{float:'right',marginTop:'5px'}}>
121
                 <view style={{float:'right',marginTop:'5px'}}>
63
                   <text className='comment'>点评:</text>
122
                   <text className='comment'>点评:</text>
64
-                  <text className='t1'>口味:</text>
65
-                  <text className='flavor'>4</text>
66
-                  <text className='t1'>环境:</text>
67
-                  <text className='storehj'>3</text>
68
-                  <text className='t1'>服务</text>
69
-                  <text className='service'>4.5</text>
123
+                  <text className='t1'>口味:{detail.sweetScore}</text>
124
+                  <text className='t1'>环境:{detail.environmentScore}</text>
125
+                  <text className='t1'>服务:{detail.serviceScore}</text>
70
                 </view>
126
                 </view>
71
               </view>
127
               </view>
72
               <view className='yysj'>
128
               <view className='yysj'>
73
-                <image src={yysj} className='yysjImg' />
74
-                <text>营业时间:周一至周日 06:00-20:00</text>
129
+                <image src={yysj} className='yysjImg' />营业时间:{detail.businessHours}
75
               </view>
130
               </view>
76
-              <view className='dpPosition'>
131
+              <view className='dpPosition'> 
77
                 <image src={dw} className='dwTip' />
132
                 <image src={dw} className='dwTip' />
78
-                <view>
79
-                  <text>马道街夫子庙老门东小吃街三条营47号(地铁3号线武定门3号口步行8分钟)</text>
133
+                <view>{detail.address}
80
                   <image src={zhuandao} className='zhuandao' />
134
                   <image src={zhuandao} className='zhuandao' />
81
                 </view>
135
                 </view>
82
               </view>
136
               </view>
83
             </view>
137
             </view>
84
           </view>
138
           </view>
85
-          <view style={{ position: 'relative' }}>
139
+          <view style={{ position: 'relative',display:spackage?'':'none'}}>
86
             <view className='title'>
140
             <view className='title'>
87
               <image src={titlezs}></image>
141
               <image src={titlezs}></image>
88
               <text>返现套餐</text>
142
               <text>返现套餐</text>
89
             </view>
143
             </view>
90
             
144
             
91
-            <view className='foodCard'>
92
-              <view className='fCleft'>
93
-                <view className='backMoney'>
94
-                  返现¥2.04
95
-                </view>
96
-                <view className='appraise'>
97
-                  <image className='star' src={huangxin}></image>
98
-                  <image className='star' src={huangxin}></image>
99
-                  <image className='star' src={huangxin}></image>
100
-                  <image className='star' src={huangxin}></image>
101
-                  <image className='star' src={baixin}></image>
102
-                  <text className='storezf'>4.5</text>
103
-                </view>
104
-                <view>
105
-                  <view className='contentImg'>
106
-                    <image src={ms2} className='img1' ></image>
107
-                    <image src={msTip} className='mstip'></image>
108
-                  </view>
109
-                  <view className='neirong'>
110
-                    <view className='textword'>
111
-                      探店拥有“蓝色波浪”的咖啡店连手提袋都很特别手绘的...
112
-                    </view>
113
-                    <view className='jiage'>
114
-                      <text className='rmb' >¥&nbsp;&nbsp;</text>
115
-                      <text className='p1'><text className='price' >55</text>元&nbsp;&nbsp;</text>
116
-                      <text className='p2'>门市价<text className='oldprice' >78</text>元</text>
117
-                    </view>
118
-                    <view className='address'>
119
-                      <image className='dw' src={wz} />
120
-                      <text className='wz'>南京市/秦淮区</text>
121
-                      <image className='star' src={huangxin}></image>
122
-                      <text className='collection'>已收藏</text>
123
-                    </view>
124
-                  </view>
125
-                </view>
126
-              </view>
127
-              <view className='fCright'>
128
-                <image src={pay} />
129
-                <view>支付</view>
130
-              </view>
131
-              <view className='columnLine'></view>
132
-            </view>
133
-            <view className='foodCard'>
134
-              <view className='fCleft'>
135
-                <view className='backMoney'>
136
-                  返现¥2.04
137
-                </view>
138
-                <view className='appraise'>
139
-                  <image className='star' src={huangxin}></image>
140
-                  <image className='star' src={huangxin}></image>
141
-                  <image className='star' src={huangxin}></image>
142
-                  <image className='star' src={huangxin}></image>
143
-                  <image className='star' src={baixin}></image>
144
-                  <text className='storezf'>4.5</text>
145
-                </view>
146
-                <view style={{ overflow: 'hidden' }}>
147
-                  <view className='contentImg'>
148
-                    <image src={ms2} className='img1' ></image>
149
-                    <image src={msTip} className='mstip'></image>
150
-                  </view>
151
-                  <view className='neirong'>
152
-                    <view className='textword'>
153
-                      探店拥有“蓝色波浪”的咖啡店连手提袋都很特别手绘的...
154
-                    </view>
155
-                    <view className='jiage'>
156
-                      <text className='rmb' >¥&nbsp;&nbsp;</text>
157
-                      <text className='p1'><text className='price' >55</text>元&nbsp;&nbsp;</text>
158
-                      <text className='p2'>门市价<text className='oldprice' >78</text>元</text>
159
-                    </view>
160
-                    <view className='address'>
161
-                      <image className='dw' src={wz} />
162
-                      <text className='wz'>南京市/秦淮区</text>
163
-                      <image className='star' src={huangxin}></image>
164
-                      <text className='collection'>已收藏</text>
165
-                    </view>
166
-                  </view>
167
-                </view>
168
-              </view>
169
-              <view className='fCright'>
170
-                <image src={pay} />
171
-                <view>支付</view>
172
-              </view>
173
-              <view className='columnLine'></view>
174
-            </view>
175
-            <view className='showMore'>
145
+            {
146
+             spackage?.map((item)=><Cards star={star} item={item} city={city} />)
147
+            }
148
+            
149
+            <view className='showMore' style={{display:newpgNum==AllpgNum?'none':''}} onClick={pgMore}>
176
               <view>查看更多</view>
150
               <view>查看更多</view>
177
               <image src={showMore} className='moreTip' />
151
               <image src={showMore} className='moreTip' />
178
             </view>
152
             </view>
179
           </view>
153
           </view>
180
 
154
 
181
-          <view style={{ position: 'relative' }}>
155
+          <view style={{ position: 'relative',display:extend?'':'none' }}>
182
             <view className='title'>
156
             <view className='title'>
183
               <image src={titlezs}></image>
157
               <image src={titlezs}></image>
184
               <text>本店指南</text>
158
               <text>本店指南</text>
185
             </view>
159
             </view>
186
-            <view className='storezn'>
187
-              Lorem ipsum dolor sit amet, consectetur adipiscing elit,
188
-              sed do eiusmod tempor incididunt ut labore et dolore
189
-              magna aliqua. Quis ipsum suspendisse ultrices gravida.
190
-              Risus commodo viverra maecenas accumsan lacus vel
191
-              facilisis.
192
-            </view>
193
-            <image src={dp} mode='widthFix' />
194
-            <view className='storezn'>
195
-              Lorem ipsum dolor sit amet, consectetur adipiscing elit,
196
-              sed do eiusmod tempor incididunt ut labore et dolore
197
-              magna aliqua. Quis ipsum suspendisse ultrices gravida.
198
-              Risus commodo viverra maecenas accumsan lacus vel
199
-              facilisis.
200
-            </view>
201
-            <view className='foodCard'>
202
-              <view className='fCleft'>
203
-                <view className='backMoney'>
204
-                  返现¥2.04
205
-                </view>
206
-                <view className='appraise'>
207
-                  <image className='star' src={huangxin}></image>
208
-                  <image className='star' src={huangxin}></image>
209
-                  <image className='star' src={huangxin}></image>
210
-                  <image className='star' src={huangxin}></image>
211
-                  <image className='star' src={baixin}></image>
212
-                  <text className='storezf'>4.5</text>
213
-                </view>
214
-                <view style={{ overflow: 'hidden' }}>
215
-                  <view className='contentImg'>
216
-                    <image src={ms2} className='img1' ></image>
217
-                    <image src={msTip} className='mstip'></image>
218
-                  </view>
219
-                  <view className='neirong'>
220
-                    <view className='textword'>
221
-                      探店拥有“蓝色波浪”的咖啡店连手提袋都很特别手绘的...
222
-                    </view>
223
-                    <view className='jiage'>
224
-                      <text className='rmb' >¥&nbsp;&nbsp;</text>
225
-                      <text className='p1'><text className='price' >55</text>元&nbsp;&nbsp;</text>
226
-                      <text className='p2'>门市价<text className='oldprice' >78</text>元</text>
227
-                    </view>
228
-                    <view className='address'>
229
-                      <image className='dw' src={wz} />
230
-                      <text className='wz'>南京市/秦淮区</text>
231
-                      <image className='star' src={huangxin}></image>
232
-                      <text className='collection'>已收藏</text>
233
-                    </view>
234
-                  </view>
235
-                </view>
236
-              </view>
237
-              <view className='fCright'>
238
-                <image src={pay} />
239
-                <view>支付</view>
240
-              </view>
241
-              <view className='columnLine'></view>
242
-            </view>
243
-            <view className='storezn'>
244
-              Lorem ipsum dolor sit amet, consectetur adipiscing elit,
245
-              sed do eiusmod tempor incididunt ut labore et dolore
246
-              magna aliqua. Quis ipsum suspendisse ultrices gravida.
247
-            </view>
248
-            <view className='showMore'>
160
+            {extend?.map((item)=><Extend item={item} />)}
161
+            <view className='showMore' style={{display:newextNum==AllextNum?'none':''}} onClick={extendMore}>
249
               <view>查看更多</view>
162
               <view>查看更多</view>
250
               <image src={showMore} className='moreTip' />
163
               <image src={showMore} className='moreTip' />
251
             </view>
164
             </view>
252
           </view>
165
           </view>
253
-
254
-          <view className='title'>
255
-            <image src={znz} className='gltitle'></image>
256
-            <text>老板推荐的攻略</text>
257
-          </view>
258
-
259
-
260
-          <view className="waterfall">
261
-            <view className='contentCard'>
262
-              <view className='cardTop'>
263
-                <image mode='widthFix' src={mjImage} className='cCardimg' />
264
-                <image className='lefttips' src={glTip} />
265
-                <image src={onlove} className='loveharde'></image>
266
-              </view>
267
-              <view className='bContent'>
268
-                <view className='cCword'>
269
-                  超划算套餐?这么便宜也是第一次见6荤6素1...
270
-                </view>
271
-                <view className='cCleft'>
272
-                  <image src={location} className='cCicon'></image>
273
-                  <view className='distance'><text>9.99</text>公里</view>
274
-                </view>
275
-                <view className='cCright'>
276
-                  <view className='money'>¥</view>
277
-                  <view className='price'><text>999</text>/人</view>
278
-                </view>
279
-              </view>
280
-            </view>
281
-            <view className='contentCard'>
282
-              <view className='cardTop'>
283
-                <image mode='widthFix' src={glImage} className='cCardimg' />
284
-                <image className='lefttips' src={glTip} />
285
-                <image src={onlove} className='loveharde'></image>
286
-              </view>
287
-              <view className='bContent'>
288
-                <view className='cCword'>
289
-                  超划算套餐?这么便宜也是第一次见6荤6素1...
290
-                </view>
291
-                <view className='cCleft'>
292
-                  <image src={location} className='cCicon'></image>
293
-                  <view className='distance'>9.99公里</view>
294
-                </view>
295
-                <view className='cCright'>
296
-                  <view className='money'>¥</view>
297
-                  <view className='price'>999/人</view>
298
-                </view>
299
-              </view>
300
-            </view>
301
-          </view>
302
-          <view className='botton'>已经到底了~</view>
166
+           <view className='botton'>已经到底了~</view>
303
         </scroll-view>
167
         </scroll-view>
304
       </view>
168
       </view>
305
     </view>
169
     </view>

+ 36
- 255
src/pages/details/foodDetails/foodDetails.less Visa fil

1
 .storeDetails{
1
 .storeDetails{
2
   background-color: #fff;  
2
   background-color: #fff;  
3
   border-radius: 12px;
3
   border-radius: 12px;
4
+  margin-bottom: 20px;
5
+
6
+  .swiper{
7
+    height: calc((100vw - 60px) * 0.6);
8
+  }
4
   .storeImage{
9
   .storeImage{
5
     position: relative;
10
     position: relative;
6
     border-radius: 22px;
11
     border-radius: 22px;
7
     width: 100%;
12
     width: 100%;
13
+    height: 100%;
8
     .tpPage{
14
     .tpPage{
9
       position: absolute;
15
       position: absolute;
10
       right: 20px;
16
       right: 20px;
24
   }  
30
   }  
25
   .storeJs{
31
   .storeJs{
26
     padding: 20px;
32
     padding: 20px;
27
-    .introduce{
28
-      float: left;
29
-      .storeName{
30
-        font-size: 32px;         
31
-        font-weight: bold;
32
-        color: #020200;
33
-        padding-right: 60px;
34
-      }
35
-      .storeName+text{
36
-        font-size: 24px;         
37
-        font-weight: bold;
38
-        color: #202020;
33
+    .storeName{      
34
+      font-size: 32px;         
35
+      font-weight: bold;
36
+      color: #202020;
37
+    }
38
+    .sprice{
39
+      color: #202020;
40
+      font-size: 32px;         
41
+      font-weight: bold;
42
+      .t1{        
43
+        font-size: 24px;
39
         padding-right: 10px;
44
         padding-right: 10px;
40
       }
45
       }
41
-      .price{
42
-        font-size: 32px;         
43
-        font-weight: bold;
44
-        color: #202020;
45
-      }
46
-    }
47
-    .bz{
48
-      float: right;
49
-      .bzRight{
50
-        font-size: 24px;         
51
-        color: #202020;
52
-        line-height: 34px;
53
-        height: 23px;
46
+      .bzRight{        
47
+        font-weight: 400;
48
+        font-size: 24px;
49
+        float: right;
54
       }
50
       }
55
     }
51
     }
52
+
53
+
54
+
55
+
56
+
57
+
56
     .appraise{
58
     .appraise{
57
       line-height: 0;
59
       line-height: 0;
58
       margin-top: 28px;
60
       margin-top: 28px;
59
       margin-bottom: 37px;
61
       margin-bottom: 37px;
60
-      image{
61
-        width: 24px;
62
-        height: 24px;
63
-        margin-right: 10px;
64
-      }
62
+      
65
       text{
63
       text{
66
         font-size: 24px;         
64
         font-size: 24px;         
67
         font-weight: bold;
65
         font-weight: bold;
70
       .t1{
68
       .t1{
71
         margin-left: 10px;
69
         margin-left: 10px;
72
       }
70
       }
73
-      .storezf{
74
-        color: #020200;
75
-        margin-left: 7px ;
76
-      }
77
       .comment{
71
       .comment{
78
         color: #666;
72
         color: #666;
79
       }
73
       }
80
     }
74
     }
81
     .yysj{
75
     .yysj{
82
       line-height: 0;
76
       line-height: 0;
77
+      font-size: 24px;
78
+      color: #666;
83
       .yysjImg{
79
       .yysjImg{
84
         width: 26px;
80
         width: 26px;
85
         height: 26px;
81
         height: 26px;
86
         position: relative;
82
         position: relative;
87
         top: 5px;
83
         top: 5px;
88
-      }
89
-      text{
90
-        font-size: 24px;
91
-        color: #666;
92
-        padding-left: 10px;
84
+        padding-right: 10px;
93
       }
85
       }
94
     }
86
     }
95
     .dpPosition{
87
     .dpPosition{
106
         font-size: 24px;         
98
         font-size: 24px;         
107
         color: #666666;
99
         color: #666666;
108
         padding-left: 34px;
100
         padding-left: 34px;
109
-        height: 97px;
101
+        padding-bottom: 40px;
110
         .zhuandao{
102
         .zhuandao{
111
           width: 14px;
103
           width: 14px;
112
           height: 24px;
104
           height: 24px;
113
           transform: rotate(180deg);
105
           transform: rotate(180deg);
114
-          position: absolute;
115
-          bottom: 25px;
106
+          position: relative;
107
+          left: 8px;
108
+          top: 5px;
116
         }        
109
         }        
117
       }
110
       }
118
       
111
       
155
 background-repeat: no-repeat;
148
 background-repeat: no-repeat;
156
 background-size: auto 50%;
149
 background-size: auto 50%;
157
 }
150
 }
158
-.foodCard{
159
-  background: #FFF;
160
-  box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.12);
161
-  border-radius: 12px;
162
-  position: relative;
163
-  margin-bottom: 30px;
164
-  overflow: hidden;
165
-  background: radial-gradient(circle at 82% top,transparent 20px,#fff 0) top,
166
-              radial-gradient(circle at 82% bottom,transparent 20px,#fff 0) bottom;
167
-  background-repeat: no-repeat;
168
-  background-size: auto 50%;
169
-  .fCleft{
170
-    float: left;
171
-    width: 82%;
172
-    .backMoney{
173
-      font-size: 24px;
174
-      font-weight: bold;
175
-      color: #FFF;
176
-      margin: 22px 40px 20px 0;        
177
-      padding: 12px 17px 9px 6px;
178
-      background:url('../../../assets/icons/housemantj/fximg.png') no-repeat;    
179
-      display: inline-block;
180
-      background-size: 100% 100%;
181
-    }
182
-    .appraise{
183
-      display: inline-block;
184
-      image{
185
-        width: 21px;
186
-        height: 21px;
187
-        margin-right: 10px;
188
-      }
189
-      text{
190
-        font-size: 24px;           
191
-        font-weight: bold;
192
-        color: #020200;
193
-      }
194
-    }
195
-    .contentImg{
196
-      margin: 0 20px 43px 20px;
197
-      position: relative;
198
-      display: inline-block;
199
-      .img1{
200
-        width: 144px;
201
-        height: 144px;
202
-        border-radius: 24px;
203
-      }
204
-      .mstip{
205
-          width:99px;
206
-          height:37px;
207
-          position: absolute;
208
-          left: 0;          
209
-      }
210
-    }
211
-    .neirong{
212
-      display: inline-block;
213
-      width: 65%;
214
-      .textword{
215
-        font-size: 24px;           
216
-        color: #333;
217
-        margin: 0 21px 0 0;
218
-        height: 84px;
219
-      }
220
-      .jiage{
221
-        line-height: 20px;
222
-        font-weight: bold;
223
-        color: #333;
224
-        .rmb{
225
-          font-size: 20px;             
226
-          margin: 0 8px 0 7px;
227
-        }
228
-        .p1{
229
-          font-size: 24px;     
230
-        }
231
-        .p2{
232
-          font-size: 18px;             
233
-          text-decoration: line-through;
234
-          color: #666;
235
-        }
236
-      }
237
-      .address{
238
-        line-height: 0;
239
-        margin-top: 18px;
240
-        .dw{
241
-          width: 16px;
242
-          height: 20px;
243
-          position: relative;
244
-          top:3px;
245
-          margin-right: 10px;
246
-        }
247
-        .wz{
248
-          font-size: 20px;             
249
-          color: #333;
250
-        }
251
-        .star{
252
-          width: 21px;
253
-          height: 21px;
254
-          margin: 0 10px 0 40px;
255
-          position: relative;
256
-          top: 3px;
257
-        }
258
-        .collection{
259
-          font-size: 20px;             
260
-          color: #333333;
261
-        }
262
-      }
263
-    }
264
-  }
265
-  .fCright{
266
-    float: right;
267
-    width: 18%;
268
-    line-height: 0;
269
-    image{
270
-      width:35px;
271
-      height:32px;
272
-      margin-top: 120%;
273
-      margin-left:calc(50% - 15px)
274
-    }
275
-    view{
276
-      font-size: 24px;
277
-      line-height: 23px;
278
-      font-weight: bold;
279
-      color: #202020;
280
-      margin-top: 19px;
281
-      text-align: center;
282
-    }
283
-  }
284
-  .columnLine{
285
-    height: 50%;
286
-    border-right: 2px dashed #595959;
287
-    opacity: 0.12;
288
-    position: absolute;
289
-    right: 18%;
290
-    bottom:15%;
291
-  }
292
-}
151
+
293
 .showMore{
152
 .showMore{
294
   width: 100%;
153
   width: 100%;
295
   background: linear-gradient(0deg, rgba(248, 248, 248, 0.58) 42%, rgba(248, 248, 248, 0) 100%);
154
   background: linear-gradient(0deg, rgba(248, 248, 248, 0.58) 42%, rgba(248, 248, 248, 0) 100%);
317
   width: 100%;
176
   width: 100%;
318
   margin-bottom: 40px;
177
   margin-bottom: 40px;
319
 }
178
 }
320
-.waterfall{
321
-  column-count: 2;      //分两列
322
-  column-gap: 30px;    //列间距
323
-  background-color: #F8F8F8;
324
-  padding:30px 30px 0 30px;
325
-  
326
-  .contentCard{
327
-    background: #FFF;
328
-    box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.12);
329
-    border-radius: 24px;
330
-    overflow: hidden;
331
-    margin-bottom:50px;
332
-    break-inside: avoid;
333
-    position: relative;
334
 
179
 
335
-    .cardTop{
336
-      border-radius: 24px 24px 0px 0px;
337
-      .cCardimg{
338
-        width: 100%;
339
-        border-radius: 24px 24px 0px 0px;
340
-      }
341
-      .lefttips{
342
-        width:99px;
343
-        height:37px;
344
-        position: absolute;
345
-        left: 0;
346
-      }
347
-      .loveharde{
348
-        width: 22px;
349
-        height: 20px;
350
-        position: absolute;
351
-        right: 20px;
352
-        top: 10px;
353
-      }
354
-    }
355
-    .bContent{
356
-      padding:20px;
357
-      .cCword{
358
-        font-size: 24px;
359
-        font-weight: bold;
360
-        color: #404040;
361
-      }
362
-      
363
-      .cCleft{
364
-        float: left;
365
-        position: relative;
366
-        padding:40px 0 30px 0;
367
-        .cCicon{
368
-          width: 17px;
369
-          height: 21px;
370
-          position: absolute;
371
-          left: 0;
372
-          top: 48px;
373
-        }
374
-        .distance{
375
-          padding-left: 24px;
376
-          font-size: 24px;
377
-          color: #C0C8D3;
378
-        }
379
-      }
380
-      .cCright{
381
-        position: relative;
382
-        float: right;
383
-        padding:40px 0 30px 0;
384
-        .money{
385
-          font-size: 20px;
386
-          color: #FF3434;          
387
-          position: absolute;
388
-          right: 78px;
389
-          bottom: 32px;
390
-        }
391
-        .price{
392
-          font-size: 24px;
393
-          color: #FF3434;
394
-        }
395
-      }
396
-    }
397
-  }
398
-}
399
 .botton{
180
 .botton{
400
   font-size: 28px;   
181
   font-size: 28px;   
401
   color: #C0C8D3;
182
   color: #C0C8D3;

+ 133
- 81
src/pages/details/mjDetails/sceneryDetails.jsx Visa fil

1
 import CustomNav from '@/components/CustomNav'
1
 import CustomNav from '@/components/CustomNav'
2
 import mj from '../../../assets/icons/housemantj/mj2.jpg'
2
 import mj from '../../../assets/icons/housemantj/mj2.jpg'
3
+import mj3 from '../../../assets/icons/housemantj/mj3.jpg'
3
 import ax from '../../../assets/icons/housemantj/onlove.png'
4
 import ax from '../../../assets/icons/housemantj/onlove.png'
4
 import huangxin from '../../../assets/icons/housemantj/已收藏.png'
5
 import huangxin from '../../../assets/icons/housemantj/已收藏.png'
5
 import baixin from '../../../assets/icons/housemantj/收藏.png'
6
 import baixin from '../../../assets/icons/housemantj/收藏.png'
6
 import dw from '../../../assets/icons/housemantj/地址.png'
7
 import dw from '../../../assets/icons/housemantj/地址.png'
7
-import titlezs from '../../../assets/icons/housemantj/推荐景点.png'
8
+import titlejd from '../../../assets/icons/housemantj/推荐景点.png'
8
 import titlems from '../../../assets/icons/housemantj/推荐美食.png'
9
 import titlems from '../../../assets/icons/housemantj/推荐美食.png'
9
 import pay from '../../../assets/icons/housemantj/pay.png'
10
 import pay from '../../../assets/icons/housemantj/pay.png'
10
 import ms2 from '../../../assets/icons/housemantj/ms2.jpg'
11
 import ms2 from '../../../assets/icons/housemantj/ms2.jpg'
12
 import wz from '../../../assets/icons/housemantj/location.png'
13
 import wz from '../../../assets/icons/housemantj/location.png'
13
 import showMore from '../../../assets/icons/housemantj/查看更多.png'
14
 import showMore from '../../../assets/icons/housemantj/查看更多.png'
14
 import dp from '../../../assets/icons/housemantj/dp.jpg'
15
 import dp from '../../../assets/icons/housemantj/dp.jpg'
15
-import znz from '../../../assets/icons/housemantj/znz.png'
16
-import location from '../../../assets/icons/housemantj/location.png'
17
-import mjImage from '../../../assets/icons/housemantj/mj.jpg'
18
-import glImage from '../../../assets/icons/housemantj/gl.jpg'
19
-import glTip from '../../../assets/icons/housemantj/gltip.png'
20
-import onlove from '../../../assets/icons/housemantj/爱心.png'
21
 import share from '../../../assets/icons/housemantj/景点分享.png'
16
 import share from '../../../assets/icons/housemantj/景点分享.png'
22
 import good from '../../../assets/icons/housemantj/景点爆赞.png'
17
 import good from '../../../assets/icons/housemantj/景点爆赞.png'
23
 import collection from '../../../assets/icons/housemantj/景点收藏.png'
18
 import collection from '../../../assets/icons/housemantj/景点收藏.png'
24
 import './sceneryDetails.less'
19
 import './sceneryDetails.less'
25
 import withLayout from '@/layouts'
20
 import withLayout from '@/layouts'
21
+import { useState, useEffect } from 'react'
22
+import { getTouristDetail, saveCollection, removeCollection } from '@/services/home'
23
+import { Swiper, SwiperItem } from '@tarojs/components';
24
+
25
+
26
 
26
 
27
 
27
 
28
 export default withLayout((props) => {
28
 export default withLayout((props) => {
29
-  const { router, person } = props
29
+  const { router, person, id } = props
30
+  const { detail, setDetail } = useState()
31
+  const tips = [
32
+    { src: mj },
33
+    { src: mj3 },
34
+    { src: collection },
35
+    { src: mj },
36
+    { src: mj },
37
+    { src: mj3 },
38
+    { src: titlems },
39
+    { src: mj }
40
+  ]
41
+  const [ jshidden, setHidden]  = useState('none')
42
+  const [ jsclose, setClose ] = useState('none')
43
+  const [ jsmore, setMore ] = useState('block')
44
+  const [ tchidden, tcHidden ] = useState('none')
45
+  const [ tcclose, setTcclose ] = useState('none')
46
+  const [ tcmore, setTcMore ] = useState('block')
47
+  const onClose=()=>{
48
+    setHidden('none')
49
+    setClose('none')
50
+    setMore('block')
51
+  }
52
+  const onShow=()=>{
53
+    setHidden('block')
54
+    setClose('block')
55
+    setMore('none')
56
+  }
57
+
58
+
59
+  const [index, setIndex] = useState(0)
60
+  const handchange = (e) => {
61
+    setIndex(e.detail.current)
62
+  }
63
+  useEffect(() => {
64
+    getTouristDetail(id).then((res) => {
65
+      setDetail(res)
66
+    })
67
+  }, [])
30
   return (
68
   return (
31
     <view className='page-index'>
69
     <view className='page-index'>
32
       <view className='index-navbar'>
70
       <view className='index-navbar'>
33
         <CustomNav title='十公里' />
71
         <CustomNav title='十公里' />
34
       </view>
72
       </view>
35
-      <view style={{overflow: 'auto', padding: '0 30rpx', background: '#F8F8F8' }}>
73
+      <view style={{ overflow: 'auto', padding: '0 30rpx', background: '#F8F8F8' }}>
36
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll">
74
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll">
37
           <view className='storeDetails'>
75
           <view className='storeDetails'>
38
-            <image src={mj} className='storeImage' >
39
-              <view className='tpPage'>
40
-                <text>1</text><text>/</text><text>64</text>
41
-              </view>
42
-            </image>
76
+            <Swiper
77
+              className='.swiper'
78
+              circular
79
+              current={index}
80
+              onChange={handchange}
81
+            >
82
+              {
83
+                tips.map((item) =>
84
+                  <SwiperItem>
85
+                    <image src={item.src} className='storeImage' >
86
+                      <view className='tpPage'>
87
+                        <text>{index + 1}</text><text>/</text><text>{tips.length}</text>
88
+                      </view>
89
+                    </image>
90
+                  </SwiperItem>
91
+                )
92
+              }
93
+            </Swiper>
94
+
43
             <view className='storeJs'>
95
             <view className='storeJs'>
44
               <view className='introduce'>
96
               <view className='introduce'>
45
                 <text className='storeName'>玄武湖</text>
97
                 <text className='storeName'>玄武湖</text>
46
               </view>
98
               </view>
47
               <view className='bz'>
99
               <view className='bz'>
48
-                  <image src={ax} style={{ width: '15px', height: '15px', marginRight: '10px', marginBottom: '-2px' }} />
49
-                  <text className='bzRight'>爆赞<text>9999+</text></text>
50
-                </view>
100
+                <image src={ax} style={{ width: '15px', height: '15px', marginRight: '10px', marginBottom: '-2px' }} />
101
+                <text className='bzRight'>爆赞<text>9999+</text></text>
102
+              </view>
51
               <view className='wz'>凤游寺52号悦动新门西15栋111号</view>
103
               <view className='wz'>凤游寺52号悦动新门西15栋111号</view>
52
               <view className='dpPosition'>
104
               <view className='dpPosition'>
53
                 <image src={dw} className='dwTip' />
105
                 <image src={dw} className='dwTip' />
60
               到了10月下旬的深秋时节,“不觉初秋夜渐长,清风习习重凄
112
               到了10月下旬的深秋时节,“不觉初秋夜渐长,清风习习重凄
61
               凉”,秋天的美,毫不输给繁花似锦的春天11月栖霞山枫叶最
113
               凉”,秋天的美,毫不输给繁花似锦的春天11月栖霞山枫叶最
62
               佳观赏期快要来了,赶紧提前收藏这些吧!
114
               佳观赏期快要来了,赶紧提前收藏这些吧!
63
-              </view>
64
-              <view className='line'></view>
65
-              <view className='sc'>
66
-                <image className='scTip' src={baixin} /><text>加入收藏</text>
67
-              </view>
115
+            </view>
116
+            <view className='line'></view>
117
+            <view className='sc'>
118
+              <image className='scTip' src={baixin} /><text>加入收藏</text>
119
+            </view>
68
           </view>
120
           </view>
69
           <view style={{ position: 'relative' }}>
121
           <view style={{ position: 'relative' }}>
122
+
70
             <view className='title'>
123
             <view className='title'>
71
-              <image src={titlezs}></image>
124
+              <image src={titlejd}></image>
72
               <text>景点介绍</text>
125
               <text>景点介绍</text>
73
             </view>
126
             </view>
74
             <view className='storezn'>
127
             <view className='storezn'>
84
               sed do eiusmod tempor incididunt ut labore et dolore
137
               sed do eiusmod tempor incididunt ut labore et dolore
85
               magna aliqua. Quis ipsum suspendisse ultrices gravida.
138
               magna aliqua. Quis ipsum suspendisse ultrices gravida.
86
             </view>
139
             </view>
87
-            <view className='showMore'>
140
+
141
+
142
+
143
+            <view style={{display:jshidden}} >
144
+              <view className='title'>
145
+                <image src={titlejd}></image>
146
+                <text>景点介绍</text>
147
+              </view>
148
+              <view className='storezn'>
149
+                Lorem ipsum dolor sit amet, consectetur adipiscing elit,
150
+                sed do eiusmod tempor incididunt ut labore et dolore
151
+                magna aliqua. Quis ipsum suspendisse ultrices gravida.
152
+                Risus commodo viverra maecenas accumsan lacus vel
153
+                facilisis.
154
+              </view>
155
+              <image src={dp} mode='widthFix' />
156
+              <view className='storezn'>
157
+                Lorem ipsum dolor sit amet, consectetur adipiscing elit,
158
+                sed do eiusmod tempor incididunt ut labore et dolore
159
+                magna aliqua. Quis ipsum suspendisse ultrices gravida.
160
+              </view>
161
+              <view className='title'>
162
+                <image src={titlejd}></image>
163
+                <text>景点介绍</text>
164
+              </view>
165
+              <view className='storezn'>
166
+                Lorem ipsum dolor sit amet, consectetur adipiscing elit,
167
+                sed do eiusmod tempor incididunt ut labore et dolore
168
+                magna aliqua. Quis ipsum suspendisse ultrices gravida.
169
+                Risus commodo viverra maecenas accumsan lacus vel
170
+                facilisis.
171
+              </view>
172
+              <image src={dp} mode='widthFix' />
173
+              <view className='storezn'>
174
+                Lorem ipsum dolor sit amet, consectetur adipiscing elit,
175
+                sed do eiusmod tempor incididunt ut labore et dolore
176
+                magna aliqua. Quis ipsum suspendisse ultrices gravida.
177
+              </view>
178
+            </view>
179
+            <view className='showMore' style={{display:jsclose}} onClick={onClose}>
180
+              <image src={showMore} className='moreTip2' />
181
+              <view>收起</view>
182
+            </view>
183
+            <view className='showMore'  style={{display:jsmore}} onClick={onShow}>
88
               <view>点击查看更多</view>
184
               <view>点击查看更多</view>
89
               <image src={showMore} className='moreTip' />
185
               <image src={showMore} className='moreTip' />
90
             </view>
186
             </view>
187
+
188
+
91
           </view>
189
           </view>
92
           <view style={{ position: 'relative' }}>
190
           <view style={{ position: 'relative' }}>
93
             <view className='title'>
191
             <view className='title'>
183
               <image src={showMore} className='moreTip' />
281
               <image src={showMore} className='moreTip' />
184
             </view>
282
             </view>
185
           </view>
283
           </view>
186
-          <view className='title'>
187
-            <image src={znz} className='gltitle'></image>
188
-            <text>老板推荐的攻略</text>
189
-          </view>
190
-          <view className="waterfall">
191
-            <view className='contentCard'>
192
-              <view className='cardTop'>
193
-                <image mode='widthFix' src={mjImage} className='cCardimg' />
194
-                <image className='lefttips' src={glTip} />
195
-                <image src={onlove} className='loveharde'></image>
196
-              </view>
197
-              <view className='bContent'>
198
-                <view className='cCword'>
199
-                  超划算套餐?这么便宜也是第一次见6荤6素1...
200
-                </view>
201
-                <view className='cCleft'>
202
-                  <image src={location} className='cCicon'></image>
203
-                  <view className='distance'><text>9.99</text>公里</view>
204
-                </view>
205
-                <view className='cCright'>
206
-                  <view className='money'>¥</view>
207
-                  <view className='price'><text>999</text>/人</view>
208
-                </view>
209
-              </view>
210
-            </view>
211
-            <view className='contentCard'>
212
-              <view className='cardTop'>
213
-                <image mode='widthFix' src={glImage} className='cCardimg' />
214
-                <image className='lefttips' src={glTip} />
215
-                <image src={onlove} className='loveharde'></image>
216
-              </view>
217
-              <view className='bContent'>
218
-                <view className='cCword'>
219
-                  超划算套餐?这么便宜也是第一次见6荤6素1...
220
-                </view>
221
-                <view className='cCleft'>
222
-                  <image src={location} className='cCicon'></image>
223
-                  <view className='distance'>9.99公里</view>
224
-                </view>
225
-                <view className='cCright'>
226
-                  <view className='money'>¥</view>
227
-                  <view className='price'>999/人</view>
228
-                </view>
229
-              </view>
230
-            </view>
231
-          </view>
232
           <view className='bottom'>已经到底了~</view>
284
           <view className='bottom'>已经到底了~</view>
233
         </scroll-view>
285
         </scroll-view>
286
+      </view>
287
+      <view className='bottomTab'>
288
+        <view className='tab'>
289
+          <image className='share' src={share} /><text>分享</text>
234
         </view>
290
         </view>
235
-        <view className='bottomTab'>
236
-          <view className='tab'>
237
-            <image className='share' src={share} /><text>分享</text>
238
-          </view>
239
-          <view className='tab'>
240
-            <image className='good' src={good} /><text>爆赞</text>
241
-          </view>
242
-          <view className='tab'>
243
-            <image className='collection' src={collection} /><text>加入收藏</text>
244
-          </view>
291
+        <view className='tab'>
292
+          <image className='good' src={good} /><text>爆赞</text>
245
         </view>
293
         </view>
246
-      
294
+        <view className='tab'>
295
+          <image className='collection' src={collection} /><text>加入收藏</text>
296
+        </view>
297
+      </view>
298
+
247
     </view>
299
     </view>
248
   )
300
   )
249
 })
301
 })

+ 10
- 78
src/pages/details/mjDetails/sceneryDetails.less Visa fil

2
   background-color: #fff;  
2
   background-color: #fff;  
3
   border-radius: 12px;
3
   border-radius: 12px;
4
   margin-bottom: 20px;
4
   margin-bottom: 20px;
5
+  .swiper{
6
+    height: calc((100vw - 60px) * 0.6);
7
+  }
5
   .storeImage{
8
   .storeImage{
6
     position: relative;
9
     position: relative;
7
     border-radius: 22px;
10
     border-radius: 22px;
8
     width: 100%;
11
     width: 100%;
12
+    height: 100%;
9
     .tpPage{
13
     .tpPage{
10
       position: absolute;
14
       position: absolute;
11
       right: 20px;
15
       right: 20px;
265
     height: 19px;
269
     height: 19px;
266
     margin-top: 14px;
270
     margin-top: 14px;
267
   }
271
   }
272
+  .moreTip2{
273
+    width: 38px;
274
+    height: 19px;
275
+    margin-top: 14px;
276
+    transform:rotate(180deg);
277
+  }
268
 }
278
 }
269
 .storezn{
279
 .storezn{
270
   font-size: 28px;
280
   font-size: 28px;
276
 .storezn+image{
286
 .storezn+image{
277
   width: 100%;
287
   width: 100%;
278
 }  
288
 }  
279
-.waterfall{
280
-  column-count: 2;      //分两列
281
-  column-gap: 30px;    //列间距
282
-  background-color: #F8F8F8;
283
-  
284
-  .contentCard{
285
-    background: #FFF;
286
-    box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.12);
287
-    border-radius: 24px;
288
-    overflow: hidden;
289
-    margin-bottom:50px;
290
-    break-inside: avoid;
291
-    position: relative;
292
-
293
-    .cardTop{
294
-      border-radius: 24px 24px 0px 0px;
295
-      .cCardimg{
296
-        width: 100%;
297
-        border-radius: 24px 24px 0px 0px;
298
-      }
299
-      .lefttips{
300
-        width:99px;
301
-        height:37px;
302
-        position: absolute;
303
-        left: 0;
304
-      }
305
-      .loveharde{
306
-        width: 22px;
307
-        height: 20px;
308
-        position: absolute;
309
-        right: 20px;
310
-        top: 10px;
311
-      }
312
-    }
313
-    .bContent{
314
-      padding:20px;
315
-      .cCword{
316
-        font-size: 24px;
317
-        font-weight: bold;
318
-        color: #404040;
319
-      }
320
-      
321
-      .cCleft{
322
-        float: left;
323
-        position: relative;
324
-        padding:40px 0 30px 0;
325
-        .cCicon{
326
-          width: 17px;
327
-          height: 21px;
328
-          position: absolute;
329
-          left: 0;
330
-          top: 48px;
331
-        }
332
-        .distance{
333
-          padding-left: 24px;
334
-          font-size: 24px;
335
-          color: #C0C8D3;
336
-        }
337
-      }
338
-      .cCright{
339
-        position: relative;
340
-        float: right;
341
-        padding:40px 0 30px 0;
342
-        .money{
343
-          font-size: 20px;
344
-          color: #FF3434;          
345
-          position: absolute;
346
-          right: 78px;
347
-          bottom: 32px;
348
-        }
349
-        .price{
350
-          font-size: 24px;
351
-          color: #FF3434;
352
-        }
353
-      }
354
-    }
355
-  }
356
-}
357
 .bottom{
289
 .bottom{
358
   font-size: 28px;    
290
   font-size: 28px;    
359
   color: #C0C8D3;
291
   color: #C0C8D3;

+ 45
- 0
src/pages/index/components/Card.js Visa fil

1
+
2
+import Taro from '@tarojs/taro'
3
+import useSave from "@/utils/hooks/useSave"
4
+import msTip from '@/assets/icons/housemantj/foodtip.png'
5
+import mjTip from '@/assets/icons/housemantj/mjtip.png'
6
+import glTip from '@/assets/icons/housemantj/gltip.png'
7
+import location from '@/assets/icons/housemantj/location.png'
8
+import onlove from '@/assets/icons/housemantj/onlove.png'
9
+import love from '@/assets/icons/housemantj/爱心.png'
10
+
11
+export default (props) => {
12
+
13
+  const { item } = props
14
+
15
+  const [isSaved, toggleSave] = useSave(item.isSaved, item.targetType, item.targetId)
16
+  const Detail=()=>{
17
+    if (item.targetType=='tourist') {
18
+      Taro.navigateTo({ url: `/pages/details/mjDetails/sceneryDetails?id=${item.targetId}` });
19
+    }
20
+    else{
21
+      Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.targetId}` });
22
+    }
23
+  }
24
+
25
+  return (
26
+    <view className='contentCard'>
27
+      <view className='cardTop'>
28
+        <image mode='widthFix' onClick={Detail} src={item.poster} className='cCardimg' />
29
+        <image className='lefttips' src={item.targetType==='tourist'?mjTip:msTip}/>
30
+        <image onClick={toggleSave} src={isSaved> 0?onlove:love} className='loveharde'></image>
31
+      </view>
32
+      <view className='bContent' onClick={Detail}>
33
+        <view className='cCword'>{(item.title).toString().length>35?(item.title).substring(0, 35)+'...':(item.title)}</view>
34
+        <view className='cCleft'>
35
+          <image src={location} className='cCicon'></image>
36
+          <view className='distance'><text>{(item.distance/1000).toFixed(2)}</text>公里</view>
37
+        </view>
38
+        <view className='cCright'>          
39
+          <view className='price'><text className='money'>¥</text><text>{item.averagePrice/100}</text>/人</view>
40
+        </view>
41
+      </view>
42
+    </view>
43
+  )
44
+
45
+}

+ 51
- 320
src/pages/index/tabs/Recommend.jsx Visa fil

1
-import { React, useState, useEffect, } from 'react'
2
-
1
+import Taro, { useRouter } from '@tarojs/taro'
2
+import { React, useState, useEffect } from 'react'
3
 import iconsearch from '@/assets/icons/housemantj/search.png'
3
 import iconsearch from '@/assets/icons/housemantj/search.png'
4
-import icontip from '@/assets/icons/housemantj/tip.png'
5
 import location from '@/assets/icons/housemantj/location.png'
4
 import location from '@/assets/icons/housemantj/location.png'
6
-import msImage from '@/assets/icons/housemantj/ms.jpg'
7
-import mjImage from '@/assets/icons/housemantj/mj.jpg'
8
-import glImage from '@/assets/icons/housemantj/gl.jpg'
9
-import msTip from '@/assets/icons/housemantj/foodtip.png'
10
-import mjTip from '@/assets/icons/housemantj/mjtip.png'
11
-import glTip from '@/assets/icons/housemantj/gltip.png'
12
-import onlove from '@/assets/icons/housemantj/onlove.png'
13
-import Taro, { useRouter } from '@tarojs/taro'
14
-import withLayout from '@/layouts'
15
-
16
-import { getIndexType, getIndexRecommender } from '@/services/home'
5
+import Tip from '@/components/tip'
6
+import { getIndexType,  getResourceList } from '@/services/home'
7
+import Card from '../components/Card'
8
+import { getLocation } from '@/utils/location'
17
 
9
 
18
 import './less/Recommend.less'
10
 import './less/Recommend.less'
19
 
11
 
24
   const { params } = useRouter()
16
   const { params } = useRouter()
25
   const { tabJump } = params || {}
17
   const { tabJump } = params || {}
26
   const [typeList, setTypeList] = useState([])
18
   const [typeList, setTypeList] = useState([])
27
-  const [list, setList] = useState([])
19
+  const [location1,setLocation]=useState('')
28
 
20
 
29
-  const tabs = [{ title: '附近' }].concat(typeList.map(x => ({ ...x, title: x.typeName })))
21
+  const [queryParams, setQueryParams] = useState({ location: '', pageNum: 1, pageSize: 10, typeId: '' })
30
 
22
 
23
+  // 获取资源表信息
24
+  const [alllist, setAllList] = useState([])
25
+  //分类标签
26
+  const tabs = [{ title: '附近' }].concat(typeList.map(x => ({ ...x, title: x.typeName })))
27
+  //切换上面的标签
31
   const handleTabChange = (e) => {
28
   const handleTabChange = (e) => {
32
     const { index } = e.detail
29
     const { index } = e.detail
33
     setActiveTab(index)
30
     setActiveTab(index)
34
     const tab = tabs[index].typeId
31
     const tab = tabs[index].typeId
35
-    // getIndexRecommender().then()
32
+    setQueryParams({
33
+      ...queryParams,
34
+      typeId: tab
35
+    })
36
+    if (index == 0) {
37
+      setQueryParams({ location: location1, pageNum: 1, pageSize: 10, typeId: '' })
38
+    }
36
   }
39
   }
37
 
40
 
38
   useEffect(() => {
41
   useEffect(() => {
42
+    getLocation().then((res) => {
43
+      setLocation(`${res.longitude},${res.latitude}`)
44
+      setQueryParams({
45
+        ...queryParams,
46
+        location: `${res.longitude},${res.latitude}`
47
+      })
48
+      getResourceList(queryParams).then((res2) => {
49
+      setAllList(res2.records || [])
50
+    })
51
+    })
52
+
53
+    //查询分类标签表
39
     getIndexType({ pageSize: 20 }).then((res) => {
54
     getIndexType({ pageSize: 20 }).then((res) => {
40
       setTypeList(res.records || [])
55
       setTypeList(res.records || [])
41
     })
56
     })
42
-    getIndexRecommender().then((res) => {
43
-      setList(res.records || [])
44
-    })
57
+    
58
+  }, [])
59
+
60
+  useEffect(() => {
45
     if (tabJump) {
61
     if (tabJump) {
46
-      setActiveTab(tabJump - 0)
62
+      // 更新 typeId
63
+      // 更新 分页
47
     }
64
     }
65
+
66
+    setActiveTab(tabJump - 0)
48
   }, [tabJump])
67
   }, [tabJump])
68
+
69
+
70
+  useEffect(() => {
71
+    getResourceList(queryParams).then((res) => {
72
+      setAllList(res.records || [])
73
+    })
74
+  }, [queryParams])
75
+
49
   const onSearch = () => {
76
   const onSearch = () => {
50
     // 用绝对路径
77
     // 用绝对路径
51
     Taro.navigateTo({ url: '/pages/search/search' });
78
     Taro.navigateTo({ url: '/pages/search/search' });
52
   }
79
   }
53
-  const toDetails = () => {
54
-    // 用绝对路径
55
-    Taro.navigateTo({ url: '/pages/details/foodDetails/foodDetails' });
56
-  }
57
-  const toDetails2 = () => {
58
-    // 用绝对路径
59
-    Taro.navigateTo({ url: '/pages/details/mjDetails/sceneryDetails' });
60
-  }
61
-  const onLogin = () => {
62
-    // 用绝对路径
63
-    Taro.navigateTo({ url: '/components/AuthPage/index' });
64
-  }
65
   return (
80
   return (
66
     <view style={{ height: '100%', overflow: 'auto' }}>
81
     <view style={{ height: '100%', overflow: 'auto' }}>
67
       <view className='search' onClick={onSearch}>
82
       <view className='search' onClick={onSearch}>
69
         <image className='searchicon' src={iconsearch} />
84
         <image className='searchicon' src={iconsearch} />
70
         <view className='searchword'>搜索</view>
85
         <view className='searchword'>搜索</view>
71
       </view>
86
       </view>
72
-      <view className='tip' onclick={onLogin}>
73
-        <image className='tipicon' src={icontip} />
74
-        <view className='tipword' >Tip : 饮食无大小,疫情防控请大家认真对待!</view>
75
-      </view>
87
+      <Tip />
76
       <view className='index-tabs'>
88
       <view className='index-tabs'>
77
         <view className='position'>
89
         <view className='position'>
78
           <image className='location' src={location} />
90
           <image className='location' src={location} />
79
           <view className='city'>南京</view>
91
           <view className='city'>南京</view>
80
           <view className='line' />
92
           <view className='line' />
81
         </view>
93
         </view>
82
-
83
         <scroll-view scroll-x='true' scroll-view='true' bindscrolltoupper='upper' bindscrolltolower='lower' bindscroll='scroll'>
94
         <scroll-view scroll-x='true' scroll-view='true' bindscrolltoupper='upper' bindscrolltolower='lower' bindscroll='scroll'>
84
-
85
           <mp-tabs
95
           <mp-tabs
86
             tabClass='tabs-Unselected'
96
             tabClass='tabs-Unselected'
87
             swiperClass='tabs-swiper'
97
             swiperClass='tabs-swiper'
96
       </view>
106
       </view>
97
       <scroll-view scroll-y='true' scroll-view='true' bindscrolltoupper='upper' bindscrolltolower='lower' bindscroll='scroll'>
107
       <scroll-view scroll-y='true' scroll-view='true' bindscrolltoupper='upper' bindscrolltolower='lower' bindscroll='scroll'>
98
         <view className='waterfall'>
108
         <view className='waterfall'>
99
-          {/* {
100
-            list.map()
101
-
102
-          } */}
103
-
104
-
105
-          {activeTab === 0 &&
106
-            <>
107
-              <view className='contentCard' onClick={toDetails2}>
108
-                <view className='cardTop'>
109
-                  <image mode='widthFix' src={mjImage} className='cCardimg' />
110
-                  <image className='lefttips' src={mjTip} />
111
-                  <image src={onlove} className='loveharde'></image>
112
-                </view>
113
-                <view className='bContent'>
114
-                  <view className='cCword'>
115
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
116
-                  </view>
117
-                  <view className='cCleft'>
118
-                    <image src={location} className='cCicon'></image>
119
-                    <view className='distance'><text>9.99</text>公里</view>
120
-                  </view>
121
-                  <view className='cCright'>
122
-                    <view className='money'>¥</view>
123
-                    <view className='price'><text>999</text>/人</view>
124
-                  </view>
125
-                </view>
126
-              </view>
127
-              <view className='contentCard'>
128
-                <view className='cardTop'>
129
-                  <image mode='widthFix' src={msImage} className='cCardimg' />
130
-                  <image className='lefttips' src={msTip} />
131
-                  <image src={onlove} className='loveharde'></image>
132
-                </view>
133
-                <view className='bContent'>
134
-                  <view className='cCword'>
135
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
136
-                  </view>
137
-                  <view className='cCleft'>
138
-                    <image src={location} className='cCicon'></image>
139
-                    <view className='distance'><text>9.99</text>公里</view>
140
-                  </view>
141
-                  <view className='cCright'>
142
-                    <view className='money'>¥</view>
143
-                    <view className='price'><text>999</text>/人</view>
144
-                  </view>
145
-                </view>
146
-              </view>
147
-              <view className='contentCard'>
148
-                <view className='cardTop'>
149
-                  <image mode='widthFix' src={glImage} className='cCardimg' />
150
-                  <image className='lefttips' src={glTip} />
151
-                  <image src={onlove} className='loveharde'></image>
152
-                </view>
153
-                <view className='bContent'>
154
-                  <view className='cCword'>
155
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
156
-                  </view>
157
-                  <view className='cCleft'>
158
-                    <image src={location} className='cCicon'></image>
159
-                    <view className='distance'>9.99公里</view>
160
-                  </view>
161
-                  <view className='cCright'>
162
-                    <view className='money'>¥</view>
163
-                    <view className='price'>999/人</view>
164
-                  </view>
165
-                </view>
166
-              </view>
167
-              <view className='contentCard'>
168
-                <view className='cardTop'>
169
-                  <image mode='widthFix' src={mjImage} className='cCardimg' />
170
-                  <image className='lefttips' src={mjTip} />
171
-                  <image src={onlove} className='loveharde'></image>
172
-                </view>
173
-                <view className='bContent'>
174
-                  <view className='cCword'>
175
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
176
-                  </view>
177
-                  <view className='cCleft'>
178
-                    <image src={location} className='cCicon'></image>
179
-                    <view className='distance'><text>9.99</text>公里</view>
180
-                  </view>
181
-                  <view className='cCright'>
182
-                    <view className='money'>¥</view>
183
-                    <view className='price'><text>999</text>/人</view>
184
-                  </view>
185
-                </view>
186
-              </view>
187
-              <view className='contentCard'>
188
-                <view className='cardTop'>
189
-                  <image mode='widthFix' src={mjImage} className='cCardimg' />
190
-                  <image className='lefttips' src={mjTip} />
191
-                  <image src={onlove} className='loveharde'></image>
192
-                </view>
193
-                <view className='bContent'>
194
-                  <view className='cCword'>
195
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
196
-                  </view>
197
-                  <view className='cCleft'>
198
-                    <image src={location} className='cCicon'></image>
199
-                    <view className='distance'><text>9.99</text>公里</view>
200
-                  </view>
201
-                  <view className='cCright'>
202
-                    <view className='money'>¥</view>
203
-                    <view className='price'><text>999</text>/人</view>
204
-                  </view>
205
-                </view>
206
-              </view>
207
-              <view className='contentCard'>
208
-                <view className='cardTop'>
209
-                  <image mode='widthFix' src={msImage} className='cCardimg' />
210
-                  <image className='lefttips' src={msTip} />
211
-                  <image src={onlove} className='loveharde'></image>
212
-                </view>
213
-                <view className='bContent'>
214
-                  <view className='cCword'>
215
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
216
-                  </view>
217
-                  <view className='cCleft'>
218
-                    <image src={location} className='cCicon'></image>
219
-                    <view className='distance'><text>9.99</text>公里</view>
220
-                  </view>
221
-                  <view className='cCright'>
222
-                    <view className='money'>¥</view>
223
-                    <view className='price'><text>999</text>/人</view>
224
-                  </view>
225
-                </view>
226
-              </view>
227
-              <view className='contentCard'>
228
-                <view className='cardTop'>
229
-                  <image mode='widthFix' src={mjImage} className='cCardimg' />
230
-                  <image className='lefttips' src={mjTip} />
231
-                  <image src={onlove} className='loveharde'></image>
232
-                </view>
233
-                <view className='bContent'>
234
-                  <view className='cCword'>
235
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
236
-                  </view>
237
-                  <view className='cCleft'>
238
-                    <image src={location} className='cCicon'></image>
239
-                    <view className='distance'><text>9.99</text>公里</view>
240
-                  </view>
241
-                  <view className='cCright'>
242
-                    <view className='money'>¥</view>
243
-                    <view className='price'><text>999</text>/人</view>
244
-                  </view>
245
-                </view>
246
-              </view>
247
-              <view className='contentCard' onClick={toDetails}>
248
-                <view className='cardTop'>
249
-                  <image mode='widthFix' src={msImage} className='cCardimg' />
250
-                  <image className='lefttips' src={msTip} />
251
-                  <image src={onlove} className='loveharde'></image>
252
-                </view>
253
-                <view className='bContent'>
254
-                  <view className='cCword'>
255
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
256
-                  </view>
257
-                  <view className='cCleft'>
258
-                    <image src={location} className='cCicon'></image>
259
-                    <view className='distance'><text>9.99</text>公里</view>
260
-                  </view>
261
-                  <view className='cCright'>
262
-                    <view className='money'>¥</view>
263
-                    <view className='price'><text>999</text>/人</view>
264
-                  </view>
265
-                </view>
266
-              </view>
267
-            </>
268
-          }
269
-          {activeTab === 1 &&
270
-            <>
271
-              <view className='contentCard'>
272
-                <view className='cardTop'>
273
-                  <image mode='widthFix' src={mjImage} className='cCardimg' />
274
-                  <image className='lefttips' src={mjTip} />
275
-                  <image src={onlove} className='loveharde'></image>
276
-                </view>
277
-                <view className='bContent'>
278
-                  <view className='cCword'>
279
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
280
-                  </view>
281
-                  <view className='cCleft'>
282
-                    <image src={location} className='cCicon'></image>
283
-                    <view className='distance'><text>9.99</text>公里</view>
284
-                  </view>
285
-                  <view className='cCright'>
286
-                    <view className='money'>¥</view>
287
-                    <view className='price'><text>999</text>/人</view>
288
-                  </view>
289
-                </view>
290
-              </view>
291
-              <view className='contentCard'>
292
-                <view className='cardTop'>
293
-                  <image mode='widthFix' src={msImage} className='cCardimg' />
294
-                  <image className='lefttips' src={msTip} />
295
-                  <image src={onlove} className='loveharde'></image>
296
-                </view>
297
-                <view className='bContent'>
298
-                  <view className='cCword'>
299
-                    超划算套餐?这么便宜也是第一次见6荤6素1...
300
-                  </view>
301
-                  <view className='cCleft'>
302
-                    <image src={location} className='cCicon'></image>
303
-                    <view className='distance'><text>9.99</text>公里</view>
304
-                  </view>
305
-                  <view className='cCright'>
306
-                    <view className='money'>¥</view>
307
-                    <view className='price'><text>999</text>/人</view>
308
-                  </view>
309
-                </view>
310
-              </view>
311
-            </>
312
-          }
313
-          {activeTab === 2 &&
314
-            <view className='contentCard'>
315
-              <view className='cardTop'>
316
-                <image mode='widthFix' src={mjImage} className='cCardimg' />
317
-                <image className='lefttips' src={mjTip} />
318
-                <image src={onlove} className='loveharde'></image>
319
-              </view>
320
-              <view className='bContent'>
321
-                <view className='cCword'>
322
-                  超划算套餐?这么便宜也是第一次见6荤6素1...
323
-                </view>
324
-                <view className='cCleft'>
325
-                  <image src={location} className='cCicon'></image>
326
-                  <view className='distance'><text>9.99</text>公里</view>
327
-                </view>
328
-                <view className='cCright'>
329
-                  <view className='money'>¥</view>
330
-                  <view className='price'><text>999</text>/人</view>
331
-                </view>
332
-              </view>
333
-            </view>
109
+          {
110
+            alllist.map((item) => <Card key={item.resourceNo} item={item} />)
334
           }
111
           }
335
-          {activeTab === 3 && <>
336
-            <view className='contentCard'>
337
-              <view className='cardTop'>
338
-                <image mode='widthFix' src={msImage} className='cCardimg' />
339
-                <image className='lefttips' src={msTip} />
340
-                <image src={onlove} className='loveharde'></image>
341
-              </view>
342
-              <view className='bContent'>
343
-                <view className='cCword'>
344
-                  超划算套餐?这么便宜也是第一次见6荤6素1...
345
-                </view>
346
-                <view className='cCleft'>
347
-                  <image src={location} className='cCicon'></image>
348
-                  <view className='distance'><text>9.99</text>公里</view>
349
-                </view>
350
-                <view className='cCright'>
351
-                  <view className='money'>¥</view>
352
-                  <view className='price'><text>999</text>/人</view>
353
-                </view>
354
-              </view>
355
-            </view>
356
-            <view className='contentCard'>
357
-              <view className='cardTop'>
358
-                <image mode='widthFix' src={mjImage} className='cCardimg' />
359
-                <image className='lefttips' src={mjTip} />
360
-                <image src={onlove} className='loveharde'></image>
361
-              </view>
362
-              <view className='bContent'>
363
-                <view className='cCword'>
364
-                  超划算套餐?这么便宜也是第一次见6荤6素1...
365
-                </view>
366
-                <view className='cCleft'>
367
-                  <image src={location} className='cCicon'></image>
368
-                  <view className='distance'><text>9.99</text>公里</view>
369
-                </view>
370
-                <view className='cCright'>
371
-                  <view className='money'>¥</view>
372
-                  <view className='price'><text>999</text>/人</view>
373
-                </view>
374
-              </view>
375
-            </view>
376
-          </>
377
-          }
378
-
379
-
380
-
381
         </view>
112
         </view>
382
         <view className='botton'>已经到底了~</view>
113
         <view className='botton'>已经到底了~</view>
383
       </scroll-view>
114
       </scroll-view>

+ 4
- 23
src/pages/index/tabs/less/Recommend.less Visa fil

28
       letter-spacing: 0.2em;
28
       letter-spacing: 0.2em;
29
     }
29
     }
30
 }
30
 }
31
-.tip{
32
-  padding:23px 0 22px 31px;
33
-  height: 70px;
34
-
35
-  .tipicon{
36
-    width: 17px;
37
-    height: 19px;
38
-    margin-right: 10px;
39
-  }
40
-  .tipword{
41
-    display:inline-block;
42
-    font-size: 24px;
43
-    color: #999;
44
-  }
45
-}
46
 .waterfall{
31
 .waterfall{
47
   column-count: 2;      //分两列
32
   column-count: 2;      //分两列
48
   column-gap: 30px;    //列间距
33
   column-gap: 30px;    //列间距
107
         position: relative;
92
         position: relative;
108
         float: right;
93
         float: right;
109
         padding:40px 0 30px 0;
94
         padding:40px 0 30px 0;
110
-        .money{
111
-          font-size: 20px;
112
-          color: #FF3434;          
113
-          position: absolute;
114
-          right: 78px;
115
-          bottom: 32px;
116
-        }
117
-        .price{
95
+        .price{          
118
           font-size: 24px;
96
           font-size: 24px;
119
           color: #FF3434;
97
           color: #FF3434;
98
+          .money{
99
+            font-size: 20px;
100
+          }
120
         }
101
         }
121
       }
102
       }
122
     }
103
     }

+ 43
- 18
src/services/home.js Visa fil

1
 import request from '@/utils/request'
1
 import request from '@/utils/request'
2
 
2
 
3
+
4
+
3
 /**
5
 /**
4
- * 获取推荐列表
5
- * @param {*} params 
6
+ * 获取分类列表
6
  * @returns 
7
  * @returns 
7
  */
8
  */
8
-export const getIndexRecommender = (params) => request('/index/recommender', { params })
9
+export const getIndexType = (params) => request('/tdType', { params })
9
 
10
 
10
 /**
11
 /**
11
- * 获取分类列表
12
+ * 获取新闻公告列表
12
  * @returns 
13
  * @returns 
13
  */
14
  */
14
-export const getIndexType = (params) => request('/tdType', { params })
15
+ export const getTipList = (params) => request('/notification', { params })
16
+/**
17
+ * 获取资源列表
18
+ * @returns 
19
+ * params 搜索条件放这里
20
+ */
21
+ export const getResourceList = (params) => request('/resource', { params })
15
 
22
 
16
 /**
23
 /**
17
- * 获取商铺列表
24
+ * 加入收藏
25
+ * @param {*} data 
18
  * @returns 
26
  * @returns 
19
  */
27
  */
20
- export const getIndexShop = (params) => request('/taShop', { params })
28
+ export const saveCollection = (targetType,targetId) => request(`/${targetType}/save/${targetId}`, { method: 'post' })
29
+
30
+/**
31
+ * 取消收藏
32
+ * @param {*} data 
33
+ * @returns 
34
+ */
35
+ export const removeCollection = (targetType,targetId) => request(`/${targetType}/save/${targetId}`, { method: 'delete'})
36
+ 
37
+/**
38
+ * 获取收藏
39
+ * @param {*} data 
40
+ * @returns 
41
+ */
42
+ export const getCollection = (targetType,targetId) => request(`/${targetType}/save/${targetId}`)
21
 
43
 
22
 /**
44
 /**
23
  * 商铺详情
45
  * 商铺详情
24
  * @param {*} id 
46
  * @param {*} id 
25
  * @returns 
47
  * @returns 
26
  */
48
  */
27
- export const getShopDetail = (id) => request(`/taShop/${id}`)
49
+ export const getShopDetail = (id) => request(`/shop/${id}`)
28
  /**
50
  /**
29
  * 获取商铺套餐列表
51
  * 获取商铺套餐列表
30
  * @returns 
52
  * @returns 
31
  */
53
  */
32
-  export const getIndexShopPackage = (params) => request('/taShopPackage ', { params })
54
+  export const getShopPackage = (id,params) => request(`/shop/${id}/package`,{params})
33
 
55
 
34
   /**
56
   /**
35
  * 套餐详情
57
  * 套餐详情
37
  * @returns 
59
  * @returns 
38
  */
60
  */
39
  export const getShopPackageDetail = (id) => request(`/taShopPackage/${id}`)
61
  export const getShopPackageDetail = (id) => request(`/taShopPackage/${id}`)
40
-
41
-/**
42
- * 获取景点列表
62
+ 
63
+ /**
64
+ * 获取套餐定位
65
+ * @param {*} id 
43
  * @returns 
66
  * @returns 
44
  */
67
  */
45
- export const getIndexTourist  = (params) => request('/taTourist ', { params })
68
+   export const getShopcity = (id) => request(`/city/${id}`)
46
 
69
 
70
+ /**
71
+ * 本店指南
72
+ * @param {*} id 
73
+ * @returns 
74
+ */
75
+  export const getExtendContent = (type,id,params) => request(`/${type}/${id}/content`,{params})
76
+ 
47
 /**
77
 /**
48
  * 景点详情
78
  * 景点详情
49
  * @param {*} id 
79
  * @param {*} id 
68
 //缺少收藏接口
98
 //缺少收藏接口
69
 //缺少套餐订单生成
99
 //缺少套餐订单生成
70
 
100
 
71
-/**
72
- * 获取更多指引列表
73
- * @returns 
74
- */
75
- export const getExtendContent  = (params) => request('/taExtendContent  ', { params })
76
 
101
 
77
 
102
 
78
 /**
103
 /**

+ 21
- 0
src/utils/hooks/useSave.js Visa fil

1
+import { useEffect, useState } from "react"
2
+import { saveCollection, removeCollection } from "@/services/home"
3
+
4
+export default function (initailState, targetType, targetId) {
5
+  const [isSaved, setIsSaved] = useState(initailState)
6
+  useEffect(() => {
7
+    setIsSaved(initailState)
8
+  }, [initailState])
9
+  const toggleSave = () => {
10
+    if (isSaved) {
11
+      removeCollection(targetType, targetId).then(() => {
12
+        setIsSaved(false)
13
+      })
14
+    } else {
15
+      saveCollection(targetType, targetId).then(() => {
16
+        setIsSaved(true)
17
+      })
18
+    }
19
+  }
20
+  return [isSaved, toggleSave]
21
+}

+ 26
- 0
src/utils/location.js Visa fil

1
+
2
+import Taro from '@tarojs/taro'
3
+
4
+export function getLocation() {
5
+  return new Promise((resolve, reject) => {
6
+    Taro.authorize({
7
+      scope: 'scope.userLocation',
8
+      success: () => {
9
+        Taro.getLocation({
10
+          type: 'wgs84',
11
+          success: (res) => {
12
+            resolve(res)
13
+          },
14
+          fail: (err) => {
15
+            console.error(err)
16
+            reject(err)
17
+          }
18
+        })
19
+      },
20
+      fail: (err) => {
21
+        console.error(err)
22
+        reject(err)
23
+      }
24
+    })
25
+  })
26
+}