activityDetail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <img :src="img" alt="" class="topimg">
  5. </view>
  6. <view class="cont">
  7. <view class="name">{{info.activityName}}</view>
  8. <view class="name2" v-if="info.startTime">{{info.startTime.slice(0,10)}}~{{info.endTime.slice(0,10)}}</view>
  9. <view class="name3">{{info.activityContent}}</view>
  10. </view>
  11. <view class="shopBox">
  12. <view class="shopBoxTop">
  13. <view class="shopMs">活动门店</view>
  14. <view class="shopTy" @click="showuse">
  15. <view class="shopTyTxt">{{shopckList.length}}家门店通用</view>
  16. <img src="../../static/img/jt2.png" alt="" class="shopjt">
  17. </view>
  18. </view>
  19. <view class="shopCont">
  20. <view class="shopContLeft">
  21. <view class="shopName">{{shopInfo.shopName}}</view>
  22. <view class="shopaddress">{{shopInfo.address}}</view>
  23. </view>
  24. <view class="shopContRight">
  25. <view class="shopContRightLine" @click="getmap">
  26. <img src="../../static/img/icon_map.png" alt="" class="shopRightIcon">
  27. <view class="shopRightTxt">地图</view>
  28. </view>
  29. <view class="shopRightSx"></view>
  30. <view class="shopContRightLine" @click="call">
  31. <img src="../../static/img/icon_phone.png" alt="" class="shopRightIcon">
  32. <view class="shopRightTxt">电话</view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="detailBOx" v-if="imgListArr">
  38. <view class="detailTitle">活动详情</view>
  39. <view class="detailImgBox" v-for="(item,index) in imgListArr">
  40. <img :src="item.img" alt="" class="detailImg">
  41. </view>
  42. </view>
  43. <view style="height: 120rpx;"></view>
  44. <view class="bottom" >
  45. <view class="bottomLeft" @click="edit1" v-if="iOSInfo.indexOf('Q022')!=-1||!iOSInfo" >编辑活动内容</view>
  46. <view class="bottomRight" @click="goshare" v-if="iOSInfo.indexOf('Q022')!=-1||!iOSInfo">分享</view>
  47. <view class="bottomRight2" @click="goshare" v-else>分享</view>
  48. </view>
  49. <!-- 适用门店 -->
  50. <view class="baomingBox ckshopBox" v-if="useShopShow" @click="noShowShop2">
  51. <view class="baomingCont" @click.stop="">
  52. <view class="bmTop">
  53. <view class="bmTitle">活动门店</view>
  54. <img src="../../static/img/chahao.png" alt="" class="bmChimg" @click="noShowShop2">
  55. </view>
  56. <view style="padding: 0 24rpx; height: 45vh;overflow-y: scroll;">
  57. <view class="ckshopLine" v-for="(item,index) in shopckList" >
  58. <view class="shoplineLeft">
  59. <image :src="item.photoPath" mode="" class="shopImg" v-if="item.photoPath"></image>
  60. <image src="../../static/img/noimg.png" mode="" class="shopImg" v-else></image>
  61. </view>
  62. <view class="shopright" style="padding-left: 20rpx;">
  63. <view class="shopTop">
  64. <view class="shopName">{{item.shopName}}</view>
  65. </view>
  66. <view class="brandsBg" v-if="item.brands">
  67. <view class="brands" v-for="(v,index2) in item.brands.split(',')">{{v}}</view>
  68. </view>
  69. <view class="shopTime"><span v-if="item.startTime">{{item.startTime}}</span> - <span
  70. v-if="item.endTime">{{item.endTime}}</span> </view>
  71. <view class="shopBottomLeft">
  72. <span class="shopaddress"
  73. v-if="item.address">{{item.provinceName}}{{item.cityName}}{{item.areaName}}{{item.address}}</span>
  74. <span v-if="item.distance&&item.distance!= '0.00'">{{item.distance}}km</span>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <!-- <audio id="video" controls autoplay="autoplay" ref="iosclick" loop="loop" >
  82. <source src="http://dmsimg.66km.com/music/sakuratears.mp3" type="audio/mpeg">
  83. </audio> -->
  84. <img src="../../static/img/mp3.png" class="mp3Img" @click="play()" v-if="!payshow&mp3Url!=''">
  85. <img src=".../../static/img/mp31.png" class="mp3Img" @click="play2()" id="bofang" v-if="payshow&mp3Url!=''">
  86. </view>
  87. </template>
  88. <script>
  89. export default {
  90. data() {
  91. return {
  92. info:'',
  93. type:'',
  94. shopNum:'',
  95. shopInfo:'',
  96. useShopShow:false,
  97. shopckList:'',
  98. ckmusic:'',
  99. bgmMusic:'',
  100. payshow:false,
  101. mp3Url:'',
  102. id:'',
  103. img:'',
  104. imgListArr:'',
  105. iOSInfo:'',
  106. }
  107. },
  108. onLoad(opt) {
  109. // if(opt.type==1){
  110. // this.type=1;
  111. // this.info = uni.getStorageSync("editdata");
  112. // this.shopNum=this.info.shopList.split(',').length
  113. // uni.setNavigationBarTitle({
  114. // title:this.info.activityName
  115. // })
  116. // }
  117. this.id=opt.id;
  118. this.getDetails()
  119. var qxnum=uni.getStorageSync("quanxian");
  120. if(qxnum==1){
  121. this.iOSInfo = JSON.parse(JSON.stringify(window.iOSInfo));
  122. }else if(qxnum==2){
  123. window.getAndroid=this.getAndroid;
  124. }
  125. /* this.shopckList= uni.getStorageSync("shopckList");
  126. this.ckmusic=uni.getStorageSync("ckmusic");
  127. if(this.ckmusic){
  128. this.mp3Url=this.ckmusic.music;
  129. this.bgmMusic = uni.createInnerAudioContext();
  130. this.bgmMusic.autoplay = true;//自动播放
  131. this.bgmMusic.loop = true;//循环播放
  132. this.bgmMusic.src = 'http://dmsimg.66km.com/music/sakuratears.mp3';//背景音乐地址
  133. this.bgmMusic.onPlay(function(){
  134. console.log('背景音乐播放中');
  135. });
  136. this.bgmMusic.onError((res) => {
  137. console.log(res.errMsg);
  138. console.log(res.errCode);
  139. });
  140. } */
  141. //console.log(this.bgmMusic)
  142. },
  143. onUnload(){
  144. this.bgmMusic.stop()
  145. },
  146. methods: {
  147. getAndroid(e){
  148. this.iOSInfo=e
  149. },
  150. goshare(){
  151. var obj={
  152. ActivityContent: this.info.activityContent,
  153. ActivityName:this.info.activityName,
  154. EndTime: this.info.endTime,
  155. ID: this.info.id,
  156. Img: this.img,
  157. StartTime: this.info.createTime,
  158. state: '',
  159. }
  160. console.log(obj)
  161. var standalone = window.navigator.standalone
  162. var userAgent = window.navigator.userAgent.toLowerCase()
  163. var safari = /safari/.test(userAgent)
  164. var ios = /iphone|ipod|ipad|mac/.test(userAgent)
  165. var android = /android/.test(userAgent)
  166. if (ios) {
  167. if ( true) {//!standalone&& !safari
  168. window.webkit.messageHandlers.goShare.postMessage(obj)
  169. }
  170. } else if (android) {
  171. window.android.postMessage()
  172. }
  173. },
  174. getDetails(){
  175. uni.showLoading({
  176. title: '加载中'
  177. })
  178. this.$http('openH5SetTheGuest/getAtivityDetails', {
  179. id:this.id
  180. },'GET').then(res => {
  181. uni.hideLoading();
  182. this.info=res.data.data
  183. // this.activityName=jkdata.activityName;
  184. // this.activityContent=jkdata.activityContent;
  185. // this.money=jkdata.money;
  186. // this.number=jkdata.number;
  187. // this.clWhereString=jkdata.clWhere;
  188. // this.clWhereList=this.clWhereString.split(',');
  189. // this.startTime=jkdata.startTime.slice(0,10);
  190. // this.endTime=jkdata.endTime.slice(0,10);
  191. // this.payType=jkdata.payType;
  192. this.img=res.data.img.img;
  193. /* if(res.data.imgList){
  194. res.data.imgList.forEach(item=>{
  195. this.imgListArr.push(item.img)
  196. })
  197. } */
  198. this.imgListArr=res.data.imgList
  199. this.shopckList=res.data.shopList;
  200. console.log()
  201. this.getShopinfo()
  202. this.ckMusic=res.data.selectedMusic;
  203. if(this.ckMusic){
  204. this.music=this.ckMusic.id;
  205. }else{
  206. }
  207. //console.log(this.imgListArr)
  208. //this.list=res.data
  209. })
  210. },
  211. play2(){
  212. this.bgmMusic.play();
  213. this.payshow=false;
  214. },
  215. play(){
  216. this.payshow=true;
  217. this.bgmMusic.stop(()=>{
  218. console.log('背景音乐停止了');
  219. });
  220. },
  221. noShowShop2(){
  222. this.useShopShow=false;
  223. },
  224. showuse(){
  225. this.useShopShow=true;
  226. },
  227. call() {
  228. uni.makePhoneCall({
  229. phoneNumber: this.shopInfo.mobilePhone
  230. });
  231. },
  232. getmap() {
  233. console.log("打开地图");
  234. return false;
  235. var that = this;
  236. if (!that.shopInfo.lat || !that.shopInfo.lng) {
  237. uni.showToast({
  238. title: '该店铺未设置定位',
  239. icon: 'none',
  240. duration: 3000
  241. });
  242. } else {
  243. uni.openLocation({
  244. latitude: Number(that.shopInfo.lat),
  245. longitude: Number(that.shopInfo.lng),
  246. name: that.shopInfo.shopName,
  247. address: that.shopInfo.provinceName + that.shopInfo.cityName + that.shopInfo.areaName + that.shopInfo.address,
  248. success: function() {
  249. console.log('success');
  250. },
  251. fail(err) {
  252. console.log(err)
  253. }
  254. });
  255. }
  256. },
  257. edit1(){
  258. uni.navigateTo({
  259. url: 'eadit?id=' + this.id
  260. })
  261. },
  262. auditSetTheGuest(){
  263. uni.showLoading({
  264. title: '加载中'
  265. })
  266. this.$http('openH5SetTheGuest/auditSetTheGuest', this.info,'POST').then(res => {
  267. uni.hideLoading();
  268. if(res.code==0){
  269. uni.showToast({
  270. title: '活动已生成',
  271. icon:'none',
  272. duration: 2000
  273. });
  274. uni.navigateTo({
  275. url:'activity?type=2'
  276. })
  277. }
  278. //this.list=res.data
  279. })
  280. },
  281. getShopinfo(){
  282. this.$http('openH5SetTheGuest/getShopinfo',{},'GET').then(res => {
  283. //this.shopInfo=res.data;
  284. var shopinfo=res.data;
  285. this.shopckList.forEach(item=>{
  286. if(item.id==shopinfo.id){
  287. this.shopInfo=shopinfo
  288. }
  289. })
  290. if(this.shopInfo==''){
  291. this.shopInfo=this.shopckList[0]
  292. }
  293. })
  294. },
  295. generate(){
  296. var that=this;
  297. uni.showModal({
  298. title: '提示',
  299. content: '活动已生成,是否立即启用',
  300. cancelText:'暂不启用',
  301. confirmText:'立即启用',
  302. success: function(res) {
  303. if (res.confirm) {
  304. that.info.clState=2;
  305. that.auditSetTheGuest()
  306. }else{
  307. console.log("no")
  308. that.info.clState=1;
  309. that.auditSetTheGuest()
  310. }
  311. }
  312. });
  313. }
  314. }
  315. }
  316. </script>
  317. <style scoped>
  318. .mp3Img{
  319. /* transform: translate(-1584.4%, 121.5%) scale(1); */
  320. position: fixed;
  321. top: 100rpx;
  322. right: 40rpx;
  323. width: 60rpx;
  324. height: 60rpx;
  325. }
  326. .shopImg {
  327. width: 146rpx;
  328. height: 146rpx;
  329. border-radius: 6rpx;
  330. }
  331. .ckshopLine{
  332. display: flex;
  333. padding: 20rpx 0;
  334. border-bottom: 1px solid #EEEEEE;
  335. }
  336. .baomingBox{
  337. width: 750rpx;
  338. height: 100vh;
  339. background: rgba(0, 0, 0, 0.4);
  340. position: fixed;
  341. top: 0;
  342. left: 0;
  343. z-index: 11;
  344. }
  345. .bmshopjt{
  346. width: 12rpx;
  347. height: 20rpx;
  348. margin-top: 10rpx;
  349. }
  350. .bmlineInput{
  351. color: #333333;
  352. font-size: 28rpx;
  353. height: 98rpx;
  354. line-height: 98rpx;
  355. }
  356. .bmshopname{
  357. font-weight: 400;
  358. color: #999999;
  359. font-size: 28rpx;
  360. line-height: 40rpx;
  361. width: 500rpx;
  362. white-space:nowrap;
  363. overflow:hidden;
  364. text-overflow:ellipsis;
  365. }
  366. .bmshopLine{
  367. display: flex;
  368. justify-content: space-between;
  369. padding: 26rpx 0;
  370. border-bottom: 1px solid #EEEEEE;
  371. }
  372. .bmLine{
  373. border-bottom: 1px solid #EEEEEE;
  374. }
  375. .bmTop{
  376. display: flex;
  377. justify-content: space-between;
  378. padding: 40rpx 24rpx 10rpx 24rpx;
  379. }
  380. .bmTitle{
  381. font-weight: 500;
  382. color: #3C3C3C;
  383. font-size: 30rpx;
  384. line-height: 36rpx;
  385. }
  386. .bmChimg{
  387. width: 36rpx;
  388. height: 36rpx;
  389. }
  390. .baomingCont{
  391. position: absolute;
  392. width: 750rpx;
  393. height:850rpx;
  394. padding-bottom: constant(safe-area-inset-bottom);
  395. padding-bottom: env(safe-area-inset-bottom);
  396. left: 0;
  397. bottom: 0;
  398. background: #ffffff;
  399. border-radius: 24rpx 24rpx 0px 0px;
  400. }
  401. .shopRightIcon{
  402. width: 44rpx;
  403. height: 44rpx;
  404. display: block;
  405. margin: 0 auto;
  406. margin-bottom: 10rpx;
  407. }
  408. .shopName{
  409. color: #3C3C3C;
  410. font-size: 28rpx;
  411. }
  412. .shopaddress{
  413. font-weight: 400;
  414. color: #999999;
  415. font-size: 24rpx;
  416. padding-top: 10rpx;
  417. width: 500rpx;
  418. }
  419. .shopRightSx{
  420. width: 2rpx;
  421. height: 69rpx;
  422. background:#EEEEEE ;
  423. margin-left: 34rpx;
  424. margin-right: 34rpx;
  425. margin-top: 14rpx;
  426. }
  427. .shopCont{
  428. display: flex;
  429. justify-content: space-between;
  430. padding-top: 25rpx;
  431. }
  432. .shopContRight{
  433. display: flex;
  434. }
  435. .shopContRightLine{
  436. text-align: center;
  437. color: #999999;
  438. font-size: 24rpx;
  439. }
  440. .content{
  441. min-height: 100vh;
  442. background:#F4F5F7;
  443. }
  444. .detailImg{
  445. width: 750rpx;
  446. display: block;
  447. }
  448. .detailBOx{
  449. background: #ffffff;
  450. margin-top: 20rpx;
  451. }
  452. .detailTitle{
  453. color: #3C3C3C;
  454. font-weight: 500;
  455. padding: 20rpx 24rpx;
  456. font-size: 30rpx;
  457. }
  458. .topimg{
  459. width: 750rpx;
  460. }
  461. .shopMs{
  462. font-weight: 500;
  463. color: #222222;
  464. line-height: 42rpx;
  465. font-size: 30rpx;
  466. }
  467. .shopBox{
  468. background: #ffffff;
  469. margin-top: 20rpx;
  470. padding: 20rpx 34rpx;
  471. }
  472. .shopBoxTop{
  473. display: flex;
  474. justify-content: space-between;
  475. }
  476. .shopTy{
  477. display: flex;
  478. }
  479. .shopTyTxt{
  480. font-weight: 400;
  481. color: #666666;
  482. font-size: 24rpx;
  483. line-height: 42rpx;
  484. }
  485. .shopjt{
  486. width: 14rpx;
  487. height: 23rpx;
  488. margin-top: 10rpx;
  489. margin-left: 10rpx;
  490. }
  491. .cont{
  492. background: #ffffff;
  493. border-radius: 24rpx 24rpx 0px 0px;
  494. margin-top: -30rpx;
  495. padding: 30rpx 24rpx;
  496. position: relative;
  497. }
  498. .name{
  499. color: #3C3C3C;
  500. line-height: 42rpx;
  501. font-weight: 500;
  502. font-size: 30rpx;
  503. }
  504. .name2{
  505. color: #3C3C3C;
  506. line-height: 36rpx;
  507. font-weight: 400;
  508. font-size: 26rpx;
  509. padding-top: 16rpx;
  510. }
  511. .name3{
  512. color: #999999;
  513. line-height: 36rpx;
  514. font-weight: 400;
  515. font-size: 26rpx;
  516. padding-top: 16rpx;
  517. }
  518. .bottom{
  519. width: 750rpx;
  520. height: 98rpx;
  521. background: #FFFFFF;
  522. position: fixed;
  523. bottom: 0;
  524. left: 0;
  525. display: flex;
  526. }
  527. .bottomLeft{
  528. width: 375rpx;
  529. line-height: 98rpx;
  530. text-align: center;
  531. color: #3C3C3C;
  532. font-size: 30rpx;
  533. }
  534. .bottomRight{
  535. width: 375rpx;
  536. height: 98rpx;
  537. background: #3F90F7;
  538. line-height: 98rpx;
  539. text-align: center;
  540. color: #FFFFFF;
  541. font-size: 30rpx;
  542. }
  543. .bottomRight2{
  544. width: 750rpx;
  545. height: 98rpx;
  546. background: #3F90F7;
  547. line-height: 98rpx;
  548. text-align: center;
  549. color: #FFFFFF;
  550. font-size: 30rpx;
  551. }
  552. .brandsBg {
  553. display: flex;
  554. height: 38rpx;
  555. flex-wrap: wrap;
  556. align-items: center;
  557. overflow: hidden;
  558. padding: 5rpx 0rpx;
  559. }
  560. .brands {
  561. border-radius: 4rpx;
  562. padding: 0 5rpx;
  563. color: #F19D01;
  564. height: 28rpx;
  565. border: 1px solid #F19D01;
  566. font-size: 20rpx;
  567. line-height: 28rpx;
  568. margin: 5rpx 10rpx 5rpx 0rpx;
  569. }
  570. .timeBg {
  571. display: flex;
  572. }
  573. .shopTime {
  574. color: #666666;
  575. font-size: 22rpx;
  576. }
  577. .addressBox {
  578. color: #666666;
  579. font-size: 22rpx;
  580. }
  581. </style>