StaffList.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. <template>
  2. <div class="seek">
  3. <div class="com-mobile-header mobile-center-header">
  4. <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
  5. <p>员工管理</p>
  6. <p class="en-name"><img :src="`/images/mobile/center/${user.data.enterprise.uu ? 'en' : 'self'}.png`" alt="">{{currentEnName}}</p>
  7. </div>
  8. <div class="mobile-fix-content mobile-centerfix-content" id="mobile-staff-center">
  9. <div class="staff-head">
  10. <span class="inline-block" :class="{'active': switchType === 'info'}" @click="setSwitchType('info')">员工信息</span>
  11. <span v-show="isAdmin" class="inline-block" :class="{'active': switchType === 'Audit'}" @click="setSwitchType('Audit')">审核绑定</span>
  12. </div>
  13. <div class="staff-record" v-if="switchType === 'info'">
  14. <div class="search-content clearfix">
  15. <div class="search">
  16. <!--<input type="text" placeholder="卖家名称/订单号" v-model="filterParams.keyword" @keyup.13="filterRecord">-->
  17. <input type="text" placeholder="人员姓名、电话号码、邮箱或UU" class="staff-search">
  18. <!--<span @click="filterRecord"><i class="iconfont icon-sousuo"></i></span>-->
  19. <span><i class="iconfont icon-sousuo"></i></span>
  20. </div>
  21. <div class="search-filter">
  22. <div class="select-wrap">全部角色<i class="iconfont icon-arrow-down"></i></div>
  23. <ul class="select-list" v-if="false">
  24. <li>全部角色</li>
  25. <li>管理员</li>
  26. <li>店长</li>
  27. <li>普通用户</li>
  28. <li>销售员</li>
  29. <li>任意测试</li>
  30. </ul>
  31. </div>
  32. </div>
  33. <div class="list-content">
  34. <div class="bg" v-for="item in staffDataList">
  35. <div class="staff-list">
  36. <div class="list-item"><span>UU账号:</span><span v-text="item.userUU">100000721</span></div>
  37. <div class="list-item"><span>姓名:</span><span v-text="item.userName">张洪别</span></div>
  38. <div class="list-item"><span>性别:</span><span v-text="item.userSex === 'F' ? '女' : item.userSex === 'M' ? '男' : '-'">男</span></div>
  39. <div class="list-item"><span>手机号:</span><span v-text="item.userTel">12345678901</span></div>
  40. <div class="list-item"><span>邮箱:</span><span v-text="item.userEmail">12345678901</span></div>
  41. <div class="list-item"><span>角色:</span><span class="role" v-for="role in item.roles" v-text="role.desc ? role.desc.slice(0,2) : ''" v-bind:class="'bg' + role.color">普通</span></div>
  42. </div>
  43. <div class="list-footer">
  44. <div @click="goEdit(item)" class="edit handle" v-bind:class="{'no-allow': (item.userUU === userInfo.userUU)}"><i class="iconfont icon-edit"></i><span>编辑</span></div>
  45. <div @click="openDelete(item)" class="delete handle" v-bind:class="{'no-allow': (item.userUU === userInfo.userUU)}"><i class="iconfont icon-lajitong"></i><span>删除</span></div>
  46. </div>
  47. </div>
  48. </div>
  49. <nuxt-link class="staff-add" :to="'/mobile/user/staff/add'"><i class="iconfont icon-add"></i>新增用户</nuxt-link>
  50. </div>
  51. <div class="staff-record" v-if="switchType === 'Audit'">
  52. <div class="search-content">
  53. <!--<input type="text" placeholder="卖家名称/订单号" v-model="filterParams.keyword" @keyup.13="filterRecord">-->
  54. <input type="text" placeholder="人员姓名、电话号码、邮箱或UU" v-model="auditSearch">
  55. <!--<span @click="filterRecord"><i class="iconfont icon-sousuo"></i></span>-->
  56. <span><i class="iconfont icon-sousuo"></i></span>
  57. </div>
  58. <div class="list-content">
  59. <div class="bg">
  60. <div class="staff-list">
  61. <div class="list-item"><span>用户名:</span><span>{item}</span></div>
  62. <div class="list-item"><span>UU账号:</span><span>100000721</span></div>
  63. <div class="list-item"><span>手机号:</span><span>12345678901</span></div>
  64. <div class="list-item"><span>邮箱:</span><span>12345678901</span></div>
  65. </div>
  66. <div class="list-footer">
  67. <div class="edit handle"><i class="iconfont icon-check-circle"></i><span>同意</span></div>
  68. <div class="handle delete"><i class="iconfont icon-close-circle"></i><span>拒绝</span></div>
  69. </div>
  70. </div>
  71. </div>
  72. <empty-status :type="'collect'" :showLink="true" :text="'抱歉,没有相关信息'"></empty-status>
  73. </div>
  74. <pull-up :fixId="'mobile-staff-center'" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
  75. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  76. </div>
  77. <!--删除员工-->
  78. <div class="deleteKuang" v-if="showDelete">
  79. <div class="kuangContent">
  80. <div class="title">温馨提示</div>
  81. <div class="titleinfo">确定删除该用户吗?</div>
  82. <div class="K_btn">
  83. <div class="cancelBtn" @click="showDelete = false">取消</div>
  84. <div class="answerBtn" @click="sureDelete()">确定</div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. </template>
  90. <script>
  91. import { RemindBox, PullUp, EmptyStatus } from '~components/mobile/common'
  92. import { BaseFilter } from '~components/mobile/base'
  93. export default {
  94. layout: 'mobile',
  95. data () {
  96. return {
  97. remindText: '',
  98. timeoutCount: 0,
  99. page: 1,
  100. count: 10,
  101. staffDataList: [],
  102. auditSearch: '',
  103. switchType: 'info',
  104. showDelete: false,
  105. currentObject: ''
  106. }
  107. },
  108. components: {
  109. RemindBox,
  110. PullUp,
  111. EmptyStatus,
  112. BaseFilter
  113. },
  114. watch: {
  115. 'staffData': {
  116. handler: function (val) {
  117. if (this.isChange) {
  118. this.staffDataList = val.content
  119. this.isChange = false
  120. } else {
  121. this.staffDataList = [...this.staffDataList, ...val.content]
  122. }
  123. console.log(this.staffDataList, '1213')
  124. },
  125. immediate: true
  126. }
  127. },
  128. computed: {
  129. staffData () {
  130. return this.$store.state.staff.infoList.info.data
  131. },
  132. fetching () {
  133. return this.staffData.fetching
  134. },
  135. allPage () {
  136. return Math.floor(this.staffData.totalElements / this.staffData.size) + Math.floor(this.staffData.totalElements % this.staffData.size > 0 ? 1 : 0)
  137. },
  138. userInfo () {
  139. return this.$store.state.option.user.data
  140. }
  141. },
  142. methods: {
  143. staffList () {
  144. this.$store.dispatch('staff/loadStaffList', {count: this.count, page: this.page, enuu: this.userInfo.enterprise.uu})
  145. },
  146. onPullUpAction: function () {
  147. this.page++
  148. this.staffList()
  149. },
  150. goEdit (item) {
  151. this.$store.commit('staff/infoList/EDIT_DATA_SUCCESS', item)
  152. this.$router.push('/mobile/user/staff/edit')
  153. },
  154. setSwitchType (type) {
  155. this.switchType = type
  156. this.$http({
  157. method: 'get',
  158. baseURL: process.env.ssoUrl,
  159. url: `/api/userspace/apply/info/mall`,
  160. data: {
  161. count: 10,
  162. page: 1,
  163. speaceUU: 10049698,
  164. status: 311
  165. }
  166. }).then(res => {
  167. console.log('1', res.data)
  168. }, err => {
  169. console.log('12', err)
  170. })
  171. },
  172. // 删除员工
  173. openDelete (item) {
  174. this.currentObject = item
  175. this.showDelete = true
  176. },
  177. sureDelete () {
  178. this.$http.delete('/basic/user/' + this.currentObject.userUU)
  179. .then(response => {
  180. // console.log(response)
  181. this.showDelete = false
  182. this.onRemind('用户' + this.currentObject.userUU + '删除成功')
  183. this.staffData()
  184. }).catch(data => {
  185. this.showDelete = false
  186. this.onRemind(data.response.data)
  187. })
  188. },
  189. onRemind: function (str) {
  190. this.remindText = str
  191. this.timeoutCount ++
  192. }
  193. }
  194. }
  195. </script>
  196. <style lang="scss">
  197. $base-color: #3f84f6;
  198. #mobile-staff-center {
  199. .staff-head {
  200. height: .82rem;
  201. line-height: .82rem;
  202. text-align: center;
  203. background: #fff;
  204. span {
  205. font-size: .29rem;
  206. &:first-child {
  207. margin-right: 2.6rem;
  208. }
  209. &.active {
  210. color: $base-color;
  211. border-bottom: 1px solid $base-color;
  212. }
  213. }
  214. }
  215. .staff-record {
  216. .search-content {
  217. padding: .25rem 0;
  218. text-align: center;
  219. input {
  220. width: 6.9rem;
  221. border: 1px solid #376ff3;
  222. }
  223. .staff-search {
  224. width: 5.31rem;
  225. }
  226. .search {
  227. float: left;
  228. }
  229. .search-filter {
  230. float: left;
  231. margin-left: .35rem;
  232. position: relative;
  233. .select-wrap {
  234. width: 1.45rem;
  235. height: .58rem;
  236. line-height: .58rem;
  237. background-color: #ffffff;
  238. border-radius: .06rem;
  239. border: solid 1px #b4b4b4;
  240. i{
  241. font-size: .1rem;
  242. font-weight: bold;
  243. color: $base-color;
  244. }
  245. }
  246. ul.select-list{
  247. width: 1.45rem;
  248. position: absolute;
  249. left: 0rem;
  250. top: .59rem;
  251. border: solid 1px #b4b4b4;
  252. border-top: none;
  253. -webkit-box-shadow: 0 1px 5px 0 #aaa;
  254. box-shadow: 0 1px 5px 0 #aaa;
  255. border-radius: .04rem;
  256. li{
  257. background: #fff;
  258. text-align: left;
  259. padding: 0 .13rem;
  260. font-size: .28rem;
  261. height: .53rem;
  262. line-height: .53rem;
  263. }
  264. }
  265. }
  266. }
  267. .list-content{
  268. margin: 0 auto;
  269. padding: 0 .20rem;
  270. div.bg{
  271. padding: .32rem .24rem 0 .24rem;
  272. margin-bottom: .25rem;
  273. width: 7.1rem;
  274. background: #fff;
  275. border-radius: .05rem;
  276. &:last-child {
  277. margin-bottom: 1.5rem;
  278. }
  279. }
  280. .staff-list {
  281. width: 100%;
  282. .list-item {
  283. margin-bottom: .14rem;
  284. &:last-child{
  285. padding-bottom: 0;
  286. }
  287. span {
  288. display: inline-block;
  289. font-size: .28rem;
  290. &:first-child {
  291. width: 1.3rem;
  292. text-align: right;
  293. color: #3f84f6;
  294. }
  295. &:last-child {
  296. color: #666;
  297. }
  298. }
  299. span.role{
  300. display: inline-block;
  301. margin-right: .1rem;
  302. padding: 0 .05rem;
  303. height: .25rem;
  304. line-height: .25rem;
  305. text-align: center;
  306. font-size: .24rem;
  307. color: #fff;
  308. border-radius: .04rem;
  309. }
  310. span.role.bg1{
  311. background-color: #89aefa;
  312. }
  313. span.role.bg2{
  314. background-color: #01d9ce;
  315. }
  316. span.role.bg3{
  317. background-color: #01d9ce;
  318. }
  319. span.role.bg4{
  320. background-color: #ff6769;
  321. }
  322. span.role.bg5{
  323. background-color: #ff8050;
  324. }
  325. }
  326. }
  327. .list-footer {
  328. width: 100%;
  329. height: .8rem;
  330. line-height: .8rem;
  331. background: #fff;
  332. border-top: 1px solid #d9d9d9;
  333. div.handle{
  334. float: left;
  335. width: 50%;
  336. margin: 0 auto;
  337. text-align: center;
  338. span{
  339. font-size: .26rem;
  340. color: #333;
  341. }
  342. i.iconfont {
  343. margin-right: .06rem;
  344. font-size: .36rem;
  345. color: #333;
  346. }
  347. }
  348. div.edit{
  349. border-right: 1px solid #d9d9d9;
  350. }
  351. div.no-allow {
  352. color: #606168;
  353. cursor: not-allowed;
  354. }
  355. }
  356. }
  357. .staff-add {
  358. display: inline-block;
  359. position: fixed;
  360. bottom: 1.2rem;
  361. left: 50%;
  362. margin-left: -3.29rem;
  363. width: 6.59rem;
  364. height: .77rem;
  365. line-height: .77rem;
  366. text-align: center;
  367. font-size: .32rem;
  368. color: #fff;
  369. background-color: #3f84f6;
  370. border-radius: 0.08rem;
  371. i{
  372. margin-right: .1rem;
  373. font-size: .32rem;
  374. color: #fff;
  375. }
  376. }
  377. }
  378. }
  379. /*删除弹框*/
  380. .deleteKuang {
  381. position: fixed;
  382. background: rgba(0,0,0,0.5);
  383. top: 0;
  384. left: 0;
  385. right: 0;
  386. bottom: 0;
  387. z-index: 9999;
  388. .kuangContent {
  389. border-radius: 5px;
  390. background: #fff;
  391. width: 5rem;
  392. position: absolute;
  393. left: 50%;
  394. top: 50%;
  395. transform: translate3d(-50%, -50%, 0);
  396. overflow: hidden;
  397. .titleinfo {
  398. font-size: .3rem;
  399. color: #666;
  400. text-align: center;
  401. margin-top: 0.5rem;
  402. margin-bottom: 0.1rem;
  403. }
  404. .title {
  405. background: #5078cb;
  406. height: .7rem;
  407. line-height: .7rem;
  408. font-size: .3rem;
  409. color: #fff;
  410. text-align: center;
  411. }
  412. .info {
  413. color: #f00;
  414. text-align: center;
  415. }
  416. .K_btn {
  417. margin-top: 0.4rem;
  418. line-height: 0.7rem;
  419. height: 0.7rem;
  420. &::after{
  421. clear: both;
  422. display: block;
  423. content: ' ';
  424. visibility: hidden;
  425. zoom: 1;
  426. }
  427. div {
  428. float: left;
  429. width: 50%;
  430. font-size: 0.3rem;
  431. text-align: center;
  432. &.cancelBtn {
  433. background: #b4b5b9;
  434. color: #333;
  435. }
  436. &.answerBtn {
  437. background: #5078cb;
  438. color: #fff;
  439. }
  440. }
  441. }
  442. }
  443. }
  444. </style>