吃个甘蔗嚼一年 3 anni fa
parent
commit
74e67172bc

+ 21
- 14
src/components/MoreGuide/index.jsx Vedi File

@@ -4,20 +4,27 @@ import './style.less'
4 4
 export default (props) => {
5 5
   const { item } = props
6 6
   return (
7
-    <>{
8
-      item.contentType == 'image' ?
9
-        <image src={item.content} mode='widthFix' style={{ width: '100%' }} className='image-content' /> :
10
-        item.contentType == 'text' ?
11
-          <view style={{ marginBottom: '5px' }}>
12
-            <view className='storezn'>{item.content}</view>
13
-          </view> :
14
-          <Video
15
-            controls
16
-            autoplay={false}
17
-            loop={false}
18
-            muted={false} style={{ width: "100%", height: '200px' }} src={item.content}></Video>
19
-
20
-    }
7
+
8
+    <>
9
+
10
+      {
11
+
12
+        item.contentType == 'image' ?
13
+
14
+          <image src={item.content} mode='widthFix' style={{ width: '100%' }} className='image-content' /> :
15
+          item.contentType == 'text' ?
16
+
17
+            <view style={{ marginBottom: '5px' }}>
18
+              <view className='storezn'>{item.content}</view>
19
+            </view>
20
+            :
21
+            <Video
22
+              controls
23
+              autoplay={false}
24
+              loop={false}
25
+              muted={false} style={{ width: "100%", height: '200px' }} src={item.content}></Video>
26
+
27
+      }
21 28
 
22 29
     </>
23 30
   )

+ 4
- 0
src/pages/RoomOrder/components/RoomForm/index.jsx Vedi File

@@ -11,6 +11,9 @@ export default (props) => {
11 11
   const [customerName, setCustomerName] = useState()
12 12
   const [customerPhone, setCustomerPhone] = useState()
13 13
 
14
+
15
+
16
+
14 17
   const handeInput = (e, key) => {
15 18
     const value = e.detail.value
16 19
 
@@ -25,6 +28,7 @@ export default (props) => {
25 28
     onChange({ customerName, customerPhone })
26 29
   }, [customerName, customerPhone])
27 30
 
31
+
28 32
   return (
29 33
     <view className='from-room'  >
30 34
       <mp-form >

+ 15
- 31
src/pages/RoomOrder/index.jsx Vedi File

@@ -25,45 +25,29 @@ export default withLayout((props) => {
25 25
   }
26 26
 
27 27
   const handleSubmit = (e) => {
28
-    console.log('原数组', formData)
28
+    for (let i = 0, len = formData.length; i < len; i++) {
29 29
 
30
-    var arrr = [...formData]
31
-    let Phone = /^[1][3,4,5,7,8,9][0-9]{9}$/;
30
+      const item = formData[i];
32 31
 
33
-    for (let i = 0, len = arrr.length; i < len; i++) {
34
-      console.log('For后数组', arrr[i])
35
-      let numPhone = 0
36
-      let userName = 0
37
-
38
-      formData.map((item, index) => {
39
-        userName = item.customerName
40
-        numPhone = item.customerPhone
41
-      })
42
-      if (userName === undefined) {
43
-        console.log('没有名字');
44
-      } else {
45
-        if (!Phone.test(numPhone)) {
46
-          console.log('手机号格式不正确')
47
-          return false;
48
-        } else {
49
-          console.log('成功----------')
50
-          return true;
51
-        }
32
+      if (!item.customerName || !item.customerPhone) {
33
+        Taro.showToast({
34
+          title: '手机号或姓名不能为空',
35
+          icon: 'none',
36
+        })
37
+        return;
52 38
       }
53
-
54
-
55
-
56
-
57
-
58
-      //   personSubmit(roomId, { ...formData }).then((res) => {
59
-      //     console.log('----------------------', res);
60
-      //   })
61
-
62 39
     }
40
+    personSubmit(roomOrderId, formData).then(a => {
41
+      Taro.navigateBack({
42
+        delta: 1
43
+      })
44
+    })
45
+
63 46
   }
64 47
 
65 48
 
66 49
 
50
+
67 51
   useEffect(() => {
68 52
     getTaRoom(roomId).then((res) => {
69 53
       setTaRoomContent(res)

+ 1
- 0
src/pages/RoomOrder/style.less Vedi File

@@ -7,4 +7,5 @@ button {
7 7
   border-radius: 12px;
8 8
   font-size: 40px;
9 9
   color: #ffffff;
10
+  margin-top: 2em;
10 11
 }

+ 1
- 2
src/pages/details/foodDetails/foodDetails.jsx Vedi File

@@ -1,7 +1,7 @@
1 1
 import CustomNav from '@/components/CustomNav'
2 2
 import withLayout from '@/layouts'
3 3
 import { getShopDetail, getShopPackage, getExtendContent } from '@/services/home'
4
-import { useState, useEffect,useRef } from 'react'
4
+import { useState, useEffect, useRef } from 'react'
5 5
 import { Swiper, SwiperItem } from '@tarojs/components';
6 6
 import Star from '@/components/Star/Star.jsx'
7 7
 import Cards from '@/components/foodCards/foodCards.jsx'
@@ -96,7 +96,6 @@ export default withLayout((props) => {
96 96
       setAllpgNum(res.total)
97 97
     })
98 98
     getExtendContent('shop', id).then((res) => {
99
-      console.log('targetId targetId targetId targetId targetId targetId targetId targetId targetId ', res);
100 99
       setExtend(res.records || [])
101 100
       setAllextNum(res.total)
102 101
       setNewextNum(res.records.length)

+ 0
- 1
src/pages/index/index.jsx Vedi File

@@ -27,7 +27,6 @@ export default withLayout((props) => {
27 27
       setCurrentTab(tab - 0)
28 28
     }
29 29
   }, [tab])
30
-
31 30
   return (
32 31
     <view className='page-index'>
33 32
       <view className='index-navbar'>

+ 52
- 109
src/pages/index/tabs/Guide.jsx Vedi File

@@ -1,6 +1,8 @@
1 1
 import { useState, useEffect, useRef } from "react";
2
-import withLayout from '@/layouts'
3 2
 import Taro from '@tarojs/taro'
3
+import MoreGuide from "@/components/MoreGuide";
4
+import Cards from '@/components/foodCards/foodCards.jsx'
5
+
4 6
 import image from '@/assets/icons/ProCard/8kb.jpg'
5 7
 import Pay from '@/assets/icons/GuideCheck/Pay_logo.png'
6 8
 import food from '@/assets/icons/ProCard/food.png'
@@ -13,11 +15,11 @@ import Cup from '@/assets/icons/GuideCheck/Cup.png'
13 15
 import BlackSpot from '@/assets/icons/GuideCheck/BlackSpot.png'
14 16
 import starOn from '@/assets/icons/GuideCheck/starOn.png'
15 17
 import starOff from '@/assets/icons/GuideCheck/starOff.png'
16
-import { getTouristDetail, getExtendContent, getRecommendList } from '@/services/home'
18
+import { getRecommendList, getExtendContent, getShopPackage } from '@/services/home'
17 19
 import sleep from '@/assets/icons/GuideCheck/sleep_logo.png'
18 20
 import { getTaRoom, goToRoomForm } from '@/services/taRoom​'
21
+import showMore from '../../../assets/icons/housemantj/查看更多.png'
19 22
 
20
-import MoreGuide from "@/components/MoreGuide";
21 23
 import './GuideCss/style.less'
22 24
 
23 25
 
@@ -28,20 +30,37 @@ const score = '3.9'
28 30
 
29 31
 export default (props) => {
30 32
   const { router, person } = props
33
+  console.log("🚀 ~ file: Guide.jsx ~ line 34 ~ props", props)
31 34
   const { roomId, location, roomOrderId } = router.params
32 35
   const [value, setVaule] = useState('已收藏')
33 36
   const [imageSrc, setImageSrc] = useState(starOn)
34 37
   const [extend, setExtend] = useState([])
35 38
   const [ifroomId, setIfroomId] = useState('havenot')
39
+  const [spackage, setPackage] = useState([])
40
+
36 41
   // 住宿经纬度
37 42
   const Roomlog = useRef('')
38 43
   const Roomlat = useRef('')
39 44
   // 停车场经纬度
40 45
   const Parklog = useRef('')
41 46
   const Parklat = useRef('')
42
-
43 47
   const [taRoomContent, setTaRoomContent] = useState([])
44 48
 
49
+
50
+  //当前指南总数
51
+  const [newextNum, setNewextNum] = useState(0)
52
+  //全部指南个数
53
+  const [AllextNum, setAllextNum] = useState(0)
54
+  //指南当前页数
55
+  const [epage, setepage] = useState(2)
56
+  const extendMore = () => {
57
+    setepage(epage + 1)
58
+    getExtendContent('room', roomId, { pageNum: epage }).then((res) => {
59
+      setExtend([...extend, ...res.records])
60
+      setNewextNum(newextNum + res.records.length)
61
+    })
62
+  }
63
+
45 64
   useEffect(() => {
46 65
     if (roomOrderId) {
47 66
       goToRoomForm(roomOrderId).then((res) => {
@@ -55,9 +74,17 @@ export default (props) => {
55 74
     }
56 75
   }, [roomOrderId])
57 76
 
77
+
78
+
79
+
58 80
   useEffect(() => {
81
+    // 老板推荐的套餐
82
+    getRecommendList({ location: location }).then((res) => {
83
+      setPackage(res || [])
84
+    })
59 85
 
60 86
     if (roomId) {
87
+      // 点击’去这里‘跳转导航
61 88
       getTaRoom(roomId).then((res) => {
62 89
         Roomlog.current = (res.location).toString().split(',')[0]
63 90
         Roomlat.current = (res.location).toString().split(',')[1]
@@ -66,18 +93,20 @@ export default (props) => {
66 93
         setTaRoomContent(res || [])
67 94
         console.log(res);
68 95
       })
96
+      //更多指引
69 97
       getExtendContent('room', roomId).then((res) => {
70 98
         setExtend(res.records || [])
71 99
         setIfroomId('reality')
100
+        setAllextNum(res.total)
101
+        setNewextNum(res.records.length)
72 102
       })
73 103
 
74 104
 
75 105
     } else {
76 106
       console.log('房源没有ID');
107
+      return
77 108
     }
78
-    // getRecommendList({ location: location }).then((res) => {
79
-    //   setRecommend(res || [])
80
-    // })
109
+
81 110
   }, [roomId])
82 111
 
83 112
 
@@ -121,14 +150,12 @@ export default (props) => {
121 150
 
122 151
 
123 152
 
153
+
124 154
   const AddCollect = () => {
125 155
     setImageSrc(starOff)
126 156
     setVaule('加入收藏')
127 157
 
128 158
   }
129
-  const handleClick = () => {
130
-    Taro.navigateTo({ url: '/pages/test/index' })
131
-  }
132 159
   // onClick={handleClick}
133 160
   return (
134 161
     <scroll-view scroll-y style='height: 77vh;' >
@@ -200,114 +227,30 @@ export default (props) => {
200 227
                   <text className='MessageCard-text' onClick={() => { wifiCopy() }}>复制</text>
201 228
                 </view>
202 229
               </view>
203
-            </view>
204 230
 
231
+              <view className='Guide-Content-box' >
232
+                <view className='title-image'>
233
+                  <image mode='scaleToFill' className='title-image-cup' src={BlackSpot} />
234
+                  <text className='title-title-boss' >更多指引</text>
235
+                </view>
236
+                {extend?.map((item, index) => <MoreGuide key={(index)} item={item} />)}
237
+
238
+                <view className='showMore' style={{ display: newextNum == AllextNum ? 'none' : '' }} onClick={extendMore}>
239
+                  <view>点击查看更多</view>
240
+                  <image src={showMore} className='moreTip' />
241
+                </view>
242
+              </view>
243
+            </view>
205 244
           )
206 245
         }
207
-
208
-
209
-        {/* 更多指引开始 */}
210
-        <view className='Guide-Content-box'>
211
-          <view className='title-image'>
212
-            <image mode='scaleToFill' className='title-image-cup' src={BlackSpot} />
213
-            <text className='title-title-boss' >更多指引</text>
214
-          </view>
215
-        </view>
216
-        {extend?.map((item, index) => <MoreGuide key={(index)} item={item} />)}
217
-        {/* 更多指引结束 */}
218 246
         <view className='Guide-Content-box'>
219 247
           <view className='title-image'>
220 248
             <image mode='scaleToFill' className='title-image-cup' src={Cup} />
221 249
             <text className='title-title-boss' >老板推荐好吃的</text>
222 250
           </view>
223 251
         </view>
224
-        {/* 小标题结束 */}
225
-        <view class='wrapper'>
226
-          <view class='left-complete-one'>
227
-            <image className='left-image-1' src={ProCard_hot}></image>
228
-            <view className='left-viewText'>
229
-              返现¥16.00
230
-            </view>
231
-            {/* 评分 */}
232
-            <view className='card-box-star'>
233
-              {
234
-                scoreList.map((_, index) => {
235
-                  const src = (index + '0.1') < score ? starOn : starOff
236
-                  return (
237
-                    <image className='card-star-image' key={index} src={src} />
238
-                  )
239
-                })
240
-              }
241
-              <text className='card-star-text' >{score}</text>
242
-            </view>
243
-            <view className='title-image'>
244
-              <image className='image-1' mode='scaleToFill' src={image}></image>
245
-              <image className='image-2' src={food}></image>
246
-            </view>
247
-            <view className='title-content'>
248
-              <view className='Pro-title'>
249
-                <view className='title-text'>【橘里橘啊换行啊啊啊气咖啡店】新鲜出炉啦!</view>
250
-              </view>
251
-              <text className='title-money' >¥6990元<text className='title-money-2'>门市价78元</text></text>
252
-              <view className='title-position-on'>
253
-                <image className='title-position' src={position} />
254
-                <text className='title-position-image'>南京市/秦淮区</text>
255
-                <image className='title-on' src={imageSrc} />
256
-                <text onClick={() => AddCollect()} className='title-on-text'>{value}</text>
257
-              </view>
258
-            </view>
259
-          </view>
260
-          <view class='right-complete-two'>
261
-            <view className='right-content'>
262
-              <image className='right-image' src={Pay} />
263
-              <view className='right-title'>支付</view>
264
-            </view>
265
-          </view>
266
-        </view>
267
-        {/* 卡片----------------- */}
268
-        <view class='wrapper'>
269
-          <view class='left-complete-one'>
270
-            <image className='left-image-1' src={ProCard_hot}></image>
271
-            <view className='left-viewText'>
272
-              返现¥16.00
273
-            </view>
274
-            {/* 评分 */}
275
-            <view className='card-box-star'>
276
-              {
277
-                scoreList.map((_, index) => {
278
-                  const src = (index + '0.1') < score ? starOn : starOff
279
-                  return (
280
-                    <image className='card-star-image' key={index} src={src} />
281
-                  )
282
-                })
283
-              }
284
-              <text className='card-star-text' >{score}</text>
285
-            </view>
286
-            <view className='title-image'>
287
-              <image className='image-1' mode='scaleToFill' src={image}></image>
288
-              <image className='image-2' src={food}></image>
289
-            </view>
290
-            <view className='title-content'>
291
-              <view className='Pro-title'>
292
-                <view className='title-text'>【橘里橘啊换行啊啊啊气咖啡店】新鲜出炉啦!</view>
293
-              </view>
294
-              <text className='title-money' >¥6990元<text className='title-money-2'>门市价78元</text></text>
295
-              <view className='title-position-on'>
296
-                <image className='title-position' src={position} />
297
-                <text className='title-position-image'>南京市/秦淮区</text>
298
-                <image className='title-on' src={imageSrc} />
299
-                <text onClick={() => AddCollect()} className='title-on-text'>{value}</text>
300
-              </view>
301
-            </view>
302
-          </view>
303
-          <view class='right-complete-two'>
304
-            <view className='right-content'>
305
-              {/* <view className='right-number'>×1</view> */}
306
-              <image className='right-image' src={Pay} />
307
-              <view className='right-title'>支付</view>
308
-            </view>
309
-          </view>
310
-        </view>
252
+        {spackage?.map((item, index) => <Cards key={(index)} item={item} />)}
253
+
311 254
         {/* 卡片------------- */}
312 255
         {/* <view className='Guide-Content-box-two'>
313 256
           <view className='title-image-two'>

+ 68
- 3
src/pages/index/tabs/GuideCss/style.less Vedi File

@@ -203,11 +203,13 @@
203 203
     }
204 204
   }
205 205
   .Guide-Content-box {
206
-    margin: 2em 0;
206
+
207 207
     .title-image {
208 208
       display: flex;
209 209
       // width: 270px;
210 210
       height: 40px;
211
+    padding-bottom: 1em;
212
+
211 213
       .title-image-cup {
212 214
         width: 32px;
213 215
         height: 32px;
@@ -224,11 +226,69 @@
224 226
         color: #202020;
225 227
       }
226 228
     }
229
+    .showMore{
230
+      width: 100%;
231
+      background: linear-gradient(0deg, rgba(248, 248, 248, 0.58) 42%, rgba(248, 248, 248, 0) 100%);
232
+      font-size: 28px;
233
+      font-weight: bold;
234
+      color: #202020;
235
+      text-align: center;
236
+      position: relative;
237
+      bottom: 7em;
238
+      padding-top: 77px;
239
+      padding-bottom: 20px;
240
+      .moreTip{
241
+        width: 38px;
242
+        height: 19px;
243
+        margin-top: 14px;
244
+      }
245
+    }
227 246
   }
247
+  // .Guide-Content-box-boss {
248
+
249
+  //   .title-image {
250
+  //     display: flex;
251
+  //     // width: 270px;
252
+  //     height: 40px;
253
+  //   padding-bottom: 1em;
254
+
255
+  //     .title-image-cup {
256
+  //       width: 32px;
257
+  //       height: 32px;
258
+  //       margin-top: 10px;
259
+  //       padding-right: 10px;
260
+  //       align-items: center;
261
+  //     }
262
+
263
+  //     .title-title-boss {
264
+  //       align-items: center;
265
+
266
+  //       font-size: 32px;
267
+  //       font-weight: 800;
268
+  //       color: #202020;
269
+  //     }
270
+  //   }
271
+  //   .showMore{
272
+  //     width: 100%;
273
+  //     background: linear-gradient(0deg, rgba(248, 248, 248, 0.58) 42%, rgba(248, 248, 248, 0) 100%);
274
+  //     font-size: 28px;
275
+  //     font-weight: bold;
276
+  //     color: #202020;
277
+  //     text-align: center;
278
+  //     position: relative;
279
+  //     bottom: 7em;
280
+  //     padding-top: 77px;
281
+  //     padding-bottom: 20px;
282
+  //     .moreTip{
283
+  //       width: 38px;
284
+  //       height: 19px;
285
+  //       margin-top: 14px;
286
+  //     }
287
+  //   }
288
+  // }
228 289
   //卡片---------------
229 290
 
230 291
   .wrapper {
231
-    margin-top: 40px;
232 292
     display: flex;
233 293
     position: relative;
234 294
     // margin-top: 600px;
@@ -452,10 +512,10 @@
452 512
   .Guide-Content-box-two {
453 513
     margin-top: 61px;
454 514
     margin-bottom: 31px;
515
+    
455 516
     .title-image-two {
456 517
       display: flex;
457 518
       width: 270px;
458
-      height: 40px;
459 519
       .title-image-cup-two {
460 520
         width: 32px;
461 521
         height: 32px;
@@ -472,8 +532,13 @@
472 532
         color: #202020;
473 533
       }
474 534
     }
535
+
536
+
475 537
   }
476 538
 
539
+
540
+
541
+
477 542
   //攻略卡片.
478 543
   .Raiders-box-one {
479 544
     // width: 100%;

+ 32
- 25
src/services/payOrder.js Vedi File

@@ -3,31 +3,38 @@ import request from '@/utils/request'
3 3
 //套餐订单列表用哪个接口
4 4
 //订单详情,订单修改数量
5 5
 
6
-  /**
7
- * 生成订单
8
- * @param {*} data 
9
- * @returns 
10
- */
11
-   export const saveOrder = (data) => request('/order', { method: 'post', data })
6
+/**
7
+* 生成订单
8
+* @param {*} data 
9
+* @returns 
10
+*/
11
+export const saveOrder = (data) => request('/order', { method: 'post', data })
12 12
 
13
-   /**
14
- * 获取子订单列表
15
- * @param {*} data
16
- * @returns 
17
- */
18
- export const getOrderSub = (data) => request('/orderSub', { data })
13
+/**
14
+* 获取子订单列表
15
+* @param {*} data
16
+* @returns 
17
+*/
18
+export const getOrderSub = (data) => request('/orderSub', { data })
19 19
 
20
-   /**
21
- * 订单项目发起支付
22
- * @param {*} id 
23
- * @returns 
24
- */
25
-    export const payOrder = (id) => request(`/order/${id}/pay`, { method: 'post' })
20
+/**
21
+* 订单项目发起支付
22
+* @param {*} id 
23
+* @returns 
24
+*/
25
+export const payOrder = (id) => request(`/order/${id}/pay`, { method: 'post' })
26
+
27
+/**
28
+* 获取子订单列表
29
+* @param {*} id
30
+* @returns 
31
+*/
32
+export const getQrcode = (id) => request(`/qrcode/${id}`)
33
+
34
+/**
35
+* 获取待支付/待核销/退款数量
36
+* @param {*} id
37
+* @returns 
38
+*/
39
+export const getMineOrder = () => request(`/orderSub/summary/mine`)
26 40
 
27
-   /**
28
- * 获取子订单列表
29
- * @param {*} id
30
- * @returns 
31
- */
32
-    export const getQrcode = (id) => request(`/qrcode/${id}`)
33
-