index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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>展会咨询电话:15338897365</text> </view>
  15. <view class="cm-line line1"></view>
  16. <view class="cm-item"> <text>客服咨询电话:15338851365</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_wechat_02.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_wechat_01.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
  46. src="https://static.caimei365.com/app/img/icon2/cm_entry_bg.png"
  47. mode="widthFix"
  48. @click="handleToggleCoupon(true)"
  49. ></image>
  50. <view class="mask-close" @click="handleToggleEntry(false)"></view>
  51. </view>
  52. </view>
  53. <view class="mask cover" v-if="showCouponEntry">
  54. <view class="content">
  55. <view class="btn btn1" @click="navigatorToPro(1)"></view>
  56. <view class="btn btn2" @click="navigatorToPro(2)"></view>
  57. <image src="https://static.caimei365.com/app/img/icon2/coupon-entry-app.png" mode="widthFix"></image>
  58. <view class="mask-close" @click="handleToggleCoupon(false)"></view>
  59. </view>
  60. </view>
  61. <view class="mask" v-if="mobileVisiable || wechatVisiable" @click="handleClose"></view>
  62. </view>
  63. </template>
  64. <script>
  65. export default {
  66. props: {
  67. pageInfo: {
  68. type: Object
  69. }
  70. },
  71. data() {
  72. return {
  73. isActive: true,
  74. mobileVisiable: false,
  75. wechatVisiable: false,
  76. entryVisiable: true,
  77. activityEntryVisiable: false,
  78. contactVisiable: false,
  79. showCouponEntry: false
  80. }
  81. },
  82. created() {
  83. this.contactVisiable = this.pageInfo.infoBarStatus === 1
  84. this.activityEntryVisiable = this.initActivityEntry(
  85. this.pageInfo.redPacketBeginTime,
  86. this.pageInfo.redPacketEndTime
  87. )
  88. console.log(this.pageInfo)
  89. },
  90. methods: {
  91. // 是否展开
  92. handleToggleAcitve(active) {
  93. this.isActive = active
  94. this.mobileVisiable = false
  95. this.wechatVisiable = false
  96. },
  97. // 显示微信二维码
  98. handelShowWechat() {
  99. this.wechatVisiable = !this.wechatVisiable
  100. this.mobileVisiable = false
  101. },
  102. // 显示联系电话
  103. handelShowMobile() {
  104. this.mobileVisiable = !this.mobileVisiable
  105. this.wechatVisiable = false
  106. },
  107. // 隐藏微信二维码和联系电话
  108. handleClose() {
  109. this.mobileVisiable = false
  110. this.wechatVisiable = false
  111. },
  112. // 显示活动入口
  113. handleToggleEntry(visiable) {
  114. this.entryVisiable = visiable
  115. },
  116. navigatorToPro(flag) {
  117. // 友盟自定义事件
  118. if (process.env.NODE_ENV != 'development') {
  119. if (flag === 2) {
  120. this.$uma.trackEvent('meibohui_Coupon_detail_click', {
  121. Um_Key_PageName: '云上美博会优惠券介绍',
  122. Um_Key_PageCategory: '活动专题页面',
  123. Um_Key_SourcePage: '活动专题页面'
  124. })
  125. }
  126. if (flag === 1) {
  127. this.$uma.trackEvent('meibohui_Coupon_buy_click', {
  128. Um_Key_PageName: '云上美博会优惠券购买跳转',
  129. Um_Key_PageCategory: '活动专题页面',
  130. Um_Key_SourcePage: '活动专题页面'
  131. })
  132. }
  133. }
  134. if (flag === 2) this.$api.navigateTo('/pages/h5/activity/couponExp')
  135. else this.$api.navigateTo('/pages/goods/product?id=6898')
  136. this.entryVisiable = false
  137. this.showCouponEntry = false
  138. },
  139. // 优惠券入口
  140. handleToggleCoupon(flag) {
  141. // 友盟自定义事件
  142. if (flag && process.env.NODE_ENV != 'development') {
  143. this.$uma.trackEvent('meibohui_Coupon_click', {
  144. Um_Key_PageName: '云上美博会获取弹窗点击',
  145. Um_Key_PageCategory: '活动专题页面',
  146. Um_Key_SourcePage: '活动专题页面'
  147. })
  148. }
  149. this.showCouponEntry = flag
  150. this.entryVisiable = false
  151. },
  152. // 初始化红包入口状态
  153. initActivityEntry(begin, end) {
  154. const nowTime = new Date().getTime()
  155. // 兼容 iso android 的时间处理
  156. const beginTime = new Date(begin.replace(/-/g, '/')).getTime()
  157. const endTime = new Date(end.replace(/-/g, '/')).getTime()
  158. console.log('活动是否开始: ')
  159. console.log(nowTime >= beginTime && nowTime <= endTime)
  160. return nowTime >= beginTime && nowTime <= endTime
  161. }
  162. }
  163. }
  164. </script>
  165. <style lang="scss" scoped>
  166. .cm-contact {
  167. position: fixed;
  168. right: 20rpx;
  169. bottom: 240rpx;
  170. z-index: 9999;
  171. }
  172. .cm-close-box {
  173. position: relative;
  174. z-index: 9;
  175. .cm-icon {
  176. position: relative;
  177. width: 80rpx;
  178. height: 80rpx;
  179. margin: 10rpx 0;
  180. &.cm-bround {
  181. border-radius: 50%;
  182. }
  183. &.cm-entry {
  184. height: 88rpx;
  185. background: url(https://static.caimei365.com/app/img/icon2/cm_entry_icon.png) no-repeat center;
  186. background-size: 80rpx;
  187. }
  188. &.cm-open-btn {
  189. background: rgba(0, 0, 0, 0.4) url(https://static.caimei365.com/app/img/icon2/cm_open.png) no-repeat center;
  190. background-size: 39rpx;
  191. }
  192. &.cm-mobile {
  193. background: rgba(0, 0, 0, 0.4) url(https://static.caimei365.com/app/img/icon2/cm_mobile.png) no-repeat
  194. center;
  195. background-size: 39rpx;
  196. }
  197. &.cm-ewm {
  198. background: rgba(0, 0, 0, 0.4) url(https://static.caimei365.com/app/img/icon2/cm_ewm.png) no-repeat center;
  199. background-size: 39rpx;
  200. }
  201. &.cm-close-btn {
  202. background: rgba(0, 0, 0, 0.4) url(https://static.caimei365.com/app/img/icon2/cm_close.png) no-repeat center;
  203. background-size: 39rpx;
  204. }
  205. }
  206. }
  207. .cm-dialog {
  208. top: 0;
  209. right: 110rpx;
  210. position: absolute;
  211. padding: 20rpx;
  212. background: rgb(255, 92, 0);
  213. border-radius: 16rpx;
  214. &::after {
  215. position: absolute;
  216. top: 20rpx;
  217. right: -20rpx;
  218. content: '';
  219. display: block;
  220. width: 0;
  221. height: 0;
  222. border-top: 16rpx solid transparent;
  223. border-bottom: 16rpx solid transparent;
  224. border-left: 20rpx solid rgb(255, 92, 0);
  225. }
  226. .cm-line {
  227. &.line1 {
  228. width: 100%;
  229. height: 1px;
  230. background: #fff;
  231. margin: 10rpx 0;
  232. }
  233. &.line2 {
  234. width: 1px;
  235. height: 200rpx;
  236. background: #eee;
  237. margin: 0 16rpx;
  238. margin-top: -50rpx;
  239. }
  240. }
  241. .content1 {
  242. .cm-item {
  243. color: #fff;
  244. text {
  245. display: block;
  246. width: 400rpx;
  247. font-size: 28rpx;
  248. text-align: center;
  249. }
  250. }
  251. }
  252. .content2 {
  253. display: flex;
  254. justify-content: space-between;
  255. align-items: center;
  256. .cm-item {
  257. color: #fff;
  258. text {
  259. display: block;
  260. font-size: 28rpx;
  261. text-align: center;
  262. margin-top: 10rpx;
  263. }
  264. image {
  265. width: 240rpx;
  266. height: 240rpx;
  267. }
  268. }
  269. }
  270. }
  271. .mask {
  272. display: flex;
  273. justify-content: center;
  274. align-items: center;
  275. position: fixed;
  276. z-index: 999;
  277. top: 0;
  278. left: 0;
  279. width: 100vw;
  280. height: 100vh;
  281. .content {
  282. position: relative;
  283. .mask-close {
  284. z-index: 9;
  285. position: absolute;
  286. top: -80rpx;
  287. right: 40rpx;
  288. width: 64rpx;
  289. height: 64rpx;
  290. background: url(https://static.caimei365.com/app/img/icon2/cm_float_close.png) no-repeat center;
  291. background-size: 60rpx 60rpx;
  292. }
  293. .btn {
  294. width: 80rpx;
  295. height: 80rpx;
  296. background: #666;
  297. z-index: 9999;
  298. position: absolute;
  299. right: 60rpx;
  300. opacity: 0;
  301. &.btn1 {
  302. top: 175rpx;
  303. }
  304. &.btn2 {
  305. top: 350rpx;
  306. }
  307. }
  308. image {
  309. width: 560rpx;
  310. }
  311. }
  312. &.cover {
  313. z-index: 999999;
  314. background: rgba(0, 0, 0, 0.4);
  315. }
  316. }
  317. </style>