customerService.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view style="touch-action: none;" v-show="!isSortType">
  3. <!-- #ifdef H5 || APP-PLUS -->
  4. <view class="customerService" :style="'top:'+topConfig" @touchmove.stop.prevent="setTouchMove">
  5. <view class="pictrue" @click="goCustomer">
  6. <image :src="logoConfig"></image>
  7. </view>
  8. </view>
  9. <!-- #endif -->
  10. <!-- #ifdef MP -->
  11. <view class="customerService" :style="'top:'+topConfig" @touchmove.stop.prevent="setTouchMove"
  12. v-if="routineContact === '0'">
  13. <view class="pictrue" @click="goCustomer">
  14. <image :src="logoConfig"></image>
  15. </view>
  16. </view>
  17. <button class="customerService-sty" :style="'top:'+topConfig" @touchmove.stop.prevent="setTouchMove"
  18. open-type='contact' v-if="routineContact === '1'">
  19. <image class="pictrue" :src="logoConfig"></image>
  20. </button>
  21. <!-- #endif -->
  22. </view>
  23. </template>
  24. <script>
  25. import {
  26. getCustomer
  27. } from '@/utils/index.js'
  28. export default {
  29. name: 'customerService',
  30. props: {
  31. dataConfig: {
  32. type: Object,
  33. default: () => {}
  34. },
  35. isSortType: {
  36. type: String | Number,
  37. default: 0
  38. }
  39. },
  40. data() {
  41. return {
  42. routineContact: this.dataConfig.routine_contact_type,
  43. logoConfig: this.dataConfig.logoConfig.url,
  44. topConfig: this.dataConfig.topConfig.val ? this.dataConfig.topConfig.val + '%' : '30%'
  45. };
  46. },
  47. created() {},
  48. methods: {
  49. setTouchMove(e) {
  50. var that = this;
  51. if (e.touches[0].clientY < 545 && e.touches[0].clientY > 66) {
  52. that.topConfig = e.touches[0].clientY + 'px'
  53. }
  54. },
  55. goCustomer() {
  56. getCustomer(`/pages/extension/customer_list/chat?productId=${this.ids}`)
  57. },
  58. }
  59. }
  60. </script>
  61. <style lang="scss">
  62. .customerService,
  63. .customerService-sty {
  64. position: fixed;
  65. right: 20rpx;
  66. z-index: 40;
  67. .pictrue {
  68. width: 86rpx;
  69. height: 86rpx;
  70. border-radius: 50%;
  71. image {
  72. width: 100%;
  73. height: 100%;
  74. }
  75. }
  76. }
  77. .customerService-sty {
  78. background-color: rgba(0, 0, 0, 0) !important;
  79. }
  80. </style>