瀏覽代碼

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/miniapp-v3 into dev

xujing 5 年之前
父節點
當前提交
e2f8c55f0d

+ 13
- 18
src/pages/activity/detail/assemble.js 查看文件

26
 import { ROLE_CODE } from '@constants/user'
26
 import { ROLE_CODE } from '@constants/user'
27
 import Consultant from '@components/consultant'
27
 import Consultant from '@components/consultant'
28
 import * as noticeType from '@constants/common.js'
28
 import * as noticeType from '@constants/common.js'
29
-import { reportClient } from '@services/report'
29
+import { report as reportCustomer } from '@utils/customer'
30
 
30
 
31
 const waitImg = require('@assets/helpgroup/wait.png')
31
 const waitImg = require('@assets/helpgroup/wait.png')
32
 const memberImg = require('@assets/helpgroup/group/member.png')
32
 const memberImg = require('@assets/helpgroup/group/member.png')
73
     grantAvatarVisible: false, // 授权头像
73
     grantAvatarVisible: false, // 授权头像
74
     pointRecordId: undefined, // 埋点ID
74
     pointRecordId: undefined, // 埋点ID
75
     consultData: {}, // 分享的置业顾问信息
75
     consultData: {}, // 分享的置业顾问信息
76
-    consultShow: false  // 置业顾问悬浮框显示隐藏
76
+    consultShow: false,  // 置业顾问悬浮框显示隐藏
77
+    reportedCustomer: false,
77
   }
78
   }
78
 
79
 
79
   componentWillMount() {
80
   componentWillMount() {
108
     this.stopTicker()
109
     this.stopTicker()
109
   }
110
   }
110
 
111
 
112
+  componentWillReceiveProps() {
113
+    this.reportClientFn()
114
+  }
115
+
111
   // 初始化页面数据
116
   // 初始化页面数据
112
   initPageData = () => {
117
   initPageData = () => {
113
     if (!this.state.detail.groupActivityId) {
118
     if (!this.state.detail.groupActivityId) {
316
     })
321
     })
317
 
322
 
318
     if (consultant) {
323
     if (consultant) {
319
-      this.reportClientFn()
320
       getCardDetail(consultant).then(res => {
324
       getCardDetail(consultant).then(res => {
321
         this.setState({
325
         this.setState({
322
           consultData: res,
326
           consultData: res,
325
       })
329
       })
326
     }
330
     }
327
   }
331
   }
332
+
328
   // 报备客户
333
   // 报备客户
329
   reportClientFn() {
334
   reportClientFn() {
330
-
331
     const router = Taro.getStorageSync('router') || { query: {} }
335
     const router = Taro.getStorageSync('router') || { query: {} }
332
     const consultant = this.$router.params.consultant || router.query.consultant || ""
336
     const consultant = this.$router.params.consultant || router.query.consultant || ""
333
-    const { userInfo: { person: { phone, tel, personId } } } = this.props
334
-
335
-    if (consultant && consultant != personId) {
336
-      const realPhone = phone || tel
337
-      const payload = {
338
-        realtyConsultant: consultant, //报备人 置业顾问
339
-        phone: realPhone,
340
-        showToast: false
341
-      }
342
-      reportClient(payload).then(res => {
343
-        console.log('恭喜您绑定成功')
344
-      }).catch(err => {
345
-        console.error(err)
337
+    const { userInfo: { person } } = this.props
338
+
339
+    if (!this.state.reportedCustomer) {
340
+      reportCustomer(person, consultant).then(() => {
341
+        this.setState({ reportedCustomer: true })
346
       })
342
       })
347
     }
343
     }
348
   }
344
   }
373
     return res
369
     return res
374
   }
370
   }
375
 
371
 
