record.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. <text>{{item.name}}</text>
  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 @showDetail="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. * @param {Object} item
  107. */
  108. fail(item){
  109. console.log(item);
  110. },
  111. /**
  112. * 显示筛选弹窗
  113. */
  114. show(){
  115. this.filterShow=true
  116. },
  117. /**
  118. * 筛选
  119. */
  120. filterConfirm(){
  121. this.$nextTick(() => {
  122. this.refreshMescroll()
  123. })
  124. this.getFilterCount()
  125. },
  126. /**
  127. * 计算筛选的数量
  128. */
  129. getFilterCount(){
  130. let n=0
  131. if (!this.$isEmpty(this.params.id)) {
  132. n++
  133. }
  134. if (!this.$isEmpty(this.params.guestName)) {
  135. n++
  136. }
  137. if (!this.$isEmpty(this.params.guestTel)) {
  138. n++
  139. }
  140. this.filterCount=n
  141. },
  142. /**
  143. * 重置筛选项
  144. */
  145. filterReset(){
  146. this.filterCount=0
  147. this.params={}
  148. this.$nextTick(() => {
  149. this.refreshMescroll()
  150. })
  151. },
  152. /**
  153. * 刷新列表
  154. */
  155. refreshMescroll(){
  156. let curMescroll = this.getMescroll(this.current)
  157. curMescroll && curMescroll.resetUpScroll()
  158. },
  159. /**
  160. * 获取Mescroll对象
  161. * @param {Object} i
  162. */
  163. getMescroll(i){
  164. let mescrollItems = this.$refs.mescrollItem;
  165. if(mescrollItems){
  166. let item = mescrollItems[i]
  167. if(item) return item.mescroll
  168. }
  169. return null
  170. },
  171. tabChange(index) {
  172. this.current = index
  173. },
  174. swiperChange(e) {
  175. uni.pageScrollTo({
  176. scrollTop: 0,
  177. duration: 0
  178. });
  179. this.current = e.detail.current
  180. },
  181. animationfinish({detail: { current }}) {
  182. this.swiperCurrent = current;
  183. this.current = current;
  184. },
  185. }
  186. }
  187. </script>
  188. <style lang="scss" scoped>
  189. .text-xl{
  190. font-size: 34rpx;
  191. }
  192. .container {
  193. height: calc(100vh);
  194. background-color: #F6F6F6;
  195. padding: 78rpx 0rpx 0rpx;
  196. .tabs {
  197. position: fixed;
  198. top: -2rpx;
  199. left: 0;
  200. width: 100%;
  201. background-color: #FFFFFF;
  202. box-sizing: border-box;
  203. z-index: 3;
  204. }
  205. }
  206. </style>