index.vue 11 KB

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