吃个甘蔗嚼一年 hace 3 años
padre
commit
a062fe12c9

+ 1
- 1
config/prod.js Ver fichero

@@ -3,7 +3,7 @@ module.exports = {
3 3
     NODE_ENV: '"production"'
4 4
   },
5 5
   defineConstants: {
6
-    HOST: '"https://sgl-v2.njyunzhi.com"',
6
+    HOST: '"http://192.168.89.147:8080"',
7 7
   },
8 8
   mini: {},
9 9
   h5: {

+ 0
- 1
package.json Ver fichero

@@ -36,7 +36,6 @@
36 36
   "author": "",
37 37
   "dependencies": {
38 38
     "@babel/runtime": "^7.7.7",
39
-    "@miniprogram-component-plus/tabs": "^1.0.0",
40 39
     "@tarojs/components": "3.3.2",
41 40
     "@tarojs/react": "3.3.2",
42 41
     "@tarojs/runtime": "3.3.2",

+ 345
- 153
src/components/CompoentsOrder/complete/index.jsx Ver fichero

@@ -1,166 +1,358 @@
1
-import { useState } from "react";
1
+import react, { useState, useEffect } from "react";
2
+import Taro from "@tarojs/taro";
3
+import { getOrderSub, getQrcode } from "@/services/payOrder";
4
+import formatTime from "@/utils/formatTime";
5
+import image from "@/assets/icons/ProCard/8kb.jpg";
6
+import food from "@/assets/icons/ProCard/food.png";
7
+import ProCard_hot from "@/assets/icons/ProCard/ProCard_hot.png";
2 8
 
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'
9
+import Evaluation from "@/assets/icons/UserCenter/Evaluation.png";
10
+import Null from "@/assets/icons/UserCenter/null_logo.png";
11
+import QRcode from "@/assets/icons/UserCenter/QRcode.png";
6 12
 
7
-import Evaluation from '@/assets/icons/UserCenter/Evaluation.png'
8
-import Null from '@/assets/icons/UserCenter/null_logo.png'
9
-import QRcode from '@/assets/icons/UserCenter/QRcode.png'
10
-
11
-import Pay from '@/assets/icons/GuideCheck/Pay_logo.png'
12
-import starOn from '@/assets/icons/GuideCheck/starOn.png'
13
-import starOff from '@/assets/icons/GuideCheck/starOff.png'
13
+import Pay from "@/assets/icons/GuideCheck/Pay_logo.png";
14
+import starOn from "@/assets/icons/GuideCheck/starOn.png";
15
+import starOff from "@/assets/icons/GuideCheck/starOff.png";
14 16
 import AlreadyUsed from "../AlreadyUsed";
15
-import './style.less'
16
-
17
+import "./style.less";
17 18
 
18
-const scoreList = new Array(5).fill(0)
19
-const score = '3.9'
19
+const scoreList = new Array(5).fill(0);
20
+const score = "3.9";
20 21
 
22
+const dict = {
23
+  0: { status: 0 },
24
+  1: { status: 1 },
25
+  2: { isVerified: 1 },
26
+  3: { status: 9 },
27
+};
21 28
 export default (props) => {
29
+  const { type } = props;
30
+  const [list, setList] = useState([]);
31
+  const [IsPull, setPull] = useState(false);
32
+  const [pageNum, setNumber] = useState(1);
33
+  const [HasNextPage, setHasNextPage] = useState(true);
34
+
35
+  useEffect(() => {
36
+    getList();
37
+  }, [pageNum]);
38
+
39
+  const pageRefresh = () => {
40
+    // 页面下拉刷新回调
41
+    setPull(true);
42
+  };
43
+
44
+  const getList = () => {
45
+    setHasNextPage(false);
46
+
47
+    // let params = {};
48
+
49
+    // if (type === 1) {
50
+    // }
51
+    getOrderSub({
52
+      pageNum,
53
+      pageSize: 10,
54
+      ...(type !== undefined ? dict[type] : null),
55
+    }).then((res) => {
56
+      setList(
57
+        pageNum === 1 ? res.records || [] : list.concat(res.records || [])
58
+      );
59
+      setHasNextPage(res.current < res.pages);
60
+      setPull(false);
61
+    });
62
+  };
63
+
64
+  const pageLoadMore = () => {
65
+    // 页面上拉加载更多
66
+    if (HasNextPage) {
67
+      setNumber(pageNum + 1);
68
+    }
69
+  };
70
+
71
+  useEffect(() => {
72
+    // 下拉刷新触发
73
+    if (IsPull) {
74
+      if (pageNum === 1) {
75
+        getList();
76
+      } else {
77
+        setNumber(1);
78
+      }
79
+    }
80
+  }, [IsPull]);
81
+
82
+  //核销
83
+  const onWriteOff = (item) => {
84
+    Taro.scanCode({
85
+      onlyFromCamera: true,
86
+      success: (res) => {
87
+        if (res.path) {
88
+          getQrcode(res.result).then((result) => {
89
+            Taro.navigateTo({
90
+              url: `/${result.page}?${result.scene}`,
91
+            });
92
+          });
93
+        } else {
94
+          Taro.showToast({
95
+            title: "非当前小程序生成二维码",
96
+            icon: "none",
97
+            duration: 2000,
98
+          });
99
+        }
100
+      },
101
+      fail: (err) => {
102
+        console.log(err, "err");
103
+      },
104
+    });
105
+  };
106
+
22 107
   return (
23
-    <scroll-view scroll-y style='height: 90vh;'  >
24
-      <view className='complete-boxs' >
25
-        {/* 已使用 */}
26
-        <view className='OrderNumber' >订单编号:ABC123456789</view>
27
-        <view class='wrapper'>
28
-          <view class='left-complete-one'>
29
-            <image className='left-image-1' src={ProCard_hot}></image>
30
-            <view className='left-viewText'>
31
-              返现¥16.00
32
-            </view>
33
-            {/* 评分 */}
34
-            <view className='card-box-star'>
35
-              {
36
-                scoreList.map((_, index) => {
37
-
38
-                  const src = (index + '0.1') < score ? starOn : starOff
39
-                  return (
40
-                    <image className='card-star-image' key={index} src={src} />
41
-                  )
42
-                })
43
-              }
44
-              <text className='card-star-text' >{score}</text>
45
-            </view>
46
-            <view className='title-image'>
47
-              <image className='image-1' mode='scaleToFill' src={image}></image>
48
-              <image className='image-2' src={food}></image>
49
-            </view>
50
-            <view className='title-content'>
51
-              <view className='Pro-title'>
52
-                <view className='title-text'>【米啊糯】新街口店 <text className='title-money-2' >数量:1张</text></view>
108
+    <scroll-view
109
+      scroll-y
110
+      style="height: 90vh;"
111
+      refresher-enabled
112
+      refresher-triggered={IsPull}
113
+      onrefresherrefresh={pageRefresh}
114
+      refresher-background="#fff"
115
+      onscrolltolower={pageLoadMore}
116
+    >
117
+      <view className="complete-boxs">
118
+        {list.map((item, index) => {
119
+          /* 待支付 */
120
+          if (item.status === 0) {
121
+            return (
122
+              <view key={`${type}-${item.orderId}`}>
123
+                <view className="OrderNumber">订单编号:{item.orderId}</view>
124
+
125
+                <view class="wrapper">
126
+                  <view class="left-complete-one">
127
+                    <image className="left-image-1" src={ProCard_hot}></image>
128
+                    <view className="left-viewText">
129
+                      返现¥{item.cashback / 100}
130
+                    </view>
131
+                    <view className="title-image">
132
+                      <image
133
+                        className="image-1"
134
+                        mode="scaleToFill"
135
+                        src={item.poster || image}
136
+                      ></image>
137
+                      <image className="image-2" src={food}></image>
138
+                    </view>
139
+                    <view className="title-content">
140
+                      <view className="Pro-title">
141
+                        <view className="title-text">
142
+                          {item.packageDescription}
143
+                          <text className="title-money-2">
144
+                            数量:{item.amount}张
145
+                          </text>
146
+                        </view>
147
+                      </view>
148
+                      <text className="title-money">
149
+                        ¥{item.unitPrice / 100}元
150
+                      </text>
151
+                      <view className="title-time">
152
+                        有效期:{formatTime(item?.startTime, "yyyy/MM/dd")}-
153
+                        {formatTime(item.endTime, "yyyy/MM/dd")}
154
+                      </view>
155
+                    </view>
156
+                  </view>
157
+                  <view class="right-complete-two">
158
+                    <view
159
+                      className="right-content"
160
+                      onClick={() => {
161
+                        Taro.navigateTo({
162
+                          url: `/pages/PayOrder/index?orderId=${item.orderId}`,
163
+                        });
164
+                      }}
165
+                    >
166
+                      <image className="right-image" src={Pay} />
167
+                      <view className="right-title">支付</view>
168
+                    </view>
169
+                  </view>
170
+                </view>
53 171
               </view>
54
-              <text className='title-money' >¥6990元</text>
55
-              <view className='title-time' >核销时间:2021/06/21  12:00</view>
56
-            </view>
57
-          </view>
58
-          <view class='right-complete-two'>
59
-            <view className='right-content'>
60
-              <image className='right-image' src={Evaluation} />
61
-              <view className='right-title'>评价</view>
62
-            </view>
63
-          </view>
64
-        </view>
65
-        {/* 待核销 */}
66
-        <view className='OrderNumber'>订单编号:ABC123456789</view>
67
-        <view class='wrapper'>
68
-          <view class='left-complete-one'>
69
-            <image className='left-image-1' src={ProCard_hot}></image>
70
-            <view className='left-viewText'>
71
-              返现¥16.00
72
-            </view>
73
-            <view className='title-image'>
74
-              <image className='image-1' mode='scaleToFill' src={image}></image>
75
-              <image className='image-2' src={food}></image>
76
-            </view>
77
-            <view className='title-content'>
78
-              <view className='Pro-title'>
79
-                <view className='title-text'>【SEOUL·创意韩国料理】 <text className='title-money-2' >数量:1张</text></view>
172
+            );
173
+          }
174
+          /* 待核销 */
175
+          if (item.status === 1 && item.isVerified == 0) {
176
+            return (
177
+              <view key={`${type}-${item.orderId}`}>
178
+                <view className="OrderNumber">订单编号:{item.orderId}</view>
179
+                <view class="wrapper">
180
+                  <view class="left-complete-one">
181
+                    <image className="left-image-1" src={ProCard_hot}></image>
182
+                    <view className="left-viewText">
183
+                      返现¥{item.cashback / 100}
184
+                    </view>
185
+                    <view className="title-image">
186
+                      <image
187
+                        className="image-1"
188
+                        mode="scaleToFill"
189
+                        src={item.poster || image}
190
+                      ></image>
191
+                      <image className="image-2" src={food}></image>
192
+                    </view>
193
+                    <view className="title-content">
194
+                      <view className="Pro-title">
195
+                        <view className="title-text">
196
+                          {item.packageDescription}
197
+                          <text className="title-money-2">
198
+                            数量:{item.amount}张
199
+                          </text>
200
+                        </view>
201
+                      </view>
202
+                      <text className="title-money">
203
+                        ¥{item.unitPrice / 100}元
204
+                      </text>
205
+                      <view className="title-time">
206
+                        有效期:{formatTime(item?.startTime, "yyyy/MM/dd")}-
207
+                        {formatTime(item.endTime, "yyyy/MM/dd")}
208
+                      </view>
209
+                    </view>
210
+                  </view>
211
+                  <view class="right-complete-two">
212
+                    <view
213
+                      className="right-content"
214
+                      onClick={() => onWriteOff(item)}
215
+                    >
216
+                      <image className="right-image" src={QRcode} />
217
+                      <view className="right-title">扫码核销</view>
218
+                    </view>
219
+                  </view>
220
+                </view>
80 221
               </view>
81
-              <text className='title-money' >¥6990元</text>
82
-              <view className='title-time' >有效期:2021/06/21-2021/12/31</view>
83
-            </view>
84
-          </view>
85
-          <view class='right-complete-two'>
86
-            <view className='right-content'>
87
-              <image className='right-image' src={QRcode} />
88
-              <view className='right-title'>扫码核销</view>
89
-            </view>
90
-          </view>
91
-        </view>
92
-        {/* 待支付 */}
93
-        <view className='OrderNumber'>订单编号:ABC123456789</view>
94
-
95
-        <view class='wrapper'>
96
-          <view class='left-complete-one'>
97
-            <image className='left-image-1' src={ProCard_hot}></image>
98
-            <view className='left-viewText'>
99
-              返现¥16.00
100
-            </view>
101
-            <view className='title-image'>
102
-              <image className='image-1' mode='scaleToFill' src={image}></image>
103
-              <image className='image-2' src={food}></image>
104
-            </view>
105
-            <view className='title-content'>
106
-              <view className='Pro-title'>
107
-                <view className='title-text'>【SEOUL·创意韩国料理】 <text className='title-money-2' >数量:1张</text></view>
222
+            );
223
+          }
224
+          /* 已过期 */
225
+          if (item.status === 9) {
226
+            return (
227
+              <view key={`${type}-${item.orderId}`}>
228
+                <view className="OrderNumber">订单编号:{item.orderId}</view>
229
+                <view class="wrapper">
230
+                  <view class="left-complete-one">
231
+                    <image className="left-image-1" src={ProCard_hot}></image>
232
+                    <view className="left-viewText">
233
+                      返现¥{item.cashback / 100}
234
+                    </view>
235
+                    {/* 评分 */}
236
+                    <view className="card-box-star">
237
+                      {scoreList.map((_, index) => {
238
+                        const src = index + 1 <= item.score ? starOn : starOff;
239
+                        return (
240
+                          <image
241
+                            className="card-star-image"
242
+                            key={index}
243
+                            src={src}
244
+                          />
245
+                        );
246
+                      })}
247
+                      <text className="card-star-text">{item.score}</text>
248
+                    </view>
249
+                    <view className="title-image">
250
+                      <image
251
+                        className="image-1"
252
+                        mode="scaleToFill"
253
+                        src={item.poster || image}
254
+                      ></image>
255
+                      <image className="image-2" src={food}></image>
256
+                    </view>
257
+                    <view className="title-content">
258
+                      <view className="Pro-title">
259
+                        <view className="title-text">
260
+                          {item.packageDescription}
261
+                          <text className="title-money-2">
262
+                            数量:{item.amount}张
263
+                          </text>
264
+                        </view>
265
+                      </view>
266
+                      <text className="title-money">
267
+                        ¥{item.unitPrice / 100}元
268
+                      </text>
269
+                      <view className="title-time">
270
+                        有效期:{formatTime(item?.startTime, "yyyy/MM/dd")}-
271
+                        {formatTime(item.endTime, "yyyy/MM/dd")}
272
+                      </view>
273
+                    </view>
274
+                  </view>
275
+                  <view class="right-complete-two">
276
+                    <view className="right-content">
277
+                      <image className="right-image-2" src={Null} />
278
+                    </view>
279
+                  </view>
280
+                </view>
108 281
               </view>
109
-              <text className='title-money' >¥6990元</text>
110
-              <view className='title-time' >有效期:2021/06/21-2021/12/31</view>
111
-            </view>
112
-          </view>
113
-          <view class='right-complete-two'>
114
-            <view className='right-content'>
115
-              <image className='right-image' src={Pay} />
116
-              <view className='right-title'>支付</view>
117
-            </view>
118
-          </view>
119
-        </view>
120
-        {/* 已过期 */}
121
-        <view className='OrderNumber'>订单编号:ABC123456789</view>
122
-        <view class='wrapper'>
123
-          <view class='left-complete-one'>
124
-            <image className='left-image-1' src={ProCard_hot}></image>
125
-            <view className='left-viewText'>
126
-              返现¥16.00
127
-            </view>
128
-            {/* 评分 */}
129
-            <view className='card-box-star'>
130
-              {
131
-                scoreList.map((_, index) => {
132
-
133
-                  const src = (index + '0.1') < score ? starOn : starOff
134
-                  return (
135
-                    <image className='card-star-image' key={index} src={src} />
136
-                  )
137
-                })
138
-              }
139
-              <text className='card-star-text' >{score}</text>
140
-            </view>
141
-            <view className='title-image'>
142
-              <image className='image-1' mode='scaleToFill' src={image}></image>
143
-              <image className='image-2' src={food}></image>
144
-            </view>
145
-            <view className='title-content'>
146
-              <view className='Pro-title'>
147
-                <view className='title-text'>【SEOUL·创意韩国料理】 <text className='title-money-2' >数量:1张</text></view>
282
+            );
283
+          }
284
+          /* 已使用 */
285
+          if (item.isVerified == 1) {
286
+            return (
287
+              <view key={`${type}-${item.orderId}`}>
288
+                <view className="OrderNumber">订单编号:{item.orderId}</view>
289
+                <view class="wrapper">
290
+                  <view class="left-complete-one">
291
+                    <image className="left-image-1" src={ProCard_hot}></image>
292
+                    <view className="left-viewText">
293
+                      返现¥{item.cashback / 100}
294
+                    </view>
295
+                    {/* 评分 */}
296
+                    <view className="card-box-star">
297
+                      {scoreList.map((_, index) => {
298
+                        console.log(index);
299
+                        const src = index + 1 <= item.score ? starOn : starOff;
300
+                        return (
301
+                          <image
302
+                            className="card-star-image"
303
+                            key={index}
304
+                            src={src}
305
+                          />
306
+                        );
307
+                      })}
308
+                      <text className="card-star-text">{item.score}</text>
309
+                    </view>
310
+                    <view className="title-image">
311
+                      <image
312
+                        className="image-1"
313
+                        mode="scaleToFill"
314
+                        src={item.poster || image}
315
+                      ></image>
316
+                      <image className="image-2" src={food}></image>
317
+                    </view>
318
+                    <view className="title-content">
319
+                      <view className="Pro-title">
320
+                        <view className="title-text">
321
+                          {item.packageDescription}
322
+                          <text className="title-money-2">
323
+                            数量:{item.amount}张
324
+                          </text>
325
+                        </view>
326
+                      </view>
327
+                      <text className="title-money">
328
+                        ¥{item.unitPrice / 100}元
329
+                      </text>
330
+                      <view className="title-time">
331
+                        核销时间:{" "}
332
+                        {formatTime(item.verifiedDate, "yyyy/MM/dd hh:mm")}
333
+                      </view>
334
+                    </view>
335
+                  </view>
336
+                  <view class="right-complete-two">
337
+                    <view className="right-content">
338
+                      <image className="right-image" src={Evaluation} />
339
+                      <view className="right-title">评价</view>
340
+                    </view>
341
+                  </view>
342
+                </view>
148 343
               </view>
149
-              <text className='title-money' >¥6990元</text>
150
-              <view className='title-time' >有效期:2021/06/21-2021/12/31</view>
151
-            </view>
152
-          </view>
153
-          <view class='right-complete-two'>
154
-            <view className='right-content'>
155
-              <image className='right-image-2' src={Null} />
156
-            </view>
157
-          </view>
158
-        </view>
159
-        <view className='foot'>
160
-          已经到底了~
161
-        </view>
344
+            );
345
+          }
346
+        })}
347
+
348
+        <view className="foot">已经到底了~</view>
162 349
       </view>
163
-    </scroll-view >
350
+    </scroll-view>
351
+  );
352
+};
353
+
354
+//  {/* 待核销 */}
355
+
356
+//  {/* 待支付 */}
164 357
 
165
-  )
166
-}
358
+//  {/* 已过期 */}

