index.vue 8.0 KB

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