Browse Source

Merge branch 'main' of http://git.ycjcjy.com/marketing/miniapp into main

Your Name 3 years ago
parent
commit
e11fa9cb53

+ 4
- 0
src/constants/api.js View File

14
 
14
 
15
 export const API_CITY_AREA = resolvePath('tdCityList/tdAreaCity') // 城市下区域查询
15
 export const API_CITY_AREA = resolvePath('tdCityList/tdAreaCity') // 城市下区域查询
16
 
16
 
17
+// 客户
18
+export const API_SAVE_CUSTOMER_INFO = resolvePath('customerInfo') // 保存客户信息
19
+export const API_GET_CUSTOMER_INFO = resolvePath('customerInfo/') // 查询客户信息
20
+
17
 // 课程
21
 // 课程
18
 export const API_COURSE_LIST = resolvePath('curriculum') // 课程列表
22
 export const API_COURSE_LIST = resolvePath('curriculum') // 课程列表
19
 export const API_MY_COLLECT_COURSE_LIST = resolvePath('curriculum/save') // 我收藏的课程列表
23
 export const API_MY_COLLECT_COURSE_LIST = resolvePath('curriculum/save') // 我收藏的课程列表

+ 23
- 28
src/pages/mine/addCustomer/index.jsx View File

59
       if (type === 'consultant') {
59
       if (type === 'consultant') {
60
         params = { name: FormData.name, phone: FormData.phone, sex: SexId }
60
         params = { name: FormData.name, phone: FormData.phone, sex: SexId }
61
       } else {
61
       } else {
62
-        params = { ...FormData, sex: SexId, intention: BuildingId, realtyConsultant: CardId }
62
+        params = { ...FormData, sex: SexId, buildingId: BuildingId, realtyConsultant: CardId }
63
       }
63
       }
64
       if (type === 'estateAgent') {
64
       if (type === 'estateAgent') {
65
         params.channelCustomerId = PersonId
65
         params.channelCustomerId = PersonId
144
       Taro.showToast({ title: '请填写正确的客户电话', icon: 'none' })
144
       Taro.showToast({ title: '请填写正确的客户电话', icon: 'none' })
145
       return false
145
       return false
146
     }
146
     }
147
-    if (BuildingId === null) {
147
+    if (BuildingId === null && type !== 'consultant') {
148
       Taro.showToast({ title: '请选择客户的意向楼盘', icon: 'none' })
148
       Taro.showToast({ title: '请选择客户的意向楼盘', icon: 'none' })
149
       return false
149
       return false
150
     }
150
     }
151
-    if (CardId === null) {
152
-      Taro.showToast({ title: '请选择内场接待', icon: 'none' })
153
-      return false
154
-    }
155
     if (!CanSubmit) {
151
     if (!CanSubmit) {
156
       setCanSubmit(true)
152
       setCanSubmit(true)
157
     }
153
     }
180
           <text>性别</text>
176
           <text>性别</text>
181
           <view className='FormLine flex-h'>
177
           <view className='FormLine flex-h'>
182
             <view className='flex-item'>
178
             <view className='flex-item'>
183
-              <Picker range-key='name' onChange={SexPickerChange} value={0} range={SexList}>
179
+              <Picker range-key='name' onChange={SexPickerChange} value={null} range={SexList}>
184
                 <text>{SexName || '请选择'}</text>
180
                 <text>{SexName || '请选择'}</text>
185
               </Picker>
181
               </Picker>
186
             </view>
182
             </view>
187
             <text className='iconfont icon-jiantoudown'></text>
183
             <text className='iconfont icon-jiantoudown'></text>
188
           </view>
184
           </view>
189
 
185
 
