item.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <MeScroll :up="up" :down="down" @up="upFn" :fixed="false" @down="downFn" @init="initMeScroll">
  3. <card @showDetail="showDetail" @pass="pass" @fail="fail" :list="list" ></card>
  4. </MeScroll>
  5. </template>
  6. <script>
  7. import MeScroll from '@/comps/mescroll-body/mescroll-uni.vue'
  8. import card from './card.vue'
  9. var app=getApp()
  10. export default {
  11. components:{
  12. MeScroll,card
  13. },
  14. props: {
  15. params:Object,
  16. type: Number,
  17. i: Number,
  18. item:Object
  19. },
  20. data() {
  21. return {
  22. //审核不通过时展示
  23. modelShow:false,
  24. //审核不通过的原因
  25. opinion:'',
  26. dataDetail:{},
  27. memberId:'',
  28. isInit: false, // 是否初始化
  29. list: [], // 列表数据
  30. mescroll: null, // mescroll 对象
  31. // 上拉配置参数
  32. up: {
  33. noMoreSize: 3,
  34. auto: false,
  35. page: {
  36. page: 0,
  37. size: 10
  38. }
  39. },
  40. // 下拉配置参数
  41. down: {
  42. use: true,
  43. auto: false
  44. }
  45. }
  46. },
  47. created() {
  48. this.memberId=getApp().globalData.member.id
  49. },
  50. watch:{
  51. type(val) {
  52. if(!this.isInit && val === this.i) {
  53. this.mescroll.resetUpScroll()
  54. }
  55. }
  56. },
  57. mounted() {
  58. if(!this.isInit && this.i === 0) {
  59. this.mescroll.resetUpScroll()
  60. }
  61. },
  62. methods: {
  63. /**
  64. * 获取待审核的数量
  65. */
  66. fetchAuthRecordNum(){
  67. let that=this
  68. let memberId=app.globalData.member.id
  69. let residentialId=uni.getStorageSync("residentialId")
  70. console.log(residentialId,"11111111")
  71. if (!this.$isEmpty(memberId)) {
  72. let params={
  73. member_id:memberId,
  74. residential_id:residentialId,
  75. size:99,
  76. auditStatus:0
  77. }
  78. // let operation='guestRecord/getListByMemberId'
  79. this.$http.getGuestRecordsByMemberId(params).then(res=>{
  80. let length=res.data.list.length
  81. that.$u.vuex('vuex_auth_audit_count',length)
  82. })
  83. }
  84. },
  85. /**
  86. * 显示详情
  87. * @param {Object} item
  88. */
  89. showDetail(item){
  90. this.$emit('showDetail',item)
  91. },
  92. /**
  93. * 通过审核
  94. */
  95. pass(item){
  96. let that=this
  97. let {rootOrgId,orgPosition,orgId,...params}=item
  98. params.auditStatus=1
  99. let operation="guestRecord/updateGuestRecord"
  100. uni.showModal({
  101. title:"提示",
  102. content:"确定审核通过该访客信息吗?",
  103. showCancel:true,
  104. success: (res) => {
  105. if (res.confirm) {
  106. getApp().globalData.postRequest(params,operation,function(res){
  107. that.fetchAuthRecordNum()
  108. that.mescroll.resetUpScroll()
  109. })
  110. }
  111. }
  112. })
  113. },
  114. /**
  115. * 审核不通过
  116. * @param {Object} item
  117. */
  118. fail(item){
  119. let that=this
  120. let {rootOrgId,orgPosition,orgId,...params}=item
  121. params.auditStatus=2
  122. let operation="guestRecord/updateGuestRecord"
  123. uni.showModal({
  124. title:"提示",
  125. content:"确定审核不通过该访客信息吗?",
  126. showCancel:true,
  127. success: (res) => {
  128. if (res.confirm) {
  129. getApp().globalData.postRequest(params,operation,function(res){
  130. that.fetchAuthRecordNum()
  131. that.mescroll.resetUpScroll()
  132. })
  133. }
  134. }
  135. })
  136. },
  137. /**
  138. * @param {Object} mescroll 初始化组件
  139. */
  140. initMeScroll(mescroll) {
  141. this.mescroll = mescroll
  142. },
  143. /**
  144. * @param {Object} mescroll 上拉回调
  145. */
  146. upFn(mescroll) {
  147. try{
  148. let that=this
  149. let params={
  150. member_id:that.memberId,
  151. residential_id:uni.getStorageSync("residentialId"),
  152. current:mescroll.num,
  153. size:mescroll.size,
  154. }
  155. if (this.item.value!=-1) {
  156. params.auditStatus=this.item.value
  157. }
  158. if (!this.$isEmpty(this.params.id)) {
  159. params.id=this.params.id
  160. }
  161. if (!this.$isEmpty(this.params.guestName)) {
  162. params.guestName=this.params.guestName
  163. }
  164. if (!this.$isEmpty(this.params.guestTel)) {
  165. params.guestTel=this.params.guestTel
  166. }
  167. // let operation='guestRecord/getListByMemberId'
  168. this.$http.getGuestRecordsByMemberId(params).then(res=>{
  169. let data=res.data.list
  170. let length=data.length
  171. let total=res.data.total
  172. mescroll.endBySize(length, total);
  173. if(mescroll.num == 1) that.list = []; //如果是第一页需手动制空列表
  174. that.list=that.list.concat(data); //追加新数据
  175. })
  176. }catch(e){
  177. mescroll.endErr();
  178. }
  179. },
  180. /**
  181. * 下拉回调
  182. * */
  183. downFn(mescroll) {
  184. setTimeout(()=>{
  185. this.mescroll.resetUpScroll()
  186. uni.showToast({
  187. title:"刷新成功",
  188. icon:"none",
  189. position:"top"
  190. })
  191. },1500)
  192. },
  193. }
  194. }
  195. </script>
  196. <style lang="scss" scoped>
  197. view{
  198. box-sizing: border-box;
  199. }
  200. </style>