list.vue 14 KB

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