activity.vue 35 KB

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