+ 21
- 16
src/components/Landlord/HouseManage/houseManage.jsx Ver fichero

@@ -1,40 +1,45 @@
1 1
 import Taro from '@tarojs/taro'
2
-import CustomNav from '@/components/CustomNav'
3
-import pImg from '../../../assets/icons/landlord/定位 位置.png'
4
-import see from '../../../assets/icons/landlord/查看入住人.png'
5
-import share from '../../../assets/icons/landlord/分享链接.png'
6
-import del from '../../../assets/icons/landlord/删除.png'
7
-import addImg from '../../../assets/icons/landlord/添加.png'
8
-import iconsearch from '../../../assets/icons/housemantj/search.png'
2
+import see from '@/assets/icons/landlord/查看入住人.png'
3
+import share from '@/assets/icons/landlord/分享链接.png'
4
+import del from '@/assets/icons/landlord/删除.png'
5
+import addImg from '@/assets/icons/landlord/添加.png'
6
+import iconsearch from '@/assets/icons/housemantj/search.png'
9 7
 import './houseManage.less'
8
+import { useState, useEffect,useRef } from 'react'
9
+import {getRoomList} from '@/services/landlord'
10 10
 
11 11
 
12 12
 export default (props) => {
13
+  const {hotel}=props
14
+  const [detail, setDetail] = useState([])
15
+  useEffect(()=>{
16
+    getRoomList({hotelId:hotel.hotelId}).then((res)=>{
17
+      setDetail(res.records||[])
18
+    })
19
+  },[hotel])
13 20
   return (
14 21
     <view>
15
-      <view>
16
-        <CustomNav logo={null} title='十公里周边指南' />
17
-      </view>
18 22
       <view style={{ padding: '0 30rpx', height: '100%' }}>
19 23
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 204px)' }}>
20
-          <view className='position'>
21
-            <image className='pImg' src={pImg} />
22
-            当前店铺:<text>南京紫荆国际公寓酒店</text>
23
-          </view>
24 24
           <view className='search'>
25 25
             <input className='searchInput' disabled />
26 26
             <image className='searchicon' src={iconsearch} />
27 27
             <view className="searchword">请输入关键字搜索</view>
28 28
           </view>
29 29
           <view>
30
-            <view className='houseCard'>
31
-              <view className='houseName'>南京紫荆国际公寓酒店</view>
30
+            {
31
+              detail?.map((item)=>
32
+              <view className='houseCard'>
33
+              <view className='houseName'>{item.roomName}</view>
32 34
               <view className='operation'>
33 35
                 <view><image src={see} /><text>查看入住人</text></view>
34 36
                 <view><image src={share} /><text>分享链接</text></view>
35 37
                 <view><image src={del} /><text>删除房源</text></view>
36 38
               </view>
37 39
             </view>
40
+              )
41
+            }
42
+            
38 43
            
39 44
           </view>
40 45
         </scroll-view>        

+ 1
- 13
src/components/Landlord/HouseManage/houseManage.less Ver fichero

@@ -1,16 +1,4 @@
1
-.position{
2
-  height: 27px;
3
-  font-size: 28px;
4
-  color: #202020;
5
-  padding-left: 25px;
6
-  .pImg{
7
-    width: 35px;
8
-    height: 42px;
9
-    position: relative;
10
-    top: 10px;
11
-    right: 21px;
12
-  }
13
-}
1
+
14 2
 .search{
15 3
   padding: 40px 0  30px 0;
16 4
   position: relative;

+ 50
- 87
src/components/Landlord/Income/income.jsx Ver fichero

@@ -1,22 +1,27 @@
1
-import { useState} from 'react'
2
-import Taro from '@tarojs/taro'
3
-import Popup from '@/components/Popup'
4
-import CustomNav from '@/components/CustomNav'
1
+import { useState } from 'react'
5 2
 import './income.less'
6 3
 import eyes from '../../../assets/icons/shopKeeper/小眼睛.png'
7 4
 import ceyes from '../../../assets/icons/shopKeeper/小眼睛-闭上.png'
8 5
 import sImg from '../../../assets/icons/landlord/我的收入2.png'
9 6
 import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
10
-import touristON from '@/assets/icons/UserCenter/touristON.png'
11
-import touristOFF from '@/assets/icons/UserCenter/touristOFF.png'
12
-import hotelBossON from '@/assets/icons/UserCenter/hotelBossON.png'
13
-import hotelBossOFF from '@/assets/icons/UserCenter/hotelBossOFF.png'
14
-import shopBossON from '@/assets/icons/UserCenter/shopBossON.png'
15
-import shopBossOFF from '@/assets/icons/UserCenter/shopBossOFF.png'
16
-import  ToggleRoul  from  '@/components/toggleRoul/ToggleRoul'
17
-
7
+import ToggleRoul from '@/components/toggleRoul/ToggleRoul'
8
+import Picker from '@/components/Picker'
18 9
 
19 10
 export default (props) => {
11
+  const { hotelList, hotel, account, onHotelChange, accountlog } = props
12
+
13
+  const handleHotelChange = (hotelId, current) => {
14
+    onHotelChange(current)
15
+  }
16
+
17
+  const [isyear, setYear] = useState(true)
18
+  const [isMomth, setMonth] = useState(false)
19
+  const handleYear = () => {
20
+    isyear ? setYear(false) : setYear(true)
21
+  }
22
+  const handleMonth = () => {
23
+    isMomth ? setMonth(false) : setMonth(true)
24
+  }
20 25
   const [showCutover, setShowCutover] = useState(false)
21 26
   const ShowMoldeOn = () => {
22 27
     setShowCutover(true)
@@ -26,89 +31,47 @@ export default (props) => {
26 31
   }
27 32
   return (
28 33
     <view>
29
-      <view>
30
-        <CustomNav title='十公里' />
31
-      </view>
32 34
       <ToggleRoul showCutover={showCutover} onClose={onClose} />
33 35
       <view style={{ padding: '30rpx', height: '100%' }}>
34 36
         <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" style={{ height: 'calc(100vh - 120px)' }}>
35 37
           <view className='storexx'>
36
-              <view className='storeName'>店名:<text>Yun咖 云里 咖啡店</text></view>
37
-              <view onClick={ShowMoldeOn}  className='User-info-cutover'>
38
-                <image className='User-info-cutover-image' src={cutoverUser} />
39
-              </view>
40
-              <view className='money'>
41
-                <view className='sleft'>
42
-                  <view className='lword'>全年收入(税前)</view>
43
-                  <view className='yearMoney'>
44
-                    <text>2800000</text>元
45
-                    <image className='micon' src={eyes}></image>
46
-                  </view>
47
-                </view>
48
-                <view className='line' />
49
-                <view className='sright'>
50
-                  <view className='rword'>当月收入(税前)</view>
51
-                  <view className='monthMoney'>
52
-                    <text>******</text>元
53
-                    <image className='micon2' src={ceyes}></image>
54
-                  </view></view>
55
-              </view>
56
-            </view>
57
-          <view className='title'>推广收入记录</view>
58
-          <view>
59
-            <view className='spreadCard'>
60
-              <view className='spreadDate'>日期:<text>2021-06-24</text></view>
61
-              <view className='card'>
62
-                <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
63
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view> 
64
-                <image className='spreadImg' src={sImg} />
65
-              </view>
38
+            <view className='storeName'>店名:<Picker style={{ display: 'inline-block' }} placeholder="请选择民宿" value={hotel?.hotelId} kv={['hotelName', 'hotelId']} dicts={hotelList} onChange={handleHotelChange} /></view>
39
+            <view onClick={ShowMoldeOn} className='User-info-cutover'>
40
+              <image className='User-info-cutover-image' src={cutoverUser} />
66 41
             </view>
67
-            <view className='spreadCard'>
68
-              <view className='spreadDate'>日期:<text>2021-06-24</text></view>
69
-              <view className='card'>
70
-                <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
71
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view> 
72
-                <image className='spreadImg' src={sImg} />
73
-              </view>
74
-            </view>
75
-            <view className='spreadCard'>
76
-              <view className='spreadDate'>日期:<text>2021-06-24</text></view>
77
-              <view className='card'>
78
-                <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
79
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view> 
80
-                <image className='spreadImg' src={sImg} />
81
-              </view>
82
-            </view>
83
-            <view className='spreadCard'>
84
-              <view className='spreadDate'>日期:<text>2021-06-24</text></view>
85
-              <view className='card'>
86
-                <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
87
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view> 
88
-                <image className='spreadImg' src={sImg} />
89
-              </view>
90
-            </view>
91
-            <view className='spreadCard'>
92
-              <view className='spreadDate'>日期:<text>2021-06-24</text></view>
93
-              <view className='card'>
94
-                <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
95
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view> 
96
-                <image className='spreadImg' src={sImg} />
97
-              </view>
98
-            </view>
99
-            <view className='spreadCard'>
100
-              <view className='spreadDate'>日期:<text>2021-06-24</text></view>
101
-              <view className='card'>
102
-                <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>2021-06-24  20:45</text></view>
103
-                <view className='spreadMoney'>收入金额:<text>5.00</text>元</view> 
104
-                <image className='spreadImg' src={sImg} />
42
+            <view className='money'>
43
+              <view className='sleft'>
44
+                <view className='lword'>全年收入(税前)</view>
45
+                <view className='yearMoney'>
46
+                  <text>{isyear ? account?.amounts : '******'}</text>元
47
+                  <image className='micon' src={isyear ? eyes : ceyes} onClick={handleYear} />
48
+                </view>
105 49
               </view>
50
+              <view className='line' />
51
+              <view className='sright'>
52
+                <view className='rword'>当月收入(税前)</view>
53
+                <view className='monthMoney'>
54
+                  <text>{isMomth ? account?.currentCharges : '******'}</text>元
55
+                  <image className='micon2' src={isMomth ? eyes : ceyes} onClick={handleMonth}></image>
56
+                </view></view>
106 57
             </view>
107 58
           </view>
108
-          <view className='botton'>已经到底了~</view>
109
-        </scroll-view>        
110
-      </view>
111
-      
59
+          
60
+          <view className='title' >{accountlog.length!=''?'推广收入记录':'暂无推广收入'}</view>
61
+            {
62
+              accountlog?.map((item) => 
63
+                <view className='spreadCard'>
64
+                  <view className='card'>
65
+                    <view className='spreadTime'>时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间:<text>{item.createDate}</text></view>
66
+                    <view className='spreadMoney'>收入金额:<text>{parseFloat((item.amount/100).toFixed(2))}</text>元</view>
67
+                    <image className='spreadImg' src={sImg} />
68
+                  </view>
69
+                </view>
70
+              )
71
+            }
72
+            {accountlog.length!=''?<view className='botton'>已经到底了~</view>:''}          
73
+        </scroll-view>
112 74
       </view>
75
+    </view>
113 76
   )
114 77
 }

+ 15
- 22
src/components/Landlord/Income/income.less Ver fichero

@@ -56,7 +56,7 @@
56 56
 }
57 57
 .storexx{
58 58
   text-align: center;
59
-  height: 302px;
59
+  display: flow-root;
60 60
   background: #FFFFFF;
61 61
   box-shadow: 0px 8px 32px 0px rgba(0, 0, 0, 0.08);
62 62
   border-radius: 24px;
@@ -80,26 +80,26 @@
80 80
   }
81 81
   .sleft{
82 82
     float: left;
83
+    text-align: left;
83 84
     .lword{
84
-      height: 25px;
85 85
       font-size: 26px;
86 86
       color: #666666;
87
-      margin-bottom: 40px;      
88
-      margin-left: 1px;
87
+      margin-bottom: 40px;
89 88
     }
90 89
     .yearMoney{
91
-      height: 30px;
92 90
       font-size: 28px;
93 91
       font-weight: bold;
94 92
       color: #202020;
93
+      line-height: 0;
94
+      display: inline-block;
95 95
       text{
96 96
         font-size: 40px;
97 97
         color: #FF3434
98 98
       }
99 99
       .micon{
100 100
         width: 38px;
101
-        height: 22px;
102
-        margin-left: 19px;
101
+        height: 26px;
102
+        margin-left: 20px;
103 103
       }
104 104
     }
105 105
   }
@@ -114,28 +114,26 @@
114 114
   }
115 115
   .sright{
116 116
     float: right;
117
-    text-align: left;
117
+    text-align: right;
118 118
     .rword{
119 119
       font-size: 26px;
120 120
       color: #666666;
121
-      margin: 0 25px 47px 0;
122
-      text-align: center;
121
+      margin-bottom: 40px;
123 122
     }
124 123
     .monthMoney{
125
-      height: 24px;
126 124
       font-size: 28px;
127 125
       font-weight: bold;
128 126
       color: #202020;
129
-      line-height: 24px;
127
+      line-height: 0;
128
+      display: inline-block;
130 129
       text{
131 130
         font-size: 40px;
132 131
         color: #FF3434;
133 132
       }
134 133
       .micon2{
135
-        width: 34px;
136
-        height: 16px;
137
-        margin-left: 23px;
138
-        margin-bottom: 7px;
134
+        height: 26px;
135
+        width: 38px;
136
+        margin-left: 20px;
139 137
       }
140 138
     }
141 139
   }
@@ -147,12 +145,7 @@
147 145
   margin: 62px 0 10px 1px;
148 146
 }
