zlisen hace 3 años
padre
commit
cf28450f3d

+ 4
- 1
src/components/CompoentsOrder/complete/index.jsx Ver fichero

@@ -76,13 +76,16 @@ export default (props) => {
76 76
 
77 77
   //核销
78 78
   const onWriteOff = (item) => {
79
+    // Taro.navigateTo({
80
+    //   url: `/pages/details/foodDetails/foodDetails?id=${item.shopId}&subOrderId=${item.subOrderId}`,
81
+    // });
79 82
     Taro.scanCode({
80 83
       onlyFromCamera: true,
81 84
       success: (res) => {
82 85
         console.log(res,'-------------')
83 86
         if (res.path) {
84 87
           Taro.navigateTo({
85
-            url: `/${res.path}&validPackage=${item.packageId}`,
88
+            url: `/${res.path}&subOrderId=${item.subOrderId}`,
86 89
           });
87 90
         } else {
88 91
           Taro.showToast({

+ 192
- 102
src/pages/MineUserAll/RefundMoney/CheckRefund/index.jsx Ver fichero

@@ -1,109 +1,187 @@
1
-import BlackSpot from '@/assets/icons/GuideCheck/BlackSpot.png'
2
-import Taro from '@tarojs/taro'
3
-import { Button, Icon, Text, Textarea } from '@tarojs/components'
1
+import BlackSpot from "@/assets/icons/GuideCheck/BlackSpot.png";
2
+import Taro from "@tarojs/taro";
3
+import { Button, Icon, Text, Textarea } from "@tarojs/components";
4 4
 
5
-import { useState } from 'react'
6
-import withLayout from '@/layouts'
5
+import { useState,useEffect } from "react";
6
+import withLayout from "@/layouts";
7
+import { getOrderSub } from "@/services/payOrder";
8
+import image from "@/assets/icons/ProCard/8kb.jpg";
9
+import food from "@/assets/icons/ProCard/food.png";
10
+import ProCard_hot from "@/assets/icons/ProCard/ProCard_hot.png";
11
+import CustomNav from "@/components/CustomNav";
12
+import "./style.less";
13
+import formatTime from "@/utils/formatTime";
7 14
 
8
-import image from '@/assets/icons/ProCard/8kb.jpg'
9
-import food from '@/assets/icons/ProCard/food.png'
10
-import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
11
-import CustomNav from '@/components/CustomNav'
12
-import './style.less'
13 15
 
14 16
 export default withLayout((props) => {
15
-  const [view, setView] = useState(true)
16
-  const [view2, setView2] = useState(false)
17
-  const [view3, setView3] = useState(false)
18
-  const [view4, setView4] = useState(false)
19
-  const [view5, setView5] = useState(false)
20
-  const [view6, setView6] = useState(false)
21
-  const { router, person } = props
22
-
23
-  let value = view
24
-  let list = [
25
-    {
26
-      className: `Refund-star-view4 ${!value ? 'bg2' : 'Refund-star-view2'}`,
27
-      name: '预约不上',
28
-      value: false,
29
-    }
30
-  ]
17
+  const { router, person } = props;
18
+  const { id } = props.router.params;
19
+  const [view, setView] = useState(true);
20
+  const [view2, setView2] = useState(false);
21
+  const [view3, setView3] = useState(false);
22
+  const [view4, setView4] = useState(false);
23
+  const [view5, setView5] = useState(false);
24
+  const [view6, setView6] = useState(false);
25
+
26
+  const [list, setList] = useState([]);
27
+    // 总价 totalPrice
28
+    const [totalPrice, setTotalPrice] = useState({});
29
+
30
+  const getData = (orderId) => {
31
+    Taro.showLoading();
32
+    getOrderSub({
33
+      pageNum: 1,
34
+      pageSize: 50,
35
+      orderId: orderId,
36
+    }).then((res) => {
37
+      setList(res.records);
38
+      Taro.hideLoading();
39
+    });
40
+  };
41
+
42
+  useEffect(() => {
43
+    getData(id);
44
+  }, []);
31 45
 
32 46
   const viewOK = () => {
33
-    setView(!view)
34
-  }
47
+    setView(!view);
48
+  };
35 49
 
36 50
   const view2OK = () => {
37
-    setView2(!view2)
38
-  }
51
+    setView2(!view2);
52
+  };
39 53
 
40 54
   const view3OK = () => {
41
-    setView3(!view3)
42
-  }
55
+    setView3(!view3);
56
+  };
43 57
 
44 58
   const view4OK = () => {
45
-    setView4(!view4)
46
-  }
59
+    setView4(!view4);
60
+  };
47 61
   const view5OK = () => {
48
-    setView5(!view5)
49
-  }
62
+    setView5(!view5);
63
+  };
50 64
 
51 65
   const view6OK = () => {
52
-    setView6(!view6)
53
-  }
54
-
55
-
66
+    setView6(!view6);
67
+  };
68
+
69
+  useEffect(() => {
70
+    let total = {
71
+      cashback: 0, //已获返现
72
+      charges: 0, //实付金额
73
+      refundPrice: 0, //退款金额
74
+    };
75
+    list.map((x) => {
76
+      total.cashback += x.cashback ;
77
+      total.charges += x.charges;
78
+      total.refundPrice += x.charges - x.cashback;
79
+    });
80
+    setTotalPrice(total);
81
+  }, [list]);
56 82
 
57 83
   return (
58
-
59
-    <view className='box-content'>
60
-      <CustomNav title='售后退款' />
61
-      <view className='Refund-Content-box'>
62
-        <view className='title-image'>
63
-          <image mode='scaleToFill' className='title-image-cup' src={BlackSpot} />
64
-          <text className='title-title-boss' >商品信息</text>
84
+    <view className="box-content">
85
+      <CustomNav title="售后退款" />
86
+      <view className="Refund-Content-box">
87
+        <view className="title-image">
88
+          <image
89
+            mode="scaleToFill"
90
+            className="title-image-cup"
91
+            src={BlackSpot}
92
+          />
93
+          <text className="title-title-boss">商品信息</text>
65 94
         </view>
66 95
       </view>
67 96
       {/* 商品信息结束 */}
68
-      <view class='wrapper'>
69
-        <view class='left-complete-one'>
70
-          <image className='left-image-1' src={ProCard_hot}></image>
71
-          <view className='left-viewText'>
72
-            返现¥16.00
73
-          </view>
74
-          <view className='title-image'>
75
-            <image className='image-1' mode='scaleToFill' src={image}></image>
76
-            <image className='image-2' src={food}></image>
77
-          </view>
78
-          <view className='title-content'>
79
-            <view className='Pro-title'>
80
-              <view className='title-text'>【米啊糯】新街口店 <text className='title-money-2' >数量:1张</text></view>
81
-
97
+      <view>
98
+        {list?.map((item) => {
99
+          return (
100
+            <view class="wrapper" key={item.orderId}>
101
+              <view class="left-complete-one">
102
+                <image className="left-image-1" src={ProCard_hot}></image>
103
+                <view className="left-viewText">返现¥{item.cashback/100}</view>
104
+                <view className="title-image">
105
+                  <image
106
+                    className="image-1"
107
+                    mode="scaleToFill"
108
+                    src={item.poster}
109
+                  ></image>
110
+                  <image className="image-2" src={food}></image>
111
+                </view>
112
+                <view className="title-content">
113
+                  <view className="Pro-title">
114
+                    <view className="title-text">
115
+                      {item.packageDescription}
116
+                      <text className="title-money-2">数量:{item.amount}张</text>
117
+                    </view>
118
+                  </view>
119
+                  <text className="title-money">
120
+                    ¥{item.unitPrice/100}元<text className="title-money-2">门市价{item.standardPrice/100}元</text>
121
+                  </text>
122
+                  <view className="title-time">
123
+                    有效期:{formatTime(item?.startTime, "yyyy/MM/dd")}-
124
+                        {formatTime(item.endTime, "yyyy/MM/dd")}
125
+                  </view>
126
+                </view>
127
+              </view>
128
+              <view class="right-complete-two">
129
+                <view className="right-content"></view>
130
+              </view>
82 131
             </view>
83
-            <text className='title-money' >¥6990元<text className='title-money-2'>门市价78元</text></text>
84
-            <view className='title-time' >有效期:2021/06/21-2021/12/31</view>
85
-          </view>
86
-        </view>
87
-        <view class='right-complete-two'>
88
-          <view className='right-content'>
89
-          </view>
90
-        </view>
132
+          );
133
+        })}
91 134
       </view>
135
+
92 136
       {/* 卡片结束 */}
93
-      <view className='Refund-Content-box'>
94
-        <view className='title-image'>
95
-          <image mode='scaleToFill' className='title-image-cup' src={BlackSpot} />
96
-          <text className='title-title-boss' >退款原因</text>
137
+      <view className="Refund-Content-box">
138
+        <view className="title-image">
139
+          <image
140
+            mode="scaleToFill"
141
+            className="title-image-cup"
142
+            src={BlackSpot}
143
+          />
144
+          <text className="title-title-boss">退款原因</text>
97 145
         </view>
98 146
         {/* 退款结束 */}
99 147
       </view>
100
-      <view className='Refund-content'>
101
-        <text className={`Refund-star-view ${view ? 'bg2' : 'Refund-star-view'}`} onClick={() => viewOK()} >计划有变,没时间消费</text>
102
-        <text className={`Refund-star-view2 ${view2 ? 'bg2' : 'Refund-star-view2'}`} onClick={() => view2OK()}  >误认为是外卖</text>
103
-        <text className={`Refund-star-view3 ${view3 ? 'bg2' : 'Refund-star-view3'}`} onClick={() => view3OK()} >没看清楚使用规则,要用时才发现限制很多</text>
104
-        <text className={`Refund-star-view4 ${view4 ? 'bg2' : 'Refund-star-view4'}`} onClick={() => view4OK()} >预约不上</text>
105
-        <text className={`Refund-star-view5 ${view5 ? 'bg2' : 'Refund-star-view5'}`} onClick={() => view5OK()} >店里更优惠</text>
106
-        <text className={`Refund-star-view6 ${view6 ? 'bg2' : 'Refund-star-view6'}`} onClick={() => view6OK()} >网友/朋友评价不好</text>
148
+      <view className="Refund-content">
149
+        <text
150
+          className={`Refund-star-view ${view ? "bg2" : "Refund-star-view"}`}
151
+          onClick={() => viewOK()}
152
+        >
153
+          计划有变,没时间消费
154
+        </text>
155
+        <text
156
+          className={`Refund-star-view2 ${view2 ? "bg2" : "Refund-star-view2"}`}
157
+          onClick={() => view2OK()}
158
+        >
159
+          误认为是外卖
160
+        </text>
161
+        <text
162
+          className={`Refund-star-view3 ${view3 ? "bg2" : "Refund-star-view3"}`}
163
+          onClick={() => view3OK()}
164
+        >
165
+          没看清楚使用规则,要用时才发现限制很多
166
+        </text>
167
+        <text
168
+          className={`Refund-star-view4 ${view4 ? "bg2" : "Refund-star-view4"}`}
169
+          onClick={() => view4OK()}
170
+        >
171
+          预约不上
172
+        </text>
173
+        <text
174
+          className={`Refund-star-view5 ${view5 ? "bg2" : "Refund-star-view5"}`}
175
+          onClick={() => view5OK()}
176
+        >
177
+          店里更优惠
178
+        </text>
179
+        <text
180
+          className={`Refund-star-view6 ${view6 ? "bg2" : "Refund-star-view6"}`}
181
+          onClick={() => view6OK()}
182
+        >
183
+          网友/朋友评价不好
184
+        </text>
107 185
         {/* 
108 186
         <view>
109 187
           {
@@ -117,34 +195,46 @@ export default withLayout((props) => {
117 195
         </view> */}
118 196
       </view>
119 197
 
120
-      <view className='Refund-Content-box'>
121
-        <view className='title-image'>
122
-          <image mode='scaleToFill' className='title-image-cup' src={BlackSpot} />
123
-          <text className='title-title-boss' >退款说明</text>
198
+      <view className="Refund-Content-box">
199
+        <view className="title-image">
200
+          <image
201
+            mode="scaleToFill"
202
+            className="title-image-cup"
203
+            src={BlackSpot}
204
+          />
205
+          <text className="title-title-boss">退款说明</text>
124 206
         </view>
125 207
       </view>
126
-      <view class='section'>
127
-        <Textarea placeholder='请补充退款说明(选填)!' confirm-type='done' />
208
+      <view class="section">
209
+        <Textarea placeholder="请补充退款说明(选填)!" confirm-type="done" />
210
+      </view>
211
+      <view className="money-title">
212
+        实付金额: <text className="money-name">{totalPrice.charges/100}元</text>
213
+      </view>
214
+      <view className="money-title">
215
+        已获返现: <text className="money-name">{totalPrice.cashback/100}元</text>
216
+      </view>
217
+      <view className="money-title">
218
+        退款金额: <text className="money-name">{totalPrice.refundPrice/100}元</text>
128 219
       </view>
129
-      <view className='money-title' >实付金额: <text className='money-name' >58元</text></view>
130
-      <view className='money-title' >已获返现: <text className='money-name' >1.88元</text></view>
131
-      <view className='money-title' >退款金额: <text className='money-name' >56.12元</text></view>
132
-      <view className='ul-li-text'>
133
-        <view className='ul-li-view' ></view>
134
-        <text className='ul-li-textname'>退款金额不可修改</text>
220
+      <view className="ul-li-text">
221
+        <view className="ul-li-view"></view>
222
+        <text className="ul-li-textname">退款金额不可修改</text>
135 223
       </view>
136
-      <view className='ul-li-text'>
137
-        <view className='ul-li-view' ></view>
138
-        <text className='ul-li-textname'>下单获得返现金额,会在退款时被扣除;</text>
224
+      <view className="ul-li-text">
225
+        <view className="ul-li-view"></view>
226
+        <text className="ul-li-textname">
227
+          下单获得返现金额,会在退款时被扣除;
228
+        </text>
139 229
       </view>
140
-      <view className='ul-li-text'>
141
-        <view className='ul-li-view' ></view>
142
-        <text className='ul-li-textname'>退款将在七个工作日内原路退还。</text>
230
+      <view className="ul-li-text">
231
+        <view className="ul-li-view"></view>
232
+        <text className="ul-li-textname">退款将在七个工作日内原路退还。</text>
143 233
       </view>
144 234
 
145
-      <view className='button-info'>
146
-        <Button className='button-box'>提交申请</Button>
235
+      <view className="button-info">
236
+        <Button className="button-box">提交申请</Button>
147 237
       </view>
148 238
     </view>
149
-  )
150
-})
239
+  );
240
+});

