瀏覽代碼

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

李志伟 3 年之前
父節點
當前提交
2f792cdbd7

+ 10
- 7
.vscode/launch.json 查看文件

@@ -2,14 +2,17 @@
2 2
     // 使用 IntelliSense 了解相关属性。 
3 3
     // 悬停以查看现有属性的描述。
4 4
     // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
5
-    "version": "0.2.0",
6
-    "configurations": [
7
-        {
8
-            "type": "pwa-chrome",
5
+    
6
+        "version": "0.2.0",
7
+        "configurations": [
8
+          {
9
+            "type": "pwa-msedge",
9 10
             "request": "launch",
10
-            "name": "Launch Chrome against localhost",
11
+            "name": "Launch Microsoft Edge and open the Edge DevTools",
11 12
             "url": "http://localhost:8080",
12 13
             "webRoot": "${workspaceFolder}"
13
-        }
14
-    ]
14
+          }
15
+        ]
16
+      
17
+    
15 18
 }

+ 1
- 0
package.json 查看文件

@@ -42,6 +42,7 @@
42 42
     "@tarojs/runtime": "3.3.2",
43 43
     "@tarojs/taro": "3.3.2",
44 44
     "@zjxpcyc/react-tiny-store": "^1.0.0",
45
+    "moment": "^2.29.1",
45 46
     "react": "^17.0.0",
46 47
     "react-dom": "^17.0.0"
47 48
   },

+ 2
- 2
src/components/CompoentsOrder/AlreadyExpired/index.jsx 查看文件