376
-
377
   onShareAppMessage = (res) => {
372
   onShareAppMessage = (res) => {
378
     const { shares, detail: { groupActivityId, activityName, mainImg } } = this.state
373
     const { shares, detail: { groupActivityId, activityName, mainImg } } = this.state
379
     const currentPage = `/${this.currentPageAndParams(res.from).join('?')}`
374
     const currentPage = `/${this.currentPageAndParams(res.from).join('?')}`

+ 13
- 17
src/pages/activity/detail/assistance.js 查看文件

27
 import { ROLE_CODE } from '@constants/user'
27
 import { ROLE_CODE } from '@constants/user'
28
 import Consultant from '@components/consultant'
28
 import Consultant from '@components/consultant'
29
 import * as noticeType from '@constants/common.js'
29
 import * as noticeType from '@constants/common.js'
30
-import { reportClient } from '@services/report'
30
+import { report as reportCustomer } from '@utils/customer'
31
 
31
 
32
 const successImg = 'https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/images/helpgroup/help/success2.png'
32
 const successImg = 'https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/images/helpgroup/help/success2.png'
33
 const failImg = 'https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/images/helpgroup/help/help%20failure.png'
33
 const failImg = 'https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/images/helpgroup/help/help%20failure.png'
73
     handleHelpBtn: true, // 立即助力好友
73
     handleHelpBtn: true, // 立即助力好友
74
     pointRecordId: undefined, // 埋点ID
74
     pointRecordId: undefined, // 埋点ID
75
     consultData: {}, // 分享的置业顾问信息
75
     consultData: {}, // 分享的置业顾问信息
76
-    consultShow: false  // 置业顾问悬浮框显示隐藏
76
+    consultShow: false,  // 置业顾问悬浮框显示隐藏
77
+    reportedCustomer: false,
77
   }
78
   }
78
 
79
 
79
   componentWillMount() {
80
   componentWillMount() {
110
     this.stopTicker()
111
     this.stopTicker()
111
   }
112
   }
112
 
113
 
114
+  componentWillReceiveProps() {
115
+    this.reportClientFn()
116
+  }
117
+
113
   // 初始化页面数据
118
   // 初始化页面数据
114
   initPageData = () => {
119
   initPageData = () => {
115
     if (!this.state.detail.helpActivityId) {
120
     if (!this.state.detail.helpActivityId) {
320
     })
325
     })
321
 
326
 
322
     if (consultant) {
327
     if (consultant) {
323
-      this.reportClientFn()
324
       getCardDetail(consultant).then(res => {
328
       getCardDetail(consultant).then(res => {
325
         this.setState({
329
         this.setState({
326
           consultData: res,
330
           consultData: res,
329
       })
333
       })
330
     }
334
     }
331
   }
335
   }
336
+
332
   // 报备客户
337
   // 报备客户
333
   reportClientFn() {
338
   reportClientFn() {
334
-
335
     const router = Taro.getStorageSync('router') || { query: {} }
339
     const router = Taro.getStorageSync('router') || { query: {} }
336
     const consultant = this.$router.params.consultant || router.query.consultant || ""
340
     const consultant = this.$router.params.consultant || router.query.consultant || ""
337
-    const { userInfo: { person: { phone, tel, personId } } } = this.props
338
-
339
-    if (consultant && consultant != personId) {
340
-      const realPhone = phone || tel
341
-      const payload = {
342
-        realtyConsultant: consultant, //报备人 置业顾问
343
-        phone: realPhone,
344
-        showToast: false
345
-      }
346
-      reportClient(payload).then(res => {
347
-        console.log('恭喜您绑定成功')
348
-      }).catch(err => {
349
-        console.error(err)
341
+    const { userInfo: { person } } = this.props
342
+
343
+    if (!this.state.reportedCustomer) {
344
+      reportCustomer(person, consultant).then(() => {
345
+        this.setState({ reportedCustomer: true })
350
       })
346
       })
351
     }
347
     }
352
   }
348
   }

+ 32
- 20
src/pages/activity/detail/index.js 查看文件

6
 import dayjs from 'dayjs'
6
 import dayjs from 'dayjs'
7
 import WxParse from '@components/wxParse/wxParse'
7
 import WxParse from '@components/wxParse/wxParse'
8
 import getUserPhone from '@utils/getUserPhone'
8
 import getUserPhone from '@utils/getUserPhone'
9
+import AchievePhone from '@components/achievePhone'
9
 import ready from '@utils/ready'
10
 import ready from '@utils/ready'
10
 import { getDownloadURL, times, transferImage } from '@utils/tools'
11
 import { getDownloadURL, times, transferImage } from '@utils/tools'
11
 import { getQrCodeParams } from '@utils/qrcode'
12
 import { getQrCodeParams } from '@utils/qrcode'
25
   updatePoint
26
   updatePoint
26
 } from '@services/common'
27
 } from '@services/common'
27
 import { connect } from '@tarojs/redux'
28
 import { connect } from '@tarojs/redux'
28
-import { reportClient } from '@services/report'
29
+import { report as reportCustomer } from '@utils/customer'
29
 