+ 138
- 103
src/pages/MineUserAll/RefundMoney/index.jsx Ver fichero

@@ -1,117 +1,152 @@
1
+import { useState, useEffect } from "react";
2
+import Taro from "@tarojs/taro";
3
+import image from "@/assets/icons/ProCard/8kb.jpg";
4
+import food from "@/assets/icons/ProCard/food.png";
5
+import ProCard_hot from "@/assets/icons/ProCard/ProCard_hot.png";
6
+import withLayout from "@/layouts";
1 7
 
2
-import { useState } from "react";
3
-import Taro from '@tarojs/taro'
4
-import image from '@/assets/icons/ProCard/8kb.jpg'
5
-import food from '@/assets/icons/ProCard/food.png'
6
-import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
7
-import withLayout from '@/layouts'
8
+import Null from "@/assets/icons/UserCenter/null_logo.png";
9
+import Refund from "@/assets/icons/UserCenter/Refund.png";
8 10
 
9
-import Null from '@/assets/icons/UserCenter/null_logo.png'
10
-import Refund from '@/assets/icons/UserCenter/Refund.png'
11
+import starOn from "@/assets/icons/GuideCheck/starOn.png";
12
+import starOff from "@/assets/icons/GuideCheck/starOff.png";
11 13
 
12
-import starOn from '@/assets/icons/GuideCheck/starOn.png'
13
-import starOff from '@/assets/icons/GuideCheck/starOff.png'
14
+import { getOrderSub } from "@/services/payOrder";
15
+import formatTime from '@/utils/formatTime'
16
+import CustomNav from "@/components/CustomNav";
17
+import "./style.less";
14 18
 
