list.vue 15 KB

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