list.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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='1' :datalist="list" :wtdt="wtdt" @getDetail='getDetail' :adrlist="adrlist" @getDelFn="getDelFn" @gettypeFn="gettypeFn"></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 "@/components/order/list.vue"
  21. import navBar from "@/components/toptab/navbar.vue"
  22. import {getReservatList,getReservatDel,getReservatSh} from "@/api/mine/order.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:'0',
  33. tablist:[{tit:"全部",val:0},{tit:"未审核",val:1},{tit:"已拒绝",val:2},{tit:"已审核",val:3},],
  34. list:[],
  35. adrlist:[],
  36. wtdt:'',
  37. pageSize: 10,
  38. pageNum: 1,
  39. reachflag: true,
  40. }
  41. },
  42. onPageScroll(e) {
  43. var scrollTop = Number(e.scrollTop);
  44. if (scrollTop > 0) {
  45. this.backgroundColor = '#0491FD'
  46. } else {
  47. this.backgroundColor = 'transparent'
  48. }
  49. },
  50. onLoad: function() {
  51. uni.$on('refreshdatalist',(e) => {
  52. this.reachflag=true;
  53. this.pageNum=1;
  54. this.list=[];
  55. this.getDataFn();
  56. })
  57. this.init()
  58. this.getDataFn()
  59. },
  60. onUnload() {
  61. uni.$off('refreshdatalist')
  62. },
  63. methods:{
  64. checkPermi, checkRole,
  65. reach_btn(){
  66. if (this.reachflag) {
  67. this.pageNum++
  68. this.getDataFn()
  69. }
  70. },
  71. getTab(val){
  72. this.tabval=val;
  73. this.reachflag=true;
  74. this.pageNum=1;
  75. this.list=[];
  76. this.getDataFn();
  77. },
  78. init(){
  79. // 记录来源
  80. getDictionaryFn('jluly').then(res=>{
  81. if(res.code==200){
  82. this.adrlist = res.data.map(v => {
  83. return {
  84. dictLabel: v.dictLabel,
  85. dictValue: Number(v.dictValue)
  86. }
  87. })
  88. }
  89. })
  90. },
  91. getDelFn(id){
  92. var that=this;
  93. getReservatDel(id).then(res=>{
  94. if(res.code==200){
  95. that.$toast('删除成功')
  96. setTimeout(function(){
  97. that.reachflag=true;
  98. that.pageNum=1;
  99. that.list=[];
  100. that.getDataFn();
  101. // that.getcount();
  102. },1500)
  103. }else{
  104. that.$toast(res.msg)
  105. }
  106. })
  107. },
  108. gettypeFn(ite){
  109. var that=this;
  110. var params={
  111. reservatId:ite.id,
  112. visitType:ite.type
  113. }
  114. getReservatSh(params).then(res=>{
  115. if(res.code==200){
  116. that.$toast('审核成功')
  117. setTimeout(function(){
  118. that.reachflag=true;
  119. that.pageNum=1;
  120. that.list=[];
  121. that.getDataFn();
  122. // that.getcount();
  123. },1500)
  124. }else{
  125. that.$toast(res.msg)
  126. }
  127. })
  128. },
  129. getDetail(data){
  130. this.$tab.navigateTo('/pages/order/staffcode?type=look&id='+data)
  131. },
  132. getDataFn(){
  133. var params={
  134. pageSize:this.pageSize,
  135. pageNum: this.pageNum,
  136. }
  137. if(this.tabval==0){
  138. }else{
  139. params.visitType=this.tabval
  140. }
  141. getReservatList(params).then(res=>{
  142. if(res.code==200){
  143. if (res.rows.length < this.pageSize) {
  144. this.reachflag = false
  145. this.wtdt = '到底了~';
  146. } else {
  147. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  148. if (num < res.total) {
  149. this.reachflag = true
  150. this.wtdt = '上拉加载更多'
  151. } else {
  152. this.reachflag = false
  153. this.wtdt = '到底了~';
  154. }
  155. }
  156. if (this.pageNum == 1) {
  157. this.list = res.rows;
  158. } else {
  159. this.list = this.list.concat(res.rows)
  160. }
  161. }else{
  162. this.$toast(res.msg)
  163. }
  164. })
  165. },
  166. },
  167. }
  168. </script>
  169. <style lang="scss" scoped>
  170. .yytab{height: 80rpx;flex: 0 0 auto;background-color: #ffffff;
  171. view{flex: 1;display: flex;align-items: center;justify-content: center;height: 80rpx;position: relative;color: #666;
  172. &.act{color: $com-cd3;
  173. &::after{content: '';width: 100rpx;height: 6rpx;background: $com-cd3;position: absolute;left: 50%;margin-left: -50rpx;bottom: 0;}
  174. }
  175. }
  176. }
  177. .yylists{width: 684rpx;margin: 0 auto 0;flex: 1;overflow: auto;}
  178. </style>