19
+const scoreList = new Array(5).fill(0);
20
+const score = "3.9";
21
+export default withLayout((props) => {
22
+  const { router, person } = props;
23
+  const [list, setList] = useState([]);
24
+  const [IsPull, setPull] = useState(false);
25
+  const [pageNum, setNumber] = useState(1);
26
+  const [HasNextPage, setHasNextPage] = useState(true);
15 27
 
28
+  const getList = () => {
29
+    setHasNextPage(false);
30
+    getOrderSub({
31
+      pageNum,
32
+      pageSize: 10,
33
+      status: 1,
34
+      isVerified: 0,
35
+    }).then((res) => {
36
+      setList(
37
+        pageNum === 1 ? res.records || [] : list.concat(res.records || [])
38
+      );
39
+      setHasNextPage(res.current < res.pages);
40
+      setPull(false);
41
+    });
42
+  };
16 43
 
44
+  const handleRefund2 = (item) => {
45
+    Taro.navigateTo({
46
+      url: `/pages/MineUserAll/RefundMoney/CheckRefund/index?id=${item.orderId}`,
47
+    });
48
+  };
49
+  const pageRefresh = () => {
50
+    // 页面下拉刷新回调
51
+    setPull(true);
52
+  };
17 53
 
18
-import CustomNav from '@/components/CustomNav'
19
-import './style.less'
54
+  const pageLoadMore = () => {
55
+    // 页面上拉加载更多
56
+    if (HasNextPage) {
57
+      setNumber(pageNum + 1);
58
+    }
59
+  };
20 60
 
61
+  useEffect(() => {
62
+    // 下拉刷新触发
63
+    if (IsPull) {
64
+      if (pageNum === 1) {
65
+        getList();
66
+      } else {
67
+        setNumber(1);
68
+      }
69
+    }
70
+  }, [IsPull]);
21 71
 
22
-const scoreList = new Array(5).fill(0)
23
-const score = '3.9'
24
-export default withLayout((props) => {
25
-  const { router, person } = props
72
+  useEffect(() => {
73
+    getList();
74
+  }, [pageNum]);
26 75
 
27
-  const handleRefund2 = () => {
28
-    Taro.navigateTo({ url: '/pages/MineUserAll/RefundMoney/CheckRefund/index' })
29
-  }
30 76
   return (
31
-    <view className='box-content'>
32
-      <CustomNav title='售后退款' />
33
-      <view class='wrapper'>
34
-        <view class='left-complete-one'>
35
-          <image className='left-image-1' src={ProCard_hot}></image>
36
-          <view className='left-viewText'>
37
-            返现¥16.00
38
-          </view>
39
-          {/* 评分 */}
40
-          <view className='card-box-star'>
41
-            {
42
-              scoreList.map((_, index) => {
77
+    <view className="box-content">
78
+      <CustomNav title="售后退款" />
79
+      <scroll-view
80
+        scroll-y
81
+        style="height: calc(100vh - 176rpx);"
82
+        refresher-enabled
83
+        refresher-triggered={IsPull}
84
+        onrefresherrefresh={pageRefresh}
85
+        refresher-background="#fff"
86
+        onscrolltolower={pageLoadMore}
87
+      >
88
+        <view>
89
+          {list?.map((item) => {
90
+            return (
91
+              <view class="wrapper" key={item.orderId}>
92
+                <view class="left-complete-one">
93
+                  <image className="left-image-1" src={ProCard_hot}></image>
43 94
 
44
-                const src = (index + '0.1') < score ? starOn : starOff
45
-                return (
46
-                  <image className='card-star-image' key={index} src={src} />
47
-                )
48
-              })
49
-            }
50
-            <text className='card-star-text' >{score}</text>
51
-          </view>
52
-          <view className='title-image'>
53
-            <image className='image-1' mode='scaleToFill' src={image}></image>
54
-            <image className='image-2' src={food}></image>
55
-          </view>
56
-          <view className='title-content'>
57
-            <view className='Pro-title'>
58
-              <view className='title-text'>【米啊糯】新街口店 <text className='title-money-2' >数量:1张</text></view>
59
-            </view>
60
-            <text className='title-money' >¥6990元</text>
61
-            <view className='title-time' >有效期:2021/06/21  14:00</view>
62
-          </view>
63
-        </view>
64
-        <view class='right-complete-two' onClick={handleRefund2} >
65
-          <view className='right-content'>
66
-            <image className='right-image' src={Refund} />
67
-            <view className='right-title'>售后</view>
68
-          </view>
69
-        </view>
70
-      </view>
71
-      {/* 已核销 */}
72
-      <view class='wrapper'>
73
-        <view class='left-complete-one'>
74
-          <image className='left-image-1' src={ProCard_hot}></image>
75
-
76
-          <view className='left-viewText'>
77
-            返现¥16.00
78
-          </view>
79
-          {/* 评分 */}
80
-          <view className='card-box-star'>
81
-            {
82
-              scoreList.map((_, index) => {
83
-
84
-                const src = (index + '0.1') < score ? starOn : starOff
85
-                return (
86
-                  <image className='card-star-image' key={index} src={src} />
87
-                )
88
-              })
89
-            }
90
-            <text className='card-star-text' >{score}</text>
91
-          </view>
92
-          <view className='title-image'>
93
-            <image className='image-1' mode='scaleToFill' src={image}></image>
94
-            <image className='image-2' src={food}></image>
95
-          </view>
96
-          <view className='title-content'>
97
-            <view className='Pro-title'>
98
-              <view className='title-text'>【米啊糯】新街口店 <text className='title-money-2' >数量:1张</text></view>
99
-            </view>
100
-            <text className='title-money' >¥6990元</text>
101
-            <view className='title-time' >有效期:2021/06/21  14:00</view>
102
-          </view>
103
-        </view>
104
-        <view class='right-complete-two' onClick={handleRefund2} >
105
-          <view className='right-content'>
106
-            {/* <image className='right-image-two' src={Null} /> */}
107
-            <image className='right-image' src={Refund} />
108
-            <view className='right-title'>售后</view>
109
-          </view>
95
+                  <view className="left-viewText">
96
+                    返现¥{item.cashback / 100}
97
+                  </view>
98
+                  {/* 评分 */}
99
+                  <view className="card-box-star">
100
+                    {scoreList.map((_, index) => {
101
+                      const src = index + 1 < item.score ? starOn : starOff;
102
+                      return (
103
+                        <image
104
+                          className="card-star-image"
105
+                          key={index}
106
+                          src={src}
107
+                        />
108
+                      );
109
+                    })}
110
+                    <text className="card-star-text">
111
+                      {item.score?.toFixed(1)}
112
+                    </text>
113
+                  </view>
114
+                  <view className="title-image">
115
+                    <image
116
+                      className="image-1"
117
+                      mode="scaleToFill"
118
+                      src={item.poster}
119
+                    ></image>
120
+                    <image className="image-2" src={food}></image>
121
+                  </view>
122
+                  <view className="title-content">
123
+                    <view className="Pro-title">
124
+                      <view className="title-text">
125
+                        {item.packageDescription}
126
+                        <text className="title-money-2">
127
+                          数量:{item.amount}张
128
+                        </text>
129
+                      </view>
130
+                    </view>
131
+                    <text className="title-money">
132
+                      ¥{item.unitPrice / 100}元
133
+                    </text>
134
+                    <view className="title-time">有效期:{formatTime(item?.endTime, "yyyy/MM/dd")}</view>
135
+                  </view>
136
+                </view>
137
+                <view class="right-complete-two" onClick={()=>handleRefund2(item)}>
138
+                  <view className="right-content">
139
+                    {/* <image className='right-image-two' src={Null} /> */}
140
+                    <image className="right-image" src={Refund} />
141
+                    <view className="right-title">售后</view>
142
+                  </view>
143
+                </view>
144
+              </view>
145
+            );
146
+          })}
147
+          <view className="foot">已经到底了~</view>
110 148
         </view>
111
-      </view>
112
-      <view className='foot'>
113
-        已经到底了~
114
-      </view>
149
+      </scroll-view>
115 150
     </view>
116
-  )
117
-})
151
+  );
152
+});

