addMixins.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. import Vue from 'vue'
  2. const addMixins = {
  3. data() {
  4. return {
  5. items: [
  6. { value: '1',name: '已沟通',checked: false},
  7. { value: '2',name: '联系不上',checked: false}
  8. ],
  9. current: '',
  10. priceFlagText: '',
  11. priceActions: [
  12. { name: '敏感', value: 1 },
  13. { name: '适中', value: 2 },
  14. { name: '不敏感', value: 3 },
  15. { name: '不明确', value: 4 }
  16. ],
  17. intenFlagText: '',
  18. intenActions: [
  19. { name: '意向强烈', value: 1 },
  20. { name: '意向中等', value: 2 },
  21. { name: '意向平淡', value: 3 },
  22. { name: '随便看看', value: 4 }
  23. ],
  24. followStateText: '',
  25. stateActions: [
  26. { name: '跟进中', value: 1 },
  27. { name: '跟进完成', value: 2 },
  28. { name: '已放弃', value: 3 },
  29. ],
  30. sourceStateText: '', // 客户来源
  31. sourceActions: [
  32. { name: '网站', value: 1 },
  33. { name: '小程序', value: 2 },
  34. { name: '公众号', value: 3 },
  35. { name: '小红书', value: 4 },
  36. { name: '微博', value: 5 },
  37. { name: '搜狐', value: 6 },
  38. { name: '其他', value: 7 }
  39. ],
  40. genderText: '', // 客户性别
  41. genderActions: [
  42. { name: '男', value: 1 },
  43. { name: '女', value: 2 }
  44. ],
  45. ageText: '', // 客户年龄
  46. ageActions: [
  47. { name: '20-30', value: 1 },
  48. { name: '30-40', value: 2 },
  49. { name: '40-50', value: 3 },
  50. { name: '50-60', value: 4 },
  51. { name: '60以上', value: 4 }
  52. ],
  53. additiveText: '', // 加群情况
  54. additiveActions: [
  55. { name: '已加群', value: 1 },
  56. { name: '未加群', value: 2 }
  57. ],
  58. labelsList: [
  59. { name: '国产品牌', value: 1, isChecked: false },
  60. { name: '国产品牌', value: 1, isChecked: false },
  61. { name: '国产品牌', value: 1, isChecked: false },
  62. { name: '国产品牌', value: 1, isChecked: false },
  63. { name: '国产品牌', value: 1, isChecked: false },
  64. { name: '国产品牌', value: 1, isChecked: false },
  65. ],
  66. checkedLabelList: '',
  67. staticLabelsList: [{ // 静态标签
  68. label: '',
  69. isAssociation: false
  70. }],
  71. checkStaticLabelsIndex: 0, // 静态标签索引
  72. staticLabelsActionList: [],// 静态标签联动搜索列表
  73. trendsLabelsList: [{ // 动态标签
  74. label: '',
  75. isAssociation: false
  76. }],
  77. checkTrendsLabelsIndex: 0, // 动态标签索引
  78. trendsLabelsActionList: [],// 动态标签联动搜索列表
  79. }
  80. },
  81. computed: {
  82. },
  83. methods: {
  84. // 切换沟通情况
  85. radioChange(evt) {
  86. for (let i = 0; i < this.items.length; i++) {
  87. if (this.items[i].value === evt.detail.value) {
  88. this.current = i
  89. break
  90. }
  91. }
  92. },
  93. handleCheckedLabel(label, index) {
  94. // 选择标签
  95. label.isChecked = !label.isChecked
  96. if (label.isChecked) {
  97. if (!this.contains(this.checkedLabelList, label.id)) {
  98. this.checkedLabelList.push(label.id)
  99. }
  100. } else {
  101. this.checkedLabelList.splice(this.checkedLabelList.indexOf(label.id), 1)
  102. }
  103. this.remarksParams.labels = this.checkedLabelList.join(',')
  104. },
  105. // 标签联动搜索
  106. async getCmremarkslist(index,value,type){
  107. try{
  108. const res = await this.UserService.getCmremarkslist({ remarks: value })
  109. const data = res.data
  110. if(data && data.length > 0){
  111. if(type === 1){
  112. this.staticLabelsActionList = data
  113. this.staticLabelsList[index].isAssociation = true
  114. }else{
  115. this.trendsLabelsActionList = data
  116. this.trendsLabelsList[index].isAssociation = true
  117. }
  118. }else{
  119. if(type === 1){
  120. this.staticLabelsActionList = []
  121. this.staticLabelsList[index].isAssociation = false
  122. }else{
  123. this.trendsLabelsActionList = []
  124. this.trendsLabelsList[index].isAssociation = false
  125. }
  126. }
  127. }catch(error){
  128. console.log('=========>获取静态标签联想列表失败')
  129. }
  130. },
  131. // 静态标签联想
  132. handleStaticLabelsAction(index, event) {
  133. this.staticLabelsActionList = []
  134. this.checkStaticLabelsIndex = index
  135. if (event.detail.value != '') {
  136. this.getCmremarkslist(index,event.detail.value,1)
  137. } else {
  138. this.staticLabelsList[index].isAssociation = false
  139. }
  140. },
  141. //隐藏对应的联想弹窗
  142. hideStaticLabelsAction(item, event) {
  143. item.isAssociation = false
  144. },
  145. //选择静态标签
  146. handleSelectStaticLabels(ass, item) {
  147. item.isAssociation = false
  148. item.label = ass
  149. },
  150. //添加静态标签
  151. handleAddStaticLabels(item, index) {
  152. let obj = { label: '', isAssociation: false }
  153. item.isAssociation = false
  154. this.staticLabelsList.push(obj)
  155. },
  156. //删除静态标签
  157. handleDelStaticLabels(item, index) {
  158. this.staticLabelsList.splice(index, 1)
  159. },
  160. // 动态标签联想
  161. handleTrendsLabelsAction(index, event) {
  162. this.trendsLabelsActionList = []
  163. this.checkTrendsLabelsIndex = index
  164. if (event.detail.value != '') {
  165. this.getCmremarkslist(index,event.detail.value,2)
  166. } else {
  167. this.trendsLabelsList[index].isAssociation = false
  168. }
  169. },
  170. //隐藏对应的联想弹窗
  171. hideTrendsLabelsAction(item, event) {
  172. item.isAssociation = false
  173. },
  174. //选择动态标签
  175. handleSelectTrendsLabels(ass, item) {
  176. item.isAssociation = false
  177. item.label = ass
  178. },
  179. //添加动态标签
  180. handleAddTrendsLabels(item, index) {
  181. let obj = { label: '', isAssociation: false }
  182. item.isAssociation = false
  183. this.trendsLabelsList.push(obj)
  184. },
  185. //删除动态标签
  186. handleDelTrendsLabels(item, index) {
  187. this.trendsLabelsList.splice(index, 1)
  188. },
  189. }
  190. }
  191. export default addMixins