list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. <template>
  2. <view class="container operator clearfix">
  3. <view class="operator-top clearfix">
  4. <view class="operator-title">
  5. <view class="head"><image :src="clubImage" mode=""></image></view>
  6. <view class="title">{{clubName}}</view>
  7. </view>
  8. <view class="operator-search">
  9. <view class="search-wrap">
  10. <view class="search-from name">
  11. <input class="input" type="text" v-model="listQuery.linkName" placeholder="请输入姓名" maxlength="6"/>
  12. </view>
  13. <view class="search-from phone">
  14. <input class="input" type="text" v-model="listQuery.mobile" placeholder="请输入手机号" maxlength="11"/>
  15. </view>
  16. <view class="search-from search">
  17. <button class="search-btn" type="default" @click.stop="handSearchOpertor">搜索</button>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="operator-main">
  23. <view v-if="isEmpty" class="empty-container">
  24. <view class="txt">暂无运营人员</view>
  25. </view>
  26. <view v-else class="operator-list">
  27. <scroll-view scroll-y="true" >
  28. <view class="list" v-for="(item, index) in operatorList" :key="index" @click.stop="showOperatorModel(item)">
  29. <view class="list-left">
  30. <view class="list-head"><image :src="item.avatarUrl ? item.avatarUrl : 'https://static.caimei365.com/app/img/icon/icon-seller@3x.png'" mode=""></image></view>
  31. <view class="list-tel">
  32. <text class="txt">{{ item.linkName ? item.linkName : ''}}</text>
  33. <text class="txt">{{ item.mobile ? item.mobile : '' }}</text>
  34. </view>
  35. </view>
  36. <view class="list-opea">
  37. <view class="opea-type">
  38. <view class="opea-type-cell" v-if="item.effectiveFlag != null">
  39. <text class="iconfont icon-iconfontweixin" :style="{color: iconStautsColor(item.status)}"></text>
  40. <text :style="{color: rexpStautsColor(item.effectiveFlag)}">{{ rexpStautsText(item.effectiveFlag) }}</text>
  41. </view>
  42. <view class="opea-type-cell none" v-else>
  43. <text>- -</text>
  44. </view>
  45. </view>
  46. <view class="opea-del">
  47. <view class="opea-type-cell" @click.stop="deleteOperator(item.id)">
  48. <text class="iconfont icon-shanchu"></text>
  49. <text>删除</text>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <!--加载loadding-->
  55. <tui-loadmore :visible="loadding" :index="3" type="black" />
  56. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#ffffff'" :text='nomoreText' />
  57. <!--加载loadding-->
  58. </scroll-view>
  59. </view>
  60. </view>
  61. <div class="operator-btn" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
  62. <view class="add-btn" @click="this.$api.navigateTo('/pages/user/operator/addoperator')">添加运营人员</view>
  63. </div>
  64. <view class="operator-model" v-if="isOperatorModel" @click.stop="closeModel">
  65. <view class="operator-alert">
  66. <text class="iconfont icon-iconfontguanbi" @click.stop="closeModel"></text>
  67. <view class="content">
  68. <view class="ciew-t">姓名:{{modelData.linkName}}</view>
  69. <view class="ciew-t">手机号:{{modelData.mobile}}</view>
  70. <view class="ciew-t">邀请码:{{modelData.invitationCode ? modelData.invitationCode : '无'}}
  71. <text :style="{color: rexpStautsColor(modelData.status)}">{{modelStautsText(modelData.effectiveFlag)}}</text>
  72. </view>
  73. <view class="ciew-t">邀请码有效期:{{modelData.effectiveDays ? modelData.effectiveDays : '0'}}天</view>
  74. <view class="ciew-t">状态:{{modelData.status == 2 ? '已绑定' : '未绑定'}}</view>
  75. <view class="ciew-t">添加时间:{{modelData.addTime}}</view>
  76. <view class="ciew-t">绑定时间:{{modelData.bindTime == null ? '无' : modelData.bindTime }}</view>
  77. </view>
  78. <view class="btn" v-if="modelData.status != 2" @click.stop="updateInvitationCode(modelData)">更新邀请码</view>
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import authorize from '@/common/config/authorize.js'
  85. export default {
  86. components:{},
  87. data() {
  88. return {
  89. clubName:'',
  90. clubImage:'',
  91. linkman:'',
  92. clubMobile:'',
  93. isEmpty:false,
  94. nomoreText: '上拉显示更多',
  95. userID:'',
  96. pageNum:1,
  97. pageSize:10,
  98. hasNextPage:false,
  99. loadding: false,
  100. pullUpOn: true,
  101. pullFlag: true,
  102. allowDataStatus:true,
  103. wrapperHeight:'100%',
  104. scrollHeight:'',
  105. deleteAddressId:'',
  106. currPage:'',//当前页面
  107. prevPage:'',//上一个页面
  108. isOperatorModel:false,
  109. operatorList:[],
  110. isIphoneX:this.$store.state.isIphoneX,
  111. modelData:'',
  112. listQuery:{
  113. userId:'',
  114. linkName:'',
  115. mobile:'',
  116. pageNum:1,
  117. pageSize:10
  118. }
  119. }
  120. },
  121. onLoad(){
  122. this.setScrollHeight()
  123. },
  124. methods: {
  125. setScrollHeight() {
  126. // 窗口高度 - 底部距离
  127. setTimeout(()=> {
  128. const query = wx.createSelectorQuery().in(this)
  129. query.selectAll('.add-btn').boundingClientRect()
  130. query.exec(res => {
  131. if(res[0][0]){
  132. let winHeight = this.$api.getWindowHeight(),
  133. eleTop = res[0][0].top - 1
  134. this.scrollHeight = eleTop
  135. }
  136. })
  137. }, 500)
  138. },
  139. handSearchOpertor(){
  140. this.listQuery.pageNum=1
  141. this.InitOperatorList()
  142. },
  143. InitOperatorList(){ //查询机构运营人员列表
  144. this.UserService.QueryOperatorList(this.listQuery).then(response =>{
  145. let responseData = response.data
  146. if(responseData.results&&responseData.results.length > 0){
  147. this.isEmpty = false
  148. this.hasNextPage = response.data.hasNextPage
  149. this.operatorList =responseData.results
  150. this.pullFlag = false
  151. setTimeout(()=>{this.pullFlag = true},500)
  152. if(this.hasNextPage){
  153. this.pullUpOn = false
  154. this.nomoreText = '上拉显示更多'
  155. }else{
  156. this.pullUpOn = true
  157. this.loadding = false
  158. this.nomoreText = '已至底部'
  159. }
  160. }else{
  161. this.isEmpty = true
  162. }
  163. }).catch(error =>{
  164. this.$util.msg(error.msg,2000)
  165. })
  166. },
  167. getOnReachBottomData(){
  168. this.listQuery.pageNum+=1
  169. this.UserService.QueryOperatorList(this.listQuery).then(response =>{
  170. let responseData = response.data
  171. if(responseData.results&&responseData.results.length > 0){
  172. this.hasNextPage = response.data.hasNextPage
  173. this.operatorList = this.operatorList.concat(responseData.results)
  174. this.pullFlag = false// 防上拉暴滑
  175. setTimeout(()=>{this.pullFlag = true},500)
  176. if(this.hasNextPage){
  177. this.pullUpOn = false
  178. this.nomoreText = '上拉显示更多'
  179. }else{
  180. this.pullUpOn = false
  181. this.loadding = false
  182. this.nomoreText = '已至底部'
  183. }
  184. }
  185. }).catch(error =>{
  186. this.$util.msg(error.msg,2000)
  187. })
  188. },
  189. showOperatorModel(item){
  190. this.isOperatorModel = true
  191. this.modelData = item
  192. },
  193. closeModel(){
  194. this.isOperatorModel = false
  195. },
  196. deleteOperator(id){//删除运营人员
  197. this.$util.modal('','确定删除运营人员吗?','确定删除','取消',true,() =>{
  198. this.UserService.PostDeleteOperator({id:id}).then(response =>{
  199. this.$util.msg('删除成功',2000,true,'success')
  200. setTimeout(()=>{
  201. this.InitOperatorList()
  202. },2000)
  203. }).catch(error =>{
  204. this.$util.msg(error.msg,2000)
  205. })
  206. })
  207. },
  208. updateInvitationCode(item){ //更新邀请码
  209. this.$util.modal('','确定更新邀请码并发送给运营人员?','确定更新','取消',true,() =>{
  210. this.UserService.PostUpdateOperatorCode({id:item.id,status:item.status}).then(response =>{
  211. this.isOperatorModel = false
  212. this.$util.msg('更新邀请码成功',2000)
  213. setTimeout(()=>{
  214. this.InitOperatorList()
  215. },2000)
  216. }).catch(error =>{
  217. this.$util.msg(error.msg,2000)
  218. })
  219. })
  220. },
  221. rexpStautsText(n) {
  222. let text = ''
  223. switch (n) {
  224. case '':
  225. text = '--'
  226. break
  227. case 1:
  228. text = '邀请码有效'
  229. break
  230. case 2:
  231. text = '邀请码已使用'
  232. break
  233. case 3:
  234. text = '邀请码已过期'
  235. break
  236. }
  237. return text
  238. },
  239. modelStautsText(n) {
  240. let text = ''
  241. switch (n) {
  242. case 1:
  243. text = '(有效)'
  244. break
  245. case 2:
  246. text = '(已使用)'
  247. break
  248. case 3:
  249. text = '(已过期)'
  250. break
  251. }
  252. return text
  253. },
  254. rexpStautsColor(status) {
  255. let textColor = ''
  256. switch (status) {
  257. case 1:
  258. textColor = '#55BB00'
  259. break
  260. case 2:
  261. textColor = '#0056BB'
  262. break
  263. case 3:
  264. textColor = '#BB0000'
  265. break
  266. }
  267. return textColor
  268. },
  269. iconStautsColor(status) {
  270. let textColor = ''
  271. if(status == 2){
  272. textColor = '#09BB07'
  273. }else{
  274. textColor = '#DDDDDD'
  275. }
  276. return textColor
  277. },
  278. },
  279. onReachBottom() {
  280. if(this.hasNextPage){
  281. this.loadding = true
  282. this.pullUpOn = true
  283. this.getOnReachBottomData()
  284. }
  285. },
  286. onShow() {
  287. this.$api.getComStorage('clubInfo').then((resolve) =>{
  288. this.clubName = resolve.name
  289. this.clubImage = resolve.image ? resolve.image : 'https://static.caimei365.com/app/img/icon/icon-club@3x.png'
  290. this.listQuery.userId = resolve.userId
  291. this.listQuery.pageNum = 1
  292. this.InitOperatorList()
  293. })
  294. }
  295. }
  296. </script>
  297. <style lang='scss'>
  298. page {
  299. height: auto;
  300. }
  301. page,.container{
  302. /* padding-bottom: 120upx; */
  303. background: #F7F7F7;
  304. border-top: 1px solid #EBEBEB;
  305. }
  306. .container{
  307. position: relative;
  308. }
  309. .operator-top{
  310. width: 702rpx;
  311. padding: 0 24rpx;
  312. height: 282rpx;
  313. background: #FFFFFF;
  314. position:fixed ;
  315. top: 0;
  316. left: 0;
  317. z-index: 999;
  318. .operator-title{
  319. width: 100%;
  320. height: 92rpx;
  321. padding: 34rpx 0;
  322. .title{
  323. width: 420rpx;
  324. float: left;
  325. font-size: $font-size-32;
  326. color: $text-color;
  327. line-height: 92rpx;
  328. text-align: left;
  329. margin-left: 20rpx;
  330. -o-text-overflow: ellipsis;
  331. text-overflow: ellipsis;
  332. display: -webkit-box;
  333. word-break: break-all;
  334. -webkit-box-orient: vertical;
  335. -webkit-line-clamp: 1;
  336. overflow: hidden;
  337. }
  338. .head{
  339. width: 92rpx;
  340. height: 92rpx;
  341. border-radius: 50%;
  342. border: 1px solid #ebebeb;
  343. float: left;
  344. image{
  345. width: 92rpx;
  346. height: 92rpx;
  347. border-radius: 50%;
  348. }
  349. }
  350. }
  351. .operator-search{
  352. width: 100%;
  353. height: auto;
  354. .search-from{
  355. width: 300rpx;
  356. height: 40rpx;
  357. padding: 20rpx;
  358. background: $sub-bg-color;
  359. border-radius: 40rpx;
  360. position: relative;
  361. margin-bottom: 20rpx;
  362. float: left;
  363. &.name{
  364. width: 180rpx;
  365. margin-right: 20rpx;
  366. .input{
  367. width: 180rpx;
  368. font-size: $font-size-28;
  369. color: $text-color;
  370. line-height: 40rpx;
  371. float: left;
  372. height: 40rpx;
  373. }
  374. }
  375. &.phone{
  376. width: 228rpx;
  377. margin-right: 20rpx;
  378. .input{
  379. width: 228rpx;
  380. padding-left:10rpx;
  381. font-size: $font-size-28;
  382. color: $text-color;
  383. line-height: 40rpx;
  384. float: left;
  385. height: 40rpx;
  386. }
  387. }
  388. &.search{
  389. width: 175rpx;
  390. padding: 0;
  391. background: #FFFFFF;
  392. .search-btn{
  393. width: 170rpx;
  394. height: 78rpx;
  395. border-radius: 39rpx;
  396. font-size: $font-size-28;
  397. color: #FFFFFF;
  398. line-height: 78rpx;
  399. background: $btn-confirm;
  400. }
  401. }
  402. .label{
  403. text-align: left;
  404. font-size: $font-size-28;
  405. color:$text-color;
  406. line-height: 40rpx;
  407. float: left;
  408. }
  409. }
  410. }
  411. }
  412. .operator-main{
  413. padding-top: 282rpx;
  414. padding-bottom: 120rpx;
  415. }
  416. .list{
  417. display: flex;
  418. align-items: center;
  419. width: 702rpx;
  420. height: 92rpx;
  421. padding: 24rpx;
  422. background: #FFFFFF;
  423. position: relative;
  424. border-bottom: 1px solid #EBEBEB;
  425. .list-left{
  426. display: flex;
  427. flex: 4;
  428. .list-head{
  429. width: 92rpx;
  430. height: 92rpx;
  431. border-radius: 50%;
  432. image{
  433. width: 92rpx;
  434. height: 92rpx;
  435. border-radius: 50%;
  436. }
  437. }
  438. .list-tel{
  439. margin-left: 18rpx;
  440. .txt{
  441. display: flex;
  442. flex: 1;
  443. font-size: $font-size-28;
  444. color: $text-color;
  445. line-height: 46rpx;
  446. }
  447. }
  448. }
  449. .list-opea{
  450. flex:6;
  451. .opea-type{
  452. flex-direction: column;
  453. align-items: center;
  454. margin-left: 35rpx;
  455. float: left;
  456. .opea-type-cell{
  457. width: 186rpx;
  458. height: 64rpx;
  459. padding:0 16rpx;
  460. border-radius: 32rpx;
  461. border: 1px solid #DDDDDD;
  462. line-height: 64rpx;
  463. font-size: $font-size-24;
  464. .icon-iconfontweixin{
  465. margin-right: 8rpx;
  466. font-size: $font-size-32;
  467. }
  468. &.none{
  469. text-align: center;
  470. }
  471. }
  472. }
  473. .opea-del{
  474. float: right;
  475. flex-direction: column;
  476. align-items: center;
  477. .opea-type-cell{
  478. width: 86rpx;
  479. height: 64rpx;
  480. padding:0 24rpx;
  481. border-radius: 32rpx;
  482. border: 1px solid #DDDDDD;
  483. line-height: 64rpx;
  484. font-size: $font-size-24;
  485. color: #FF0000;
  486. .icon-shanchu{
  487. font-size: $font-size-32;
  488. margin-right: 6rpx;
  489. }
  490. }
  491. }
  492. }
  493. }
  494. .operator-model{
  495. width: 100%;
  496. height: 100%;
  497. background: rgba(0,0,0,.1);
  498. position: fixed;
  499. top: 0;
  500. left: 0;
  501. bottom: 0;
  502. right: 0;
  503. margin: auto;
  504. z-index: 1000;
  505. .operator-alert{
  506. width: 435rpx;
  507. height: 360rpx;
  508. padding: 68rpx 32rpx;
  509. background: #FFFFFF;
  510. border-radius: 14rpx;
  511. position: absolute;
  512. top: 0;
  513. left: 0;
  514. bottom: 0;
  515. right: 0;
  516. margin: auto;
  517. z-index: 1001;
  518. .icon-iconfontguanbi{
  519. width: 68rpx;
  520. height: 68rpx;
  521. text-align: center;
  522. line-height: 68rpx;
  523. position: absolute;
  524. right: 0;
  525. top: 0;
  526. font-size: $font-size-36;
  527. color: #999999;
  528. }
  529. .content{
  530. .ciew-t{
  531. font-size: $font-size-28;
  532. color: $text-color;
  533. line-height: 48rpx;
  534. }
  535. }
  536. .btn{
  537. width: 100%;
  538. height: 68rpx;
  539. border-top: 1px solid #F7F7F7;
  540. line-height: 68rpx;
  541. font-size: $font-size-26;
  542. text-align: center;
  543. color: $color-system;
  544. position: absolute;
  545. bottom:0 ;
  546. left: 0;
  547. }
  548. }
  549. }
  550. .operator-btn{
  551. position: fixed;
  552. width: 100%;
  553. height: 140rpx;
  554. left: 0;
  555. bottom: 0;
  556. background: #FFFFFF;
  557. z-index: 95;
  558. display: flex;
  559. align-items: center;
  560. justify-content: center;
  561. .add-btn{
  562. width: 600rpx;
  563. height: 88rpx;
  564. font-size: $font-size-28;
  565. line-height: 88rpx;
  566. color: #FFFFFF;
  567. text-align: center;
  568. background: $btn-confirm;
  569. border-radius: 44rpx;
  570. }
  571. }
  572. .adds-btn{
  573. width: 600rpx;
  574. height: 88rpx;
  575. font-size: 28rpx;
  576. line-height: 88rpx;
  577. color: #FFFFFF;
  578. margin: 0 auto;
  579. text-align: center;
  580. background: #000000;
  581. border-radius: 44rpx;
  582. }
  583. </style>