张延森 3 年之前
父節點
當前提交
ec17101433

+ 6
- 3
src/components/BadgeTag/index.jsx 查看文件

@@ -5,15 +5,18 @@ import food from '@/assets/icons/ProCard/food.png'
5 5
 import './style.less'
6 6
 
7 7
 export default (props) => {
8
-  const { type, style } = props
8
+  const { type, top = '0px', left = '0px' } = props
9 9
 
10
-  const text = type === 'food' ? '美食' : '攻略';
11 10
   const icon = type === 'food' ? food : undefined;
12 11
 
12
+  const style = {
13
+    top,
14
+    left
15
+  }
16
+
13 17
   return (
14 18
     <View className='badge-tag-box' style={style}>
15 19
       <Image src={icon} className='badge-icon' />
16
-      <Text>{text}</Text>
17 20
     </View>
18 21
   )
19 22
 }

+ 3
- 13
src/components/BadgeTag/style.less 查看文件

@@ -1,20 +1,10 @@
1 1
 
2 2
 .badge-tag-box {
3
-  font-size: 20px;
4
-  font-weight: 400;
5
-  color: #FFFFFF;
6 3
   box-sizing: border-box;
7
-  padding: 8px 10px;
8
-  background: rgba(0, 0, 0, .2);
9
-  border-bottom-right-radius: 24px;
4
+  position: absolute;
10 5
 
11 6
   .badge-icon {
12
-    display: inline-block !important;
13
-    width: 22px !important;
14
-    height: 22px !important;
15
-  }
16
-
17
-  text {
18
-    margin-left: 6px;
7
+    width: 99px;
8
+    height: 36px;
19 9
   }
20 10
 }

+ 27
- 78
src/components/BossCard/index.jsx 查看文件

@@ -1,34 +1,21 @@
1 1
 import Taro from '@tarojs/taro'
2
-import { View, Image } from '@tarojs/components'
3
-import useSave from "@/utils/hooks/useSave"
4
-import { getShopDetail, getShopcity } from '@/services/home'
5
-import { useState, useEffect } from 'react'
6
-// import Star from '@/components/Star/Star.jsx'
7
-import position from '@/assets/icons/GuideCheck/position_logo.png'
2
+import { View, Text } from '@tarojs/components'
8 3
 import Pay from '@/assets/icons/GuideCheck/Pay_logo.png'
9 4
 
10
-import starOn from '@/assets/icons/housemantj/onlove.png'
11
-import starOff from '@/assets/icons/housemantj/touristGood.png'
12
-import food from '@/assets/icons/ProCard/food.png'
13
-import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
14
-
15 5
 import { getQueryString } from '@/utils/index'
16 6
 import CouponCard from '@/components/CouponCard'
17
-import IconAction from '@/components/CouponCard/components/IconAction'
18
-import Cashback from '@/components/CouponCard/components/Cashback'
19
-import Star from '@/components/Star'
20
-import BadgeTag from '@/components/BadgeTag'
7
+import Location from '@/components/Location'
8
+import SaveIcon from '@/components/SaveIcon'
21 9
 
22 10
 import './style.less'
23 11
 
