item.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. if (!this.$isEmpty(memberId)) {
  70. let params={
  71. member_id:memberId,
  72. size:99,
  73. auditStatus:0
  74. }
  75. let operation='guestRecord/getListByMemberId'
  76. getApp().globalData.postRequest(params,operation,function(res){
  77. let length=res.data.list.length
  78. that.$u.vuex('vuex_auth_audit_count',length)
  79. })
  80. }
  81. },
  82. /**
  83. * 显示详情
  84. * @param {Object} item
  85. */
  86. showDetail(item){
  87. this.$emit('showDetail',item)
  88. },
  89. /**
  90. * 通过审核
  91. */
  92. pass(item){
  93. let that=this
  94. let {rootOrgId,orgPosition,orgId,...params}=item
  95. params.auditStatus=1
  96. let operation="guestRecord/updateGuestRecord"
  97. uni.showModal({
  98. title:"提示",
  99. content:"确定审核通过该访客信息吗?",
  100. showCancel:true,
  101. success: (res) => {
  102. if (res.confirm) {
  103. getApp().globalData.postRequest(params,operation,function(res){
  104. that.fetchAuthRecordNum()
  105. that.mescroll.resetUpScroll()
  106. })
  107. }
  108. }
  109. })
  110. },
  111. /**
  112. * 审核不通过
  113. * @param {Object} item
  114. */
  115. fail(item){
  116. let that=this
  117. let {rootOrgId,orgPosition,orgId,...params}=item
  118. params.auditStatus=2
  119. let operation="guestRecord/updateGuestRecord"
  120. uni.showModal({
  121. title:"提示",
  122. content:"确定审核不通过该访客信息吗?",
  123. showCancel:true,
  124. success: (res) => {
  125. if (res.confirm) {
  126. getApp().globalData.postRequest(params,operation,function(res){
  127. that.fetchAuthRecordNum()
  128. that.mescroll.resetUpScroll()
  129. })
  130. }
  131. }
  132. })
  133. },
  134. /**
  135. * @param {Object} mescroll 初始化组件
  136. */
  137. initMeScroll(mescroll) {
  138. this.mescroll = mescroll
  139. },
  140. /**
  141. * @param {Object} mescroll 上拉回调
  142. */
  143. upFn(mescroll) {
  144. try{
  145. let that=this
  146. let params={
  147. member_id:that.memberId,
  148. current:mescroll.num,
  149. size:mescroll.size,
  150. }
  151. if (this.item.value!=-1) {
  152. params.auditStatus=this.item.value
  153. }
  154. if (!this.$isEmpty(this.params.id)) {
  155. params.id=this.params.id
  156. }
  157. if (!this.$isEmpty(this.params.guestName)) {
  158. params.guestName=this.params.guestName
  159. }
  160. if (!this.$isEmpty(this.params.guestTel)) {
  161. params.guestTel=this.params.guestTel
  162. }
  163. let operation='guestRecord/getListByMemberId'
  164. getApp().globalData.postRequest(params,operation,function(res){
  165. let data=res.data.list
  166. let length=data.length
  167. let total=res.data.total
  168. mescroll.endBySize(length, total);
  169. if(mescroll.num == 1) that.list = []; //如果是第一页需手动制空列表
  170. that.list=that.list.concat(data); //追加新数据
  171. })
  172. }catch(e){
  173. mescroll.endErr();
  174. }
  175. },
  176. /**
  177. * 下拉回调
  178. * */
  179. downFn(mescroll) {
  180. setTimeout(()=>{
  181. this.mescroll.resetUpScroll()
  182. uni.showToast({
  183. title:"刷新成功",
  184. icon:"none",
  185. position:"top"
  186. })
  187. },1500)
  188. },
  189. }
  190. }
  191. </script>
  192. <style lang="scss" scoped>
  193. view{
  194. box-sizing: border-box;
  195. }
  196. </style>