list.vue 15 KB

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