customer.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view style="height: 100vh;margin: 32upx;">
  3. <view style="text-align: center;background: #FFFFFF;padding: 40upx;border-radius: 32upx;">
  4. <view style="font-size: 38upx;">添加客服微信咨询</view>
  5. <view style="font-size: 32upx;margin-top: 32upx;">微信号:{{weixin}}</view>
  6. <view style="font-size: 32upx;margin-top: 32upx;">手机号:{{phone}}</view>
  7. <view @click="copyHref"
  8. style="background: #557EFD;width:200upx;margin-top: 32upx;font-size: 30upx;margin-left: 36%;color: #FFFFFF;padding: 4upx 20upx;border-radius: 24upx;">
  9. 一键复制</view>
  10. <image @click="saveImg" mode="aspectFit" style="margin-top: 32upx" :src="images"></image>
  11. <view style="font-size: 28upx;margin-top: 32upx" v-if="isWeiXin">{{ isWeiXin ? '长按识别上方二维码' : '' }}</view>
  12. <!-- <button open-type="contact">在线客服</button> -->
  13. <!-- <view @click="goChat"
  14. style="width:260upx;margin-top: 32upx;font-size: 30upx;margin-left: 28%;color: #557EFD;padding: 4upx 20upx;border-radius: 24upx;">
  15. 联系在线客服</view>
  16. <view v-if="isWeiXin" style="font-size: 24upx;margin-top: 80upx" @click="rests">无法识别?</view> -->
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. data() {
  23. return {
  24. images: '',
  25. isWeiXin: false,
  26. weixin: '',
  27. phone: '',
  28. webviewStyles: {
  29. progress: {
  30. color: '#1A1929 '
  31. }
  32. }
  33. };
  34. },
  35. onLoad() {
  36. // #ifdef H5
  37. let ua = navigator.userAgent.toLowerCase();
  38. if (ua.indexOf('micromessenger') !== -1) {
  39. this.isWeiXin = true;
  40. }
  41. // #endif
  42. //获取客服二维码
  43. this.$Request.getT('/app/common/type/289').then(res => {
  44. if (res.code == 0) {
  45. if (res.data && res.data.value) {
  46. console.log(res.data.value)
  47. this.images = res.data.value;
  48. }
  49. }
  50. });
  51. this.$Request.getT('/app/common/type/288').then(res => {
  52. if (res.code == 0) {
  53. if (res.data && res.data.value) {
  54. this.weixin = res.data.value;
  55. }
  56. }
  57. });
  58. //获取手机号码
  59. this.$Request.getT('/app/common/type/287').then(res => {
  60. if (res.code == 0) {
  61. if (res.data && res.data.value) {
  62. this.phone = res.data.value;
  63. }
  64. }
  65. });
  66. },
  67. onPullDownRefresh: function() {
  68. uni.stopPullDownRefresh(); // 停止刷新
  69. },
  70. methods: {
  71. //邀请码复制
  72. copyHref() {
  73. uni.setClipboardData({
  74. data: this.weixin,
  75. success: r => {
  76. this.$queue.showToast('复制成功');
  77. }
  78. });
  79. },
  80. saveImg() {
  81. let that = this;
  82. let imgArr = []
  83. imgArr.push(that.image);
  84. //预览图片
  85. uni.previewImage({
  86. urls: imgArr,
  87. current: imgArr[0]
  88. });
  89. // uni.saveImageToPhotosAlbum({
  90. // filePath: that.image,
  91. // success(res) {
  92. // that.$queue.showToast('保存成功');
  93. // }
  94. // });
  95. },
  96. rests() {
  97. uni.showToast({
  98. title: '已刷新请再次长按识别',
  99. mask: false,
  100. duration: 1500,
  101. icon: 'none'
  102. });
  103. window.location.reload();
  104. },
  105. // 在线客服
  106. goChat() {
  107. let token = this.$queue.getData('token');
  108. if (token) {
  109. uni.navigateTo({
  110. url: '/my/setting/chat'
  111. });
  112. } else {
  113. this.goLoginInfo();
  114. }
  115. },
  116. //统一登录跳转
  117. goLoginInfo() {
  118. uni.navigateTo({
  119. url: '/pages/public/loginphone'
  120. });
  121. },
  122. }
  123. };
  124. </script>
  125. <style>
  126. /* @import '../../static/css/index.css'; */
  127. page {
  128. background: #F5F5F5;
  129. }
  130. </style>