scrollTop.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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">
  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. isShowSupplier: {
  45. // 是否展示供应商服务图标
  46. type: Boolean,
  47. default: false
  48. }
  49. },
  50. data() {
  51. return {
  52. isPhone: false,
  53. telPhone: '0755-22907771',
  54. mobilePhone: '15338851365',
  55. isShowIcon: true
  56. }
  57. },
  58. created() {},
  59. methods: {
  60. onPageScrollTop() {
  61. uni.pageScrollTo({
  62. scrollTop: 0,
  63. duration: 600
  64. })
  65. },
  66. handleContact(e) {
  67. console.log(e.detail.path)
  68. console.log(e.detail.query)
  69. }
  70. }
  71. }
  72. </script>
  73. <style lang="scss">
  74. .supplierLogo {
  75. position: fixed;
  76. right: 20rpx;
  77. z-index: 100;
  78. width: 120rpx;
  79. height: 130rpx;
  80. display: flex;
  81. align-items: flex-end;
  82. justify-content: flex-end;
  83. .logo {
  84. width: 120rpx;
  85. height: 120rpx;
  86. }
  87. .close {
  88. position: absolute;
  89. top: 0;
  90. right: 0;
  91. width: 30rpx;
  92. height: 30rpx;
  93. }
  94. }
  95. .scrollTop {
  96. width: 80rpx;
  97. height: 120rpx;
  98. position: fixed;
  99. right: 20rpx;
  100. z-index: 99;
  101. .icon {
  102. width: 80rpx;
  103. height: 80rpx;
  104. border-radius: 50%;
  105. float: left;
  106. margin: 10rpx 0;
  107. line-height: 80rpx;
  108. text-align: center;
  109. .contact-btn {
  110. width: 80rpx;
  111. height: 80rpx;
  112. background-color: rgba(0, 0, 0, 0);
  113. line-height: 80rpx;
  114. .iconfont {
  115. font-size: $font-size-44;
  116. color: #ffffff;
  117. }
  118. }
  119. &.msg {
  120. background-image: linear-gradient(0deg, #f28e31 0%, #ff5b00 100%);
  121. }
  122. &.top {
  123. background-color: rgba(0, 0, 0, 0.4);
  124. &.show {
  125. opacity: 1;
  126. }
  127. &.none {
  128. opacity: 0;
  129. }
  130. }
  131. .iconfont {
  132. font-size: $font-size-44;
  133. color: #ffffff;
  134. }
  135. }
  136. }
  137. </style>