aboutContacts.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="section about-contacts">
  3. <view class="section-title">
  4. <image :src="$static('images/crm_about/contacts.png')" class="icon" />
  5. <text class="title">
  6. 联系人
  7. </text>
  8. <view
  9. v-if="!config.isSeas"
  10. class="add-btn"
  11. @click="handleAdd">
  12. <text class="wk wk-plus icon-add" />
  13. <text>新建</text>
  14. </view>
  15. </view>
  16. <view class="section-body">
  17. <template v-if="list.length > 0">
  18. <view class="contacts-list">
  19. <view
  20. v-for="(item, index) in list"
  21. :key="index"
  22. class="contacts-list-item"
  23. @click="handleTo(item.contactsId)">
  24. <view class="contacts-list-item-info">
  25. <text class="name">
  26. {{ item.name || '&nbsp;' }}
  27. </text>
  28. <text class="phone">
  29. {{ item.mobile || '&nbsp;' }}
  30. </text>
  31. </view>
  32. <image
  33. :src="$static('images/icon/call.png')"
  34. class="contacts-list-item-icon"
  35. alt=""
  36. @click.stop="ringUp(item.mobile)" />
  37. </view>
  38. </view>
  39. </template>
  40. <template v-else>
  41. <view class="no-data">
  42. 暂无数据
  43. </view>
  44. </template>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. name: 'AboutContacts',
  51. props: {
  52. list: {
  53. type: Array,
  54. required: true
  55. },
  56. config: {
  57. type: Object,
  58. default: () => {}
  59. }
  60. },
  61. data() {
  62. return {}
  63. },
  64. methods: {
  65. handleAdd() {
  66. const checkRes = this.$auth('crm.contacts.save')
  67. if (!checkRes) {
  68. this.$toast('权限不足!')
  69. return
  70. }
  71. if (!this.config.detail) return
  72. getApp().globalData.formBridge = {
  73. default: {
  74. customerId: [{
  75. customerId: this.config.detail.customerId,
  76. customerName: this.config.detail.customerName
  77. }]
  78. }
  79. }
  80. this.$Router.navigateTo({
  81. url: '/pages_crm/contacts/create'
  82. })
  83. },
  84. handleTo(id) {
  85. const checkRes = this.$auth('crm.contacts.read')
  86. if (!checkRes) {
  87. this.$toast('权限不足!')
  88. return
  89. }
  90. this.$Router.navigateTo({
  91. url: '/pages_crm/contacts/detail',
  92. query: {
  93. id: id
  94. }
  95. })
  96. },
  97. /**
  98. * 拨打电话
  99. * @param {string} tel
  100. */
  101. ringUp(tel) {
  102. console.log('tel: ')
  103. uni.makePhoneCall({
  104. phoneNumber: tel
  105. })
  106. }
  107. }
  108. }
  109. </script>
  110. <style scoped lang="scss">
  111. @import './style.scss';
  112. .contacts-list {
  113. width: 100%;
  114. background-color: white;
  115. padding: 0 32rpx;
  116. &-item {
  117. border-bottom: 1rpx solid $border-color;
  118. @include padding;
  119. @include left;
  120. &-info {
  121. flex: 1;
  122. flex-direction: column;
  123. display: flex;
  124. .name {
  125. font-size: 30rpx;
  126. color: $dark;
  127. }
  128. .phone {
  129. font-size: 26rpx;
  130. color: $gray;
  131. line-height: 2;
  132. }
  133. }
  134. &-icon {
  135. width: 52rpx;
  136. height: 52rpx;
  137. }
  138. &:last-child {
  139. border: 0 none;
  140. }
  141. }
  142. }
  143. </style>