铝交易,微信公众号
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.

159 lines
3.3 KiB

6 months ago
6 months ago
6 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('getImagePhoneOther', {}, res => {
  66. console.log(res)
  67. this.phone = res.result.phone
  68. })
  69. },
  70. open() {
  71. this.show = true
  72. },
  73. close() {
  74. this.show = false
  75. },
  76. // 拨打电话
  77. confirm() {
  78. this.show = false
  79. let phone = this.phone; // 需要拨打的电话号码
  80. // console.log('拨打电话', phone)
  81. const res = uni.getSystemInfoSync();
  82. // ios系统默认有个模态框
  83. if (res.platform == 'ios') {
  84. uni.makePhoneCall({
  85. phoneNumber: phone,
  86. success() {
  87. console.log('ios拨打成功');
  88. },
  89. fail() {
  90. console.log('ios拨打失败');
  91. }
  92. })
  93. } else {
  94. //安卓手机手动设置一个showActionSheet
  95. uni.showActionSheet({
  96. itemList: [phone, '呼叫'],
  97. success: function(res) {
  98. if (res.tapIndex == 1) {
  99. uni.makePhoneCall({
  100. phoneNumber: phone,
  101. success() {
  102. console.log('安卓拨打成功');
  103. },
  104. fail() {
  105. console.log('安卓拨打失败');
  106. }
  107. })
  108. }
  109. }
  110. })
  111. }
  112. },
  113. }
  114. }
  115. </script>
  116. <style scoped lang="scss">
  117. .warp {
  118. display: flex;
  119. align-items: center;
  120. justify-content: center;
  121. height: 100%;
  122. }
  123. .rect {
  124. width: 600rpx;
  125. height: 300rpx;
  126. background-color: #fff;
  127. border-radius: 20rpx;
  128. overflow: hidden;
  129. .title {
  130. padding: 20rpx 0 10rpx 20rpx;
  131. background-color: $uni-color;
  132. color: #FFF;
  133. text-align: left;
  134. width: 100%;
  135. height: 18%;
  136. font-size: 36rpx;
  137. }
  138. .center {
  139. height: 40%;
  140. display: flex;
  141. justify-content: center;
  142. align-items: center;
  143. font-size: 36rpx;
  144. }
  145. .bottom {
  146. display: flex;
  147. justify-content: center;
  148. gap: 50rpx;
  149. }
  150. }
  151. </style>