149 147
 .spreadCard{
150
-  margin-bottom: 1px;
151
-  .spreadDate{
152
-    font-size: 20px;
153
-    color: #202020;
154
-    line-height: 60px;
155
-  }
148
+  margin-bottom: 60px;  
156 149
   .card{
157 150
     height: 166px;
158 151
     background: #FFF;

+ 58
- 0
src/components/Picker/index.jsx Ver fichero

@@ -0,0 +1,58 @@
1
+import { useEffect, useState } from 'react'
2
+import { Picker, View } from '@tarojs/components'
3
+import './style.less'
4
+
5
+export default (props) => {
6
+  const { kv, value, onChange, dicts, placeholder, mode, ...leftProps } = props
7
+  const [rangeKey, rangeVal] = kv || ['label', 'value']
8
+
9
+  const [inx, setInx] = useState()
10
+  const [text, setText] = useState()
11
+
12
+  const handleChange = (e) => {
13
+    if (mode && mode !== 'selector') {
14
+      onChange(e.detail.value)
15
+      return
16
+    }
17
+
18
+    const index = e.detail.value - 0
19
+    const item = dicts[index]
20
+    if (onChange) {
21
+      onChange(item[rangeVal], item)
22
+    }
23
+  }
24
+
25
+  useEffect(() => {
26
+    if (dicts && dicts.length > 0) {
27
+      if (value !== undefined && value !== null) {
28
+        for(let i = 0; i < dicts.length; i += 1) {
29
+          if (dicts[i][rangeVal] === value) {
30
+            setInx(i)
31
+            setText(dicts[i][rangeKey])
32
+            break;
33
+          }
34
+        }
35
+      }
36
+    }
37
+  }, [dicts, rangeKey, rangeVal, value])
38
+
39
+  useEffect(() => {
40
+    if (mode && mode !== 'selector') {
41
+      setText(value)
42
+    }
43
+  }, [mode, value])
44
+
45
+  return (
46
+    <Picker
47
+      className='g-picker'
48
+      rangeKey={rangeKey}
49
+      onChange={handleChange}
50
+      value={inx}
51
+      range={dicts}
52
+      mode={mode||'selector'}
53
+      {...leftProps}
54
+    >
55
+      <View>{text || placeholder || '请选择'}</View>
56
+    </Picker>
57
+  )
58
+}

+ 0
- 0
src/components/Picker/style.less Ver fichero


+ 46
- 52
src/components/foodCards/foodCards.jsx Ver fichero

@@ -1,7 +1,4 @@
1
-import useSave from "@/utils/hooks/useSave"
2
-import Taro from "@tarojs/taro"
3
-import { getShopDetail, getShopcity } from '@/services/home'
4
-import { useState, useEffect } from 'react'
1
+import Taro from '@tarojs/taro'
5 2
 import Star from '@/components/Star/Star.jsx'
6 3
 import pay from '@/assets/icons/housemantj/pay.png'
7 4
 import msTip from '@/assets/icons/housemantj/foodtip.png'
@@ -9,71 +6,68 @@ import wz from '@/assets/icons/housemantj/location.png'
9 6
 import hongxin from '@/assets/icons/housemantj/已收藏.png'
10 7
 import baixin from '@/assets/icons/housemantj/收藏.png'
11 8
 import './style.less'
9
+import useSave from "@/utils/hooks/useSave"
10
+import {getShopDetail,getShopcity} from '@/services/home'
11
+import { useState, useEffect } from 'react'
12 12
 
13 13
 
14 14
 
15 15
 //套餐卡片
16 16
 export default (props) => {
17 17
   const { item } = props
18
-  const [isSaved, toggleSave] = useSave(item.isSaved, 'shop_package', item.packageId)
19
-  const [city, setCity] = useState({})
20
-  const [detail, setDetail] = useState({})
21
-
22
-  const goToPay = () => {
23
-    Taro.navigateTo({
24
-      url: `/pages/PayOrder/index?packageId=${item.packageId}&shopId=${item.shopId}`,
25
-    })
26
-  }
18
+  const [isSaved, toggleSave] = useSave(item.isSaved,'shop_package', item.packageId)
19
+  const [city,setCity]=useState({})
20
+  const [detail,setDetail]=useState({})
27 21
 
28 22
   useEffect(() => {
29
-    getShopDetail(item.shopId).then((res) => {
30
-      setDetail(res)
31
-      getShopcity(res.cityId).then((res2) => {
32
-        setCity(res2)
33
-      })
23
+  getShopDetail(item.shopId).then((res)=>{
24
+    setDetail(res)
25
+    getShopcity(res.cityId).then((res2)=>{
26
+      setCity(res2)
34 27
     })
35
-  }, [])
36
-  const star = parseFloat(((detail.sweetScore + detail.environmentScore + detail.serviceScore) / 3).toFixed(1));
28
+  })
29
+}, [])
30
+const star=parseFloat(((detail.sweetScore+detail.environmentScore+detail.serviceScore)/3).toFixed(1)); 
37 31
 
38 32
   return (
39
-    <view className='foodCard'>
40
-      <view className='fCleft'>
41
-        <view className='backMoney'>
42
-          返现¥{item.cashback / 100}
43
-        </view>
44
-        <view className='appraise'>
45
-          <Star star={star} />
46
-          <text className='storezf'>{star}</text>
47
-        </view>
48
-        <view>
49
-          <view className='contentImg'>
50
-            <image src={item.poster} className='img1'></image>
51
-            <image src={msTip} className='mstip'></image>
33
+      <view className='foodCard'>
34
+        <view className='fCleft'>
35
+          <view className='backMoney'>
36
+            返现¥{item.cashback/100}
37
+          </view>
38
+          <view className='appraise'>
39
+            <Star star={star} />
40
+            <text className='storezf'>{star}</text>
52 41
           </view>
53
-          <view className='neirong'>
54
-            <view className='textword'>{(item.description).toString().length > 25 ? (item.description).substring(0, 25) + '...' : (item.description)}</view>
55
-            <view className='jiage'>
56
-              <text className='rmb' >¥&nbsp;&nbsp;</text>
57
-              <text className='p1'><text className='price' >{item.actualPrice / 100}</text>元&nbsp;&nbsp;</text>
58
-              <text className='p2'>门市价<text className='oldprice' >{item.standardPrice / 100}</text>元</text>
42
+          <view>
43
+            <view className='contentImg'>
44
+              <image src={item.poster} className='img1'></image>
45
+              <image src={msTip} className='mstip'></image>
59 46
             </view>
60
-            <view className='address'>
61
-              <image className='dw' src={wz} />
62
-              <text className='wz'>{city.areaPName}/{city.areaName}</text>
63
-              <view style={{ display: 'inline-block' }} onClick={toggleSave}>
64
-                <image className='star' src={isSaved > 0 ? hongxin : baixin}></image>
65
-                <text className='collection'>{isSaved > 0 ? '已收藏' : '加入收藏'}</text>
47
+            <view className='neirong'>
48
+              <view className='textword'>{(item.description).toString().length>25?(item.description).substring(0, 25)+'...':(item.description)}</view>
49
+              <view className='jiage'>
50
+                <text className='rmb' >¥&nbsp;&nbsp;</text>
51
+                <text className='p1'><text className='price' >{item.actualPrice/100}</text>元&nbsp;&nbsp;</text>
52
+                <text className='p2'>门市价<text className='oldprice' >{item.standardPrice/100}</text>元</text>
53
+              </view>
54
+              <view className='address'>
55
+                <image className='dw' src={wz} />
56
+                <text className='wz'>{city.areaPName}/{city.areaName}</text>
57
+                <view style={{display:'inline-block'}} onClick={toggleSave}>
58
+                <image className='star' src={isSaved>0?hongxin:baixin}></image>
59
+                <text className='collection'>{isSaved>0?'已收藏':'加入收藏'}</text>
60
+              </view>
66 61
               </view>
67 62
             </view>
68 63
           </view>
69 64
         </view>
65
+        <view className='fCright' onClick={()=>{Taro.navigateTo({ url: `/pages/PayOrder/index?packageId=${item.packageId}` });}}>
66
+          <image src={pay} />
67
+          <view>支付</view>
68
+        </view>
69
+        <view className='columnLine'></view>
70 70
       </view>
71
-      <view className='fCright' onClick={() => { goToPay() }}>
72
-        <image src={pay} />
73
-        <view>支付</view>
74
-      </view>
75
-      <view className='columnLine'></view>
76
-    </view>
77
-
71
+    
78 72
   )
79 73
 }

+ 34
- 3
src/hotel/pages/landlord/landlord.jsx Ver fichero

@@ -7,15 +7,45 @@ import incomeImg from '@/assets/icons/landlord/我的收入.png'
7 7
 import onincomeImg from '@/assets/icons/landlord/我的收入按下.png'
8 8
 import houseImg from '@/assets/icons/landlord/房源管理.png'
9 9
 import onhouseImg from '@/assets/icons/landlord/房源管理按下.png'
10
-import './landlord.less'
11 10
 import withLayout from '@/layouts'
11
+import { getHotelManage, getAccountLogList, getNowHotelManage } from '@/services/landlord'
12
+import CustomNav from '@/components/CustomNav'
12 13
 
14
+import './landlord.less'
13 15
 
14 16
 export default withLayout((props) => {
15 17
   const { router, person } = props
16 18
   const { params } = useRouter()
17 19
   const { tab } = params || {}
18 20
 
21
+  const [hotelList, setHotelList] = useState([])
22
+  const [hotel, setHotel] = useState()
23
+  const [account, setAccount] = useState()
24
+  const [accountlog, setAccountLog] = useState([])
25
+
26
+  useEffect(() => {
27
+    getHotelManage().then((res) => {
28
+      const { hotelList: list, account: acc, hotel: current } = res
29
+      setHotelList(list)
30
+      setHotel(current)
31
+      setAccount(acc)
32
+      getAccountLogList(acc.accountId).then((res2) => {
33
+        setAccountLog(res2.records || [])
34
+      })
35
+    })
36
+  }, [])
37
+
38
+  const handleHotelChange = (current) => {    
39
+    getNowHotelManage(current.hotelId).then((res) => {
40
+      const {account: acc } = res
41
+      setAccount(acc)
42
+      setHotel(current)
43
+      getAccountLogList(acc.accountId).then((res2) => {
44
+        setAccountLog(res2.records || [])
45
+      })
46
+    })
47
+  }
48
+
19 49
   const [currentTab, setCurrentTab] = useState(0)
20 50
 
21 51
   const handleTabChange = (e) => {
@@ -31,9 +61,10 @@ export default withLayout((props) => {
31 61
 
32 62
   return (
33 63
     <view className='page-index'>
64
+      <CustomNav title={hotel?.hotelName} logo={hotel?.logo} />
34 65
       <view className='index-container'>
35
-        {currentTab === 0 && <Income />}
36
-        {currentTab === 1 && <HouseManage />}
66
+        {currentTab === 0 && <Income hotelList={hotelList} hotel={hotel} account={account} onHotelChange={handleHotelChange} accountlog={accountlog} />}
67
+        {currentTab === 1 && <HouseManage hotel={hotel} />}
37 68
       </view>
38 69
       <view className='index-tabbar'>
39 70
         <TabBar extClass='custom-tabbar bottomTab' current={currentTab} onChange={handleTabChange}>

+ 4
- 4
src/pages/MineUserAll/AllOrder/index.jsx Ver fichero

@@ -96,10 +96,10 @@ export default withLayout((props) => {
96 96
         </mp-tabs>
97 97
       </view>
98 98
       {activeTab === 0 && <Complete />}
99
-      {activeTab === 1 && <TobePaid />}
100
-      {activeTab === 2 && <TobeWritten />}
101
-      {activeTab === 3 && <AlreadyUsed />}
102
-      {activeTab === 4 && <AlreadyExpired />}
99
+      {activeTab === 1 && <Complete type={0} />}
100
+      {activeTab === 2 && <Complete type={1} />}
101
+      {activeTab === 3 && <Complete type={2} />}
102
+      {activeTab === 4 && <Complete type={3} />}
103 103
     </view>
104 104
   )
105 105
 })

+ 275
- 131
src/pages/PayOrder/index.jsx Ver fichero

@@ -1,147 +1,291 @@
1
-import withLayout from '@/layouts'
2
-import image from '@/assets/icons/ProCard/8kb.jpg'
3
-import AuthPage from '@/components/AuthPage'
4
-import Taro from '@tarojs/taro'
5
-import { useState, useEffect, useRef } from 'react'
6
-import { Button, Radio, Input } from '@tarojs/components'
7
-import food from '@/assets/icons/ProCard/food.png'
8
-import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
9
-import CustomNav from '@/components/CustomNav'
10
-import PayOrderCard from '@/components/PayOrderCard'
11
-import { PaysOrder, getMineOrder } from '@/services/payOrder' //创建订单
12
-import { getShopPackage, } from '@/services/home'
13
-import './style.less'
1
+import withLayout from "@/layouts";
2
+import image from "@/assets/icons/ProCard/8kb.jpg";
3
+import { useState, useEffect } from "react";
4
+import { Button, Checkbox, Input } from "@tarojs/components";
5
+
6
+import food from "@/assets/icons/ProCard/food.png";
7
+import ProCard_hot from "@/assets/icons/ProCard/ProCard_hot.png";
8
+import CustomNav from "@/components/CustomNav";
9
+import OrderMolded from "@/components/OrderMolded";
10
+import Popup from "@/components/Popup";
11
+
12
+import "./style.less";
13
+import Taro, { useDidShow } from "@tarojs/taro";
14
+import { getShopPackageDetail } from "@/services/home";
15
+import { saveOrder, getOrderSub, payOrder } from "@/services/payOrder";
16
+import formatTime from "@/utils/formatTime";
14 17
 
15 18
 export default withLayout((props) => {
16
-  const { router, person } = props
17
-  const { id, shopId, packageId } = props.router.params
18
-  const [shopPackage, setShopPackage] = useState([])
19
-  const [buttonDisabled, setButtonDisabled] = useState(true)
20
-  const [totalCost, setTotalCost] = useState(0)
21
-  const [cashBack, setCashBack] = useState(0)
22
-  const [realPrice, setRealPrice] = useState(0)
23
-
24
-  console.log('----------shopId-------', props, shopId, id);
25
-
26
-  const handelButton = () => {
27
-    setButtonDisabled(false)
28
-  }
29
-
30
-  const goRules = () => {
31
-    Taro.navigateTo({ url: `/pages/MineUserAll/Rules/index` })
32
-
33
-  }
34
-
35
-
36
-  const handeList = () => {
37
-    shopPackage.map((item) => {
38
-      //总价
39
-      let CostSum = (item.actualPrice / 100) * (item.BuyNumber || 1)
40
-      setTotalCost(totalCost + CostSum)
41
-      //返现价
42
-      let backSum = (item.cashback / 100) * (item.BuyNumber || 1)
43
-      setCashBack(cashBack + backSum)
44
-      //实际价
45
-      let PriceSum = (item.standardPrice / 100) * (item.BuyNumber || 1)
46
-      setRealPrice(realPrice + PriceSum)
47
-
48
-    })
19
+  const { router, person } = props;
20
+  const { packageId, orderId } = props.router.params;
21
+
22
+  const [payInfo,setPayInfo] = useState()
23
+
24
+  const [showDialog, setShowDialog] = useState(false);
25
+  // 是否已阅读协议
26
+  const [agreement, setAgreement] = useState(false);
27
+  // 总价 totalPrice
28
+  const [totalPrice, setTotalPrice] = useState({});
29
+  const [list, setList] = useState([]);
30
+
31
+  const [BuyNumber, setBuyNumber] = useState(1);
32
+  const [detail, setDetail] = useState({});
33
+
34
+  const [DisabledBool, setDisabledBool] = useState(false);
35
+
36
+  const ShowMoldeOn = (e) => {
37
+    if (packageId) {
38
+      setBuyNumber(e.amount || 1);
39
+      setDetail(e);
40
+      setShowDialog(true);
41
+    }
42
+  };
43
+  const ButtonCancel = () => {
44
+    setShowDialog(false);
45
+  };
46
+  const ButtonOK = (e) => {
47
+    setList(
48
+      list.map((x) =>
49
+        x.packageId == detail.packageId ? { ...x, amount: BuyNumber } : x
50
+      )
51
+    );
52
+    setShowDialog(false);
53
+  };
54
+
55
+  const NumberAdd = () => {
56
+    setBuyNumber(BuyNumber + 1);
57
+    console.log(BuyNumber);
58
+  };
59
+
60
+  const NumberCut = () => {
61
+    if (DisabledBool) return;
62
+    setBuyNumber(BuyNumber - 1);
63
+    console.log(BuyNumber);
64
+  };
65
+
66
+  const onInput = (e) => {
67
+    let values = e.detail.value;
68
+    setBuyNumber(values - 0);
69
+  };
70
+
71
+  const requestPayment = (params) =>{
72
+    console.log(params,'requestPayment')
73
+    Taro.requestPayment({
74
+      ...params,
75
+      package: params.packageValue,
76
+      success: () => {
77
+        console.log("success");
78
+        setPayInfo()
79
+        Taro.showToast({
80
+          title: "支付成功",
81
+          icon: "none",
82
+          duration: 2000,
83
+        });
84
+      },
85
+      fail: (e) => {
86
+        console.log(e, "fail");
87
+        Taro.showToast({
88
+          title: "支付失败",
89
+          icon: "none",
90
+          duration: 2000,
91
+        });
92
+      },
93
+    });
49 94
   }
50 95
 
51
-
52
-
53
-
54
-  useEffect(() => {
55
-
56
-
57
-    getShopPackage(shopId, { packageId: packageId }).then((res) => {
58
-      const itemShop = res.records
59
-      setShopPackage(itemShop)
60
-    })
61
-
62
-
63
-  }, [])
64
-
65
-
66
-
67
-
68
-
69
-  const shopContent = (item) => {
70
-    const lst = shopPackage.map((pack) => {
71
-      if (pack.packageId === item.packageId) {
72
-        return item
73
-      } else {
74
-        return pack
96
+  const onShowPay = (e) => {
97
+    if (agreement) {
98
+      if(payInfo){
99
+        requestPayment(payInfo)
100
+        return
75 101
       }
76
-    })
77
-
78
-    setShopPackage(lst)
79
-  }
80
-
81
-  const submit = (data) => {
82
-    PaysOrder(data, {
83
-      amount: 2,
84
-      itemId: id,
85
-      price: totalCost
86
-
87
-    }).then((res) => {
88
-      console.log("🚀 ~ file: index.jsx ~ line 33 ~ submit ~ res", res)
89
-
90
-      Taro.requestPayment({
91
-        timeStamp: '',
92
-        nonceStr: '',
93
-        package: '',
94
-        signType: 'MD5',
95
-        paySign: '',
96
-        success: val => {
97
-          console.log(val);
98
-        },
99
-        fail: err => {
100
-
101
-        }
102
+      if (packageId) {
103
+        saveOrder(
104
+          list.map((x) => {
105
+            return {
106
+              amount: x.amount || 1,
107
+              itemId: x.packageId,
108
+              price: x.actualPrice,
109
+            };
110
+          })
111
+        ).then((res) => {
112
+          setPayInfo(res)
113
+          requestPayment(res)
114
+        });
115
+      }
116
+      if (orderId) {
117
+        payOrder(orderId).then((res) => {
118
+          setPayInfo(res)
119
+          requestPayment(res)
120
+        });
121
+      }
122
+    } else {
123
+      Taro.showToast({
124
+        title: "请勾选《平台用户服务协议》",
125
+        icon: "none",
126
+        duration: 2000,
127
+      });
128
+    }
129
+  };
102 130
 
103
-      })
131
+  useEffect(() => {
132
+    if (packageId) {
133
+      getShopPackageDetail(packageId).then((res) => {
134
+        setList([res]);
135
+      });
136
+    }
137
+    if (orderId) {
138
+      getOrderSub({ pageNum: 1, pageSize: 999, orderId }).then((res) => {
139
+        setList(res.records);
140
+      });
141
+    }
142
+  }, [packageId, orderId]);
104 143
 
105
-    }).catch(err => {
106
-      console.log("🚀 ~ -------------支付错误------------", err)
144
+  useEffect(() => {
145
+    if (BuyNumber < 2) {
146
+      setDisabledBool(true);
147
+    } else {
148
+      setDisabledBool(false);
149
+    }
150
+  }, [BuyNumber]);
107 151
 
152
+  useEffect(() => {
153
+    let total = {
154
+      cashback: 0,
155
+      actualPrice: 0,
156
+      standardPrice: 0,
157
+    };
158
+    list.map((x) => {
159
+      total.cashback += x.cashback * (x.amount || 1);
160
+      total.actualPrice += (x.actualPrice || x.unitPrice) * (x.amount || 1);
161
+      total.standardPrice += x.standardPrice * (x.amount || 1);
108 162
     });
109
-  }
110
-
111
-
112
-
113
-  return !person.phone ? <AuthPage /> : (
114
-
115
-    <view class='container'>
116
-      <CustomNav title='订单' />
117
-      {
118
-        shopPackage?.map((item, index) => <PayOrderCard onShopContent={shopContent} onShopNumber={handeList} key={(index)} item={item} />)
119
-      }
120
-
121
-      <view className='view-button'>
122
-        <view className='Card-number-box'>
123
-          <view className='Card-number'>
124
-            <text style='left:29px;position: absolute; padding-top:20px'>手机号码:</text>
125
-            <text style='right:29px;position: absolute;padding-top:20px'>{person.phone}</text>
163
+    setTotalPrice(total);
164
+  }, [list]);
165
+
166
+  return (
167
+    <view class="container">
168
+      <CustomNav title="订单" />
169
+      <Popup show={showDialog} maskClosable={false}>
170
+        <OrderMolded item={detail}/>
171
+        <view className="item-center-Number">
172
+          <view
173
+            className="buy-num-minus"
174
+            disabled={DisabledBool}
175
+            onClick={NumberCut}
176
+          >
177
+            -
126 178
           </view>
127
-          <view className='Card-user'>
128
-            <Radio onClick={handelButton} style='padding-left:20px; position: relative; top:24px;' value='我已阅读知晓并同意' >我已阅读知晓并同意 <text style='color:#274190;text-decoration:underline;font-weight:400' onClick={goRules} >《平台用户服务协议》</text></Radio>
179
+          <Input
180
+            className="buy-num-input"
181
+            type="number"
182
+            min="1"
183
+            onInput={onInput}
184
+            value={BuyNumber}
185
+          />
186
+          <view className="buy-num-add" onClick={NumberAdd}>
187
+            +
129 188
           </view>
130 189
         </view>
131
-        <view className='button-box-button-box'>
132
-          <view className='button-text-image' >
133
-            <text className='button-text-money-hot'>返现¥{cashBack}</text>
134
-            <image className='button-image' src={ProCard_hot}></image>
135
-            <view className='button-text-money'>门店市面价:{realPrice / 100}元</view>
190
+        <view className="buy-button-box">
191
+          <button className="button-Cancel" onClick={ButtonCancel}>
192
+            取消
193
+          </button>
194
+          <button className="button-OK" onClick={ButtonOK}>
195
+            确定
196
+          </button>
197
+        </view>
198
+      </Popup>
199
+      <view class="coupon-list">
200
+        {list?.map((item) => {
201
+          return (
202
+            <view class="wrapper">
203
+              <view class="left-complete-one">
204
+                <image className="left-image-1" src={ProCard_hot}></image>
205
+                <view className="left-viewText">
206
+                  返现¥{(item.cashback || 0) / 100}
207
+                </view>
208
+                <view className="title-image">
209
+                  <image
210
+                    className="image-1"
211
+                    mode="scaleToFill"
212
+                    src={item.poster}
213
+                  ></image>
214
+                  <image className="image-2" src={food}></image>
215
+                </view>
216
+                <view className="title-content">
217
+                  <view className="Pro-title">
218
+                    <view className="title-text">{item.description}</view>
219
+                  </view>
220
+                  <text className="title-money">
221
+                    ¥{(item.actualPrice || item.unitPrice || 0) / 100}元
222
+                    <text className="title-money-2">
223
+                      门市价{(item.standardPrice || 0) / 100}元
224
+                    </text>
225
+                  </text>
226
+                  <view className="title-time">
227
+                    有效期:{formatTime(item.startTime, "yyyy/MM/dd")}-
228
+                    {formatTime(item.endTime, "yyyy/MM/dd")}
229
+                  </view>
230
+                </view>
231
+              </view>
232
+              <view
233
+                class="right-complete-two"
234
+                onClick={() => ShowMoldeOn(item)}
235
+              >
236
+                <view className="right-content">
237
+                  <view className="right-number">×{item.amount || 1}</view>
238
+                  <view className="right-title">数量</view>
239
+                </view>
240
+              </view>
241
+            </view>
242
+          );
243
+        })}
244
+      </view>
245
+      <view className="view-button">
246
+        <view className="Card-number-box">
247
+          <view className="Card-number">
248
+            <text style="left:29px;position: absolute; padding-top:20px">
249
+              手机号码:
250
+            </text>
251
+            <text style="right:29px;position: absolute;padding-top:20px">
252
+              {person.phone}
253
+            </text>
254
+          </view>
255
+          <view className="Card-user">
256
+            <Checkbox
257
+              style="padding-left:20px; position: relative; top:24px;"
258
+              value="agreement"
259
+              checked={agreement}
260
+              onClick={() => {
261
+                setAgreement(!agreement);
262
+              }}
263
+            >
264
+              我已阅读知晓并同意
265
+              <text style="color:#274190;text-decoration:underline;font-weight:400">
266
+                《平台用户服务协议》
267
+              </text>
268
+            </Checkbox>
136 269
           </view>
137
-          <Button onClick={submit} disabled={buttonDisabled} className='button-box-one'>¥{totalCost}元 <text className='button-text-one'>支付订单</text> </Button>
138 270
         </view>
139
-
271
+        <view className="button-box-button-box">
272
+          <view className="button-text-image">
273
+            <text className="button-text-money-hot">
274
+              返现¥{(totalPrice?.cashback || 0) / 100}
275
+            </text>
276
+            <image className="button-image" src={ProCard_hot}>
277
+              123123
278
+            </image>
279
+            <view className="button-text-money">
280
+              门店市面价:{(totalPrice?.standardPrice || 0) / 100}元
281
+            </view>
282
+          </view>
283
+          <Button className="button-box-one" onClick={() => onShowPay()}>
284
+            ¥{(totalPrice?.actualPrice || 0) / 100}元
285
+            <text className="button-text-one">支付订单</text>
286
+          </Button>
287
+        </view>
140 288
       </view>
141 289
     </view>
142
-
143
-
144
-  )
145
-
146
-})
147
-
290
+  );
291
+});

+ 1
- 2
src/pages/details/foodDetails/foodDetails.jsx Ver fichero

@@ -1,7 +1,7 @@
1 1
 import CustomNav from '@/components/CustomNav'
2 2
 import withLayout from '@/layouts'
3 3
 import { getShopDetail, getShopPackage, getExtendContent } from '@/services/home'
4
-import { useState, useEffect } from 'react'
4
+import { useState, useEffect,useRef } from 'react'
5 5
 import { Swiper, SwiperItem } from '@tarojs/components';
6 6
 import Star from '@/components/Star/Star.jsx'
7 7
 import Cards from '@/components/foodCards/foodCards.jsx'
@@ -20,7 +20,6 @@ import Taro from '@tarojs/taro'
20 20
 import Extend from '../components/Extend/extend'
21 21
 import useSave from "@/utils/hooks/useSave"
22 22
 import useLike from "@/utils/hooks/useLike"
23
-import { useRef } from 'react';
24 23
 
25 24
 export default withLayout((props) => {
26 25
   const { router, person } = props

+ 24
- 2
src/services/landlord.js Ver fichero

@@ -11,11 +11,33 @@ import request from '@/utils/request'
11 11
 
12 12
  
13 13
 /**
14
- * 查询房源列表 
14
+ * 查询指定名宿的账户
15 15
  * @param {*} params 
16 16
  * @returns 
17 17
  */
18
- export const getRoomList = (params) => request('/taRoom', { params })
18
+ export const getNowHotelManage = (id,params) => request(`/hotel/manage/${id}`, { params })
19
+
20
+
21
+/**
22
+ * 查询民宿老板的所有名宿列表
23
+ * @param {*} params 
24
+ * @returns 
25
+ */
26
+ export const getHotelManage = (params) => request('/hotel/manage/index', { params })
27
+
28
+/**
29
+ * 查询指定名宿的账户流水
30
+ * @param {*} params 
31
+ * @returns 
32
+ */
33
+ export const getAccountLogList = (id) => request(`/hotel/account/${id}/log`)
34
+
35
+/**
36
+ * 房源列表
37
+ * @param {*} id 
38
+ * @returns 
39
+ */
40
+ export const getRoomList = (params) => request('/taRoom',{params})
19 41
 
20 42
  /**
21 43
  * 删除房源

+ 26
- 6
src/services/payOrder.js Ver fichero

@@ -1,13 +1,33 @@
1 1
 //支付订单模块
2 2
 import request from '@/utils/request'
3 3
 //套餐订单列表用哪个接口
4
+//订单详情,订单修改数量
4 5
 
5
-export const getMineOrder = () => request('/orderSub/summary/mine',)
6
+  /**
7
+ * 生成订单
8
+ * @param {*} data 
9
+ * @returns 
10
+ */
11
+   export const saveOrder = (data) => request('/order', { method: 'post', data })
6 12
 
13
+   /**
14
+ * 获取子订单列表
15
+ * @param {*} data
16
+ * @returns 
17
+ */
18
+ export const getOrderSub = (data) => request('/orderSub', { data })
7 19
 
20
+   /**
21
+ * 订单项目发起支付
22
+ * @param {*} id 
23
+ * @returns 
24
+ */
25
+    export const payOrder = (id) => request(`/order/${id}/pay`, { method: 'post' })
8 26
 
9
-export const PaysOrder = (data) => request('/order', { data, method: 'post' })
10
-
11
-
12
-
13
-//订单详情,订单修改数量
27
+   /**
28
+ * 获取子订单列表
29
+ * @param {*} id
30
+ * @returns 
31
+ */
32
+    export const getQrcode = (id) => request(`/qrcode/${id}`)
33
+    

+ 16
- 0
src/utils/formatTime.js Ver fichero

@@ -0,0 +1,16 @@
1
+export default function formatTimes(date, fmt) {
2
+  var date = new Date(date);
3
+  var o = {
4
+    "M+": date.getMonth() + 1, //月份
5
+    "d+": date.getDate(), //日
6
+    "h+": date.getHours(), //小时
7
+    "m+": date.getMinutes(), //分
8
+    "s+": date.getSeconds(), //秒
9
+    "q+": Math.floor((date.getMonth() + 3) / 3), //季度
10
+    "S": date.getMilliseconds() //毫秒
11
+  };
12
+  if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
13
+  for (var k in o)
14
+    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
15
+  return fmt;
16
+};