addMixins.js 9.3 KB

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