|
@@ -1,90 +1,44 @@
|
1
|
|
-import { useState } from 'react'
|
2
|
|
-
|
3
|
1
|
import Taro from '@tarojs/taro'
|
4
|
|
-import { saveTravel } from '@/services/travel'
|
5
|
|
-
|
6
|
|
-import { View, Text, Image, ScrollView } from '@tarojs/components'
|
7
|
|
-import CouponCard from '@/components/CouponCard'
|
|
2
|
+import { View, Text, } from '@tarojs/components'
|
8
|
3
|
import { compressImage } from '@/utils'
|
|
4
|
+import CouponCard from '@/components/CouponCard'
|
9
|
5
|
import SaveIcon from '@/components/SaveIcon'
|
10
|
6
|
import Location from '@/components/Location'
|
11
|
|
-
|
|
7
|
+import { saveTravel } from '@/services/travel'
|
12
|
8
|
import add from '@/assets/icons/Travel/add.png'
|
13
|
|
-
|
14
|
|
-import Popup from '@/components/Popup'
|
15
|
|
-
|
16
|
9
|
import './style.less'
|
17
|
10
|
|
18
|
|
-
|
19
|
11
|
const CouponMedia = CouponCard.Media
|
20
|
12
|
const Action = CouponCard.Action
|
21
|
13
|
|
22
|
14
|
//套餐卡片
|
23
|
15
|
export default (props) => {
|
24
|
|
- const { item, st, editable, setScroll, goshop, det, travelId, handelAddTravel, dayNumber } = props
|
25
|
|
- // const travelId = travelMineContent?.records[0]?.travelId
|
26
|
|
- const { targetId, itemId, targetType } = props.item
|
|
16
|
+ const { item, st, editable, travelId, handelAddTravel, dayNumber } = props
|
|
17
|
+ const { targetId, targetType } = props.item
|
27
|
18
|
const goDetail = () => {
|
28
|
19
|
Taro.navigateTo({ url: `/pages/details/mjDetails/sceneryDetails?id=${targetId}` })
|
29
|
|
-
|
30
|
20
|
}
|
31
|
21
|
const goFood = () => {
|
32
|
22
|
Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${targetId}` })
|
33
|
|
-
|
34
|
|
- }
|
35
|
|
- const [showCutover, setShowCutover] = useState(false)
|
36
|
|
- const [valueList, setValueList] = useState([])
|
37
|
|
-
|
38
|
|
-
|
39
|
|
- const onClose = () => {
|
40
|
|
- //关闭当前套餐详情弹窗
|
41
|
|
- setShowCutover(false)
|
42
|
|
- //使父组件恢复滚动
|
43
|
|
- setScroll(true)
|
44
|
23
|
}
|
45
|
|
-
|
46
|
|
-
|
47
|
|
-
|
48
|
24
|
const handlePayClick = (e) => {
|
49
|
|
-
|
50
|
25
|
saveTravel(travelId, { dayOrder: dayNumber, targetId: targetId, targetType: targetType }).then((res) => {
|
51
|
26
|
Taro.showToast({
|
52
|
27
|
title: '添加成功',
|
53
|
28
|
icon: 'none',
|
54
|
|
-
|
55
|
29
|
duration: 1000
|
56
|
30
|
})
|
57
|
31
|
handelAddTravel()
|
58
|
|
-
|
59
|
|
-
|
60
|
32
|
})
|
61
|
|
-
|
62
|
|
- // Taro.navigateTo({ url: `/pages/PayOrder/index?packageId=${item.packageId}&scene=${scene || ''}&subOrderId=${subOrderId}&id=${id}` })
|
63
|
|
-
|
64
|
33
|
}
|
65
|
34
|
const PayAction = <Action.Icon icon={add} text='增加' onClick={handlePayClick} />
|
66
|
|
-
|
67
|
|
-
|
68
|
|
-
|
69
|
|
-
|
70
|
35
|
return (
|
71
|
36
|
<View style={{ margin: '15px 5px' }} >
|
72
|
|
- <View className='packageDetail' style={{ display: goshop ? '' : 'none' }}>
|
73
|
|
- <Popup show={showCutover} maskClosable={showCutover} onClose={onClose}>
|
74
|
|
- <ScrollView
|
75
|
|
- scrollY
|
76
|
|
- style={{ maxHeight: '60vh' }}
|
77
|
|
- >
|
78
|
|
- <Image mode='widthFix' src={item.details ? item.details : item.poster} />
|
79
|
|
- </ScrollView>
|
80
|
|
- </Popup >
|
81
|
|
- </View>
|
82
|
37
|
<CouponCard action={PayAction}>
|
83
|
38
|
<CouponMedia onClick={item.targetType === 'tourist' ? goDetail : goFood}>
|
84
|
39
|
<CouponMedia.Header
|
85
|
40
|
cashback={item.cashback}
|
86
|
41
|
image={compressImage(item.poster)}
|
87
|
|
- // badge='food'
|
88
|
42
|
/>
|
89
|
43
|
<CouponMedia.Body star={st}>
|
90
|
44
|
<View className='foodCard'>
|
|
@@ -93,11 +47,10 @@ export default (props) => {
|
93
|
47
|
</View>
|
94
|
48
|
<View className='cpn-card-text' style={{ marginTop: '10rpx' }}>
|
95
|
49
|
<Text className='cpn-card-text_mn'>¥{`${(item.averagePrice == '' ? '0.00' : item.averagePrice / 100)?.toFixed(2)}元`}</Text>
|
96
|
|
- {/* <Text className='cpn-card-text_rm'>{`门市价${(item.standardPrice / 100)?.toFixed(2)}元`}</Text> */}
|
97
|
50
|
</View>
|
98
|
51
|
<View className='cpn-md-act'>
|
99
|
|
- <Location {...det} />
|
100
|
|
- <SaveIcon saved={item.isSaved > 0} targetType='shop_package' editable={editable} targetId={item.targetId} />
|
|
52
|
+ <Location {...item} />
|
|
53
|
+ <SaveIcon saved={item.isSaved > 0} targetType={item.targetType} editable={editable} targetId={item.targetId} />
|
101
|
54
|
</View>
|
102
|
55
|
</View>
|
103
|
56
|
</CouponMedia.Body>
|