1002884655 hace 3 años
padre
commit
882615fdae

+ 6
- 7
src/pages/mine/addCustomer/index.jsx Ver fichero

@@ -6,7 +6,6 @@ import { useSelector } from 'react-redux'
6 6
 import { fetch } from '@/utils/request'
7 7
 import { API_ITEMS_LIST, API_CARDS_LIST, API_REPORT_CUETOMER, API_USER_ADD_CUSTOMER, API_CHANNEL_REPORT } from '@/constants/api'
8 8
 import Taro from '@tarojs/taro'
9
-import { ROLE_CODE } from '@/constants/user'
10 9
 import './index.scss'
11 10
 
12 11
 const defaultSpecialImage = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg'
@@ -49,20 +48,20 @@ export default withLayout((props) => {
49 48
   useEffect(() => {
50 49
     if (CanSubmit) {
51 50
       let url = null
52
-      if (type === ROLE_CODE.CONSULTANT) { // 置业顾问
51
+      if (type === 'consultant') { // 置业顾问
53 52
         url = API_REPORT_CUETOMER
54
-      } else if (type === ROLE_CODE.CUSTOMER) { // 普通客户
53
+      } else if (type === 'customer') { // 普通客户
55 54
         url = API_USER_ADD_CUSTOMER
56 55
       } else { // 经纪人
57 56
         url = API_CHANNEL_REPORT
58 57
       }
59 58
       let params = {}
60
-      if (type === ROLE_CODE.CONSULTANT) {
59
+      if (type === 'consultant') {
61 60
         params = { name: FormData.name, phone: FormData.phone, sex: SexId }
62 61
       } else {
63 62
         params = { ...FormData, sex: SexId, buildingId: BuildingId, realtyConsultant: CardId }
64 63
       }
65
-      if (type === ROLE_CODE.CHANNEL_AGENT) {
64
+      if (type === 'estateAgent') {
66 65
         params.channelCustomerId = PersonId
67 66
         params.channelId = user.userInfo.person.channelId
68 67
         params.buildingId = BuildingId
@@ -145,7 +144,7 @@ export default withLayout((props) => {
145 144
       Taro.showToast({ title: '请填写正确的客户电话', icon: 'none' })
146 145
       return false
147 146
     }
148
-    if (BuildingId === null && type !== ROLE_CODE.CONSULTANT) {
147
+    if (BuildingId === null && type !== 'consultant') {
149 148
       Taro.showToast({ title: '请选择客户的意向楼盘', icon: 'none' })
150 149
       return false
151 150
     }
@@ -185,7 +184,7 @@ export default withLayout((props) => {
185 184
           </view>
186 185
 
187 186
           {
188
-            type !== ROLE_CODE.CONSULTANT &&
187
+            type !== 'consultant' &&
189 188
             <Block>
190 189
               <text>意向楼盘</text>
191 190
               <view className='FormLine flex-h'>

+ 14
- 2
src/pages/mine/components/EditUserDetailBasicInfo/index.jsx Ver fichero

@@ -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 Ver fichero

@@ -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
     }