30
 
30
 @connect(state => state.user)
31
 @connect(state => state.user)
31
 export default class Detail extends Component {
32
 export default class Detail extends Component {
48
     canChoose: 'none',
49
     canChoose: 'none',
49
     inputName: '',
50
     inputName: '',
50
     consultData: {}, // 分享的置业顾问信息
51
     consultData: {}, // 分享的置业顾问信息
51
-    consultShow: false  // 置业顾问悬浮框显示隐藏
52
+    consultShow: false,  // 置业顾问悬浮框显示隐藏
53
+    reportedCustomer: false,
52
   }
54
   }
53
 
55
 
54
   componentWillMount() {
56
   componentWillMount() {
87
     })
89
     })
88
   }
90
   }
89
 
91
 
92
+  componentWillReceiveProps() {
93
+    this.reportClientFn()
94
+  }
95
+
90
   loadDetail() {
96
   loadDetail() {
91
     const { id } = this.state
97
     const { id } = this.state
92
     Taro.showLoading()
98
     Taro.showLoading()
133
         }
139
         }
134
       })
140
       })
135
       WxParse.wxParse('article', 'html', res.desc, this.$scope, 0)
141
       WxParse.wxParse('article', 'html', res.desc, this.$scope, 0)
136
-
137
-
138
     })
142
     })
139
 
143
 
140
     if (consultant) {
144
     if (consultant) {
141
-      this.reportClientFn()
142
       getCardDetail(consultant).then(res => {
145
       getCardDetail(consultant).then(res => {
143
         this.setState({
146
         this.setState({
144
           consultData: res,
147
           consultData: res,
147
       })
150
       })
148
     }
151
     }
149
   }
152
   }
153
+
150
   // 报备客户
154
   // 报备客户
151
   reportClientFn() {
155
   reportClientFn() {
152
-
153
-    const router = Taro.getStorageSync('router') || { query: {} }
156
+    const router = Taro.getStorageSync('router')
154
     const consultant = this.$router.params.consultant || router.query.consultant || ""
157
     const consultant = this.$router.params.consultant || router.query.consultant || ""
155
-    const { userInfo: { person: { phone, tel, personId } } } = this.props
158
+    const { userInfo: { person } } = this.props
156
 
159
 
157
-    if (consultant && consultant != personId) {
158
-      const realPhone = phone || tel
159
-      const payload = {
160
-        realtyConsultant: consultant, //报备人 置业顾问
161
-        phone: realPhone,
162
-        showToast: false
163
-      }
164
-      reportClient(payload).then(res => {
165
-        console.log('恭喜您绑定成功')
166
-      }).catch(err => {
167
-        console.error(err)
160
+    if (!this.state.reportedCustomer) {
161
+      reportCustomer(person, consultant).then(() => {
162
+        this.setState({ reportedCustomer: true })
168
       })
163
       })
169
     }
164
     }
170
   }
165
   }
198
     }
193
     }
199
   }
194
   }
200
 
195
 
196
+  // 手机号获取成功就报备客户
197
+  handleAuthPhoneSuccess = () => {
198
+    // 报备放到页面生命周期里面了
199
+    // this.reportClientFn()
200
+  }
201
+
201
   handleSignup() {
202
   handleSignup() {
202
     const { detail: { buildingId, dynamicId }, isSign } = this.state
203
     const { detail: { buildingId, dynamicId }, isSign } = this.state
203
     const { userInfo: { person: { phone, name, nickname } } } = this.props
204
     const { userInfo: { person: { phone, name, nickname } } } = this.props
258
       }
259
       }
259
     })
260
     })
260
   }
261
   }
262
+
261
   getPosterData = () => {
263
   getPosterData = () => {
262
     return new Promise(resolve => {
264
     return new Promise(resolve => {
263
       const { posterData } = this.state
265
       const { posterData } = this.state
295
       })
297
       })
296
     })
298
     })
297
   }
299
   }
300
+
298
   // 开始生成海报
301
   // 开始生成海报
