张延森 3 年 前
コミット
7835b5f856

+ 19
- 0
src/components/BadgeTag/index.jsx ファイルの表示

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

+ 20
- 0
src/components/BadgeTag/style.less ファイルの表示

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

+ 72
- 46
src/components/BossCard/index.jsx ファイルの表示

@@ -1,8 +1,9 @@
1 1
 import Taro from '@tarojs/taro'
2
+import { View, Image } from '@tarojs/components'
2 3
 import useSave from "@/utils/hooks/useSave"
3 4
 import { getShopDetail, getShopcity } from '@/services/home'
4 5
 import { useState, useEffect } from 'react'
5
-import Star from '@/components/Star/Star.jsx'
6
+// import Star from '@/components/Star/Star.jsx'
6 7
 import position from '@/assets/icons/GuideCheck/position_logo.png'
7 8
 import Pay from '@/assets/icons/GuideCheck/Pay_logo.png'
8 9
 
@@ -12,9 +13,11 @@ import food from '@/assets/icons/ProCard/food.png'
12 13
 import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
13 14
 
14 15
 import { getQueryString } from '@/utils/index'
15
-//入住指引--老板推荐
16
-
17
-
16
+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'
18 21
 
19 22
 import './style.less'
20 23
 
@@ -32,50 +35,73 @@ export default (props) => {
32 35
     Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${shopId}` })
33 36
   }
34 37
 
38
+  const handlePayClick = () => {
39
+    Taro.navigateTo({ url: `/pages/PayOrder/index?packageId=${item.packageId}` })
40
+  }
41
+
42
+  const PayAction = <IconAction icon={Pay} text='支付' onClick={handlePayClick} />
35 43
 
36 44
   return (
37
-    <view class='container'>
38
-      <view class='wrapper'>
39
-        <view class='left-complete-one' onClick={() => { goFood() }} >
40
-          {/* <image className='left-image-1' src={ProCard_hot}></image> */}
41
-          <view className='left-viewText'>
42
-            返现¥{(item.cashback / 100)?.toFixed(2)}
43
-          </view>
44
-          {/* 评分 */}
45
-          <view className='card-box-star'>
46
-            <Star star={st} />
47
-            <text className='card-star-text' >{st}</text>
48
-          </view>
49
-          <view className='title-image' >
50
-            <image className='image-1' mode='scaleToFill' src={item.poster}></image>
51
-            <image className='image-2' src={food}></image>
52
-          </view>
53
-          <view className='title-content'>
54
-            <view className='Pro-title'  >
55
-              <view className='title-text'>{(item.description).toString().length > 25 ? (item.description).substring(0, 25) + '...' : (item.description)}</view>
56
-            </view>
57
-            <text className='title-money' >¥{(item.actualPrice / 100)?.toFixed(2)}元<text className='title-money-2'>门市价{(item.standardPrice / 100)?.toFixed(2)}元</text></text>
58
-            <view className='title-position-on'>
59
-              <image className='title-position' src={position} />
60
-              <text className='title-position-image'>{det.areaName == '南京市' ? det.areaName : det.areaPName + '/' + det.areaName}</text>
61
-              {/* <view style={{ display: 'inline-block' }} onClick={toggleSave}>
62
-
63
-                <image className='title-on' src={isSaved > 0 ? starOn : starOff} />
64
-                <text className='title-on-text'>{isSaved > 0 ? '已收藏' : '加入收藏'}</text>
65
-              </view> */}
66
-            </view>
67
-          </view>
68
-        </view>
69
-        <view class='right-complete-two'>
70
-          <view className='right-content' onClick={() => { Taro.navigateTo({ url: `/pages/PayOrder/index?packageId=${item.packageId}` }); }}>
71
-            {/* <view className='right-number'>×1</view> */}
72
-            <image className='right-image' src={Pay} />
73
-            <view className='right-title'>支付</view>
74
-          </view>
75
-        </view>
76
-      </view>
77
-    </view>
45
+    <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} />
52
+          </View>
53
+        </View>
54
+        <View className='coupun-content_body'>
55
+          <Star score={st} style={{ position: 'absolute', top: '26rpx', left: 0 }} />
56
+        </View>
57
+      </View>
58
+    </CouponCard>
59
+  )
78 60
 
79 61
 
80
-  )
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
+  // )
81 107
 }

+ 34
- 0
src/components/BossCard/style.less ファイルの表示

@@ -223,3 +223,37 @@
223 223
     opacity: 0.12;
224 224
   }
225 225
 }
226
+
227
+
228
+.coupun-content {
229
+  display: flex;
230
+
231
+  &_header {
232
+    flex: none;
233
+    box-sizing: border-box;
234
+    width: 184px;
235
+    position: relative;
236
+
237
+    padding: 78px 20px 40px;
238
+
239
+    .coupun-content_thumb {
240
+      width: 144px;
241
+      height: 144px;
242
+      border-radius: 24px;
243
+      position: relative;
244
+      overflow: hidden;
245
+
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
+}

+ 16
- 0
src/components/CouponCard/components/Cashback.jsx ファイルの表示

@@ -0,0 +1,16 @@
1
+
2
+import React from 'react'
3
+import { View, Text } from '@tarojs/components'
4
+
5
+export default (props) => {
6
+  const { money, prefix = '返现', style } = props
7
+
8
+  const yuan = !money ? 0 : Number(money / 100).toFixed(2)
9
+
10
+  return (
11
+    <View className='cpn_cashback' style={style}>
12
+      <Text>{prefix}</Text>
13
+      <Text>{`¥${yuan}`}</Text>
14
+    </View>
15
+  )
16
+}

+ 18
- 0
src/components/CouponCard/components/IconAction.jsx ファイルの表示

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

+ 17
- 0
src/components/CouponCard/components/ImageAction.jsx ファイルの表示

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

+ 36
- 0
src/components/CouponCard/components/style.less ファイルの表示

@@ -0,0 +1,36 @@
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
+}

+ 18
- 0
src/components/CouponCard/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' 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
+}

+ 66
- 0
src/components/CouponCard/style.less ファイルの表示

@@ -0,0 +1,66 @@
1
+
2
+// 开孔半径
3
+@radius-size: 16px;
4
+
5
+.coupon-card {
6
+  display: flex;
7
+  filter: drop-shadow(0 0 0.9rem rgba(0, 0, 0, 0.12));
8
+  border-radius: 12px;
9
+
10
+  & + & {
11
+    margin-top: 36rpx;
12
+  }
13
+
14
+  & > view {
15
+    position: relative;
16
+    box-sizing: border-box;
17
+  }
18
+
19
+  &_body {
20
+    flex: auto;
21
+    min-height: 60px;
22
+    background: radial-gradient(circle at top right, transparent @radius-size, #fff 0 0)
23
+                  top right,
24
+                radial-gradient(circle at bottom right, transparent @radius-size, #fff 0 0)
25
+                  bottom right;
26
+    background-size: 100% 60%;
27
+    background-repeat: no-repeat;
28
+  }
29
+
30
+  &_action {
31
+    flex: none;
32
+    width: 18%;
33
+    min-width: 130px;
34
+    background: radial-gradient(circle at top left, transparent @radius-size, #fff 0 0)
35
+                  top left,
36
+                radial-gradient(circle at bottom left, transparent @radius-size, #fff 0 0)
37
+                  bottom left;
38
+    background-size: 100% 60%;
39
+    background-repeat: no-repeat;
40
+    
41
+    // 避开孔位置, 方便子元素居中
42
+    padding-left: @radius-size * 2;
43
+
44
+    &::before {
45
+      position: absolute;
46
+      content: ' ';
47
+      width: 1px;
48
+      border-left: 1px dashed rgba(89, 89, 89, .2);
49
+      height: 50%;
50
+      top: 25%;
51
+      left: 0;
52
+      z-index: 2;
53
+    }
54
+  }
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
+}

+ 1
- 1
src/components/Star/Star.jsx ファイルの表示

@@ -1,6 +1,6 @@
1 1
 import hongxin from '@/assets/icons/housemantj/Save2.png'
2 2
 import baixin from '@/assets/icons/housemantj/save.png'
3
-import './Star.less'
3
+import './style.less'
4 4
 
5 5
 const Star = (props) => <image className='star-image' src={props.star >= props.index ? hongxin : baixin}></image>
6 6
 

+ 0
- 5
src/components/Star/Star.less ファイルの表示

@@ -1,5 +0,0 @@
1
-.star-image{
2
-  width: 24px;
3
-  height: 24px;
4
-  margin-right: 10px;
5
-}

+ 19
- 0
src/components/Star/index.jsx ファイルの表示

@@ -0,0 +1,19 @@
1
+import React from 'react'
2
+import { View } from '@tarojs/components'
3
+import Star from './Star'
4
+import './style.less'
5
+
6
+export default (props) => {
7
+  const { score, style } = props
8
+
9
+  return (
10
+    <View className='star-box' style={style}>
11
+      <View>
12
+        <Star star={score} />
13
+      </View>
14
+      <View>
15
+        {score}
16
+      </View>
17
+    </View>
18
+  )
19
+}

+ 25
- 0
src/components/Star/style.less ファイルの表示

@@ -0,0 +1,25 @@
1
+.star-image{
2
+  width: 24px;
3
+  height: 24px;
4
+  margin-right: 10px;
5
+}
6
+
7
+.star-box {
8
+  display: flex;
9
+
10
+  & > view {
11
+    box-sizing: border-box;
12
+    display: inline-block;
13
+    font-size: 20px;
14
+    font-weight: bold;
15
+    color: #333333;
16
+
17
+    &:last-child {
18
+      margin-top: -4px;
19
+    }
20
+
21
+    & + view {
22
+      margin-left: 10px;
23
+    }
24
+  }
25
+}