list.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view class="container">
  3. <u-modal cancel-text="重置" cancel-color="#000000" @cancel="filterReset" :show-cancel-button="true" @confirm="filterConfirm" title="筛选" :mask-close-able="true" v-model="filterShow" >
  4. <view class="slot-content" style="margin: 20rpx;">
  5. <u-form label-width="150" ref="uForm">
  6. <u-form-item label="员工姓名"><u-input v-model="realName" /></u-form-item>
  7. <u-form-item :border-bottom="false" label="手机号"><u-input v-model="phone" type="number" /></u-form-item>
  8. </u-form>
  9. </view>
  10. </u-modal>
  11. <view class="tabs flex flex-direction">
  12. <view class="flex">
  13. <scroll-view scroll-x class="bg-white nav" style="width: 90%;">
  14. <view class="flex text-center">
  15. <view class="cu-item flex-sub" :class="index==current?'text-blue text-xl text-bold ':'text-lg'" v-for="(item,index) in tabs" :key="index" @tap="tabChange(index)" >
  16. {{item.name}}
  17. </view>
  18. </view>
  19. </scroll-view>
  20. <view class="flex justify-center align-center" @click="show">
  21. <text class="cuIcon-filter " style="font-size: 40rpx;"></text>
  22. <u-badge size="mini" type="error" :count="filterCount"></u-badge>
  23. </view>
  24. </view>
  25. </view>
  26. <view style="height: 100%;">
  27. <swiper style="height: 100%;" :current="current" @change="swiperChange"
  28. @animationfinish="animationfinish">
  29. <swiper-item v-for="(item, index) in tabs" :key="index">
  30. <scroll-view scroll-y style="height: 100%;">
  31. <item ref="mescrollItem" :realName="realName" :phone="phone" :refresh="refresh" :i="index" :item="item" :type="current"></item>
  32. </scroll-view>
  33. </swiper-item>
  34. </swiper>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import item from "./item.vue"
  40. export default {
  41. components: {
  42. item
  43. },
  44. data() {
  45. return {
  46. filterCount:0,
  47. filterShow:false,
  48. realName:'',
  49. phone:'',
  50. current: 0,
  51. swiperCurrent:0,
  52. tabs: [
  53. {
  54. name: '全部',
  55. value:-1
  56. },
  57. {
  58. name: '待审核',
  59. value:0
  60. },
  61. {
  62. name: '已通过',
  63. value:1
  64. },
  65. {
  66. name:'未通过',
  67. value:2
  68. }
  69. ],
  70. }
  71. },
  72. onShow(){
  73. let pages = getCurrentPages(); //获取所有页面栈实例列表
  74. let currPage = pages[ pages.length - 1]; //当前页页面实例
  75. if (currPage.data.flag==true) {
  76. this.realName=''
  77. this.phone=''
  78. this.refreshMescroll()
  79. }
  80. },
  81. onLoad() {
  82. },
  83. methods:{
  84. show(){
  85. this.filterShow=true
  86. console.log("111");
  87. },
  88. /**
  89. * 筛选
  90. */
  91. filterConfirm(){
  92. this.refreshMescroll()
  93. let n=0
  94. if (!this.$isEmpty(this.realName)) {
  95. n++
  96. }
  97. if (!this.$isEmpty(this.phone)) {
  98. n++
  99. }
  100. this.filterCount=n
  101. },
  102. /**
  103. * 重置筛选项
  104. */
  105. filterReset(){
  106. this.filterCount=0
  107. this.realName=''
  108. this.phone=''
  109. this.$nextTick(() => {
  110. this.refreshMescroll()
  111. })
  112. },
  113. /**
  114. * 刷新列表
  115. */
  116. refreshMescroll(){
  117. let curMescroll = this.getMescroll(this.current)
  118. curMescroll && curMescroll.resetUpScroll()
  119. },
  120. /**
  121. * 获取Mescroll对象
  122. * @param {Object} i
  123. */
  124. getMescroll(i){
  125. let mescrollItems = this.$refs.mescrollItem;
  126. if(mescrollItems){
  127. let item = mescrollItems[i]
  128. if(item) return item.mescroll
  129. }
  130. return null
  131. },
  132. tabChange(index) {
  133. this.current = index
  134. },
  135. swiperChange(e) {
  136. uni.pageScrollTo({
  137. scrollTop: 0,
  138. duration: 0
  139. });
  140. this.current = e.detail.current
  141. },
  142. animationfinish({detail: { current }}) {
  143. this.swiperCurrent = current;
  144. this.current = current;
  145. },
  146. }
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. .text-blue{
  151. color: #59a5f0;
  152. }
  153. .text-xl{
  154. font-size: 34rpx;
  155. }
  156. .container {
  157. height: calc(100vh);
  158. background-color: #F6F6F6;
  159. padding: 78rpx 0rpx 0rpx;
  160. .tabs {
  161. position: fixed;
  162. top: -10rpx;
  163. left: 0;
  164. width: 100%;
  165. background-color: #FFFFFF;
  166. box-sizing: border-box;
  167. z-index: 3;
  168. }
  169. }
  170. </style>