list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  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/logo@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. <view class="label">姓名:</view>
  12. <input class="input" type="text" v-model="linkman" placeholder="请输入姓名" maxlength="6"/>
  13. </view>
  14. <view class="search-from phone">
  15. <view class="label">手机号:</view>
  16. <input class="input" type="text" v-model="clubMobile" placeholder="请输入手机号" maxlength="11"/>
  17. </view>
  18. </view>
  19. <view class="search-wrap">
  20. <button class="search-btn" type="default" @click.stop="searchOpertor">搜索</button>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="operator-main">
  25. <view v-if="isEmpty" class="empty-container">
  26. <view class="txt">暂无运营人员</view>
  27. <view class="add-btn" @click="this.$api.navigateTo('/pages/user/operator/addoperator')">添加运营人员</view>
  28. </view>
  29. <view v-else class="operator-list">
  30. <scroll-view scroll-y="true">
  31. <view class="list" v-for="(item, index) in operatorList" :key="index" @click.stop="showOperatorModel(item)">
  32. <view class="list-left">
  33. <view class="list-head"><image :src="item.image" mode=""></image></view>
  34. <view class="list-tel">
  35. <text class="txt">{{item.name}}</text>
  36. <text class="txt">{{item.mobile}}</text>
  37. </view>
  38. </view>
  39. <view class="list-opea">
  40. <view class="opea-type">
  41. <view class="opea-type-cell" v-if="item.status != '0'">
  42. <text class="iconfont icon-iconfontweixin" :style="{color: iconStautsColor(item.status)}"></text>
  43. <text :style="{color: rexpStautsColor(item.status)}">{{ rexpStautsText(item.status) }}</text>
  44. </view>
  45. </view>
  46. <view class="opea-del">
  47. <view class="opea-type-cell" @click.stop="deleteOperator(item)">
  48. <text class="iconfont icon-shanchu"></text>
  49. <text>删除</text>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </scroll-view>
  55. <view class="add-btn" @click="this.$api.navigateTo('/pages/user/operator/addoperator')">添加运营人员</view>
  56. </view>
  57. </view>
  58. <view class="operator-model" v-if="isOperatorModel" @click.stop="closeModel">
  59. <view class="operator-alert">
  60. <text class="iconfont icon-iconfontguanbi" @click.stop="closeModel"></text>
  61. <view class="content">
  62. <view class="ciew-t">姓名:{{modelData.name}}</view>
  63. <view class="ciew-t">手机号:{{modelData.mobile}}</view>
  64. <view class="ciew-t">邀请码:{{modelData.code ? modelData.code : '无'}}<text :style="{color: rexpStautsColor(modelData.status)}">{{modelStautsText(modelData.status)}}</text></view>
  65. <view class="ciew-t">邀请码有效期:{{modelData.time}}</view>
  66. <view class="ciew-t">状态:{{modelData.status == '2' ? '已绑定' : '未绑定'}}</view>
  67. <view class="ciew-t">添加时间:{{modelData.addtime}}</view>
  68. <view class="ciew-t">绑定时间:{{modelData.bindtime}}</view>
  69. </view>
  70. <view class="btn" v-if="modelData.status != '2'" @click.stop="updateInvitationCode">更新邀请码</view>
  71. </view>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import authorize from '@/common/config/authorize.js'
  77. import modelAlert from '@/components/module/modelAlert/modelAlert.vue'
  78. import { queryOperatorList, deleteOperator , updateCode } from "@/api/operator.js"
  79. export default {
  80. components:{
  81. modelAlert
  82. },
  83. data() {
  84. return {
  85. clubName:'采美商城采购机构按时',
  86. isSelect:false,
  87. isEmpty:false,
  88. isLoadMore:false,
  89. alertText:'确定要删除该地址?',
  90. userID:'',
  91. pageNum:1,
  92. pageSize:10,
  93. addressList: [],
  94. hasNextPage:false,
  95. allowDataStatus:true,
  96. wrapperHeight:'100%',
  97. scrollHeight:'',
  98. deleteAddressId:'',
  99. currPage:'',//当前页面
  100. prevPage:'',//上一个页面
  101. isOperatorModel:false,
  102. operatorList:[
  103. {
  104. image:'../../../static/temp/logo@3x.png',
  105. name:'张三',
  106. mobile:'18888888888',
  107. status:'1',
  108. code:'456789',
  109. time:'5',
  110. static:'1',
  111. addtime:'2020-03-18 23:48:56',
  112. bindtime:'2020-03-18 23:48:56',
  113. },
  114. {
  115. image:'../../../static/temp/logo@3x.png',
  116. name:'张三',
  117. mobile:'18888888888',
  118. status:'2',
  119. code:'456789',
  120. time:'5',
  121. addtime:'2020-03-18 23:48:56',
  122. bindtime:'2020-03-18 23:48:56',
  123. },
  124. {
  125. image:'../../../static/temp/logo@3x.png',
  126. name:'张三',
  127. mobile:'18888888888',
  128. status:'3',
  129. code:'456789',
  130. time:'5',
  131. addtime:'2020-03-18 23:48:56',
  132. bindtime:'2020-03-18 23:48:56',
  133. },
  134. {
  135. image:'../../../static/temp/logo@3x.png',
  136. name:'张三',
  137. mobile:'18888888888',
  138. status:'0',
  139. code:'',
  140. time:'5',
  141. addtime:'2020-03-18 23:48:56',
  142. bindtime:'2020-03-18 23:48:56',
  143. },
  144. ],
  145. modelData:''
  146. }
  147. },
  148. onLoad(option){
  149. if(option.type=='select'){this.isSelect = true;}
  150. this.setScrollHeight();
  151. },
  152. onReachBottom() {
  153. // console.log('滑动到页面底部')
  154. if(this.isLoadMore) {
  155. // this.initAddressList();
  156. }
  157. },
  158. methods: {
  159. setScrollHeight() {
  160. // 窗口高度 - 底部距离
  161. setTimeout(()=> {
  162. const query = wx.createSelectorQuery().in(this);
  163. query.selectAll('.add-btn').boundingClientRect();
  164. query.exec(res => {
  165. if(res[0][0]){
  166. let winHeight = this.$api.getWindowHeight(),
  167. eleTop = res[0][0].top - 1;
  168. this.scrollHeight = eleTop;
  169. }
  170. })
  171. }, 500)
  172. },
  173. searchOpertor(){
  174. this.initAddressList()
  175. },
  176. initAddressList(){
  177. queryOperatorList({status:2,pageNum:this.pageNum,pageSize:this.pageSize}).then(response =>{
  178. if(response.results == ''){
  179. this.isEmpty = true
  180. }else{
  181. this.isEmpty = false
  182. let results =[];
  183. results = response.results;
  184. this.addressList = this.addressList.concat(results);
  185. this.pageNum = response.index +1;
  186. if(this.pageNum === response.totalPage + 1 ){
  187. this.isLoadMore = false;
  188. } else {
  189. this.isLoadMore = true;
  190. }
  191. }
  192. }).catch(response =>{
  193. this.$util.msg(response.msg,2000);
  194. })
  195. },
  196. showOperatorModel(item){
  197. console.log(item)
  198. this.isOperatorModel = true
  199. this.modelData = item
  200. },
  201. closeModel(){
  202. this.isOperatorModel = false
  203. },
  204. deleteOperator(id){//删除运营人员
  205. console.log('删除地址的ID',id)
  206. this.$util.modal('','确定删除运营人员吗?','确定删除','取消',true,() =>{
  207. deleteOperator({id:id}).then(response =>{
  208. this.$util.msg('删除成功',2000);
  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. }).catch(response =>{
  220. this.$util.msg(response.msg,2000);
  221. })
  222. })
  223. },
  224. rexpStautsText(status) {
  225. let text = ''
  226. switch (status) {
  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(status) {
  240. let text = ''
  241. switch (status) {
  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. onShow() {
  280. this.pageNum = 1;
  281. this.addressList = [];
  282. this.initAddressList();
  283. var pages = getCurrentPages();
  284. var prevPage = pages[pages.length - 2]; //上一个页面
  285. // prevPage.setData({select:''})
  286. }
  287. }
  288. </script>
  289. <style lang='scss'>
  290. page {
  291. height: auto;
  292. }
  293. page,.container{
  294. /* padding-bottom: 120upx; */
  295. background: #F7F7F7;
  296. border-top: 1px solid #EBEBEB;
  297. }
  298. .container{
  299. position: relative;
  300. }
  301. .operator-top{
  302. width: 702rpx;
  303. padding: 0 24rpx;
  304. height: auto;
  305. background: #FFFFFF;
  306. margin-bottom: 24rpx;
  307. .operator-title{
  308. width: 100%;
  309. height: 92rpx;
  310. padding: 34rpx 0;
  311. .title{
  312. float: left;
  313. font-size: $font-size-36;
  314. color: $text-color;
  315. line-height: 92rpx;
  316. text-align: left;
  317. margin-left: 20rpx;
  318. }
  319. .head{
  320. width: 92rpx;
  321. height: 92rpx;
  322. border-radius: 50%;
  323. border: 1px solid $color-system;
  324. float: left;
  325. image{
  326. width: 92rpx;
  327. height: 92rpx;
  328. border-radius: 50%;
  329. }
  330. }
  331. }
  332. .operator-search{
  333. width: 100%;
  334. height: auto;
  335. .search-from{
  336. width: 300rpx;
  337. height: 40rpx;
  338. padding: 24rpx;
  339. background: $sub-bg-color;
  340. border-radius: 14rpx;
  341. position: relative;
  342. margin-bottom: 20rpx;
  343. float: left;
  344. &.name{
  345. width: 260rpx;
  346. margin-right: 20rpx;
  347. .input{
  348. width: 180rpx;
  349. padding-left:10rpx;
  350. font-size: $font-size-28;
  351. color: $text-color;
  352. line-height: 40rpx;
  353. float: left;
  354. height: 40rpx;
  355. }
  356. }
  357. &.phone{
  358. width: 324rpx;
  359. .input{
  360. width: 220rpx;
  361. padding-left:10rpx;
  362. font-size: $font-size-28;
  363. color: $text-color;
  364. line-height: 40rpx;
  365. float: left;
  366. height: 40rpx;
  367. }
  368. }
  369. .label{
  370. text-align: left;
  371. font-size: $font-size-28;
  372. color:$text-color;
  373. line-height: 40rpx;
  374. float: left;
  375. }
  376. }
  377. .search-btn{
  378. width: 702rpx;
  379. height: 88rpx;
  380. border: 1px solid $color-system;
  381. border-radius: 14rpx;
  382. font-size: $font-size-28;
  383. color: $color-system;
  384. line-height: 88rpx;
  385. }
  386. }
  387. }
  388. .list{
  389. display: flex;
  390. align-items: center;
  391. width: 702rpx;
  392. height: 92rpx;
  393. padding: 24rpx;
  394. background: #FFFFFF;
  395. position: relative;
  396. border-bottom: 1px solid #EBEBEB;
  397. .list-left{
  398. display: flex;
  399. flex: 4;
  400. .list-head{
  401. width: 92rpx;
  402. height: 92rpx;
  403. border: 1px solid $color-system;
  404. border-radius: 50%;
  405. image{
  406. width: 92rpx;
  407. height: 92rpx;
  408. border-radius: 50%;
  409. }
  410. }
  411. .list-tel{
  412. margin-left: 18rpx;
  413. .txt{
  414. display: flex;
  415. flex: 1;
  416. font-size: $font-size-28;
  417. color: $text-color;
  418. line-height: 46rpx;
  419. }
  420. }
  421. }
  422. .list-opea{
  423. flex:6;
  424. .opea-type{
  425. flex-direction: column;
  426. align-items: center;
  427. margin-left: 20rpx;
  428. float: left;
  429. .opea-type-cell{
  430. width: 186rpx;
  431. height: 64rpx;
  432. padding:0 16rpx;
  433. border-radius: 10rpx;
  434. border: 1px solid #DDDDDD;
  435. line-height: 64rpx;
  436. font-size: $font-size-24;
  437. .icon-iconfontweixin{
  438. margin-right: 8rpx;
  439. font-size: $font-size-32;
  440. }
  441. }
  442. }
  443. .opea-del{
  444. float: right;
  445. flex-direction: column;
  446. align-items: center;
  447. .opea-type-cell{
  448. width: 86rpx;
  449. height: 64rpx;
  450. padding:0 24rpx;
  451. border-radius: 10rpx;
  452. border: 1px solid #DDDDDD;
  453. line-height: 64rpx;
  454. font-size: $font-size-24;
  455. color: #FF0000;
  456. .icon-shanchu{
  457. font-size: $font-size-32;
  458. margin-right: 6rpx;
  459. }
  460. }
  461. }
  462. }
  463. }
  464. .operator-model{
  465. width: 100%;
  466. height: 100%;
  467. background: rgba(0,0,0,.1);
  468. position: fixed;
  469. top: 0;
  470. left: 0;
  471. bottom: 0;
  472. right: 0;
  473. margin: auto;
  474. z-index: 992;
  475. .operator-alert{
  476. width: 430rpx;
  477. height: 376rpx;
  478. padding: 68rpx 32rpx;
  479. background: #FFFFFF;
  480. border-radius: 14rpx;
  481. position: absolute;
  482. top: 0;
  483. left: 0;
  484. bottom: 0;
  485. right: 0;
  486. margin: auto;
  487. z-index: 999;
  488. .icon-iconfontguanbi{
  489. width: 68rpx;
  490. height: 68rpx;
  491. text-align: center;
  492. line-height: 68rpx;
  493. position: absolute;
  494. right: 0;
  495. top: 0;
  496. font-size: $font-size-36;
  497. color: #999999;
  498. }
  499. .content{
  500. .ciew-t{
  501. font-size: $font-size-28;
  502. color: $text-color;
  503. line-height: 48rpx;
  504. }
  505. }
  506. .btn{
  507. width: 100%;
  508. height: 68rpx;
  509. border-top: 1px solid #F7F7F7;
  510. line-height: 68rpx;
  511. font-size: $font-size-26;
  512. text-align: center;
  513. color: $color-system;
  514. position: absolute;
  515. bottom:0 ;
  516. left: 0;
  517. }
  518. }
  519. }
  520. .add-btn{
  521. position: fixed;
  522. left: 24rpx;
  523. right: 24rpx;
  524. bottom: 34rpx;
  525. z-index: 95;
  526. display: flex;
  527. align-items: center;
  528. justify-content: center;
  529. width: 702rpx;
  530. height: 88rpx;
  531. font-size: $font-size-28;
  532. line-height: 88rpx;
  533. color: #FFFFFF;
  534. text-align: center;
  535. background: $btn-confirm;
  536. border-radius: 14rpx;
  537. }
  538. .adds-btn{
  539. width: 702rpx;
  540. height: 88rpx;
  541. font-size: 28rpx;
  542. line-height: 88rpx;
  543. color: #FFFFFF;
  544. margin: 0 auto;
  545. text-align: center;
  546. background: #000000;
  547. border-radius: 14rpx;
  548. }
  549. </style>