item.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <MeScroll :up="up" :down="down" @up="upFn" :fixed="false" @down="downFn" @init="initMeScroll">
  3. <card @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,
  13. card
  14. },
  15. props: {
  16. params: Object,
  17. type: Number,
  18. i: Number,
  19. item: Object
  20. },
  21. data() {
  22. return {
  23. //审核不通过时展示
  24. modelShow: false,
  25. //审核不通过的原因
  26. opinion: '',
  27. dataDetail: {},
  28. memberId: '',
  29. isInit: false, // 是否初始化
  30. list: [], // 列表数据
  31. mescroll: null, // mescroll 对象
  32. // 上拉配置参数
  33. up: {
  34. noMoreSize: 3,
  35. auto: false,
  36. page: {
  37. page: 0,
  38. size: 10
  39. }
  40. },
  41. // 下拉配置参数
  42. down: {
  43. use: true,
  44. auto: false
  45. }
  46. }
  47. },
  48. created() {
  49. this.memberId = getApp().globalData.member.id
  50. },
  51. watch: {
  52. type(val) {
  53. if (!this.isInit && val === this.i) {
  54. this.mescroll.resetUpScroll()
  55. }
  56. }
  57. },
  58. mounted() {
  59. if (!this.isInit && this.i === 0) {
  60. this.mescroll.resetUpScroll()
  61. }
  62. },
  63. methods: {
  64. /**
  65. * 通过审核
  66. */
  67. pass(item) {
  68. let params = {
  69. id: item.id,
  70. auditStatus: 1
  71. }
  72. this.$dialog.showModal('确定审核通过该记录?').then(() => {
  73. this.$http.guestRecordsSubmit(params).then(res => {
  74. this.fetchAuthRecordNum()
  75. this.mescroll.resetUpScroll()
  76. })
  77. })
  78. },
  79. fetchAuthRecordNum() {
  80. },
  81. /**
  82. * 审核不通过
  83. * @param {Object} item
  84. */
  85. fail(item) {
  86. let params = {
  87. id: item.id,
  88. auditStatus: 2
  89. }
  90. this.$dialog.showModal('确定审核不通过该记录?').then(() => {
  91. this.$http.guestRecordsSubmit(params).then(res => {
  92. this.fetchAuthRecordNum()
  93. this.mescroll.resetUpScroll()
  94. })
  95. })
  96. },
  97. fetchAuthRecordNum() {
  98. let memberId = this.vuex_member.id
  99. let residentialId = uni.getStorageSync("residentialId");
  100. if (!this.$isEmpty(memberId)) {
  101. let params = {
  102. userId: memberId,
  103. residentialId: uni.getStorageSync("residentialId"),
  104. size: 99,
  105. auditStatus: 0
  106. }
  107. this.$http.guestRecordsCount(params).then(res => {
  108. this.$u.vuex('vuex_auth_audit_count', res.data.data)
  109. })
  110. }
  111. },
  112. /**
  113. * @param {Object} mescroll 初始化组件
  114. */
  115. initMeScroll(mescroll) {
  116. this.mescroll = mescroll
  117. },
  118. /**
  119. * @param {Object} mescroll 上拉回调
  120. */
  121. upFn(mescroll) {
  122. try {
  123. let params = {
  124. userId: this.memberId,
  125. residentialId: uni.getStorageSync("residentialId"),
  126. query: {
  127. current: mescroll.num,
  128. size: mescroll.size,
  129. }
  130. }
  131. if (this.item.value != -1) {
  132. params.auditStatus = this.item.value
  133. }
  134. if (!this.$isEmpty(this.params.id)) {
  135. params.id = this.params.id
  136. }
  137. if (!this.$isEmpty(this.params.guestName)) {
  138. params.guestName = this.params.guestName
  139. }
  140. if (!this.$isEmpty(this.params.guestTel)) {
  141. params.guestTel = this.params.guestTel
  142. }
  143. this.$http.guestRecordsPage(params).then(res => {
  144. let data = res.data.data
  145. let records = data.records
  146. let total = data.total
  147. mescroll.endBySize(records.length, total)
  148. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  149. this.list = this.list.concat(records); //追加新数据
  150. })
  151. } catch (e) {
  152. mescroll.endErr();
  153. }
  154. },
  155. /**
  156. * 下拉回调
  157. * */
  158. downFn(mescroll) {
  159. setTimeout(() => {
  160. this.mescroll.resetUpScroll()
  161. uni.showToast({
  162. title: "刷新成功",
  163. icon: "none",
  164. position: "top"
  165. })
  166. }, 1500)
  167. },
  168. }
  169. }
  170. </script>
  171. <style lang="scss" scoped>
  172. view {
  173. box-sizing: border-box;
  174. }
  175. </style>