Procházet zdrojové kódy

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

1002884655 před 3 roky
rodič
revize
a2291bcd09

+ 2
- 2
config/dev.js Zobrazit soubor

@@ -3,8 +3,8 @@ module.exports = {
3 3
     NODE_ENV: '"development"'
4 4
   },
5 5
   defineConstants: {
6
-    HOST: '"https://xlk.njyz.tech"',
7
-    // HOST: '"http://127.0.0.1:8081"',
6
+    // HOST: '"https://xlk.njyz.tech"',
7
+    HOST: '"http://127.0.0.1:8081"',
8 8
     WSS_HOST: '"ws://127.0.0.1:8081"',
9 9
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10 10
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',

+ 6
- 0
src/constants/api.js Zobrazit soubor

@@ -296,3 +296,9 @@ export const API_FEEDBACK_SETTING = resolvePath('searchHouse/setting')
296 296
 
297 297
 // 系统参数
298 298
 export const API_SYSTEM_PARAM = resolvePath('sysOrgParams')
299
+
300
+// 渠道-龙虎榜
301
+export const API_CHANNEL_RANK = resolvePath('ranklist')
302
+
303
+// 获取报备客户详情
304
+export const API_CHANNEL_CUSTOMER_DETAIL = resolvePath('channelCustomer')

+ 1
- 0
src/pages/mine/components/MyActivityListItem/index.jsx Zobrazit soubor

@@ -4,6 +4,7 @@ import Taro from '@tarojs/taro'
4 4
 
5 5
 export default function MyActivityListItem (props) {
6 6
   const { Data = {} } = props
7
+
7 8
   return (
8 9
     <view className='components MyActivityListItem' onClick={() => { Taro.navigateTo({ url: `/pages/index/activityDetail/index?id=${Data.id}` }) }}>
9 10
       <view className='Img'>

+ 7
- 1
src/pages/mine/components/MyCustomerListItem/index.jsx Zobrazit soubor

@@ -10,8 +10,14 @@ export default function MyCustomerListItem (props) {
10 10
   const { expirationDate, customerStatus } = data
11 11
   const expStr = expirationDate && customerStatus === '1' ? `${expirationDate.substring(0, 10)} 回收` : ''
12 12
 
13
+  const gotoDetail = () => {
14
+    const id = data.channelCustomerId || data.customerId
15
+    const url = `/pages/mine/myCustomerDetail/index?id=${id}`
16
+    Taro.navigateTo({ url })
17
+  }
18
+
13 19
   return (
14
-    <view className='components MyCustomerListItem flex-h' onClick={() => { Taro.navigateTo({ url: `/pages/mine/myCustomerDetail/index?id=${data.customerId}` }) }}>
20
+    <view className='components MyCustomerListItem flex-h' onClick={gotoDetail}>
15 21
       <view className='Img'>
16 22
         <Image mode='scaleToFill' src={data.avatarurl}></Image>
17 23
       </view>

+ 27
- 15
src/pages/mine/customerDetail/index.jsx Zobrazit soubor

@@ -5,7 +5,9 @@ import '@/assets/css/iconfont.css'
5 5
 import { Image, Textarea } from '@tarojs/components'
6 6
 import { fetch } from '@/utils/request'
7 7
 import { API_GET_CUSTOMER_INFO, API_FOLLOW_LIST } from '@/constants/api'
8
+import { getCustomerDetail, addFollowRecord } from '@/services/person'
8 9
 import { getImgURL } from '@/utils/image'
10
+import { BIZ_STATUS } from '@/constants/user'
9 11
 import './index.scss'
10 12
 import UserDetailBasicInfo from '../components/UserDetailBasicInfo/index'
11 13
 import UserDetailViewRecord from '../components/UserDetailViewRecord/index'
@@ -13,9 +15,10 @@ import UserDetailActivityInfo from '../components/UserDetailActivityInfo/index'
13 15
 import UserDetailFollowRecord from '../components/UserDetailFollowRecord/index'
14 16
 
15 17
 export default withLayout((props) => {
18
+  const { router, person } = props
19
+  const { id : CustomerId,  } = router.params
16 20
 
17
-  const { name, sex, phone, avatarurl, status } = props.router.params
18
-  const [CustomerId] = useState(props.router.params.id)
21
+  const [custBaseInfo, setCustBaseInfo] = useState({})
19 22
   const [CustomerInfo, setCustomerInfo] = useState({})
20 23
   const [ShowAddFollow, setShowAddFollow] = useState(false)
21 24
   const [MenuList] = useState([
@@ -28,12 +31,6 @@ export default withLayout((props) => {
28 31
   const [FollowContent, setFollowContent] = useState('')
29 32
   const [FollowAddCounts, setFollowAddCounts] = useState(0)
30 33
 
31
-  useEffect(() => {
32
-    if (CustomerId) {
33
-      UpdateCustomerInfo()
34
-    }
35
-  }, [CustomerId])
36
-
37 34
   const UpdateCustomerInfo = () => {
38 35
     fetch({ url: `${API_GET_CUSTOMER_INFO}${CustomerId}` }).then((res) => {
39 36
       if (res) {
@@ -57,7 +54,13 @@ export default withLayout((props) => {
57 54
   }
58 55
 
59 56
   const SaveFollow = () => {
60
-    fetch({ url: API_FOLLOW_LIST, method: 'post', payload: { recordType: '添加跟进', recordContent: FollowContent, customerSex: CustomerInfo.sex, customerId: CustomerId } }).then((res) => {
57
+    const payload = {
58
+      recordType: '添加跟进',
59
+      recordContent: FollowContent,
60
+      customerSex: CustomerInfo.sex,
61
+      customerId: CustomerId,
62
+    }
63
+    addFollowRecord(payload).then((res) => {
61 64
       Taro.showToast({
62 65
         title: '添加跟进成功',
63 66
         icon: 'none'
@@ -80,6 +83,15 @@ export default withLayout((props) => {
80 83
     setFollowContent('')
81 84
   }
82 85
 
86
+  useEffect(() => {
87
+    if (CustomerId) {
88
+      UpdateCustomerInfo()
89
+
90
+      getCustomerDetail(CustomerId).then((res) => setCustBaseInfo(res || {}))
91
+    }
92
+  }, [CustomerId])
93
+
94
+
83 95
   return (
84 96
     <view className='Page customerDetail flex-v'>
85 97
 
@@ -89,20 +101,20 @@ export default withLayout((props) => {
89 101
             <view className='centerLabel'>
90 102
               <view className='flex-h'>
91 103
                 <view className='Icon'>
92
-                  <Image mode='aspectFill' src={getImgURL(CustomerInfo.avatarurl || avatarurl)}></Image>
104
+                  <Image mode='aspectFill' src={getImgURL(custBaseInfo.avatarurl)}></Image>
93 105
                 </view>
94 106
                 <view className='flex-item'>
95 107
                   <view>
96
-                    <text>{CustomerInfo.name || name}</text>
97
-                    <text className={CustomerInfo.sex - 0 === 1 || sex - 0 === 1 ? 'iconfont icon-nanxing' : 'iconfont icon-nvxing'}></text>
108
+                    <text>{custBaseInfo.name}</text>
109
+                    <text className={custBaseInfo.sex - 0 === 1 ? 'iconfont icon-nanxing' : 'iconfont icon-nvxing'}></text>
98 110
                   </view>
99
-                  <text>{CustomerInfo.phone || phone}</text>
111
+                  <text>{custBaseInfo.phone}</text>
100 112
                 </view>
101 113
                 <text className='iconfont icon-liaotian'></text>
102
-                <text className='iconfont icon-dianhua' onClick={() => { Taro.makePhoneCall({ phoneNumber: CustomerInfo.phone || phone }) }}></text>
114
+                <text className='iconfont icon-dianhua' onClick={() => { Taro.makePhoneCall({ phoneNumber: custBaseInfo.phone }) }}></text>
103 115
               </view>
104 116
             </view>
105
-            <text className='Status'>{status - 0 === 1 || status - 0 === 0 ? '已报备' : status - 0 === 2 ? '已到访' : status - 0 === 3 ? '已认筹' : '已签约'}</text>
117
+            <text className='Status'>{BIZ_STATUS[custBaseInfo.status] || '报备'}</text>
106 118
             <text className='Tips'>NEW</text>
107 119
             <text className='Tips'>NEW</text>
108 120
           </view>

+ 15
- 18
src/pages/mine/myCustomerDetail/index.jsx Zobrazit soubor

@@ -1,32 +1,29 @@
1 1
 import React, { useState, useEffect } from 'react'
2 2
 import withLayout from '@/layout'
3
-import './index.scss'
3
+import { getChannelCustomerDetail } from '@/services/person'
4 4
 import { ScrollView, Image } from '@tarojs/components'
5 5
 import '@/assets/css/iconfont.css'
6
+import './index.scss'
7
+import { ROLE_CODE } from '@/constants/user'
6 8
 
7 9
 export default withLayout((props) => {
10
+  const { router, person } = props
11
+  const { id } = router.params
8 12
 
9
-  // const [PageProps] = useState(props)
10
-  const [IsPull, setPull] = useState(false)
11
-  const [PullTimer, setPullTimer] = useState(null)
12
-
13
-  const PageRefresh = () => { // 页面下拉刷新回调
14
-    setPull(true)
15
-  }
13
+  const [custBaseInfo, setCustBaseInfo] = useState({})
16 14
 
17
-  useEffect(() => { // 下拉刷新触发
18
-    if (IsPull) {
19
-      clearTimeout(PullTimer)
20
-      setPullTimer(setTimeout(() => {
21
-        setPull(false)
22
-      }, 2000))
15
+  useEffect(() => {
16
+    if (id) {
17
+      if (person.personType === ROLE_CODE.CHANNEL_AGENT) {
18
+        getChannelCustomerDetail(id).then((res) => setCustBaseInfo(res || {}))
19
+      }
23 20
     }
24
-  }, [IsPull])
21
+  }, [id, person])
25 22
 
26 23
   return (
27 24
     <view className='Page myCustomerDetail'>
28 25
 
29
-      <ScrollView scroll-y={true} refresher-enabled={true} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#f8f8f8'>
26
+      <ScrollView scrollY>
30 27
         <view className='PageContent'>
31 28
 
32 29
           {/* 基本信息 */}
@@ -40,8 +37,8 @@ export default withLayout((props) => {
40 37
                   <Image mode='aspectFill' src={null}></Image>
41 38
                 </view>
42 39
                 <view className='flex-item'>
43
-                  <text>范丞丞</text>
44
-                  <text>136 1394 9434</text>
40
+                  <text>{custBaseInfo.name}</text>
41
+                  <text>{custBaseInfo.phone}</text>
45 42
                 </view>
46 43
                 <text className='iconfont icon-jiantouright'></text>
47 44
               </view>

+ 34
- 16
src/pages/mine/partnerChannel/index.jsx Zobrazit soubor

@@ -1,17 +1,17 @@
1 1
 import React, { useState, useEffect } from 'react'
2 2
 import withLayout from '@/layout'
3
-import './index.scss'
4 3
 import { ScrollView, Image } from '@tarojs/components'
4
+import { getChannelRank } from '@/services/agent'
5
+import { fetch } from '@/utils/request'
6
+import { API_GET_AGENT_BUILDINGS } from '@/constants/api'
5 7
 import '@/assets/css/iconfont.css'
8
+import './index.scss'
6 9
 
7 10
 export default withLayout((props) => {
8
-
9
-  // const [PageProps] = useState(props)
10
-  const [RankingList, setRankingList] = useState([
11
-    { name: '范丞丞', id: '', icon: '', num: '5', department: '销售部' },
12
-    { name: '范丞丞', id: '', icon: '', num: '6', department: '销售部' },
13
-    { name: '范丞丞', id: '', icon: '', num: '3', department: '销售部' }
14
-  ])
11
+  
12
+  const [buildingId, setBuildingId] = useState()
13
+  const [buildingList, setBuildingList] = useState([])
14
+  const [rankList, setRankList] = useState([])
15 15
   const [IsPull, setPull] = useState(false)
16 16
   const [PullTimer, setPullTimer] = useState(null)
17 17
 
@@ -28,6 +28,24 @@ export default withLayout((props) => {
28 28
     }
29 29
   }, [IsPull])
30 30
 
31
+  useEffect(() => {
32
+    fetch({ url: API_GET_AGENT_BUILDINGS }).then((res) => {
33
+      const buildings = res || []
34
+      setBuildingList(buildings)
35
+      if (buildings.length) {
36
+        setBuildingId(buildings[0].buildingId)
37
+      }
38
+    })
39
+  }, [])
40
+
41
+  useEffect(() => {
42
+    if (buildingId) {
43
+      getChannelRank({buildingId}).then((res) => {
44
+        setRankList(res || [])
45
+      })
46
+    }
47
+  }, [buildingId])
48
+
31 49
   return (
32 50
     <view className='Page partnerChannel'>
33 51
       <ScrollView scroll-y={true} refresher-enabled={true} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
@@ -37,34 +55,34 @@ export default withLayout((props) => {
37 55
           <view className='Ranking'>
38 56
             <view className='Top flex-h'>
39 57
               <text className='flex-item'>龙虎榜</text>
40
-              <Image mode='heightFix' src={require('../../../assets/mine-icon23.png')}></Image>
58
+              <Image mode='heightFix' src={require('@/assets/mine-icon23.png')}></Image>
41 59
             </view>
42 60
             <view className='List flex-h'>
43 61
               {
44
-                RankingList.map((item, index) => (
62
+                rankList.map((item, index) => (
45 63
                   <view className={index === 1 ? 'flex-item active' : 'flex-item'} key={`ListItem-${index}`}>
46 64
                     {
47 65
                       index === 0 &&
48
-                      <Image mode='heightFix' src={require('../../../assets/mine-icon21.png')}></Image>
66
+                      <Image mode='heightFix' src={require('@/assets/mine-icon21.png')}></Image>
49 67
                     }
50 68
                     {
51 69
                       index === 1 &&
52
-                      <Image mode='heightFix' src={require('../../../assets/mine-icon20.png')}></Image>
70
+                      <Image mode='heightFix' src={require('@/assets/mine-icon20.png')}></Image>
53 71
                     }
54 72
                     {
55 73
                       index === 2 &&
56
-                      <Image mode='heightFix' src={require('../../../assets/mine-icon22.png')}></Image>
74
+                      <Image mode='heightFix' src={require('@/assets/mine-icon22.png')}></Image>
57 75
                     }
58 76
                     <view className='Icon'>
59
-                      <Image mode='aspectFill' src={item.icon || null}></Image>
77
+                      <Image mode='aspectFill' src={item.avatarurl || null}></Image>
60 78
                     </view>
61 79
                     <view className='Index'>
62 80
                       <text>{item.name}</text>
63 81
                       <text>{index === 0 ? 2 : index === 1 ? 1 : 3}</text>
64 82
                     </view>
65 83
                     <view className='Num'>
66
-                      <text>{item.department}</text>
67
-                      <text>{item.num}</text>
84
+                      <text></text>
85
+                      <text>{item.number}</text>
68 86
                     </view>
69 87
                   </view>
70 88
                 ))

+ 4
- 2
src/services/agent.js Zobrazit soubor

@@ -5,8 +5,8 @@ import {
5 5
   API_REGISTER_AGENT,
6 6
   API_AGENT_CHANNEL,
7 7
   API_AGENT_CURRENT,
8
-  API_EDIT_AGENT
9
-
8
+  API_EDIT_AGENT,
9
+  API_CHANNEL_RANK,
10 10
 } from '@/constants/api'
11 11
 
12 12
 
@@ -41,3 +41,5 @@ export const agentCurrent = payload => fetch({ url: API_AGENT_CURRENT, payload }
41 41
  */
42 42
 export const editAgent = payload => fetch({ url: `${API_EDIT_AGENT}?name=${payload.name}&&avatar=${payload.avatar}&&phone=${payload.phone}`, method: 'PUT' })
43 43
 
44
+
45
+export const getChannelRank = (payload) => fetch({ url: API_CHANNEL_RANK, payload })

+ 7
- 1
src/services/person.js Zobrazit soubor

@@ -14,7 +14,8 @@ import {
14 14
   API_MORE_ACTIVITY,
15 15
   API_SHARE_LIST,
16 16
   API_SHARE_INFOLIST,
17
-  API_BIND_CUSTOMER
17
+  API_BIND_CUSTOMER,
18
+  API_CHANNEL_CUSTOMER_DETAIL,
18 19
 } from '@/constants/api'
19 20
 
20 21
 
@@ -107,5 +108,10 @@ export const judgeBindCustomer = (payload) => fetch({ url: API_BIND_CUSTOMER, pa
107 108
  */
108 109
 export const getSharePersonInfoList = (payload) => fetch({ url: API_SHARE_INFOLIST, payload })
109 110
 
111
+/**
112
+ * 获取报备客户详情
113
+ * @param {*} customerId  
114
+ */
115
+export const getChannelCustomerDetail = (id) => fetch({ url: `${API_CHANNEL_CUSTOMER_DETAIL}/${id}` })
110 116
 
111 117