clue.js 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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. return
  217. }
  218. const response = res.data
  219. this.maxPrice = []
  220. this.minPrice = []
  221. this.color = []
  222. const categories = []
  223. const dateMap = {}
  224. response.forEach(item => {
  225. this.maxPrice.push(item.max)
  226. this.minPrice.push(item.min)
  227. item.list.forEach(i => {
  228. if (!dateMap[i.recycleTime]) {
  229. dateMap[i.recycleTime] = true
  230. categories.push(i.recycleTime)
  231. }
  232. })
  233. })
  234. const series = response.map((item) => {
  235. const color = this.getRandomColor()
  236. this.color.push(color)
  237. const data = categories.map(date => {
  238. const itemData = item.list.find(i => i.recycleTime === date)
  239. return itemData ? itemData.price : null
  240. })
  241. return {
  242. name: item.model,
  243. data: data,
  244. setShadow: [
  245. 3,
  246. 8,
  247. 15,
  248. color
  249. ],
  250. }
  251. })
  252. this.opts.color = this.color
  253. const chartData = {
  254. categories: categories,
  255. series: series
  256. }
  257. this.chartData = JSON.parse(JSON.stringify(chartData))
  258. this.chartShow = true
  259. }).catch((err) => {
  260. uni.$u.toast(err)
  261. })
  262. }
  263. },
  264. getRandomColor(){
  265. var letters = '0123456789ABCDEF';
  266. var color = '#';
  267. for (var i = 0; i < 6; i++) {
  268. color += letters[Math.floor(Math.random() * 16)];
  269. }
  270. return color;
  271. },
  272. handleAddClue() {
  273. uni.navigateTo({
  274. url: "/pages/addClue/index"
  275. })
  276. },
  277. handleClueStateClick(item) {
  278. this.queryParams.clueState = item.clueState;
  279. this.resetData();
  280. },
  281. handleKeyword() {
  282. this.resetData();
  283. },
  284. handleKeywordClear() {
  285. // 组件有bug 清空后的值还是存在
  286. this.queryParams.conditionContent = "";
  287. this.resetData();
  288. },
  289. handleShowTag() {
  290. this.$refs.clueTag.showModal();
  291. },
  292. async handleClueTagConfirm() {
  293. this.resetData();
  294. },
  295. async getDicts() {
  296. this.$getDicts('crm_clue_phase').then(res => {
  297. this.dicts.caseStatusDicts = res;
  298. });
  299. this.$getDicts('crm_follow_status').then(res => {
  300. this.dicts.crmFollowStatus = res;
  301. })
  302. this.$getDicts('crm_call_status').then(res => {
  303. this.dicts.crmCallStatus = res;
  304. })
  305. this.$getDicts('clue_entrance_type').then(res => {
  306. this.dicts.clueEntranceType = res;
  307. });
  308. this.$getDicts('crm_clue_biz').then(res => {
  309. this.dicts.crmClueBiz = res;
  310. });
  311. this.$getDicts('crm_clue_obj').then(res => {
  312. this.dicts.crmClueObj = res;
  313. });
  314. this.$getDicts('crm_clue_type').then(res => {
  315. this.dicts.crmClueType = res;
  316. });
  317. uni.$u.api.getClueTagGroupVoList({ tagGroupApplication: '1' }).then(({
  318. data
  319. }) => {
  320. this.clueTagGroupVoList = data;
  321. });
  322. },
  323. getOtherData() {
  324. this.statisticsCaseState();
  325. },
  326. async statisticsCaseState() {
  327. const {
  328. data
  329. } = await uni.$u.api.statisticsCaseState(this.queryParams);
  330. this.clueStateList = data;
  331. },
  332. handleshowFilter() {
  333. this.$refs.filter.show();
  334. },
  335. handleShowSort() {
  336. this.$refs.sort.show();
  337. },
  338. sectionChange(val) {
  339. this.queryParams.type = val == 0 ? 1 : 2;
  340. this.resetData();
  341. },
  342. handleConfirm() {
  343. this.resetData();
  344. },
  345. handleConditionChange() {
  346. if (this.queryParams.conditionContent) {
  347. this.resetData();
  348. }
  349. },
  350. handleToDetail(item) {
  351. const {
  352. id,
  353. name
  354. } = item;
  355. uni.navigateTo({
  356. url: `/pages/clueDetail/index?clueId=${id}&name=${name}&type=${this.queryParams.type}`,
  357. });
  358. },
  359. async getList() {
  360. const {
  361. pageNum,
  362. pageSize,
  363. ...params
  364. } = this.queryParams;
  365. const {
  366. rows,
  367. total
  368. } = await uni.$u.api.getClueMainInfoList({
  369. pageSize,
  370. pageNum
  371. }, params);
  372. rows.forEach(v => {
  373. if (v.repetitionOperationName) {
  374. // 按逗号分割成数组
  375. const parts = v.repetitionOperationName.split(',');
  376. // 对每个部分提取 '-' 前面的内容
  377. const result = parts.map(part => part.split('-')[0]).join(',');
  378. v.repetitionOperationName = result;
  379. }
  380. if (v.repetitionOperWeixinName) {
  381. // 按逗号分割成数组
  382. const parts = v.repetitionOperWeixinName.split(',');
  383. // 对每个部分提取 '-' 前面的内容
  384. const result = parts.map(part => part.split('-')[0]).join(',');
  385. v.repetitionOperWeixinName = result;
  386. }
  387. })
  388. return rows;
  389. }
  390. }
  391. }