Sfoglia il codice sorgente

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

Your Name 3 anni fa
parent
commit
e11fa9cb53

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

@@ -14,6 +14,10 @@ export const resolvePath = api => `${host + pathname}/${api}`
14 14
 
15 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 22
 export const API_COURSE_LIST = resolvePath('curriculum') // 课程列表
19 23
 export const API_MY_COLLECT_COURSE_LIST = resolvePath('curriculum/save') // 我收藏的课程列表

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

@@ -59,7 +59,7 @@ export default withLayout((props) => {
59 59
       if (type === 'consultant') {
60 60
         params = { name: FormData.name, phone: FormData.phone, sex: SexId }
61 61
       } else {
62
-        params = { ...FormData, sex: SexId, intention: BuildingId, realtyConsultant: CardId }
62
+        params = { ...FormData, sex: SexId, buildingId: BuildingId, realtyConsultant: CardId }
63 63
       }
64 64
       if (type === 'estateAgent') {
65 65
         params.channelCustomerId = PersonId
@@ -144,14 +144,10 @@ export default withLayout((props) => {
144 144
       Taro.showToast({ title: '请填写正确的客户电话', icon: 'none' })
145 145
       return false
146 146
     }
147
-    if (BuildingId === null) {
147
+    if (BuildingId === null && type !== 'consultant') {
148 148
       Taro.showToast({ title: '请选择客户的意向楼盘', icon: 'none' })
149 149
       return false
150 150
     }
151
-    if (CardId === null) {
152
-      Taro.showToast({ title: '请选择内场接待', icon: 'none' })
153
-      return false
154
-    }
155 151
     if (!CanSubmit) {
156 152
       setCanSubmit(true)
157 153
     }
@@ -180,37 +176,36 @@ export default withLayout((props) => {
180 176
           <text>性别</text>
181 177
           <view className='FormLine flex-h'>
182 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 180
                 <text>{SexName || '请选择'}</text>
185 181
               </Picker>
186 182
             </view>
187 183
             <text className='iconfont icon-jiantoudown'></text>
188 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 187
             type !== 'consultant' &&
213 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 209
               <text>备注</text>
215 210
               <view className='FormLine flex-h'>
216 211
                 <view className='flex-item'>

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

@@ -1,5 +1,8 @@
1 1
 import { useState, useEffect } from 'react'
2 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 6
 import './index.scss'
4 7
 
5 8
 export default function EditUserDetailBasicInfo (props) {
@@ -15,11 +18,20 @@ export default function EditUserDetailBasicInfo (props) {
15 18
   useEffect(() => {
16 19
     if(CanSubmit) {
17 20
       setCanSubmit(false)
18
-      console.log(FormData)
19
-      close()
21
+      ToSubmit()
20 22
     }
21 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 35
   const PickerChange = (key, e) => {
24 36
     let resData = FormData
25 37
     if (key === 'age') {

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

@@ -4,7 +4,7 @@ import withLayout from '@/layout'
4 4
 import '@/assets/css/iconfont.css'
5 5
 import { Image, Textarea } from '@tarojs/components'
6 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 8
 import { getImgURL } from '@/utils/image'
9 9
 import './index.scss'
10 10
 import UserDetailBasicInfo from '../components/UserDetailBasicInfo/index'
@@ -28,7 +28,7 @@ export default withLayout((props) => {
28 28
 
29 29
   useEffect(() => {
30 30
     if (CustomerId) {
31
-      fetch({ url: `${API_CUSTOMER_DETAILINFO}/${CustomerId}` }).then((res) => {
31
+      fetch({ url: `${API_GET_CUSTOMER_INFO}${CustomerId}` }).then((res) => {
32 32
         setCustomerInfo(res)
33 33
       })
34 34
     }

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

@@ -7,7 +7,7 @@ import '@/assets/css/iconfont.css'
7 7
 import { fetch } from '@/utils/request'
8 8
 import { API_PUT_REGISTERCONSULTANT } from '@/constants/api'
9 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 11
 import store from '@/store'
12 12
 import './index.scss'
13 13
 import NeedLogin from './components/NeedLogin'
@@ -29,7 +29,7 @@ export default withLayout(() => {
29 29
     setShowLogin(false)
30 30
     if (user?.userInfo?.person?.personId) {
31 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 34
   }, [user])
35 35