@@ -39,7 +39,7 @@ export default (props) => {
39 39
             <view className='card-box-star'>
40 40
               {
41 41
                 scoreList.map((_, index) => {
42
-                  console.log(index)
42
+
43 43
                   const src = (index + '0.1') < score ? starOn : starOff
44 44
                   return (
45 45
                     <image className='card-star-image' key={index} src={src} />
@@ -78,7 +78,7 @@ export default (props) => {
78 78
             <view className='card-box-star'>
79 79
               {
80 80
                 scoreList.map((_, index) => {
81
-                  console.log(index)
81
+
82 82
                   const src = (index + '0.1') < score ? starOn : starOff
83 83
                   return (
84 84
                     <image className='card-star-image' key={index} src={src} />

+ 5
- 5
src/components/CompoentsOrder/AlreadyUsed/index.jsx 查看文件

@@ -48,7 +48,7 @@ export default (props) => {
48 48
               <text className='card-box-star-text' onClick={Nuberr} >口味:</text>
49 49
               {
50 50
                 scoreList.map((_, index) => {
51
-                  console.log(index)
51
+
52 52
                   const src = (index + `${CollectNub}`) < score ? starOn : starOff
53 53
                   return (
54 54
                     <image className='card-star-image' key={index} src={src} onClick={Nuberr} />
@@ -60,7 +60,7 @@ export default (props) => {
60 60
               <text className='card-box-star-text' onClick={Nuberr} >环境:</text>
61 61
               {
62 62
                 scoreList.map((_, index) => {
63
-                  console.log(index)
63
+
64 64
                   const src = (index + `${CollectNub}`) < score ? starOn : starOff
65 65
                   return (
66 66
                     <image className='card-star-image' key={index} src={src} onClick={Nuberr} />
@@ -72,7 +72,7 @@ export default (props) => {
72 72
               <text className='card-box-star-text' onClick={Nuberr} >服务:</text>
73 73
               {
74 74
                 scoreList.map((_, index) => {
75
-                  console.log(index)
75
+
76 76
                   const src = (index + `${CollectNub}`) < score ? starOn : starOff
77 77
                   return (
78 78
                     <image className='card-star-image' key={index} src={src} onClick={Nuberr} />
@@ -100,7 +100,7 @@ export default (props) => {
100 100
             <view className='card-box-star'>
101 101
               {
102 102
                 scoreList.map((_, index) => {
103
-                  console.log(index)
103
+
104 104
                   const src = (index + '0.1') < score ? starOn : starOff
105 105
                   return (
106 106
                     <image className='card-star-image' key={index} src={src} />
@@ -141,7 +141,7 @@ export default (props) => {
141 141
             <view className='card-box-star'>
142 142
               {
143 143
                 scoreList.map((_, index) => {
144
-                  console.log(index)
144
+
145 145
                   const src = (index + '0.1') < score ? starOn : starOff
146 146
                   return (
147 147
                     <image className='card-star-image' key={index} src={src} />

+ 2
- 2
src/components/CompoentsOrder/complete/index.jsx 查看文件

@@ -34,7 +34,7 @@ export default (props) => {
34 34
             <view className='card-box-star'>
35 35
               {
36 36
                 scoreList.map((_, index) => {
37
-                  console.log(index)
37
+
38 38
                   const src = (index + '0.1') < score ? starOn : starOff
39 39
                   return (
40 40
                     <image className='card-star-image' key={index} src={src} />
@@ -129,7 +129,7 @@ export default (props) => {
129 129
             <view className='card-box-star'>
130 130
               {
131 131
                 scoreList.map((_, index) => {
132
-                  console.log(index)
132
+
133 133
                   const src = (index + '0.1') < score ? starOn : starOff
134 134
                   return (
135 135
                     <image className='card-star-image' key={index} src={src} />

+ 9
- 6
src/components/OrderMolded/index.jsx 查看文件

@@ -1,32 +1,35 @@
1 1
 import { useState } from 'react'
2 2
 import image from '@/assets/icons/ProCard/8kb.jpg'
3 3
 import { Button, Radio } from '@tarojs/components'
4
-
4
+import PayOrderCard from '@/components/PayOrderCard'
5
+import moment from 'moment'
5 6
 import food from '@/assets/icons/ProCard/food.png'
6 7
 import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
7 8
 import './style.less'
8 9
 
9 10
 export default (props) => {
11
+  const { item } = props
10 12
 
11 13
   return (
12 14
     <view class='wrapper-box'>
13 15
       <view class='left-complete-one'>
14 16
         <image className='left-image-1' src={ProCard_hot}></image>
15 17
         <view className='left-viewText'>
16
-          返现¥16.00
18
+          返现¥{item.cashback / 100}
17 19
         </view>
18 20
         <view className='title-image'>
19
-          <image className='image-1' mode='scaleToFill' src={image}></image>
21
+          <image className='image-1' mode='scaleToFill' src={item.poster}></image>
20 22
           <image className='image-2' src={food}></image>
21 23
         </view>
22 24
         <view className='title-content'>
23 25
           <view className='Pro-title'>
24
-            <view className='title-text'>【橘里橘气咖啡店】新鲜出炉啦!</view>
26
+            <view className='title-text'>{item.description}</view>
25 27
           </view>
26
-          <text className='title-money' >¥6990元</text>
27
-          <view className='title-time' >有效期:2021/06/21-2021/12/31</view>
28
+          <text className='title-money' >¥{item.actualPrice / 100}元</text>
29
+          <view className='title-time' >有效期:<text>{moment(item.startTimeal).format('YYYY/MM/DD')}</text> - <text>{moment(item.endTime).format('YYYY/MM/DD')}</text></view>
28 30
         </view>
29 31
       </view>
30 32
     </view>
33
+    // </view >
31 34
   )
32 35
 }

+ 121
- 0
src/components/PayOrderCard/index.jsx 查看文件

@@ -0,0 +1,121 @@
1
+import withLayout from '@/layouts'
2
+import useSave from "@/utils/hooks/useSave"
3
+import image from '@/assets/icons/ProCard/8kb.jpg'
4
+import AuthPage from '@/components/AuthPage'
5
+import moment from 'moment'
6
+import { useState, useEffect } from 'react'
7
+import { Button, Radio, Input } from '@tarojs/components'
8
+import food from '@/assets/icons/ProCard/food.png'
9
+import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
10
+import OrderMolded from '@/components/OrderMolded'
11
+import Popup from '@/components/Popup'
12
+
13
+
14
+
15
+import './style.less'
16
+
17
+export default (props) => {
18
+  const { item, onShopContent, onShopNumber } = props
19
+  const [showDialog, setShowDialog] = useState(false)
20
+  const [BuyNumber, setBuyNumber] = useState(1)
21
+  const [DisabledBool, setDisabledBool] = useState(false)
22
+
23
+
24
+
25
+  const ShowMoldeOn = () => {
26
+    setShowDialog(true)
27
+  }
28
+  const ButtonCancel = () => {
29
+    setShowDialog(false)
30
+    setBuyNumber(1)
31
+  }
32
+  const ButtonOK = (e) => {
33
+    setShowDialog(false)
34
+    const itemList = [{ ...item }]
35
+    const itemListNumber = itemList.map(x => {
36
+      return { ...x, BuyNumber: BuyNumber }
37
+    })
38
+    const handeItemList = itemListNumber.map(shoPnumber => {
39
+      onShopContent(shoPnumber)
40
+    })
41
+    onShopNumber()
42
+    // console.log("🚀 ~ file: index.jsx ~ line 38 ~ ButtonOK ~ handeItemList", handeItemList)
43
+
44
+
45
+  }
46
+  const NumberAdd = () => {
47
+    setBuyNumber(BuyNumber + 1)
48
+
49
+  }
50
+
51
+  const NumberCut = () => {
52
+    setBuyNumber(BuyNumber - 1)
53
+
54
+  }
55
+
56
+  const onInput = (e) => {
57
+    let values = e.detail.value
58
+    setBuyNumber(values - 0)
59
+
60
+
61
+  }
62
+
63
+
64
+  useEffect(() => {
65
+    if (BuyNumber < 2) {
66
+      setDisabledBool(true)
67
+
68
+    } else {
69
+      setDisabledBool(false)
70
+
71
+    }
72
+
73
+  }, [BuyNumber])
74
+
75
+  return (
76
+
77
+    <view class='container'>
78
+      <Popup show={showDialog} maskClosable={false}>
79
+        <OrderMolded item={item} />
80
+        <view className='item-center-Number' >
81
+          <view className='buy-num-minus' disabled={DisabledBool} onClick={NumberCut} > - </view>
82
+          <Input className='buy-num-input' type='number' min={1} onInput={onInput} value={BuyNumber} />
83
+          <view className='buy-num-add' onClick={NumberAdd} >+</view>
84
+        </view>
85
+        <view className='buy-button-box' >
86
+          <button className='button-Cancel' onClick={ButtonCancel} >取消</button>
87
+          <button className='button-OK' onClick={ButtonOK} >确定</button>
88
+        </view>
89
+      </Popup>
90
+      <view class='coupon-list'>
91
+        <view class='wrapper'>
92
+          <view class='left-complete-one'>
93
+            <image className='left-image-1' src={ProCard_hot}></image>
94
+            <view className='left-viewText'>
95
+              返现¥{item.cashback / 100}
96
+            </view>
97
+            <view className='title-image'>
98
+              <image className='image-1' mode='scaleToFill' src={item.poster}></image>
99
+              <image className='image-2' src={food}></image>
100
+            </view>
101
+            <view className='title-content'>
102
+              <view className='Pro-title'>
103
+                <view className='title-text'>{item.description}</view>
104
+              </view>
105
+              <text className='title-money' >¥{item.actualPrice / 100}<text className='title-money-2'>{item.standardPrice / 100}</text></text>
106
+              <view className='title-time' >有效期:<text>{moment(item.startTimeal).format('YYYY/MM/DD')}</text> - <text>{moment(item.endTime).format('YYYY/MM/DD')}</text></view>
107
+            </view>
108
+          </view>
109
+          <view class='right-complete-two' onClick={ShowMoldeOn} >
110
+            <view className='right-content'>
111
+              <view className='right-number'>×{BuyNumber}</view>
112
+              <view className='right-title'>数量</view>
113
+            </view>
114
+          </view>
115
+        </view>
116
+      </view>
117
+    </view>
118
+
119
+
120
+  )
121
+}

+ 299
- 0
src/components/PayOrderCard/style.less 查看文件

@@ -0,0 +1,299 @@
1
+@whiteColor: #fff;
2
+@Image-ProCard_hot: "../../assets/icons/ProCard/ProCard_hot.png";
3
+.container {
4
+  width: 100%;
5
+  .item-center-Number {
6
+    width: 100%;
7
+    margin-top: 30px;
8
+    .buy-num-minus {
9
+      display: inline-block;
10
+      width: 60px;
11
+      height: 60px;
12
+      background: #ffffff;
13
+      border: 1px solid #999999;
14
+      border-radius: 8px 0px 0px 8px;
15
+    }
16
+    .buy-num-input {
17
+      display: inline-block;
18
+      width: 90px;
19
+      height: 60px;
20
+      font-size: 28px;
21
+      font-weight: 400;
22
+      color: #202020;
23
+      background: #ffffff;
24
+      border: 1px solid #999999;
25
+      position: relative;
26
+      top: 26px;
27
+    }
28
+    .buy-num-add {
29
+      display: inline-block;
30
+
31
+      width: 60px;
32
+      height: 60px;
33
+      background: #ffffff;
34
+      border: 1px solid #999999;
35
+      border-radius: 0px 8px 8px 0px;
36
+    }
37
+  }
38
+  .buy-button-box {
39
+    width: 100%;
40
+    margin: 40px 0 0 0;
41
+
42
+    .button-Cancel {
43
+      display: inline-block;
44
+      width: 236px;
45
+      height: 78px;
46
+      border: 2px solid #274291;
47
+      font-size: 30px;
48
+      font-weight: bold;
49
+      color: #274291;
50
+      border-radius: 12px;
51
+      margin-right: 80px;
52
+    }
53
+    .button-OK {
54
+      display: inline-block;
55
+
56
+      width: 236px;
57
+      height: 78px;
58
+      background: #274291;
59
+      border-radius: 12px;
60
+      font-size: 30px;
61
+      font-weight: bold;
62
+      color: #ffffff;
63
+    }
64
+  }
65
+  .wrapper {
66
+    display: flex;
67
+    position: relative;
68
+    // margin-top: 600px;
69
+    margin: 30px auto;
70
+    width: 700px;
71
+
72
+    // box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.12);
73
+    // filter: drop-shadow(5px 8px 6px rgb(202, 202, 202));
74
+    filter: drop-shadow(0 0 0.9rem rgba(0, 0, 0, 0.12));
75
+
76
+    .left-complete-one {
77
+      padding-top: 87px;
78
+      padding-bottom: 43px;
79
+      position: relative;
80
+      display: flex;
81
+      background: @whiteColor;
82
+      background: radial-gradient(
83
+            circle at top right,
84
+            transparent 15px,
85
+            @whiteColor 0
86
+          )
87
+          top right,
88
+        radial-gradient(circle at bottom right, transparent 15px, @whiteColor 0)
89
+          bottom right;
90
+      background-size: 100% 60%;
91
+      background-repeat: no-repeat;
92
+
93
+      width: 573px;
94
+      border-radius: 15px 0px 0px 15px;
95
+      // border-radius: 12px;
96
+
97
+      align-items: center;
98
+      .left-image-1 {
99
+        width: 145px;
100
+        height: 44px;
101
+        position: absolute;
102
+        top: 22px;
103
+      }
104
+      .left-viewText {
105
+        // background-image: url(@Image-ProCard_hot);
106
+        // width: 287px;
107
+        width: auto;
108
+        height: 44.3px;
109
+        position: absolute;
110
+        left: 1px;
111
+        top: 28px;
112
+        font-size: 24px;
113
+        color: @whiteColor;
114
+        font-weight: 600;
115
+      }
116
+      //图片
117
+      .title-image {
118
+        width: 145px;
119
+        margin-left: 20px;
120
+        border-radius: 24px;
121
+        overflow: hidden;
122
+        position: relative;
123
+        .image-1 {
124
+          width: 100%;
125
+          height: 145px;
126
+        }
127
+        .image-2 {
128
+          width: 89px;
129
+          height: 34px;
130
+          position: absolute;
131
+          left: 0;
132
+          top: 0;
133
+        }
134
+      }
135
+      // 商品标题
136
+      .title-content {
137
+        // padding: 84px 0 56px 20px;
138
+        padding-left: 18px;
139
+
140
+        .Pro-title {
141
+          .title-text {
142
+            width: 375px;
143
+            overflow: hidden;
144
+            text-overflow: ellipsis;
145
+            display: -webkit-box; //必须要
146
+            -webkit-line-clamp: 1;
147
+            -webkit-box-orient: vertical;
148
+            word-break: break-all; /* 多出文本省略号代替 */
149
+            text-align: left;
150
+            font-size: 24px;
151
+            padding-bottom: 10px;
152
+          }
153
+        }
154
+        .title-money {
155
+          padding-top: 34px;
156
+          font-size: 24px;
157
+          // color: red;
158
+          font-weight: 800;
159
+        }
160
+        .title-money-2 {
161
+          font-size: 18px;
162
+          color: #666;
163
+          padding-left: 10px;
164
+          text-decoration: line-through;
165
+        }
166
+
167
+        .title-time {
168
+          font-size: 24px;
169
+          padding-top: 20px;
170
+          color: #c0c8d3;
171
+        }
172
+      }
173
+    }
174
+  }
175
+
176
+  .right-complete-two {
177
+    background: @whiteColor;
178
+    background: radial-gradient(
179
+          circle at top left,
180
+          transparent 15px,
181
+          @whiteColor 0
182
+        )
183
+        top left,
184
+      radial-gradient(circle at bottom left, transparent 15px, @whiteColor 0)
185
+        bottom left;
186
+    background-size: 100% 60%;
187
+    background-repeat: no-repeat;
188
+    width: 129px;
189
+    border-radius: 0 15px 15px 0;
190
+    position: relative;
191
+    //右面部分
192
+    .right-content {
193
+      // width: 100px;
194
+      // height: 80px;
195
+      position: absolute;
196
+      top: 50%;
197
+      left: 50%;
198
+      transform: translate(-50%, -50%);
199
+      // border: 1px solid red;
200
+
201
+      .right-number {
202
+        width: 40px;
203
+        font-size: 20px;
204
+        border-radius: 4px;
205
+        border: 2px solid #999;
206
+        margin: auto;
207
+        text-align: center;
208
+      }
209
+
210
+      .right-title {
211
+        font-weight: 700;
212
+        font-size: 24px;
213
+        padding-top: 20px;
214
+        text-align: center;
215
+      }
216
+    }
217
+  }
218
+  //线条
219
+  .right-complete-two::after {
220
+    content: "";
221
+    position: absolute;
222
+    top: 15px;
223
+    margin: 26px auto;
224
+    height: 70%;
225
+    border-left: 1px dashed #595959;
226
+  }
227
+
228
+  .view-button {
229
+
230
+    position: fixed;
231
+    bottom: 0px;
232
+
233
+    .Card-number-box {
234
+      .Card-number {
235
+        width: 100%;
236
+        height: 96px;
237
+        background-color: @whiteColor;
238
+      }
239
+      .Card-user {
240
+        width: 100%;
241
+        height: 96px;
242
+        background-color: @whiteColor;
243
+      }
244
+    }
245
+    .button-box-button-box {
246
+      position: relative;
247
+      .button-text-image {
248
+        width: 144;
249
+        height: 45px;
250
+        position: absolute;
251
+        top: -35px;
252
+        left: 267px;
253
+        right: 305px;
254
+        z-index: 1;
255
+        .button-text-money-hot {
256
+          position: absolute;
257
+          width: 144px;
258
+          height: 43px;
259
+          line-height: 43px;
260
+          font-size: 24px;
261
+          font-weight: bold;
262
+          color: @whiteColor;
263
+        }
264
+        .button-image {
265
+          width: 143px;
266
+          height: 43px;
267
+        }
268
+        .button-text-money {
269
+          position: absolute;
270
+          margin-top: -8;
271
+          width: 157px;
272
+          font-size: 18px;
273
+          font-weight: 400;
274
+          text-decoration: line-through;
275
+          color: @whiteColor;
276
+        }
277
+      }
278
+      .button-box-one {
279
+        font-size: 30px;
280
+        line-height: 92px;
281
+        margin-top: 3em;
282
+        background-color: #274190;
283
+        border-radius: 12px;
284
+        width: 690px;
285
+        height: 92px;
286
+        color: @whiteColor;
287
+        // position: absolute;
288
+        bottom: 40px;
289
+        right: 0;
290
+        left: 0;
291
+        .button-text-one {
292
+          right: 133px;
293
+          font-size: 30px;
294
+          padding-left: 220px;
295
+        }
296
+      }
297
+    }
298
+  }
299
+}

+ 52
- 45
src/components/foodCards/foodCards.jsx 查看文件

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

+ 2
- 2
src/pages/MineUserAll/Collect/index.jsx 查看文件

@@ -49,7 +49,7 @@ export default withLayout((props) => {
49 49
           <view className='card-box-star'>
50 50
             {
51 51
               scoreList.map((_, index) => {
52
-                console.log(index)
52
+
53 53
                 const src = (index + '0.1') < score ? starOn : starOff
54 54
                 return (
55 55
                   <image className='card-star-image' key={index} src={src} />
@@ -92,7 +92,7 @@ export default withLayout((props) => {
92 92
           <view className='card-box-star'>
93 93
             {
94 94
               scoreList.map((_, index) => {
95
-                console.log(index)
95
+
96 96
                 const src = (index + '0.1') < score ? starOn : starOff
97 97
                 return (
98 98
                   <image className='card-star-image' key={index} src={src} />

+ 2
- 2
src/pages/MineUserAll/RefundMoney/index.jsx 查看文件

@@ -40,7 +40,7 @@ export default withLayout((props) => {
40 40
           <view className='card-box-star'>
41 41
             {
42 42
               scoreList.map((_, index) => {
43
-                console.log(index)
43
+
44 44
                 const src = (index + '0.1') < score ? starOn : starOff
45 45
                 return (
46 46
                   <image className='card-star-image' key={index} src={src} />
@@ -80,7 +80,7 @@ export default withLayout((props) => {
80 80
           <view className='card-box-star'>
81 81
             {
82 82
               scoreList.map((_, index) => {
83
-                console.log(index)
83
+
84 84
                 const src = (index + '0.1') < score ? starOn : starOff
85 85
                 return (
86 86
                   <image className='card-star-image' key={index} src={src} />

+ 94
- 130
src/pages/PayOrder/index.jsx 查看文件

@@ -1,178 +1,140 @@
1 1
 import withLayout from '@/layouts'
2 2
 import image from '@/assets/icons/ProCard/8kb.jpg'
3
-import { useState, useEffect } from 'react'
3
+import AuthPage from '@/components/AuthPage'
4
+import Taro from '@tarojs/taro'
5
+import { useState, useEffect, useRef } from 'react'
4 6
 import { Button, Radio, Input } from '@tarojs/components'
5
-
6 7
 import food from '@/assets/icons/ProCard/food.png'
7 8
 import ProCard_hot from '@/assets/icons/ProCard/ProCard_hot.png'
8 9
 import CustomNav from '@/components/CustomNav'
9
-import OrderMolded from '@/components/OrderMolded'
10
-import Popup from '@/components/Popup'
11
-
10
+import PayOrderCard from '@/components/PayOrderCard'
11
+import { PaysOrder, getMineOrder } from '@/services/payOrder' //创建订单
12
+import { getShopPackage, } from '@/services/home'
12 13
 import './style.less'
13 14
 
14 15
 export default withLayout((props) => {
15 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)
16 23
 
17
-  const [showDialog, setShowDialog] = useState(false)
18
-
19
-  const [BuyNumber, setBuyNumber] = useState(1)
20
-  const [DisabledBool, setDisabledBool] = useState(false)
24
+  console.log('----------shopId-------', props, shopId, id);
21 25
 
22
-  const ShowMoldeOn = () => {
23
-    setShowDialog(true)
26
+  const handelButton = () => {
27
+    setButtonDisabled(false)
24 28
   }
25
-  const ButtonCancel = () => {
26
-    setShowDialog(false)
29
+
30
+  const goRules = () => {
31
+    Taro.navigateTo({ url: `/pages/MineUserAll/Rules/index` })
32
+
27 33
   }
28
-  const ButtonOK = (e) => {
29
-    setShowDialog(false)
30 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
+    })
31 49
   }
32 50
 
33 51
 
34 52
 
35
-  const NumberAdd = () => {
36
-    setBuyNumber(BuyNumber + 1)
37
-    console.log(BuyNumber);
38 53
 
39
-  }
54
+  useEffect(() => {
40 55
 
41
-  const NumberCut = () => {
42
-    setBuyNumber(BuyNumber - 1)
43
-    console.log(BuyNumber);
44 56
 
45
-  }
57
+    getShopPackage(shopId, { packageId: packageId }).then((res) => {
58
+      const itemShop = res.records
59
+      setShopPackage(itemShop)
60
+    })
46 61
 
47
-  const onInput = (e) => {
48
-    let values = e.detail.value
49
-    setBuyNumber(values - 0)
50 62
 
63
+  }, [])
51 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
75
+      }
76
+    })
77
+
78
+    setShopPackage(lst)
52 79
   }
53 80
 
54
-  useEffect(() => {
55
-    if (BuyNumber < 2) {
56
-      setDisabledBool(true)
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
+        }
57 102
 
58
-    } else {
59
-      setDisabledBool(false)
103
+      })
104
+
105
+    }).catch(err => {
106
+      console.log("🚀 ~ -------------支付错误------------", err)
107
+
108
+    });
109
+  }
60 110
 
61
-    }
62
-  }, [BuyNumber])
63 111
 
64
-  return (
112
+
113
+  return !person.phone ? <AuthPage /> : (
65 114
 
66 115
     <view class='container'>
67 116
       <CustomNav title='订单' />
68
-      <Popup show={showDialog} maskClosable={false}>
69
-        <OrderMolded />
70
-        <view className='item-center-Number' >
71
-          <view className='buy-num-minus' disabled={DisabledBool} onClick={NumberCut} >-</view>
72
-          <Input className='buy-num-input' type="number" min="1" onInput={onInput} value={BuyNumber} />
73
-          <view className='buy-num-add' onClick={NumberAdd} >+</view>
74
-        </view>
75
-        <view className='buy-button-box' >
76
-          <button className='button-Cancel' onClick={ButtonCancel} >取消</button>
77
-          <button className='button-OK' onClick={ButtonOK} >确定</button>
78
-        </view>
79
-      </Popup>
80
-      <view class='coupon-list'>
81
-        <view class='wrapper'>
82
-          <view class='left-complete-one'>
83
-            <image className='left-image-1' src={ProCard_hot}></image>
84
-            <view className='left-viewText'>
85
-              返现¥16.00
86
-            </view>
87
-            <view className='title-image'>
88
-              <image className='image-1' mode='scaleToFill' src={image}></image>
89
-              <image className='image-2' src={food}></image>
90
-            </view>
91
-            <view className='title-content'>
92
-              <view className='Pro-title'>
93
-                <view className='title-text'>【橘里橘气咖啡店】新鲜出炉啦!</view>
94
-              </view>
95
-              <text className='title-money' >¥6990元<text className='title-money-2'>门市价78元</text></text>
96
-              <view className='title-time' >有效期:2021/06/21-2021/12/31</view>
97
-            </view>
98
-          </view>
99
-          <view class='right-complete-two' onClick={ShowMoldeOn} >
100
-            <view className='right-content'>
101
-              <view className='right-number'>×{BuyNumber}</view>
102
-              <view className='right-title'>数量</view>
103
-            </view>
104
-          </view>
105
-        </view>
106
-        <view class='wrapper'>
107
-          <view class='left-complete-one'>
108
-            <image className='left-image-1' src={ProCard_hot}></image>
109
-            <view className='left-viewText'>
110
-              返现¥16.00
111
-            </view>
112
-            <view className='title-image'>
113
-              <image className='image-1' mode='scaleToFill' src={image}></image>
114
-              <image className='image-2' src={food}></image>
115
-            </view>
116
-            <view className='title-content'>
117
-              <view className='Pro-title'>
118
-                <view className='title-text'>【橘里橘气咖啡店】新鲜出炉啦!</view>
119
-              </view>
120
-              <text className='title-money' >¥6990元<text className='title-money-2'>门市价78元</text></text>
121
-              <view className='title-time' >有效期:2021/06/21-2021/12/31</view>
122
-            </view>
123
-          </view>
124
-          <view class='right-complete-two'>
125
-            <view className='right-content'>
126
-              <view className='right-number'>×1</view>
127
-              <view className='right-title'>数量</view>
128
-            </view>
129
-          </view>
130
-        </view>
117
+      {
118
+        shopPackage?.map((item, index) => <PayOrderCard onShopContent={shopContent} onShopNumber={handeList} key={(index)} item={item} />)
119
+      }
131 120
 
132
-        <view class='wrapper'>
133
-          <view class='left-complete-one'>
134
-            <image className='left-image-1' src={ProCard_hot}></image>
135
-            <view className='left-viewText'>
136
-              返现¥16.00
137
-            </view>
138
-            <view className='title-image'>
139
-              <image className='image-1' mode='scaleToFill' src={image}></image>
140
-              <image className='image-2' src={food}></image>
141
-            </view>
142
-            <view className='title-content'>
143
-              <view className='Pro-title'>
144
-                <view className='title-text'>【橘里橘气咖啡店】新鲜出炉啦!</view>
145
-              </view>
146
-              <text className='title-money' >¥6990元<text className='title-money-2'>门市价78元</text></text>
147
-              <view className='title-time' >有效期:2021/06/21-2021/12/31</view>
148
-            </view>
149
-          </view>
150
-          <view class='right-complete-two'>
151
-            <view className='right-content'>
152
-              <view className='right-number'>×1</view>
153
-              <view className='right-title'>数量</view>
154
-            </view>
155
-          </view>
156
-        </view>
157
-
158
-      </view>
159 121
       <view className='view-button'>
160 122
         <view className='Card-number-box'>
161 123
           <view className='Card-number'>
162 124
             <text style='left:29px;position: absolute; padding-top:20px'>手机号码:</text>
163
-            <text style='right:29px;position: absolute;padding-top:20px'>16161312125</text>
125
+            <text style='right:29px;position: absolute;padding-top:20px'>{person.phone}</text>
164 126
           </view>
165 127
           <view className='Card-user'>
166
-            <Radio style='padding-left:20px; position: relative; top:24px;' value='我已阅读知晓并同意' >我已阅读知晓并同意 <text style='color:#274190;text-decoration:underline;font-weight:400'>《平台用户服务协议》</text></Radio>
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>
167 129
           </view>
168 130
         </view>
169 131
         <view className='button-box-button-box'>
170 132
           <view className='button-text-image' >
171
-            <text className='button-text-money-hot'>返现¥2.18</text>
172
-            <image className='button-image' src={ProCard_hot}>123123</image>
173
-            <view className='button-text-money'>门店市面价:230元</view>
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>
174 136
           </view>
175
-          <Button className='button-box-one'>¥170元 <text className='button-text-one'>支付订单</text> </Button>
137
+          <Button onClick={submit} disabled={buttonDisabled} className='button-box-one'>¥{totalCost}元 <text className='button-text-one'>支付订单</text> </Button>
176 138
         </view>
177 139
 
178 140
       </view>
@@ -180,4 +142,6 @@ export default withLayout((props) => {
180 142
 
181 143
 
182 144
   )
145
+
183 146
 })
147
+

+ 4
- 4
src/pages/PayOrder/style.less 查看文件

@@ -23,7 +23,7 @@
23 23
       background: #ffffff;
24 24
       border: 1px solid #999999;
25 25
       position: relative;
26
-      top: 30px;
26
+      top: 26px;
27 27
     }
28 28
     .buy-num-add {
29 29
       display: inline-block;
@@ -226,9 +226,9 @@
226 226
   }
227 227
 
228 228
   .view-button {
229
-    // width: 100%;
230
-    // height: 150px;
231
-    position: relative;
229
+
230
+    position: fixed;
231
+    bottom: 0px;
232 232
 
233 233
     .Card-number-box {
234 234
       .Card-number {

+ 73
- 73
src/pages/details/foodDetails/foodDetails.jsx 查看文件

@@ -1,7 +1,7 @@
1 1
 import CustomNav from '@/components/CustomNav'
2 2
 import withLayout from '@/layouts'
3
-import {getShopDetail,getShopPackage,getExtendContent} from '@/services/home'
4
-import { useState,useEffect } from 'react'
3
+import { getShopDetail, getShopPackage, getExtendContent } from '@/services/home'
4
+import { useState, useEffect } 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'
@@ -24,93 +24,93 @@ import { useRef } from 'react';
24 24
 
25 25
 export default withLayout((props) => {
26 26
   const { router, person } = props
27
-  const {id}=props.router.params
27
+  const { id } = props.router.params
28 28
   //商铺基础信息
29
-  const [detail,setDetail]=useState({})
29
+  const [detail, setDetail] = useState({})
30 30
   //商铺套餐
31
-  const [spackage,setPackage]=useState([])
31
+  const [spackage, setPackage] = useState([])
32 32
   //banner图集数组
33
-  const [imglist,setimglist]=useState([])
33
+  const [imglist, setimglist] = useState([])
34 34
   const [index, setIndex] = useState(0)
35 35
   const handchange = (e) => {
36 36
     setIndex(e.detail.current)
37 37
   }
38
-  
38
+
39 39
   const [isSaved, toggleSave] = useSave(detail.isSaved, 'shop', id)
40 40
   const [isLike, toggleLike] = useLike(detail.isLike, 'shop', id)
41 41
 
42 42
   //当前套餐总数
43
-  const [newpgNum,setNewpgNum]=useState(0)
43
+  const [newpgNum, setNewpgNum] = useState(0)
44 44
   //全部套餐个数
45
-  const [AllpgNum,setAllpgNum]=useState(0)
45
+  const [AllpgNum, setAllpgNum] = useState(0)
46 46
   //套餐当前页数
47
-  const [page,setpage]=useState(2)
48
-  const pgMore=()=>{
49
-    setpage(page+1)
50
-    getShopPackage(id,{pageNum:page}).then((res)=>{
51
-      setPackage([...spackage,...res.records])
52
-      setNewpgNum(newpgNum+res.records.length)
47
+  const [page, setpage] = useState(2)
48
+  const pgMore = () => {
49
+    setpage(page + 1)
50
+    getShopPackage(id, { pageNum: page }).then((res) => {
51
+      setPackage([...spackage, ...res.records])
52
+      setNewpgNum(newpgNum + res.records.length)
53 53
     })
54 54
   }
55 55
   //本店指南
56
-  const [extend,setExtend]=useState([])
56
+  const [extend, setExtend] = useState([])
57 57
 
58 58
   //当前指南总数
59
-  const [newextNum,setNewextNum]=useState(0)
59
+  const [newextNum, setNewextNum] = useState(0)
60 60
   //全部指南个数
61
-  const [AllextNum,setAllextNum]=useState(0)
61
+  const [AllextNum, setAllextNum] = useState(0)
62 62
   //指南当前页数
63
-  const [epage,setepage]=useState(2)
64
-  const extendMore=()=>{
65
-    setepage(epage+1)
66
-    getExtendContent('shop',id,{pageNum:epage}).then((res)=>{
67
-      setExtend([...extend,...res.records])
68
-      setNewextNum(newextNum+res.records.length)
63
+  const [epage, setepage] = useState(2)
64
+  const extendMore = () => {
65
+    setepage(epage + 1)
66
+    getExtendContent('shop', id, { pageNum: epage }).then((res) => {
67
+      setExtend([...extend, ...res.records])
68
+      setNewextNum(newextNum + res.records.length)
69 69
     })
70 70
   }
71
-  const toShare=()=>{
71
+  const toShare = () => {
72 72
     console.log(222222222222)
73 73
     onShareAppMessage()
74 74
   }
75
-  const openMap=()=>{
76
-     Taro.openLocation({
77
-              longitude: log.current - 0,
78
-              latitude: lat.current - 0,
79
-              name: detail.shopName,
80
-              address:detail.address,
81
-              scale: 12,
82
-            })
75
+  const openMap = () => {
76
+    Taro.openLocation({
77
+      longitude: log.current - 0,
78
+      latitude: lat.current - 0,
79
+      name: detail.shopName,
80
+      address: detail.address,
81
+      scale: 12,
82
+    })
83 83
   }
84
-  const log=useRef('')
85
-  const lat=useRef('')
84
+  const log = useRef('')
85
+  const lat = useRef('')
86 86
 
87
-  useEffect(()=>{
88
-    getShopDetail(id).then((res)=>{
87
+  useEffect(() => {
88
+    getShopDetail(id).then((res) => {
89 89
       setDetail(res)
90
-      log.current=(res.locaton).toString().split(',')[0]
91
-      lat.current=(res.locaton).toString().split(',')[1]
92
-      setimglist(res.imageList||[])
90
+      log.current = (res.locaton).toString().split(',')[0]
91
+      lat.current = (res.locaton).toString().split(',')[1]
92
+      setimglist(res.imageList || [])
93 93
     })
94
-    getShopPackage(id).then((res)=>{
95
-      setPackage(res.records||[])
94
+    getShopPackage(id).then((res) => {
95
+      setPackage(res.records || [])
96 96
       setNewpgNum(res.records.length)
97 97
       setAllpgNum(res.total)
98 98
     })
99
-    getExtendContent('shop',id).then((res)=>{
100
-      setExtend(res.records||[])
99
+    getExtendContent('shop', id).then((res) => {
100
+      setExtend(res.records || [])
101 101
       setAllextNum(res.total)
102 102
       setNewextNum(res.records.length)
103 103
     })
104
-  },[])
105
-  const star=parseFloat(((detail.sweetScore+detail.environmentScore+detail.serviceScore)/3).toFixed(1)); 
106
-return (
104
+  }, [])
105
+  const star = parseFloat(((detail.sweetScore + detail.environmentScore + detail.serviceScore) / 3).toFixed(1));
106
+  return (
107 107
     <view className='page-index'>
108 108
       <view className='index-navbar'>
109 109
         <CustomNav title='十公里' />
110 110
       </view>
111
-      <view style={{overflow: 'auto', padding: '0 30rpx', background: '#F8F8F8' }}>
112
-        <scroll-view scroll-y="true" scroll-view='true' bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll">
113
-          <view className='storeDetails'>           
111
+      <view style={{ overflow: 'auto', padding: '0 30rpx', background: '#F8F8F8' }}>
112
+        <scroll-view scroll-y='true' scroll-view='true' bindscrolltoupper='upper' bindscrolltolower='lower' bindscroll='scroll'>
113
+          <view className='storeDetails'>
114 114
             <Swiper
115 115
               className='.swiper'
116 116
               circular
@@ -122,27 +122,27 @@ return (
122 122
                   <SwiperItem>
123 123
                     <image src={item.url} className='storeImage' >
124 124
                       <view className='tpPage'>
125
-                      <text>{index + 1}/{imglist.length}</text>
125
+                        <text>{index + 1}/{imglist.length}</text>
126 126
                       </view>
127 127
                     </image>
128 128
                   </SwiperItem>
129 129
                 )
130 130
               }
131
-            </Swiper>                        
131
+            </Swiper>
132 132
             <view className='storeJs'>
133 133
               <view style={{ overflow: 'hidden' }}>
134
-                  <view className='storeName'>{detail.shopName}</view>
135
-                  <view className='sprice'>
136
-                    <text className='t1'>¥</text>
137
-                    {detail.averagePrice/100}/人                
138
-                    <view className='bzRight'>
139
-                      <image src={ax} style={{ width: '15px', height: '15px', marginRight: '11rpx', marginBottom: '-2px' }} />
134
+                <view className='storeName'>{detail.shopName}</view>
135
+                <view className='sprice'>
136
+                  <text className='t1'>¥</text>
137
+                  {detail.averagePrice / 100}/人
138
+                  <view className='bzRight'>
139
+                    <image src={ax} style={{ width: '15px', height: '15px', marginRight: '11rpx', marginBottom: '-2px' }} />
140 140
                     爆赞{detail.likeNum}</view>
141
-                  </view>
141
+                </view>
142 142
               </view>
143 143
               <view className='appraise'>
144
-                <Star star={star}/>{star}
145
-                <view style={{float:'right',marginTop:'5px'}}>
144
+                <Star star={star} />{star}
145
+                <view style={{ float: 'right', marginTop: '5px' }}>
146 146
                   <text className='comment'>点评:</text>
147 147
                   <text className='t1'>口味:{detail.sweetScore}</text>
148 148
                   <text className='t1'>环境:{detail.environmentScore}</text>
@@ -152,36 +152,36 @@ return (
152 152
               <view className='yysj'>
153 153
                 <image src={yysj} className='yysjImg' />营业时间:{detail.businessHours}
154 154
               </view>
155
-              <view className='dpPosition' onClick={openMap}> 
155
+              <view className='dpPosition' onClick={openMap}>
156 156
                 <image src={dw} className='dwTip' />
157 157
                 <view>
158
-                  {detail.address}<image src={zhuandao} className='zhuandao'/>
158
+                  {detail.address}<image src={zhuandao} className='zhuandao' />
159 159
                 </view>
160 160
               </view>
161 161
             </view>
162 162
           </view>
163
-          <view style={{ position: 'relative',display:spackage==''?'none':''}}>
163
+          <view style={{ position: 'relative', display: spackage == '' ? 'none' : '' }}>
164 164
             <view className='title'>
165
-              <image src={titlezs}/><text>返现套餐</text>
166
-            </view>            
167
-            {spackage?.map((item)=><Cards star={star} item={item}/>)}            
168
-            <view className='showMore' style={{display:newpgNum==AllpgNum?'none':''}} onClick={pgMore}>
165
+              <image src={titlezs} /><text>返现套餐</text>
166
+            </view>
167
+            {spackage?.map((item) => <Cards star={star} item={item} />)}
168
+            <view className='showMore' style={{ display: newpgNum == AllpgNum ? 'none' : '' }} onClick={pgMore}>
169 169
               <view>查看更多</view>
170 170
               <image src={showMore} className='moreTip' />
171 171
             </view>
172 172
           </view>
173
-          <view style={{ position: 'relative',display:extend==''?'none':'' }}>
173
+          <view style={{ position: 'relative', display: extend == '' ? 'none' : '' }}>
174 174
             <view className='title'>
175
-              <image src={titlezs}/>
175
+              <image src={titlezs} />
176 176
               <text>本店指南</text>
177 177
             </view>
178
-            {extend?.map((item)=><Extend item={item} />)}
179
-            <view className='showMore' style={{display:newextNum==AllextNum?'none':''}} onClick={extendMore}>
178
+            {extend?.map((item) => <Extend item={item} />)}
179
+            <view className='showMore' style={{ display: newextNum == AllextNum ? 'none' : '' }} onClick={extendMore}>
180 180
               <view>查看更多</view>
181 181
               <image src={showMore} className='moreTip' />
182 182
             </view>
183 183
           </view>
184
-           <view className='botton' style={{display:newextNum==AllextNum?'':'none'}}>已经到底了~</view>
184
+          <view className='botton' style={{ display: newextNum == AllextNum ? '' : 'none' }}>已经到底了~</view>
185 185
         </scroll-view>
186 186
       </view>
187 187
       <view className='bottomTab'>

+ 16
- 6
src/pages/index/tabs/Mine.jsx 查看文件

@@ -1,5 +1,5 @@
1 1
 
2
-import { useState } from 'react'
2
+import { useState, useEffect } from 'react'
3 3
 import Taro from '@tarojs/taro'
4 4
 import { Slot } from '@tarojs/components'
5 5
 import AuthPage from '@/components/AuthPage'
@@ -16,6 +16,8 @@ import Rules from '@/assets/icons/UserCenter/Rules.png'
16 16
 import DefaultImage from '@/assets/icons/UserCenter/DefaultImage.png'
17 17
 import cutoverUser from '@/assets/icons/UserCenter/cutoverUser.png'
18 18
 import SwitchSelect from '@/components/SwitchSelect'
19
+import { PaysOrder, getMineOrder } from '@/services/payOrder' //创建订单
20
+
19 21
 import { useModel } from '@/store'
20 22
 import './MineCss/style.less'
21 23
 import  ToggleRoul  from  '@/components/toggleRoul/ToggleRoul'
@@ -30,8 +32,9 @@ export default (props) => {
30 32
   const { getAvatar } = useModel('person')
31 33
   const [showCutover, setShowCutover] = useState(false)
32 34
   const hasAvatar = !!person.avatar
33
-  // const hidePhone = person.phone.replace(/^(\d{3})\d{4}(\d+)/, "$1****$2")
34
-  // console.log("🚀 ~ file: Mine.jsx ~ line 31 ~ hidePhone", hidePhone)
35
+  const [orderNum, setOrderNum] = useState([])
36
+  console.log("🚀 ~ file: Mine.jsx ~ line 34 ~ orderNum", orderNum)
37
+
35 38
 
36 39
   const ShowMoldeOn = () => {
37 40
     setShowCutover(true)
@@ -40,6 +43,13 @@ export default (props) => {
40 43
     setShowCutover(false)
41 44
   }
42 45
 
46
+  useEffect(() => {
47
+    getMineOrder().then(res => setOrderNum(res))
48
+
49
+  }, [])
50
+
51
+
52
+
43 53
   // 通过getUserProfile获取微信用户信息
44 54
   const handleGetUserProfile = () => {
45 55
     if (hasAvatar) return;
@@ -128,12 +138,12 @@ export default (props) => {
128 138
             <view className='buy-list-Paybox' onClick={handleTobePaid} >
129 139
               <image className='buy-list-PayLogo' src={awaitPay} />
130 140
               <view className='buy-list-goPay'>待支付</view>
131
-              <view className='buy-list-OrderNumber'>2笔订单</view>
141
+              <view className='buy-list-OrderNumber'>{orderNum?.unPayNum}笔订单</view>
132 142
             </view>
133 143
             <view className='buy-list-Paybox ' onClick={handleTobeWritten} >
134 144
               <image className='buy-list-PayLogo' src={ToShop} />
135 145
               <view className='buy-list-goPay'>待核销</view>
136
-              <view className='buy-list-OrderNumber'>1个订单</view>
146
+              <view className='buy-list-OrderNumber'>{orderNum?.unVerifiedNum}个订单</view>
137 147
             </view>
138 148
             <view className='buy-list-Paybox ' onClick={handleAllOrder} >
139 149
               <image className='buy-list-PayLogo' src={AllOrder} />
@@ -143,7 +153,7 @@ export default (props) => {
143 153
             <view className='buy-list-Paybox ' onClick={handleRefund} >
144 154
               <image className='buy-list-PayLogo' src={Refund} />
145 155
               <view className='buy-list-goPay'>退款/售后</view>
146
-              <view className='buy-list-OrderNumber'>2笔订单</view>
156
+              <view className='buy-list-OrderNumber'>{orderNum?.refundNum}笔订单</view>
147 157
             </view>
148 158
           </view>
149 159
           <view className='Badge-box'>

+ 9
- 0
src/services/payOrder.js 查看文件

@@ -1,4 +1,13 @@
1 1
 //支付订单模块
2 2
 import request from '@/utils/request'
3 3
 //套餐订单列表用哪个接口
4
+
5
+export const getMineOrder = () => request('/orderSub/summary/mine',)
6
+
7
+
8
+
9
+export const PaysOrder = (data) => request('/order', { data, method: 'post' })
10
+
11
+
12
+
4 13
 //订单详情,订单修改数量