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