+ 159
- 108
src/pages/TobeShop/index.jsx Ver fichero

@@ -1,137 +1,188 @@
1
-import withLayout from '@/layouts'
2
-
3
-import CustomNav from "@/components/CustomNav"
4
-import Popup from '@/components/Popup'
5
-import { useState, useEffect } from 'react'
6
-import LocationBig from '@/assets/icons/UserCenter/LocationBig.png'
7
-import Perfection from '@/assets/icons/UserCenter/Perfection.png'
8
-import Check_OK from '@/assets/icons/UserCenter/Check_OK.png'
9
-import Check_NO from '@/assets/icons/UserCenter/Check_NO.png'
10
-import BlackSpot from '@/assets/icons/GuideCheck/BlackSpot.png'
11
-import image from '@/assets/icons/ProCard/8kb.jpg'
12
-import food from '@/assets/icons/ProCard/food.png'
13
-import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
14
-import { Button, Icon, Text, Textarea } from '@tarojs/components'
15
-import './style.less'
1
+import withLayout from "@/layouts";
16 2
 
3
+import CustomNav from "@/components/CustomNav";
4
+import Popup from "@/components/Popup";
5
+import { useState, useEffect } from "react";
6
+import LocationBig from "@/assets/icons/UserCenter/LocationBig.png";
7
+import Perfection from "@/assets/icons/UserCenter/Perfection.png";
8
+import Check_OK from "@/assets/icons/UserCenter/Check_OK.png";
9
+import Check_NO from "@/assets/icons/UserCenter/Check_NO.png";
10
+import BlackSpot from "@/assets/icons/GuideCheck/BlackSpot.png";
11
+import image from "@/assets/icons/ProCard/8kb.jpg";
12
+import food from "@/assets/icons/ProCard/food.png";
13
+import ProCard_hot from "@/assets/icons/ProCard/ProCard_hot.png";
14
+import { Button, Icon, Text, Textarea } from "@tarojs/components";
15
+import { getVerifyTargetList,putVerifyTarget } from "@/services/payOrder";
16
+import formatTime from '@/utils/formatTime'
17
+import "./style.less";
18
+import Taro from "@tarojs/taro";
17 19
 
