list.vue 15 KB

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