list.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <view>
  3. <van-sticky>
  4. <view class="top-wrap">
  5. <view @click="handleGoSearch">
  6. <van-search disabled use-left-icon-slot shape="round" placeholder="客户名称/社会信用码">
  7. <view slot="left-icon">
  8. <image src="../static/search-icon.png" mode="aspectFill" class="search-icon"></image>
  9. </view>
  10. </van-search>
  11. </view>
  12. <van-tabs swipeable id="tabs" :active="status" title-active-color="#3385FF" color="#3385FF" @change="typeChange">
  13. <van-tab title="待审批" name="待审批"></van-tab>
  14. <van-tab title="已审批" name="已审批"></van-tab>
  15. </van-tabs>
  16. </view>
  17. </van-sticky>
  18. <van-empty description="暂无数据" :image="require('@/static/empty.png')" v-if="finished&&list.length===0"/>
  19. <view class="list-wrap" v-else>
  20. <approve-list-item v-for="item in list" :key="item.CompanyApprovalId" :data="item"></approve-list-item>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import {apiCustomeList} from '@/api/approve/custome.js'
  26. import approveListItem from '../components/approveListItem.vue'
  27. export default {
  28. components: {
  29. approveListItem
  30. },
  31. data() {
  32. return {
  33. status: '待审批',
  34. list:[],
  35. page:1,
  36. finished:false,
  37. }
  38. },
  39. onShow() {
  40. this.list=[]
  41. this.page=1
  42. this.getList()
  43. this.selectComponent('#tabs').resize();// 解决初始渲染 vant tab 底部条
  44. },
  45. onPullDownRefresh() {
  46. this.page=1
  47. this.finished=false
  48. this.list=[]
  49. this.getList()
  50. setTimeout(()=>{
  51. uni.stopPullDownRefresh()
  52. },1500)
  53. },
  54. onReachBottom() {
  55. if(this.finished) return
  56. this.page++
  57. this.getList()
  58. },
  59. methods: {
  60. // 去搜索
  61. handleGoSearch() {
  62. uni.navigateTo({
  63. url: '../search/index?type=custome'
  64. })
  65. },
  66. typeChange(e){
  67. this.status=e.detail.name
  68. this.page=1
  69. this.finished=false
  70. this.list=[]
  71. this.getList()
  72. },
  73. //获取列表数据
  74. async getList(){
  75. const res=await apiCustomeList({
  76. CurrentIndex:this.page,
  77. Status:this.status,
  78. Keyword:''
  79. })
  80. if(res.code===200){
  81. if(!res.data.List||res.data.List.length===0){
  82. this.finished=true
  83. }else{
  84. let arr=res.data.List.map(item=>{
  85. //申请类型:申请类型:1:试用->正式,2:冻结—>试用,3:试用延期,4:原销售申请领取流失客户,5:正式客户申请服务更新
  86. let applyType=''
  87. switch(item.ApplyMethod){
  88. case 1:
  89. applyType='试用转正式'
  90. break;
  91. case 2:
  92. applyType='冻结转试用'
  93. break;
  94. case 3:
  95. applyType='试用延期'
  96. break;
  97. case 4:
  98. applyType='原销售申领'
  99. break;
  100. case 5:
  101. applyType='服务更新'
  102. break;
  103. }
  104. return {
  105. title:item.CompanyName,
  106. saller:item.ApplyRealName,
  107. submitTime:item.ApprovalTime,
  108. approveTime:item.ApproveTime,
  109. backTime:'',
  110. cancelTime:'',
  111. status:item.ApproveStatus==='驳回'?'已驳回':item.ApproveStatus,
  112. applyType:applyType,
  113. id:item.CompanyApprovalId,
  114. type:'custome'
  115. }
  116. })
  117. this.list=[...this.list,...arr]
  118. }
  119. }
  120. },
  121. },
  122. }
  123. </script>
  124. <style lang="scss">
  125. .search-icon {
  126. width: 40rpx;
  127. height: 40rpx;
  128. display: block;
  129. position: relative;
  130. top: 4rpx;
  131. margin-right: 10rpx;
  132. }
  133. .list-wrap {
  134. padding: 20rpx;
  135. }
  136. </style>