18 20
 export default withLayout((props) => {
19
-  const { router, person } = props
20
-
21
-  const [showDialog, setShowDialog] = useState(false)
21
+  const { router, person } = props;
22
+  const { id, subOrderId } = props.router.params;
23
+  const [showDialog, setShowDialog] = useState(false);
22 24
   //核销
23
-  const [Consumption, setConsumption] = useState(false)
25
+  const [Consumption, setConsumption] = useState(false);
26
+
27
+  const [checked, setChecked] = useState();
28
+
29
+  
30
+
31
+  const [list, setList] = useState([]);
32
+
33
+  const getList = (params) => {
34
+    getVerifyTargetList({
35
+      shopId: id,
36
+      isMine: true,
37
+      isVerified: 0,
38
+      pageNum:1,
39
+      pageSize:50,
40
+    }).then((res) => {
41
+      if(res){
42
+        setList(res.records)
43
+        
44
+          setChecked(res?.records.filter(x=>x.subOrderId==subOrderId)[0].verifyNo)
45
+        
46
+        // if(item.verifyNo==checked)
47
+      }
48
+      
49
+    });
50
+  };
51
+
52
+  useEffect(() => {
53
+    getList();
54
+  }, []);
24 55
 
25 56
   const ShowMoldeOn = () => {
26
-    setShowDialog(true)
27
-  }
57
+    setShowDialog(true);
58
+  };
28 59
   const ButtonCancel = () => {
29
-    setShowDialog(false)
30
-  }
60
+    setShowDialog(false);
61
+  };
31 62
   const ButtonOK = (e) => {
63
+    if(!checked) return
32 64
     // setShowDialog(false)
33 65
     if (showDialog === true) {
34
-      setShowDialog(false)
35
-      setConsumption(true)
66
+      Taro.showLoading({
67
+        title:'核销中'
68
+      })
69
+    
70
+      putVerifyTarget(checked).then(res=>{
71
+        Taro.hideLoading()
72
+        setShowDialog(false);
73
+        setConsumption(true);
74
+      }).catch(e=>{
75
+        Taro.hideLoading()
76
+        setShowDialog(false);
77
+        Taro.showToast({
78
+          title: '核销失败',
79
+          icon: 'none',
80
+          duration: 2000
81
+        })
82
+      })
36 83
     }
37
-
38
-  }
84
+  };
39 85
 
