index.vue 11 KB

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