index.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. import { activity,User } from "@/config/api.js"
  2. let app = getApp()
  3. export default {
  4. data() {
  5. return {
  6. page_no: 1,
  7. pageSize: 10,
  8. collectList: [],
  9. status: "loadmore",
  10. loadText: {
  11. loadmore: "上拉加载更多",
  12. loading: "加载中",
  13. nomore: "已经到底了",
  14. },
  15. listActivityStaus: [], //状态
  16. listActivityType: [], //类型
  17. listChartPermission: [], //分类
  18. listChartPermissionInit:[],
  19. activityTypeIds: '', //活动类型id 多个用 , 隔开
  20. chartPermissionIds: '', //行业id 多个用 , 隔开
  21. chartPermissionName: '所有分类',
  22. activityTypeName: '所有类型',
  23. selectShow: false,
  24. isShowJurisdiction: false,
  25. isGain: true,
  26. signupType: '', //关注类型
  27. goFollow: false, //是否关注公众号
  28. signupStatus: 'Success', //4个不同的类型提示文案
  29. isShow: false, //弹框
  30. isCancelShow: false,
  31. idTypeCancel: {
  32. id: '',
  33. type: 1,
  34. cutId: '',
  35. state: '',
  36. isNum: false
  37. },
  38. isAreaCode: false,
  39. areaCode: {
  40. id: '',
  41. type: ''
  42. },
  43. isNeedAddCountryCode: false,//判断是否需要区号
  44. isId: 0,
  45. activityIdAdd: '',
  46. // 历史搜索列表
  47. historySearchList: [],
  48. hasPermission: '', //是否有权限
  49. jurisdictionList: {
  50. SellerMobile: '',
  51. PopupMsg: '',
  52. OperationMode: '',
  53. },
  54. isShowhasPermission: false, //拨打销售电话
  55. applyForIsShow: false, //潜在用户
  56. flag: false,
  57. activityTimeList:[{Id: 1, IsChoose: false, StatusName: "今日活动"},{Id: 2, IsChoose: false, StatusName: "明日活动"}],
  58. activityTimeStatus:'',
  59. editIsShow:false,//外呼莫泰框
  60. countryCode:'',//外呼区号
  61. mobileEdit:'',//外呼手机号
  62. goOnNextStep:'',//设置外呼号后弹出哪个
  63. mailboxBinding:false,//是否绑定邮箱
  64. keyWord: '',
  65. }
  66. },
  67. methods: {
  68. // 滑动状态下拉选择的收起
  69. closeTheWindow(type) {
  70. if (type == 'statusstate') {
  71. const state = this.activeState ? this.activeState.split(',').map(Number) : []
  72. this.listActivityStaus.forEach(item => {
  73. if (state.indexOf(item.Id) !== -1) {
  74. item.IsChoose = true
  75. } else {
  76. item.IsChoose = false
  77. }
  78. })
  79. } else if (type == 'genre') {
  80. const types = this.activityTypeIds ? this.activityTypeIds.split(',').map(Number) : []
  81. this.listActivityType.forEach(item => {
  82. if (types.includes(item.ActivityTypeId)) {
  83. item.IsChoose = true
  84. } else {
  85. item.IsChoose = false
  86. }
  87. })
  88. } else {
  89. const chart = this.chartPermissionIds ? this.chartPermissionIds.split(',').map(Number) : []
  90. this.listChartPermission.forEach(item => {
  91. if (chart.includes(item.ChartPermissionId)) {
  92. item.IsChoose = true
  93. } else {
  94. item.IsChoose = false
  95. }
  96. })
  97. }
  98. },
  99. // 我要报名
  100. wanttosignup(id) {
  101. this.activityIdAdd = id
  102. this.selectShow = true
  103. },
  104. //判断是否要绑定区号
  105. countryCcode() {
  106. User.countryCcode().then(res => {
  107. if (res.Ret == 200) {
  108. this.isNeedAddCountryCode = res.Data.IsNeedAddCountryCode
  109. }
  110. })
  111. },
  112. //报名
  113. signupAdd(id, type) {
  114. let timer = null;
  115. if (this.flag) return
  116. clearTimeout(timer)
  117. this.flag = true
  118. this.$store.dispatch('checkHandle').then(res => {
  119. app.globalData.isAuth = res.IsAuth;
  120. app.globalData.isBind = res.IsBind;
  121. })
  122. if (app.globalData.isBind && !app.globalData.isAuth) {
  123. uni.navigateTo({
  124. url: '/pages/login/login'
  125. })
  126. return
  127. } else if (app.globalData.isAuth) {
  128. uni.navigateTo({
  129. url: '/pages/authGuide/authGuide'
  130. })
  131. return
  132. }
  133. this.selectShow = false
  134. if (id == 'id') {
  135. id = this.activityIdAdd
  136. }
  137. if (this.isNeedAddCountryCode) {
  138. this.isAreaCode = true
  139. this.areaCode = {
  140. id,
  141. type
  142. }
  143. } else {
  144. activity.signupAdd({
  145. ActivityId: id,
  146. SignupType: type,
  147. }).then(res => {
  148. if (res.Ret == 200) {
  149. this.hasPermission = res.Data.HasPermission
  150. if (this.hasPermission == 1) {
  151. const index = this.collectList.findIndex(item => item.ActivityId == id)
  152. this.collectList[index].SignupType = type
  153. this.signupType = res.Data.SignupType
  154. this.signupStatus = res.Data.SignupStatus
  155. this.countryCode=res.Data.CountryCode
  156. this.mobileEdit=res.Data.Mobile
  157. this.goOnNextStep=res.Data.GoFollow
  158. this.idTypeCancel = {
  159. cutId: res.Data.ActivityId,
  160. state: 1
  161. }
  162. if( res.Data.GoBindEmail){
  163. this.mailboxBinding=true
  164. return
  165. }
  166. if(res.Data.SignupStatus !== 'Success') {
  167. this.isShow = true
  168. }else {
  169. if(res.Data.GoOutboundMobile){
  170. this.editIsShow=true
  171. }else if (res.Data.GoFollow){
  172. this.goFollow = res.Data.GoFollow
  173. }else if(res.Data.SignupStatus == 'Success') {
  174. this.isShow = true
  175. }
  176. }
  177. } else if (this.hasPermission == 2) {
  178. this.jurisdictionList.SellerMobile = res.Data.SellerMobile
  179. this.jurisdictionList.PopupMsg = res.Data.PopupMsg
  180. this.isShowhasPermission = true
  181. } else if (this.hasPermission == 3 || this.hasPermission == 4) {
  182. this.jurisdictionList.PopupMsg = res.Data.PopupMsg
  183. this.applyForIsShow = true
  184. }
  185. }
  186. })
  187. }
  188. timer = setTimeout(() => {
  189. this.flag = false
  190. }, 500)
  191. },
  192. signupCancel(id, type, time) {
  193. const str = time.replace(/-/g, '/')
  194. const date = new Date(str)
  195. const times = date.getTime()
  196. const num = new Date().getTime()
  197. if (times - num <= 3600000) {
  198. uni.showModal({
  199. confirmText: '知道了',
  200. showCancel: false,
  201. confirmColor: '#3385FF',
  202. content: type == 1 ? '活动开始前1小时内无法取消预约外呼,请联系对口销售处理' : '活动开始前1小时内无法取消报名,请联系对口销售处理'
  203. })
  204. return
  205. }
  206. this.isCancelShow = true
  207. this.idTypeCancel = {
  208. id,
  209. type,
  210. cutId: '',
  211. state: 0,
  212. isNum: true
  213. }
  214. },
  215. //去往详情页面
  216. goDetail(item) {
  217. this.public({type:'show'}, true, '/activityPages/activityDetail/activityDetail?id=', item.ActivityId)
  218. },
  219. //是否展示有权限的行业
  220. isJurisdiction() {
  221. this.$store.dispatch('checkHandle').then(res => {
  222. app.globalData.isAuth = res.IsAuth;
  223. app.globalData.isBind = res.IsBind;
  224. if ((!res.IsAuth) && (!res.IsBind)) { //已授权已绑定
  225. if (this.isShowJurisdiction) {
  226. this.isId = 2
  227. } else {
  228. this.isId = 1
  229. }
  230. this.getUserSearchContent('traverse')
  231. } else if (res.IsAuth) { //未授权
  232. uni.navigateTo({
  233. url: '/pages/authGuide/authGuide'
  234. })
  235. } else if (res.IsBind && !res.IsAuth) { //已授权未绑定
  236. uni.navigateTo({
  237. url: '/pages/login/login'
  238. })
  239. }
  240. })
  241. },
  242. /* 初始化判断token */
  243. authentication() {
  244. this.$store.dispatch('checkHandle').then(res => {
  245. app.globalData.isAuth = res.IsAuth;
  246. app.globalData.isBind = res.IsBind;
  247. })
  248. },
  249. /* 新布局产业选项确定按钮 */
  250. replacementConfirm(type) {
  251. this.page_no = 1
  252. if (type == 'statusstate') {
  253. const arr = []
  254. const str = []
  255. this.listActivityStaus.forEach(key => {
  256. if (key.IsChoose) {
  257. arr.push(key.Id)
  258. str.push(key.StatusName)
  259. }
  260. })
  261. this.activeState = arr.join(',')
  262. const arrTwo = []
  263. const strTwo = []
  264. this.activityTimeList.forEach(key => {
  265. if (key.IsChoose) {
  266. arrTwo.push(key.Id)
  267. strTwo.push(key.StatusName)
  268. }
  269. })
  270. this.activityTimeStatus = arrTwo.join(',')
  271. if (strTwo.length > 0) {
  272. this.activeStateName = strTwo.join(',')
  273. }else{
  274. if (str.length == this.listActivityStaus.length || str.length <= 0) {
  275. this.activeStateName = '所有状态'
  276. } else {
  277. this.activeStateName = str.join(',')
  278. }
  279. }
  280. } else if (type == 'industry') {
  281. const arr = []
  282. const str = []
  283. this.listChartPermission.forEach(key => {
  284. if (key.IsChoose) {
  285. arr.push(key.ChartPermissionId)
  286. str.push(key.PermissionName)
  287. }
  288. })
  289. if ((str.length == 6 && this.listChartPermission.length == 6) || str.length <= 0) {
  290. this.chartPermissionName = '所有分类'
  291. } else {
  292. this.chartPermissionName = str.join(',')
  293. }
  294. this.chartPermissionIds = arr.join(',')
  295. } else {
  296. const arr = []
  297. const str = []
  298. this.listActivityType.forEach(key => {
  299. if (key.IsChoose) {
  300. arr.push(key.ActivityTypeId)
  301. str.push(key.ActivityTypeName)
  302. }
  303. })
  304. if (str.length == this.listActivityType.length || str.length <= 0) {
  305. this.activityTypeName = '所有类型'
  306. } else {
  307. this.activityTypeName = str.join(',')
  308. }
  309. this.activityTypeIds = arr.join(',')
  310. }
  311. this.page_no = 1
  312. this.collectList = []
  313. this.dynamicList=[]
  314. this.spanIndex=[]
  315. this.keyWord=''
  316. this.fastSearchKeWord()
  317. this.getList()
  318. this.selectComponent(`#${type}`).toggle();
  319. },
  320. /* 新布局产业选项重置按钮 */
  321. replacementBtn(type) {
  322. if (type == 'statusstate') {
  323. this.listActivityStaus.forEach(item => item.IsChoose = false)
  324. this.activityTimeList.forEach(key => {key.IsChoose=false})
  325. this.listActivityStaus[0].IsChoose = true
  326. this.activeState = '1'
  327. this.activityTimeStatus=''
  328. this.activeStateName = '未开始'
  329. } else if (type == 'industry') {
  330. this.listChartPermission=this.listChartPermissionInit
  331. this.chartPermissionIds = ''
  332. this.isShowJurisdiction = false
  333. this.isId = 2
  334. this.listChartPermission.map(item => item.IsChoose = false)
  335. this.chartPermissionName = '所有分类'
  336. } else {
  337. this.listActivityType.forEach(item => item.IsChoose = false)
  338. this.activityTypeIds = ''
  339. this.activityTypeName = '所有类型'
  340. }
  341. },
  342. //状态的下拉选择
  343. overallBtn(type, item) {
  344. this.listActivityStaus.forEach(key => {
  345. if (key.Id == item.Id) {
  346. key.IsChoose = !key.IsChoose
  347. }
  348. })
  349. },
  350. // 行业的下拉选择
  351. overallClick(type, item) {
  352. if (this.isShowJurisdiction) return
  353. this.listChartPermission.forEach(key => {
  354. if (key.ChartPermissionId == item.ChartPermissionId) {
  355. key.IsChoose = !key.IsChoose
  356. }
  357. })
  358. },
  359. //类型的下拉选择
  360. overallActivity(type, item) {
  361. this.listActivityType.forEach(key => {
  362. if (key.ActivityTypeId == item.ActivityTypeId) {
  363. key.IsChoose = !key.IsChoose
  364. }
  365. })
  366. },
  367. // 弹框的初始化
  368. init() {
  369. this.signupType = ''
  370. this.goFollow = false
  371. this.signupStatus = ''
  372. this.isShow = false
  373. this.isCancelShow = false
  374. },
  375. // 跳转判断权限
  376. public(type, flag, purl, price = '') {
  377. this.$store.dispatch('checkHandle', type).then(res => {
  378. app.globalData.isAuth = res.IsAuth;
  379. app.globalData.isBind = res.IsBind;
  380. if ((!res.IsAuth) && (!res.IsBind)) { //已授权已绑定
  381. if (flag) {
  382. uni.navigateTo({
  383. url: purl + price,
  384. });
  385. }
  386. } else if (res.IsAuth) { //未授权
  387. uni.navigateTo({
  388. url: '/pages/authGuide/authGuide'
  389. })
  390. } else if (res.IsBind && !res.IsAuth) { //已授权未绑定
  391. uni.navigateTo({
  392. url: '/pages/login/login'
  393. })
  394. }
  395. })
  396. },
  397. //今日,明日 活动的选择
  398. timeListBtn(type,item){
  399. this.activityTimeList.forEach(key => {
  400. if (key.Id == item.Id) {
  401. key.IsChoose = !key.IsChoose
  402. }
  403. })
  404. }
  405. },
  406. }