Kaynağa Gözat

完善提现认证、提现记录、提现逻辑

黎海 3 hafta önce
ebeveyn
işleme
8e6d528d9f

+ 7 - 7
src/pages/member/index.jsx

@@ -18,7 +18,7 @@ export default class Index extends Component {
18 18
       users: { name: "去登录", icon: avatar },
19 19
       earnings: { store_earnings_now: 0, store_earnings_all: 0 },
20 20
       draw_money: { store_earnings_now: 0 },
21
-      partner: { partner_direct_cnt: 0},
21
+      partner: { partner_direct_cnt: 0 },
22 22
       order: { order_all: 0, order_promotion: 0, order_pay: 0, unissued_order_cnt: 0, on_arrival_order_cnt: 0, dead_order_cnt: 0 },
23 23
     }, //会员信息
24 24
   };
@@ -37,7 +37,7 @@ export default class Index extends Component {
37 37
       });
38 38
     }
39 39
   };
40
-  componentDidShow() {
40
+  componentDidShow () {
41 41
     if (Taro.getStorageSync("session_key")) {
42 42
       this.getVipInfo(); //获取会员首页数据
43 43
     }
@@ -46,7 +46,7 @@ export default class Index extends Component {
46 46
   handleOrderClick = (type) => {
47 47
     Taro.navigateTo({ url: `/pages/memberSub/earningsOrder/index?type=${type}` });
48 48
   }
49
-  render() {
49
+  render () {
50 50
     const { vipInfo } = this.state;
51 51
     return (
52 52
       <View className="member">
@@ -120,12 +120,12 @@ export default class Index extends Component {
120 120
                   ¥{vipInfo.draw_money.store_earnings_now}
121 121
                 </Text>
122 122
 
123
-                {/* <View className="warning-icon-box">
123
+                <View className="warning-icon-box">
124 124
                   <Image className="warning-icon" src={warning} />
125 125
                   <Text className="warning-text">未完成提现认证</Text>
126
-                </View> */}
126
+                </View>
127 127
               </View>
128
-              {/* <View onClick={() => Taro.navigateTo({ url: `/pages/memberSub/cashOut/index` })} className="right">点击提现</View> */}
128
+              <View onClick={() => Taro.navigateTo({ url: `/pages/memberSub/cashOut/index` })} className="right">点击提现</View> 
129 129
             </View>
130 130
           </View>
131 131
           {/* 我的伙伴 */}
@@ -176,7 +176,7 @@ export default class Index extends Component {
176 176
               <View className="order-item" onClick={() => this.handleOrderClick(2)}>
177 177
                 <Text className="label">已付款订单</Text>
178 178
                 <Text className="amount">{vipInfo.order.unissued_order_cnt}</Text>
179
-              </View>            
179
+              </View>
180 180
               <View className="order-item" onClick={() => this.handleOrderClick(2)}>
181 181
                 <Text className="label">已收货订单</Text>
182 182
                 <Text className="amount">{vipInfo.order.on_arrival_order_cnt}</Text>

+ 1 - 1
src/pages/memberSub/Alipay/index.config.js

@@ -1,3 +1,3 @@
1 1
 export default definePageConfig({
2
-  navigationBarTitleText: '支付宝'
2
+  navigationBarTitleText: '提现认证'
3 3
 })

+ 278 - 37
src/pages/memberSub/Alipay/index.jsx

@@ -3,6 +3,10 @@ import { View, Text, Image } from "@tarojs/components";
3 3
 import { AtInput } from "taro-ui";
4 4
 import "./index.less";
5 5
 import aliPayIcon from "../../../images/aliPayIcon.png";
6
+import { get_my_worker_info, worker_register, card_ocr } from "../../../service/money_api";
7
+import Taro from '@tarojs/taro';
8
+
9
+
6 10
 export default class Index extends Component {
7 11
   state = {
8 12
     name: "", // 账户姓名
@@ -10,51 +14,247 @@ export default class Index extends Component {
10 14
     phone: "", // 手机号
11 15
     idCard: "", // 身份证号
12 16
     bankCard: "", // 银行卡号
17
+    idCardFront: "https://video-img.fyshark.com/1735011631991upload-background-front.11d37038.png", // 身份证正面
18
+    idCardBack: "https://video-img.fyshark.com/1735011647149upload-background-back.5b42ae0e.png", // 身份证反面
19
+    type: "alipay", // 类型
20
+    phoneError: false, // 手机号格式错误标志
21
+    isLoading: false, // 是否加载中
22
+    isAlipay: false, // 是否已绑定支付宝
23
+    isBank: false, // 是否已绑定银行卡
24
+    signImg: "https://video-img.fyshark.com/1735033624483%E5%B7%B2%E7%AD%BE%E7%BA%A6.png", // 签约码
13 25
   };
26
+
27
+  componentDidMount () {
28
+    this.getWorkerInfo(); // 页面加载时请求签约信息
29
+  }
30
+
31
+  // 获取签约信息
32
+  getWorkerInfo = async () => {
33
+    const res = await get_my_worker_info();
34
+    if (res.length > 0) {
35
+      res.forEach(item => {
36
+        if (item.rsv_account_type === 1) {
37
+          this.setState({
38
+            name: item.name,
39
+            idCard: item.card_no,
40
+            phone: item.phone,
41
+            idCardFront: item.portrait_page,
42
+            idCardBack: item.national_emblem_page,
43
+            account: item.bank_no,
44
+            isAlipay: true
45
+          });
46
+        } else {
47
+          this.setState({
48
+            name: item.name,
49
+            idCard: item.card_no,
50
+            phone: item.phone,
51
+            idCardFront: item.portrait_page,
52
+            idCardBack: item.national_emblem_page,
53
+            bankCard: item.bank_no,
54
+            isBank: true
55
+          });
56
+        }
57
+      });
58
+    }
59
+    console.log(res, 'res');
60
+  }
14 61
   // 账户姓名
15
-  handleChangeName(value) {
62
+  handleChangeName (value) {
16 63
     this.setState({ name: value });
17 64
   }
18 65
   // 支付宝账户
19
-  handleChangeAccount(value) {
66
+  handleChangeAccount (value) {
20 67
     this.setState({ account: value });
21 68
   }
22 69
   // 手机号
23
-  handleChangePhone(value) {
70
+  handleChangePhone (value) {
24 71
     this.setState({ phone: value });
25 72
   }
26 73
   // 身份证号
27
-  handleChangeIdCard(value) {
74
+  handleChangeIdCard (value) {
28 75
     this.setState({ idCard: value });
29 76
   }
30 77
   // 银行卡号
31
-  handleChangeBankCard(value) {
78
+  handleChangeBankCard (value) {
32 79
     this.setState({ bankCard: value });
33 80
   }
34
-  render() {
81
+
82
+
83
+
84
+  handleChooseImage (type) {
85
+    if (this.isBind()) return;
86
+    Taro.chooseImage({
87
+      count: 1, // 选择一张图片
88
+      sizeType: ['compressed'], // 可以指定是原图还是压缩图
89
+      sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机
90
+      success: (res) => {
91
+        const filePath = res.tempFilePaths[0];
92
+        Taro.showLoading({
93
+          title: '上传中...',
94
+          mask: true
95
+        });
96
+        Taro.uploadFile({
97
+          url: 'https://api.yushixcx.com/money/upload', // 上传接口地址
98
+          filePath: filePath,
99
+          name: 'file',
100
+          header: {
101
+            'accept': 'application/json',
102
+            'Content-Type': 'multipart/form-data'
103
+          },
104
+          formData: {
105
+            'type': 'image/png' // 根据需要设置文件类型
106
+          },
107
+          success: async (uploadRes) => {
108
+            const data = JSON.parse(uploadRes.data);
109
+            if (type === 'front') {
110
+              this.setState({ idCardFront: data.url });
111
+              let that = this;
112
+              await card_ocr({
113
+                img_url: data.url
114
+              }).then(res => {
115
+                console.log(res, 'res111');
116
+                let info = JSON.parse(res);
117
+                that.setState({ idCard: info.card_no, name: info.name });
118
+              })
119
+            } else if (type === 'back') {
120
+              this.setState({ idCardBack: data.url });
121
+            }
122
+            // 隐藏加载提示
123
+            Taro.hideLoading();
124
+          }
125
+
126
+        });
127
+      }
128
+    });
129
+  }
130
+  // 提交
131
+  handleSubmit () {
132
+    const { name, account, phone, idCard, bankCard, idCardFront, idCardBack, type, phoneError } = this.state;
133
+    const defaultFront = "https://video-img.fyshark.com/1735011631991upload-background-front.11d37038.png";
134
+    const defaultBack = "https://video-img.fyshark.com/1735011647149upload-background-back.5b42ae0e.png";
135
+    switch (true) {
136
+      case name.length === 0:
137
+        Taro.showToast({
138
+          title: '请填写账户姓名',
139
+          icon: 'none',
140
+          duration: 2000
141
+        });
142
+        return;
143
+      case phone.length === 0 || phoneError:
144
+        Taro.showToast({
145
+          title: phone.length === 0 ? '请填写手机号' : phoneError ? '手机号格式错误' : '请填写手机号',
146
+          icon: 'none',
147
+          duration: 2000
148
+        });
149
+        return;
150
+      case idCard.length === 0:
151
+        Taro.showToast({
152
+          title: '请填写身份证号',
153
+          icon: 'none',
154
+          duration: 2000
155
+        });
156
+        return;
157
+      case type === 'alipay' && account.length === 0:
158
+        Taro.showToast({
159
+          title: '请填写支付宝账户',
160
+          icon: 'none',
161
+          duration: 2000
162
+        });
163
+        return;
164
+      case type === 'bank' && bankCard.length === 0:
165
+        Taro.showToast({
166
+          title: '请填写银行卡号',
167
+          icon: 'none',
168
+          duration: 2000
169
+        });
170
+        return;
171
+      case idCardFront === defaultFront || idCardBack === defaultBack:
172
+        Taro.showToast({
173
+          title: '请上传身份证照片',
174
+          icon: 'none',
175
+          duration: 2000
176
+        });
177
+        return;
178
+    }
179
+    Taro.showLoading({
180
+      title: '签约中...',
181
+      mask: true
182
+    });
183
+    worker_register({
184
+      name,
185
+      card_no: idCard,
186
+      bank_no: type === 'alipay' ? account : bankCard,
187
+      phone,
188
+      rsv_account_type: type === 'alipay' ? "1" : "0",
189
+      portrait_page: idCardFront,
190
+      national_emblem_page: idCardBack
191
+    }).then(res => {
192
+      console.log(res, 'res');
193
+      Taro.showToast({
194
+        title: '签约成功',
195
+        icon: 'none',
196
+        duration: 2000
197
+      });
198
+    }).finally(() => {
199
+      Taro.hideLoading();
200
+    })
201
+  }
202
+
203
+  // 选择类型
204
+  handleChooseType (type) {
205
+    this.setState({ type });
206
+  }
207
+
208
+  // 手机号
209
+  handleBlurPhone (value) {
210
+    const phonePattern = /^1[3-9]\d{9}$/; // 简单的中国大陆手机号验证
211
+    if (phonePattern.test(value)) {
212
+      this.setState({ phoneError: false });
213
+    } else {
214
+      this.setState({ phoneError: true });
215
+    }
216
+  }
217
+  // 是否已绑定
218
+  isBind () {
219
+    return (this.state.isAlipay && this.state.type === 'alipay') || (this.state.isBank && this.state.type === 'bank')
220
+  }
221
+  render () {
35 222
     return (
36 223
       <View className="index">
37 224
         {/* 支付宝信息 */}
225
+
38 226
         <View className="alipay-info">
227
+          <View className="alipay-info-item">
228
+            <View className="type-box">
229
+              <View className={["type-title", this.state.type === 'alipay' ? 'active' : '']} onClick={() => this.handleChooseType('alipay')}>支付宝</View>
230
+              <View className={["type-title", this.state.type === 'bank' ? 'active' : '']} onClick={() => this.handleChooseType('bank')}>银行卡</View>
231
+            </View>
232
+          </View>
233
+          <View className="upload-box">
234
+            <View className="upload-title" style={{ color: this.isBind() ? '#999' : '#333' }}>请上传身份证照片</View>
235
+            <View className="upload-image">
236
+              <View className="upload-image-item" onClick={() => this.handleChooseImage('front')}>
237
+                <Image src={this.state.idCardFront} className="upload-image-item-image" />
238
+              </View>
239
+              <View className="upload-image-item" onClick={() => this.handleChooseImage('back')}>
240
+                <Image src={this.state.idCardBack} className="upload-image-item-image" />
241
+              </View>
242
+            </View>
243
+          </View>
244
+
39 245
           <AtInput
40 246
             name="value"
41 247
             title="账户姓名"
42 248
             type="text"
249
+            disabled={this.isBind()}
43 250
             placeholder="请输入账户姓名"
44 251
             value={this.state.name}
45 252
             onChange={this.handleChangeName.bind(this)}
46 253
           />
47 254
           <AtInput
48 255
             name="value"
49
-            title="手机号"
50
-            type="text"
51
-            placeholder="请输入手机号"
52
-            value={this.state.phone}
53
-            onChange={this.handleChangePhone.bind(this)}
54
-          />
55
-          <AtInput
56
-            name="value"
57 256
             title="身份证号"
257
+            disabled={this.isBind()}
58 258
             type="text"
59 259
             placeholder="请输入身份证号"
60 260
             value={this.state.idCard}
@@ -62,34 +262,75 @@ export default class Index extends Component {
62 262
           />
63 263
           <AtInput
64 264
             name="value"
65
-            title="银行卡号"
66
-            type="text"
67
-            placeholder="请输入银行卡号"
68
-            value={this.state.bankCard}
69
-            onChange={this.handleChangeBankCard.bind(this)}
70
-          />
71
-          <AtInput
72
-            border={false}
73
-            name="value"
74
-            title="支付宝账户"
75
-            type="text"
76
-            placeholder="请输入支付宝账户"
77
-            value={this.state.account}
78
-            onChange={this.handleChangeAccount.bind(this)}
265
+            title="手机号"
266
+            disabled={this.isBind()}
267
+            type='phone'
268
+            placeholder="请输入手机号"
269
+            value={this.state.phone}
270
+            onChange={this.handleChangePhone.bind(this)}
271
+            onBlur={this.handleBlurPhone.bind(this)}
272
+            error={this.state.phoneError}
273
+            errorMessage={this.state.phoneError ? '请输入正确的手机号' : ''}
79 274
           />
275
+          {
276
+            this.state.type === 'bank' && (
277
+              <AtInput
278
+                name="value"
279
+                disabled={this.isBind()}
280
+                title="银行卡号"
281
+                type="text"
282
+                placeholder="请输入银行卡号"
283
+                value={this.state.bankCard}
284
+                onChange={this.handleChangeBankCard.bind(this)}
285
+              />
286
+            )
287
+          }
288
+          {
289
+            this.state.type === 'alipay' && (
290
+              <AtInput
291
+                border={false}
292
+                disabled={this.isBind()}
293
+                name="value"
294
+                title="支付宝账户"
295
+                type="text"
296
+                placeholder="请输入支付宝账户"
297
+                value={this.state.account}
298
+                onChange={this.handleChangeAccount.bind(this)}
299
+              />
300
+            )
301
+          }
80 302
         </View>
81
-        {/* 注意 */}
82
-        <View className="attention">
83
-          <View className="attention-top">
84
-            <Image src={aliPayIcon} className="attention-icon" />
85
-            注意:
86
-          </View>
87
-          <View className="attention-bottom">
88
-            所维护的信息需要与提现认证提交的自然人为同一人,非同一人会提现失败
303
+        <View className="alipay-info-tips">
304
+          <View className="alipay-info-tips-item">
305
+            <Image src={this.state.signImg} className="alipay-info-tips-item-icon" />
306
+            <View className="alipay-info-tips-item-text">
307
+              如需更改,请联系客服
308
+            </View>
89 309
           </View>
90 310
         </View>
311
+        {/* 注意 */}
312
+        {
313
+          !this.isBind() && (
314
+            <View className="attention">
315
+              <View className="attention-top">
316
+                <Image src={aliPayIcon} className="attention-icon" />
317
+                注意:
318
+              </View>
319
+              <View className="attention-bottom">
320
+                所维护的信息需要与提现认证提交的自然人为同一人,非同一人会提现失败
321
+              </View>
322
+            </View>
323
+          )
324
+        }
91 325
         {/* 提交 */}
92
-        <View className="submit">提交</View>
326
+        {
327
+          !this.isBind() &&
328
+          <View className="submit" onClick={this.handleSubmit.bind(this)}>提交</View>
329
+        }
330
+        {
331
+          !this.isBind() &&
332
+          <View className="submit" onClick={this.handleSubmit.bind(this)}>提交</View>
333
+        }
93 334
       </View>
94 335
     );
95 336
   }

+ 149 - 49
src/pages/memberSub/Alipay/index.less

@@ -1,61 +1,161 @@
1 1
 .index {
2
-    padding: 30px 16px;
3
-    background-color: #f9f9f9;
2
+  padding: 30px 16px;
3
+  background-color: #f9f9f9;
4
+  box-sizing: border-box;
5
+  min-height: 100vh;
6
+  position: relative;
7
+
8
+  .alipay-info {
9
+    padding: 0 17px;
10
+    border-radius: 20px;
11
+    background-color: #fff;
4 12
     box-sizing: border-box;
5
-    min-height: 100vh;
6
-
7
-    .alipay-info {
8
-        padding: 0 17px;
9
-        border-radius: 20px;
10
-        background-color: #fff;
11
-        box-sizing: border-box;
12
-        overflow: hidden;
13
-
14
-        .at-input__title {
15
-            font-size: 28px;
16
-            color: #000000;
17
-        }
13
+    overflow: hidden;
18 14
 
19
-        .at-input {
20
-            margin-left: 0;
21
-        }
22
-    }
15
+    .upload-box {
16
+      margin-top: 20px;
17
+      padding: 20px 0;
23 18
 
24
-    // 注意
25
-    .attention {
26
-        padding: 22px 41px 22px 19px;
27
-        box-sizing: border-box;
28
-        background-color: #fdf7e7;
29
-        border-radius: 20px;
19
+      .upload-title {
20
+        font-size: 28px;
21
+        color: #000000;
22
+      }
23
+
24
+      .upload-image {
30 25
         margin-top: 20px;
31
-        font-size: 26px;
32
-        color: #A0A0A0;
33
-        line-height: 38px;
34
-        .attention-top {
35
-            display: flex;
36
-            align-items: center;
37
-
38
-            .attention-icon {
39
-                width: 38px;
40
-                height: 38px;
41
-                margin-right: 10px;
42
-            }
26
+        display: flex;
27
+        flex-direction: row;
28
+        align-items: center;
29
+        justify-content: center;
30
+        gap: 20px;
31
+
32
+        .upload-image-item {
33
+          flex: 1;
34
+          width: 100%;
35
+          aspect-ratio: 294 / 199;
36
+          background-color: #f0f0f0;
37
+          border-radius: 20px;
38
+          margin-bottom: 20px;
39
+          position: relative;
40
+
41
+          .upload-image-item-image {
42
+            width: 100%;
43
+            height: 100%;
44
+            border-radius: 20px;
45
+            object-fit: cover;
46
+          }
47
+
48
+          .upload-image-item-input {
49
+            position: absolute;
50
+            top: 0;
51
+            left: 0;
52
+            width: 100%;
53
+            height: 100%;
54
+            opacity: 0;
55
+            z-index: 10;
56
+          }
43 57
         }
58
+      }
44 59
     }
45
-    // 提交
46
-    .submit{
47
-        background-color: #f6c71a;
48
-        margin: 0 16px;
49
-        position: fixed;
50
-        bottom: 30px;
51
-        left: 0;
52
-        right: 0;
53
-        height: 88px;
60
+
61
+    .alipay-info-item {
62
+      width: 100%;
63
+
64
+      .type-box {
54 65
         display: flex;
66
+        flex-direction: row;
55 67
         align-items: center;
56 68
         justify-content: center;
57
-        font-size: 28px;
58
-        color: #000000;
59
-        border-radius: 70px;
69
+        width: 100%;
70
+
71
+        .type-title {
72
+          width: 50%;
73
+          font-weight: 600;
74
+          font-size: 36px;
75
+          color: #868484;
76
+          text-align: center;
77
+          padding: 20px 0;
78
+          border-bottom: 2px solid transparent;
79
+        }
80
+
81
+        .active {
82
+          color: #000000;
83
+          border-bottom: 2px solid #000000;
84
+        }
85
+      }
86
+    }
87
+
88
+    .at-input__title {
89
+      font-size: 28px;
90
+      color: #000000;
91
+    }
92
+
93
+    .at-input {
94
+      margin-left: 0;
95
+    }
96
+  }
97
+
98
+  .alipay-info-tips {
99
+    position: absolute;
100
+    left: 50%;
101
+    top: 70%;
102
+    transform: translateX(15%) translateY(-50%);
103
+
104
+  .alipay-info-tips-item {
105
+    display: flex;
106
+    flex-direction: column;
107
+    align-items: center;
108
+
109
+    .alipay-info-tips-item-icon {
110
+      width: 200px;
111
+      height: 200px;
60 112
     }
113
+
114
+    .alipay-info-tips-item-text {
115
+      margin-top: 20px;
116
+      font-size: 28px;
117
+      color: #F9C518;
118
+    }
119
+  }
120
+}
121
+
122
+// 注意
123
+.attention {
124
+  padding: 22px 41px 22px 19px;
125
+  box-sizing: border-box;
126
+  background-color: #fdf7e7;
127
+  border-radius: 20px;
128
+  margin-top: 20px;
129
+  font-size: 26px;
130
+  color: #A0A0A0;
131
+  line-height: 38px;
132
+
133
+  .attention-top {
134
+    display: flex;
135
+    align-items: center;
136
+
137
+    .attention-icon {
138
+      width: 38px;
139
+      height: 38px;
140
+      margin-right: 10px;
141
+    }
142
+  }
143
+}
144
+
145
+// 提交
146
+.submit {
147
+  background-color: #f6c71a;
148
+  margin: 0 16px;
149
+  position: fixed;
150
+  bottom: 30px;
151
+  left: 0;
152
+  right: 0;
153
+  height: 88px;
154
+  display: flex;
155
+  align-items: center;
156
+  justify-content: center;
157
+  font-size: 28px;
158
+  color: #000000;
159
+  border-radius: 70px;
160
+}
61 161
 }

+ 164 - 40
src/pages/memberSub/cashOut/index.jsx

@@ -1,56 +1,180 @@
1 1
 import { Component } from 'react'
2
-import { View, Text } from '@tarojs/components'
3
-import { AtList, AtListItem } from "taro-ui"
2
+import { View, Text, Image } from '@tarojs/components'
3
+import { AtList, AtListItem, AtModal, AtModalHeader, AtModalContent, AtModalAction, AtInput } from "taro-ui"
4 4
 import './index.less'
5 5
 import Taro from '@tarojs/taro'
6
+import { get_my_worker_info, submit_withdraw_record } from '../../../service/money_api'
7
+import { getUserInfo } from '../../../service/index'
6 8
 export default class Index extends Component {
9
+  state = {
10
+    userInfo: {},
11
+    isOpened: false,
12
+    isAlipay: false, // 是否已绑定支付宝
13
+    isBank: false, // 是否已绑定银行卡
14
+    amount: 0, // 提现金额
15
+    bank_id: 0, // 银行卡id
16
+    alipay_id: 0, // 支付宝id
17
+    type: 0, // 提现类型
18
+    translate_money: 0, // 可提现金额
19
+  }
20
+  componentDidMount () {
21
+    this.getWorkerInfo(); // 页面加载时请求签约信息
22
+    this.getUserInfo(); // 页面加载时请求用户信息
23
+  }
24
+  // 获取用户信息
25
+  getUserInfo = async () => {
26
+    const userInfoRes = await getUserInfo();
27
+    this.setState({
28
+      translate_money: userInfoRes.translate_money
29
+    });
30
+    console.log(userInfoRes, 'userInfoRes');
31
+
32
+  }
33
+  // 获取签约信息
34
+  getWorkerInfo = async () => {
35
+    const res = await get_my_worker_info();
36
+    if (res.length > 0) {
37
+      res.forEach(item => {
38
+        if (item.rsv_account_type === 1) {
39
+          this.setState({
40
+            type: 1,
41
+            isAlipay: true,
42
+            alipay_id: item.rsv_account_id
43
+          });
44
+        } else {
45
+          this.setState({
46
+            type: 0,
47
+            isBank: true,
48
+            bank_id: item.rsv_account_id
49
+          });
50
+        }
51
+      });
52
+    }
53
+    console.log(res, 'res');
54
+  }
55
+
56
+
57
+  openModal = () => {
58
+    if (!this.state.isAlipay && !this.state.isBank) {
59
+      Taro.showToast({
60
+        title: '请先提现认证',
61
+        icon: 'none'
62
+      })
63
+      return;
64
+    }
65
+    this.setState({
66
+      isOpened: true
67
+    })
68
+  }
69
+  handleChange = (e) => {
70
+    if (e > this.state.translate_money) {
71
+      e == this.state.translate_money
72
+    }
73
+    this.setState({
74
+      amount: e
75
+    })
76
+  }
77
+  handleSubmit = async () => {
78
+    const res = await submit_withdraw_record({
79
+      amount: this.state.amount,
80
+      bank_id: this.state.type === 1 ? this.state.alipay_id : this.state.bank_id
81
+    });
82
+    if (res.code === 0) {
83
+      Taro.showToast({
84
+        title: '提现申请成功',
85
+        icon: 'none'
86
+      })
87
+      this.setState({
88
+        isOpened: false
89
+      })
90
+      this.getUserInfo();
91
+    }
92
+  }
7 93
 
8 94
   render () {
9 95
     return (
10
-      <View className='index'>  
11
-      {/* 提现 */}
96
+      <View className='index'>
97
+        {/* 提现 */}
12 98
         <View className='cash-out'>
13 99
           <View className='balance-section'>
14
-          <View className='balance-info'>
15
-            <Text className='label'>可提现金额</Text>
16
-            <View className='amount'>
17
-              <Text className='integer'>¥888.</Text>
18
-              <Text className='decimal'>00</Text>
100
+            <View className='balance-info'>
101
+              <Text className='label'>可提现金额</Text>
102
+              <View className='amount'>
103
+                <Text className='integer'>{`¥ ${this.state.translate_money}`}</Text>
104
+              </View>
105
+            </View>
106
+            <View className='action'>
107
+              <View className='withdraw-btn' onClick={() => this.openModal()}>提现</View>
19 108
             </View>
20
-          </View>
21
-          <View className='action'>
22
-            <View className='withdraw-btn'>提现</View>
23 109
           </View>
24 110
         </View>
25
-      </View>
26
-      {/* 提现功能 */}
27
-      <View className='cash-out-function'>
28
-        <AtList hasBorder={false}>
29
-        <AtListItem hasBorder={false} onClick={() => Taro.navigateTo({ url: `/pages/memberSub/Alipay/index` })} title='提现认证' extraText='认证审核中' arrow='right' />
30
-        <View className='line'></View>
31
-        <AtListItem hasBorder={false} onClick={() => Taro.navigateTo({ url: `/pages/memberSub/cashOutRecord/index` })} title='提现记录' extraText='' arrow='right' />
32
-        <View className='line'></View>
33
-        <AtListItem hasBorder={false} title='支付账户' extraText='需维护支付宝账户信息' arrow='right' />
34
-        <View className='line'></View>
35
-        <AtListItem hasBorder={false} onClick={() => Taro.navigateTo({ url: `/pages/memberSub/statementRecords/index` })} title='标题结算单记录' extraText='6月结算单已出' arrow='right' />
36
-        </AtList>
37
-      </View>
38
-      {/* 结算单说明 */}
39
-      <View className='settlement-statement'>
40
-        <Text className='title'>结算单说明</Text>
41
-        <View className='contentBox'>
42
-        <View className='content indent'>1. 每月 <Text className='highlight'>27</Text>号 出上月结算单</View>
43
-        <View className='content sub-content'>收益可在当月27号至30号全天申请提现</View>
44
-        <View className='content sub-content'>错过需要等下个月,提现金额会在1-5个工作日到账</View>
45
-        <View className='content indent'>2. 会员需要在提现前完成 提现认证 并审核通过</View>
46
-        <View className='content sub-content'>维护完善 支付宝账户信息,否则将影响提现进行</View>
47
-        <View className='content indent'>3. 结算单收益:订单完成时间在上个月的总收益</View>
48
-        <View className='content sub-content'>上个月【已付款】但未完成订单可在下个月提现</View>
49
-        <View className='content indent'>4. 可提现金额已扣除各项税费,提现金额需大于1元</View>
50
-        <View className='content indent'>5. 本月未提现收益不会清 0</View>
51
-        <View className='content sub-content'>会累积到账户余额,下个月合并提现</View>
111
+        {/* 提现功能 */}
112
+        <View className='cash-out-function'>
113
+          <AtList hasBorder={false}>
114
+            <AtListItem hasBorder={false} onClick={() => Taro.navigateTo({ url: `/pages/memberSub/Alipay/index` })} title='提现认证' arrow='right' />
115
+            <View className='line'></View>
116
+            <AtListItem hasBorder={false} onClick={() => Taro.navigateTo({ url: `/pages/memberSub/cashOutRecord/index` })} title='提现记录' extraText='' arrow='right' />
117
+            <View className='line'></View>
118
+            {/* <AtListItem hasBorder={false} title='支付账户' extraText='需维护支付宝账户信息' arrow='right' /> */}
119
+            {/* <View className='line'></View> */}
120
+            <AtListItem hasBorder={false} onClick={() => Taro.navigateTo({ url: `/pages/memberSub/statementRecords/index` })} title='标题结算单记录' extraText='6月结算单已出' arrow='right' />
121
+          </AtList>
52 122
         </View>
53
-      </View>
123
+        {/* 结算单说明 */}
124
+        <View className='settlement-statement'>
125
+          <Text className='title'>结算单说明</Text>
126
+          <View className='contentBox'>
127
+            <View className='content indent'>1. 每月 <Text className='highlight'>27</Text>号 出上月结算单</View>
128
+            <View className='content sub-content'>收益可在当月27号至30号全天申请提现</View>
129
+            <View className='content sub-content'>错过需要等下个月,提现金额会在1-5个工作日到账</View>
130
+            <View className='content indent'>2. 会员需要在提现前完成 提现认证 并审核通过</View>
131
+            <View className='content sub-content'>维护完善 支付宝账户信息,否则将影响提现进行</View>
132
+            <View className='content indent'>3. 结算单收益:订单完成时间在上个月的总收益</View>
133
+            <View className='content sub-content'>上个月【已付款】但未完成订单可在下个月提现</View>
134
+            <View className='content indent'>4. 可提现金额已扣除各项税费,提现金额需大于1元</View>
135
+            <View className='content indent'>5. 本月未提现收益不会清 0</View>
136
+            <View className='content sub-content'>会累积到账户余额,下个月合并提现</View>
137
+          </View>
138
+        </View>
139
+        <AtModal
140
+          isOpened={this.state.isOpened}
141
+        >
142
+          <AtModalHeader>提现申请</AtModalHeader>
143
+          <AtModalContent>
144
+            <View className='amount-box'>
145
+              <AtInput
146
+                className='amount-input'
147
+                name='value2'
148
+                title='金额'
149
+                type='number'
150
+                placeholder='请输入金额'
151
+                value={this.state.amount}
152
+                onChange={this.handleChange}
153
+              />
154
+              <View className='all-btn' onClick={() => this.handleChange(this.state.translate_money)}>全部</View>
155
+            </View>
156
+            <View className='amount-info'>
157
+              {
158
+                this.state.isAlipay &&
159
+                <View className={['amount-info-item', this.state.type === 1 ? 'active' : '']} onClick={() => this.setState({ type: 1 })}>
160
+                  <Image src='https://video-img.fyshark.com/1735041316314%E6%94%AF%E4%BB%98%E5%AE%9D%E6%94%AF%E4%BB%98.png' style={{ width: '24px', height: '24px' }} />
161
+                  <Text className='amount-info-item-text'>支付宝</Text>
162
+                </View>
163
+              }
164
+              {
165
+                this.state.isBank &&
166
+                <View className={['amount-info-item', this.state.type === 0 ? 'active' : '']} onClick={() => this.setState({ type: 2 })}>
167
+                  <Image src='https://video-img.fyshark.com/1735041334363%E6%94%AF%E4%BB%98%E5%B9%B3%E5%8F%B0-%E9%93%B6%E8%81%94.png' style={{ width: '32px', height: '24px' }} />
168
+                  <Text className='amount-info-item-text'>银行卡</Text>
169
+                </View>
170
+              }
171
+            </View>
172
+            <View className='submit-btn'>
173
+              <View className='submit-btn-text' onClick={this.handleSubmit}>提交</View>
174
+            </View>
175
+          </AtModalContent>
176
+          <AtModalAction>  </AtModalAction>
177
+        </AtModal>
54 178
       </View>
55 179
     )
56 180
   }

+ 167 - 101
src/pages/memberSub/cashOut/index.less

@@ -1,122 +1,188 @@
1 1
 .index {
2
-    min-height: 100vh;
3
-    background-color: #f0f2f5;
4
-    padding: 20px 16px 0 16px;
5
-    box-sizing: border-box;
2
+  min-height: 100vh;
3
+  background-color: #f0f2f5;
4
+  padding: 20px 16px 0 16px;
5
+  box-sizing: border-box;
6 6
 
7 7
 }
8 8
 
9 9
 .cash-out {
10
-    .balance-section {
10
+  .balance-section {
11
+    display: flex;
12
+    justify-content: space-between;
13
+    align-items: center;
14
+    background-color: #fff;
15
+    border-radius: 20px;
16
+    padding: 0 17px;
17
+    box-sizing: border-box;
18
+
19
+    .balance-info {
20
+      padding: 35px 0 25px 0;
21
+      box-sizing: border-box;
22
+
23
+      .label {
24
+        font-size: 28px;
25
+        color: #000000;
26
+        display: block;
27
+        margin-bottom: 11px;
28
+        line-height: 41px;
29
+        font-weight: 500;
30
+      }
31
+
32
+      .amount {
11 33
         display: flex;
12
-        justify-content: space-between;
13
-        align-items: center;
14
-        background-color: #fff;
15
-        border-radius: 20px;
16
-        padding: 0 17px;
17
-        box-sizing: border-box;
18
-
19
-        .balance-info {
20
-            padding: 35px 0 25px 0;
21
-            box-sizing: border-box;
22
-
23
-            .label {
24
-                font-size: 28px;
25
-                color: #000000;
26
-                display: block;
27
-                margin-bottom: 11px;
28
-                line-height: 41px;
29
-                font-weight: 500;
30
-            }
31
-
32
-            .amount {
33
-                display: flex;
34
-                align-items: baseline;
35
-                font-weight: 700;
36
-                line-height: 70px;
37
-                color: #F6C71A;
38
-
39
-                .integer {
40
-                    font-size: 48px;
41
-                }
42
-
43
-                .decimal {
44
-                    font-size: 36px;
45
-                }
46
-            }
34
+        align-items: baseline;
35
+        font-weight: 700;
36
+        line-height: 70px;
37
+        color: #F6C71A;
38
+
39
+        .integer {
40
+          font-size: 48px;
47 41
         }
48 42
 
49
-        .action {
50
-            .withdraw-btn {
51
-                color: #F6C71A;
52
-                padding: 13px 53px;
53
-                line-height: 38px;
54
-                border-radius: 60px;
55
-                font-size: 26px;
56
-                border: 1px solid #F6C71A;
57
-            }
43
+        .decimal {
44
+          font-size: 36px;
58 45
         }
46
+      }
47
+    }
48
+
49
+    .action {
50
+      .withdraw-btn {
51
+        color: #F6C71A;
52
+        padding: 13px 53px;
53
+        line-height: 38px;
54
+        border-radius: 60px;
55
+        font-size: 26px;
56
+        border: 1px solid #F6C71A;
57
+      }
59 58
     }
59
+  }
60 60
 }
61 61
 
62 62
 // 提现功能
63 63
 .cash-out-function {
64
-    margin-top: 20px;
65
-    border-radius: 20px;
66
-    background-color: #fff;
67
-    overflow: hidden;
68
-    .line{
69
-        margin: 0 17px;
70
-        height: 1px;
71
-        background-color: #D8D8D8;
72
-    }
73
-    .item-content__info-title {
74
-        font-weight: 500;
75
-        font-size: 28px;
76
-        color: #000000;
77
-    }
78
-    .item-extra__info{
79
-        font-size: 24px;
80
-    }
81
-    .at-list__item-extra{
82
-        max-width: 400px;
83
-    }
84
-    .at-list__item .item-extra__icon-arrow{
85
-        font-size: 32px;
86
-    }
87
-    .at-list__item{
88
-        padding: 31px 17px;
89
-    }
64
+  margin-top: 20px;
65
+  border-radius: 20px;
66
+  background-color: #fff;
67
+  overflow: hidden;
68
+
69
+  .line {
70
+    margin: 0 17px;
71
+    height: 1px;
72
+    background-color: #D8D8D8;
73
+  }
74
+
75
+  .item-content__info-title {
76
+    font-weight: 500;
77
+    font-size: 28px;
78
+    color: #000000;
79
+  }
80
+
81
+  .item-extra__info {
82
+    font-size: 24px;
83
+  }
84
+
85
+  .at-list__item-extra {
86
+    max-width: 400px;
87
+  }
88
+
89
+  .at-list__item .item-extra__icon-arrow {
90
+    font-size: 32px;
91
+  }
92
+
93
+  .at-list__item {
94
+    padding: 31px 17px;
95
+  }
90 96
 }
97
+
91 98
 // 结算单说明
92
-.settlement-statement{
93
-    margin-top: 30px;
94
-    padding: 0 17px;
95
-    box-sizing: border-box;
96
-    .title{
97
-        font-size: 24px;
98
-        line-height: 35px;
99
-        color: #000000;
99
+.settlement-statement {
100
+  margin-top: 30px;
101
+  padding: 0 17px;
102
+  box-sizing: border-box;
103
+
104
+  .title {
105
+    font-size: 24px;
106
+    line-height: 35px;
107
+    color: #000000;
108
+  }
109
+
110
+  .contentBox {
111
+    margin-top: 10px;
112
+  }
113
+
114
+  .content {
115
+    font-size: 22px;
116
+    line-height: 32px;
117
+    color: #B5B5B5;
118
+
119
+    &.indent {
120
+      padding-left: 24px;
121
+      text-indent: -24px;
100 122
     }
101
-    .contentBox{
102
-        margin-top: 10px;
123
+
124
+    &.sub-content {
125
+      padding-left: 24px;
103 126
     }
104
-    .content{
105
-        font-size: 22px;
106
-        line-height: 32px;
107
-        color: #B5B5B5;
108
-        
109
-        &.indent {
110
-            padding-left: 24px;
111
-            text-indent: -24px;
112
-        }
113
-        
114
-        &.sub-content {
115
-            padding-left: 24px;
116
-        }
117 127
 
118
-        .highlight{
119
-            color: #EC8F2B;
120
-        }
128
+    .highlight {
129
+      color: #EC8F2B;
121 130
     }
131
+  }
122 132
 }
133
+
134
+.amount-box {
135
+  display: flex;
136
+  align-items: center;
137
+  justify-content: space-between;
138
+
139
+  .amount-input {
140
+    flex: 1;
141
+  }
142
+
143
+  .all-btn {
144
+    font-size: 24px;
145
+    color: #113fab;
146
+    border-radius: 10px;
147
+  }
148
+}
149
+
150
+.amount-info {
151
+  margin-top: 80px;
152
+  display: flex;
153
+  align-items: center;
154
+  gap: 20px;
155
+
156
+  .amount-info-item {
157
+    padding: 10rpx 30rpx;
158
+    border: 2rpx solid #9c9ca0;
159
+    border-radius: 30rpx;
160
+    display: flex;
161
+    align-items: center;
162
+    gap: 5px;
163
+
164
+    .amount-info-item-text {
165
+      font-size: 24px;
166
+      color: #000000;
167
+    }
168
+  }
169
+
170
+  .active {
171
+    border: 2rpx solid #FCE020 !important;
172
+  }
173
+}
174
+
175
+.submit-btn {
176
+  margin-top: 40px;
177
+  display: flex;
178
+  justify-content: center;
179
+  align-items: center;
180
+  padding: 10px 0;
181
+  background-color: #FCE020;
182
+  border-radius: 10px;
183
+
184
+  .submit-btn-text {
185
+    font-size: 28px;
186
+    color: #000000;
187
+  }
188
+}

+ 42 - 15
src/pages/memberSub/cashOutRecord/index.jsx

@@ -2,21 +2,44 @@ import { Component } from 'react'
2 2
 import { View, Text, Image } from '@tarojs/components'
3 3
 import './index.less'
4 4
 import wallet from '../../../images/wallet.png'
5
-export default class Index extends Component {
6
-
7
-  componentWillMount () { }
5
+import { get_withdraw_record } from '../../../service/money_api'
8 6
 
9
-  componentDidMount () { }
7
+export default class Index extends Component {
8
+  state = {
9
+    withdraw_record_list: [],
10
+    page: 1,
11
+    page_size: 20, // 每页加载20条
12
+    total: 0,
13
+    loading: false // 加载状态
14
+  }
10 15
 
11
-  componentWillUnmount () { }
16
+  componentDidShow () {
17
+    this.get_withdraw_record()
18
+  }
12 19
 
13
-  componentDidShow () { }
20
+  get_withdraw_record = async () => {
21
+    if (this.state.loading) return; // 防止重复加载
22
+    this.setState({ loading: true });
23
+    const res = await get_withdraw_record({
24
+      page: this.state.page,
25
+      page_size: this.state.page_size
26
+    })
27
+    console.log(res, 'res')
28
+    this.setState(prevState => ({
29
+      withdraw_record_list: prevState.page === 1 ? res : [...prevState.withdraw_record_list, ...res],
30
+      loading: false
31
+    }))
32
+  }
14 33
 
15
-  componentDidHide () { }
34
+  onReachBottom = () => {
35
+    if (this.state.withdraw_record_list.length < this.state.total) {
36
+      this.setState(prevState => ({ page: prevState.page + 1 }), this.get_withdraw_record)
37
+    }
38
+  }
16 39
 
17 40
   render () {
18 41
     return (
19
-      <View className='index'>
42
+      <View className='index' onScrollToLower={this.onReachBottom}>
20 43
         {/* 提现记录 */}
21 44
         <View className='cash-out-record'>
22 45
           {/* 累计提现金额 */}
@@ -31,13 +54,17 @@ export default class Index extends Component {
31 54
             </View>
32 55
           </View>
33 56
           {/* 提现记录 */}
34
-          <View className='record-item'>
35
-            <View className='item-time'>2024-06-27 10:00:00</View>
36
-            <View className='item-amount'>
37
-              <View className='amount'>¥ 10000.00</View>
38
-              <View className='status'>提现成功</View>
39
-            </View>
40
-          </View>
57
+          {this.state.withdraw_record_list.map((item, index) => {
58
+            return (
59
+              <View className='record-item' key={index}>
60
+                <View className='item-time'>{item.time.replace('T', ' ')}</View>
61
+                <View className='item-amount'>
62
+                  <View className='amount'>¥{item.amount}</View>
63
+                  <View className='status'>{item.msg}</View>
64
+                </View>
65
+              </View>
66
+            )
67
+          })}
41 68
         </View>
42 69
       </View>
43 70
     )

+ 41 - 0
src/service/money_api.js

@@ -0,0 +1,41 @@
1
+import Request from '../api/request';
2
+
3
+// 提现认证 
4
+export const worker_register = data =>
5
+  Request({
6
+    url: '/money/worker_register',
7
+    method: 'POST',
8
+    data,
9
+  });
10
+
11
+// 获取签约信息
12
+export const get_my_worker_info = data =>
13
+  Request({
14
+    url: '/money/get_my_worker_info',
15
+    method: 'POST',
16
+    data,
17
+  });
18
+
19
+  // 申请提现
20
+  export const submit_withdraw_record = data =>
21
+  Request({
22
+    url: '/money/submit_withdraw_record',
23
+    method: 'POST',
24
+    data,
25
+  });
26
+
27
+  // 身份证ocr
28
+  export const card_ocr = data =>
29
+    Request({
30
+      url: '/money/card_ocr',
31
+      method: 'POST',
32
+      data,
33
+    });
34
+
35
+  // 获取提现记录
36
+  export const get_withdraw_record = data =>
37
+    Request({
38
+      url: '/money/get_withdraw_record',
39
+      method: 'POST',
40
+      data,
41
+    });