kefu.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <view style="height: 100vh;">
  3. <!-- border-radius: 32upx; -->
  4. <view style="text-align: center;background: #FFFFFF;padding: 30upx;">
  5. <view class="item">
  6. <view class="lef">
  7. <image src="../../../static/my/QQ.png"></image>
  8. <view class="txt">
  9. <text>QQ</text>
  10. <text>{{qq}}</text>
  11. </view>
  12. </view>
  13. <view @click="copyHref" class="copy" data-txt='qq'>复制QQ</view>
  14. </view>
  15. <view class="item">
  16. <view class="lef">
  17. <image src="../../../static/my/wx.png"></image>
  18. <view class="txt">
  19. <text>微信</text>
  20. <text>{{weixin}}</text>
  21. </view>
  22. </view>
  23. <view @click="copyHref" class="copy" data-txt='weixin'>复制微信</view>
  24. </view>
  25. <view class="item">
  26. <view class="lef">
  27. <image src="../../../static/my/phone.png"></image>
  28. <view class="txt">
  29. <text>电话</text>
  30. <text>{{phone}}</text>
  31. </view>
  32. </view>
  33. <view @click="copyHref" data-txt='phone' class="copy">拨打电话</view>
  34. </view>
  35. <!-- #ifdef MP-WEIXIN -->
  36. <view class="item">
  37. <view class="lef">
  38. <image src="../../../static/my/kf.png"></image>
  39. <view class="txt">
  40. <text>在线客服</text>
  41. <text>在线客服专员为你解答问题</text>
  42. </view>
  43. </view>
  44. <button class="copys" data-txt='qq' open-type="contact">在线客服</button>
  45. </view>
  46. <!-- #endif -->
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. image: 'https://taobao.xianmxkj.com/custom.jpg',
  55. isWeiXin: false,
  56. weixin: '',
  57. qq: '',
  58. phone: '',
  59. webviewStyles: {
  60. progress: {
  61. color: '#FF2638'
  62. }
  63. }
  64. };
  65. },
  66. onLoad() {
  67. // #ifdef H5
  68. let ua = navigator.userAgent.toLowerCase();
  69. if (ua.indexOf('micromessenger') !== -1) {
  70. this.isWeiXin = true;
  71. }
  72. // #endif
  73. //微信号码
  74. this.$Request.getT('/app/common/type/44').then(res => {
  75. if (res.code == 0) {
  76. if (res.data && res.data.value) {
  77. this.weixin = res.data.value;
  78. }
  79. }
  80. });
  81. //客服电话
  82. this.$Request.getT('/app/common/type/252').then(res => {
  83. if (res.code == 0) {
  84. if (res.data && res.data.value) {
  85. this.phone = res.data.value;
  86. }
  87. }
  88. });
  89. //qq号码
  90. this.$Request.getT('/app/common/type/274').then(res => {
  91. if (res.code == 0) {
  92. if (res.data && res.data.value) {
  93. this.qq = res.data.value;
  94. }
  95. }
  96. });
  97. },
  98. onPullDownRefresh: function() {
  99. uni.stopPullDownRefresh(); // 停止刷新
  100. },
  101. methods: {
  102. //邀请码复制
  103. copyHref(e) {
  104. console.log(e.target.dataset.txt)
  105. if (e.target.dataset.txt == 'qq') {
  106. this.copy(this.qq)
  107. } else if (e.target.dataset.txt == 'weixin') {
  108. this.copy(this.weixin)
  109. } else {
  110. uni.makePhoneCall({
  111. phoneNumber: this.phone
  112. })
  113. }
  114. },
  115. copy(item) {
  116. uni.setClipboardData({
  117. data: item,
  118. success: r => {
  119. this.$queue.showToast('复制成功');
  120. }
  121. });
  122. },
  123. saveImg() {
  124. let that = this;
  125. uni.saveImageToPhotosAlbum({
  126. filePath: that.image,
  127. success(res) {
  128. that.$queue.showToast('保存成功');
  129. }
  130. });
  131. },
  132. rests() {
  133. uni.showToast({
  134. title: '已刷新请再次长按识别',
  135. mask: false,
  136. duration: 1500,
  137. icon: 'none'
  138. });
  139. window.location.reload();
  140. }
  141. }
  142. };
  143. </script>
  144. <style scoped>
  145. /* @import '../../static/css/index.css'; */
  146. .item {
  147. display: flex;
  148. justify-content: space-between;
  149. align-items: center;
  150. margin-bottom: 36rpx;
  151. }
  152. .items {
  153. margin-bottom: 0;
  154. }
  155. .lef {
  156. display: flex;
  157. justify-content: flex-start;
  158. align-items: center;
  159. }
  160. .item image {
  161. width: 89rpx;
  162. height: 89rpx;
  163. margin-right: 26rpx;
  164. }
  165. .item .txt {
  166. display: flex;
  167. flex-direction: column;
  168. justify-content: flex-start;
  169. align-items: flex-start;
  170. }
  171. .txt>text:nth-child(1) {
  172. font-size: 32rpx;
  173. font-family: PingFang SC;
  174. font-weight: bold;
  175. color: #1F2029;
  176. /* line-height: 87rpx; */
  177. margin-bottom: 10rpx;
  178. }
  179. .txt>text:nth-child(2) {
  180. font-size: 28rpx;
  181. font-family: PingFang SC;
  182. font-weight: 500;
  183. color: #666666;
  184. /* line-height: 87rpx; */
  185. }
  186. .copy {
  187. width: 140rpx;
  188. height: 54rpx;
  189. background: #FF1E43;
  190. border-radius: 27rpx;
  191. text-align: center;
  192. line-height: 54rpx;
  193. font-size: 24rpx;
  194. font-family: PingFang SC;
  195. font-weight: bold;
  196. color: #FFFFFF;
  197. }
  198. .copys {
  199. height: 54rpx;
  200. background: #FF1E43;
  201. border-radius: 27rpx;
  202. text-align: center;
  203. line-height: 54rpx;
  204. font-size: 24rpx;
  205. font-family: PingFang SC;
  206. font-weight: bold;
  207. color: #FFFFFF;
  208. margin-right: 0rpx;
  209. }
  210. /*
  211. <!-- <view style="font-size: 38upx;color: #000000">添加客服微信咨询</view>
  212. <view style="font-size: 32upx;margin-top: 32upx;color: #000000">微信号:{{weixin}}</view>
  213. <view @click="copyHref" style="width:200upx;margin-top: 32upx;font-size: 30upx;margin-left: 36%;color: #FFFFFF;background: #FF2638;padding: 4upx 20upx;border-radius: 24upx;">一键复制</view>
  214. <image @click="saveImg" mode="aspectFit" style="margin-top: 32upx" :src="image"></image>
  215. <view style="font-size: 28upx;color: #000000;margin-top: 32upx" v-if="isWeiXin">{{ isWeiXin ? '长按识别上方二维码' : '' }}</view>
  216. <view v-if="isWeiXin" style="font-size: 24upx;color: #000000;margin-top: 80upx" @click="rests">无法识别?</view> -->
  217. */
  218. </style>