李志伟 3 years ago
parent
commit
966f2121f1
1 changed files with 15 additions and 15 deletions
  1. 15
    15
      src/components/foodCards/foodCards.jsx

+ 15
- 15
src/components/foodCards/foodCards.jsx View File

@@ -14,11 +14,11 @@ import './style.less'
14 14
 
15 15
 //套餐卡片
16 16
 export default (props) => {
17
-  const { item } = props
17
+  const { item,st,det } = props
18 18
   const { shopId } = props.item
19 19
   const [isSaved, toggleSave] = useSave(item.isSaved, 'shop_package', item.packageId)
20
-  const [city, setCity] = useState({})
21
-  const [detail, setDetail] = useState({})
20
+  // const [city, setCity] = useState({})
21
+  // const [detail, setDetail] = useState({})
22 22
 
23 23
 
24 24
 
@@ -37,15 +37,15 @@ export default (props) => {
37 37
 
38 38
 
39 39
 
40
-  useEffect(() => {
41
-    getShopDetail(item.shopId).then((res) => {
42
-      setDetail(res)
43
-      getShopcity(res.cityId).then((res2) => {
44
-        setCity(res2)
45
-      })
46
-    })
47
-  }, [])
48
-  const star = parseFloat(((detail.sweetScore + detail.environmentScore + detail.serviceScore) / 3).toFixed(1));
40
+  // useEffect(() => {
41
+  //   getShopDetail(item.shopId).then((res) => {
42
+  //     setDetail(res)
43
+  //     getShopcity(res.cityId).then((res2) => {
44
+  //       setCity(res2)
45
+  //     })
46
+  //   })
47
+  // }, [])
48
+  // const star = parseFloat(((detail.sweetScore + detail.environmentScore + detail.serviceScore) / 3).toFixed(1));
49 49
 
50 50
   return (
51 51
     <view className='foodCard'>
@@ -54,8 +54,8 @@ export default (props) => {
54 54
           返现¥{(item.cashback / 100).toFixed(2)}
55 55
         </view>
56 56
         <view className='appraise'>
57
-          <Star star={star} />
58
-          <text className='storezf'>{star}</text>
57
+          <Star star={st} />
58
+          <text className='storezf'>{st}</text>
59 59
         </view>
60 60
         <view>
61 61
           <view className='contentImg' onClick={() => { goFood() }}>
@@ -71,7 +71,7 @@ export default (props) => {
71 71
             </view>
72 72
             <view className='address'>
73 73
               <image className='dw' src={wz} />
74
-              <text className='wz'>{city.areaName=='南京市'?city.areaName:city.areaPName+'/'+city.areaName}</text>
74
+              <text className='wz'>{det.areaName=='南京市'?det.areaName:item.areaPName+'/'+det.areaName}</text>
75 75
               <view style={{ display: 'inline-block' }} onClick={toggleSave}>
76 76
                 <image className='star' src={isSaved > 0 ? ax : good}></image>
77 77
                 <text className='collection'>{isSaved > 0 ? '已收藏' : '加入收藏'}</text>