item.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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: true,
  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. methods: {
  51. showDetail(item){
  52. this.$emit('test',item)
  53. },
  54. /**
  55. * 通过审核
  56. */
  57. pass(item){
  58. let that=this
  59. let {rootOrgId,orgPosition,orgId,...params}=item
  60. params.auditStatus=1
  61. let operation="guestRecord/updateGuestRecord"
  62. uni.showModal({
  63. title:"提示",
  64. content:"确定审核通过该访客信息吗?",
  65. showCancel:true,
  66. success: (res) => {
  67. if (res.confirm) {
  68. getApp().globalData.postRequest(params,operation,function(res){
  69. console.log(res);
  70. that.mescroll.resetUpScroll()
  71. })
  72. }
  73. }
  74. })
  75. },
  76. /**
  77. * 审核不通过
  78. * @param {Object}
  79. */
  80. submitFailAudit(){
  81. let that=this
  82. let {rootOrgId,orgPosition,orgId,...params}=item
  83. params.auditStatus=2
  84. let operation="guestRecord/updateGuestRecord"
  85. uni.showModal({
  86. title:"提示",
  87. content:"确定审核不通过该访客信息吗?",
  88. showCancel:true,
  89. success: (res) => {
  90. if (res.confirm) {
  91. getApp().globalData.postRequest(params,operation,function(res){
  92. console.log(res);
  93. that.mescroll.resetUpScroll()
  94. })
  95. }
  96. }
  97. })
  98. },
  99. /**
  100. * 显示审核不通过的意见框
  101. * @param {Object} item
  102. */
  103. fail(item){
  104. this.dataDetail=item
  105. this.modelShow=true
  106. },
  107. /**
  108. * @param {Object} mescroll 初始化组件
  109. */
  110. initMeScroll(mescroll) {
  111. this.mescroll = mescroll
  112. },
  113. /**
  114. * @param {Object} mescroll 上拉回调
  115. */
  116. upFn(mescroll) {
  117. try{
  118. let that=this
  119. let params={
  120. member_id:that.memberId,
  121. current:mescroll.num,
  122. size:mescroll.size,
  123. }
  124. if (this.item.value!=-1) {
  125. params.auditStatus=this.item.value
  126. }
  127. if (!this.$isEmpty(this.params.id)) {
  128. params.id=this.params.id
  129. }
  130. if (!this.$isEmpty(this.params.guestName)) {
  131. params.guestName=this.params.guestName
  132. }
  133. if (!this.$isEmpty(this.params.guestTel)) {
  134. params.guestTel=this.params.guestTel
  135. }
  136. let operation='guestRecord/getListByMemberId'
  137. getApp().globalData.postRequest(params,operation,function(res){
  138. let data=res.data.list
  139. let length=data.length
  140. let total=res.data.total
  141. mescroll.endBySize(length, total);
  142. if(mescroll.num == 1) that.list = []; //如果是第一页需手动制空列表
  143. that.list=that.list.concat(data); //追加新数据
  144. })
  145. }catch(e){
  146. mescroll.endErr();
  147. }
  148. },
  149. /**
  150. * 下拉回调
  151. * */
  152. downFn(mescroll) {
  153. setTimeout(()=>{
  154. this.mescroll.resetUpScroll()
  155. uni.showToast({
  156. title:"刷新成功",
  157. icon:"none",
  158. position:"top"
  159. })
  160. },1500)
  161. },
  162. }
  163. }
  164. </script>
  165. <style lang="scss" scoped>
  166. view{
  167. box-sizing: border-box;
  168. }
  169. </style>