visitor.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view class="yybox">
  3. <!-- <nav-bar navtit="预约信息" ></nav-bar> -->
  4. <!-- 主体 -->
  5. <view class="yydet">
  6. <view class="yytab flexc">
  7. <view :class="ite.val==tabval?'act':''" v-for="(ite,idx) in tablist" :key='idx' @click="getTab(ite.val)">{{ite.tit}}</view>
  8. </view>
  9. <!-- 列表 -->
  10. <scroll-view scroll-y class="yylists" lower-threshold="40" @scrolltolower="reach_btn">
  11. <view class="mt12">
  12. <y-list type='visitor' :datalist="list" :wtdt="wtdt" :fklist="fklist" @getDetail='getDetail' :adrlist="adrlist" @getDelFn="getDelFn"></y-list>
  13. </view>
  14. </scroll-view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  20. import yList from "@/work/components/yuyue/list.vue"
  21. import navBar from "@/components/toptab/navbar.vue"
  22. import {getRecordList,getRecordDel} from "@/api/mine/work.js"
  23. import {getDictionaryFn} from "@/api/mine/register.js"
  24. export default {
  25. components:{yList,navBar},
  26. data(){
  27. return{
  28. navbg:require("@/static/images/navbg.png"),
  29. headimg:require("@/static/images/order/staff/head.png"),
  30. listline:require("@/static/images/order/staff/listline.png"),
  31. backgroundColor: "transparent",
  32. tabval:'-1',
  33. tablist:[{tit:"全部",val:'-1'},],
  34. list:[],
  35. adrlist:[],
  36. fklist:[],
  37. wtdt:'',
  38. pageSize: 10,
  39. pageNum: 1,
  40. reachflag: true,
  41. }
  42. },
  43. onPageScroll(e) {
  44. var scrollTop = Number(e.scrollTop);
  45. if (scrollTop > 0) {
  46. this.backgroundColor = '#0491FD'
  47. } else {
  48. this.backgroundColor = 'transparent'
  49. }
  50. },
  51. onLoad: function() {
  52. // uni.$on('refreshdatalist',(e) => {
  53. // this.reachflag=true;
  54. // this.pageNum=1;
  55. // this.list=[];
  56. // this.getDataFn();
  57. // })
  58. this.init()
  59. this.getDataFn()
  60. },
  61. onUnload() {
  62. uni.$off('refreshdatalist')
  63. },
  64. methods:{
  65. checkPermi, checkRole,
  66. reach_btn(){
  67. if (this.reachflag) {
  68. this.pageNum++
  69. this.getDataFn()
  70. }
  71. },
  72. getTab(val){
  73. this.tabval=val;
  74. this.reachflag=true;
  75. this.pageNum=1;
  76. this.list=[];
  77. this.getDataFn();
  78. },
  79. init(){
  80. // 记录来源
  81. getDictionaryFn('jluly').then(res=>{
  82. if(res.code==200){
  83. this.adrlist=res.data.map(v => {
  84. var obj={
  85. tit: v.dictLabel,
  86. val: v.dictValue
  87. }
  88. this.tablist.push(obj)
  89. return {
  90. dictLabel: v.dictLabel,
  91. dictValue: v.dictValue
  92. }
  93. })
  94. }
  95. })
  96. // 人员类型
  97. getDictionaryFn('fange').then(res=>{
  98. if(res.code==200){
  99. this.fklist=res.data.map(v => {
  100. return {
  101. dictLabel: v.dictLabel,
  102. dictValue: v.dictValue
  103. }
  104. })
  105. }
  106. })
  107. },
  108. getDelFn(id){
  109. var that=this;
  110. getRecordDel(id).then(res=>{
  111. if(res.code==200){
  112. that.$toast('删除成功')
  113. setTimeout(function(){
  114. that.reachflag=true;
  115. that.pageNum=1;
  116. that.list=[];
  117. that.getDataFn();
  118. // that.getcount();
  119. },1500)
  120. }else{
  121. that.$toast(res.msg)
  122. }
  123. })
  124. },
  125. getDetail(data){
  126. // this.$tab.navigateTo('/pages/order/staffcode?type=look&id='+data)
  127. },
  128. getDataFn(){
  129. var params={
  130. pageSize:this.pageSize,
  131. pageNum: this.pageNum,
  132. }
  133. if(this.tabval=='-1'){
  134. }else{
  135. params.recordSource=this.tabval
  136. }
  137. getRecordList(params).then(res=>{
  138. if(res.code==200){
  139. if (res.rows.length < this.pageSize) {
  140. this.reachflag = false
  141. this.wtdt = '到底了~';
  142. } else {
  143. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  144. if (num < res.total) {
  145. this.reachflag = true
  146. this.wtdt = '上拉加载更多'
  147. } else {
  148. this.reachflag = false
  149. this.wtdt = '到底了~';
  150. }
  151. }
  152. if (this.pageNum == 1) {
  153. this.list = res.rows;
  154. } else {
  155. this.list = this.list.concat(res.rows)
  156. }
  157. }else{
  158. this.$toast(res.msg)
  159. }
  160. })
  161. },
  162. },
  163. }
  164. </script>
  165. <style lang="scss" scoped>
  166. .yytab{height: 80rpx;flex: 0 0 auto;background-color: #ffffff;
  167. view{flex: 1;display: flex;align-items: center;justify-content: center;height: 80rpx;position: relative;color: #666;
  168. &.act{color: $com-cd3;
  169. &::after{content: '';width: 100rpx;height: 6rpx;background: $com-cd3;position: absolute;left: 50%;margin-left: -50rpx;bottom: 0;}
  170. }
  171. }
  172. }
  173. .yylists{width: 684rpx;margin: 0 auto 0;flex: 1;overflow: auto;}
  174. </style>