张延森 5 anos atrás
pai
commit
624b0a7661

+ 5
- 1
src/onlineSelling/pages/houseList/index.js Ver arquivo

@@ -23,8 +23,9 @@ import { getCardDetail } from '@/services/card'
23 23
 import Consultant from '@/components/consultant'
24 24
 import './index.scss'
25 25
 import { Loading } from '@/components/Loading'
26
+import * as houseActions from '@/actions/house'
26 27
 
27
-@connect(s => s.user)
28
+@connect(s => s.user, { ...houseActions })
28 29
 @withDetail({
29 30
   track: {
30 31
     event: 'house_list',
@@ -70,6 +71,9 @@ export default class HouseList extends Component {
70 71
       this.setState({ showShareMenu: false })
71 72
       this.initPageData()
72 73
     })
74
+
75
+    // 清空认筹选择
76
+    this.props.dispatchFlush2Cart([])
73 77
   }
74 78
 
75 79
 

+ 32
- 0
src/onlineSelling/pages/raiseMoney/RadioList/index.js Ver arquivo

@@ -0,0 +1,32 @@
1
+import Taro, { Component } from '@tarojs/taro'
2
+import { View, Label, Radio } from "@tarojs/components";
3
+import './index.scss'
4
+
5
+export default class extends Component {
6
+
7
+  render() {
8
+    const { value, color, size, dataset = [], onChange } = this.props
9
+
10
+    return (
11
+      <RadioGroup onChange={onChange}>
12
+        {
13
+          dataset.map((item) => {
14
+            const checked = item.value === value
15
+            const checkedColor = color && checked ? `border-color: ${color}` : ''
16
+            const btnSize = size ? `width: ${size}; height: ${size}` : ''
17
+            const btnStyle = `${checkedColor};${btnSize}`
18
+
19
+            return (
20
+              <Label key={item.value} className="radio-btn">
21
+                <Radio hidden value={item.value} checked={checked}></Radio>
22
+                <View className={`icon ${checked ? 'checked' : ''}`} style={btnStyle}></View>
23
+                <View className="label">{item.label}</View>
24
+              </Label>
25
+            )
26
+          })
27
+        }
28
+      </RadioGroup>
29
+    )
30
+  }
31
+
32
+}

+ 28
- 0
src/onlineSelling/pages/raiseMoney/RadioList/index.scss Ver arquivo

@@ -0,0 +1,28 @@
1
+.radio-btn {
2
+  display: inline-block;
3
+
4
+  .icon {
5
+    width: 20px;
6
+    height: 20px;
7
+    display: inline-block;
8
+    border:2px solid #999;
9
+    border-radius:50%;
10
+    position: relative;
11
+    margin-right: 10px;
12
+    vertical-align: middle;
13
+
14
+    &.checked {
15
+      border-width: 6px;
16
+      border-style: solid;
17
+      border-color: #f00;
18
+    }
19
+  }
20
+
21
+  .label {
22
+    display: inline-block;
23
+  }
24
+
25
+  & + .radio-btn {
26
+    margin-left: 40px;
27
+  }
28
+}

+ 55
- 8
src/onlineSelling/pages/raiseMoney/index.js Ver arquivo

@@ -14,6 +14,7 @@ import { raiseOrder, cancelOrder } from '@/services/project'
14 14
 import { getCodeMessage } from '@/services/getCode'
15 15
 import { checkIDCard, isEmpty } from '@/utils/tools'
16 16
 import ContactConsultant from '../../components/ContactConsultant'
17
+import RadioList from './RadioList'
17 18
 
18 19
 const getRaiseProfile = ({ salesBatchId, raiseRecordId, personId }) => {
19 20
   const queryString = [
@@ -44,13 +45,18 @@ export default class raiseMoney extends Component {
44 45
     navigationBarTitleText: '认筹确认'
45 46
   }
46 47
   state = {
47
-    current: 0,
48
+    current: 3,
48 49
     inputName: '',
49 50
     raiseProfile: undefined,
50 51
     record: {},
51 52
     protocolCountdown: 10, // 单位 s
52 53
     captchaCountdown: 60, // 单位 s
53 54
     raiseIdRecord:'',
55
+    payType: '', // 缴费方式
56
+    payTypeList: [
57
+      { label: '线上缴费', value: 'onLine' },
58
+      { label: '线下缴费', value: 'offLine' },
59
+    ],
54 60
   }
55 61
 
56 62
   captchaLock = false
@@ -87,7 +93,13 @@ export default class raiseMoney extends Component {
87 93
 
88 94
     // 请求认筹信息
89 95
     getRaiseProfile({ salesBatchId, raiseRecordId, personId }).then(res => {
90
-      this.setState({ raiseProfile: res, record: res.record || defaultRecord })
96
+      let payType = ''
97
+      const payTypeSettings = (res.payType || '').split(',')
98
+      if (payTypeSettings.length === 1) {
99
+        payType = payTypeSettings[0]
100
+      }
101
+
102
+      this.setState({ raiseProfile: res, payType, record: res.record || defaultRecord })
91 103
 
92 104
       // 请求置业顾问列表
93 105
       if (!house.consultantList || !house.consultantList.length) {
@@ -354,10 +366,19 @@ export default class raiseMoney extends Component {
354 366
     num = num.replace(reg, '$1');
355 367
     num = this.toDecimal2(num)
356 368
     return num
357
-  };
358
-  renderMoney() {
359
-    const { raiseProfile = {} } = this.state
369
+  }
370
+
371
+  handleChangeType = (e) => {
372
+    console.log('----------------->', e)
373
+    this.setState({ payType: e.detail.value })
374
+  }
360 375
 
376
+  renderMoney() {
377
+    const { raiseProfile = {}, payTypeList, payType } = this.state
378
+    const payTypeSettings = (raiseProfile.payType || '').split(',')
379
+    const showTypes = payTypeList.filter(x => (payTypeSettings.indexOf(x.value) > -1))
380
+    const showProtocal = payType === 'onLine' ? raiseProfile.payDescriptionOnline : raiseProfile.payDescriptionOffline
381
+    const payTip = payType === 'onLine' ? '线上缴费说明' : '线下缴费说明'
361 382
 
362 383
     return (
363 384
       <ScrollView scrollY className="container2" style="padding:0 30rpx">
@@ -365,8 +386,19 @@ export default class raiseMoney extends Component {
365 386
           <View className="title">认筹金额</View>
366 387
           <View className="price">{this.regFenToYuan(raiseProfile.raisePrice)}元</View>
367 388
         </View>
368
-        <View className="center-title">线上缴费说明</View>
369
-        <RichText nodes={raiseProfile.payDescriptionOnline || ''} />
389
+        {
390
+          (payTypeSettings.length > 1) &&
391
+          (
392
+            <View className="pay-type">
393
+              <View className="head">请选择缴费方式:</View>
394
+              <View className="body">
395
+                <RadioList dataset={showTypes} value={payType} onChange={this.handleChangeType} />
396
+              </View>
397
+            </View>
398
+          )
399
+        }
400
+        <View className="center-title">{payTip}</View>
401
+        <RichText nodes={showProtocal || ''} />
370 402
       </ScrollView >
371 403
     )
372 404
   }
@@ -427,8 +459,10 @@ export default class raiseMoney extends Component {
427 459
       return Promise.reject()
428 460
     }
429 461
 
462
+    debugger
463
+
430 464
     // 校验手机号
431
-    if (isEmpty(record.tel) || record.tel < 11) {
465
+    if (isEmpty(record.tel) || record.tel.length < 11) {
432 466
       Taro.showToast({
433 467
         title: '手机号格式不正确',
434 468
         icon: 'none',
@@ -468,6 +502,19 @@ export default class raiseMoney extends Component {
468 502
   }
469 503
 
470 504
   makePay = () => {
505
+    const { payType } = this.state
506
+    if (!payType) {
507
+      Taro.showToast({
508
+        title: '请确定支付方式',
509
+        icon: 'none'
510
+      })
511
+      return Promise.reject()
512
+    }
513
+
514
+    if (payType === 'offLine') {
515
+      return Promise.resolve()
516
+    }
517
+
471 518
     const params = {
472 519
       targetId: this.$router.params.raiseRecordId || this.state.raiseIdRecord,
473 520
       targetType: 'house'

+ 20
- 0
src/onlineSelling/pages/raiseMoney/index.scss Ver arquivo

@@ -44,6 +44,26 @@
44 44
   }
45 45
   .container2 {
46 46
     height: calc(100vh - 382px);
47
+
48
+    .pay-type {
49
+      display: flex;
50
+      margin: 30px 0 40px;
51
+      font-size:28px;
52
+      color: #333;
53
+
54
+      .head {
55
+        width: 240px;
56
+        flex: none;
57
+      }
58
+
59
+      .body {
60
+        flex: auto;
61
+
62
+        .item {
63
+          display: inline-block;
64
+        }
65
+      }
66
+    }
47 67
   }
48 68
   .container3 {
49 69
     height: calc(100vh - 452px);

+ 1
- 0
src/onlineSelling/pages/raiseProfile/index.scss Ver arquivo

@@ -129,6 +129,7 @@
129 129
   }
130 130
 }
131 131
 .raise-flex{
132
+  margin-top: 40px;
132 133
   display: flex;
133 134
   align-items: center;
134 135
   justify-content: space-between;

+ 3
- 0
src/onlineSelling/pages/records/index.js Ver arquivo

@@ -80,6 +80,9 @@ export default class Records extends Component {
80 80
       }
81 81
 
82 82
       this.setState({ salesBatchId })
83
+
84
+      // 清空认筹选择
85
+      this.props.dispatchFlush2Cart([])
83 86
     })
84 87
   }
85 88
   getPreselection(params) {