index.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view v-if="isShow">
  3. <!-- 微信小程序端、H5端、APP端 -->
  4. <!-- #ifdef MP-WEIXIN || H5 || APP-PLUS -->
  5. <button class="btn-normal" :open-type="setting.provider == 'mpwxkf' ? 'contact' : ''" :show-message-card="showCard"
  6. :send-message-path="cardPath" :send-message-title="cardTitle" :send-message-img="cardImage" @click="handleContact()">
  7. <slot></slot>
  8. </button>
  9. <!-- #endif -->
  10. </view>
  11. </template>
  12. <script>
  13. import SettingKeyEnum from '@/common/enum/setting/Key'
  14. import SettingModel from '@/common/model/Setting'
  15. export default {
  16. props: {
  17. // 是否显示消息卡片
  18. showCard: {
  19. Type: Boolean,
  20. default: false
  21. },
  22. // 消息卡片标题
  23. cardTitle: {
  24. Type: String,
  25. default: ''
  26. },
  27. // 消息卡片图片
  28. cardImage: {
  29. Type: String,
  30. default: ''
  31. },
  32. // 消息卡片点击跳转的路径
  33. cardPath: {
  34. Type: String,
  35. default: ''
  36. },
  37. },
  38. data() {
  39. return {
  40. isShow: false,
  41. setting: {}
  42. }
  43. },
  44. async created() {
  45. // 是否显示在线客服按钮
  46. this.isShow = await SettingModel.isShowCustomerBtn()
  47. // 商城客服设置
  48. this.setting = await SettingModel.item(SettingKeyEnum.CUSTOMER.value, true)
  49. },
  50. methods: {
  51. }
  52. }
  53. </script>
  54. <style lang="scss" scoped>
  55. </style>