index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view class="container">
  3. <navBar title="客服中心" :back="true" color="#333333" background="#FFFFFF" />
  4. <view class="server">
  5. <image :src="picBase+'kefuAvatar.png'" mode=""></image>
  6. </view>
  7. <view v-if="phone" class="kefu">
  8. <view class="dian"></view>
  9. <view class="">客服手机号:{{phone}}</view>
  10. <view class="yijian"><u-button @click="call(phone)" color="#207CF7" size="mini" type="primary"
  11. shape="circle" text="一键拨号"></u-button></view>
  12. </view>
  13. <view v-if="weiChat" class="kefu">
  14. <view class="dian"></view>
  15. <view>客服微信号:{{weiChat}}</view>
  16. <view class="yijian"><u-button @click="fhuzhi" color="#207CF7" size="mini" type="primary" shape="circle"
  17. text="一键复制"></u-button></view>
  18. </view>
  19. <!-- <view class="sds">dfhsfsdh25</view> -->
  20. <block v-if="code">
  21. <view class="kefu">
  22. <view class="dian"></view>
  23. <view class="">客服二维码</view>
  24. </view>
  25. <view class="qrcode_path">
  26. <image @click="viewsave(code)" :src="code" mode="widthFix"></image>
  27. <!-- <image src="@/static/images/head.jpg" mode="widthFix"></image> -->
  28. </view>
  29. </block>
  30. </view>
  31. </template>
  32. <script>
  33. // import navBar from '@/components/navBar/index.vue'
  34. import {
  35. getKefu,
  36. } from '@/api/index/index.js'
  37. export default {
  38. // components: {
  39. // navBar
  40. // },
  41. data() {
  42. return {
  43. picBase: this.$picBase2,
  44. phone: '',
  45. weiChat: '',
  46. code: ''
  47. }
  48. info: null
  49. },
  50. onLoad() {
  51. this.getKefu()
  52. },
  53. methods: {
  54. async getKefu() {
  55. let res1 = await getKefu()
  56. console.log('客服信息返回值--------', res1);
  57. if (res1.code == 0) {
  58. this.phone = res1.data.service_phone.value
  59. this.weiChat = res1.data.service_wx.value
  60. this.code = this.$ossBaseUrl + res1.data.service_qrcode.value
  61. console.log(this.phone, this.weiChat, this.code);
  62. } else {
  63. this.$toast(res1.message)
  64. }
  65. },
  66. viewsave(e) {
  67. uni.previewImage({
  68. urls: [e],
  69. current: 0
  70. })
  71. },
  72. fhuzhi() {
  73. var that = this;
  74. uni.setClipboardData({
  75. data: that.weiChat,
  76. success: function() {
  77. uni.showToast({
  78. title: '微信号已复制'
  79. })
  80. }
  81. });
  82. },
  83. call(e) {
  84. wx.makePhoneCall({
  85. phoneNumber: e //仅为示例,并非真实的电话号码
  86. })
  87. },
  88. }
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. @import "./index.scss";
  93. </style>