list.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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 id="tabs" :active="status" title-active-color="#3385FF" color="#3385FF" @change="typeChange">
  13. <van-tab :title="item" :name="item" v-for="item in tabList" :key="item"></van-tab>
  14. </van-tabs>
  15. </view>
  16. </van-sticky>
  17. <van-empty description="暂无数据" :image="require('@/static/empty.png')" v-if="finished&&list.length===0"/>
  18. <view class="list" v-else>
  19. <approve-list-item v-for="item in list" :key="item.id" :data="item"></approve-list-item>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {apiContractApproveList,apiContractList} from '@/api/approve/contract.js'
  25. import approveListItem from '../components/approveListItem.vue'
  26. export default{
  27. components:{
  28. approveListItem
  29. },
  30. data() {
  31. return {
  32. tabList:[],
  33. status: '待审批',
  34. list:[],
  35. page:1,
  36. finished:false,
  37. }
  38. },
  39. onLoad(options) {
  40. this.status=options.status||'待审批'
  41. this.initTabs()//初始化tab 栏
  42. if(this.status==='待提交'){
  43. this.getContractList()
  44. }else{
  45. this.getList()
  46. }
  47. // 更新列表
  48. uni.$on('contractApproveListUpdate',(e)=>{
  49. console.log('更新列表');
  50. this.list=this.list.filter(item=>{
  51. return !(item.ContractApprovalId==e.ContractApprovalId&&item.ContractApprovalRecordId==e.ContractApprovalRecordId&&item.ContractId==e.ContractId)
  52. })
  53. })
  54. },
  55. onUnload(){
  56. uni.$off('contractApproveListUpdate')
  57. },
  58. onShow() {
  59. this.$nextTick(()=>{
  60. this.selectComponent('#tabs').resize();// 解决初始渲染 vant tab 底部条
  61. })
  62. // this.page=1
  63. // this.list=[]
  64. // if(this.status==='待提交'){
  65. // this.getContractList()
  66. // }else{
  67. // this.getList()
  68. // }
  69. },
  70. onPullDownRefresh() {
  71. this.page=1
  72. this.finished=false
  73. this.list=[]
  74. if(this.status==='待提交'){
  75. this.getContractList()
  76. }else{
  77. this.getList()
  78. }
  79. setTimeout(()=>{
  80. uni.stopPullDownRefresh()
  81. },1500)
  82. },
  83. onReachBottom() {
  84. if(this.finished) return
  85. this.page++
  86. if(this.status==='待提交'){
  87. this.getContractList()
  88. }else{
  89. this.getList()
  90. }
  91. },
  92. methods: {
  93. //初始化tab
  94. initTabs(){
  95. // ficc销售 权益销售
  96. const RoleTypeCode=this.$store.state.userInfo.RoleTypeCode
  97. if(['ficc_seller','rai_seller','ficc_group','rai_group','ficc_team'].includes(RoleTypeCode)){
  98. this.tabList=['待审批','处理中','已审批','已签回','待提交','其它']
  99. this.status='待审批'
  100. }
  101. // ficc管理员 权益管理员 合规compliance
  102. if(RoleTypeCode==='ficc_admin'||RoleTypeCode==='rai_admin'||RoleTypeCode==='compliance'||RoleTypeCode==='admin'){
  103. this.tabList=['待审批','处理中','已审批','已签回','其它']
  104. this.status='待审批'
  105. }
  106. },
  107. // 去搜索
  108. handleGoSearch() {
  109. uni.navigateTo({
  110. url: '../search/index?type=contract'
  111. })
  112. },
  113. typeChange(e){
  114. this.status=e.detail.name
  115. this.page=1
  116. this.finished=false
  117. this.list=[]
  118. if(this.status==='待提交'){
  119. this.getContractList()
  120. }else{
  121. this.getList()
  122. }
  123. },
  124. //获取列表数据
  125. async getList(){
  126. const res=await apiContractApproveList({
  127. CurrentIndex:this.page,
  128. Status:this.status,
  129. Keyword:''
  130. })
  131. if(res.code===200){
  132. if(!res.data.List||res.data.List.length===0){
  133. this.finished=true
  134. }else{
  135. if(this.page===1&&res.data.List.length<20){
  136. this.finished=true
  137. }
  138. let arr=res.data.List.map(item=>{
  139. let backTime=''
  140. if(item.Status==='已撤回'){
  141. backTime=item.ModifyTime
  142. }
  143. return {
  144. title:item.CompanyName,
  145. saller:item.SellerName,
  146. submitTime:this.status==='处理中'?item.ModifyTime:item.CreateTime,
  147. approveTime:item.ApproveTime,
  148. checkBackTime:item.CheckBackFileTime,
  149. backTime:backTime,
  150. cancelTime:item.InvalidTime,
  151. status:item.Status,
  152. applyType:item.ApplyContent,
  153. id:item.ContractApprovalId,
  154. ContractApprovalId:item.ContractApprovalId,
  155. ContractApprovalRecordId:item.ContractApprovalRecordId,
  156. ContractId:item.ContractId,
  157. RescindTime:item.RescindTime,
  158. type:'contract',
  159. }
  160. })
  161. this.list=[...this.list,...arr]
  162. }
  163. }
  164. },
  165. // 获取合同列表
  166. async getContractList(){
  167. const res=await apiContractList({
  168. CurrentIndex:this.page,
  169. Status:this.status,
  170. Keyword:''
  171. })
  172. if(res.code===200){
  173. if(res.data.Paging.IsEnd){
  174. this.finished=true
  175. }
  176. let arr=res.data.List.map(item=>{
  177. let backTime=''
  178. if(item.Status==='已撤回'){
  179. backTime=item.ModifyTime
  180. }
  181. return {
  182. title:item.CompanyName,
  183. saller:item.SellerName,
  184. submitTime:item.CreateTime,
  185. approveTime:item.ApproveTime,
  186. checkBackTime:item.CheckBackFileTime,
  187. backTime:backTime,
  188. cancelTime:item.InvalidTime,
  189. status:item.Status,
  190. applyType:'生成新模板',
  191. id:item.ContractId,
  192. ContractApprovalId:0,
  193. ContractApprovalRecordId:0,
  194. ContractId:item.ContractId,
  195. ModifyTime:item.ModifyTime,
  196. type:'contract',
  197. }
  198. })
  199. this.list=[...this.list,...arr]
  200. }
  201. }
  202. },
  203. }
  204. </script>
  205. <style lang="scss">
  206. .search-icon {
  207. width: 40rpx;
  208. height: 40rpx;
  209. display: block;
  210. position: relative;
  211. top: 4rpx;
  212. margin-right: 10rpx;
  213. }
  214. .list{
  215. padding: 20rpx;
  216. }
  217. </style>