李志伟 3 years ago
parent
commit
ec44c18da4

+ 26
- 7
src/components/foodCards/foodCards.jsx View File

@@ -1,11 +1,13 @@
1 1
 import Taro from '@tarojs/taro'
2
-import { View, Text } from '@tarojs/components'
2
+import { View, Text, Image, Button, ScrollView } from '@tarojs/components'
3 3
 import CouponCard from '@/components/CouponCard'
4 4
 import Location from '@/components/Location'
5 5
 import { compressImage } from '@/utils'
6 6
 import SaveIcon from '@/components/SaveIcon'
7 7
 import Pay from '@/assets/icons/housemantj/pay.png'
8
+import Popup from '@/components/Popup'
8 9
 import './style.less'
10
+import { useState } from 'react'
9 11
 
10 12
 
11 13
 const CouponMedia = CouponCard.Media
@@ -13,26 +15,43 @@ const Action = CouponCard.Action
13 15
 
14 16
 //套餐卡片
15 17
 export default (props) => {
16
-  const { item, st, det, editable, goshop, scene, subOrderId, id } = props
18
+  const { item, st, det, editable,setScroll, goshop, scene, subOrderId, id } = props
17 19
   const { shopId } = props.item
18 20
   const goFood = () => {
19 21
     Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${shopId}` })
20 22
   }
23
+  const [showCutover, setShowCutover] = useState(false)
21 24
   const goDetail = () => {
22
-    
25
+    //打开当前套餐详情弹窗
26
+    setShowCutover(true)
27
+    //使父组件禁止滚动
28
+    setScroll(false)
29
+  }
30
+  const onClose = () => {
31
+    //关闭当前套餐详情弹窗
32
+    setShowCutover(false)
33
+    //使父组件恢复滚动
34
+    setScroll(true)
23 35
   }
24 36
 
25
-  // 支付成功--判断---有---问--没有--跳转到全部订单
26 37
 
27 38
 
28 39
   const handlePayClick = () => {
29 40
     Taro.navigateTo({ url: `/pages/PayOrder/index?packageId=${item.packageId}&scene=${scene || ''}&subOrderId=${subOrderId}&id=${id}` })
30
-    console.log("🚀 ~ file: foodCards.jsx ~ line 17 ~ scene", item.packageId, scene)
31
-
32 41
   }
33 42
   const PayAction = <Action.Icon icon={Pay} text='支付' onClick={handlePayClick} />
34 43
   return (
35
-    <View style={{ margin: '15px 5px' }}>
44
+    <View style={{ margin: '15px 5px' }} >
45
+      <View className='packageDetail' style={{display:goshop?'':'none'}}>
46
+        <Popup show={showCutover} maskClosable={showCutover}  onClose={onClose}>
47
+          <ScrollView
48
+            scrollY
49
+            style={{ maxHeight: '60vh' }}
50
+          >
51
+            <Image mode='widthFix' src={item.details ? item.details : item.poster} />
52
+          </ScrollView>
53
+        </Popup >
54
+      </View>
36 55
       <CouponCard action={PayAction}>
37 56
         <CouponMedia onClick={goshop ? goDetail : goFood}>
38 57
           <CouponMedia.Header

+ 9
- 0
src/components/foodCards/style.less View File

@@ -35,4 +35,13 @@
35 35
       flex: 1;
36 36
     }
37 37
   }
38
+}
39
+.packageDetail{
40
+  Image{
41
+    width: 100%;
42
+  }
43
+  .weui-dialog__bd{
44
+    padding: 0;
45
+    margin: 0;
46
+  }
38 47
 }

+ 4
- 2
src/pages/details/foodDetails/foodDetails.config.js View File

@@ -2,6 +2,8 @@ export default {
2 2
   navigationBarTitleText: '美食详情',
3 3
   navigationStyle: 'custom',
4 4
   disableScroll: true,
5
-
6
-  enableShareAppMessage: true
5
+  enableShareAppMessage: true,
6
+  usingComponents: {
7
+    "mp-dialog": "weui-miniprogram/dialog/dialog",
8
+  }
7 9
 }

+ 3
- 3
src/pages/details/foodDetails/foodDetails.jsx View File

@@ -126,7 +126,7 @@ export default withLayout((props) => {
126 126
       imageUrl: detail.poster,
127 127
     };
128 128
   });
129
-
129
+ const [isScroll,setScroll]=useState(true)
130 130
   return (
131 131
     <view className='page-index'>
132 132
       <view className='index-navbar'>
@@ -134,7 +134,7 @@ export default withLayout((props) => {
134 134
       </view>
135 135
       <SpinBox loading={loading} className='index-container' style={{ padding: '0 30rpx' }}>
136 136
         <scroll-view
137
-          scrollY
137
+          scrollY={isScroll}
138 138
           style={{ height: '100%' }}
139 139
         >
140 140
           <view className='storeDetails'>
@@ -217,7 +217,7 @@ export default withLayout((props) => {
217 217
                     <text>返现套餐</text>
218 218
                   </view>
219 219
                   {(spackage || []).map((item) => (
220
-                    <Cards scene={scene} id={id} subOrderId={subOrderId} key={item.packageId} editable='1' st={star} goshop='1' item={item} det={detail} />
220
+                    <Cards scene={scene} id={id} setScroll={setScroll} subOrderId={subOrderId} key={item.packageId} editable='1' st={star} goshop='1' item={item} det={detail} />
221 221
                   ))}
222 222
                 </view>
223 223
                 <view