clue.js 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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. tableData: [],
  177. date:'',
  178. columns: [
  179. { label: '型号', prop: 'model'},
  180. { label: '价格(元)', prop: 'price' },
  181. ],
  182. }
  183. },
  184. onPullDownRefresh() {
  185. uni.stopPullDownRefresh();
  186. this.resetData();
  187. },
  188. mounted() {
  189. uni.getSystemInfo({
  190. success: (e) => {
  191. const {
  192. windowTop,
  193. windowBottom,
  194. windowHeight
  195. } = e;
  196. this.mapHeight = (windowHeight - 70) + 'px';
  197. }
  198. });
  199. this.getDicts();
  200. // this.handleLoadData();
  201. this.resetData();
  202. },
  203. // onShow() {
  204. // this.resetData();
  205. // },
  206. methods: {
  207. handleTrend() {
  208. this.trendModal = true;
  209. },
  210. handleTrendConfirm() {
  211. this.model = ""
  212. this.date = ""
  213. this.tableData = []
  214. this.chartShow = false
  215. this.trendModal = false;
  216. },
  217. searchTrend(val) {
  218. if (val !== ''){
  219. uni.$u.api.inquiryChart({
  220. model: val,
  221. }).then(res => {
  222. if(res.data.length == 0){
  223. uni.$u.toast("暂无数据")
  224. this.minPrice = []
  225. this.maxPrice = []
  226. this.chartShow = false
  227. return
  228. }
  229. const response = res.data
  230. this.maxPrice = []
  231. this.minPrice = []
  232. this.color = []
  233. const categories = []
  234. const dateMap = {}
  235. response.forEach(item => {
  236. this.maxPrice.push(item.max)
  237. this.minPrice.push(item.min)
  238. item.list.forEach(i => {
  239. if (!dateMap[i.recycleTime]) {
  240. dateMap[i.recycleTime] = true
  241. categories.push(i.recycleTime)
  242. }
  243. })
  244. })
  245. const series = response.map((item) => {
  246. const color = this.getRandomColor()
  247. this.color.push(color)
  248. const data = categories.map(date => {
  249. const itemData = item.list.find(i => i.recycleTime === date)
  250. return itemData ? itemData.price : null
  251. })
  252. return {
  253. name: item.model,
  254. data: data,
  255. setShadow: [
  256. 3,
  257. 8,
  258. 15,
  259. color
  260. ],
  261. }
  262. })
  263. this.opts.color = this.color
  264. const chartData = {
  265. categories: categories,
  266. series: series
  267. }
  268. this.chartData = JSON.parse(JSON.stringify(chartData))
  269. this.chartShow = true
  270. }).catch((err) => {
  271. uni.$u.toast(err)
  272. })
  273. }
  274. },
  275. handleChartClick(event) {
  276. console.log(event);
  277. const index = event.currentIndex.index;
  278. // 获取点击的日期
  279. const date = this.chartData.categories[index];
  280. this.date = date;
  281. // 构建该日期的所有型号价格数据
  282. const tableData = [];
  283. this.chartData.series.forEach(series => {
  284. const price = series.data[index];
  285. if (price !== null) {
  286. tableData.push({
  287. model: series.name,
  288. price: price
  289. });
  290. }
  291. });
  292. this.tableData = tableData;
  293. },
  294. getRandomColor(){
  295. var letters = '0123456789ABCDEF';
  296. var color = '#';
  297. for (var i = 0; i < 6; i++) {
  298. color += letters[Math.floor(Math.random() * 16)];
  299. }
  300. return color;
  301. },
  302. handleAddClue() {
  303. uni.navigateTo({
  304. url: "/pages/addClue/index"
  305. })
  306. },
  307. handleClueStateClick(item) {
  308. this.queryParams.clueState = item.clueState;
  309. this.resetData();
  310. },
  311. handleKeyword() {
  312. this.resetData();
  313. },
  314. handleKeywordClear() {
  315. // 组件有bug 清空后的值还是存在
  316. this.queryParams.conditionContent = "";
  317. this.resetData();
  318. },
  319. handleShowTag() {
  320. this.$refs.clueTag.showModal();
  321. },
  322. async handleClueTagConfirm() {
  323. this.resetData();
  324. },
  325. async getDicts() {
  326. this.$getDicts('crm_clue_phase').then(res => {
  327. this.dicts.caseStatusDicts = res;
  328. });
  329. this.$getDicts('crm_follow_status').then(res => {
  330. this.dicts.crmFollowStatus = res;
  331. })
  332. this.$getDicts('crm_call_status').then(res => {
  333. this.dicts.crmCallStatus = res;
  334. })
  335. this.$getDicts('clue_entrance_type').then(res => {
  336. this.dicts.clueEntranceType = res;
  337. });
  338. this.$getDicts('crm_clue_biz').then(res => {
  339. this.dicts.crmClueBiz = res;
  340. });
  341. this.$getDicts('crm_clue_obj').then(res => {
  342. this.dicts.crmClueObj = res;
  343. });
  344. this.$getDicts('crm_clue_type').then(res => {
  345. this.dicts.crmClueType = res;
  346. });
  347. uni.$u.api.getClueTagGroupVoList({ tagGroupApplication: '1' }).then(({
  348. data
  349. }) => {
  350. this.clueTagGroupVoList = data;
  351. });
  352. },
  353. getOtherData() {
  354. this.statisticsCaseState();
  355. },
  356. async statisticsCaseState() {
  357. const {
  358. data
  359. } = await uni.$u.api.statisticsCaseState(this.queryParams);
  360. this.clueStateList = data;
  361. },
  362. handleshowFilter() {
  363. this.$refs.filter.show();
  364. },
  365. handleShowSort() {
  366. this.$refs.sort.show();
  367. },
  368. sectionChange(val) {
  369. this.queryParams.type = val == 0 ? 1 : 2;
  370. this.resetData();
  371. },
  372. handleConfirm() {
  373. this.resetData();
  374. },
  375. handleConditionChange() {
  376. if (this.queryParams.conditionContent) {
  377. this.resetData();
  378. }
  379. },
  380. handleToDetail(item) {
  381. const {
  382. id,
  383. name
  384. } = item;
  385. uni.navigateTo({
  386. url: `/pages/clueDetail/index?clueId=${id}&name=${name}&type=${this.queryParams.type}`,
  387. });
  388. },
  389. async getList() {
  390. const {
  391. pageNum,
  392. pageSize,
  393. ...params
  394. } = this.queryParams;
  395. const {
  396. rows,
  397. total
  398. } = await uni.$u.api.getClueMainInfoList({
  399. pageSize,
  400. pageNum
  401. }, params);
  402. rows.forEach(v => {
  403. if (v.repetitionOperationName) {
  404. // 按逗号分割成数组
  405. const parts = v.repetitionOperationName.split(',');
  406. // 对每个部分提取 '-' 前面的内容
  407. const result = parts.map(part => part.split('-')[0]).join(',');
  408. v.repetitionOperationName = result;
  409. }
  410. if (v.repetitionOperWeixinName) {
  411. // 按逗号分割成数组
  412. const parts = v.repetitionOperWeixinName.split(',');
  413. // 对每个部分提取 '-' 前面的内容
  414. const result = parts.map(part => part.split('-')[0]).join(',');
  415. v.repetitionOperWeixinName = result;
  416. }
  417. })
  418. return rows;
  419. }
  420. }
  421. }