酒店桌布为微信小程序
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.

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