customerService.vue 2.3 KB

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