index.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <!-- 客服跳转 -->
  3. <!-- #ifdef APP-PLUS || H5 -->
  4. <view class="acea-row row-center-wrapper cartf iconfont icon-kefu3" :style="{ top: top + 'px'}" @touchmove.stop.prevent="setTouchMove" @click="licks"></view>
  5. <!-- #endif -->
  6. <!-- #ifdef MP -->
  7. <view v-if="routineContact == 0">
  8. <view class="acea-row row-center-wrapper cartf iconfont icon-kefu3" :style="{ top: top + 'px'}" @touchmove.stop.prevent="setTouchMove" @click="licks"></view>
  9. </view>
  10. <button class="acea-row row-center-wrapper cartf iconfont icon-kefu3" open-type='contact' :style="{ top: top + 'px'}" @touchmove.stop.prevent="setTouchMove" v-else-if="routineContact==1 && !goodsCon"></button>
  11. <button class="acea-row row-center-wrapper cartf iconfont icon-kefu3" open-type='contact' :send-message-title="storeInfo.store_name" :send-message-img="storeInfo.image" :send-message-path="`/pages/goods_details/index?id=${storeInfo.id}`" show-message-card :style="{ top: top + 'px'}" @touchmove.stop.prevent="setTouchMove" v-else-if="routineContact==1 && goodsCon"></button>
  12. <!-- #endif -->
  13. </template>
  14. <script>
  15. let app = getApp();
  16. import {
  17. mapGetters
  18. } from "vuex";
  19. export default {
  20. name: "kefuIcon",
  21. props: {
  22. ids: {
  23. type: Number,
  24. default: 0
  25. },
  26. routineContact: {
  27. type: Number,
  28. default: 0
  29. },
  30. storeInfo: {
  31. type: Object,
  32. default () {
  33. return {};
  34. }
  35. },
  36. goodsCon: {
  37. type: Number,
  38. default: 0
  39. }
  40. },
  41. computed: mapGetters(['userInfo']),
  42. data: function() {
  43. return {
  44. top: "480"
  45. };
  46. },
  47. mounted() {
  48. // #ifdef H5
  49. this.top = parseFloat(window.innerHeight) -200
  50. // #endif
  51. },
  52. methods: {
  53. setTouchMove(e) {
  54. let that = this;
  55. if (e.touches[0].clientY < 480 && e.touches[0].clientY > 66) {
  56. that.top = e.touches[0].clientY
  57. }
  58. },
  59. licks(){
  60. let userInfo = {}
  61. if(typeof this.userInfo === 'string'){
  62. userInfo = JSON.parse(this.userInfo)
  63. }else{
  64. userInfo = this.userInfo
  65. }
  66. let url = `/pages/extension/customer_list/chat?productId=${this.ids}`
  67. let obj = {
  68. store_name: this.storeInfo.store_name,
  69. path: `/pages/goods_details/index?id=${this.storeInfo.id}`,
  70. image:this.storeInfo.image
  71. }
  72. this.$util.getCustomer(userInfo,url,obj,1)
  73. }
  74. },
  75. created() {
  76. }
  77. };
  78. </script>
  79. <style lang="scss">
  80. .cartf{
  81. width: 96rpx;
  82. height: 96rpx;
  83. background: #FFFFFF;
  84. box-shadow: 0 3rpx 16rpx rgba(0, 0, 0, 0.08);
  85. border-radius: 50%;
  86. font-size: 47rpx;
  87. color: #666;
  88. position: fixed;
  89. right: 15rpx;
  90. z-index: 9;
  91. }
  92. </style>