|
@@ -6,12 +6,10 @@ import CouponCard from '@/components/CouponCard'
|
6
|
6
|
import { compressImage } from '@/utils'
|
7
|
7
|
import SaveIcon from '@/components/SaveIcon'
|
8
|
8
|
import Location from '@/components/Location'
|
9
|
|
-
|
10
|
9
|
import grassOFF from '@/assets/icons/housemantj/grassOFF.png'
|
11
|
10
|
import grassNO from '@/assets/icons/housemantj/grassNO.png'
|
12
|
11
|
import Popup from '@/components/Popup'
|
13
|
12
|
import { saveTravel, newTravelMine } from '@/services/travel'
|
14
|
|
-
|
15
|
13
|
import './style.less'
|
16
|
14
|
|
17
|
15
|
|
|
@@ -21,24 +19,18 @@ const Action = CouponCard.Action
|
21
|
19
|
//套餐卡片
|
22
|
20
|
export default (props) => {
|
23
|
21
|
const { item, st, editable, setScroll, goshop, travelMine, resourceList, det, handelNoteList } = props
|
24
|
|
- // const travelId = travelMineContent?.records[0]?.travelId
|
25
|
22
|
const targetId = props.item?.targetId
|
26
|
23
|
const targetType = props.item?.targetType
|
27
|
|
-
|
28
|
24
|
const goFood = () => {
|
29
|
25
|
Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${targetId}` })
|
30
|
|
-
|
31
|
26
|
}
|
32
|
27
|
const [showCutover, setShowCutover] = useState(false)
|
33
|
28
|
const [valueList, setValueList] = useState([])
|
34
|
|
-
|
35
|
|
- const [traveCoumun, setTraveCoumun] = useState()
|
|
29
|
+ const [traveCoumun, setTraveCoumun] = useState() //第几天
|
36
|
30
|
|
37
|
31
|
useEffect(() => {
|
38
|
|
-
|
39
|
32
|
setValueList(travelMine?.records)
|
40
|
33
|
setTraveCoumun(travelMine?.records[0].dayNum)
|
41
|
|
-
|
42
|
34
|
}, [travelMine?.records, item])
|
43
|
35
|
|
44
|
36
|
const onClose = () => {
|
|
@@ -48,8 +40,6 @@ export default (props) => {
|
48
|
40
|
setScroll(true)
|
49
|
41
|
}
|
50
|
42
|
|
51
|
|
- //列改变
|
52
|
|
-
|
53
|
43
|
|
54
|
44
|
const numberTrave = (new Array(traveCoumun).fill()).map((_, index) => ({ id: index + 1, title: `第 ${index + 1} 天` }))
|
55
|
45
|
|
|
@@ -57,89 +47,36 @@ export default (props) => {
|
57
|
47
|
|
58
|
48
|
|
59
|
49
|
const handleColumn = e => {
|
60
|
|
- console.log("🚀 ~ file: index.jsx ~ line 63 ~ e", e)
|
61
|
|
- // console.log(e.detail.column);
|
62
|
50
|
const { column, value } = e.detail
|
63
|
|
-
|
64
|
51
|
if (column == 0) {
|
65
|
|
-
|
66
|
52
|
const firstValue = valueList[value] || ''
|
67
|
53
|
setTraveCoumun(firstValue.dayNum)
|
68
|
|
-
|
69
|
54
|
}
|
70
|
|
-
|
71
|
|
-
|
72
|
|
-
|
73
|
55
|
}
|
74
|
56
|
|
75
|
|
-
|
76
|
57
|
const day = new Date();
|
77
|
58
|
const y = day.getFullYear();
|
78
|
59
|
const m = day.getMonth() + 1;
|
79
|
60
|
const d = day.getDate();
|
80
|
|
- let number = 0
|
81
|
|
-
|
82
|
61
|
const hanleChange = (e) => {
|
83
|
|
- console.log("🚀 ~ file: index.jsx ~ line 63 ~ e", e)
|
84
|
|
-
|
85
|
|
- if (travelMine?.records == '') {
|
86
|
|
-
|
87
|
|
-
|
88
|
|
- // newTravelMine({ title: `我的行程 ${y}-${m}-${d}` }).then(res => {
|
89
|
|
- // handelNoteList()
|
90
|
|
- // // 首先创建一个行程,然后才能拿到下面的这些数据
|
91
|
|
-
|
92
|
|
- // const [firstInx, secondInx] = e.detail?.value
|
93
|
|
-
|
94
|
|
- // const firstValue = valueList[firstInx] || ''
|
95
|
|
-
|
96
|
|
- // const secondValue = numberTrave[secondInx] || ''
|
97
|
|
-
|
98
|
|
- // const { travelId } = firstValue
|
99
|
|
-
|
100
|
|
- // //行程内容
|
101
|
|
- // const { id } = secondValue//天数
|
102
|
|
- // // saveTravel({})
|
103
|
|
- // saveTravel(res.travelId, { dayOrder: id, targetId: targetId, targetType: targetType }).then((val) => {
|
104
|
|
- // Taro.showToast({
|
105
|
|
- // title: '添加成功',
|
106
|
|
- // icon: 'none',
|
107
|
|
- // duration: 1000
|
108
|
|
- // })
|
109
|
|
- // resourceList(travelId)
|
110
|
|
- // })
|
111
|
|
- // })
|
112
|
|
-
|
113
|
|
- return;
|
114
|
|
- } else {
|
|
62
|
+ if (travelMine?.records != '') {
|
115
|
63
|
const [firstInx, secondInx] = e.detail.value
|
116
|
|
-
|
117
|
64
|
const firstValue = valueList[firstInx]
|
118
|
|
-
|
119
|
65
|
const secondValue = numberTrave[secondInx]
|
120
|
|
-
|
121
|
66
|
const { travelId } = firstValue
|
122
|
|
-
|
123
|
|
-
|
124
|
67
|
//行程内容
|
125
|
68
|
const { id } = secondValue//天数
|
126
|
|
-
|
127
|
69
|
saveTravel(travelId, { dayOrder: id, targetId: targetId, targetType: targetType }).then((res) => {
|
128
|
70
|
Taro.showToast({
|
129
|
71
|
title: '添加成功',
|
130
|
72
|
icon: 'none',
|
131
|
|
-
|
132
|
73
|
duration: 1000
|
133
|
74
|
})
|
134
|
75
|
resourceList(travelId)
|
135
|
|
-
|
136
|
|
- // setGrowGrass(grassNO)
|
137
|
|
-
|
138
|
76
|
})
|
139
|
77
|
}
|
140
|
78
|
}
|
141
|
79
|
|
142
|
|
-
|
143
|
80
|
const handlePayClick = () => {
|
144
|
81
|
if (travelMine?.records == '') {
|
145
|
82
|
Taro.showToast({
|
|
@@ -152,10 +89,7 @@ export default (props) => {
|
152
|
89
|
handelNoteList()
|
153
|
90
|
// 首先创建一个行程,然后才能拿到下面的这些数据
|
154
|
91
|
})
|
155
|
|
-
|
156
|
92
|
}
|
157
|
|
- // Taro.navigateTo({ url: `/pages/PayOrder/index?packageId=${item.packageId}&scene=${scene || ''}&subOrderId=${subOrderId}&id=${id}` })
|
158
|
|
-
|
159
|
93
|
}
|
160
|
94
|
const PayAction = travelMine?.total >= 1 ?
|
161
|
95
|
<View className='view-picker'>
|
|
@@ -167,7 +101,6 @@ export default (props) => {
|
167
|
101
|
onColumnChange={handleColumn}
|
168
|
102
|
onChange={hanleChange}
|
169
|
103
|
scrollType='link'
|
170
|
|
- // value={}
|
171
|
104
|
>
|
172
|
105
|
<Action.Icon icon={item.isVisited < 1 ? grassOFF : grassNO} text={item.isVisited < 1 ? '种草' : '已种草'} onClick={handlePayClick} />
|
173
|
106
|
</Picker>
|
|
@@ -175,7 +108,6 @@ export default (props) => {
|
175
|
108
|
:
|
176
|
109
|
<Action.Icon icon={item.isVisited < 1 ? grassOFF : grassNO} text={item.isVisited < 1 ? '种草' : '已种草'} onClick={handlePayClick} />
|
177
|
110
|
|
178
|
|
-
|
179
|
111
|
return (
|
180
|
112
|
<View style={{ margin: '15px 5px' }} >
|
181
|
113
|
<View className='packageDetail' style={{ display: goshop ? '' : 'none' }}>
|
|
@@ -202,7 +134,6 @@ export default (props) => {
|
202
|
134
|
</View>
|
203
|
135
|
<View className='cpn-card-text' style={{ marginTop: '10rpx' }}>
|
204
|
136
|
<Text className='cpn-card-text_mn'>¥{`${(item.averagePrice == '' ? 0 / 100 : item.averagePrice / 100).toFixed(2)}元`}</Text>
|
205
|
|
- {/* <Text className='cpn-card-text_rm'>{`门市价${(item.standardPrice / 100)?.toFixed(2)}元`}</Text> */}
|
206
|
137
|
</View>
|
207
|
138
|
<View className='cpn-md-act'>
|
208
|
139
|
<Location {...det} />
|