addMixins.js 9.1 KB

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