index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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"></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. // 初始化红包入口状态
  104. initActivityEntry(begin, end) {
  105. const nowTime = new Date().getTime()
  106. const beginTime = new Date(begin).getTime()
  107. const endTime = new Date(end).getTime()
  108. return nowTime >= beginTime && nowTime <= endTime
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. .cm-contact {
  115. position: fixed;
  116. right: 20rpx;
  117. top: 30%;
  118. }
  119. .cm-close-box {
  120. position: relative;
  121. z-index: 9;
  122. .cm-icon {
  123. position: relative;
  124. width: 80rpx;
  125. height: 80rpx;
  126. margin: 10rpx 0;
  127. &.cm-bround {
  128. border-radius: 50%;
  129. }
  130. &.cm-entry {
  131. height: 88rpx;
  132. background: url(https://static.caimei365.com/app/img/icon2/cm_entry_icon.png) no-repeat center;
  133. background-size: 80rpx;
  134. }
  135. &.cm-open-btn {
  136. background: rgba(0, 0, 0, 0.4) url(https://static.caimei365.com/app/img/icon2/cm_open.png) no-repeat center;
  137. background-size: 39rpx;
  138. }
  139. &.cm-mobile {
  140. background: rgba(0, 0, 0, 0.4) url(https://static.caimei365.com/app/img/icon2/cm_mobile.png) no-repeat
  141. center;
  142. background-size: 39rpx;
  143. }
  144. &.cm-ewm {
  145. background: rgba(0, 0, 0, 0.4) url(https://static.caimei365.com/app/img/icon2/cm_ewm.png) no-repeat center;
  146. background-size: 39rpx;
  147. }
  148. &.cm-close-btn {
  149. background: rgba(0, 0, 0, 0.4) url(https://static.caimei365.com/app/img/icon2/cm_close.png) no-repeat center;
  150. background-size: 39rpx;
  151. }
  152. }
  153. }
  154. .cm-dialog {
  155. top: 0;
  156. right: 110rpx;
  157. position: absolute;
  158. padding: 20rpx;
  159. background: rgb(255, 92, 0);
  160. border-radius: 16rpx;
  161. &::after {
  162. position: absolute;
  163. top: 20rpx;
  164. right: -20rpx;
  165. content: '';
  166. display: block;
  167. width: 0;
  168. height: 0;
  169. border-top: 16rpx solid transparent;
  170. border-bottom: 16rpx solid transparent;
  171. border-left: 20rpx solid rgb(255, 92, 0);
  172. }
  173. .cm-line {
  174. &.line1 {
  175. width: 100%;
  176. height: 1px;
  177. background: #fff;
  178. margin: 10rpx 0;
  179. }
  180. &.line2 {
  181. width: 1px;
  182. height: 200rpx;
  183. background: #eee;
  184. margin: 0 10rpx;
  185. }
  186. }
  187. .content1 {
  188. .cm-item {
  189. color: #fff;
  190. text {
  191. display: block;
  192. width: 400rpx;
  193. font-size: 28rpx;
  194. text-align: center;
  195. }
  196. }
  197. }
  198. .content2 {
  199. display: flex;
  200. justify-content: space-between;
  201. align-items: center;
  202. .cm-item {
  203. color: #fff;
  204. text {
  205. display: block;
  206. font-size: 28rpx;
  207. text-align: center;
  208. margin-top: 10rpx;
  209. }
  210. image {
  211. width: 240rpx;
  212. height: 240rpx;
  213. }
  214. }
  215. }
  216. }
  217. .mask {
  218. display: flex;
  219. justify-content: center;
  220. align-items: center;
  221. position: fixed;
  222. z-index: 1;
  223. top: 0;
  224. left: 0;
  225. width: 100vw;
  226. height: 100vh;
  227. .content {
  228. position: relative;
  229. .mask-close {
  230. z-index: 9;
  231. position: absolute;
  232. top: -40rpx;
  233. right: 40rpx;
  234. width: 64rpx;
  235. height: 64rpx;
  236. background: url(https://static.caimei365.com/app/img/icon2/cm_float_close.png) no-repeat center;
  237. background-size: 60rpx 60rpx;
  238. }
  239. image {
  240. width: 560rpx;
  241. }
  242. }
  243. &.cover {
  244. z-index: 999;
  245. background: rgba(0, 0, 0, 0.4);
  246. }
  247. }
  248. </style>