addMixins.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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. console.log('evnt',evt.detail.value)
  84. for (let i = 0; i < this.items.length; i++) {
  85. if (this.items[i].value === evt.detail.value) {
  86. this.current = i
  87. this.remarksParams.communicationSituation = evt.detail.value*1
  88. console.log('communicationMethods',this.remarksParams.communicationSituation)
  89. break
  90. }
  91. }
  92. },
  93. // 选择联系方式
  94. checkboxChange(evnt){
  95. let data = evnt.detail.value
  96. this.remarksParams.communicationMethods = data.join(',')
  97. console.log('communicationMethods',this.remarksParams.communicationMethods)
  98. },
  99. bindPickerChange(type, e) {
  100. //选择筛选条件
  101. switch (type) {
  102. case 1:
  103. this.priceFlagText = this.priceActions[e.target.value].name
  104. this.remarksParams.pinceSensitve = this.priceActions[e.target.value].value
  105. break
  106. case 2:
  107. this.intenFlagText = this.intenActions[e.target.value].name
  108. this.remarksParams.satisfied = this.intenActions[e.target.value].value
  109. break
  110. case 3:
  111. this.followStateText = this.stateActions[e.target.value].name
  112. this.remarksParams.followup = this.stateActions[e.target.value].value
  113. break
  114. case 4: // 客户来源
  115. this.sourceStateText = this.sourceActions[e.target.value].name
  116. this.remarksParams.customerSource = this.sourceActions[e.target.value].value
  117. break
  118. case 5: // 客户性别
  119. this.genderText = this.genderActions[e.target.value].name
  120. this.remarksParams.customerGender = this.genderActions[e.target.value].value
  121. break
  122. case 6: // 客户年龄
  123. this.customerAge = this.ageActions[e.target.value].name
  124. this.remarksParams.customerAge = this.ageActions[e.target.value].name
  125. break
  126. case 7: // 加群情况
  127. this.additiveText = this.additiveActions[e.target.value].name
  128. this.remarksParams.groupAddition = this.additiveActions[e.target.value].value
  129. break
  130. }
  131. },
  132. handleCheckedLabel(label, index) {
  133. // 选择标签
  134. label.isChecked = !label.isChecked
  135. if (label.isChecked) {
  136. if (!this.contains(this.firstLabelList, label.label)) {
  137. this.firstLabelList.push(label.label)
  138. }
  139. } else {
  140. this.firstLabelList.splice(this.firstLabelList.indexOf(label.label), 1)
  141. }
  142. console.log('firstLabelList', this.firstLabelList)
  143. },
  144. // 标签联动搜索
  145. async getCmremarkslist(index,value,type){
  146. try{
  147. const res = await this.UserService.getCmremarkslist({ remarks: value , type : type })
  148. const data = res.data
  149. if(data && data.length > 0){
  150. if(type === 1){
  151. this.staticLabelsActionList = data
  152. this.staticLabelsList[index].isAssociation = true
  153. }else{
  154. this.trendsLabelsActionList = data
  155. this.trendsLabelsList[index].isAssociation = true
  156. }
  157. }else{
  158. if(type === 1){
  159. this.staticLabelsActionList = []
  160. this.staticLabelsList[index].isAssociation = false
  161. }else{
  162. this.trendsLabelsActionList = []
  163. this.trendsLabelsList[index].isAssociation = false
  164. }
  165. }
  166. }catch(error){
  167. console.log('=========>获取静态标签联想列表失败')
  168. }
  169. },
  170. // 静态标签联想
  171. handleStaticLabelsAction(index, event) {
  172. this.staticLabelsActionList = []
  173. this.checkStaticLabelsIndex = index
  174. if (event.detail.value != '') {
  175. this.getCmremarkslist(index,event.detail.value,1)
  176. } else {
  177. this.staticLabelsList[index].isAssociation = false
  178. }
  179. },
  180. //隐藏对应的联想弹窗
  181. hideStaticLabelsAction(item, event) {
  182. item.isAssociation = false
  183. },
  184. //选择静态标签
  185. handleSelectStaticLabels(ass, item) {
  186. item.isAssociation = false
  187. item.label = ass
  188. },
  189. //添加静态标签
  190. handleAddStaticLabels(item, index) {
  191. let obj = { label: '', isAssociation: false }
  192. item.isAssociation = false
  193. this.staticLabelsList.push(obj)
  194. },
  195. //删除静态标签
  196. handleDelStaticLabels(item, index) {
  197. this.staticLabelsList.splice(index, 1)
  198. },
  199. // 动态标签联想
  200. handleTrendsLabelsAction(index, event) {
  201. this.trendsLabelsActionList = []
  202. this.checkTrendsLabelsIndex = index
  203. if (event.detail.value != '') {
  204. this.getCmremarkslist(index,event.detail.value,0)
  205. } else {
  206. this.trendsLabelsList[index].isAssociation = false
  207. }
  208. },
  209. //隐藏对应的联想弹窗
  210. hideTrendsLabelsAction(item, event) {
  211. item.isAssociation = false
  212. },
  213. //选择动态标签
  214. handleSelectTrendsLabels(ass, item) {
  215. item.isAssociation = false
  216. item.label = ass
  217. },
  218. //添加动态标签
  219. handleAddTrendsLabels(item, index) {
  220. let obj = { label: '', isAssociation: false }
  221. item.isAssociation = false
  222. this.trendsLabelsList.push(obj)
  223. },
  224. //删除动态标签
  225. handleDelTrendsLabels(item, index) {
  226. this.trendsLabelsList.splice(index, 1)
  227. },
  228. }
  229. }
  230. export default addMixins