personnel.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="page-body flex flex_column">
  3. <swiper class="scroll-list" :current="swiperCurrent">
  4. <swiper-item class="swiper-item" style="height: 100%;width: 100%;overflow: hidden;">
  5. <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
  6. <view style="height: 20rpx;" ></view>
  7. <view
  8. class="check-order-list"
  9. v-for="(item,index) in list"
  10. :key="item.id"
  11. >
  12. <view class="flex align_center justify_between">
  13. <view class="flex_1">
  14. <view class="u-name">
  15. <text style="margin-right: 0.5rem;">{{item.name}}</text>
  16. <u-icon :name="item.sex==1?'man':'woman'" size="28" :color="item.sex==1?'#00aaff':'#ffaaaa'"></u-icon>
  17. </view>
  18. <view class="u-mobile">
  19. <text v-if="item.isManager == 1">门店负责人 / </text>
  20. <text v-else>{{item.roleNames}} / </text>
  21. {{item.mobile}}
  22. </view>
  23. </view>
  24. <view @click="editPerson(item)">
  25. <u-icon size="34" name="edit-pen"></u-icon>
  26. </view>
  27. </view>
  28. </view>
  29. <view style="padding:0 30upx 30upx;">
  30. <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  31. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  32. </view>
  33. </scroll-view>
  34. </swiper-item>
  35. </swiper>
  36. <view class="footer">
  37. <u-button @click="editPerson(null)" :throttle-time="100" :custom-style="{ background: '#066cff', color: '#fff',width:'400rpx' }" shape="circle" type="info">
  38. 新增员工
  39. </u-button>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import {searchEmployee, delEmployee } from '@/api/employee'
  45. import moment from 'moment'
  46. export default{
  47. name:'personnel',
  48. data(){
  49. return{
  50. status: 'loading',
  51. noDataText: '暂无数据',
  52. current: 0,
  53. swiperCurrent: 0,
  54. // 查询条件
  55. pageNo: 1,
  56. pageSize: 20,
  57. list: [],
  58. total: 0,
  59. }
  60. },
  61. onShow() {
  62. this.getRow(1)
  63. },
  64. // 判断员工身份权限
  65. filters:{
  66. isManagerFilter(isManagerFilterVal){
  67. if(isManagerFilterVal == 1){
  68. return '负责人'
  69. }
  70. }
  71. },
  72. methods:{
  73. // 查询列表
  74. getRow (pageNo) {
  75. let _this = this
  76. if (pageNo) {
  77. this.pageNo = pageNo
  78. }
  79. let params = {
  80. pageNo:this.pageNo,
  81. pageSize:this.pageSize
  82. }
  83. this.status = "loading"
  84. searchEmployee(params).then(res => {
  85. if (res.code == 200 || res.status == 204 || res.status == 200) {
  86. if(_this.pageNo>1){
  87. _this.list = _this.list.concat(res.data.list || [])
  88. }else{
  89. _this.list = res.data.list || []
  90. }
  91. _this.total = res.data.count || 0
  92. } else {
  93. _this.list = []
  94. _this.total = 0
  95. _this.noDataText = res.message
  96. }
  97. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  98. })
  99. },
  100. // scroll-view到底部加载更多
  101. onreachBottom() {
  102. console.log(this.list.length, this.total)
  103. if(this.list.length < this.total){
  104. this.pageNo += 1
  105. this.getRow()
  106. }else{
  107. this.status = "nomore"
  108. }
  109. },
  110. // 编辑员工
  111. editPerson(row){
  112. this.$store.state.vuex_nowStaffData = row;
  113. uni.navigateTo({
  114. url: "/pages/storeManage/addPerson"
  115. })
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="less">
  121. .page-body{
  122. height: 100vh;
  123. padding:0;
  124. .scroll-list{
  125. flex-grow: 1;
  126. .check-order-list{
  127. background: #ffffff;
  128. padding: 10upx 20upx;
  129. margin: 0 25rpx 25rpx 25rpx;
  130. border-radius: 20upx;
  131. box-shadow: 1px 1px 3px #EEEEEE;
  132. > view{
  133. padding: 0.8rem 0.5rem;
  134. .u-name{
  135. font-size: 32rpx;
  136. margin-bottom: 0.5rem;
  137. }
  138. .u-mobile{
  139. color: #666;
  140. }
  141. }
  142. }
  143. }
  144. .footer{
  145. padding: 0.6rem;
  146. background: #ffffff;
  147. }
  148. }
  149. </style>