李志伟 3 лет назад
Родитель
Сommit
469edcb573

+ 3
- 3
src/components/CompoentsOrder/OrderCard/index.jsx Просмотреть файл

@@ -1,7 +1,7 @@
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';
4
+import SlideView from '@/components/SlideView';
5 5
 import CouponCard from '@/components/CouponCard'
6 6
 import QRcode from "@/assets/icons/UserCenter/QRcode.png";
7 7
 import refund from "@/assets/icons/GuideCheck/refund.png";
@@ -80,7 +80,7 @@ export default (props) => {
80 80
         sh != '1' || kkp != '1' ? <view className='OrderNumber'>订单编号:{item.orderId}</view> : null
81 81
       }
82 82
       {
83
-        item.status === 0 ? <SlideViewOrder del onDelete={() => handeDelete(item)} >
83
+        item.status === 0 ? <SlideView del onDelete={() => handeDelete(item)} >
84 84
           <CouponCard action={PayAction}>
85 85
             <CouponMedia>
86 86
               <CouponMedia.Header
@@ -113,7 +113,7 @@ export default (props) => {
113 113
               </CouponMedia.Body>
114 114
             </CouponMedia>
115 115
           </CouponCard>
116
-        </SlideViewOrder>
116
+        </SlideView>
117 117
           :
118 118
           <CouponCard onClick={() => {
119 119
             item.status === 1 && item.isVerified == false ? Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.shopId}` }) : ''

+ 0
- 6
src/components/CompoentsOrder/complete/index.jsx Просмотреть файл

@@ -88,7 +88,6 @@ export default (props) => {
88 88
     setItem(val)
89 89
   }
90 90
   const slideButtonTap = (e) => {
91
-    console.log(e)
92 91
     deleteOrder(e.orderId).then(() => {
93 92
       Taro.showToast({
94 93
         title: '删除订单成功',
@@ -120,7 +119,6 @@ export default (props) => {
120 119
                 if (item.status === 0) {
121 120
                   return (
122 121
                     <SpinBox loading={loading} className='index-container' >
123
-
124 122
                       <view key={`${type}-${item.orderId}`}  >
125 123
                         <OrderCard item={item} handeDelete={slideButtonTap} />
126 124
                       </view>
@@ -131,24 +129,20 @@ export default (props) => {
131 129
                 else if (item.isVerified == 1) {
132 130
                   return (
133 131
                     <SpinBox loading={loading} className='index-container' >
134
-
135 132
                       <view key={`${type}-${item.orderId}`}>
136 133
                         <OrderCard item={item} setShowCutover={setShowCutover} show={show} />
137 134
                       </view>
138 135
                     </SpinBox>
139
-
140 136
                   );
141 137
                 }
142 138
                 /* 待核销 */
143 139
                 else {
144 140
                   return (
145 141
                     <SpinBox loading={loading} className='index-container' >
146
-
147 142
                       <view key={`${type}-${item.orderId}`}>
148 143
                         <OrderCard item={item} />
149 144
                       </view>
150 145
                     </SpinBox>
151
-
152 146
                   );
153 147
                 }
154 148
               })}

+ 1
- 1
src/components/SlideView/index.jsx Просмотреть файл

@@ -56,7 +56,7 @@ export default (props) => {
56 56
             const { height } = res[0]
57 57
             if (height && height !== contentHeightRef.current) {
58 58
               setActStyle({
59
-                height: `${height}px`,
59
+                height: `calc(${height}px - 10px)`,
60 60
               })
61 61
               contentHeightRef.current = height
62 62
             }

+ 0
- 97
src/components/SlideViewOrder/index.jsx Просмотреть файл

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

+ 0
- 52
src/components/SlideViewOrder/style.less Просмотреть файл

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