40 86
   const PerfectionOK = () => {
41
-    setConsumption(false)
42
-  }
43
-
87
+    setConsumption(false);
88
+    if(list?.length>1){
89
+      getList()
90
+    }else{
91
+      Taro.navigateBack({delta: 1})
92
+    }
93
+  };
44 94
 
45 95
   return (
46
-    <view className='shop-Eat' >
47
-      <CustomNav title='到店核销' />
96
+    <view className="shop-Eat">
97
+      <CustomNav title="到店核销" />
48 98
       <Popup show={showDialog} maskClosable={false}>
49
-        <view className='Consumption-Now' >您即将核销1张套餐券!</view>
50
-        <text className='Consumption-text' >核销后套餐券不退不换</text>
51
-        <text className='Consumption-text' >请核对无误后再点击确认!</text>
52
-        <view className='buy-button-box' >
53
-          <button className='button-Cancel' onClick={ButtonCancel} >取消</button>
54
-          <button className='button-OK' onClick={ButtonOK} >确定</button>
99
+        <view className="Consumption-Now">您即将核销1张套餐券!</view>
100
+        <text className="Consumption-text">核销后套餐券不退不换</text>
101
+        <text className="Consumption-text">请核对无误后再点击确认!</text>
102
+        <view className="buy-button-box">
103
+          <button className="button-Cancel" onClick={ButtonCancel}>
104
+            取消
105
+          </button>
106
+          <button className="button-OK" onClick={ButtonOK}>
107
+            确定
108
+          </button>
55 109
         </view>
56 110
       </Popup>
57 111
       <Popup show={Consumption} maskClosable={false}>
58
-        <view className='Perfection-image-view' >
59
-          <image src={Perfection} className='Perfection-image' />
60
-
112
+        <view className="Perfection-image-view">
113
+          <image src={Perfection} className="Perfection-image" />
61 114
         </view>
62 115
         <text>核销完成!请与店铺确认!</text>
63
-        <view className='buy-button-box' >
64
-          <button className='button-OK' onClick={PerfectionOK} >完成</button>
116
+        <view className="buy-button-box">
117
+          <button className="button-OK" onClick={PerfectionOK}>
118
+            完成
119
+          </button>
65 120
         </view>
66 121
       </Popup>
67
-      <view className='position-header' >
68
-        <image className='position-LocationBig' src={LocationBig} />
69
-        <text cla='position-LocationBig-text'>当前所在店铺:SEOUL·创意韩国料理</text>
70
-      </view>
71
-      <view className='shop-image'>
72
-        <image mode='scaleToFill' className='shop-title-image-cup' src={BlackSpot} />
73
-        <text className='shop-title-title' >请选择你要核销的套餐</text>
74
-      </view>
75
-
76
-      {/* 卡片 */}
77
-      <view class='wrapper'>
78
-        <view class='left-complete-one'>
79
-          <view className='Check_OK-box' >
80
-            <image className='Check_OK-image' src={Check_OK} />
81
-          </view>
82
-          <image className='left-image-1' src={ProCard_hot}></image>
83
-          <view className='left-viewText'>
84
-            返现¥16.00
85
-          </view>
86
-          <view className='title-image'>
87
-            <image className='image-1' mode='scaleToFill' src={image}></image>
88
-            <image className='image-2' src={food}></image>
89
-          </view>
90
-          <view className='title-content'>
91
-            <view className='Pro-title'>
92
-              <view className='title-text'>【米啊糯】新街口店 <text className='title-money-2' >数量:1张</text></view>
93
-            </view>
94
-            <text className='title-money' >¥6990元<text className='title-money-2'>门市价78元</text></text>
95
-            <view className='title-time' >有效期:2021/06/21-2021/12/31</view>
96
-          </view>
97
-        </view>
98
-        <view class='right-complete-two'>
99
-          <view className='right-content'>
100
-          </view>
122
+      <view>
123
+        <view className="position-header">
124
+          <image className="position-LocationBig" src={LocationBig} />
125
+          <text cla="position-LocationBig-text">
126
+            当前所在店铺:SEOUL·创意韩国料理
127
+          </text>
101 128
         </view>
102
-      </view>
103
-
104
-      <view class='wrapper'>
105
-        <view class='left-complete-one'>
106
-          <view className='Check_OK-box' >
107
-            <image className='Check_OK-image' src={Check_NO} />
108
-          </view>
109
-          <image className='left-image-1' src={ProCard_hot}></image>
110
-          <view className='left-viewText'>
111
-            返现¥16.00
112
-          </view>
113
-          <view className='title-image'>
114
-            <image className='image-1' mode='scaleToFill' src={image}></image>
115
-            <image className='image-2' src={food}></image>
116
-          </view>
117
-          <view className='title-content'>
118
-            <view className='Pro-title'>
119
-              <view className='title-text'>【米啊糯】新街口店 <text className='title-money-2' >数量:1张</text></view>
120
-            </view>
121
-            <text className='title-money' >¥6990元<text className='title-money-2'>门市价78元</text></text>
122
-            <view className='title-time' >有效期:2021/06/21-2021/12/31</view>
123
-          </view>
129
+        <view className="shop-image">
130
+          <image
131
+            mode="scaleToFill"
132
+            className="shop-title-image-cup"
133
+            src={BlackSpot}
134
+          />
135
+          <text className="shop-title-title">请选择你要核销的套餐</text>
124 136
         </view>
125
-        <view class='right-complete-two'>
126
-          <view className='right-content'>
127
-          </view>
137
+        <view>
138
+          {list?.map((item) => {
139
+            
140
+            return (
141
+              <view class="wrapper" key={item.verifyNo} onClick={()=>setChecked(item.verifyNo)}>
142
+                <view class="left-complete-one">
143
+                  <view className="Check_OK-box">
144
+                    <image className="Check_OK-image" src={item.verifyNo==checked? Check_OK:Check_NO} />
145
+                  </view>
146
+                  <image className="left-image-1" src={ProCard_hot}></image>
147
+                  <view className="left-viewText">返现¥16.00</view>
148
+                  <view className="title-image">
149
+                    <image
150
+                      className="image-1"
151
+                      mode="scaleToFill"
152
+                      src={item.poster}
153
+                    ></image>
154
+                    <image className="image-2" src={food}></image>
155
+                  </view>
156
+                  <view className="title-content">
157
+                    <view className="Pro-title">
158
+                      <view className="title-text">
159
+                        {item.description}
160
+                        <text className="title-money-2">数量:1张</text>
161
+                      </view>
162
+                    </view>
163
+                    <text className="title-money">
164
+                      ¥{item.actualPrice/100}元<text className="title-money-2">门市价{item.standPrice/100}元</text>
165
+                    </text>
166
+                    <view className="title-time">
167
+                      有效期:{formatTime(item?.createDate, "yyyy/MM/dd")}-
168
+                        {formatTime(item?.expireDate, "yyyy/MM/dd")}
169
+                    </view>
170
+                  </view>
171
+                </view>
172
+                <view class="right-complete-two">
173
+                  <view className="right-content"></view>
174
+                </view>
175
+              </view>
176
+            );
177
+          })}
128 178
         </view>
129
-      </view>
130 179
 
131
-      <view className='button-info'>
132
-        <Button className='button-box' onClick={ShowMoldeOn} >确定核销</Button>
180
+        <view className="button-info">
181
+          <Button className="button-box" disabled={!checked} onClick={ShowMoldeOn}>
182
+            确定核销
183
+          </Button>
184
+        </view>
133 185
       </view>
134
-
135 186
     </view>
136
-  )
137
-})
187
+  );
188
+});

