customerService.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <!-- 在线客服 -->
  3. <view class="custmer" v-show="!isSortType">
  4. <!-- #ifdef H5 || APP-PLUS -->
  5. <view class="customerService" :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" :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" :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. export default {
  28. name: 'customerService',
  29. computed: mapGetters(['userInfo']),
  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: parseFloat(this.dataConfig.routine_contact_type),
  43. logoConfig: this.dataConfig.logoConfig.url,
  44. topConfig: this.dataConfig.topConfig.val?this.dataConfig.topConfig.val>=80?80+'%':this.dataConfig.topConfig.val+'%':'30%'
  45. };
  46. },
  47. created() {
  48. },
  49. methods: {
  50. licks(){
  51. let userInfo = {}
  52. if(typeof this.userInfo === 'string'){
  53. userInfo = JSON.parse(this.userInfo)
  54. }else{
  55. userInfo = this.userInfo
  56. }
  57. this.$util.getCustomer(userInfo)
  58. },
  59. setTouchMove(e) {
  60. var that = this;
  61. if (e.touches[0].clientY < 545 && e.touches[0].clientY > 66) {
  62. that.topConfig = e.touches[0].clientY+'px'
  63. }
  64. },
  65. }
  66. }
  67. </script>
  68. <style lang="scss">
  69. .custmer {
  70. touch-action: none;
  71. }
  72. .customerService,.customerService-sty {
  73. position: fixed;
  74. right: 20rpx;
  75. z-index: 40;
  76. .pictrue {
  77. width: 86rpx;
  78. height: 86rpx;
  79. border-radius: 50%;
  80. image {
  81. width: 100%;
  82. height: 100%;
  83. border-radius: 50%;
  84. }
  85. }
  86. }
  87. .customerService-sty{
  88. background-color: rgba(0,0,0,0) !important;
  89. }
  90. </style>