소스 검색

Merge branch 'dev' of http://git.ycjcjy.com/shigongli/miniapp-v2 into dev

张延森 3 년 전
부모
커밋
0b33abbda3

+ 40
- 34
src/components/CompoentsOrder/OrderCard/index.jsx 파일 보기

@@ -1,6 +1,9 @@
1 1
 import Taro from "@tarojs/taro";
2 2
 import { View, Text } from '@tarojs/components'
3 3
 import formatTime from "@/utils/formatTime";
4
+import SlideViewOrder from '@/components/SlideViewOrder';
5
+import { getOrderSub, deleteOrder } from "@/services/payOrder";
6
+
4 7
 import CouponCard from '@/components/CouponCard'
5 8
 import QRcode from "@/assets/icons/UserCenter/QRcode.png";
6 9
 import refund from "@/assets/icons/GuideCheck/refund.png";
@@ -17,7 +20,7 @@ const CouponMedia = CouponCard.Media
17 20
 const Action = CouponCard.Action
18 21
 
19 22
 export default (props) => {
20
-  const { item, setShowCutover, show, sh, kkp } = props
23
+  const { item, setShowCutover, show, sh, kkp, handeDelete } = props
21 24
 
22 25
   const handleDetail = () => {
23 26
     if (item.status === 0) {
@@ -27,6 +30,8 @@ export default (props) => {
27 30
     }
28 31
   }
29 32
 
33
+
34
+
30 35
   //核销
31 36
   const onWriteOff = (item) => {
32 37
     Taro.scanCode({
@@ -70,44 +75,45 @@ export default (props) => {
70 75
                   item.isVerified == true && item.isEvaluated > 0 ? <Action.Image image={Evaluated} /> :
71 76
                     item.isVerified == true ? <Action.Icon icon={Evaluation} text='评价' onClick={() => evaluation(item)} /> : null
72 77
 
73
-
74 78
   return (
75 79
     <>
76 80
       {
77
-        sh != '1'|| kkp == '1'? <view className='OrderNumber'>订单编号:{item.orderId}</view> : null
81
+        sh != '1' || kkp == '1' ? <view className='OrderNumber'>订单编号:{item.orderId}</view> : null
78 82
       }
79
-      <CouponCard action={PayAction}>
80
-        <CouponMedia>
81
-          <CouponMedia.Header
82
-            cashback={item.cashback}
83
-            image={item.poster}
84
-            badge='food'
85
-          />
86
-          <CouponMedia.Body star={kkp == '1' ? 'ss' : item.score}>
87
-            <View className='orderCard'>
88
-              <View className='cpn-card-text'>
89
-                <View style={{ flex: '1' }}>{(item.packageDescription).toString().length > 25 ? (item.packageDescription).substring(0, 25) + '...' : (item.packageDescription)}</View>
90
-                <text className={kkp == '1' ? 'shanchu' : 'title-money-2'}>
91
-                  数量:{item.amount}张
92
-                </text>
93
-              </View>
94
-              <View className='cpn-card-text' style={{ marginTop: '10rpx' }}>
95
-                <Text className='cpn-card-text_mn'>¥{`${(item.unitPrice / 100)?.toFixed(2)}元`}</Text>
96
-              </View>
97
-              <View className='cpn-md-act'>
98
-                <view className={item.isVerified == 1 ? 'title-time' : ''}>
99
-                  {
100
-                    sh == 1 ? '有效期:' + formatTime(item.endTime, "yyyy/MM/dd") :
101
-                      item.isVerified == 1 ? '核销时间 :' + formatTime(item?.verifiedDate, "yyyy/MM/dd") :
102
-                        '有效期:' + formatTime(item?.startTime, "yyyy/MM/dd") + '-' +
103
-                        formatTime(item.endTime, "yyyy/MM/dd")
104
-                  }
105
-                </view>
83
+      <SlideViewOrder del onDelete={() => handeDelete(item)} >
84
+        <CouponCard action={PayAction}>
85
+          <CouponMedia>
86
+            <CouponMedia.Header
87
+              cashback={item.cashback}
88
+              image={item.poster}
89
+              badge='food'
90
+            />
91
+            <CouponMedia.Body star={kkp == '1' ? 'ss' : item.score}>
92
+              <View className='orderCard'>
93
+                <View className='cpn-card-text'>
94
+                  <View style={{ flex: '1' }}>{(item.packageDescription).toString().length > 25 ? (item.packageDescription).substring(0, 25) + '...' : (item.packageDescription)}</View>
95
+                  <text className={kkp == '1' ? 'shanchu' : 'title-money-2'}>
96
+                    数量:{item.amount}张
97
+                  </text>
98
+                </View>
99
+                <View className='cpn-card-text' style={{ marginTop: '10rpx' }}>
100
+                  <Text className='cpn-card-text_mn'>¥{`${(item.unitPrice / 100)?.toFixed(2)}元`}</Text>
101
+                </View>
102
+                <View className='cpn-md-act'>
103
+                  <view className={item.isVerified == 1 ? 'title-time' : ''}>
104
+                    {
105
+                      sh == 1 ? '有效期:' + formatTime(item.endTime, "yyyy/MM/dd") :
106
+                        item.isVerified == 1 ? '核销时间 :' + formatTime(item?.verifiedDate, "yyyy/MM/dd") :
107
+                          '有效期:' + formatTime(item?.startTime, "yyyy/MM/dd") + '-' +
108
+                          formatTime(item.endTime, "yyyy/MM/dd")
109
+                    }
110
+                  </view>
111
+                </View>
106 112
               </View>
107
-            </View>
108
-          </CouponMedia.Body>
109
-        </CouponMedia>
110
-      </CouponCard>
113
+            </CouponMedia.Body>
114
+          </CouponMedia>
115
+        </CouponCard>
116
+      </SlideViewOrder>
111 117
     </>
112 118
   )
113 119
 }

+ 6
- 5
src/components/CompoentsOrder/complete/index.jsx 파일 보기

@@ -7,6 +7,7 @@ import AlreadyUsed from "../AlreadyUsed";
7 7
 import OrderCard from '../OrderCard'
8 8
 import "./style.less";
9 9
 import { View } from "@tarojs/components";
10
+import SlideViewOrder from '@/components/SlideViewOrder';
10 11
 
11 12
 
12 13
 const dict = {
@@ -117,11 +118,11 @@ export default (props) => {
117 118
                 /* 待支付 */
118 119
                 if (item.status === 0) {
119 120
                   return (
120
-                    <mp-slideview buttons={button} onButtontap={() => slideButtonTap(item)} icon >
121
-                      <view key={`${type}-${item.orderId}`}  >
122
-                        <OrderCard item={item} />
123
-                      </view>
124
-                    </mp-slideview>
121
+                    // <SlideViewOrder del onDelete={() => slideButtonTap(item)}>
122
+                    <view key={`${type}-${item.orderId}`}  >
123
+                      <OrderCard item={item} handeDelete={slideButtonTap} />
124
+                    </view>
125
+                    // </SlideViewOrder>
125 126
                   );
126 127
                 }
127 128
                 /* 已使用 */

+ 97
- 0
src/components/SlideViewOrder/index.jsx 파일 보기

@@ -0,0 +1,97 @@
1
+
2
+import React, { useEffect, useMemo, useRef, useState } from 'react'
3
+import Taro from '@tarojs/taro';
4
+import { ScrollView, View, Image, Text } from '@tarojs/components';
5
+import deleteIcon from '@/assets/icons/landlord/delete.png';
6
+import './style.less'
7
+
8
+export default (props) => {
9
+  const { className, action, del, onDelete } = props;
10
+
11
+  const contextRef = useRef()
12
+  const contentHeightRef = useRef(0)
13
+  const [actStyle, setActStyle]= useState()
14
+
15
+  const uqClass = useMemo(() => `f-${Math.random().toString(36).substring(2)}`, [])
16
+  const classes = [className, 'slideview-wrapper', uqClass].filter(Boolean).join(' ');
17
+
18
+  const handleScrollLeft = () => {
19
+    if (contextRef.current) {
20
+      contextRef.current.scrollIntoView('.slideview-content')
21
+    }
22
+  }
23
+
24
+  const handleScrollRight = () => {
25
+    if (contextRef.current) {
26
+      contextRef.current.scrollIntoView('.slideview-actions')
27
+    }
28
+  }
29
+
30
+  const handleDelete = (e) => {
31
+    if (onDelete) {
32
+      onDelete(e)
33
+    }
34
+  }
35
+
36
+  useEffect(() => {
37
+    Taro.nextTick(() => {
38
+      Taro.createSelectorQuery()
39
+      .select(`.${uqClass}`)
40
+      .node()
41
+      .exec((res) => {
42
+        contextRef.current = res[0].node;
43
+      })
44
+    })
45
+  }, [])
46
+
47
+  useEffect(() => {
48
+    Taro.nextTick(() => {
49
+      // 不清楚为什么, 此处获取高度一直不准确
50
+      const t = setTimeout(() => {
51
+        Taro.createSelectorQuery()
52
+        .select(`.${uqClass}`)
53
+        .boundingClientRect()
54
+        .exec((res) => {
55
+          if (res && res[0]) {
56
+            const { height } = res[0]
57
+            if (height && height !== contentHeightRef.current) {
58
+              setActStyle({
59
+                height: `${height}px`,
60
+              })
61
+              contentHeightRef.current = height
62
+            }
63
+          }
64
+        })
65
+        clearTimeout(t)
66
+      }, 500)
67
+    })
68
+  })
69
+
70
+  return (
71
+    <ScrollView
72
+      className={classes}
73
+      upperThreshold={20}
74
+      lowerThreshold={20}
75
+      scrollX
76
+      scrollWithAnimation
77
+      enhanced
78
+      onScrollToUpper={handleScrollLeft}
79
+      onScrollToLower={handleScrollRight}
80
+    >
81
+      <View className='slideview-content'>{props.children}</View>
82
+      <View className='slideview-actions' style={actStyle}>
83
+        <View className='slideview-action'>
84
+          {
85
+            del && (
86
+              <View className='slideview-action_delete' onClick={handleDelete}>
87
+                <Image src={deleteIcon} />
88
+                <View>删除</View>
89
+              </View>
90
+            )
91
+          }
92
+          {action}
93
+        </View>
94
+      </View>
95
+    </ScrollView>
96
+  )
97
+}

+ 52
- 0
src/components/SlideViewOrder/style.less 파일 보기

@@ -0,0 +1,52 @@
1
+.slideview-wrapper {
2
+  box-sizing: border-box;
3
+  white-space: nowrap;
4
+
5
+  &::-webkit-scrollbar{
6
+    width: 0;
7
+    height: 0;
8
+    color: transparent;
9
+  }
10
+
11
+  .slideview-content {
12
+    min-width: 100%;
13
+    display: inline-block;
14
+    vertical-align: middle;
15
+  }
16
+
17
+  .slideview-actions {
18
+    display: inline-block;
19
+    vertical-align: middle;
20
+    margin: 0 20px;
21
+    background: #FFFFFF;
22
+    box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.12);
23
+    border-radius: 12px;
24
+
25
+    .slideview-action {
26
+      height: 100%;
27
+      display: flex;
28
+      align-items: center;
29
+      justify-content: center;
30
+      
31
+      &_delete {
32
+        display: block;
33
+        flex: none;
34
+        height: 74px;
35
+        width: 67px;
36
+        text-align: center;
37
+        padding: 10px;
38
+        font-size: 24px;
39
+        font-weight: bold;
40
+        color: #FF3434;
41
+
42
+        & > image {
43
+          width: 28px;
44
+          height: 30px;
45
+          display: block;
46
+          margin: 0 auto 20px;
47
+        }
48
+      }
49
+    }
50
+
51
+  }
52
+}

+ 1
- 1
src/components/add-tips/index.wxml 파일 보기

@@ -2,6 +2,6 @@
2 2
   <view class='arrow' style="margin-right:{{arrowR}}px;"></view>
3 3
   <view class='body' bindtap='hidden' style="margin-right:{{bodyR}}px;">
4 4
     <image src="{{logo}}" class="logo"></image>
5
-    <view class="tips">选择"添加到我的小程序",使用更便捷</view>
5
+    <view class="tips"></view>
6 6
   </view>
7 7
 </view>

+ 4
- 2
src/components/add-tips/index.wxss 파일 보기

@@ -26,14 +26,16 @@
26 26
   zoom: 1.5;
27 27
 }
28 28
 .tips {
29
+  height: 200px;
30
+  width: 200px;
29 31
   flex: 1;
30 32
   color: #fff;
31 33
   font-size: 20px;
32 34
   font-weight: 700;
33 35
 }
34 36
 .logo {
35
-  height: 42px;
36
-  width: 42px;
37
+  height: 200px;
38
+  width: 200px;
37 39
   border-radius: 8px;
38 40
   margin-right: 10px;
39 41
 }

+ 75
- 63
src/pages/details/foodDetails/foodDetails.less 파일 보기

@@ -1,73 +1,73 @@
1
-.storeDetails{
2
-  background-color: #fff;  
1
+.storeDetails {
2
+  background-color: #fff;
3 3
   border-radius: 12px;
4 4
   margin-bottom: 20px;
5 5
 
6
-  .swiper{
6
+  .swiper {
7 7
     height: calc((100vw - 60px) * 0.6);
8 8
   }
9
-  .storeImage{
9
+  .storeImage {
10 10
     position: relative;
11 11
     border-radius: 22px;
12 12
     width: 100%;
13 13
     height: 100%;
14
-    .tpPage{
14
+    .tpPage {
15 15
       position: absolute;
16 16
       right: 20px;
17 17
       bottom: 20px;
18 18
       background: #000000;
19
-      border-radius: 16px;  
20
-      font-size: 24px;       
21
-      color: #FFFFFF;
22
-      padding:0 7px;
23
-      opacity: 0.4;  
19
+      border-radius: 16px;
20
+      font-size: 24px;
21
+      color: #ffffff;
22
+      padding: 0 7px;
23
+      opacity: 0.4;
24 24
       line-height: 32px;
25 25
       padding: 7px 8px 8px 7px;
26
-      text{
26
+      text {
27 27
         opacity: 0.64;
28 28
       }
29 29
     }
30
-  }  
31
-  .storeJs{
30
+  }
31
+  .storeJs {
32 32
     padding: 20px;
33
-    .storeName{      
34
-      font-size: 32px;         
33
+    .storeName {
34
+      font-size: 32px;
35 35
       font-weight: bold;
36 36
       color: #202020;
37 37
     }
38
-    .sprice{
38
+    .sprice {
39 39
       color: #202020;
40
-      font-size: 32px;         
40
+      font-size: 32px;
41 41
       font-weight: bold;
42
-      .t1{        
42
+      .t1 {
43 43
         font-size: 24px;
44 44
         padding-right: 10px;
45 45
       }
46
-      .bzRight{        
46
+      .bzRight {
47 47
         font-weight: 400;
48 48
         font-size: 24px;
49 49
         float: right;
50 50
       }
51 51
     }
52
-    .appraise{
52
+    .appraise {
53 53
       line-height: 0;
54 54
       margin-top: 28px;
55 55
       margin-bottom: 37px;
56
-      font-size: 24px;         
56
+      font-size: 24px;
57 57
       font-weight: bold;
58 58
       color: #020200;
59
-      .t1{
59
+      .t1 {
60 60
         margin-left: 10px;
61 61
       }
62
-      .comment{
62
+      .comment {
63 63
         color: #666;
64 64
       }
65 65
     }
66
-    .yysj{
66
+    .yysj {
67 67
       line-height: 0;
68 68
       font-size: 24px;
69 69
       color: #666;
70
-      .yysjImg{
70
+      .yysjImg {
71 71
         width: 26px;
72 72
         height: 26px;
73 73
         position: relative;
@@ -75,50 +75,49 @@
75 75
         padding-right: 10px;
76 76
       }
77 77
     }
78
-    .dpPosition{
78
+    .dpPosition {
79 79
       margin-top: 40px;
80 80
       position: relative;
81
-      .dwTip{
81
+      .dwTip {
82 82
         width: 28px;
83 83
         height: 28px;
84 84
         position: absolute;
85 85
         top: 4px;
86
-        left:0;
86
+        left: 0;
87 87
       }
88
-      view{
89
-        font-size: 24px;         
88
+      view {
89
+        font-size: 24px;
90 90
         color: #666666;
91 91
         padding-left: 34px;
92 92
         padding-bottom: 40px;
93
-        .zhuandao{
93
+        .zhuandao {
94 94
           width: 14px;
95 95
           height: 24px;
96 96
           transform: rotate(180deg);
97 97
           position: relative;
98 98
           left: 8px;
99 99
           top: 5px;
100
-        }        
100
+        }
101 101
       }
102
-      
103 102
     }
104 103
   }
105 104
 }
106
-.title{
105
+.title {
107 106
   margin: 59px 0 41px 0;
108
-  image{
107
+  image {
109 108
     width: 30px;
110 109
     height: 30px;
111 110
     position: relative;
112 111
     top: 5px;
113 112
   }
114
-  text{
115
-    font-size: 34px;       
113
+  text {
114
+    font-size: 34px;
116 115
     font-weight: bold;
117 116
     color: #202020;
118 117
     margin-left: 10px;
119 118
   }
120 119
 }
121
-.cs{
120
+.cs {
122 121
   height: 500px;
123 122
   // background: rgb(240, 142, 142);
124 123
   // background: radial-gradient(circle at top left, transparent 15px, rgb(240, 142, 142) 0) top left,
@@ -126,66 +125,79 @@
126 125
   //           radial-gradient(circle at bottom left, transparent 15px, #58a 0) bottom left,
127 126
   //           radial-gradient(circle at bottom right, transparent 15px, #58a 0) bottom right;
128 127
 
128
+  background: radial-gradient(
129
+        circle at 82% top,
130
+        transparent 15px,
131
+        rgb(240, 140, 140) 0
132
+      )
133
+      top,
134
+    radial-gradient(
135
+        circle at 82% bottom,
136
+        transparent 15px,
137
+        rgb(230, 120, 120) 0
138
+      )
139
+      bottom;
129 140
 
130
-  background: radial-gradient(circle at 82% top,transparent 15px,rgb(240,140,140) 0) top,
131
-              radial-gradient(circle at 82% bottom,transparent 15px,rgb(230,120,120) 0) bottom;
132
-
133
-background-repeat: no-repeat;
134
-background-size: auto 50%;
141
+  background-repeat: no-repeat;
142
+  background-size: auto 50%;
135 143
 }
136 144
 
137
-.showMore{
145
+.showMore {
138 146
   width: 100%;
139
-  background: linear-gradient(0deg, rgba(248, 248, 248, 0.58) 42%, rgba(248, 248, 248, 0) 100%);
147
+  background: linear-gradient(
148
+    0deg,
149
+    rgba(248, 248, 248, 0.58) 42%,
150
+    rgba(248, 248, 248, 0) 100%
151
+  );
140 152
   font-size: 28px;
141 153
   font-weight: bold;
142 154
   color: #202020;
143 155
   text-align: center;
144 156
   position: absolute;
145
-  bottom: -100px;
157
+  bottom: -140px;
146 158
   padding-top: 77px;
147 159
   padding-bottom: 20px;
148
-  .moreTip{
160
+  .moreTip {
149 161
     width: 38px;
150 162
     height: 19px;
151 163
     margin-top: 14px;
152 164
   }
153 165
 }
154
-.storezn{
155
-  font-size: 28px;    
166
+.storezn {
167
+  font-size: 28px;
156 168
   color: #202020;
157 169
   line-height: 54px;
158 170
   margin-bottom: 44px;
159 171
 }
160
-.storezn+image{
172
+.storezn + image {
161 173
   width: 100%;
162 174
   margin-bottom: 40px;
163 175
 }
164 176
 
165
-.botton{
166
-  font-size: 28px;   
167
-  color: #C0C8D3;
177
+.botton {
178
+  font-size: 28px;
179
+  color: #c0c8d3;
168 180
   line-height: 34px;
169 181
   text-align: center;
170
-  padding:40px 0 68px 0;
171
-  background-color: #F8F8F8;
182
+  padding: 40px 0 68px 0;
183
+  background-color: #f8f8f8;
172 184
 }
173
-.bottomTab{
174
-  background: #FFF;
185
+.bottomTab {
186
+  background: #fff;
175 187
   border-radius: 12px;
176 188
   column-count: 3;
177
-  text-align: center;  
178
-  .sharebtn{
189
+  text-align: center;
190
+  .sharebtn {
179 191
     position: absolute;
180 192
     width: 260px;
181 193
     opacity: 0;
182 194
   }
183
-  .tab{
195
+  .tab {
184 196
     line-height: 96px;
185
-    font-size: 28px;     
197
+    font-size: 28px;
186 198
     font-weight: bold;
187 199
     color: #202020;
188
-    image{
200
+    image {
189 201
       width: 31px;
190 202
       height: 31px;
191 203
       position: relative;
@@ -193,4 +205,4 @@ background-size: auto 50%;
193 205
       margin-right: 12px;
194 206
     }
195 207
   }
196
-}
208
+}

+ 0
- 38
src/utils/copyTxt.js 파일 보기

@@ -1,38 +0,0 @@
1
-
2
-export default function copyTxt(text, fn) { // 复制功能
3
-  if (typeof document.execCommand !== 'function') {
4
-    console.log('复制失败,请长按复制')
5
-    return
6
-  }
7
-  var dom = document.createElement('textarea')
8
-  dom.value = text
9
-  dom.setAttribute('style', 'display: block;width: 1px;height: 1px;')
10
-  document.body.appendChild(dom)
11
-  dom.select()
12
-  var result = document.execCommand('copy')
13
-  document.body.removeChild(dom)
14
-  if (result) {
15
-    console.log('复制成功')
16
-    typeof fn === 'function' && fn()
17
-    return
18
-  }
19
-  if (typeof document.createRange !== 'function') {
20
-    console.log('复制失败,请长按复制')
21
-    return
22
-  }
23
-  var range = document.createRange()
24
-  var div = document.createElement('div')
25
-  div.innerhtml = text
26
-  div.setAttribute('style', 'height: 1px;fontSize: 1px;overflow: hidden;')
27
-  document.body.appendChild(div)
28
-  range.selectNode(div)
29
-  var selection = window.getSelection()
30
-  console.log(selection)
31
-  if (selection.rangeCount > 0) {
32
-    selection.removeAllRanges()
33
-  }
34
-  selection.addRange(range)
35
-  document.execCommand('copy')
36
-  typeof fn === 'function' && fn()
37
-  console.log('复制成功')
38
-}