Your Name 3 jaren geleden
bovenliggende
commit
884129b30d

+ 2
- 2
config/dev.js Bestand weergeven

3
     NODE_ENV: '"development"'
3
     NODE_ENV: '"development"'
4
   },
4
   },
5
   defineConstants: {
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
     WSS_HOST: '"ws://127.0.0.1:8081"',
8
     WSS_HOST: '"ws://127.0.0.1:8081"',
9
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
9
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',

src/pages/mine/myCustomer/components/DatePicker/index.jsx → src/components/DateRangePicker/index.jsx Bestand weergeven


src/pages/mine/myCustomer/components/DatePicker/index.scss → src/components/DateRangePicker/index.scss Bestand weergeven


+ 3
- 0
src/constants/api.js Bestand weergeven

302
 
302
 
303
 // 获取报备客户详情
303
 // 获取报备客户详情
304
 export const API_CHANNEL_CUSTOMER_DETAIL = resolvePath('channelCustomer')
304
 export const API_CHANNEL_CUSTOMER_DETAIL = resolvePath('channelCustomer')
305
+
306
+// 获取渠道折线图
307
+export const API_CHANNEL_LINE_CHAT = resolvePath('briefing/detail')

+ 2
- 2
src/pages/mine/myCustomer/index.jsx Bestand weergeven

5
 import { fetch } from '@/utils/request'
5
 import { fetch } from '@/utils/request'
6
 import { API_CLIENT_LIST, API_CHANNEL_CLIENT_LIST } from '@/constants/api'
6
 import { API_CLIENT_LIST, API_CHANNEL_CLIENT_LIST } from '@/constants/api'
7
 import { ROLE_CODE } from '@/constants/user'
7
 import { ROLE_CODE } from '@/constants/user'
8
-import './index.scss'
8
+import DatePicker from '@/components/DateRangePicker'
9
 import MyCustomerListItem from '../components/MyCustomerListItem/index'
9
 import MyCustomerListItem from '../components/MyCustomerListItem/index'
10
-import DatePicker from './components/DatePicker/index'
11
 import TypePicker from './TypePicker'
10
 import TypePicker from './TypePicker'
11
+import './index.scss'
12
 
12
 
13
 export default withLayout((props) => {
13
 export default withLayout((props) => {
14
   const { person } = props
14
   const { person } = props

+ 99
- 0
src/pages/mine/partnerChannel/components/LineChat.jsx Bestand weergeven

1
+import React, { useEffect, useState } from 'react'
2
+import Taro from '@tarojs/taro'
3
+import * as echarts from '@/components/ec-canvas/echarts';
4
+import { getChannelLineChat } from '@/services/agent'
5
+
6
+function initChart(canvas, width, height, dpr) {
7
+  const chart = echarts.init(canvas, null, {
8
+    width: width,
9
+    height: height,
10
+    devicePixelRatio: dpr // new
11
+  });
12
+  canvas.setChart(chart);
13
+
14
+  var option = {
15
+    title: {
16
+      text: '测试下面legend的红色区域不应被裁剪',
17
+      left: 'center'
18
+    },
19
+    legend: {
20
+      data: ['A', 'B', 'C'],
21
+      top: 50,
22
+      left: 'center',
23
+      backgroundColor: 'red',
24
+      z: 100
25
+    },
26
+    grid: {
27
+      containLabel: true
28
+    },
29
+    tooltip: {
30
+      show: true,
31
+      trigger: 'axis'
32
+    },
33
+    xAxis: {
34
+      type: 'category',
35
+      boundaryGap: false,
36
+      data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
37
+      // show: false
38
+    },
39
+    yAxis: {
40
+      x: 'center',
41
+      type: 'value',
42
+      splitLine: {
43
+        lineStyle: {
44
+          type: 'dashed'
45
+        }
46
+      }
47
+      // show: false
48
+    },
49
+    series: [{
50
+      name: 'A',
51
+      type: 'line',
52
+      smooth: true,
53
+      data: [18, 36, 65, 30, 78, 40, 33]
54
+    }, {
55
+      name: 'B',
56
+      type: 'line',
57
+      smooth: true,
58
+      data: [12, 50, 51, 35, 70, 30, 20]
59
+    }, {
60
+      name: 'C',
61
+      type: 'line',
62
+      smooth: true,
63
+      data: [10, 30, 31, 50, 40, 20, 10]
64
+    }]
65
+  };
66
+
67
+  chart.setOption(option);
68
+  return chart;
69
+}
70
+
71
+export default (props) => {
72
+  const { buildingId, xType, dateRange } = props
73
+
74
+  const [ec, setEc] = useState()
75
+
76
+  useEffect(() => {
77
+    Taro.nextTick(() => {
78
+      setEc({
79
+        onInit: initChart
80
+      })
81
+    })
82
+  }, [])
83
+
84
+  useEffect(() => {
85
+    if (ec) {
86
+      const [startDate, endDate] = dateRange
87
+      getChannelLineChat({
88
+        buildingId,
89
+        type: xType,
90
+        startDate: `${startDate}T00:00:00.000Z`,
91
+        endDate: `${endDate}T23:59:59.999Z`,
92
+      }).then((res) => {})
93
+    }
94
+  }, [ec, buildingId, dateRange, xType])
95
+
96
+  return (
97
+    <ec-canvas ec={ec} />
98
+  )
99
+}

+ 4
- 1
src/pages/mine/partnerChannel/index.config.js Bestand weergeven

1
 export default {
1
 export default {
2
-  navigationBarTitleText: '合作渠道'
2
+  navigationBarTitleText: '合作渠道',
3
+  usingComponents: {
4
+    'ec-canvas': '@/components/ec-canvas/ec-canvas'
5
+  }
3
 }
6
 }

+ 62
- 18
src/pages/mine/partnerChannel/index.jsx Bestand weergeven

1
-import React, { useState, useEffect } from 'react'
1
+import React, { useState, useEffect, useRef } from 'react'
2
 import withLayout from '@/layout'
2
 import withLayout from '@/layout'
3
 import { ScrollView, Image } from '@tarojs/components'
3
 import { ScrollView, Image } from '@tarojs/components'
4
 import { getChannelRank } from '@/services/agent'
4
 import { getChannelRank } from '@/services/agent'
5
 import { fetch } from '@/utils/request'
5
 import { fetch } from '@/utils/request'
6
 import { API_GET_AGENT_BUILDINGS } from '@/constants/api'
6
 import { API_GET_AGENT_BUILDINGS } from '@/constants/api'
7
-import '@/assets/css/iconfont.css'
7
+import {  } from '@/constants/user'
8
+import DateRangePicker from '@/components/DateRangePicker'
9
+import Picker from '@/components/Picker'
10
+import LineChat from './components/LineChat'
11
+// import '@/assets/css/iconfont.css'
8
 import './index.scss'
12
 import './index.scss'
9
 
13
 
14
+const lineXDicts = [
15
+  {name: '按天', id: 'day'},
16
+  {name: '按月', id: 'month'},
17
+]
18
+
19
+const padMonth = m => m > 9 ? m : `0${m}`
20
+
10
 export default withLayout((props) => {
21
 export default withLayout((props) => {
11
   
22
   
23
+  const [showPicker, setShowPicker] = useState(false)
24
+  const [rankDateRange, setRankDateRange] = useState([])
25
+  const [reportDateRange, setReportDateRange] = useState([])
12
   const [buildingId, setBuildingId] = useState()
26
   const [buildingId, setBuildingId] = useState()
13
   const [buildingList, setBuildingList] = useState([])
27
   const [buildingList, setBuildingList] = useState([])
14
   const [rankList, setRankList] = useState([])
28
   const [rankList, setRankList] = useState([])
15
-  const [IsPull, setPull] = useState(false)
16
-  const [PullTimer, setPullTimer] = useState(null)
29
+  const [lineXType, setLineXType] = useState('day')
30
+  const [lingeDateRange, seteLineDateRange] = useState([])
31
+  const pickerTrigger = useRef()
17
 
32
 
18
-  const PageRefresh = () => { // 页面下拉刷新回调
19
-    setPull(true)
33
+  const handleRankDate = () => {
34
+    pickerTrigger.current = 'rank'
35
+    setShowPicker(true)
20
   }
36
   }
21
 
37
 
22
-  useEffect(() => { // 下拉刷新触发
23
-    if (IsPull) {
24
-      clearTimeout(PullTimer)
25
-      setPullTimer(setTimeout(() => {
26
-        setPull(false)
27
-      }, 2000))
38
+  const handleReportDate = () => {
39
+    pickerTrigger.current = 'report'
40
+    setShowPicker(true)
41
+  }
42
+  
43
+  const handlePickerChange = (e) => {
44
+    setShowPicker(false)
45
+
46
+    if (pickerTrigger.current == 'rank') {
47
+      setRankDateRange(e)
48
+    } else {
49
+      setReportDateRange(e)
28
     }
50
     }
29
-  }, [IsPull])
51
+  }
30
 
52
 
31
   useEffect(() => {
53
   useEffect(() => {
32
     fetch({ url: API_GET_AGENT_BUILDINGS }).then((res) => {
54
     fetch({ url: API_GET_AGENT_BUILDINGS }).then((res) => {
46
     }
68
     }
47
   }, [buildingId])
69
   }, [buildingId])
48
 
70
 
71
+  useEffect(() => {
72
+    const now = new Date()
73
+    const endDay = now.toJSON().substring(0, 10)
74
+    if (lineXType === 'day') {
75
+      const cutDay = 7 * 24 * 60 * 60 * 1000
76
+      const start = new Date(now - cutDay)
77
+      seteLineDateRange([start.toJSON().substring(0, 10), endDay])
78
+    } else {
79
+      const cutMonth = 6
80
+      const curMonth = now.getMonth() + 1
81
+      const startMonth = curMonth - cutMonth + 1
82
+      if (startMonth <= 0) {
83
+        const startYear = now.getFullYear() - 1
84
+        seteLineDateRange([`${startYear}-${padMonth(startMonth + 12)}-01`, endDay])
85
+      } else {
86
+        seteLineDateRange([`${now.getFullYear()}-${padMonth(startMonth)}-01`, endDay])
87
+      }
88
+    }
89
+    
90
+  }, [lineXType])
91
+
49
   return (
92
   return (
50
     <view className='Page partnerChannel'>
93
     <view className='Page partnerChannel'>
51
-      <ScrollView scroll-y={true} refresher-enabled={true} refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#fff'>
94
+      <DateRangePicker visable={showPicker} close={() => setShowPicker(false)} change={handlePickerChange} />
95
+      <ScrollView scrollY>
52
         <view className='PageContent'>
96
         <view className='PageContent'>
53
 
97
 
54
           {/* 排行榜 */}
98
           {/* 排行榜 */}
55
           <view className='Ranking'>
99
           <view className='Ranking'>
56
             <view className='Top flex-h'>
100
             <view className='Top flex-h'>
57
               <text className='flex-item'>龙虎榜</text>
101
               <text className='flex-item'>龙虎榜</text>
58
-              <Image mode='heightFix' src={require('@/assets/mine-icon23.png')}></Image>
102
+              <Image mode='heightFix' src={require('@/assets/mine-icon23.png')} onClick={handleRankDate} />
59
             </view>
103
             </view>
60
             <view className='List flex-h'>
104
             <view className='List flex-h'>
61
               {
105
               {
94
           <view className='SaleNews'>
138
           <view className='SaleNews'>
95
             <view className='Top flex-h'>
139
             <view className='Top flex-h'>
96
               <text>销售简报</text>
140
               <text>销售简报</text>
97
-              <Image mode='heightFix' src={require('../../../assets/mine-icon23.png')}></Image>
141
+              <Image mode='heightFix' src={require('../../../assets/mine-icon23.png')} onClick={handleReportDate}></Image>
98
               <view className='flex-item'></view>
142
               <view className='flex-item'></view>
99
               <text>更多</text>
143
               <text>更多</text>
100
               <text className='iconfont icon-jiantouright'></text>
144
               <text className='iconfont icon-jiantouright'></text>
128
                 <text className='iconfont icon-sanjiaoxingdown'></text>
172
                 <text className='iconfont icon-sanjiaoxingdown'></text>
129
               </view>
173
               </view>
130
               <view className='Sort'>
174
               <view className='Sort'>
131
-                <text>按天</text>
175
+                <Picker kv={['name', 'id']} dicts={lineXDicts} value={lineXType} onChange={setLineXType} />
132
                 <text className='iconfont icon-sanjiaoxingdown'></text>
176
                 <text className='iconfont icon-sanjiaoxingdown'></text>
133
               </view>
177
               </view>
134
             </view>
178
             </view>
135
             <view className='LineChart'>
179
             <view className='LineChart'>
136
-              
180
+              <LineChat buildingId={buildingId} xType={lineXType} dateRange={lingeDateRange} />
137
             </view>
181
             </view>
138
           </view>
182
           </view>
139
 
183
 

+ 1
- 1
src/pages/mine/partnerChannel/index.scss Bestand weergeven

189
               font-size: 0;
189
               font-size: 0;
190
               white-space: nowrap;
190
               white-space: nowrap;
191
               margin-left: 20px;
191
               margin-left: 20px;
192
-              >text {
192
+              >text, picker {
193
                 display: inline-block;
193
                 display: inline-block;
194
                 vertical-align: middle;
194
                 vertical-align: middle;
195
                 font-size: 30px;
195
                 font-size: 30px;

+ 13
- 1
src/services/agent.js Bestand weergeven

7
   API_AGENT_CURRENT,
7
   API_AGENT_CURRENT,
8
   API_EDIT_AGENT,
8
   API_EDIT_AGENT,
9
   API_CHANNEL_RANK,
9
   API_CHANNEL_RANK,
10
+  API_CHANNEL_LINE_CHAT,
10
 } from '@/constants/api'
11
 } from '@/constants/api'
11
 
12
 
12
 
13
 
41
  */
42
  */
42
 export const editAgent = payload => fetch({ url: `${API_EDIT_AGENT}?name=${payload.name}&&avatar=${payload.avatar}&&phone=${payload.phone}`, method: 'PUT' })
43
 export const editAgent = payload => fetch({ url: `${API_EDIT_AGENT}?name=${payload.name}&&avatar=${payload.avatar}&&phone=${payload.phone}`, method: 'PUT' })
43
 
44
 
44
-
45
+/**
46
+ * 经纪人排行
47
+ * @param {*} payload 
48
+ * @returns 
49
+ */
45
 export const getChannelRank = (payload) => fetch({ url: API_CHANNEL_RANK, payload })
50
 export const getChannelRank = (payload) => fetch({ url: API_CHANNEL_RANK, payload })
51
+
52
+/**
53
+ * 渠道折线图
54
+ * @param {*} payload 
55
+ * @returns 
56
+ */
57
+export const getChannelLineChat = (payload) => fetch({ url: API_CHANNEL_LINE_CHAT, payload })

+ 6
- 6
src/services/news.js Bestand weergeven

4
   API_NEWS_FAVOR,
4
   API_NEWS_FAVOR,
5
   API_NEWS_UV,
5
   API_NEWS_UV,
6
   // API_NEWS_SHARE,
6
   // API_NEWS_SHARE,
7
-  API_HOUSE_SHARE,
8
-  API_HOUSE_POSTER,
9
-  API_LIVE_SHARE,
10
-  API_LIVE_POSTER,
7
+  // API_HOUSE_SHARE,
8
+  // API_HOUSE_POSTER,
9
+  // API_LIVE_SHARE,
10
+  // API_LIVE_POSTER,
11
   API_ACTIVITY_GROUP,
11
   API_ACTIVITY_GROUP,
12
   // API_INDEX_SHARE,
12
   // API_INDEX_SHARE,
13
 } from '@/constants/api'
13
 } from '@/constants/api'
35
  * 房源列表分享埋点(海报)
35
  * 房源列表分享埋点(海报)
36
  * @param {*} id  id
36
  * @param {*} id  id
37
  */
37
  */
38
-export const addHousePosterNum = id => fetch({ url: `${API_HOUSE_POSTER}/${id}`, method: 'POST' })
38
+// export const addHousePosterNum = id => fetch({ url: `${API_HOUSE_POSTER}/${id}`, method: 'POST' })
39
 /**
39
 /**
40
  * 房源列表分享埋点(小程序)
40
  * 房源列表分享埋点(小程序)
41
  * @param {*} id  id
41
  * @param {*} id  id
45
  * 直播详情分享埋点(海报)
45
  * 直播详情分享埋点(海报)
46
  * @param {*} id  id
46
  * @param {*} id  id
47
  */
47
  */
48
-export const addLivePosterNum = id => fetch({ url: `${API_LIVE_POSTER}/${id}`, method: 'POST' })
48
+// export const addLivePosterNum = id => fetch({ url: `${API_LIVE_POSTER}/${id}`, method: 'POST' })
49
 /**
49
 /**
50
  * 直播详情分享埋点(小程序)
50
  * 直播详情分享埋点(小程序)
51
  * @param {*} id  id
51
  * @param {*} id  id