activity.vue 35 KB

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