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

161 lines
3.3 KiB

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