list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  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="../../../static/temp/icon-club@3x.png" 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">
  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}}</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. linkman:'',
  96. clubMobile:'',
  97. isSelect:false,
  98. isEmpty:false,
  99. isLoadMore:false,
  100. alertText:'确定要删除该地址?',
  101. nomoreText: '上拉显示更多',
  102. userID:'',
  103. pageNum:1,
  104. pageSize:10,
  105. addressList: [],
  106. hasNextPage:false,
  107. loadding: false,
  108. pullUpOn: true,
  109. allowDataStatus:true,
  110. wrapperHeight:'100%',
  111. scrollHeight:'',
  112. deleteAddressId:'',
  113. currPage:'',//当前页面
  114. prevPage:'',//上一个页面
  115. isOperatorModel:false,
  116. operatorList:[],
  117. modelData:''
  118. }
  119. },
  120. onLoad(option){
  121. if(option.type=='select'){this.isSelect = true;}
  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. searchOpertor(){
  140. this.pageNum=1
  141. this.initOperatorList()
  142. },
  143. initOperatorList(){
  144. let params = {pageNum:this.pageNum,pageSize:this.pageSize,linkName:this.linkman,mobile:this.clubMobile}
  145. queryOperatorList(params).then(response =>{
  146. let responseData = response.data
  147. if(responseData.results&&responseData.results.length > 0){
  148. this.isEmpty = false
  149. this.hasNextPage = response.data.hasNextPage
  150. this.operatorList =responseData.results
  151. this.pullFlag = false;
  152. setTimeout(()=>{this.pullFlag = true;},500)
  153. if(this.hasNextPage){
  154. this.pullUpOn = false
  155. this.nomoreText = '上拉显示更多'
  156. }else{
  157. this.pullUpOn = true
  158. this.loadding = false
  159. this.nomoreText = '已至底部'
  160. }
  161. }else{
  162. this.isEmpty = true
  163. }
  164. }).catch(response =>{
  165. this.$util.msg(response.msg,2000)
  166. })
  167. },
  168. getOnReachBottomData(){
  169. this.pageNum+=1
  170. let params = {pageNum:this.pageNum,pageSize:this.pageSize,linkName:this.linkman,mobile:this.clubMobile}
  171. queryOperatorList(params).then(response =>{
  172. let responseData = response.data
  173. if(responseData.results&&responseData.results.length > 0){
  174. this.hasNextPage = response.data.hasNextPage
  175. this.operatorList = this.operatorList.concat(responseData.results)
  176. this.pullFlag = false;// 防上拉暴滑
  177. setTimeout(()=>{this.pullFlag = true;},500)
  178. if(this.hasNextPage){
  179. this.pullUpOn = false
  180. this.nomoreText = '上拉显示更多'
  181. }else{
  182. this.pullUpOn = false
  183. this.loadding = false
  184. this.nomoreText = '已至底部'
  185. }
  186. }
  187. }).catch(response =>{
  188. this.$util.msg(response.msg,2000)
  189. })
  190. },
  191. showOperatorModel(item){
  192. console.log(item)
  193. this.isOperatorModel = true
  194. this.modelData = item
  195. },
  196. closeModel(){
  197. this.isOperatorModel = false
  198. },
  199. deleteOperator(id){//删除运营人员
  200. console.log('删除的ID',id)
  201. this.$util.modal('','确定删除运营人员吗?','确定删除','取消',true,() =>{
  202. deleteOperator({id:id}).then(response =>{
  203. this.$util.msg('删除成功',2000)
  204. this.initOperatorList()
  205. }).catch(response =>{
  206. this.$util.msg(response.msg,2000)
  207. })
  208. })
  209. },
  210. updateInvitationCode(item){ //更新邀请码
  211. this.$util.modal('','确定更新邀请码并发送给运营人员?','确定更新','取消',true,() =>{
  212. updateCode({id:item.id,status:item.status}).then(response =>{
  213. this.$util.msg('更新邀请码成功',2000)
  214. this.isOperatorModel = false
  215. this.initOperatorList()
  216. }).catch(response =>{
  217. this.$util.msg(response.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.pageNum = 1;
  288. this.addressList = [];
  289. this.initOperatorList();
  290. var pages = getCurrentPages();
  291. var prevPage = pages[pages.length - 2]; //上一个页面
  292. // prevPage.setData({select:''})
  293. }
  294. }
  295. </script>
  296. <style lang='scss'>
  297. page {
  298. height: auto;
  299. }
  300. page,.container{
  301. /* padding-bottom: 120upx; */
  302. background: #F7F7F7;
  303. border-top: 1px solid #EBEBEB;
  304. }
  305. .container{
  306. position: relative;
  307. }
  308. .operator-top{
  309. width: 702rpx;
  310. padding: 0 24rpx;
  311. height: 282rpx;
  312. background: #FFFFFF;
  313. position:fixed ;
  314. top: 0;
  315. left: 0;
  316. z-index: 999;
  317. .operator-title{
  318. width: 100%;
  319. height: 92rpx;
  320. padding: 34rpx 0;
  321. .title{
  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. }
  329. .head{
  330. width: 92rpx;
  331. height: 92rpx;
  332. border-radius: 50%;
  333. border: 1px solid $color-system;
  334. float: left;
  335. image{
  336. width: 92rpx;
  337. height: 92rpx;
  338. border-radius: 50%;
  339. }
  340. }
  341. }
  342. .operator-search{
  343. width: 100%;
  344. height: auto;
  345. .search-from{
  346. width: 300rpx;
  347. height: 40rpx;
  348. padding: 20rpx;
  349. background: $sub-bg-color;
  350. border-radius: 14rpx;
  351. position: relative;
  352. margin-bottom: 20rpx;
  353. float: left;
  354. &.name{
  355. width: 180rpx;
  356. margin-right: 20rpx;
  357. .input{
  358. width: 180rpx;
  359. padding-left:10rpx;
  360. font-size: $font-size-28;
  361. color: $text-color;
  362. line-height: 40rpx;
  363. float: left;
  364. height: 40rpx;
  365. }
  366. }
  367. &.phone{
  368. width: 228rpx;
  369. margin-right: 20rpx;
  370. .input{
  371. width: 228rpx;
  372. padding-left:10rpx;
  373. font-size: $font-size-28;
  374. color: $text-color;
  375. line-height: 40rpx;
  376. float: left;
  377. height: 40rpx;
  378. }
  379. }
  380. &.search{
  381. width: 170rpx;
  382. padding: 0;
  383. background: #FFFFFF;
  384. .search-btn{
  385. width: 170rpx;
  386. height: 78rpx;
  387. border: 1px solid $color-system;
  388. border-radius: 14rpx;
  389. font-size: $font-size-28;
  390. color: $color-system;
  391. line-height: 78rpx;
  392. }
  393. }
  394. .label{
  395. text-align: left;
  396. font-size: $font-size-28;
  397. color:$text-color;
  398. line-height: 40rpx;
  399. float: left;
  400. }
  401. }
  402. }
  403. }
  404. .operator-main{
  405. padding-top: 282rpx;
  406. padding-bottom: 120rpx;
  407. }
  408. .list{
  409. display: flex;
  410. align-items: center;
  411. width: 702rpx;
  412. height: 92rpx;
  413. padding: 24rpx;
  414. background: #FFFFFF;
  415. position: relative;
  416. border-bottom: 1px solid #EBEBEB;
  417. .list-left{
  418. display: flex;
  419. flex: 4;
  420. .list-head{
  421. width: 92rpx;
  422. height: 92rpx;
  423. border: 1px solid $color-system;
  424. border-radius: 50%;
  425. image{
  426. width: 92rpx;
  427. height: 92rpx;
  428. border-radius: 50%;
  429. }
  430. }
  431. .list-tel{
  432. margin-left: 18rpx;
  433. .txt{
  434. display: flex;
  435. flex: 1;
  436. font-size: $font-size-28;
  437. color: $text-color;
  438. line-height: 46rpx;
  439. }
  440. }
  441. }
  442. .list-opea{
  443. flex:6;
  444. .opea-type{
  445. flex-direction: column;
  446. align-items: center;
  447. margin-left: 20rpx;
  448. float: left;
  449. .opea-type-cell{
  450. width: 186rpx;
  451. height: 64rpx;
  452. padding:0 16rpx;
  453. border-radius: 10rpx;
  454. border: 1px solid #DDDDDD;
  455. line-height: 64rpx;
  456. font-size: $font-size-24;
  457. .icon-iconfontweixin{
  458. margin-right: 8rpx;
  459. font-size: $font-size-32;
  460. }
  461. &.none{
  462. text-align: center;
  463. }
  464. }
  465. }
  466. .opea-del{
  467. float: right;
  468. flex-direction: column;
  469. align-items: center;
  470. .opea-type-cell{
  471. width: 86rpx;
  472. height: 64rpx;
  473. padding:0 24rpx;
  474. border-radius: 10rpx;
  475. border: 1px solid #DDDDDD;
  476. line-height: 64rpx;
  477. font-size: $font-size-24;
  478. color: #FF0000;
  479. .icon-shanchu{
  480. font-size: $font-size-32;
  481. margin-right: 6rpx;
  482. }
  483. }
  484. }
  485. }
  486. }
  487. .operator-model{
  488. width: 100%;
  489. height: 100%;
  490. background: rgba(0,0,0,.1);
  491. position: fixed;
  492. top: 0;
  493. left: 0;
  494. bottom: 0;
  495. right: 0;
  496. margin: auto;
  497. z-index: 1000;
  498. .operator-alert{
  499. width: 430rpx;
  500. height: 376rpx;
  501. padding: 68rpx 32rpx;
  502. background: #FFFFFF;
  503. border-radius: 14rpx;
  504. position: absolute;
  505. top: 0;
  506. left: 0;
  507. bottom: 0;
  508. right: 0;
  509. margin: auto;
  510. z-index: 1001;
  511. .icon-iconfontguanbi{
  512. width: 68rpx;
  513. height: 68rpx;
  514. text-align: center;
  515. line-height: 68rpx;
  516. position: absolute;
  517. right: 0;
  518. top: 0;
  519. font-size: $font-size-36;
  520. color: #999999;
  521. }
  522. .content{
  523. .ciew-t{
  524. font-size: $font-size-28;
  525. color: $text-color;
  526. line-height: 48rpx;
  527. }
  528. }
  529. .btn{
  530. width: 100%;
  531. height: 68rpx;
  532. border-top: 1px solid #F7F7F7;
  533. line-height: 68rpx;
  534. font-size: $font-size-26;
  535. text-align: center;
  536. color: $color-system;
  537. position: absolute;
  538. bottom:0 ;
  539. left: 0;
  540. }
  541. }
  542. }
  543. .operator-btn{
  544. position: fixed;
  545. width: 100%;
  546. height: 140rpx;
  547. left: 0;
  548. bottom: 0;
  549. background: #FFFFFF;
  550. z-index: 95;
  551. display: flex;
  552. align-items: center;
  553. justify-content: center;
  554. .add-btn{
  555. width: 702rpx;
  556. height: 88rpx;
  557. font-size: $font-size-28;
  558. line-height: 88rpx;
  559. color: #FFFFFF;
  560. text-align: center;
  561. background: $btn-confirm;
  562. border-radius: 14rpx;
  563. }
  564. }
  565. .adds-btn{
  566. width: 702rpx;
  567. height: 88rpx;
  568. font-size: 28rpx;
  569. line-height: 88rpx;
  570. color: #FFFFFF;
  571. margin: 0 auto;
  572. text-align: center;
  573. background: #000000;
  574. border-radius: 14rpx;
  575. }
  576. </style>