personnel.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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" @click="editPerson(item)">
  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-if="item.isManager == 0 && item.roleNames">{{item.roleNames}} / </text>
  21. {{item.mobile}}
  22. </view>
  23. </view>
  24. <view>
  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. methods:{
  65. // 查询列表
  66. getRow (pageNo) {
  67. let _this = this
  68. if (pageNo) {
  69. this.pageNo = pageNo
  70. }
  71. let params = {
  72. pageNo:this.pageNo,
  73. pageSize:this.pageSize
  74. }
  75. this.status = "loading"
  76. searchEmployee(params).then(res => {
  77. if (res.code == 200 || res.status == 204 || res.status == 200) {
  78. if(_this.pageNo>1){
  79. _this.list = _this.list.concat(res.data.list || [])
  80. }else{
  81. _this.list = res.data.list || []
  82. }
  83. _this.total = res.data.count || 0
  84. } else {
  85. _this.list = []
  86. _this.total = 0
  87. _this.noDataText = res.message
  88. }
  89. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  90. })
  91. },
  92. // scroll-view到底部加载更多
  93. onreachBottom() {
  94. console.log(this.list.length, this.total)
  95. if(this.list.length < this.total){
  96. this.pageNo += 1
  97. this.getRow()
  98. }else{
  99. this.status = "nomore"
  100. }
  101. },
  102. // 编辑员工
  103. editPerson(row){
  104. this.$store.state.vuex_nowStaffData = row;
  105. uni.navigateTo({
  106. url: "/pages/storeManage/addPerson"
  107. })
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="less">
  113. .page-body{
  114. height: 100vh;
  115. padding:0;
  116. .scroll-list{
  117. flex-grow: 1;
  118. .check-order-list{
  119. background: #ffffff;
  120. padding: 10upx 20upx;
  121. margin: 0 25rpx 25rpx 25rpx;
  122. border-radius: 20upx;
  123. box-shadow: 1px 1px 3px #EEEEEE;
  124. > view{
  125. padding: 0.8rem 0.5rem;
  126. .u-name{
  127. font-size: 32rpx;
  128. margin-bottom: 0.5rem;
  129. }
  130. .u-mobile{
  131. color: #666;
  132. }
  133. }
  134. }
  135. }
  136. .footer{
  137. padding: 0.6rem;
  138. background: #ffffff;
  139. }
  140. }
  141. </style>