customerList.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <view class="list-wrapper">
  3. <list-filter
  4. crm-type="customer"
  5. @filter="handleFilter" />
  6. <wk-scroll-view
  7. :status="listStatus"
  8. class="list-scroll"
  9. @refresh="getList({}, true)"
  10. @loadmore="getList()">
  11. <customer-item
  12. v-for="item in listData"
  13. :key="item.customerId"
  14. :item-data="item" />
  15. </wk-scroll-view>
  16. <wk-drag-button
  17. v-if="showAddBtn"
  18. @click="handleAdd">
  19. <view class="wk-drag-btn">
  20. <text class="wk wk-plus icon" />
  21. </view>
  22. </wk-drag-button>
  23. </view>
  24. </template>
  25. <script>
  26. import {
  27. GetList
  28. } from 'API/crm/customer'
  29. import CustomerItem from '../customer/components/customerItem'
  30. import ListFilter from '../components/listFilter/index.vue'
  31. import mainListMixins from '../../mixins/mainList.js'
  32. import { deepCopy } from '@/utils/lib.js'
  33. export default {
  34. name: 'CustomerList',
  35. components: {
  36. CustomerItem,
  37. ListFilter
  38. },
  39. mixins: [mainListMixins],
  40. data() {
  41. return {
  42. GetListFn: GetList, // 获取列表数据接口
  43. listType: 'crm_customer',
  44. sortOptions: [ // 排序规则选项
  45. {label: '客户名称正序', order: 2, field: 'customerName'},
  46. {label: '客户名称倒序', order: 1, field: 'customerName'},
  47. {label: '创建时间正序', order: 2, field: 'createTime'},
  48. {label: '创建时间倒序', order: 1, field: 'createTime'},
  49. {label: '最后跟进时间正序', order: 2, field: 'lastTime'},
  50. {label: '最后跟进时间倒序', order: 1, field: 'lastTime'},
  51. ],
  52. dragWidth: 0
  53. }
  54. },
  55. computed: {
  56. showAddBtn() {
  57. return this.$auth('crm.customer.save')
  58. }
  59. },
  60. methods: {
  61. handleFilter(opt) {
  62. this.listParams = {
  63. page: 0,
  64. limit: 15
  65. }
  66. this.getList(opt, true)
  67. },
  68. handleAdd() {
  69. console.log('add click')
  70. this.$Router.navigateTo({
  71. url: '/pages_crm/customer/create'
  72. })
  73. }
  74. }
  75. }
  76. </script>
  77. <style scoped lang="scss">
  78. .list-wrapper {
  79. width: 100%;
  80. height: 100%;
  81. display: flex;
  82. flex-direction: column;
  83. overflow: hidden;
  84. .list-scroll {
  85. flex: 1;
  86. overflow: hidden;
  87. }
  88. }
  89. </style>