299
   togglePosterStatus = (flag) => {
302
   togglePosterStatus = (flag) => {
300
     if (flag) {
303
     if (flag) {
393
   }
396
   }
394
 
397
 
395
   render() {
398
   render() {
399
+    const router = Taro.getStorageSync('router')
396
     const { detail, loaded, isSaved, isSign, posterVisible, posterData, posterShow, consultData, consultShow } = this.state
400
     const { detail, loaded, isSaved, isSign, posterVisible, posterData, posterShow, consultData, consultShow } = this.state
397
-    const { userInfo: { person: { phone, personId, nickname, name } } } = this.props
401
+    const { userInfo = {} } = this.props
402
+    const { person: { phone, personId, nickname, name, tel } = {} } = userInfo
403
+    const consultant = this.$router.params.consultant || router.query.consultant || ""
404
+
398
     return (
405
     return (
399
       <Block>
406
       <Block>
400
         {/* 生成海报 */}
407
         {/* 生成海报 */}
401
         {posterVisible && (<Poster data={posterData} toggle={this.togglePosterStatus}></Poster>)}
408
         {posterVisible && (<Poster data={posterData} toggle={this.togglePosterStatus}></Poster>)}
402
 
409
 
410
+        {
411
+          (personId && !phone && !tel && consultant) &&
412
+          <AchievePhone user={userInfo.person} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
413
+        }
414
+
403
         {
415
         {
404
           loaded && (
416
           loaded && (
405
             <View>
417
             <View>

+ 13
- 16
src/pages/news/detail/index.js 查看文件

9
 import { getMiniQrcode, savePoint, updatePoint } from '@services/common'
9
 import { getMiniQrcode, savePoint, updatePoint } from '@services/common'
10
 import { getDownloadURL, transferImage } from '@utils/tools'
10
 import { getDownloadURL, transferImage } from '@utils/tools'
11
 import { getQrCodeParams } from '@utils/qrcode'
11
 import { getQrCodeParams } from '@utils/qrcode'
12
+import { report as reportCustomer } from '@utils/qrcode'
12
 import { getCardDetail } from '@services/card'
13
 import { getCardDetail } from '@services/card'
13
 import { ROLE_CODE } from '@constants/user'
14
 import { ROLE_CODE } from '@constants/user'
14
 import Consultant from '@components/consultant'
15
 import Consultant from '@components/consultant'
39
     posterData: {},
40
     posterData: {},
40
     posterVisible: false,
41
     posterVisible: false,
41
     consultData: {}, // 分享的置业顾问信息
42
     consultData: {}, // 分享的置业顾问信息
42
-    consultShow: false  // 置业顾问悬浮框显示隐藏
43
+    consultShow: false,  // 置业顾问悬浮框显示隐藏
44
+    reportedCustomer: false,
43
   }
45
   }
44
 
46
 
45
   componentWillMount(options) {
47
   componentWillMount(options) {
76
     })
78
     })
77
   }
79
   }
78
 
80
 
81
+  componentWillReceiveProps(nextProps) {
82
+    this.reportClientFn()
83
+  }
84
+
79
   componentWillUnmount() {
85
   componentWillUnmount() {
80
     const { recordId } = this.state
86
     const { recordId } = this.state
81
     recordId && updatePoint(recordId)
87
     recordId && updatePoint(recordId)
89
       }
95
       }
90
     })
96
     })
91
   }
97
   }
98
+  
92
   // 报备客户
99
   // 报备客户
93
   reportClientFn() {
100
   reportClientFn() {
94
-
95
     const router = Taro.getStorageSync('router') || { query: {} }
101
     const router = Taro.getStorageSync('router') || { query: {} }
96
     const consultant = this.$router.params.consultant || router.query.consultant || ""
102
     const consultant = this.$router.params.consultant || router.query.consultant || ""
97
     const consultantId = this.$router.params.consultantId || router.query.consultantId || ""
103
     const consultantId = this.$router.params.consultantId || router.query.consultantId || ""
98
-    const { userInfo: { person: { phone, tel, personId } } } = this.props
99
-
100
-    if (consultant && consultant != personId) {
101
-      const realPhone = phone || tel
102
-      const payload = {
103
-        realtyConsultant: consultant, //报备人 置业顾问
104
-        phone: realPhone,
105
-        showToast: false
106
-      }
107
-      reportClient(payload).then(res => {
108
-        console.log('恭喜您绑定成功')
109
-      }).catch(err => {
110
-        console.error(err)
104
+    const { userInfo: { person } } = this.props
105
+
106
+    if (!this.state.reportedCustomer) {
107
+      reportCustomer(person, consultant).then(() => {
108
+        this.setState({ reportedCustomer: true })
111
       })
109
       })
112
     }
110
     }
113
   }
111
   }
249
     })
