scrollTop.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template name="scrollTop">
  2. <!-- 商品详情价格判断 -->
  3. <view>
  4. <view
  5. class="supplierLogo"
  6. v-if="isShowSupplier && isShowIcon"
  7. @click="$api.navigateTo('/pages/login/supplier_login')"
  8. :style="{ bottom: bottom + 120 + 'rpx' }"
  9. >
  10. <image class="logo" src="https://static.caimei365.com/app/img/icon/supplier_logo.png" mode=""></image>
  11. <image
  12. class="close"
  13. @click.stop="isShowIcon = false"
  14. src="https://static.caimei365.com/app/img/supplier-login/close_icon.png"
  15. mode=""
  16. ></image>
  17. </view>
  18. <view class="scrollTop" :style="{ bottom: bottom + 'rpx' }">
  19. <view class="icon msg" v-if="isShowKefu">
  20. <!-- #ifdef MP-WEIXIN -->
  21. <button class="contact-btn" open-type="contact" @bindcontact="handleContact">
  22. <text class="iconfont icon-zixunrexian"></text>
  23. </button>
  24. <!-- #endif -->
  25. </view>
  26. <view class="icon top" @click="onPageScrollTop" :class="isScrollTop ? 'show' : 'none'">
  27. <text class="iconfont icon-zhiding"></text>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. name: 'scrollTop',
  35. props: {
  36. bottom: {
  37. type: Number,
  38. default: 100
  39. },
  40. isScrollTop: {
  41. type: Boolean,
  42. default: false
  43. },
  44. isShowKefu:{
  45. type: Boolean,
  46. default: true
  47. },
  48. isShowSupplier: {
  49. // 是否展示供应商服务图标
  50. type: Boolean,
  51. default: false
  52. }
  53. },
  54. data() {
  55. return {
  56. isPhone: false,
  57. telPhone: '0755-22907771',
  58. mobilePhone: '15338851365',
  59. isShowIcon: true
  60. }
  61. },
  62. created() {},
  63. methods: {
  64. onPageScrollTop() {
  65. uni.pageScrollTo({
  66. scrollTop: 0,
  67. duration: 600
  68. })
  69. },
  70. handleContact(e) {
  71. console.log(e.detail.path)
  72. console.log(e.detail.query)
  73. }
  74. }
  75. }
  76. </script>
  77. <style lang="scss">
  78. .supplierLogo {
  79. position: fixed;
  80. right: 20rpx;
  81. z-index: 100;
  82. width: 120rpx;
  83. height: 130rpx;
  84. display: flex;
  85. align-items: flex-end;
  86. justify-content: flex-end;
  87. .logo {
  88. width: 120rpx;
  89. height: 120rpx;
  90. }
  91. .close {
  92. position: absolute;
  93. top: 0;
  94. right: 0;
  95. width: 30rpx;
  96. height: 30rpx;
  97. }
  98. }
  99. .scrollTop {
  100. width: 80rpx;
  101. height: 120rpx;
  102. position: fixed;
  103. right: 20rpx;
  104. z-index: 99;
  105. .icon {
  106. width: 80rpx;
  107. height: 80rpx;
  108. border-radius: 50%;
  109. float: left;
  110. margin: 10rpx 0;
  111. line-height: 80rpx;
  112. text-align: center;
  113. .contact-btn {
  114. width: 80rpx;
  115. height: 80rpx;
  116. background-color: rgba(0, 0, 0, 0);
  117. line-height: 80rpx;
  118. .iconfont {
  119. font-size: $font-size-44;
  120. color: #ffffff;
  121. }
  122. }
  123. &.msg {
  124. background-image: linear-gradient(0deg, #f28e31 0%, #ff5b00 100%);
  125. }
  126. &.top {
  127. background-color: rgba(0, 0, 0, 0.4);
  128. &.show {
  129. opacity: 1;
  130. }
  131. &.none {
  132. opacity: 0;
  133. }
  134. }
  135. .iconfont {
  136. font-size: $font-size-44;
  137. color: #ffffff;
  138. }
  139. }
  140. }
  141. </style>