editIsManage.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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 class="check-order-list">
  8. <u-radio-group wrap @change="radioGroupChange">
  9. <u-radio
  10. v-model="item.checked"
  11. v-for="(item, index) in list" :key="item.userId"
  12. :name="item.userId"
  13. v-if="item.isManager == 0"
  14. >
  15. <view class="u-name">
  16. {{item.name}}/{{item.mobile}}
  17. </view>
  18. </u-radio>
  19. </u-radio-group>
  20. </view>
  21. <view style="padding:0 30upx 30upx;">
  22. <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>
  23. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  24. </view>
  25. </scroll-view>
  26. </swiper-item>
  27. </swiper>
  28. <view class="footer flex align_center justify_center">
  29. <u-button @click="setNewAdmin()" :throttle-time="100" :custom-style="{ background: '#066cff', color: '#fff' }" shape="circle" type="info">
  30. 设为新负责人
  31. </u-button>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import {searchEmployee} from '@/api/employee'
  37. import moment from 'moment'
  38. export default{
  39. name:'personnel',
  40. data(){
  41. return{
  42. status: 'loading',
  43. noDataText: '暂无数据',
  44. current: 0,
  45. swiperCurrent: 0,
  46. // 查询条件
  47. pageNo: 1,
  48. pageSize: 20,
  49. list: [],
  50. total: 0,
  51. curPerson: null
  52. }
  53. },
  54. onShow() {
  55. this.getRow(1)
  56. },
  57. computed:{
  58. userInfo(){
  59. return this.$store.state.vuex_userInfo
  60. },
  61. },
  62. methods:{
  63. radioGroupChange(e){
  64. console.log(e)
  65. this.curPerson = e
  66. },
  67. // 查询列表
  68. getRow (pageNo) {
  69. let _this = this
  70. if (pageNo) {
  71. this.pageNo = pageNo
  72. }
  73. let params = {
  74. pageNo:this.pageNo,
  75. pageSize:this.pageSize
  76. }
  77. this.status = "loading"
  78. searchEmployee(params).then(res => {
  79. if (res.code == 200 || res.status == 204 || res.status == 200) {
  80. if(_this.pageNo>1){
  81. _this.list = _this.list.concat(res.data.list || [])
  82. }else{
  83. _this.list = res.data.list || []
  84. }
  85. _this.total = res.data.count || 0
  86. } else {
  87. _this.list = []
  88. _this.total = 0
  89. _this.noDataText = res.message
  90. }
  91. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  92. })
  93. },
  94. // scroll-view到底部加载更多
  95. onreachBottom() {
  96. console.log(this.list.length, this.total)
  97. if(this.list.length < this.total){
  98. this.pageNo += 1
  99. this.getRow()
  100. }else{
  101. this.status = "nomore"
  102. }
  103. },
  104. // 设为负责人
  105. setNewAdmin(){
  106. console.log(this.curPerson)
  107. if(!!this.curPerson){
  108. const row = this.list.find(item => item.userId == this.curPerson )
  109. this.$store.state.vuex_nowStaffData = row
  110. uni.redirectTo({
  111. url: "/pages/storeManage/editAdminAuth"
  112. })
  113. }else{
  114. uni.showToast({
  115. title: "请选择员工"
  116. })
  117. }
  118. },
  119. }
  120. }
  121. </script>
  122. <style lang="less">
  123. .page-body{
  124. height: 100vh;
  125. padding:0;
  126. .scroll-list{
  127. flex-grow: 1;
  128. .check-order-list{
  129. padding: 10upx 20upx;
  130. u-radio{
  131. > view{
  132. background: #ffffff;
  133. border-radius: 20upx;
  134. box-shadow: 1px 1px 3px #EEEEEE;
  135. margin: 10rpx 0;
  136. padding: 20rpx;
  137. >view:last-child{
  138. flex-grow: 1;
  139. }
  140. }
  141. }
  142. }
  143. }
  144. .footer{
  145. padding: 0.6rem;
  146. background: #ffffff;
  147. u-button{
  148. width: 45%;
  149. margin: 0 2%;
  150. }
  151. }
  152. }
  153. </style>