12
+const CouponMedia = CouponCard.Media
13
+const Action = CouponCard.Action
14
+
24 15
 export default (props) => {
25 16
 
26 17
   const { item, st, taRoomContent, trackClick, det } = props
27 18
   const { shopId, packageId } = props.item
28
-  const [isSaved, toggleSave] = useSave(item.isSaved, 'shop_package', item.packageId)
29
-
30
-
31
-
32 19
 
33 20
   const goFood = () => {
34 21
     trackClick({ eventType: 'hotel_recommend_package', eventParams: getQueryString({ hotelId: taRoomContent.hotelId, shopId: shopId, packageId: packageId }) })
@@ -39,69 +26,31 @@ export default (props) => {
39 26
     Taro.navigateTo({ url: `/pages/PayOrder/index?packageId=${item.packageId}` })
40 27
   }
41 28
 
42
-  const PayAction = <IconAction icon={Pay} text='支付' onClick={handlePayClick} />
29
+  const PayAction = <Action.Icon icon={Pay} text='支付' onClick={handlePayClick} />
43 30
 
44 31
   return (
45 32
     <CouponCard action={PayAction}>
46
-      <View className='coupun-content'>
47
-        <View className='coupun-content_header'>
48
-          <Cashback money={item.cashback} style={{ position: 'absolute', top: '20rpx', left: 0 }} />
49
-          <View className='coupun-content_thumb'>
50
-            <BadgeTag type='food' style={{ position: 'absolute', top: 0, left: 0 }} />
51
-            <Image src={item.poster} />
33
+      <CouponMedia onClick={goFood}>
34
+        <CouponMedia.Header
35
+          cashback={item.cashback}
36
+          image={item.poster}
37
+          badge='food'
38
+        />
39
+        <CouponMedia.Body star={st}>
40
+          <View className='cpn-card-text'>
41
+            {(item.description).toString().length > 25 ? (item.description).substring(0, 25) + '...' : (item.description)}
42
+          </View>
43
+          <View className='cpn-card-text' style={{marginTop: '10rpx'}}>
44
+            <Text className='cpn-card-text_ms'>¥</Text>
45
+            <Text className='cpn-card-text_mn'>{`${(item.actualPrice / 100)?.toFixed(2)}元`}</Text>
46
+            <Text className='cpn-card-text_rm'>{`门市价${(item.standardPrice / 100)?.toFixed(2)}元`}</Text>
52 47
           </View>
53
-        </View>
54
-        <View className='coupun-content_body'>
55
-          <Star score={st} style={{ position: 'absolute', top: '26rpx', left: 0 }} />
56
-        </View>
57
-      </View>
48
+          <View className='cpn-md-act'>
49
+            <Location {...det} />
50
+            <SaveIcon saved={item.isSaved > 0} targetType='shop_package' targetId={item.packageId} />
51
+          </View>
52
+        </CouponMedia.Body>
53
+      </CouponMedia>
58 54
     </CouponCard>
59 55
   )
60
-
61
-
62
-  // return (
63
-  //   <view class='container'>
64
-  //     <view class='wrapper'>
65
-  //       <view class='left-complete-one' onClick={() => { goFood() }} >
66
-  //         {/* <image className='left-image-1' src={ProCard_hot}></image> */}
67
-  //         <view className='left-viewText'>
68
-  //           返现¥{(item.cashback / 100)?.toFixed(2)}
69
-  //         </view>
70
-  //         {/* 评分 */}
71
-  //         <view className='card-box-star'>
72
-  //           <Star star={st} />
73
-  //           <text className='card-star-text' >{st}</text>
74
-  //         </view>
75
-  //         <view className='title-image' >
76
-  //           <image className='image-1' mode='scaleToFill' src={item.poster}></image>
77
-  //           <image className='image-2' src={food}></image>
78
-  //         </view>
79
-  //         <view className='title-content'>
80
-  //           <view className='Pro-title'  >
81
-  //             <view className='title-text'>{(item.description).toString().length > 25 ? (item.description).substring(0, 25) + '...' : (item.description)}</view>
82
-  //           </view>
83
-  //           <text className='title-money' >¥{(item.actualPrice / 100)?.toFixed(2)}元<text className='title-money-2'>门市价{(item.standardPrice / 100)?.toFixed(2)}元</text></text>
84
-  //           <view className='title-position-on'>
85
-  //             <image className='title-position' src={position} />
86
-  //             <text className='title-position-image'>{det.areaName == '南京市' ? det.areaName : det.areaPName + '/' + det.areaName}</text>
87
-  //             {/* <view style={{ display: 'inline-block' }} onClick={toggleSave}>
88
-
89
-  //               <image className='title-on' src={isSaved > 0 ? starOn : starOff} />
90
-  //               <text className='title-on-text'>{isSaved > 0 ? '已收藏' : '加入收藏'}</text>
91
-  //             </view> */}
92
-  //           </view>
93
-  //         </view>
94
-  //       </view>
95
-  //       <view class='right-complete-two'>
96
-  //         <view className='right-content' onClick={() => { Taro.navigateTo({ url: `/pages/PayOrder/index?packageId=${item.packageId}` }); }}>
97
-  //           {/* <view className='right-number'>×1</view> */}
98
-  //           <image className='right-image' src={Pay} />
99
-  //           <view className='right-title'>支付</view>
100
-  //         </view>
101
-  //       </view>
102
-  //     </view>
103
-  //   </view>
104
-
105
-
106
-  // )
107 56
 }

+ 220
- 207
src/components/BossCard/style.less 查看文件

@@ -1,138 +1,184 @@
1
-@whiteColor: #fff;
2
-@Image-ProCard_hot: "../../assets/icons/ProCard/ProCard_hot.png";
3
-.container {
4
-  width: 100%;
5
-  .item-center-Number {
6
-    width: 100%;
7
-    margin-top: 30px;
8
-    .buy-num-minus {
9
-      display: inline-block;
10
-      width: 60px;
11
-      height: 60px;
12
-      background: #ffffff;
13
-      border: 1px solid #999999;
14
-      border-radius: 8px 0px 0px 8px;
15
-    }
16
-    .buy-num-input {
17
-      display: inline-block;
18
-      width: 90px;
19
-      height: 60px;
20
-      font-size: 28px;
21
-      font-weight: 400;
22
-      color: #202020;
23
-      background: #ffffff;
24
-      border: 1px solid #999999;
25
-      position: relative;
26
-      top: 26px;
27
-    }
28
-    .buy-num-add {
29
-      display: inline-block;
30 1
 
31
-      width: 60px;
32
-      height: 60px;
33
-      background: #ffffff;
34
-      border: 1px solid #999999;
35
-      border-radius: 0px 8px 8px 0px;
2
+.cpn-card-text {
3
+  font-size: 24px;
4
+  font-weight: 400;
5
+  color: #333333;
6
+  line-height: 40px;
7
+  vertical-align: baseline;
8
+
9
+  & > text {
10
+    display: inline-block;
11
+
12
+    & + text {
13
+      margin-left: 8px;
36 14
     }
37 15
   }
38
-  .buy-button-box {
39
-    width: 100%;
40
-    margin: 40px 0 0 0;
41 16
 
42
-    .button-Cancel {
43
-      display: inline-block;
44
-      width: 236px;
45
-      height: 78px;
46
-      border: 2px solid #274291;
47
-      font-size: 30px;
48
-      font-weight: bold;
49
-      color: #274291;
50
-      border-radius: 12px;
51
-      margin-right: 80px;
52
-    }
53
-    .button-OK {
54
-      display: inline-block;
17
+  &_ms {
18
+    font-size: 20px;
19
+    font-weight: bold;
20
+    color: #333333;
21
+  }
55 22
 
56
-      width: 236px;
57
-      height: 78px;
58
-      background: #274291;
59
-      border-radius: 12px;
60
-      font-size: 30px;
61
-      font-weight: bold;
62
-      color: #ffffff;
63
-    }
23
+  &_mn {
24
+    font-size: 24px;
25
+    font-weight: bold;
26
+    color: #333333;
64 27
   }
65 28
 
66
-  .wrapper {
67
-    display: flex;
68
-    position: relative;
69
-    margin: 30px auto;
70
-    width: 100%;
71
-    // box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.12);
72
-    // filter: drop-shadow(5px 8px 6px rgb(202, 202, 202));
73
-    filter: drop-shadow(0 0 0.9rem rgba(0, 0, 0, 0.12));
29
+  &_rm {
30
+    font-size: 18px;
31
+    font-weight: 400;
32
+    text-decoration: line-through;
33
+    color: #666666;
34
+  }
35
+}
74 36
 
75
-    .left-complete-one {
76
-      padding-top: 87px;
77
-      padding-bottom: 43px;
78
-      position: relative;
79
-      display: flex;
80
-      background: @whiteColor;
81
-      background: radial-gradient(
82
-            circle at top right,
83
-            transparent 15px,
84
-            #fff 0 0
85
-          )
86
-          top right,
87
-        radial-gradient(circle at bottom right, transparent 15px, #fff 0 0)
88
-          bottom right;
89
-      background-size: 100% 60%;
90
-      background-repeat: no-repeat;
37
+.cpn-md-act {
38
+  display: flex;
39
+  margin-top: 10px;
91 40
 
92
-      width: 573px;
93
-      border-radius: 15px 0px 0px 15px;
94
-      // border-radius: 12px;
41
+  & > view {
42
+    flex: 1;
43
+  }
44
+}
95 45
 
96
-      align-items: center;
97
-      .left-image-1 {
98
-        width: 145px;
99
-        height: 44px;
100
-        position: absolute;
101
-        top: 22px;
102
-      }
103
-      // @/assets/icons/ProCard/ProCard_hot.png
104
-      .left-viewText {
105
-        background: url(../../assets/icons/ProCard/ProCard_hot.png) no-repeat;
106
-        background-size: 100% 100%;
107
-        padding: 0 24px 7px 2px;
108
-        width: auto;
109
-        font-size: 24px;
110
-        line-height: 48px;
111
-        height: 44.3px;
112
-        position: absolute;
113
-        top: 20px;
114
-        color: @whiteColor;
115
-        font-weight: 600;
116
-      }
117
-      //图片
118
-      .title-image {
119
-        height: 144px;
120
-        margin-left: 20px;
121
-        border-radius: 24px;
122
-        overflow: hidden;
123
-        position: relative;
124
-        .image-1 {
125
-          width: 144px;
126
-          height: 144px;
127
-          margin: 0;
128
-        }
129
-        .image-2 {
130
-          width: 89px;
131
-          height: 34px;
132
-          position: absolute;
133
-          left: 0;
134
-        }
135
-      }
46
+
47
+// @whiteColor: #fff;
48
+// @Image-ProCard_hot: "../../assets/icons/ProCard/ProCard_hot.png";
49
+// .container {
50
+//   width: 100%;
51
+//   .item-center-Number {
52
+//     width: 100%;
53
+//     margin-top: 30px;
54
+//     .buy-num-minus {
55
+//       display: inline-block;
56
+//       width: 60px;
57
+//       height: 60px;
58
+//       background: #ffffff;
59
+//       border: 1px solid #999999;
60
+//       border-radius: 8px 0px 0px 8px;
61
+//     }
62
+//     .buy-num-input {
63
+//       display: inline-block;
64
+//       width: 90px;
65
+//       height: 60px;
66
+//       font-size: 28px;
67
+//       font-weight: 400;
68
+//       color: #202020;
69
+//       background: #ffffff;
70
+//       border: 1px solid #999999;
71
+//       position: relative;
72
+//       top: 26px;
73
+//     }
74
+//     .buy-num-add {
75
+//       display: inline-block;
76
+
77
+//       width: 60px;
78
+//       height: 60px;
79
+//       background: #ffffff;
80
+//       border: 1px solid #999999;
81
+//       border-radius: 0px 8px 8px 0px;
82
+//     }
83
+//   }
84
+//   .buy-button-box {
85
+//     width: 100%;
86
+//     margin: 40px 0 0 0;
87
+
88
+//     .button-Cancel {
89
+//       display: inline-block;
90
+//       width: 236px;
91
+//       height: 78px;
92
+//       border: 2px solid #274291;
93
+//       font-size: 30px;
94
+//       font-weight: bold;
95
+//       color: #274291;
96
+//       border-radius: 12px;
97
+//       margin-right: 80px;
98
+//     }
99
+//     .button-OK {
100
+//       display: inline-block;
101
+
102
+//       width: 236px;
103
+//       height: 78px;
104
+//       background: #274291;
105
+//       border-radius: 12px;
106
+//       font-size: 30px;
107
+//       font-weight: bold;
108
+//       color: #ffffff;
109
+//     }
110
+//   }
111
+
112
+//   .wrapper {
113
+//     display: flex;
114
+//     position: relative;
115
+//     margin: 30px auto;
116
+//     width: 100%;
117
+//     // box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.12);
118
+//     // filter: drop-shadow(5px 8px 6px rgb(202, 202, 202));
119
+//     filter: drop-shadow(0 0 0.9rem rgba(0, 0, 0, 0.12));
120
+
121
+//     .left-complete-one {
122
+//       padding-top: 87px;
123
+//       padding-bottom: 43px;
124
+//       position: relative;
125
+//       display: flex;
126
+//       background: @whiteColor;
127
+//       background: radial-gradient(
128
+//             circle at top right,
129
+//             transparent 15px,
130
+//             #fff 0 0
131
+//           )
132
+//           top right,
133
+//         radial-gradient(circle at bottom right, transparent 15px, #fff 0 0)
134
+//           bottom right;
135
+//       background-size: 100% 60%;
136
+//       background-repeat: no-repeat;
137
+
138
+//       width: 573px;
139
+//       border-radius: 15px 0px 0px 15px;
140
+//       // border-radius: 12px;
141
+
142
+//       align-items: center;
143
+//       .left-image-1 {
144
+//         width: 145px;
145
+//         height: 44px;
146
+//         position: absolute;
147
+//         top: 22px;
148
+//       }
149
+//       // @/assets/icons/ProCard/ProCard_hot.png
150
+//       .left-viewText {
151
+//         background: url(../../assets/icons/ProCard/ProCard_hot.png) no-repeat;
152
+//         background-size: 100% 100%;
153
+//         padding: 0 24px 7px 2px;
154
+//         width: auto;
155
+//         font-size: 24px;
156
+//         line-height: 48px;
157
+//         height: 44.3px;
158
+//         position: absolute;
159
+//         top: 20px;
160
+//         color: @whiteColor;
161
+//         font-weight: 600;
162
+//       }
163
+//       //图片
164
+//       .title-image {
165
+//         height: 144px;
166
+//         margin-left: 20px;
167
+//         border-radius: 24px;
168
+//         overflow: hidden;
169
+//         position: relative;
170
+//         .image-1 {
171
+//           width: 144px;
172
+//           height: 144px;
173
+//           margin: 0;
174
+//         }
175
+//         .image-2 {
176
+//           width: 89px;
177
+//           height: 34px;
178
+//           position: absolute;
179
+//           left: 0;
180
+//         }
181
+//       }
136 182
       // 商品标题
137 183
       .title-content {
138 184
         // padding: 84px 0 56px 20px;
@@ -171,89 +217,56 @@
171 217
           color: #c0c8d3;
172 218
         }
173 219
       }
174
-    }
175
-  }
176
-
177
-  .right-complete-two {
178
-    background: @whiteColor;
179
-    background: radial-gradient(circle at top left, transparent 15px, #fff 0 0)
180
-        top left,
181
-      radial-gradient(circle at bottom left, transparent 15px, #fff 0 0) bottom
182
-        left;
183
-    background-size: 100% 60%;
184
-    background-repeat: no-repeat;
185
-    width: 129px;
186
-    border-radius: 0 15px 15px 0;
187
-    position: relative;
188
-    //右面部分
189
-    .right-content {
190
-      // width: 100px;
191
-      // height: 80px;
192
-      position: absolute;
193
-      top: 50%;
194
-      left: 50%;
195
-      transform: translate(-50%, -50%);
196
-      // border: 1px solid red;
197
-
198
-      .right-number {
199
-        width: 40px;
200
-        font-size: 20px;
201
-        border-radius: 4px;
202
-        border: 2px solid #999;
203
-        margin: auto;
204
-        text-align: center;
205
-      }
206
-
207
-      .right-title {
208
-        font-weight: 700;
209
-        font-size: 24px;
210
-        padding-top: 20px;
211
-        text-align: center;
212
-      }
213
-    }
214
-  }
215
-  //线条
216
-  .right-complete-two::after {
217
-    content: "";
218
-    position: absolute;
219
-    top: 15px;
220
-    margin: 26px auto;
221
-    height: 70%;
222
-    border-left: 1px dashed #595959;
223
-    opacity: 0.12;
224
-  }
225
-}
226
-
220
+//     }
221
+//   }
227 222
 
228
-.coupun-content {
229
-  display: flex;
230
-
231
-  &_header {
232
-    flex: none;
233
-    box-sizing: border-box;
234
-    width: 184px;
235
-    position: relative;
223
+//   .right-complete-two {
224
+//     background: @whiteColor;
225
+//     background: radial-gradient(circle at top left, transparent 15px, #fff 0 0)
226
+//         top left,
227
+//       radial-gradient(circle at bottom left, transparent 15px, #fff 0 0) bottom
228
+//         left;
229
+//     background-size: 100% 60%;
230
+//     background-repeat: no-repeat;
231
+//     width: 129px;
232
+//     border-radius: 0 15px 15px 0;
233
+//     position: relative;
234
+//     //右面部分
235
+//     .right-content {
236
+//       // width: 100px;
237
+//       // height: 80px;
238
+//       position: absolute;
239
+//       top: 50%;
240
+//       left: 50%;
241
+//       transform: translate(-50%, -50%);
242
+//       // border: 1px solid red;
236 243
 
237
-    padding: 78px 20px 40px;
244
+//       .right-number {
245
+//         width: 40px;
246
+//         font-size: 20px;
247
+//         border-radius: 4px;
248
+//         border: 2px solid #999;
249
+//         margin: auto;
250
+//         text-align: center;
251
+//       }
238 252
 
239
-    .coupun-content_thumb {
240
-      width: 144px;
241
-      height: 144px;
242
-      border-radius: 24px;
243
-      position: relative;
244
-      overflow: hidden;
253
+//       .right-title {
254
+//         font-weight: 700;
255
+//         font-size: 24px;
256
+//         padding-top: 20px;
257
+//         text-align: center;
258
+//       }
259
+//     }
260
+//   }
261
+//   //线条
262
+//   .right-complete-two::after {
263
+//     content: "";
264
+//     position: absolute;
265
+//     top: 15px;
266
+//     margin: 26px auto;
267
+//     height: 70%;
268
+//     border-left: 1px dashed #595959;
269
+//     opacity: 0.12;
270
+//   }
271
+// }
245 272
 
246
-      image {
247
-        width: 100%;
248
-        height: 100%;
249
-        display: block;
250
-      }
251
-    }
252
-  }
253
-
254
-  &_body {
255
-    flex: auto;
256
-    position: relative;
257
-    padding: 78px 20px 40px 0;
258
-  }
259
-}

src/components/CouponCard/components/IconAction.jsx → src/components/CouponCard/Action/IconAction.jsx 查看文件

@@ -7,9 +7,16 @@ import './style.less'
7 7
 export default (props) => {
8 8
   const { icon, text, onClick } = props
9 9
 
10
+  const handleClick = (e) => {
11
+    if (onClick) {
12
+      e.stopPropagation()
13
+      onClick(e);
14
+    }
15
+  }
16
+
10 17
   return (
11 18
     <View className='cpn-action cpn-icon-action'>
12
-      <View onClick={onClick}>
19
+      <View onClick={handleClick}>
13 20
         <Image src={icon} />
14 21
         <Text>{text}</Text>
15 22
       </View>

src/components/CouponCard/components/ImageAction.jsx → src/components/CouponCard/Action/ImageAction.jsx 查看文件

@@ -7,9 +7,16 @@ import './style.less'
7 7
 export default (props) => {
8 8
   const { image, onClick } = props
9 9
 
10
+  const handleClick = (e) => {
11
+    if (onClick) {
12
+      e.stopPropagation()  
13
+      onClick(e);
14
+    }
15
+  }
16
+
10 17
   return (
11 18
     <View className='cpn-action cpn-image-action'>
12
-      <View onClick={onClick}>
19
+      <View onClick={handleClick}>
13 20
         <Image src={image} />
14 21
       </View>
15 22
     </View>

+ 10
- 0
src/components/CouponCard/Action/index.js 查看文件

@@ -0,0 +1,10 @@
1
+
2
+import IconAction from "./IconAction";
3
+import ImageAction from "./ImageAction";
4
+
5
+const Action = {
6
+  Icon: IconAction,
7
+  Image: ImageAction,
8
+};
9
+
10
+export default Action;

+ 39
- 0
src/components/CouponCard/Action/style.less 查看文件

@@ -0,0 +1,39 @@
1
+
2
+.cpn-action {
3
+  height: 100%;
4
+  display: flex;
5
+  align-items: center;
6
+  justify-content: center;
7
+
8
+  & > view {
9
+    flex: none;
10
+  }
11
+}
12
+
13
+.cpn-icon-action {
14
+  & > view {
15
+    & > image {
16
+      width: 36px;
17
+      height: 36px;
18
+      display: block;
19
+      margin: 0 auto;
20
+    }
21
+  
22
+    & > text {
23
+      margin-top: 20px;
24
+      display: inline-block;
25
+      font-size: 24px;
26
+      font-weight: bold;
27
+      color: #202020;
28
+      line-height: 1.4em;
29
+    }
30
+  }
31
+}
32
+
33
+.cpn-image-action {
34
+  & > image {
35
+    width: 72px;
36
+    height: 72px;
37
+    display: block;
38
+  }
39
+}

+ 18
- 0
src/components/CouponCard/Card/index.jsx 查看文件

@@ -0,0 +1,18 @@
1
+
2
+import React from 'react'
3
+import { View } from '@tarojs/components'
4
+
5
+import './style.less'
6
+
7
+export default (props) => {
8
+  const { action = null, onClick } = props
9
+
10
+  return (
11
+    <View className='coupon-card'>
12
+      <View className='coupon-card_body' onClick={onClick}>
13
+        {props.children}
14
+      </View>
15
+      <View className='coupon-card_action'>{action}</View>
16
+    </View>
17
+  )
18
+}

src/components/CouponCard/style.less → src/components/CouponCard/Card/style.less 查看文件

@@ -53,14 +53,3 @@
53 53
     }
54 54
   }
55 55
 }
56
-
57
-.cpn-action {
58
-  height: 100%;
59
-  display: flex;
60
-  align-items: center;
61
-  justify-content: center;
62
-
63
-  & > view {
64
-    flex: none;
65
-  }
66
-}

src/components/CouponCard/components/Cashback.jsx → src/components/CouponCard/Cashback/index.jsx 查看文件

@@ -1,6 +1,7 @@
1 1
 
2 2
 import React from 'react'
3 3
 import { View, Text } from '@tarojs/components'
4
+import './style.less'
4 5
 
5 6
 export default (props) => {
6 7
   const { money, prefix = '返现', style } = props

+ 10
- 0
src/components/CouponCard/Cashback/style.less 查看文件

@@ -0,0 +1,10 @@
1
+
2
+.cpn_cashback {
3
+  box-sizing: border-box;
4
+  background: url('~@/assets/icons/ProCard/ProCard_hot.png') no-repeat;
5
+  background-size: 100% 100%;
6
+  padding: 16px 25px 10px 10px;
7
+  font-size: 20px;
8
+  color: #fff;
9
+  line-height: 1em;
10
+}

+ 17
- 0
src/components/CouponCard/Media/Body.jsx 查看文件

@@ -0,0 +1,17 @@
1
+import React from 'react'
2
+import { View } from '@tarojs/components'
3
+import Star from '@/components/Star'
4
+import './style.less'
5
+
6
+export default (props) => {
7
+  const { star } = props
8
+
9
+  return (
10
+    <View className='coupun-media_body'>
11
+      <Star score={star} style={{ position: 'absolute', top: '26rpx', left: 0 }} />
12
+      <View>
13
+        {props.children}
14
+      </View>
15
+    </View>
16
+  )
17
+}

+ 19
- 0
src/components/CouponCard/Media/Header.jsx 查看文件

@@ -0,0 +1,19 @@
1
+import React from 'react'
2
+import { View, Image } from '@tarojs/components'
3
+import BadgeTag from '@/components/BadgeTag'
4
+import Cashback from '../Cashback'
5
+import './style.less'
6
+
7
+export default (props) => {
8
+  const { cashback, badge, image } = props
9
+
10
+  return (
11
+    <View className='coupun-media_header'>
12
+      <Cashback money={cashback} style={{ position: 'absolute', top: '10px', left: 0 }} />
13
+      <View className='coupun-media_thumb'>
14
+        <BadgeTag type={badge} />
15
+        <Image src={image} />
16
+      </View>
17
+    </View>
18
+  )
19
+}

+ 20
- 0
src/components/CouponCard/Media/Wrapper.jsx 查看文件

@@ -0,0 +1,20 @@
1
+import React from 'react'
2
+import { View } from '@tarojs/components'
3
+import './style.less'
4
+
5
+export default (props) => {
6
+  const { onClick } = props
7
+
8
+  const handleClick = (e) => {
9
+    if (onClick) {
10
+      e.stopPropagation();  
11
+      onClick(e);
12
+    }
13
+  }
14
+
15
+  return (
16
+    <View className='coupun-media' onClick={handleClick}>
17
+      {props.children}
18
+    </View>
19
+  )
20
+}

+ 8
- 0
src/components/CouponCard/Media/index.jsx 查看文件

@@ -0,0 +1,8 @@
1
+import Wrapper from "./Wrapper";
2
+import Header from "./Header";
3
+import Body from "./Body";
4
+
5
+Wrapper.Header = Header;
6
+Wrapper.Body = Body;
7
+
8
+export default Wrapper;

+ 34
- 0
src/components/CouponCard/Media/style.less 查看文件

@@ -0,0 +1,34 @@
1
+
2
+.coupun-media {
3
+  display: flex;
4
+
5
+  &_header {
6
+    flex: none;
7
+    box-sizing: border-box;
8
+    width: 184px;
9
+    position: relative;
10
+
11
+    padding: 78px 20px 40px;
12
+  }
13
+
14
+  &_thumb {
15
+    width: 144px;
16
+    height: 144px;
17
+    border-radius: 24px;
18
+    position: relative;
19
+    overflow: hidden;
20
+
21
+    & > image {
22
+      width: 100%;
23
+      height: 100%;
24
+      display: block;
25
+    }
26
+  }
27
+
28
+  &_body {
29
+    flex: auto;
30
+    position: relative;
31
+    padding: 78px 20px 40px 0;
32
+    box-sizing: border-box;
33
+  }
34
+}

+ 0
- 36
src/components/CouponCard/components/style.less 查看文件

@@ -1,36 +0,0 @@
1
-
2
-.cpn-icon-action {
3
-  image {
4
-    width: 36px;
5
-    height: 36px;
6
-    display: block;
7
-    margin: 0 auto;
8
-  }
9
-
10
-  text {
11
-    margin-top: 20px;
12
-    display: inline-block;
13
-    font-size: 24px;
14
-    font-weight: bold;
15
-    color: #202020;
16
-    line-height: 1.4em;
17
-  }
18
-}
19
-
20
-.cpn-image-action {
21
-  image {
22
-    width: 72px;
23
-    height: 72px;
24
-    display: block;
25
-  }
26
-}
27
-
28
-.cpn_cashback {
29
-  box-sizing: border-box;
30
-  background: url('~@/assets/icons/ProCard/ProCard_hot.png') no-repeat;
31
-  background-size: 100% 100%;
32
-  padding: 16px 25px 10px 10px;
33
-  font-size: 20px;
34
-  color: #fff;
35
-  line-height: 1em;
36
-}

+ 6
- 16
src/components/CouponCard/index.jsx 查看文件

@@ -1,18 +1,8 @@
1
+import Card from "./Card";
2
+import Media from "./Media";
3
+import Action from './Action';
1 4
 
2
-import React from 'react'
3
-import { View } from '@tarojs/components'
5
+Card.Media = Media;
6
+Card.Action = Action;
4 7
 
5
-import './style.less'
6
-
7
-export default (props) => {
8
-  const { action = null, onClick } = props
9
-
10
-  return (
11
-    <View className='coupon-card' onClick={onClick}>
12
-      <View className='coupon-card_body'>
13
-        {props.children}
14
-      </View>
15
-      <View className='coupon-card_action'>{action}</View>
16
-    </View>
17
-  )
18
-}
8
+export default Card;

+ 21
- 0
src/components/Location/index.jsx 查看文件

@@ -0,0 +1,21 @@
1
+import React from 'react'
2
+import { View, Image } from '@tarojs/components'
3
+import position from '@/assets/icons/GuideCheck/position_logo.png'
4
+import './style.less'
5
+
6
+export default (props) => {
7
+  const { areaName, areaPName } = props
8
+
9
+  const name = [areaPName, areaName].filter(Boolean).join('/')
10
+
11
+  return (
12
+    <View className='loc-box'>
13
+      <View className='loc-box_icon'>
14
+        <Image src={position} />
15
+      </View>
16
+      <View className='loc-box_name'>
17
+        {name}
18
+      </View>
19
+    </View>
20
+  )
21
+}

+ 25
- 0
src/components/Location/style.less 查看文件

@@ -0,0 +1,25 @@
1
+
2
+.loc-box {
3
+  display: flex;
4
+  align-items: center;
5
+
6
+  &_icon {
7
+    flex: none;
8
+    width: 16px;
9
+    height: 20px;
10
+
11
+    & > image {
12
+      width: 100%;
13
+      height: 100%;
14
+      display: block;
15
+    }
16
+  }
17
+
18
+  &_name {
19
+    flex: auto;
20
+    margin-left: 8px;
21
+    font-size: 20px;
22
+    font-weight: 400;
23
+    color: #333333;
24
+  }
25
+}

+ 31
- 0
src/components/SaveIcon/index.jsx 查看文件

@@ -0,0 +1,31 @@
1
+import React from 'react'
2
+import { View, Image } from '@tarojs/components'
3
+import useSave from "@/utils/hooks/useSave"
4
+import starOn from '@/assets/icons/housemantj/onlove.png'
5
+import starOff from '@/assets/icons/housemantj/touristGood.png'
6
+import './style.less'
7
+
8
+export default (props) => {
9
+  const { saved, targetType, targetId, editable } = props
10
+  
11
+  const [isSaved, toggleSave] = useSave(saved, targetType, targetId)
12
+
13
+  const link = isSaved ? starOn : starOff
14
+  const text = isSaved ? '已收藏' : '加入收藏'
15
+
16
+  const handleClick = (e) => {
17
+    if (editable) {
18
+      e.stopPropagation()
19
+      toggleSave()
20
+    }
21
+  }
22
+
23
+  return (
24
+    <View className='save-box' onClick={handleClick}>
25
+      <View className='save-box_icon'>
26
+        <Image src={link} />
27
+      </View>
28
+      <View className='save-box_text'>{text}</View>
29
+    </View>
30
+  )
31
+}

+ 26
- 0
src/components/SaveIcon/style.less 查看文件

@@ -0,0 +1,26 @@
1
+
2
+.save-box {
3
+  display: flex;
4
+  align-items: center;
5
+
6
+  &_icon {
7
+    flex: none;
8
+    width: 20px;
9
+    height: 20px;
10
+
11
+    & > image {
12
+      width: 100%;
13
+      height: 100%;
14
+      display: block;
15
+    }
16
+
17
+  }
18
+
19
+  &_text {
20
+    flex: auto;
21
+    margin-left: 8px;
22
+    font-size: 20px;
23
+    font-weight: 400;
24
+    color: #333333;
25
+  }
26
+}