clue.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. import pullUpRefresh from "@/utils/pullUpRefresh";
  2. import dayjs from "dayjs";
  3. export default {
  4. mixins: [pullUpRefresh],
  5. computed: {
  6. currentIndex() {
  7. return this.queryParams.type == 1 ? 0 : 1;
  8. }
  9. },
  10. onPullDownRefresh() {
  11. uni.stopPullDownRefresh();
  12. // 刷新
  13. },
  14. data() {
  15. return {
  16. clueStateList: [],
  17. mapHeight: "0px",
  18. key: new Date().getTime(),
  19. clueTagGroupVoList: [],
  20. dicts: {
  21. caseStatusDicts: [],
  22. crmFollowStatus: [],
  23. crmCallStatus: [],
  24. clueEntranceType: [],
  25. crmClueBiz: [],
  26. crmClueObj: [],
  27. crmClueType: []
  28. },
  29. options: [{
  30. value: "3",
  31. label: "电话/微信"
  32. },
  33. {
  34. value: "1",
  35. label: "姓名"
  36. },
  37. {
  38. value: "8",
  39. label: "广告主ID"
  40. },
  41. {
  42. value: "7",
  43. label: "广告主名称"
  44. },
  45. {
  46. value: "10",
  47. label: "广告ID"
  48. },
  49. {
  50. value: "9",
  51. label: "广告名称"
  52. },
  53. {
  54. value: "11",
  55. label: "标题ID"
  56. },
  57. {
  58. value: "12",
  59. label: "视频ID"
  60. },
  61. {
  62. value: "5",
  63. label: "qq号"
  64. },
  65. {
  66. value: "6",
  67. label: "邮箱"
  68. },
  69. {
  70. value: "2",
  71. label: "线索ID"
  72. },
  73. ],
  74. queryParams: {
  75. name: undefined,
  76. telephone: undefined,
  77. weixin: undefined,
  78. createTimeStart: dayjs().format("YYYY-MM-DD"),
  79. createTimeEnd: dayjs().format("YYYY-MM-DD"),
  80. conditionContent: undefined,
  81. condition: "3",
  82. batchCodes: [],
  83. clueIds: [],
  84. deptName: undefined,
  85. deptIds: [],
  86. type: "1",
  87. pageNum: 1,
  88. pageSize: 20,
  89. allTagList: [],
  90. clueStateList: [],
  91. followStatusList: [],
  92. handleStateList: [],
  93. convertStatusList: [],
  94. followCountStart: undefined,
  95. followCountEnd: undefined,
  96. autoProvince: undefined,
  97. autoCity: undefined,
  98. autoArea: undefined,
  99. manualProvince: undefined,
  100. manualCity: undefined,
  101. manualArea: undefined,
  102. clueEntranceType: [],
  103. clueBizType: undefined,
  104. clueObjType: undefined,
  105. clueAdType: undefined,
  106. clueOperationId: undefined,
  107. clueOwnerId: undefined,
  108. sort: undefined,
  109. clueState: undefined,
  110. sortField: undefined,
  111. appNames: [],
  112. appNameLabel: undefined,
  113. isRepetitionOperWeixinName: '',
  114. isRepetitionOperationName: '',
  115. isVideoIdIsNull: '',
  116. advName: "",
  117. promotionName: "",
  118. advId: "",
  119. promotionId: "",
  120. titleId: "",
  121. videoId: "",
  122. },
  123. trendModal: false,
  124. chartData:{},
  125. color:[],
  126. opts: {
  127. color: this.color,
  128. padding: [20, 10, 20, 0],
  129. dataLabel: true,
  130. dataPointShape: true,
  131. enableScroll: true,
  132. xAxis: {
  133. disableGrid: true,
  134. scrollShow: true,
  135. itemCount: 10,
  136. rotateLabel: true,
  137. rotateAngle: 45,
  138. },
  139. yAxis: {
  140. gridType: "dash",
  141. dashLength: 7,
  142. },
  143. legend: {
  144. show: false,
  145. type: 'scroll',
  146. orient: 'horizontal',
  147. pageSize: 3,
  148. pageIconSize: 12,
  149. pageIconColor: '#666',
  150. pageIconInactiveColor: '#ccc',
  151. pageTextStyle: {
  152. color: '#666',
  153. fontSize: 12
  154. },
  155. bottom: 0
  156. },
  157. extra: {
  158. line: {
  159. type: "curve",
  160. width: 3,
  161. activeType: "hollow",
  162. linearType: "custom",
  163. onShadow: true,
  164. animation: "horizontal"
  165. },
  166. tooltip:{
  167. legendShow: true,
  168. bgOpacity: 0.6,
  169. }
  170. }
  171. },
  172. model: "",
  173. maxPrice: [],
  174. minPrice: [],
  175. chartShow: false,
  176. }
  177. },
  178. onPullDownRefresh() {
  179. uni.stopPullDownRefresh();
  180. this.resetData();
  181. },
  182. mounted() {
  183. uni.getSystemInfo({
  184. success: (e) => {
  185. const {
  186. windowTop,
  187. windowBottom,
  188. windowHeight
  189. } = e;
  190. this.mapHeight = (windowHeight - 70) + 'px';
  191. }
  192. });
  193. this.getDicts();
  194. // this.handleLoadData();
  195. this.resetData();
  196. },
  197. // onShow() {
  198. // this.resetData();
  199. // },
  200. methods: {
  201. handleTrend() {
  202. this.trendModal = true;
  203. },
  204. handleTrendConfirm() {
  205. this.model = ""
  206. this.chartShow = false
  207. this.trendModal = false;
  208. },
  209. searchTrend(val) {
  210. if (val !== ''){
  211. uni.$u.api.inquiryChart({
  212. model: val,
  213. }).then(res => {
  214. if(res.data.length == 0){
  215. uni.$u.toast("暂无数据")
  216. this.minPrice = []
  217. this.maxPrice = []
  218. this.chartShow = false
  219. return
  220. }
  221. const response = res.data
  222. this.maxPrice = []
  223. this.minPrice = []
  224. this.color = []
  225. const categories = []
  226. const dateMap = {}
  227. response.forEach(item => {
  228. this.maxPrice.push(item.max)
  229. this.minPrice.push(item.min)
  230. item.list.forEach(i => {
  231. if (!dateMap[i.recycleTime]) {
  232. dateMap[i.recycleTime] = true
  233. categories.push(i.recycleTime)
  234. }
  235. })
  236. })
  237. const series = response.map((item) => {
  238. const color = this.getRandomColor()
  239. this.color.push(color)
  240. const data = categories.map(date => {
  241. const itemData = item.list.find(i => i.recycleTime === date)
  242. return itemData ? itemData.price : null
  243. })
  244. return {
  245. name: item.model,
  246. data: data,
  247. setShadow: [
  248. 3,
  249. 8,
  250. 15,
  251. color
  252. ],
  253. }
  254. })
  255. this.opts.color = this.color
  256. const chartData = {
  257. categories: categories,
  258. series: series
  259. }
  260. this.chartData = JSON.parse(JSON.stringify(chartData))
  261. this.chartShow = true
  262. }).catch((err) => {
  263. uni.$u.toast(err)
  264. })
  265. }
  266. },
  267. getRandomColor(){
  268. var letters = '0123456789ABCDEF';
  269. var color = '#';
  270. for (var i = 0; i < 6; i++) {
  271. color += letters[Math.floor(Math.random() * 16)];
  272. }
  273. return color;
  274. },
  275. handleAddClue() {
  276. uni.navigateTo({
  277. url: "/pages/addClue/index"
  278. })
  279. },
  280. handleClueStateClick(item) {
  281. this.queryParams.clueState = item.clueState;
  282. this.resetData();
  283. },
  284. handleKeyword() {
  285. this.resetData();
  286. },
  287. handleKeywordClear() {
  288. // 组件有bug 清空后的值还是存在
  289. this.queryParams.conditionContent = "";
  290. this.resetData();
  291. },
  292. handleShowTag() {
  293. this.$refs.clueTag.showModal();
  294. },
  295. async handleClueTagConfirm() {
  296. this.resetData();
  297. },
  298. async getDicts() {
  299. this.$getDicts('crm_clue_phase').then(res => {
  300. this.dicts.caseStatusDicts = res;
  301. });
  302. this.$getDicts('crm_follow_status').then(res => {
  303. this.dicts.crmFollowStatus = res;
  304. })
  305. this.$getDicts('crm_call_status').then(res => {
  306. this.dicts.crmCallStatus = res;
  307. })
  308. this.$getDicts('clue_entrance_type').then(res => {
  309. this.dicts.clueEntranceType = res;
  310. });
  311. this.$getDicts('crm_clue_biz').then(res => {
  312. this.dicts.crmClueBiz = res;
  313. });
  314. this.$getDicts('crm_clue_obj').then(res => {
  315. this.dicts.crmClueObj = res;
  316. });
  317. this.$getDicts('crm_clue_type').then(res => {
  318. this.dicts.crmClueType = res;
  319. });
  320. uni.$u.api.getClueTagGroupVoList({ tagGroupApplication: '1' }).then(({
  321. data
  322. }) => {
  323. this.clueTagGroupVoList = data;
  324. });
  325. },
  326. getOtherData() {
  327. this.statisticsCaseState();
  328. },
  329. async statisticsCaseState() {
  330. const {
  331. data
  332. } = await uni.$u.api.statisticsCaseState(this.queryParams);
  333. this.clueStateList = data;
  334. },
  335. handleshowFilter() {
  336. this.$refs.filter.show();
  337. },
  338. handleShowSort() {
  339. this.$refs.sort.show();
  340. },
  341. sectionChange(val) {
  342. this.queryParams.type = val == 0 ? 1 : 2;
  343. this.resetData();
  344. },
  345. handleConfirm() {
  346. this.resetData();
  347. },
  348. handleConditionChange() {
  349. if (this.queryParams.conditionContent) {
  350. this.resetData();
  351. }
  352. },
  353. handleToDetail(item) {
  354. const {
  355. id,
  356. name
  357. } = item;
  358. uni.navigateTo({
  359. url: `/pages/clueDetail/index?clueId=${id}&name=${name}&type=${this.queryParams.type}`,
  360. });
  361. },
  362. async getList() {
  363. const {
  364. pageNum,
  365. pageSize,
  366. ...params
  367. } = this.queryParams;
  368. const {
  369. rows,
  370. total
  371. } = await uni.$u.api.getClueMainInfoList({
  372. pageSize,
  373. pageNum
  374. }, params);
  375. rows.forEach(v => {
  376. if (v.repetitionOperationName) {
  377. // 按逗号分割成数组
  378. const parts = v.repetitionOperationName.split(',');
  379. // 对每个部分提取 '-' 前面的内容
  380. const result = parts.map(part => part.split('-')[0]).join(',');
  381. v.repetitionOperationName = result;
  382. }
  383. if (v.repetitionOperWeixinName) {
  384. // 按逗号分割成数组
  385. const parts = v.repetitionOperWeixinName.split(',');
  386. // 对每个部分提取 '-' 前面的内容
  387. const result = parts.map(part => part.split('-')[0]).join(',');
  388. v.repetitionOperWeixinName = result;
  389. }
  390. })
  391. return rows;
  392. }
  393. }
  394. }