activity.vue 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088
  1. <template>
  2. <page-meta :page-style="currentAudioMsg.show? 'overflow: hidden;' : ''" />
  3. <view class="activity-page">
  4. <van-sticky style="background: #fff">
  5. <!-- <view class="search-wrap">
  6. <van-search
  7. shape="round"
  8. :value="searchVal"
  9. placeholder="搜索您想要的商品名"
  10. @change="searchValChange"
  11. @search="onSearch"
  12. @clear="onClearSearch"
  13. />
  14. </view> -->
  15. <view class="flex tabs-wrap" @click="tabChange">
  16. <view
  17. :class="['tab-item', tabActive === '1' && 'tab-active']"
  18. data-type="1"
  19. >线上会议</view>
  20. <view
  21. :class="['tab-item', tabActive === '3' && 'tab-active']"
  22. data-type="3"
  23. >线下沙龙</view>
  24. </view>
  25. <view class="flex status-wrap" @click="statusChange">
  26. <view
  27. :class="[
  28. 'status-item',
  29. statusActive === '1' && 'status-active',
  30. ]"
  31. data-status="1">本周预告
  32. </view>
  33. <view
  34. :class="[
  35. 'status-item',
  36. statusActive === '2' && 'status-active',
  37. ]"
  38. data-status="2">进行中
  39. </view>
  40. <view
  41. :class="[
  42. 'status-item',
  43. statusActive === '3' && 'status-active',
  44. ]"
  45. data-status="3">已结束
  46. </view>
  47. <van-checkbox
  48. class="auth-box"
  49. shape="square"
  50. :value="onlySeeAuth"
  51. @change="handleAuthChange"
  52. checked-color="#D5AD79"
  53. icon-size="16px"
  54. >
  55. <view class="text">只看有权限</view>
  56. </van-checkbox>
  57. </view>
  58. </van-sticky>
  59. <view class="list" v-if="list.length > 0">
  60. <view
  61. class="global-list-card item"
  62. v-for="(item,index) in list"
  63. :key="item.activityId"
  64. @click="handleGoDetail(item.activityId)"
  65. >
  66. <view class="status-box status-before" v-if="item.activityState===1">未开始</view>
  67. <view class="status-box status-progress" v-if="item.activityState===2">进行中</view>
  68. <view class="status-box status-end" v-if="item.activityState===3">已结束</view>
  69. <view class="flex top">
  70. <image class="avatar" :src="item.speakerHeadPic" mode="aspectFill"></image>
  71. <view class="content">
  72. <view class="flex icon-box" @click.stop="handleGetAudio(item)">
  73. <template v-if="item.firstActivityTypeId===3&&item.city">
  74. <image src='../../static/position.png'></image>
  75. <text>{{item.city}}</text>
  76. </template>
  77. <template v-if="item.firstActivityTypeId===1&&item.activityState===3&&item.hasPlayBack">
  78. <image :src="currentAudioMsg.activityId==item.activityId&&currentAudioMsg.play?'../../static/audio-doing.png':'../../static/audio-pause-3.png'"></image>
  79. <text>{{currentAudioMsg.activityId==item.activityId?currentAudioMsg.play?'暂停':'回放':'回放'}}</text>
  80. </template>
  81. </view>
  82. <view class="van-ellipsis title">{{item.activityTypeName}}</view>
  83. <view class="name">主讲:{{item.speaker}}</view>
  84. <view class="time">{{ item.startTime | formatActivityTime(item.endTime) }}</view>
  85. </view>
  86. </view>
  87. <view class="flex bot" v-if="item.activityState===1">
  88. <view
  89. :class="!item.hasRemind&&'active'"
  90. @click.stop="handleRemind(item,index)"
  91. >
  92. {{item.hasRemind?'取消提醒':'会议提醒'}}
  93. </view>
  94. <view
  95. :class="!item.registerState&&'active'"
  96. v-if="item.firstActivityTypeId===3"
  97. @click.stop="handleRegister(item,index)"
  98. >
  99. {{item.registerState?'取消线下报名':'报名线下参会'}}
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. <view class="report-empty-box" v-if="list.length===0&&finished">
  105. <image :src="globalImgUrls.chartEmpty" mode="widthFix" />
  106. <view>暂无活动</view>
  107. </view>
  108. <!-- <van-empty description="暂无数据" v-if="list.length===0&&finished" /> -->
  109. <!-- 弹窗 -->
  110. <van-popup :show="pupData.show" @close="pupData.show=false" :close-on-click-overlay="false">
  111. <view class="global-pup">
  112. <view class="content">
  113. <rich-text :nodes="pupData.content"></rich-text>
  114. </view>
  115. <view class="flex bot" v-if="pupData.type=='contact'">
  116. <view @click="pupData.show=false" style="color:#A9AFB8">取消</view>
  117. <view @click="handleCallPhone(pupData.mobile)">拨号</view>
  118. </view>
  119. <view class="flex bot" v-else-if="pupData.type=='apply'">
  120. <view @click="pupData.show=false" style="color:#A9AFB8">取消</view>
  121. <view @click="handleApply">立即申请</view>
  122. </view>
  123. <view class="flex bot" v-else>
  124. <view @click="pupData.show=false">知道了</view>
  125. </view>
  126. </view>
  127. </van-popup>
  128. <!-- 音频弹窗 -->
  129. <van-popup
  130. :show="currentAudioMsg.show"
  131. @close="currentAudioMsg.show=false"
  132. position="bottom"
  133. closeable
  134. round
  135. z-index="99999"
  136. >
  137. <view class="audio-popup-box">
  138. <view class="title">{{currentAudioMsg.title}}</view>
  139. <view class="list">
  140. <view class="flex item" v-for="item in currentAudioMsg.list" :key="item.voiceUrl" @click="handleAudioChange(item)">
  141. <view>
  142. <view :style="{color:item.voiceUrl==currentAudioMsg.audioCurrentUrl?'#D5AD79':''}">{{item.voiceName}}</view>
  143. <view style="font-size:12px;color:#999">{{item.voicePlaySeconds|formatVoiceTime}}</view>
  144. </view>
  145. <!-- <image v-if="item.voiceUrl==currentAudioMsg.audioCurrentUrl&&currentAudioMsg.play" src="../../static/audio-doing.png" mode="scaleToFill"/>
  146. <image v-else-if="item.voiceUrl==currentAudioMsg.audioCurrentUrl&&!currentAudioMsg.play" src="../../static/audio-pause-3.png" mode="scaleToFill"/>
  147. <image v-else src="../../static/audio-pause-2.png" mode="scaleToFill"/> -->
  148. </view>
  149. </view>
  150. <view class="flex box">
  151. <text>{{currentAudioMsg.audioCurrentTime|formatVoiceTime}}</text>
  152. <slider
  153. activeColor="#e3b377"
  154. :max="currentAudioMsg.audioTime"
  155. :value="currentAudioMsg.audioCurrentTime"
  156. @change="handleAudioSliderChange($event)"
  157. block-size="20"
  158. />
  159. <text>{{currentAudioMsg.audioTime|formatVoiceTime}}</text>
  160. </view>
  161. <view class="flex btns">
  162. <image
  163. class="before"
  164. :src="isFirstAudio?'../../static/audio-before-grey.png':'../../static/audio-before.png'"
  165. mode="aspectFit"
  166. @click="handleAudioBtn('before')"
  167. />
  168. <image
  169. class="center"
  170. :src="currentAudioMsg.play?'../../static/audio-doing.png':'../../static/audio-pause-3.png'"
  171. mode="aspectFit"
  172. @click="handleAudioBtn('center')"
  173. />
  174. <image
  175. class="next"
  176. :src="isLastAudio?'../../static/audio-before-grey.png':'../../static/audio-before.png'"
  177. mode="aspectFit"
  178. @click="handleAudioBtn('next')"
  179. />
  180. </view>
  181. </view>
  182. </van-popup>
  183. <!-- 分享海报 -->
  184. <sharePoster
  185. :style="{bottom:'250rpx'}"
  186. :shareData="{
  187. type:'activity_list',
  188. code_page:'pages/activity/activity',
  189. code_scene:'',
  190. data:shareParams
  191. }"
  192. v-if="showPoster"
  193. ></sharePoster>
  194. </view>
  195. </template>
  196. <script>
  197. import {
  198. apiActivityList,
  199. apiActivityAddRemind,
  200. apiActivityCancelRemind,
  201. apiActivityRegister,
  202. apiActivityCancelRegister,
  203. apiActivityAudios
  204. } from '@/api/activity'
  205. import {apiApplyPermission,apiUserInfo} from '@/api/user'
  206. import sharePoster from '../../components/sharePoster/sharePoster.vue'
  207. const moment=require('@/utils/moment-with-locales.min')
  208. moment.locale('zh-cn');
  209. export default {
  210. components: {
  211. sharePoster
  212. },
  213. computed: {
  214. isFirstAudio(){
  215. if(!this.currentAudioMsg.audioCurrentUrl){
  216. return true
  217. }
  218. if(this.currentAudioMsg.list.length>0){
  219. return this.currentAudioMsg.audioCurrentUrl==this.currentAudioMsg.list[0].voiceUrl
  220. }
  221. },
  222. isLastAudio(){
  223. if(!this.currentAudioMsg.audioCurrentUrl){
  224. return true
  225. }
  226. if(this.currentAudioMsg.list.length>0){
  227. return this.currentAudioMsg.audioCurrentUrl==this.currentAudioMsg.list[this.currentAudioMsg.list.length-1].voiceUrl
  228. }
  229. },
  230. shareParams(){ //生成海报数据
  231. let obj={
  232. list_title:this.tabActive === '1'?'线上会议':'线下沙龙',
  233. status_1:'',
  234. avatar_1:'',
  235. title_1:'',
  236. speaker_1:'',
  237. time_1:'',
  238. status_2:'',
  239. avatar_2:'',
  240. title_2:'',
  241. speaker_2:'',
  242. time_2:'',
  243. }
  244. if(this.list[0]){
  245. obj.status_1=this.list[0].activityState==1?'未开始':this.list[0].activityState==2?'进行中':'已结束'
  246. obj.avatar_1=this.list[0].speakerHeadPic
  247. obj.title_1=this.list[0].activityTypeName
  248. obj.speaker_1=this.list[0].speaker
  249. obj.time_1=this.formatActivityTime(this.list[0].startTime,this.list[0].endTime)
  250. }
  251. if(this.list[1]){
  252. obj.status_2=this.list[1].activityState==1?'未开始':this.list[1].activityState==2?'进行中':'已结束'
  253. obj.avatar_2=this.list[1].speakerHeadPic
  254. obj.title_2=this.list[1].activityTypeName
  255. obj.speaker_2=this.list[1].speaker
  256. obj.time_2=this.formatActivityTime(this.list[1].startTime,this.list[1].endTime)
  257. }
  258. return obj
  259. }
  260. },
  261. watch: {
  262. 'pupData.show':{
  263. handler(nval){
  264. if(!nval){
  265. this.pupData={
  266. show:false,
  267. content:'',//弹窗html字符串
  268. type:'',
  269. mobile:"",
  270. }
  271. }
  272. }
  273. }
  274. },
  275. data() {
  276. return {
  277. searchVal: '',
  278. tabActive: '1',
  279. statusActive: '1',
  280. page: 1,
  281. pageSize: 20,
  282. list: [],
  283. finished: false,
  284. isInit:false,//是否是初始化获取数据
  285. pupData:{
  286. show:false,
  287. content:'',//弹窗html字符串
  288. type:'',
  289. mobile:"",
  290. },
  291. onlySeeAuth:false,// 是否只看有权限的
  292. currentAudioMsg:{
  293. activityId:'',//活动id
  294. play:false,//是否正在播放
  295. list:[],//音频列表数据
  296. show:false,//是否显示弹窗
  297. title:'',//音频弹窗标题
  298. audioCurrentTime:0,//音频播放实时时间
  299. audioTime:0,//当前音频时间
  300. audioCurrentUrl:'',//当前音频地址
  301. },
  302. showPoster:true
  303. }
  304. },
  305. onLoad() {
  306. this.isInit=true
  307. this.init()
  308. this.addEventListenerRemind()
  309. this.addEventListenerRegister()
  310. },
  311. onShow() {
  312. this.showPoster=true
  313. if(this.$store.state.activity.activityListPageRefresh){
  314. if(this.isInit) return
  315. this.allRefresh()
  316. }
  317. this.initAudio()
  318. // uni.getSystemInfo({
  319. // success: function (res) {
  320. // if (res.windowWidth > 600||['windows','mac'].includes(res.platform)) {
  321. // console.log('跳转启动页判断进入pc');
  322. // uni.reLaunch({
  323. // url: "/pages/pc",
  324. // });
  325. // }
  326. // },
  327. // })
  328. },
  329. onHide(){
  330. this.showPoster=false
  331. this.pupData.show=false
  332. this.currentAudioMsg.show=false
  333. // 存一次音频信息
  334. uni.setStorageSync('audioMsg', JSON.stringify(this.currentAudioMsg))
  335. },
  336. onUnload(){
  337. uni.$off('activityDetailSetRemind')
  338. uni.$off('activityDetailSetRegister')
  339. },
  340. onShareAppMessage(res) {
  341. return {
  342. title: '弘则FICC周度电话会安排',
  343. path: ''
  344. }
  345. },
  346. onPullDownRefresh() {
  347. this.refreshPage()
  348. setTimeout(() => {
  349. uni.stopPullDownRefresh()
  350. }, 1500)
  351. },
  352. onReachBottom() {
  353. if (this.finished) return
  354. this.page++
  355. this.getList()
  356. },
  357. methods: {
  358. formatActivityTime(start,end){
  359. const week=moment(start).format('dddd');
  360. const day=moment(start).format('YYYY-MM-DD');
  361. const startTime=moment(start).format('HH:mm');
  362. const endTime=moment(end).format('HH:mm');
  363. return `${day} ${startTime}-${endTime} ${week}`
  364. },
  365. // 初始化音频状态
  366. initAudio(){
  367. console.log('音频src',this.globalBgMusic.src);
  368. if(this.globalBgMusic.src){
  369. const obj=uni.getStorageSync('audioMsg')
  370. if(obj){
  371. this.currentAudioMsg=JSON.parse(obj)
  372. }
  373. this.handleAudioFun()
  374. }else{
  375. this.currentAudioMsg={
  376. activityId:'',//活动id
  377. play:false,//是否正在播放
  378. list:[],//音频列表数据
  379. show:false,//是否显示弹窗
  380. title:'',//音频弹窗标题
  381. audioCurrentTime:0,//音频播放实时时间
  382. audioTime:0,//当前音频时间
  383. audioCurrentUrl:'',//当前音频地址
  384. }
  385. }
  386. },
  387. // 点击列表中播放音频
  388. async handleGetAudio(item){
  389. if(!(item.firstActivityTypeId===1&&item.activityState===3&&item.hasPlayBack)) return
  390. // 获取音频
  391. if(this.currentAudioMsg.activityId!=item.activityId){
  392. const res=await apiActivityAudios({activity_id: Number(item.activityId)})
  393. if(res.code===200){
  394. if(res.data){
  395. this.currentAudioMsg.activityId=item.activityId
  396. this.currentAudioMsg.list=res.data
  397. this.currentAudioMsg.title=item.activityTypeName
  398. this.handlePlayAudio(res.data[0])
  399. this.currentAudioMsg.show=!this.currentAudioMsg.show
  400. }else{
  401. uni.showToast({
  402. title:"无音频数据",
  403. icon:"none"
  404. })
  405. }
  406. }else if(res.code===403){
  407. if(res.data.type=='contact'){
  408. if(!res.data.customer_info.has_apply){
  409. if(res.data.customer_info.status=='冻结'||(res.data.customer_info.status=='试用'&&res.data.customer_info.is_suspend==1)){
  410. apiApplyPermission({
  411. company_name:res.data.customer_info.company_name,
  412. real_name:res.data.customer_info.name,
  413. source:2,
  414. from_page:'活动列表'
  415. }).then(res=>{
  416. if(res.code===200){
  417. console.log('主动申请成功');
  418. }
  419. })
  420. }
  421. }
  422. this.pupData.content=`<p>您暂无权限参加此活动,若想参加请联系</p>
  423. <p>对口销售${res.data.name}:${res.data.mobile}</p>`
  424. this.pupData.mobile=res.data.mobile
  425. }else if(res.data.type=='apply'){
  426. this.pupData.content=`<p>您暂无权限参加此活动,若想参加可以申请开通哦</p>`
  427. }
  428. this.pupData.show=true
  429. this.pupData={...this.pupData,...res.data}
  430. }
  431. }else{
  432. if(this.currentAudioMsg.play){
  433. this.globalBgMusic.pause()
  434. }else{
  435. this.globalBgMusic.play()
  436. }
  437. this.currentAudioMsg.show=!this.currentAudioMsg.show
  438. }
  439. },
  440. // 播放音频
  441. handlePlayAudio(item){
  442. this.globalBgMusic.src=item.voiceUrl
  443. this.globalBgMusic.title=item.voiceName
  444. this.globalBgMusic.onCanplay(()=>{
  445. this.globalBgMusic.play()
  446. this.currentAudioMsg.audioTime=item.voicePlaySeconds
  447. })
  448. this.handleAudioFun()
  449. },
  450. // 音频事件
  451. handleAudioFun(){
  452. this.globalBgMusic.onPlay(()=>{
  453. this.currentAudioMsg.play=true
  454. this.currentAudioMsg.audioCurrentUrl=this.globalBgMusic.src
  455. })
  456. this.globalBgMusic.onPause(()=>{
  457. this.currentAudioMsg.play=false
  458. })
  459. this.globalBgMusic.onStop(()=>{
  460. this.currentAudioMsg.play=false
  461. this.currentAudioMsg.play=false
  462. this.currentAudioMsg.audioCurrentTime=0
  463. this.currentAudioMsg.audioTime=0
  464. this.currentAudioMsg.audioCurrentUrl=0
  465. })
  466. this.globalBgMusic.onEnded(()=>{
  467. console.log('onEnded');
  468. this.currentAudioMsg.play=false
  469. this.handleAudioBtn('next','auto')
  470. })
  471. this.globalBgMusic.onError((e)=>{
  472. console.log('onError',e);
  473. })
  474. this.globalBgMusic.onTimeUpdate(()=>{
  475. console.log('时间更新');
  476. // if(this.globalBgMusic.src==this.currentAudioMsg.audioCurrentUrl){
  477. this.currentAudioMsg.audioCurrentTime=parseInt(this.globalBgMusic.currentTime)
  478. // }
  479. })
  480. },
  481. // 点击弹窗中的按钮
  482. handleAudioBtn(type,e){
  483. if(type==='center'){
  484. if(this.globalBgMusic.src){
  485. if(this.currentAudioMsg.play){
  486. this.globalBgMusic.pause()
  487. }else{
  488. this.globalBgMusic.play()
  489. }
  490. }else{
  491. this.handlePlayAudio(this.currentAudioMsg.list[0])
  492. }
  493. }
  494. if(type==='before'){
  495. if(!this.isFirstAudio){
  496. this.currentAudioMsg.list.forEach((_item,index)=>{
  497. if(_item.voiceUrl==this.currentAudioMsg.audioCurrentUrl){
  498. this.handlePlayAudio(this.currentAudioMsg.list[index-1])
  499. }
  500. })
  501. }
  502. }
  503. if(type==='next'){
  504. if(!this.isLastAudio){
  505. this.currentAudioMsg.list.forEach((_item,index)=>{
  506. if(_item.voiceUrl==this.currentAudioMsg.audioCurrentUrl){
  507. this.handlePlayAudio(this.currentAudioMsg.list[index+1])
  508. }
  509. })
  510. }else{
  511. if(e==='auto'){
  512. this.currentAudioMsg.play=false
  513. this.currentAudioMsg.audioCurrentTime=0
  514. this.currentAudioMsg.audioTime=0
  515. this.currentAudioMsg.audioCurrentUrl=''
  516. }
  517. }
  518. }
  519. },
  520. //点击弹窗中的音频项
  521. handleAudioChange(item){
  522. // 点击的同一个
  523. if(item.voiceUrl==this.currentAudioMsg.audioCurrentUrl){
  524. // if(this.currentAudioMsg.play){
  525. // this.globalBgMusic.pause()
  526. // }else{
  527. // this.globalBgMusic.play()
  528. // }
  529. }else{
  530. this.handlePlayAudio(item)
  531. }
  532. },
  533. //拖动进度条
  534. handleAudioSliderChange(e){
  535. const value=e.detail.value
  536. this.globalBgMusic.seek(value)
  537. },
  538. async init(){
  539. let userInfoRes=this.userInfo
  540. if(!this.userInfo.status){
  541. const res=await apiUserInfo()
  542. if(res.code===200){
  543. userInfoRes=res.data
  544. }
  545. }
  546. if(['正式','永续'].includes(userInfoRes.status)){
  547. this.onlySeeAuth=true
  548. }
  549. if(userInfoRes.status=='试用'&&userInfoRes.is_suspend==0){
  550. this.onlySeeAuth=true
  551. }
  552. this.getList('init')
  553. },
  554. handleAuthChange(e){
  555. this.onlySeeAuth=e.detail
  556. this.refreshPage()
  557. },
  558. // 切换tabbar页面时 整个刷新
  559. allRefresh(){
  560. this.tabActive= '1'
  561. this.statusActive='1'
  562. this.pupData={
  563. show:false,
  564. content:'',//弹窗html字符串
  565. type:'',
  566. mobile:"",
  567. }
  568. this.page = 1
  569. this.list = []
  570. this.finished = false
  571. this.getList()
  572. },
  573. // 监听详情中设置提醒
  574. addEventListenerRemind(){
  575. uni.$on('activityDetailSetRemind',e=>{
  576. this.list.forEach((item,index) => {
  577. if(item.activityId==e.id){
  578. this.handleUpateRemindStatus(index)
  579. }
  580. });
  581. })
  582. },
  583. // 监听详情中报名
  584. addEventListenerRegister(){
  585. uni.$on('activityDetailSetRegister',e=>{
  586. this.list.forEach((item,index) => {
  587. if(item.activityId==e.id){
  588. this.handleUpdateRegister(index)
  589. }
  590. });
  591. })
  592. },
  593. //搜索
  594. onSearch(){
  595. this.refreshPage()
  596. this.getList()
  597. },
  598. //清除搜索内容
  599. onClearSearch(){
  600. this.searchVal=''
  601. this.refreshPage()
  602. this.getList()
  603. },
  604. // 同步搜索关键词
  605. searchValChange(e){
  606. this.searchVal=e.detail
  607. },
  608. // 类型切换
  609. tabChange(e) {
  610. const type = e.target.dataset.type
  611. if (!type||type === this.tabActive) return
  612. this.tabActive = type
  613. this.statusActive = '1'
  614. this.refreshPage()
  615. },
  616. // 状态切换
  617. statusChange(e) {
  618. const status = e.target.dataset.status
  619. if (!status||status === this.statusActive) return
  620. this.statusActive = status
  621. this.refreshPage()
  622. },
  623. // 刷新页面
  624. refreshPage() {
  625. this.page = 1
  626. this.list = []
  627. this.finished = false
  628. this.getList()
  629. },
  630. handleGoDetail(id) {
  631. uni.navigateTo({
  632. url: '/pages-activity/detail?id=' + id
  633. });
  634. },
  635. async getList(e) {
  636. const res = await apiActivityList({
  637. title:this.searchVal,
  638. active_state: Number(this.statusActive),
  639. activity_type: Number(this.tabActive),
  640. has_permission:this.onlySeeAuth?1:0,
  641. page: this.page,
  642. limit: this.pageSize
  643. })
  644. if(e=='init'){
  645. this.isInit=false
  646. }
  647. if (res.code === 200) {
  648. if(res.data){
  649. this.list = [...this.list, ...res.data]
  650. }else{
  651. this.finished=true
  652. }
  653. }
  654. },
  655. handleRemind(e,index){
  656. if(e.hasRemind===0){
  657. this.handleAddRemind(e,index)
  658. }else{
  659. this.handleCancelRemind(e,index)
  660. }
  661. },
  662. // 添加提醒
  663. async handleAddRemind(e,index){
  664. const res=await apiActivityAddRemind({activity_id:Number(e.activityId)})
  665. if(res.code===200){
  666. this.pupData.content=`<h4 style="text-align:center;margin-bottom:5px">设置成功</h4>
  667. <p>关注【弘则研究】公众号,接收会前15分钟微信提醒,并及时获取活动信息变更通知</p>`
  668. this.pupData.show=true
  669. this.handleUpateRemindStatus(index)
  670. }else if(res.code===4001){
  671. if(res.data.type=='time'){
  672. this.pupData.content=`<p>会议开始前15分钟内无法设置会议提醒</p>`
  673. this.pupData.type='time'
  674. }
  675. this.pupData.show=true
  676. }else if(res.code===403){
  677. if(res.data.type=='contact'){
  678. if(!res.data.customer_info.has_apply){
  679. if(res.data.customer_info.status=='冻结'||(res.data.customer_info.status=='试用'&&res.data.customer_info.is_suspend==1)){
  680. apiApplyPermission({
  681. company_name:res.data.customer_info.company_name,
  682. real_name:res.data.customer_info.name,
  683. source:2,
  684. from_page:'活动列表'
  685. }).then(res=>{
  686. if(res.code===200){
  687. console.log('主动申请成功');
  688. }
  689. })
  690. }
  691. }
  692. this.pupData.content=`<p>您暂无权限参加此会议,若想参加请联系</p>
  693. <p>对口销售${res.data.name}:${res.data.mobile}</p>`
  694. this.pupData.mobile=res.data.mobile
  695. }else if(res.data.type=='apply'){
  696. this.pupData.content=`<p>您暂无权限参加此会议,若想参加可以申请开通哦</p>`
  697. }
  698. this.pupData.show=true
  699. this.pupData={...this.pupData,...res.data}
  700. }
  701. },
  702. //取消提醒
  703. async handleCancelRemind(e,index){
  704. const res=await apiActivityCancelRemind({activity_id:Number(e.activityId)})
  705. if(res.code===200){
  706. uni.showToast({
  707. title:"取消提醒成功",
  708. icon:"none"
  709. })
  710. this.handleUpateRemindStatus(index)
  711. }else if(res.code===403){
  712. uni.showToast({
  713. title:res.msg,
  714. icon:"none"
  715. })
  716. }
  717. },
  718. //更新列表中某项的设置提醒状态
  719. handleUpateRemindStatus(index){
  720. if(this.list[index].hasRemind===0){
  721. this.list[index].hasRemind=1
  722. }else{
  723. this.list[index].hasRemind=0
  724. }
  725. },
  726. handleRegister(e,index){
  727. if(e.registerState===0){
  728. this.handleAddRegister(e,index)
  729. }else{
  730. this.handleCancelRegister(e,index)
  731. }
  732. },
  733. // 线下报名
  734. async handleAddRegister(e,index){
  735. const res=await apiActivityRegister({activity_id:Number(e.activityId)})
  736. if(res.code===200){
  737. this.pupData.content=`<h4 style="text-align:center;margin-bottom:5px">报名成功</h4>
  738. <p>关注【弘则研究】公众号,接收会前1小时微信提醒,并及时获取活动信息变更通知</p>`
  739. this.pupData.show=true
  740. this.handleUpdateRegister(index)
  741. }else if(res.code===4001){
  742. if(res.data.type=='time'){
  743. this.pupData.content=`<p>活动开始前15分钟内无法设置会议提醒</p>`
  744. this.pupData.type='time'
  745. }else if(res.data.type=='full'){
  746. this.pupData.content=`<p>此活动报名人数已满,请留意下期活动</p>`
  747. this.pupData.type='full'
  748. }
  749. this.pupData.show=true
  750. }else if(res.code===403){
  751. if(res.data.type=='contact'){
  752. if(!res.data.customer_info.has_apply){
  753. if(res.data.customer_info.status=='冻结'||(res.data.customer_info.status=='试用'&&res.data.customer_info.is_suspend==1)){
  754. apiApplyPermission({
  755. company_name:res.data.customer_info.company_name,
  756. real_name:res.data.customer_info.name,
  757. source:2,
  758. from_page:'活动列表'
  759. }).then(res=>{
  760. if(res.code===200){
  761. console.log('主动申请成功');
  762. }
  763. })
  764. }
  765. }
  766. this.pupData.content=`<p>您暂无权限参加此活动,若想参加请联系</p>
  767. <p>对口销售${res.data.name}:${res.data.mobile}</p>`
  768. this.pupData.mobile=res.data.mobile
  769. }else if(res.data.type=='apply'){
  770. this.pupData.content=`<p>您暂无权限参加此活动,若想参加可以申请开通哦</p>`
  771. }
  772. this.pupData.show=true
  773. this.pupData={...this.pupData,...res.data}
  774. }
  775. },
  776. //取消线下报名
  777. async handleCancelRegister(e,index){
  778. const res=await apiActivityCancelRegister({activity_id:Number(e.activityId)})
  779. if(res.code===200){
  780. uni.showToast({
  781. title:"取消报名成功",
  782. icon:"none"
  783. })
  784. this.handleUpdateRegister(index)
  785. }else if(res.code===403){
  786. uni.showToast({
  787. title:res.msg,
  788. icon:"none"
  789. })
  790. }
  791. },
  792. // 更新报名状态
  793. handleUpdateRegister(index){
  794. if(this.list[index].registerState===0){
  795. this.list[index].registerState=1
  796. }else{
  797. this.list[index].registerState=0
  798. }
  799. },
  800. // 点击立即申请
  801. async handleApply(){
  802. if(this.pupData.customer_info.has_apply){//已经申请过
  803. this.pupData.content=`<p>您已提交过申请,请耐心等待</p>`
  804. this.pupData.type=''
  805. }else{
  806. if(!this.pupData.customer_info.status||this.pupData.customer_info.status!='流失'){
  807. uni.navigateTo({
  808. url:"/pages-applyPermission/applyPermission?source=2"
  809. })
  810. }else{//主动调一次申请权限接口
  811. const res=await apiApplyPermission({
  812. company_name:this.pupData.customer_info.company_name,
  813. real_name:this.pupData.customer_info.name,
  814. source:2,
  815. from_page:'活动列表'
  816. })
  817. if(res.code===200){
  818. this.pupData.content=`<p>申请已提交</p><p>请等待销售人员与您联系</p>`
  819. this.pupData.type=''
  820. }
  821. }
  822. }
  823. },
  824. // 拨打电话
  825. handleCallPhone(tel){
  826. uni.makePhoneCall({
  827. phoneNumber: tel
  828. });
  829. }
  830. }
  831. }
  832. </script>
  833. <style lang="scss">
  834. .audio-popup-box{
  835. .title{
  836. font-size: 16px;
  837. font-weight: bold;
  838. padding: 40rpx 34rpx 0 34rpx;
  839. }
  840. .list{
  841. max-height: 50vh;
  842. overflow-y: auto;
  843. }
  844. .item{
  845. padding: 34rpx 52rpx 34rpx 34rpx;
  846. border-bottom: 1px solid $global-border-color;
  847. justify-content: space-between;
  848. image{
  849. width: 48rpx;
  850. height: 48rpx;
  851. flex-shrink: 0;
  852. }
  853. }
  854. .box{
  855. align-items: center;
  856. padding: 0rpx 54rpx 30rpx 54rpx;
  857. text{
  858. width: 110rpx;
  859. display: inline-block;
  860. font-size: 12px;
  861. }
  862. slider{
  863. flex: 1;
  864. }
  865. }
  866. .btns{
  867. width: 45%;
  868. margin-left: auto;
  869. margin-right: auto;
  870. margin-bottom: 20rpx;
  871. justify-content: space-between;
  872. image{
  873. width: 58rpx;
  874. height: 58rpx;
  875. }
  876. .next{
  877. transform: rotate(180deg);
  878. }
  879. }
  880. }
  881. .search-wrap {
  882. padding: 0 8rpx;
  883. background-color: $global-bg-color;
  884. }
  885. .tabs-wrap {
  886. background-color: $global-bg-color;
  887. box-shadow: $global-tab-shadow-color;
  888. align-items: center;
  889. text-align: center;
  890. font-size: $global-font-size-lg;
  891. color: $global-text-color-grey;
  892. position: relative;
  893. z-index: 10;
  894. .tab-item {
  895. flex: 1;
  896. height: 94rpx;
  897. line-height: 94rpx;
  898. }
  899. .tab-active {
  900. font-weight: bold;
  901. color: $global-text-color-main;
  902. border-bottom: 6rpx solid $global-text-color-main;
  903. }
  904. }
  905. .status-wrap {
  906. background-color: $global-bg-color;
  907. padding: 40rpx 34rpx 20rpx 34rpx;
  908. overflow-x: scroll;
  909. width: 100%;
  910. margin-right: 34rpx;
  911. align-items: center;
  912. &::-webkit-scrollbar{
  913. width: 0;
  914. display: none;
  915. }
  916. .status-item {
  917. font-size: $global-font-size-sm;
  918. color: #444;
  919. min-width: 167rpx;
  920. text-align: center;
  921. padding: 14rpx;
  922. border-radius: 40rpx;
  923. background-color: #f6f6f6;
  924. margin-right: 40rpx;
  925. // height: 60rpx;
  926. }
  927. .status-active {
  928. background: linear-gradient(270deg, #efc896 0%, #d9a35f 100%);
  929. color: $global-bg-color;
  930. }
  931. .auth-box{
  932. margin-right: 40rpx;
  933. .text{
  934. color: $global-text-color-main;
  935. font-size: $global-font-size-sm;
  936. min-width: 120rpx;
  937. white-space: nowrap;
  938. }
  939. }
  940. }
  941. .list {
  942. padding: 34rpx;
  943. .item {
  944. position: relative;
  945. margin-bottom: 30rpx;
  946. .status-box {
  947. top: 0;
  948. right: 0;
  949. position: absolute;
  950. width: 132rpx;
  951. line-height: 44rpx;
  952. text-align: center;
  953. font-size: $global-font-size-sm;
  954. color: $global-text-color-white;
  955. }
  956. .status-before {
  957. background-color: #e3b377;
  958. }
  959. .status-progress {
  960. background-color: #3385ff;
  961. }
  962. .status-end {
  963. background-color: #a2a2a2;
  964. }
  965. .top {
  966. padding-top: 64rpx;
  967. padding-left: 30rpx;
  968. padding-right: 30rpx;
  969. padding-bottom: 42rpx;
  970. .avatar {
  971. width: 168rpx;
  972. height: 168rpx;
  973. border-radius: 50%;
  974. margin-right: 30rpx;
  975. flex-shrink: 0;
  976. border: 1px solid $global-border-color;
  977. }
  978. .title {
  979. font-size: $global-font-size-lg;
  980. font-weight: bold;
  981. width: 400rpx;
  982. padding-right: 80rpx;
  983. padding-bottom: 10rpx;
  984. border-bottom: 1px solid $global-border-color;
  985. }
  986. .name {
  987. color: $global-text-color-grey;
  988. margin: 20rpx 0;
  989. }
  990. .time {
  991. font-size: $global-font-size-sm;
  992. color: $global-text-color-999;
  993. }
  994. }
  995. .bot {
  996. border-top: 1px solid $global-border-color;
  997. color: $global-text-color-999;
  998. view {
  999. line-height: 72rpx;
  1000. flex: 1;
  1001. text-align: center;
  1002. border-right: 1px solid $global-border-color;
  1003. }
  1004. view:last-child {
  1005. border: none;
  1006. }
  1007. .active{
  1008. color: #E3B377;
  1009. }
  1010. }
  1011. .content{
  1012. width: 420rpx;
  1013. position: relative;
  1014. .icon-box{
  1015. align-items: center;
  1016. position: absolute;
  1017. right: 0;
  1018. top: -10rpx;
  1019. font-size: $global-font-size-sm;
  1020. color:$global-text-color-main;
  1021. width: 100rpx;
  1022. height: 70rpx;
  1023. justify-content: center;
  1024. image{
  1025. width: 26rpx;
  1026. height: 26rpx;
  1027. margin-right: 4rpx;
  1028. }
  1029. }
  1030. }
  1031. }
  1032. }
  1033. </style>