index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="公海客户" @clickLeft="back">
  4. <!--右菜单-->
  5. <template slot="right">
  6. <u-button type="success" size="small" class="u-reset-button" @click="$refs.treePicker._show()"
  7. text="选择分类"></u-button>
  8. </template>
  9. </uni-nav-bar>
  10. <view class="top-wrapper">
  11. <uni-section>
  12. <uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="名称">
  13. </uni-easyinput>
  14. </uni-section>
  15. <button class="search_btn" @click="doSearch">搜索</button>
  16. <image class="menu_icon" src="~@/static/pda/menu.svg"></image>
  17. </view>
  18. <u-list @scrolltolower="scrolltolower">
  19. <contactList :btnList="btnList" ref="contactListRef"></contactList>
  20. </u-list>
  21. <view class="add" @click="add">
  22. <u-icon name="plus" color="#fff"></u-icon>
  23. </view>
  24. <ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="confirm" title="选择分类"
  25. :localdata="classificationList" valueKey="id" textKey="name" />
  26. </view>
  27. </template>
  28. <script>
  29. import contactList from './contactList.vue'
  30. import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
  31. import {
  32. getTreeByPid,
  33. } from '@/api/classifyManage'
  34. export default {
  35. components: {
  36. contactList,
  37. baTreePicker
  38. },
  39. data() {
  40. return {
  41. treeList: [],
  42. btnList: [{
  43. name: '详情',
  44. apiName: '',
  45. btnType: 'primary',
  46. type: '1',
  47. pageUrl: '/pages/saleManage/contact/add'
  48. }, {
  49. name: '申请',
  50. apiName: 'addApply',
  51. btnType: 'primary',
  52. type: '2',
  53. }],
  54. searchVal: '',
  55. categoryLevelId: '',
  56. classificationList:[]
  57. }
  58. },
  59. async onShow() {
  60. getTreeByPid(17).then(res => {
  61. this.classificationList = res.data
  62. });
  63. this.$nextTick(() => {
  64. this.$refs.contactListRef.doSearch({
  65. type: 1,
  66. assignStatus: 0,
  67. })
  68. })
  69. },
  70. methods: {
  71. doSearch(){
  72. this.$nextTick(() => {
  73. this.$refs.contactListRef.doSearch({
  74. type: 1,
  75. name: this.searchVal,
  76. categoryId: this.categoryLevelId,
  77. assignStatus: 0,
  78. })
  79. })
  80. },
  81. confirm([id]) {
  82. this.categoryLevelId = id
  83. this.doSearch()
  84. },
  85. add() {
  86. uni.navigateTo({
  87. url: '/pages/saleManage/contact/add'
  88. })
  89. },
  90. scrolltolower() {
  91. this.$refs.contactListRef.getList({
  92. type: 1,
  93. assignStatus: 0,
  94. name: this.searchVal,
  95. categoryId: this.categoryLevelId,
  96. })
  97. },
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. .add {
  103. width: 96rpx;
  104. height: 96rpx;
  105. border-radius: 48rpx;
  106. background: #3c9cff;
  107. position: fixed;
  108. bottom: 100rpx;
  109. right: 24rpx;
  110. display: flex;
  111. align-items: center;
  112. justify-content: center;
  113. }
  114. .top-wrapper {
  115. background-color: #fff;
  116. display: flex;
  117. width: 750rpx;
  118. height: 88rpx;
  119. padding: 16rpx 32rpx;
  120. align-items: center;
  121. gap: 16rpx;
  122. /deep/.uni-section {
  123. margin-top: 0px;
  124. }
  125. /deep/.uni-section-header {
  126. padding: 0px;
  127. }
  128. .search_btn {
  129. width: 120rpx;
  130. height: 70rpx;
  131. line-height: 70rpx;
  132. padding: 0 24rpx;
  133. background: $theme-color;
  134. font-size: 32rpx;
  135. color: #fff;
  136. margin: 0;
  137. margin-left: 26rpx;
  138. }
  139. .menu_icon {
  140. width: 44rpx;
  141. height: 44rpx;
  142. margin-left: 14rpx;
  143. }
  144. }
  145. </style>