李志伟 3 years ago
parent
commit
87f5da0082
1 changed files with 2 additions and 72 deletions
  1. 2
    72
      src/components/foodCards/ShopNoteCard/index.jsx

+ 2
- 72
src/components/foodCards/ShopNoteCard/index.jsx View File

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