190
-
191
-          <text>意向楼盘</text>
192
-          <view className='FormLine flex-h'>
193
-            <view className='flex-item'>
194
-              <Picker range-key='name' onChange={PickerChange} value={0} range={BuildingList}>
195
-                <text>{BuildingName || '请选择'}</text>
196
-              </Picker>
197
-            </view>
198
-          </view>
199
-
200
-          <text>内场接待(选填)</text>
201
-          <view className='FormLine flex-h'>
202
-            <view className='flex-item'>
203
-              <Picker range-key='name' onChange={CardPickerChange} value={0} range={CardList}>
204
-                <text>{CardName || '请选择'}</text>
205
-              </Picker>
206
-            </view>
207
-            <Image mode='heightFix' src={defaultSpecialImage}></Image>
208
-            <text>选择</text>
209
-          </view>
210
-
211
           {
186
           {
212
             type !== 'consultant' &&
187
             type !== 'consultant' &&
213
             <Block>
188
             <Block>
189
+              <text>意向楼盘</text>
190
+              <view className='FormLine flex-h'>
191
+                <view className='flex-item'>
192
+                  <Picker range-key='name' onChange={PickerChange} value={null} range={BuildingList}>
193
+                    <text>{BuildingName || '请选择'}</text>
194
+                  </Picker>
195
+                </view>
196
+              </view>
197
+
198
+              <text>内场接待(选填)</text>
199
+              <view className='FormLine flex-h'>
200
+                <view className='flex-item'>
201
+                  <Picker range-key='name' onChange={CardPickerChange} value={null} range={CardList}>
202
+                    <text>{CardName || '请选择'}</text>
203
+                  </Picker>
204
+                </view>
205
+                <Image mode='heightFix' src={defaultSpecialImage}></Image>
206
+                <text>选择</text>
207
+              </view>
208
+
214
               <text>备注</text>
209
               <text>备注</text>
215
               <view className='FormLine flex-h'>
210
               <view className='FormLine flex-h'>
216
                 <view className='flex-item'>
211
                 <view className='flex-item'>

+ 14
- 2
src/pages/mine/components/EditUserDetailBasicInfo/index.jsx View File

1
 import { useState, useEffect } from 'react'
1
 import { useState, useEffect } from 'react'
2
 import { ScrollView, Input, Picker } from '@tarojs/components'
2
 import { ScrollView, Input, Picker } from '@tarojs/components'
3
+import { fetch } from '@/utils/request'
4
+import { API_SAVE_CUSTOMER_INFO } from '@/constants/api'
5
+import Taro from '@tarojs/taro'
3
 import './index.scss'
6
 import './index.scss'
4
 
7
 
5
 export default function EditUserDetailBasicInfo (props) {
8
 export default function EditUserDetailBasicInfo (props) {
15
   useEffect(() => {
18
   useEffect(() => {
16
     if(CanSubmit) {
19
     if(CanSubmit) {
17
       setCanSubmit(false)
20
       setCanSubmit(false)
18
-      console.log(FormData)
19
-      close()
21
+      ToSubmit()
20
     }
22
     }
21
   }, [CanSubmit])
23
   }, [CanSubmit])
22
 
24
 
25
+  const ToSubmit = () => {
26
+    let params = {}
27
+    fetch({ API_SAVE_CUSTOMER_INFO, method: 'post', payload: params }).then(() => {
28
+      Taro.showToast({ title: '修改成功', icon: 'none', duration: 2000 })
29
+      close()
30
+    }).catch(() => {
31
+      setCanSubmit(false)
32
+    })
33
+  }
34
+
23
   const PickerChange = (key, e) => {
35
   const PickerChange = (key, e) => {
24
     let resData = FormData
36
     let resData = FormData
25
     if (key === 'age') {
37
     if (key === 'age') {

+ 2
- 2
src/pages/mine/customerDetail/index.jsx View File

4
 import '@/assets/css/iconfont.css'
4
 import '@/assets/css/iconfont.css'
5
 import { Image, Textarea } from '@tarojs/components'
5
 import { Image, Textarea } from '@tarojs/components'
6
 import { fetch } from '@/utils/request'
6
 import { fetch } from '@/utils/request'
7
-import { API_CUSTOMER_DETAILINFO, API_FOLLOW_LIST } from '@/constants/api'
7
+import { API_GET_CUSTOMER_INFO, API_FOLLOW_LIST } from '@/constants/api'
8
 import { getImgURL } from '@/utils/image'
8
 import { getImgURL } from '@/utils/image'
9
 import './index.scss'
9
 import './index.scss'
10
 import UserDetailBasicInfo from '../components/UserDetailBasicInfo/index'
10
 import UserDetailBasicInfo from '../components/UserDetailBasicInfo/index'
28
 
28
 
29
   useEffect(() => {
29
   useEffect(() => {
30
     if (CustomerId) {
30
     if (CustomerId) {
31
-      fetch({ url: `${API_CUSTOMER_DETAILINFO}/${CustomerId}` }).then((res) => {
31
+      fetch({ url: `${API_GET_CUSTOMER_INFO}${CustomerId}` }).then((res) => {
32
         setCustomerInfo(res)
32
         setCustomerInfo(res)
33
       })
33
       })
34
     }
34
     }

+ 2
- 2
src/pages/mine/index.jsx View File

7
 import { fetch } from '@/utils/request'
7
 import { fetch } from '@/utils/request'
8
 import { API_PUT_REGISTERCONSULTANT } from '@/constants/api'
8
 import { API_PUT_REGISTERCONSULTANT } from '@/constants/api'
9
 import { getImgURL } from '@/utils/image'
9
 import { getImgURL } from '@/utils/image'
10
-import { UPDATE_USER_INFO } from '@/constants/user'
10
+import { UPDATE_USER_INFO, ROLE_CODE } from '@/constants/user'
11
 import store from '@/store'
11
 import store from '@/store'
12
 import './index.scss'
12
 import './index.scss'
13
 import NeedLogin from './components/NeedLogin'
13
 import NeedLogin from './components/NeedLogin'
29
     setShowLogin(false)
29
     setShowLogin(false)
30
     if (user?.userInfo?.person?.personId) {
30
     if (user?.userInfo?.person?.personId) {
31
       const person = user.userInfo.person
31
       const person = user.userInfo.person
32
-      setUserRole(person.personType === 'customer' || person.personType === 'drift' ? 1 : person.personType === 'estate agent' || person.personType === 'channel agent' ? 2 : person.personType === 'Realty Consultant' ? 3 : 4)
32
+      setUserRole(person.personType === ROLE_CODE.CUSTOMER ? 1 : person.personType === ROLE_CODE.CHANNEL_AGENT ? 2 : person.personType === ROLE_CODE.CONSULTANT ? 3 : 4)
33
     }
33
     }
34
   }, [user])
34
   }, [user])
35
 
35