personnel.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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 flex align_center justify_center">
  37. <u-button @click="editIsManage()" v-if="userInfo&&userInfo.superAdmin==1" :throttle-time="100" shape="circle" type="error" plain>
  38. 更换负责人
  39. </u-button>
  40. <u-button @click="editPerson(null)" :throttle-time="100" :custom-style="{ background: '#066cff', color: '#fff' }" shape="circle" type="info">
  41. 新增员工
  42. </u-button>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. import {searchEmployee, delEmployee } from '@/api/employee'
  48. import moment from 'moment'
  49. export default{
  50. name:'personnel',
  51. data(){
  52. return{
  53. status: 'loading',
  54. noDataText: '暂无数据',
  55. current: 0,
  56. swiperCurrent: 0,
  57. // 查询条件
  58. pageNo: 1,
  59. pageSize: 20,
  60. list: [],
  61. total: 0,
  62. }
  63. },
  64. onShow() {
  65. this.getRow(1)
  66. },
  67. computed:{
  68. userInfo(){
  69. return this.$store.state.vuex_userInfo
  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. editIsManage(){
  119. uni.navigateTo({
  120. url: "/pages/storeManage/editIsManage"
  121. })
  122. }
  123. }
  124. }
  125. </script>
  126. <style lang="less">
  127. .page-body{
  128. height: 100vh;
  129. padding:0;
  130. .scroll-list{
  131. flex-grow: 1;
  132. .check-order-list{
  133. background: #ffffff;
  134. padding: 10upx 20upx;
  135. margin: 0 25rpx 25rpx 25rpx;
  136. border-radius: 20upx;
  137. box-shadow: 1px 1px 3px #EEEEEE;
  138. > view{
  139. padding: 0.8rem 0.5rem;
  140. .u-name{
  141. font-size: 32rpx;
  142. margin-bottom: 0.5rem;
  143. }
  144. .u-mobile{
  145. color: #666;
  146. }
  147. }
  148. }
  149. }
  150. .footer{
  151. padding: 0.6rem;
  152. background: #ffffff;
  153. u-button{
  154. width: 45%;
  155. margin: 0 2%;
  156. }
  157. }
  158. }
  159. </style>