铝交易,微信公众号
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

158 lines
3.3 KiB

4 months ago
4 months ago
4 months ago
  1. <template>
  2. <!-- 联系客服弹框 -->
  3. <uv-overlay :show="show" @click="close">
  4. <view class="warp">
  5. <view class="rect" @tap.stop>
  6. <view class="title">{{ $t('components.contactCustomerService') }}</view>
  7. <view class="center">{{ $t('components.confirmCallCustomerService') }}?</view>
  8. <view class="bottom">
  9. <view>
  10. <uv-button type="info" shape="circle" :text="$t('components.cancel')" :custom-style="customStyle1"
  11. @click="close"></uv-button>
  12. </view>
  13. <view>
  14. <uv-button type="info" shape="circle" :text="$t('components.confirmD')" :custom-style="customStyle2"
  15. @click="confirm"></uv-button>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </uv-overlay>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. show: false,
  27. phone:'',
  28. }
  29. },
  30. computed: {
  31. customStyle1() {
  32. return {
  33. height: '60rpx',
  34. background: '#FFF',
  35. color: '#000000',
  36. fontSize: '36rpx',
  37. borderRadius: '40rpx', //圆角
  38. // nvue中必须是下方的写法
  39. 'border-top-right-radius': '40rpx',
  40. 'border-bottom-left-radius': '40rpx',
  41. 'border-bottom-right-radius': '40rpx',
  42. 'width': '150rpx',
  43. }
  44. },
  45. customStyle2() {
  46. return {
  47. height: '60rpx',
  48. background: '#1f1c39',
  49. color: '#FFF',
  50. fontSize: '34px',
  51. borderRadius: '40rpx', //圆角
  52. // nvue中必须是下方的写法
  53. 'border-top-right-radius': '40rpx',
  54. 'border-bottom-left-radius': '40rpx',
  55. 'border-bottom-right-radius': '40rpx',
  56. 'width': '150rpx',
  57. }
  58. }
  59. },
  60. mounted() {
  61. this.getCustomPhone()
  62. },
  63. methods: {
  64. getCustomPhone(){
  65. this.$api('customUser', {}, res => {
  66. this.phone = res.result.phone
  67. })
  68. },
  69. open() {
  70. this.show = true
  71. },
  72. close() {
  73. this.show = false
  74. },
  75. // 拨打电话
  76. confirm() {
  77. this.show = false
  78. let phone = this.phone; // 需要拨打的电话号码
  79. // console.log('拨打电话', phone)
  80. const res = uni.getSystemInfoSync();
  81. // ios系统默认有个模态框
  82. if (res.platform == 'ios') {
  83. uni.makePhoneCall({
  84. phoneNumber: phone,
  85. success() {
  86. console.log('ios拨打成功');
  87. },
  88. fail() {
  89. console.log('ios拨打失败');
  90. }
  91. })
  92. } else {
  93. //安卓手机手动设置一个showActionSheet
  94. uni.showActionSheet({
  95. itemList: [phone, '呼叫'],
  96. success: function(res) {
  97. if (res.tapIndex == 1) {
  98. uni.makePhoneCall({
  99. phoneNumber: phone,
  100. success() {
  101. console.log('安卓拨打成功');
  102. },
  103. fail() {
  104. console.log('安卓拨打失败');
  105. }
  106. })
  107. }
  108. }
  109. })
  110. }
  111. },
  112. }
  113. }
  114. </script>
  115. <style scoped lang="scss">
  116. .warp {
  117. display: flex;
  118. align-items: center;
  119. justify-content: center;
  120. height: 100%;
  121. }
  122. .rect {
  123. width: 600rpx;
  124. height: 300rpx;
  125. background-color: #fff;
  126. border-radius: 20rpx;
  127. overflow: hidden;
  128. .title {
  129. padding: 20rpx 0 10rpx 20rpx;
  130. background-color: $uni-color;
  131. color: #FFF;
  132. text-align: left;
  133. width: 100%;
  134. height: 18%;
  135. font-size: 36rpx;
  136. }
  137. .center {
  138. height: 40%;
  139. display: flex;
  140. justify-content: center;
  141. align-items: center;
  142. font-size: 36rpx;
  143. }
  144. .bottom {
  145. display: flex;
  146. justify-content: center;
  147. gap: 50rpx;
  148. }
  149. }
  150. </style>