activity.vue 38 KB

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