list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  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="shopLogo == null ? '../../../static/temp/icon-club@3x.png' : shopLogo" mode=""></image></view>
  6. <view class="title">{{shopNmae}}</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 : '../../../static/temp/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" 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. shopId:'',
  94. shopNmae:'',
  95. shopLogo:'',
  96. isEmpty:false,
  97. nomoreText: '上拉显示更多',
  98. userID:'',
  99. hasNextPage:false,
  100. loadding: false,
  101. pullUpOn: true,
  102. pullFlag: true,
  103. allowDataStatus:true,
  104. wrapperHeight:'100%',
  105. scrollHeight:'',
  106. deleteAddressId:'',
  107. currPage:'',//当前页面
  108. prevPage:'',//上一个页面
  109. isOperatorModel:false,
  110. operatorList:[],
  111. isIphoneX:this.$store.state.isIphoneX,
  112. modelData:'',
  113. listQuery:{
  114. linkman:'',
  115. clubMobile:'',
  116. pageNum:1,
  117. pageSize:10,
  118. }
  119. }
  120. },
  121. onLoad(){
  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 = {clubID:this.clubID,pageNum:1,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(error =>{
  165. this.$util.msg(error.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(error =>{
  188. this.$util.msg(error.msg,2000)
  189. })
  190. },
  191. showOperatorModel(item){
  192. this.isOperatorModel = true
  193. this.modelData = item
  194. },
  195. closeModel(){
  196. this.isOperatorModel = false
  197. },
  198. deleteOperator(id){//删除运营人员
  199. this.$util.modal('','确定删除运营人员吗?','确定删除','取消',true,() =>{
  200. deleteOperator({id:id}).then(response =>{
  201. this.$util.msg('删除成功',2000,true,'success')
  202. this.initOperatorList()
  203. }).catch(error =>{
  204. this.$util.msg(error.msg,2000)
  205. })
  206. })
  207. },
  208. updateInvitationCode(item){ //更新邀请码
  209. this.$util.modal('','确定更新邀请码并发送给运营人员?','确定更新','取消',true,() =>{
  210. updateCode({id:item.id,status:item.status}).then(response =>{
  211. this.$util.msg('更新邀请码成功',2000)
  212. this.isOperatorModel = false
  213. this.initOperatorList()
  214. }).catch(error =>{
  215. this.$util.msg(error.msg,2000)
  216. })
  217. })
  218. },
  219. rexpStautsText(n) {
  220. let text = ''
  221. switch (n) {
  222. case '':
  223. text = '--'
  224. break
  225. case '1':
  226. text = '邀请码有效'
  227. break
  228. case '2':
  229. text = '邀请码已使用'
  230. break
  231. case '3':
  232. text = '邀请码已过期'
  233. break
  234. }
  235. return text
  236. },
  237. modelStautsText(n) {
  238. let text = ''
  239. switch (n) {
  240. case '1':
  241. text = '(有效)'
  242. break
  243. case '2':
  244. text = '(已使用)'
  245. break
  246. case '3':
  247. text = '(已过期)'
  248. break
  249. }
  250. return text
  251. },
  252. rexpStautsColor(status) {
  253. let textColor = ''
  254. switch (status) {
  255. case '1':
  256. textColor = '#55BB00'
  257. break
  258. case '2':
  259. textColor = '#0056BB'
  260. break
  261. case '3':
  262. textColor = '#BB0000'
  263. break
  264. }
  265. return textColor
  266. },
  267. iconStautsColor(status) {
  268. let textColor = ''
  269. if(status == '2'){
  270. textColor = '#09BB07'
  271. }else{
  272. textColor = '#DDDDDD'
  273. }
  274. return textColor
  275. },
  276. },
  277. onReachBottom() {
  278. if(this.hasNextPage){
  279. this.loadding = true
  280. this.pullUpOn = true
  281. this.getOnReachBottomData()
  282. }
  283. },
  284. onShow() {
  285. this.$api.getComStorage('shopInfo').then(response =>{
  286. console.log(response)
  287. this.shopId = response.shopID
  288. this.shopName = response.name
  289. this.shopLogo = response.logo
  290. this.pageNum = 1;
  291. // this.initOperatorList();
  292. })
  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. width: 420rpx;
  323. float: left;
  324. font-size: $font-size-32;
  325. color: $text-color;
  326. line-height: 92rpx;
  327. text-align: left;
  328. margin-left: 20rpx;
  329. -o-text-overflow: ellipsis;
  330. text-overflow: ellipsis;
  331. display: -webkit-box;
  332. word-break: break-all;
  333. -webkit-box-orient: vertical;
  334. -webkit-line-clamp: 1;
  335. overflow: hidden;
  336. }
  337. .head{
  338. width: 92rpx;
  339. height: 92rpx;
  340. border-radius: 14rpx;
  341. border: 1px solid #ebebeb;
  342. float: left;
  343. image{
  344. width: 92rpx;
  345. height: 92rpx;
  346. border-radius: 14rpx;
  347. }
  348. }
  349. }
  350. .operator-search{
  351. width: 100%;
  352. height: auto;
  353. .search-from{
  354. width: 300rpx;
  355. height: 40rpx;
  356. padding: 20rpx;
  357. background: $sub-bg-color;
  358. border-radius: 14rpx;
  359. position: relative;
  360. margin-bottom: 20rpx;
  361. float: left;
  362. &.name{
  363. width: 180rpx;
  364. margin-right: 20rpx;
  365. .input{
  366. width: 180rpx;
  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: 175rpx;
  389. padding: 0;
  390. background: #FFFFFF;
  391. .search-btn{
  392. width: 170rpx;
  393. height: 78rpx;
  394. border-radius: 14rpx;
  395. font-size: $font-size-28;
  396. color: #FFFFFF;
  397. line-height: 78rpx;
  398. background: $btn-confirm;
  399. }
  400. }
  401. .label{
  402. text-align: left;
  403. font-size: $font-size-28;
  404. color:$text-color;
  405. line-height: 40rpx;
  406. float: left;
  407. }
  408. }
  409. }
  410. }
  411. .operator-main{
  412. padding-top: 282rpx;
  413. padding-bottom: 120rpx;
  414. }
  415. .list{
  416. display: flex;
  417. align-items: center;
  418. width: 702rpx;
  419. height: 92rpx;
  420. padding: 24rpx;
  421. background: #FFFFFF;
  422. position: relative;
  423. border-bottom: 1px solid #EBEBEB;
  424. .list-left{
  425. display: flex;
  426. flex: 4;
  427. .list-head{
  428. width: 92rpx;
  429. height: 92rpx;
  430. border-radius: 14rpx;
  431. image{
  432. width: 92rpx;
  433. height: 92rpx;
  434. border-radius: 14rpx;
  435. }
  436. }
  437. .list-tel{
  438. margin-left: 18rpx;
  439. .txt{
  440. display: flex;
  441. flex: 1;
  442. font-size: $font-size-28;
  443. color: $text-color;
  444. line-height: 46rpx;
  445. }
  446. }
  447. }
  448. .list-opea{
  449. flex:6;
  450. .opea-type{
  451. flex-direction: column;
  452. align-items: center;
  453. margin-left: 35rpx;
  454. float: left;
  455. .opea-type-cell{
  456. width: 186rpx;
  457. height: 64rpx;
  458. padding:0 16rpx;
  459. border-radius: 10rpx;
  460. border: 1px solid #DDDDDD;
  461. line-height: 64rpx;
  462. font-size: $font-size-24;
  463. .icon-iconfontweixin{
  464. margin-right: 8rpx;
  465. font-size: $font-size-32;
  466. }
  467. &.none{
  468. text-align: center;
  469. }
  470. }
  471. }
  472. .opea-del{
  473. float: right;
  474. flex-direction: column;
  475. align-items: center;
  476. .opea-type-cell{
  477. width: 86rpx;
  478. height: 64rpx;
  479. padding:0 24rpx;
  480. border-radius: 10rpx;
  481. border: 1px solid #DDDDDD;
  482. line-height: 64rpx;
  483. font-size: $font-size-24;
  484. color: #FF0000;
  485. .icon-shanchu{
  486. font-size: $font-size-32;
  487. margin-right: 6rpx;
  488. }
  489. }
  490. }
  491. }
  492. }
  493. .operator-model{
  494. width: 100%;
  495. height: 100%;
  496. background: rgba(0,0,0,.1);
  497. position: fixed;
  498. top: 0;
  499. left: 0;
  500. bottom: 0;
  501. right: 0;
  502. margin: auto;
  503. z-index: 1000;
  504. .operator-alert{
  505. width: 435rpx;
  506. height: 360rpx;
  507. padding: 68rpx 32rpx;
  508. background: #FFFFFF;
  509. border-radius: 14rpx;
  510. position: absolute;
  511. top: 0;
  512. left: 0;
  513. bottom: 0;
  514. right: 0;
  515. margin: auto;
  516. z-index: 1001;
  517. .icon-iconfontguanbi{
  518. width: 68rpx;
  519. height: 68rpx;
  520. text-align: center;
  521. line-height: 68rpx;
  522. position: absolute;
  523. right: 0;
  524. top: 0;
  525. font-size: $font-size-36;
  526. color: #999999;
  527. }
  528. .content{
  529. .ciew-t{
  530. font-size: $font-size-28;
  531. color: $text-color;
  532. line-height: 48rpx;
  533. }
  534. }
  535. .btn{
  536. width: 100%;
  537. height: 68rpx;
  538. border-top: 1px solid #F7F7F7;
  539. line-height: 68rpx;
  540. font-size: $font-size-26;
  541. text-align: center;
  542. color: $color-system;
  543. position: absolute;
  544. bottom:0 ;
  545. left: 0;
  546. }
  547. }
  548. }
  549. .operator-btn{
  550. position: fixed;
  551. width: 100%;
  552. height: 140rpx;
  553. left: 0;
  554. bottom: 0;
  555. background: #FFFFFF;
  556. z-index: 95;
  557. display: flex;
  558. align-items: center;
  559. justify-content: center;
  560. .add-btn{
  561. width: 702rpx;
  562. height: 88rpx;
  563. font-size: $font-size-28;
  564. line-height: 88rpx;
  565. color: #FFFFFF;
  566. text-align: center;
  567. background: $btn-confirm;
  568. border-radius: 14rpx;
  569. }
  570. }
  571. .adds-btn{
  572. width: 702rpx;
  573. height: 88rpx;
  574. font-size: 28rpx;
  575. line-height: 88rpx;
  576. color: #FFFFFF;
  577. margin: 0 auto;
  578. text-align: center;
  579. background: #000000;
  580. border-radius: 14rpx;
  581. }
  582. </style>