list.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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" :data="item"></approve-list-item>
  20. </view>
  21. <image src="../static/seal-icon.png" mode="aspectFill" class="add-btn" @click="handleGoApplySeal" v-if="showAddSeal"></image>
  22. </view>
  23. </template>
  24. <script>
  25. import {apiSealList,apiSealApproveList} from '@/api/approve/seal.js'
  26. import approveListItem from '../components/approveListItem.vue'
  27. export default {
  28. components:{
  29. approveListItem
  30. },
  31. computed:{
  32. showAddSeal(){
  33. // 只有销售和合规能有此按钮
  34. let RoleTypeCode=this.$store.state.userInfo.RoleTypeCode
  35. if(['ficc_seller','rai_seller','compliance','ficc_group','rai_group','ficc_team'].includes(RoleTypeCode)){
  36. return true
  37. }else{
  38. return false
  39. }
  40. }
  41. },
  42. data() {
  43. return {
  44. tabList:['待审批','处理中','已审批','已签回','其它'],
  45. status: '待审批',
  46. list:[],
  47. page:1,
  48. finished:false,
  49. }
  50. },
  51. onLoad(options) {
  52. this.status=options.status||'待审批'
  53. // this.initTabs()
  54. this.getList()
  55. // 更新列表
  56. uni.$on('sealApproveListUpdate',(e)=>{
  57. console.log('更新列表');
  58. if(this.status==='待审批'){
  59. this.page=1
  60. this.finished=false
  61. this.list=[]
  62. this.getList()
  63. return
  64. }
  65. this.list=this.list.filter(item=>{
  66. return !(item.ContractApprovalId==e.ContractApprovalId&&item.ContractApprovalRecordId==e.ContractApprovalRecordId&&item.SealId==e.SealId)
  67. })
  68. })
  69. },
  70. onUnload(){
  71. uni.$off('sealApproveListUpdate')
  72. },
  73. onShow() {
  74. // this.list=[]
  75. // this.page=1
  76. // this.getList()
  77. this.$nextTick(()=>{
  78. this.selectComponent('#tabs').resize();// 解决初始渲染 vant tab 底部条
  79. })
  80. },
  81. onPullDownRefresh() {
  82. this.page=1
  83. this.finished=false
  84. this.list=[]
  85. this.getList()
  86. setTimeout(()=>{
  87. uni.stopPullDownRefresh()
  88. },1500)
  89. },
  90. onReachBottom() {
  91. if(this.finished) return
  92. this.page++
  93. this.getList()
  94. },
  95. methods: {
  96. //初始化tab 将已作废、已撤回合并则不用区分用户权限(该方法废弃)
  97. // initTabs(){
  98. // // ficc销售 权益销售
  99. // const RoleTypeCode=this.$store.state.userInfo.RoleTypeCode
  100. // if(RoleTypeCode==='ficc_seller'||RoleTypeCode==='rai_seller'||RoleTypeCode==='ficc_group'||RoleTypeCode==='rai_group'||RoleTypeCode==='compliance'){
  101. // this.tabList=['待审批','处理中','已审批','已作废','已撤回']
  102. // this.status='待审批'
  103. // }
  104. // // ficc管理员 权益管理员 合规compliance
  105. // if(RoleTypeCode==='ficc_admin'||RoleTypeCode==='rai_admin'||RoleTypeCode==='admin'){
  106. // this.tabList=['待审批','处理中','已审批','已作废']
  107. // this.status='待审批'
  108. // }
  109. // },
  110. //去添加用印申请、
  111. handleGoApplySeal(){
  112. uni.navigateTo({
  113. url:'/pages-approve/seal/addSeal'
  114. })
  115. },
  116. // 去搜索
  117. handleGoSearch() {
  118. uni.navigateTo({
  119. url: '../search/index?type=seal'
  120. })
  121. },
  122. typeChange(e){
  123. this.status=e.detail.name
  124. this.page=1
  125. this.finished=false
  126. this.list=[]
  127. this.getList()
  128. },
  129. //获取列表数据
  130. async getList(){
  131. // let res=null
  132. // if(this.status==='已撤回'){
  133. // res=await apiSealList({
  134. // CurrentIndex:this.page,
  135. // Status:this.status,
  136. // Keyword:''
  137. // })
  138. // }else{
  139. // res=await apiSealApproveList({
  140. // CurrentIndex:this.page,
  141. // Status:this.status,
  142. // Keyword:''
  143. // })
  144. // }
  145. let res=await apiSealApproveList({
  146. CurrentIndex:this.page,
  147. Status:this.status,
  148. Keyword:''
  149. })
  150. if(res.code===200){
  151. if(!res.data.List||res.data.List.length===0){
  152. this.finished=true
  153. }else{
  154. if(this.page===1&&res.data.List.length<20){
  155. this.finished=true
  156. }
  157. let arr=res.data.List.map(item=>{
  158. return {
  159. title:item.CompanyName,
  160. saller:item.UserName,
  161. submitTime:this.status==='处理中'?item.ModifyTime:item.CreateTime,
  162. approveTime:item.ApproveTime,
  163. backTime:item.ModifyTime,
  164. cancelTime:item.InvalidTime,
  165. checkBackTime:item.CheckBackFileTime,
  166. status:item.Status,
  167. applyType:item.SealType,
  168. ContractApprovalId:item.ContractApprovalId||0,
  169. ContractApprovalRecordId:item.ContractApprovalRecordId||0,
  170. SealId:item.SealId||0,
  171. AffiliatedCompany:item.AffiliatedCompany,
  172. type:'seal'
  173. }
  174. })
  175. this.list=[...this.list,...arr]
  176. }
  177. }
  178. },
  179. },
  180. }
  181. </script>
  182. <style lang="scss">
  183. .search-icon {
  184. width: 40rpx;
  185. height: 40rpx;
  186. display: block;
  187. position: relative;
  188. top: 4rpx;
  189. margin-right: 10rpx;
  190. }
  191. .list{
  192. padding: 20rpx;
  193. }
  194. .add-btn{
  195. width: 120rpx;
  196. height: 120rpx;
  197. position: fixed;
  198. bottom: 102rpx;
  199. right: 34rpx;
  200. z-index: 100;
  201. }
  202. </style>