index.vue 11 KB

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