+ 6
- 4
src/pages/details/foodDetails/foodDetails.jsx Ver fichero

@@ -26,14 +26,16 @@ import useLike from "@/utils/hooks/useLike"
26 26
 
27 27
 export default withLayout((props) => {
28 28
   const { router, person } = props
29
-  const { id, validPackage} = props.router.params
29
+  const { id, subOrderId} = props.router.params
30
+  // console.log(id,subOrderId,'--333-----')
30 31
   useEffect(()=>{
31
-    if(id&&validPackage){
32
+    console.log(id,subOrderId,'-------')
33
+    if(id&&subOrderId){
32 34
       Taro.navigateTo({
33
-        url: `/pages/TobeShop/index&id=${id}&validPackage=${validPackage}`,
35
+        url: `/pages/TobeShop/index?id=${id}&subOrderId=${subOrderId}`,
34 36
       });
35 37
     }
36
-  },[id,validPackage])
38
+  },[id, subOrderId])
37 39
   //商铺基础信息
38 40
   const [detail, setDetail] = useState({})
39 41
   //商铺套餐

+ 14
- 0
src/services/payOrder.js Ver fichero

@@ -38,3 +38,17 @@ export const getQrcode = (id) => request(`/qrcode/${id}`)
38 38
 */
39 39
 export const getMineOrder = () => request(`/orderSub/summary/mine`)
40 40
 
41
+/**
42
+* 获取待核销列表
43
+* @param {*} params
44
+* @returns 
45
+*/
46
+export const getVerifyTargetList = (params) => request(`/verifyTarget`,{ params })
47
+
48
+/**
49
+* 核销
50
+* @param {*} id
51
+* @returns 
52
+*/
53
+export const putVerifyTarget = (id) => request(`/verifyTarget/${id}`,{ method: 'put' })
54
+