index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <view class="cm-contact" v-if="activityEntryVisiable || contactVisiable">
  3. <!-- 未展开状态 -->
  4. <view class="cm-close-box" v-show="!isActive">
  5. <view class="cm-icon cm-entry" @click="handleToggleEntry(true)" v-if="activityEntryVisiable"></view>
  6. <view class="cm-icon cm-bround cm-open-btn" @click="handleToggleAcitve(true)" v-if="contactVisiable"></view>
  7. </view>
  8. <!-- 展开状态 -->
  9. <view class="cm-close-box" v-show="contactVisiable && isActive">
  10. <view class="cm-icon cm-entry" @click="handleToggleEntry(true)" v-if="activityEntryVisiable"></view>
  11. <view class="cm-icon cm-bround cm-mobile" @click="handelShowMobile">
  12. <view class="cm-dialog" v-show="mobileVisiable">
  13. <view class="cm-dialog-content content1">
  14. <view class="cm-item"> <text>展会咨询电话:13766896620</text> </view>
  15. <view class="cm-line line1"></view>
  16. <view class="cm-item"> <text>业务咨询电话:13766896620</text> </view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="cm-icon cm-bround cm-ewm" @click="handelShowWechat">
  21. <view class="cm-dialog" v-show="wechatVisiable">
  22. <view class="cm-dialog-content content2">
  23. <view class="cm-item">
  24. <image
  25. src="https://static.caimei365.com/app/img/icon2/cm_entry_bg.png"
  26. mode="widthFix"
  27. ></image>
  28. <text>展会咨询微信</text>
  29. </view>
  30. <view class="cm-line line2"></view>
  31. <view class="cm-item">
  32. <image
  33. src="https://static.caimei365.com/app/img/icon2/cm_entry_bg.png"
  34. mode="widthFix"
  35. ></image>
  36. <text>业务咨询微信</text>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="cm-icon cm-bround cm-close-btn" @click="handleToggleAcitve(false)"></view>
  42. </view>
  43. <view class="mask cover" v-if="activityEntryVisiable && entryVisiable">
  44. <view class="content">
  45. <image src="https://static.caimei365.com/app/img/icon2/cm_entry_bg.png" mode="widthFix" @click="navigator"></image>
  46. <view class="mask-close" @click="handleToggleEntry(false)"></view>
  47. </view>
  48. </view>
  49. <view class="mask" v-if="mobileVisiable || wechatVisiable" @click="handleClose"></view>
  50. </view>
  51. </template>
  52. <script>
  53. export default {
  54. props: {
  55. pageInfo: {
  56. type: Object
  57. }
  58. },
  59. data() {
  60. return {
  61. isActive: true,
  62. mobileVisiable: false,
  63. wechatVisiable: false,
  64. entryVisiable: true,
  65. activityEntryVisiable: false,
  66. contactVisiable: false
  67. }
  68. },
  69. created() {
  70. this.contactVisiable = this.pageInfo.infoBarStatus === 1
  71. this.activityEntryVisiable = this.initActivityEntry(
  72. this.pageInfo.redPacketBeginTime,
  73. this.pageInfo.redPacketEndTime
  74. )
  75. console.log(this.pageInfo)
  76. },
  77. methods: {
  78. // 是否展开
  79. handleToggleAcitve(active) {
  80. this.isActive = active
  81. this.mobileVisiable = false
  82. this.wechatVisiable = false
  83. },
  84. // 显示微信二维码
  85. handelShowWechat() {
  86. this.wechatVisiable = !this.wechatVisiable
  87. this.mobileVisiable = false
  88. },
  89. // 显示联系电话
  90. handelShowMobile() {
  91. this.mobileVisiable = !this.mobileVisiable
  92. this.wechatVisiable = false
  93. },
  94. // 隐藏微信二维码和联系电话
  95. handleClose() {
  96. this.mobileVisiable = false
  97. this.wechatVisiable = false
  98. },
  99. // 显示活动入口
  100. handleToggleEntry(visiable) {
  101. this.entryVisiable = visiable
  102. },
  103. navigator(){
  104. // 友盟自定义事件
  105. if(process.env.NODE_ENV != 'development'){
  106. this.$uma.trackEvent('meibohui_cloud_click', {
  107. Um_Key_PageName: '云上美博会',
  108. Um_Key_PageCategory: '活动专题页面',
  109. Um_Key_SourcePage: '活动专题页面',
  110. })
  111. }
  112. this.$api.navigateTo('/pages/user/coupon/coupon-collection')
  113. this.entryVisiable = false
  114. },
  115. // 初始化红包入口状态
  116. initActivityEntry(begin, end) {
  117. const nowTime = new Date().getTime()
  118. const beginTime = new Date(begin).getTime()
  119. const endTime = new Date(end).getTime()
  120. return nowTime >= beginTime && nowTime <= endTime
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. .cm-contact {
  127. position: fixed;
  128. right: 20rpx;
  129. bottom: 17%;
  130. }
  131. .cm-close-box {
  132. position: relative;
  133. z-index: 9;
  134. .cm-icon {
  135. position: relative;
  136. width: 80rpx;
  137. height: 80rpx;
  138. margin: 10rpx 0;
  139. &.cm-bround {
  140. border-radius: 50%;
  141. }
  142. &.cm-entry {
  143. height: 88rpx;
  144. background: url(https://static.caimei365.com/app/img/icon2/cm_entry_icon.png) no-repeat center;
  145. background-size: 80rpx;
  146. }
  147. &.cm-open-btn {
  148. background: rgba(0, 0, 0, 0.4) url(https://static.caimei365.com/app/img/icon2/cm_open.png) no-repeat center;
  149. background-size: 39rpx;
  150. }
  151. &.cm-mobile {
  152. background: rgba(0, 0, 0, 0.4) url(https://static.caimei365.com/app/img/icon2/cm_mobile.png) no-repeat
  153. center;
  154. background-size: 39rpx;
  155. }
  156. &.cm-ewm {
  157. background: rgba(0, 0, 0, 0.4) url(https://static.caimei365.com/app/img/icon2/cm_ewm.png) no-repeat center;
  158. background-size: 39rpx;
  159. }
  160. &.cm-close-btn {
  161. background: rgba(0, 0, 0, 0.4) url(https://static.caimei365.com/app/img/icon2/cm_close.png) no-repeat center;
  162. background-size: 39rpx;
  163. }
  164. }
  165. }
  166. .cm-dialog {
  167. top: 0;
  168. right: 110rpx;
  169. position: absolute;
  170. padding: 20rpx;
  171. background: rgb(255, 92, 0);
  172. border-radius: 16rpx;
  173. &::after {
  174. position: absolute;
  175. top: 20rpx;
  176. right: -20rpx;
  177. content: '';
  178. display: block;
  179. width: 0;
  180. height: 0;
  181. border-top: 16rpx solid transparent;
  182. border-bottom: 16rpx solid transparent;
  183. border-left: 20rpx solid rgb(255, 92, 0);
  184. }
  185. .cm-line {
  186. &.line1 {
  187. width: 100%;
  188. height: 1px;
  189. background: #fff;
  190. margin: 10rpx 0;
  191. }
  192. &.line2 {
  193. width: 1px;
  194. height: 200rpx;
  195. background: #eee;
  196. margin: 0 10rpx;
  197. }
  198. }
  199. .content1 {
  200. .cm-item {
  201. color: #fff;
  202. text {
  203. display: block;
  204. width: 400rpx;
  205. font-size: 28rpx;
  206. text-align: center;
  207. }
  208. }
  209. }
  210. .content2 {
  211. display: flex;
  212. justify-content: space-between;
  213. align-items: center;
  214. .cm-item {
  215. color: #fff;
  216. text {
  217. display: block;
  218. font-size: 28rpx;
  219. text-align: center;
  220. margin-top: 10rpx;
  221. }
  222. image {
  223. width: 240rpx;
  224. height: 240rpx;
  225. }
  226. }
  227. }
  228. }
  229. .mask {
  230. display: flex;
  231. justify-content: center;
  232. align-items: center;
  233. position: fixed;
  234. z-index: 1;
  235. top: 0;
  236. left: 0;
  237. width: 100vw;
  238. height: 100vh;
  239. .content {
  240. position: relative;
  241. .mask-close {
  242. z-index: 9;
  243. position: absolute;
  244. top: -40rpx;
  245. right: 40rpx;
  246. width: 64rpx;
  247. height: 64rpx;
  248. background: url(https://static.caimei365.com/app/img/icon2/cm_float_close.png) no-repeat center;
  249. background-size: 60rpx 60rpx;
  250. }
  251. image {
  252. width: 560rpx;
  253. }
  254. }
  255. &.cover {
  256. z-index: 999;
  257. background: rgba(0, 0, 0, 0.4);
  258. }
  259. }
  260. </style>