123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409 |
- import { activity,User } from "@/config/api.js"
- let app = getApp()
- export default {
- data() {
- return {
- page_no: 1,
- pageSize: 10,
- collectList: [],
- status: "loadmore",
- loadText: {
- loadmore: "上拉加载更多",
- loading: "加载中",
- nomore: "已经到底了",
- },
- listActivityStaus: [], //状态
- listActivityType: [], //类型
- listChartPermission: [], //分类
- listChartPermissionInit:[],
- activityTypeIds: '', //活动类型id 多个用 , 隔开
- chartPermissionIds: '', //行业id 多个用 , 隔开
- chartPermissionName: '所有分类',
- activityTypeName: '所有类型',
- selectShow: false,
- isShowJurisdiction: false,
- isGain: true,
- signupType: '', //关注类型
- goFollow: false, //是否关注公众号
- signupStatus: 'Success', //4个不同的类型提示文案
- isShow: false, //弹框
- isCancelShow: false,
- idTypeCancel: {
- id: '',
- type: 1,
- cutId: '',
- state: '',
- isNum: false
- },
- isAreaCode: false,
- areaCode: {
- id: '',
- type: ''
- },
- isNeedAddCountryCode: false,//判断是否需要区号
- isId: 0,
- activityIdAdd: '',
- // 历史搜索列表
- historySearchList: [],
- hasPermission: '', //是否有权限
- jurisdictionList: {
- SellerMobile: '',
- PopupMsg: '',
- OperationMode: '',
- },
- isShowhasPermission: false, //拨打销售电话
- applyForIsShow: false, //潜在用户
- flag: false,
- activityTimeList:[{Id: 1, IsChoose: false, StatusName: "今日活动"},{Id: 2, IsChoose: false, StatusName: "明日活动"}],
- activityTimeStatus:'',
- editIsShow:false,//外呼莫泰框
- countryCode:'',//外呼区号
- mobileEdit:'',//外呼手机号
- goOnNextStep:'',//设置外呼号后弹出哪个
- mailboxBinding:false,//是否绑定邮箱
- keyWord: '',
- }
- },
- methods: {
- // 滑动状态下拉选择的收起
- closeTheWindow(type) {
- if (type == 'statusstate') {
- const state = this.activeState ? this.activeState.split(',').map(Number) : []
- this.listActivityStaus.forEach(item => {
- if (state.indexOf(item.Id) !== -1) {
- item.IsChoose = true
- } else {
- item.IsChoose = false
- }
- })
- } else if (type == 'genre') {
- const types = this.activityTypeIds ? this.activityTypeIds.split(',').map(Number) : []
- this.listActivityType.forEach(item => {
- if (types.includes(item.ActivityTypeId)) {
- item.IsChoose = true
- } else {
- item.IsChoose = false
- }
- })
- } else {
- const chart = this.chartPermissionIds ? this.chartPermissionIds.split(',').map(Number) : []
- this.listChartPermission.forEach(item => {
- if (chart.includes(item.ChartPermissionId)) {
- item.IsChoose = true
- } else {
- item.IsChoose = false
- }
- })
- }
- },
- // 我要报名
- wanttosignup(id) {
- this.activityIdAdd = id
- this.selectShow = true
- },
- //判断是否要绑定区号
- countryCcode() {
- User.countryCcode().then(res => {
- if (res.Ret == 200) {
- this.isNeedAddCountryCode = res.Data.IsNeedAddCountryCode
- }
- })
- },
- //报名
- signupAdd(id, type) {
- let timer = null;
- if (this.flag) return
- clearTimeout(timer)
- this.flag = true
- this.$store.dispatch('checkHandle').then(res => {
- app.globalData.isAuth = res.IsAuth;
- app.globalData.isBind = res.IsBind;
- })
- if (app.globalData.isBind && !app.globalData.isAuth) {
- uni.navigateTo({
- url: '/pages/login/login'
- })
- return
- } else if (app.globalData.isAuth) {
- uni.navigateTo({
- url: '/pages/authGuide/authGuide'
- })
- return
- }
- this.selectShow = false
- if (id == 'id') {
- id = this.activityIdAdd
- }
- if (this.isNeedAddCountryCode) {
- this.isAreaCode = true
- this.areaCode = {
- id,
- type
- }
- } else {
- activity.signupAdd({
- ActivityId: id,
- SignupType: type,
- }).then(res => {
- if (res.Ret == 200) {
- this.hasPermission = res.Data.HasPermission
- if (this.hasPermission == 1) {
- const index = this.collectList.findIndex(item => item.ActivityId == id)
- this.collectList[index].SignupType = type
- this.signupType = res.Data.SignupType
- this.signupStatus = res.Data.SignupStatus
- this.countryCode=res.Data.CountryCode
- this.mobileEdit=res.Data.Mobile
- this.goOnNextStep=res.Data.GoFollow
- this.idTypeCancel = {
- cutId: res.Data.ActivityId,
- state: 1
- }
- if( res.Data.GoBindEmail){
- this.mailboxBinding=true
- return
- }
- if(res.Data.SignupStatus !== 'Success') {
- this.isShow = true
- }else {
- if(res.Data.GoOutboundMobile){
- this.editIsShow=true
- }else if (res.Data.GoFollow){
- this.goFollow = res.Data.GoFollow
- }else if(res.Data.SignupStatus == 'Success') {
- this.isShow = true
- }
- }
- } else if (this.hasPermission == 2) {
- this.jurisdictionList.SellerMobile = res.Data.SellerMobile
- this.jurisdictionList.PopupMsg = res.Data.PopupMsg
- this.isShowhasPermission = true
- } else if (this.hasPermission == 3 || this.hasPermission == 4) {
- this.jurisdictionList.PopupMsg = res.Data.PopupMsg
- this.applyForIsShow = true
- }
- }
- })
- }
- timer = setTimeout(() => {
- this.flag = false
- }, 500)
- },
- signupCancel(id, type, time) {
- const str = time.replace(/-/g, '/')
- const date = new Date(str)
- const times = date.getTime()
- const num = new Date().getTime()
- if (times - num <= 3600000) {
- uni.showModal({
- confirmText: '知道了',
- showCancel: false,
- confirmColor: '#3385FF',
- content: type == 1 ? '活动开始前1小时内无法取消预约外呼,请联系对口销售处理' : '活动开始前1小时内无法取消报名,请联系对口销售处理'
- })
- return
- }
- this.isCancelShow = true
- this.idTypeCancel = {
- id,
- type,
- cutId: '',
- state: 0,
- isNum: true
- }
- },
- //去往详情页面
- goDetail(item) {
- this.public({type:'show'}, true, '/activityPages/activityDetail/activityDetail?id=', item.ActivityId)
- },
- //是否展示有权限的行业
- isJurisdiction() {
- this.$store.dispatch('checkHandle').then(res => {
- app.globalData.isAuth = res.IsAuth;
- app.globalData.isBind = res.IsBind;
- if ((!res.IsAuth) && (!res.IsBind)) { //已授权已绑定
- if (this.isShowJurisdiction) {
- this.isId = 2
- } else {
- this.isId = 1
- }
- this.getUserSearchContent('traverse')
- } else if (res.IsAuth) { //未授权
- uni.navigateTo({
- url: '/pages/authGuide/authGuide'
- })
- } else if (res.IsBind && !res.IsAuth) { //已授权未绑定
- uni.navigateTo({
- url: '/pages/login/login'
- })
- }
- })
- },
- /* 初始化判断token */
- authentication() {
- this.$store.dispatch('checkHandle').then(res => {
- app.globalData.isAuth = res.IsAuth;
- app.globalData.isBind = res.IsBind;
- })
- },
- /* 新布局产业选项确定按钮 */
- replacementConfirm(type) {
- this.page_no = 1
- if (type == 'statusstate') {
- const arr = []
- const str = []
- this.listActivityStaus.forEach(key => {
- if (key.IsChoose) {
- arr.push(key.Id)
- str.push(key.StatusName)
- }
- })
- this.activeState = arr.join(',')
- const arrTwo = []
- const strTwo = []
- this.activityTimeList.forEach(key => {
- if (key.IsChoose) {
- arrTwo.push(key.Id)
- strTwo.push(key.StatusName)
- }
- })
- this.activityTimeStatus = arrTwo.join(',')
- if (strTwo.length > 0) {
- this.activeStateName = strTwo.join(',')
- }else{
- if (str.length == this.listActivityStaus.length || str.length <= 0) {
- this.activeStateName = '所有状态'
- } else {
- this.activeStateName = str.join(',')
- }
- }
- } else if (type == 'industry') {
- const arr = []
- const str = []
- this.listChartPermission.forEach(key => {
- if (key.IsChoose) {
- arr.push(key.ChartPermissionId)
- str.push(key.PermissionName)
- }
- })
- if ((str.length == 6 && this.listChartPermission.length == 6) || str.length <= 0) {
- this.chartPermissionName = '所有分类'
- } else {
- this.chartPermissionName = str.join(',')
- }
- this.chartPermissionIds = arr.join(',')
- } else {
- const arr = []
- const str = []
- this.listActivityType.forEach(key => {
- if (key.IsChoose) {
- arr.push(key.ActivityTypeId)
- str.push(key.ActivityTypeName)
- }
- })
- if (str.length == this.listActivityType.length || str.length <= 0) {
- this.activityTypeName = '所有类型'
- } else {
- this.activityTypeName = str.join(',')
- }
- this.activityTypeIds = arr.join(',')
- }
- this.page_no = 1
- this.collectList = []
- this.dynamicList=[]
- this.spanIndex=[]
- this.keyWord=''
- this.fastSearchKeWord()
- this.getList()
- this.selectComponent(`#${type}`).toggle();
- },
- /* 新布局产业选项重置按钮 */
- replacementBtn(type) {
- if (type == 'statusstate') {
- this.listActivityStaus.forEach(item => item.IsChoose = false)
- this.activityTimeList.forEach(key => {key.IsChoose=false})
- this.listActivityStaus[0].IsChoose = true
- this.activeState = '1'
- this.activityTimeStatus=''
- this.activeStateName = '未开始'
- } else if (type == 'industry') {
- this.listChartPermission=this.listChartPermissionInit
- this.chartPermissionIds = ''
- this.isShowJurisdiction = false
- this.isId = 2
- this.listChartPermission.map(item => item.IsChoose = false)
- this.chartPermissionName = '所有分类'
- } else {
- this.listActivityType.forEach(item => item.IsChoose = false)
- this.activityTypeIds = ''
- this.activityTypeName = '所有类型'
- }
- },
- //状态的下拉选择
- overallBtn(type, item) {
- this.listActivityStaus.forEach(key => {
- if (key.Id == item.Id) {
- key.IsChoose = !key.IsChoose
- }
- })
- },
- // 行业的下拉选择
- overallClick(type, item) {
- if (this.isShowJurisdiction) return
- this.listChartPermission.forEach(key => {
- if (key.ChartPermissionId == item.ChartPermissionId) {
- key.IsChoose = !key.IsChoose
- }
- })
- },
- //类型的下拉选择
- overallActivity(type, item) {
- this.listActivityType.forEach(key => {
- if (key.ActivityTypeId == item.ActivityTypeId) {
- key.IsChoose = !key.IsChoose
- }
- })
- },
- // 弹框的初始化
- init() {
- this.signupType = ''
- this.goFollow = false
- this.signupStatus = ''
- this.isShow = false
- this.isCancelShow = false
- },
- // 跳转判断权限
- public(type, flag, purl, price = '') {
- this.$store.dispatch('checkHandle', type).then(res => {
- app.globalData.isAuth = res.IsAuth;
- app.globalData.isBind = res.IsBind;
- if ((!res.IsAuth) && (!res.IsBind)) { //已授权已绑定
- if (flag) {
- uni.navigateTo({
- url: purl + price,
- });
- }
- } else if (res.IsAuth) { //未授权
- uni.navigateTo({
- url: '/pages/authGuide/authGuide'
- })
- } else if (res.IsBind && !res.IsAuth) { //已授权未绑定
- uni.navigateTo({
- url: '/pages/login/login'
- })
- }
- })
- },
- //今日,明日 活动的选择
- timeListBtn(type,item){
- this.activityTimeList.forEach(key => {
- if (key.Id == item.Id) {
- key.IsChoose = !key.IsChoose
- }
- })
- }
- },
- }
|