record.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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="主键id" v-if="!$isEmpty(params.id)"><u-input v-model="params.id" disabled /></u-form-item>
  7. <u-form-item label="访客姓名"><u-input v-model="params.guestName" /></u-form-item>
  8. <u-form-item :border-bottom="false" label="手机号"><u-input v-model="params.guestTel" type="number" /></u-form-item>
  9. </u-form>
  10. </view>
  11. </u-modal>
  12. <view class="tabs flex flex-direction">
  13. <view class="flex">
  14. <scroll-view scroll-x class="bg-white nav" >
  15. <view class="flex text-center">
  16. <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)" >
  17. <text>{{item.name}}</text>
  18. </view>
  19. </view>
  20. </scroll-view>
  21. <view class="flex justify-center align-center padding-right-20" style="flex: 10%;" @click="show">
  22. <text class="cuIcon-filter " style="font-size: 40rpx;"></text>
  23. <u-badge size="mini" type="error" :count="filterCount"></u-badge>
  24. </view>
  25. </view>
  26. </view>
  27. <view style="height: 100%;">
  28. <swiper style="height: 100%;" :current="current" @change="swiperChange"
  29. @animationfinish="animationfinish">
  30. <swiper-item v-for="(item, index) in tabs" :key="index">
  31. <scroll-view scroll-y style="height: 100%;">
  32. <item @showDetail="showDetail" ref="mescrollItem" :params="params" :i="index" :item="item" :type="current"></item>
  33. </scroll-view>
  34. </swiper-item>
  35. </swiper>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import item from "./item.vue"
  41. export default {
  42. components: {
  43. item
  44. },
  45. data() {
  46. return {
  47. filterCount:0,
  48. filterShow:false,
  49. params:{},
  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. },
  74. onLoad(options) {
  75. this.params.id=options.id
  76. this.getFilterCount()
  77. },
  78. methods:{
  79. /**
  80. * 审核不通过时显示弹出框
  81. * @param {Object} item
  82. */
  83. fail(item){
  84. },
  85. /**
  86. * 显示筛选弹窗
  87. */
  88. show(){
  89. this.filterShow=true
  90. },
  91. /**
  92. * 筛选
  93. */
  94. filterConfirm(){
  95. this.$nextTick(() => {
  96. this.refreshMescroll()
  97. })
  98. this.getFilterCount()
  99. },
  100. /**
  101. * 计算筛选的数量
  102. */
  103. getFilterCount(){
  104. let n=0
  105. if (!this.$isEmpty(this.params.id)) {
  106. n++
  107. }
  108. if (!this.$isEmpty(this.params.guestName)) {
  109. n++
  110. }
  111. if (!this.$isEmpty(this.params.guestTel)) {
  112. n++
  113. }
  114. this.filterCount=n
  115. },
  116. /**
  117. * 重置筛选项
  118. */
  119. filterReset(){
  120. this.filterCount=0
  121. this.params={}
  122. this.$nextTick(() => {
  123. this.refreshMescroll()
  124. })
  125. },
  126. /**
  127. * 刷新列表
  128. */
  129. refreshMescroll(){
  130. let curMescroll = this.getMescroll(this.current)
  131. curMescroll && curMescroll.resetUpScroll()
  132. },
  133. /**
  134. * 获取Mescroll对象
  135. * @param {Object} i
  136. */
  137. getMescroll(i){
  138. let mescrollItems = this.$refs.mescrollItem;
  139. if(mescrollItems){
  140. let item = mescrollItems[i]
  141. if(item) return item.mescroll
  142. }
  143. return null
  144. },
  145. tabChange(index) {
  146. this.current = index
  147. },
  148. swiperChange(e) {
  149. uni.pageScrollTo({
  150. scrollTop: 0,
  151. duration: 0
  152. });
  153. this.current = e.detail.current
  154. },
  155. animationfinish({detail: { current }}) {
  156. this.swiperCurrent = current;
  157. this.current = current;
  158. },
  159. }
  160. }
  161. </script>
  162. <style lang="scss" scoped>
  163. .text-xl{
  164. font-size: 34rpx;
  165. }
  166. .container {
  167. height: calc(100vh);
  168. background-color: #F6F6F6;
  169. padding: 78rpx 0rpx 0rpx;
  170. .tabs {
  171. position: fixed;
  172. top: -2rpx;
  173. left: 0;
  174. width: 100%;
  175. background-color: #FFFFFF;
  176. box-sizing: border-box;
  177. z-index: 3;
  178. }
  179. }
  180. </style>