telList.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <uni-popup ref="telRef" :isMaskClick='true' type="center" border-radius="10px 10px 0 0" maskBackgroundColor='rgba(0, 0, 0, 0.1)'>
  3. <view class="tel-box">
  4. <view class="tel-title">请选择电话拨打</view>
  5. <view class="tel-number">
  6. <view class="tel-number-item" v-for="item in telList" @click.stop="onPhoneCall(item.phone)">
  7. <text>{{item.phone}}</text>
  8. <text style="margin-left: 15rpx;" v-if="item.remark">({{item.remark}})</text>
  9. </view>
  10. </view>
  11. <view class="tel-btns" @click.stop="onClose()">
  12. <view class="tel-btn">关闭</view>
  13. </view>
  14. </view>
  15. </uni-popup>
  16. </template>
  17. <script>
  18. import { PhoneCall } from "@/utils/tool.js";
  19. export default {
  20. data() {
  21. return {
  22. telList: []
  23. }
  24. },
  25. mounted() {
  26. // this.$refs.telRef.open()
  27. },
  28. methods: {
  29. open(parmas = {}) {
  30. const { tel } = parmas;
  31. if (tel) {
  32. if (tel.length === 1 && !tel[0].remark) {
  33. this.onPhoneCall(tel[0].phone)
  34. } else {
  35. this.telList = tel;
  36. this.$refs.telRef.open()
  37. }
  38. }
  39. },
  40. onPhoneCall(phone) {
  41. PhoneCall(phone).then(res => {
  42. this.onClose()
  43. })
  44. },
  45. onClose() {
  46. this.$refs.telRef.close()
  47. this.telList = [];
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. .uni-popup {
  54. z-index: 1002;
  55. .tel-box {
  56. width: 80vw;
  57. min-height: 30vh;
  58. height: auto;
  59. max-height: 70vh;
  60. background-color: #fff;
  61. border-radius: 20rpx;
  62. display: flex;
  63. flex-direction: column;
  64. // justify-content: center;
  65. align-items: center;
  66. justify-content: space-between;
  67. .tel-title {
  68. font-size: 36rpx;
  69. padding: 20rpx 0;
  70. }
  71. .tel-number {
  72. height: 1px;
  73. flex: 1;
  74. overflow: hidden;
  75. overflow-y: auto;
  76. .tel-number-item {
  77. padding: 20rpx;
  78. color: #3291F8;
  79. }
  80. }
  81. .tel-btns {
  82. padding: 20rpx 0;
  83. .tel-btn {
  84. width: 260rpx;
  85. height: 80rpx;
  86. display: flex;
  87. justify-content: center;
  88. align-items: center;
  89. color: #fff;
  90. border-radius: 10rpx;
  91. background-color: #3291F8;
  92. }
  93. }
  94. }
  95. }
  96. </style>