247
     })
250
 
248
 
251
     if (consultant) {
249
     if (consultant) {
252
-      this.reportClientFn()
253
       getCardDetail(consultant).then(res => {
250
       getCardDetail(consultant).then(res => {
254
         this.setState({
251
         this.setState({
255
           consultData: res,
252
           consultData: res,

+ 17
- 28
src/pages/project/detail/index.js 查看文件

4
 import Banner from '../banner'
4
 import Banner from '../banner'
5
 import HelpGroupBanner from '../swiper'
5
 import HelpGroupBanner from '../swiper'
6
 import Poster from './poster'
6
 import Poster from './poster'
7
-import { reportClient } from '@services/report'
8
 import Around from './Around/around'
7
 import Around from './Around/around'
9
 import BackHomeBtn from '@components/BackHomeBtn'
8
 import BackHomeBtn from '@components/BackHomeBtn'
10
 import AchievePhone from '@components/achievePhone'
9
 import AchievePhone from '@components/achievePhone'
29
 import { ROLE_CODE } from '@constants/user'
28
 import { ROLE_CODE } from '@constants/user'
30
 import { getCardDetail } from '@services/card'
29
 import { getCardDetail } from '@services/card'
31
 import Consultant from '@components/consultant'
30
 import Consultant from '@components/consultant'
31
+import { report as reportCustomer } from '@utils/customer'
32
 import * as noticeType from '@constants/common.js'
32
 import * as noticeType from '@constants/common.js'
33
 
33
 
34
 const buildBg = 'https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/images/buildbg.png'
34
 const buildBg = 'https://estateagents.oss-cn-shanghai.aliyuncs.com/miniapp/images/buildbg.png'
64
     btnstate: 0,// 1显示视频 0显示图片
64
     btnstate: 0,// 1显示视频 0显示图片
65
     albumCurrent: 0,
65
     albumCurrent: 0,
66
     videoPlayShow: 'flex',
66
     videoPlayShow: 'flex',
67
-    grantPhoneVisible: false, // 授权手机弹框
68
     consultData: {}, // 分享的置业顾问信息
67
     consultData: {}, // 分享的置业顾问信息
69
-    consultShow: false  // 置业顾问悬浮框显示隐藏
68
+    consultShow: false,  // 置业顾问悬浮框显示隐藏
69
+    reportedCustomer: false,
70
   }
70
   }
71
 
71
 
72
   componentWillMount() {
72
   componentWillMount() {
82
         Taro.reLaunch({ url: '/pages/auth/index' })
82
         Taro.reLaunch({ url: '/pages/auth/index' })
83
         return
83
         return
84
       }
84
       }
85
-      this.setState({
86
-        grantPhoneVisible: true,
87
-      })
88
-      // }
89
 
85
 
90
       const id = this.$router.params.id || router.query.id
86
       const id = this.$router.params.id || router.query.id
91
 
87
 
119
     })
115
     })
120
   }
116
   }
121
 
117
 
118
+  componentWillReceiveProps() {
119
+    this.reportClientFn()
120
+  }
121
+
122
   // 报备客户
122
   // 报备客户
123
   reportClientFn() {
123
   reportClientFn() {
124
-    const router = Taro.getStorageSync('router') || { query: {} }
124
+    const router = Taro.getStorageSync('router')
125
     const consultant = this.$router.params.consultant || router.query.consultant || ""
125
     const consultant = this.$router.params.consultant || router.query.consultant || ""
126
-    const { userInfo: { person: { phone, tel, personId } } } = this.props
127
-
128
-    if (consultant && consultant != personId) {
129
-      const realPhone = phone || tel
130
-      const payload = {
131
-        realtyConsultant: consultant, //报备人 置业顾问
132
-        phone: realPhone,
133
-        showToast: false
134
-      }
135
-      reportClient(payload).then(res => {
136
-        console.log('恭喜您绑定成功')
137
-      }).catch(err => {
138
-        console.error(err)
126
+    const { userInfo: { person } } = this.props
127
+
128
+    if (!this.state.reportedCustomer) {
129
+      reportCustomer(person, consultant).then(() => {
130
+        this.setState({ reportedCustomer: true })
139
       })
131
       })
140
     }
132
     }
141
   }
133
   }
228
         console.log('项目详情')
220
         console.log('项目详情')
229
       })
221
       })
