index.vue 12 KB

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