activity.vue 36 KB

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