list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  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. s </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 : '../../../static/temp/logo@3x.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. console.log('删除的ID',id)
  198. this.$util.modal('','确定删除运营人员吗?','确定删除','取消',true,() =>{
  199. deleteOperator({id:id}).then(response =>{
  200. this.$util.msg('删除成功',2000)
  201. this.initOperatorList()
  202. }).catch(response =>{
  203. this.$util.msg(response.msg,2000)
  204. })
  205. })
  206. },
  207. updateInvitationCode(item){ //更新邀请码
  208. this.$util.modal('','确定更新邀请码并发送给运营人员?','确定更新','取消',true,() =>{
  209. updateCode({id:item.id,status:item.status}).then(response =>{
  210. this.$util.msg('更新邀请码成功',2000)
  211. this.isOperatorModel = false
  212. this.initOperatorList()
  213. }).catch(response =>{
  214. this.$util.msg(response.msg,2000)
  215. })
  216. })
  217. },
  218. rexpStautsText(n) {
  219. let text = ''
  220. switch (n) {
  221. case '':
  222. text = '--'
  223. break
  224. case '1':
  225. text = '邀请码有效'
  226. break
  227. case '2':
  228. text = '邀请码已使用'
  229. break
  230. case '3':
  231. text = '邀请码已过期'
  232. break
  233. }
  234. return text
  235. },
  236. modelStautsText(n) {
  237. let text = ''
  238. switch (n) {
  239. case '1':
  240. text = '(有效)'
  241. break
  242. case '2':
  243. text = '(已使用)'
  244. break
  245. case '3':
  246. text = '(已过期)'
  247. break
  248. }
  249. return text
  250. },
  251. rexpStautsColor(status) {
  252. let textColor = ''
  253. switch (status) {
  254. case '1':
  255. textColor = '#55BB00'
  256. break
  257. case '2':
  258. textColor = '#0056BB'
  259. break
  260. case '3':
  261. textColor = '#BB0000'
  262. break
  263. }
  264. return textColor
  265. },
  266. iconStautsColor(status) {
  267. let textColor = ''
  268. if(status == '2'){
  269. textColor = '#09BB07'
  270. }else{
  271. textColor = '#DDDDDD'
  272. }
  273. return textColor
  274. },
  275. },
  276. onReachBottom() {
  277. if(this.hasNextPage){
  278. this.loadding = true
  279. this.pullUpOn = true
  280. this.getOnReachBottomData()
  281. }
  282. },
  283. onShow() {
  284. this.$api.getCommonStorage('clubInfo').then(response =>{
  285. console.log(response)
  286. this.clubID = response.clubID
  287. this.clubName = response.name
  288. this.clubImage = response.image
  289. this.pageNum = 1;
  290. this.initOperatorList();
  291. })
  292. }
  293. }
  294. </script>
  295. <style lang='scss'>
  296. page {
  297. height: auto;
  298. }
  299. page,.container{
  300. /* padding-bottom: 120upx; */
  301. background: #F7F7F7;
  302. border-top: 1px solid #EBEBEB;
  303. }
  304. .container{
  305. position: relative;
  306. }
  307. .operator-top{
  308. width: 702rpx;
  309. padding: 0 24rpx;
  310. height: 282rpx;
  311. background: #FFFFFF;
  312. position:fixed ;
  313. top: 0;
  314. left: 0;
  315. z-index: 999;
  316. .operator-title{
  317. width: 100%;
  318. height: 92rpx;
  319. padding: 34rpx 0;
  320. .title{
  321. width: 420rpx;
  322. float: left;
  323. font-size: $font-size-36;
  324. color: $text-color;
  325. line-height: 92rpx;
  326. text-align: left;
  327. margin-left: 20rpx;
  328. -o-text-overflow: ellipsis;
  329. text-overflow: ellipsis;
  330. display: -webkit-box;
  331. word-break: break-all;
  332. -webkit-box-orient: vertical;
  333. -webkit-line-clamp: 1;
  334. overflow: hidden;
  335. }
  336. .head{
  337. width: 92rpx;
  338. height: 92rpx;
  339. border-radius: 50%;
  340. border: 1px solid $color-system;
  341. float: left;
  342. image{
  343. width: 92rpx;
  344. height: 92rpx;
  345. border-radius: 50%;
  346. }
  347. }
  348. }
  349. .operator-search{
  350. width: 100%;
  351. height: auto;
  352. .search-from{
  353. width: 300rpx;
  354. height: 40rpx;
  355. padding: 20rpx;
  356. background: $sub-bg-color;
  357. border-radius: 14rpx;
  358. position: relative;
  359. margin-bottom: 20rpx;
  360. float: left;
  361. &.name{
  362. width: 180rpx;
  363. margin-right: 20rpx;
  364. .input{
  365. width: 180rpx;
  366. padding-left:10rpx;
  367. font-size: $font-size-28;
  368. color: $text-color;
  369. line-height: 40rpx;
  370. float: left;
  371. height: 40rpx;
  372. }
  373. }
  374. &.phone{
  375. width: 228rpx;
  376. margin-right: 20rpx;
  377. .input{
  378. width: 228rpx;
  379. padding-left:10rpx;
  380. font-size: $font-size-28;
  381. color: $text-color;
  382. line-height: 40rpx;
  383. float: left;
  384. height: 40rpx;
  385. }
  386. }
  387. &.search{
  388. width: 170rpx;
  389. padding: 0;
  390. background: #FFFFFF;
  391. .search-btn{
  392. width: 170rpx;
  393. height: 78rpx;
  394. border: 1px solid $color-system;
  395. border-radius: 14rpx;
  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: 14rpx;
  432. image{
  433. width: 92rpx;
  434. height: 92rpx;
  435. border-radius: 14rpx;
  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: 20rpx;
  455. float: left;
  456. .opea-type-cell{
  457. width: 186rpx;
  458. height: 64rpx;
  459. padding:0 16rpx;
  460. border-radius: 10rpx;
  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: 10rpx;
  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: 702rpx;
  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: 14rpx;
  570. }
  571. }
  572. .adds-btn{
  573. width: 702rpx;
  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: 14rpx;
  582. }
  583. </style>