list.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. onLoad(options){
  40. this.status=options.status||'待审批'
  41. this.getList()
  42. uni.$on('customeApproveListUpdate',(e)=>{
  43. console.log('监听customeApproveListUpdate,携带参数为:' + e.CompanyApprovalId);
  44. this.list=this.list.filter(item=>{
  45. return item.id!=e.CompanyApprovalId
  46. })
  47. })
  48. },
  49. onUnload(){
  50. uni.$off('customeApproveListUpdate')
  51. },
  52. onShow() {
  53. // this.list=[]
  54. // this.page=1
  55. // this.getList()
  56. this.selectComponent('#tabs').resize();// 解决初始渲染 vant tab 底部条
  57. },
  58. onPullDownRefresh() {
  59. this.page=1
  60. this.finished=false
  61. this.list=[]
  62. this.getList()
  63. setTimeout(()=>{
  64. uni.stopPullDownRefresh()
  65. },1500)
  66. },
  67. onReachBottom() {
  68. if(this.finished) return
  69. this.page++
  70. this.getList()
  71. },
  72. methods: {
  73. // 去搜索
  74. handleGoSearch() {
  75. uni.navigateTo({
  76. url: '../search/index?type=custome'
  77. })
  78. },
  79. typeChange(e){
  80. this.status=e.detail.name
  81. this.page=1
  82. this.finished=false
  83. this.list=[]
  84. this.getList()
  85. },
  86. //获取列表数据
  87. async getList(){
  88. const res=await apiCustomeList({
  89. CurrentIndex:this.page,
  90. Status:this.status,
  91. Keyword:''
  92. })
  93. if(res.code===200){
  94. if(!res.data.List||res.data.List.length===0){
  95. this.finished=true
  96. }else{
  97. let arr=res.data.List.map(item=>{
  98. //申请类型:申请类型:1:试用->正式,2:冻结—>试用,3:试用延期,4:原销售申请领取流失客户,5:续约申请,6:补充协议
  99. let applyType=''
  100. switch(item.ApplyMethod){
  101. case 1:
  102. applyType='试用转正式'
  103. break;
  104. case 2:
  105. applyType='冻结转试用'
  106. break;
  107. case 3:
  108. applyType='试用延期'
  109. break;
  110. case 4:
  111. applyType='原销售申领'
  112. break;
  113. case 5:
  114. applyType='续约申请'
  115. break;
  116. case 6:
  117. applyType='补充协议'
  118. break;
  119. }
  120. return {
  121. title:item.CompanyName,
  122. saller:item.ApplyRealName,
  123. submitTime:item.ApprovalTime,
  124. approveTime:item.ApproveTime,
  125. backTime:'',
  126. cancelTime:'',
  127. status:item.ApproveStatus==='驳回'?'已驳回':item.ApproveStatus,
  128. applyType:applyType,
  129. contractSourceTag:item.ContractSourceTag,
  130. id:item.CompanyApprovalId,
  131. type:'custome'
  132. }
  133. })
  134. this.list=[...this.list,...arr]
  135. }
  136. }
  137. },
  138. },
  139. }
  140. </script>
  141. <style lang="scss">
  142. .search-icon {
  143. width: 40rpx;
  144. height: 40rpx;
  145. display: block;
  146. position: relative;
  147. top: 4rpx;
  148. margin-right: 10rpx;
  149. }
  150. .list-wrap {
  151. padding: 20rpx;
  152. }
  153. </style>