230
       if (consultant) {
222
       if (consultant) {
231
-        this.reportClientFn()
232
         getCardDetail(consultant).then(res => {
223
         getCardDetail(consultant).then(res => {
233
           this.setState({
224
           this.setState({
234
             consultData: res,
225
             consultData: res,
318
   navigateTo(url) {
309
   navigateTo(url) {
319
     Taro.navigateTo({ url: url })
310
     Taro.navigateTo({ url: url })
320
   }
311
   }
312
+
321
   // 海报预览图
313
   // 海报预览图
322
   previewImage(arr) {
314
   previewImage(arr) {
323
     // console.log('arr:' + arr)
315
     // console.log('arr:' + arr)
389
       const { userInfo: { person: { personId, nickname, name } } } = this.props
381
       const { userInfo: { person: { personId, nickname, name } } } = this.props
390
       const { userInfo: { miniApp: { tpls } } } = this.props
382
       const { userInfo: { miniApp: { tpls } } } = this.props
391
       const tplId = (tpls.filter(x => x.tplType == noticeType.TPL_NOTICE && x.isSubscribe == true))[0].tplId
383
       const tplId = (tpls.filter(x => x.tplType == noticeType.TPL_NOTICE && x.isSubscribe == true))[0].tplId
384
+
392
       wx.requestSubscribeMessage({
385
       wx.requestSubscribeMessage({
393
         tmplIds: [tplId],
386
         tmplIds: [tplId],
394
         success(res) {
387
         success(res) {
492
           icon: 'none'
485
           icon: 'none'
493
         })
486
         })
494
       }
487
       }
495
-
496
     }
488
     }
497
-
498
   }
489
   }
499
 
490
 
500
   handleTelClick(item, e) {
491
   handleTelClick(item, e) {
653
     })
644
     })
654
   }
645
   }
655
 
646
 
656
-
657
-
658
   handleAuthPhoneSuccess = () => {
647
   handleAuthPhoneSuccess = () => {
659
     const { person = {} } = this.props.userInfo || {}
648
     const { person = {} } = this.props.userInfo || {}
660
     if ((person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
649
     if ((person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
1206
   }
1195
   }
1207
 
1196
 
1208
   render() {
1197
   render() {
1209
-    const { posterStatus, posterData, loaded, btnstate, grantPhoneVisible, consultData, consultShow } = this.state
1198
+    const { posterStatus, posterData, loaded, btnstate, consultData, consultShow } = this.state
1210
     const { projectDetail, userInfo = { person: {} } } = this.props
1199
     const { projectDetail, userInfo = { person: {} } } = this.props
1211
     const { uvList = {} } = projectDetail
1200
     const { uvList = {} } = projectDetail
1212
     const { total = 0, records = [] } = uvList
1201
     const { total = 0, records = [] } = uvList
1214
     return (
1203
     return (
1215
       <Block>
1204
       <Block>
1216
         {
1205
         {
1217
-          (grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone && !userInfo.person.tel) &&
1206
+          (userInfo.person.personId && !userInfo.person.phone && !userInfo.person.tel) &&
1218
           <AchievePhone user={userInfo.person} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
1207
           <AchievePhone user={userInfo.person} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
1219
         }
1208
         }
1220
         {
1209
         {

+ 38
- 0
src/utils/customer.js 查看文件

1
+
2
+import { reportClient } from '@services/report'
3
+
4
+/**
5
+ * 报备客户
6
+ * @param {*} userInfo 
7
+ * @param {*} consultant 
8
+ * @param {*} showToast 
9
+ */
10
+export function report(person, consultant, showToast) {
11
+  if (!person || !(person.tel || person.phone)) {
12
+    return Promise.reject('用户手机号不存在');
13
+  }
14
+
15
+  if (!consultant) {
16
+    return Promise.reject('置业顾问信息不存在');
17
+  }
18
+
19
+  if (consultant == person.personId || consultant == person.userId) {
20
+    return Promise.resolve();
21
+  }
22
+
23
+  const realPhone = person.tel || person.phone
24
+  const payload = {
25
+    realtyConsultant: consultant, //报备人 置业顾问
26
+    phone: realPhone,
27
+    showToast,
28
+  }
29
+
30
+  return new Promise((resolve, reject) => {
31
+    reportClient(payload).then(res => {
32
+      resolve()
33
+    }).catch(err => {
34
+      console.error(err)
35
+      reject(err.message || err)
36
+    })
37
+  })
38
+}