123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <template>
- <view class="contacts-item" @click="handleDetail">
- <view class="cell">
- <view class="left">
- {{ iconText }}
- </view>
- <view class="center">
- <view class="name">
- {{ itemData.name || ' ' }}
- </view>
- <view class="text-info">
- 最后跟进时间:{{ itemData.lastTime | formatTime }}
- </view>
- </view>
- <view class="right" @click.stop="ringUp(itemData.mobile)">
- <image
- :src="$static('images/icon/call.png')"
- class="call" />
- </view>
- </view>
- </view>
- </template>
- <script>
- import moment from 'moment'
- export default {
- name: 'ContactsItem',
- filters: {
- formatTime(val) {
- if (!val) return '--'
- return moment(val).format('YYYY-MM-DD')
- }
- },
- props: {
- itemData: {
- type: Object,
- required: true
- }
- },
- data() {
- return {
- auth: 'crm.contacts.read'
- }
- },
- computed: {
- iconText() {
- const reg = /[\u4e00-\u9fa5]+/
- let str = this.itemData.name.slice(0, 1) || ''
- if (reg.test(str)) {
- return this.itemData.name.slice(0, 1)
- }
- return this.itemData.name.slice(0, 2)
- }
- },
- methods: {
- /**
- * 联系人详情跳转
- */
- handleDetail() {
- if (!this.$auth(this.auth)) {
- this.$toast('权限不足')
- return
- }
- this.$Router.navigateTo({
- url: '/pages_crm/contacts/detail',
- query: {
- id: this.itemData.contactsId
- }
- })
- },
- /**
- * 拨打电话
- * @param {string} tel
- */
- ringUp(tel) {
- console.log('tel: ', tel)
- if (!tel) {
- this.$toast('暂无电话')
- return
- }
- uni.makePhoneCall({
- phoneNumber: tel
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- @import "../../style/listItem";
- .contacts-item {
- border-bottom: 1rpx solid $border-color;
- background-color: white;
- padding: 20rpx 32rpx;
- .cell {
- .left {
- width: 80rpx;
- height: 80rpx;
- font-size: 36rpx;
- color: white;
- text-align: center;
- line-height: 80rpx;
- border-radius: 50%;
- background-color: $theme-color;
- margin-right: 25rpx;
- }
- .center {
- flex: 1;
- text-align: left;
- .name {
- font-size: 32rpx;
- color: #212121;
- @include ellipsis;
- }
- .text-info {
- font-size: 26rpx;
- color: $gray;
- }
- }
- .right {
- padding: 15rpx 0 15rpx 20rpx;
- @include center;
- }
- }
- }
- </style>
|