吃个甘蔗嚼一年 3 年 前
コミット
ff606e5f7b
共有2 個のファイルを変更した38 個の追加28 個の削除を含む
  1. 36
    26
      src/components/BossCard/index.jsx
  2. 2
    2
      src/pages/index/tabs/Guide.jsx

+ 36
- 26
src/components/BossCard/index.jsx ファイルの表示

@@ -1,62 +1,72 @@
1
-import withLayout from '@/layouts'
1
+import Taro from '@tarojs/taro'
2 2
 import useSave from "@/utils/hooks/useSave"
3
-import image from '@/assets/icons/ProCard/8kb.jpg'
4
-import AuthPage from '@/components/AuthPage'
5
-import formatTimes from '@/utils/formatTime'
3
+import { getShopDetail, getShopcity } from '@/services/home'
6 4
 import { useState, useEffect } from 'react'
7
-import { Button, Radio, Input } from '@tarojs/components'
5
+import Star from '@/components/Star/Star.jsx'
6
+import position from '@/assets/icons/GuideCheck/position_logo.png'
7
+import Pay from '@/assets/icons/GuideCheck/Pay_logo.png'
8
+import starOff from '@/assets/icons/GuideCheck/starOff.png'
9
+import starOn from '@/assets/icons/GuideCheck/starOn.png'
8 10
 import food from '@/assets/icons/ProCard/food.png'
9 11
 import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
10
-import OrderMolded from '@/components/OrderMolded'
11
-import Popup from '@/components/Popup'
12
+
13
+
14
+//入住指引--老板推荐
12 15
 
13 16
 
14 17
 
15 18
 import './style.less'
16 19
 
17 20
 export default (props) => {
18
-  const { } = props
21
+  const { item } = props
22
+  const [isSaved, toggleSave] = useSave(item.isSaved, 'shop_package', item.packageId)
23
+  const [city, setCity] = useState({})
24
+  const [detail, setDetail] = useState({})
19 25
 
26
+  useEffect(() => {
27
+    getShopDetail(item.shopId).then((res) => {
28
+      setDetail(res)
29
+      getShopcity(res.cityId).then((x) => {
30
+        setCity(x)
31
+      })
32
+    })
33
+  }, [])
34
+  const star = parseFloat(((detail.sweetScore + detail.environmentScore + detail.serviceScore) / 3).toFixed(1));
20 35
   return (
21
-
22 36
     <view class='container'>
23 37
       <view class='wrapper'>
24 38
         <view class='left-complete-one'>
25 39
           <image className='left-image-1' src={ProCard_hot}></image>
26 40
           <view className='left-viewText'>
27
-            返现¥16.00
41
+            返现¥{item.cashback / 100}
28 42
           </view>
29 43
           {/* 评分 */}
30 44
           <view className='card-box-star'>
31
-            {
32
-              scoreList.map((_, index) => {
33
-                const src = (index + '0.1') < score ? starOn : starOff
34
-                return (
35
-                  <image className='card-star-image' key={index} src={src} />
36
-                )
37
-              })
38
-            }
39
-            <text className='card-star-text' >{score}</text>
45
+            <Star star={star} />
46
+            <text className='card-star-text' >{star}</text>
40 47
           </view>
41 48
           <view className='title-image'>
42
-            <image className='image-1' mode='scaleToFill' src={image}></image>
49
+            <image className='image-1' mode='scaleToFill' src={item.poster}></image>
43 50
             <image className='image-2' src={food}></image>
44 51
           </view>
45 52
           <view className='title-content'>
46 53
             <view className='Pro-title'>
47
-              <view className='title-text'>【橘里橘啊换行啊啊啊气咖啡店】新鲜出炉啦!</view>
54
+              <view className='title-text'>{(item.description).toString().length > 25 ? (item.description).substring(0, 25) + '...' : (item.description)}</view>
48 55
             </view>
49
-            <text className='title-money' >¥6990元<text className='title-money-2'>门市价78元</text></text>
56
+            <text className='title-money' >¥{item.actualPrice / 100}元<text className='title-money-2'>门市价{item.standardPrice / 100}元</text></text>
50 57
             <view className='title-position-on'>
51 58
               <image className='title-position' src={position} />
52
-              <text className='title-position-image'>南京市/秦淮区</text>
53
-              <image className='title-on' src={imageSrc} />
54
-              <text onClick={() => AddCollect()} className='title-on-text'>{value}</text>
59
+              <text className='title-position-image'>{city.areaPName}/{city.areaName}</text>
60
+              <view style={{ display: 'inline-block' }} onClick={toggleSave}>
61
+
62
+                <image className='title-on' src={isSaved > 0 ? starOn : starOff} />
63
+                <text className='title-on-text'>{isSaved > 0 ? '已收藏' : '加入收藏'}</text>
64
+              </view>
55 65
             </view>
56 66
           </view>
57 67
         </view>
58 68
         <view class='right-complete-two'>
59
-          <view className='right-content'>
69
+          <view className='right-content' onClick={() => { Taro.navigateTo({ url: `/pages/PayOrder/index?packageId=${item.packageId}` }); }}>
60 70
             {/* <view className='right-number'>×1</view> */}
61 71
             <image className='right-image' src={Pay} />
62 72
             <view className='right-title'>支付</view>

+ 2
- 2
src/pages/index/tabs/Guide.jsx ファイルの表示

@@ -2,7 +2,7 @@ import { useState, useEffect, useRef } from "react";
2 2
 import Taro from '@tarojs/taro'
3 3
 import MoreGuide from "@/components/MoreGuide";
4 4
 import Cards from '@/components/foodCards/foodCards.jsx'
5
-
5
+import BossCard from '@/components/BossCard'
6 6
 import image from '@/assets/icons/ProCard/8kb.jpg'
7 7
 import Pay from '@/assets/icons/GuideCheck/Pay_logo.png'
8 8
 import food from '@/assets/icons/ProCard/food.png'
@@ -249,7 +249,7 @@ export default (props) => {
249 249
             <text className='title-title-boss' >老板推荐好吃的</text>
250 250
           </view>
251 251
         </view>
252
-        {spackage?.map((item, index) => <Cards key={(index)} item={item} />)}
252
+        {spackage?.map((item, index) => <BossCard key={(index)} item={item} />)}
253 253
 
254 254
         {/* 卡片------------- */}
255 255
         {/* <view className='Guide-Content-box-two'>