record.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <view class="container">
  3. <u-popup v-model="detailShow" mode="center" width="650" :closeable="true" border-radius="10">
  4. <view style="padding: 60rpx 5rpx 10rpx;">
  5. <u-cell-group >
  6. <u-cell-item :icon-style="iconStyle" :border-top="false" :arrow="false" icon="account-fill" title="访客姓名:" :value="detailData.guestName"></u-cell-item>
  7. <u-cell-item :icon-style="iconStyle" :arrow="false" icon="bookmark-fill" title="身份证号:" :value="detailData.guestIdcard"></u-cell-item>
  8. <u-cell-item :icon-style="iconStyle" :arrow="false" icon="phone-fill" title="手机号:" :value="detailData.guestTel"></u-cell-item>
  9. <u-cell-item :icon-style="iconStyle" :arrow="false" icon="map-fill" title="访问区域:" :value="detailData.guestPosition"></u-cell-item>
  10. <u-cell-item :icon-style="iconStyle" :arrow="false" icon="clock-fill" title="访问时间:" :value="detailData.guestTime"></u-cell-item>
  11. <u-cell-item :icon-style="iconStyle" :arrow="false" icon="plus-people-fill" title="接待人:" :value="detailData.userName"></u-cell-item>
  12. <u-cell-item :icon-style="iconStyle" :border-bottom="false" :arrow="false" icon="error-circle-fill" title="访问目的:" :value="detailData.guestReason"></u-cell-item>
  13. </u-cell-group>
  14. </view>
  15. </u-popup>
  16. <u-modal cancel-text="重置" cancel-color="#000000" @cancel="filterReset" :show-cancel-button="true" @confirm="filterConfirm" title="筛选" :mask-close-able="true" v-model="filterShow" >
  17. <view class="slot-content" style="margin: 20rpx;">
  18. <u-form label-width="150" ref="uForm">
  19. <u-form-item label="主键id" v-if="!$isEmpty(params.id)"><u-input v-model="params.id" disabled /></u-form-item>
  20. <u-form-item label="访客姓名"><u-input v-model="params.guestName" /></u-form-item>
  21. <u-form-item :border-bottom="false" label="手机号"><u-input v-model="params.guestTel" type="number" /></u-form-item>
  22. </u-form>
  23. </view>
  24. </u-modal>
  25. <view class="tabs flex flex-direction">
  26. <view class="flex">
  27. <scroll-view scroll-x class="bg-white nav" >
  28. <view class="flex text-center">
  29. <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)" >
  30. {{item.name}}
  31. </view>
  32. </view>
  33. </scroll-view>
  34. <view class="flex justify-center align-center padding-right-20" style="flex: 10%;" @click="show">
  35. <text class="cuIcon-filter " style="font-size: 40rpx;"></text>
  36. <u-badge size="mini" type="error" :count="filterCount"></u-badge>
  37. </view>
  38. </view>
  39. </view>
  40. <view style="height: 100%;">
  41. <swiper style="height: 100%;" :current="current" @change="swiperChange"
  42. @animationfinish="animationfinish">
  43. <swiper-item v-for="(item, index) in tabs" :key="index">
  44. <scroll-view scroll-y style="height: 100%;">
  45. <item @test="showDetail" ref="mescrollItem" :params="params" :i="index" :item="item" :type="current"></item>
  46. </scroll-view>
  47. </swiper-item>
  48. </swiper>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import item from "./item.vue"
  54. export default {
  55. components: {
  56. item
  57. },
  58. data() {
  59. return {
  60. iconStyle:{
  61. color:"#59a5f0"
  62. },
  63. detailShow:false,
  64. detailData:{},
  65. filterCount:0,
  66. filterShow:false,
  67. params:{},
  68. current: 0,
  69. swiperCurrent:0,
  70. tabs: [
  71. {
  72. name: '全部',
  73. value:-1
  74. },
  75. {
  76. name: '待审核',
  77. value:0
  78. },
  79. {
  80. name: '已通过',
  81. value:1
  82. },
  83. {
  84. name:'未通过',
  85. value:2
  86. }
  87. ],
  88. }
  89. },
  90. onShow(){
  91. },
  92. onLoad(options) {
  93. this.params.id=options.id
  94. this.getFilterCount()
  95. },
  96. methods:{
  97. /**显示详情
  98. * @param {Object} item
  99. */
  100. showDetail(item){
  101. this.detailShow=true
  102. this.detailData=item
  103. },
  104. /**
  105. * 显示筛选弹窗
  106. */
  107. show(){
  108. this.filterShow=true
  109. },
  110. /**
  111. * 筛选
  112. */
  113. filterConfirm(){
  114. this.$nextTick(() => {
  115. this.refreshMescroll()
  116. })
  117. this.getFilterCount()
  118. },
  119. /**
  120. * 计算筛选的数量
  121. */
  122. getFilterCount(){
  123. let n=0
  124. if (!this.$isEmpty(this.params.id)) {
  125. n++
  126. }
  127. if (!this.$isEmpty(this.params.guestName)) {
  128. n++
  129. }
  130. if (!this.$isEmpty(this.params.guestTel)) {
  131. n++
  132. }
  133. this.filterCount=n
  134. },
  135. /**
  136. * 重置筛选项
  137. */
  138. filterReset(){
  139. this.filterCount=0
  140. this.params={}
  141. this.$nextTick(() => {
  142. this.refreshMescroll()
  143. })
  144. },
  145. /**
  146. * 刷新列表
  147. */
  148. refreshMescroll(){
  149. let curMescroll = this.getMescroll(this.current)
  150. curMescroll && curMescroll.resetUpScroll()
  151. },
  152. /**
  153. * 获取Mescroll对象
  154. * @param {Object} i
  155. */
  156. getMescroll(i){
  157. let mescrollItems = this.$refs.mescrollItem;
  158. if(mescrollItems){
  159. let item = mescrollItems[i]
  160. if(item) return item.mescroll
  161. }
  162. return null
  163. },
  164. tabChange(index) {
  165. this.current = index
  166. },
  167. swiperChange(e) {
  168. uni.pageScrollTo({
  169. scrollTop: 0,
  170. duration: 0
  171. });
  172. this.current = e.detail.current
  173. },
  174. animationfinish({detail: { current }}) {
  175. this.swiperCurrent = current;
  176. this.current = current;
  177. },
  178. }
  179. }
  180. </script>
  181. <style lang="scss" scoped>
  182. .text-blue{
  183. color: #59a5f0;
  184. }
  185. .text-xl{
  186. font-size: 34rpx;
  187. }
  188. .container {
  189. height: calc(100vh);
  190. background-color: #F6F6F6;
  191. padding: 78rpx 0rpx 0rpx;
  192. .tabs {
  193. position: fixed;
  194. top: -10rpx;
  195. left: 0;
  196. width: 100%;
  197. background-color: #FFFFFF;
  198. box-sizing: border-box;
  199. z-index: 3;
  200. }
  201. }
  202. </style>