list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  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">搜索</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. <!-- 删除弹窗 -->
  74. <model-alert v-if="isShowDelModal"
  75. :alertText='alertText'
  76. @btnConfirm ='confirmDetele'>
  77. </model-alert>
  78. </view>
  79. </template>
  80. <script>
  81. import authorize from '@/common/config/authorize.js'
  82. import modelAlert from '@/components/module/modelAlert/modelAlert.vue'
  83. export default {
  84. components:{
  85. modelAlert
  86. },
  87. data() {
  88. return {
  89. clubName:'采美商城采购机构按时',
  90. isSelect:false,
  91. isEmpty:false,
  92. isLoadMore:false,
  93. alertText:'确定要删除该地址?',
  94. userID:'',
  95. pageNum:1,
  96. pageSize:10,
  97. addressList: [],
  98. hasNextPage:false,
  99. allowDataStatus:true,
  100. isShowDelModal:false,
  101. wrapperHeight:'100%',
  102. scrollHeight:'',
  103. deleteAddressId:'',
  104. currPage:'',//当前页面
  105. prevPage:'',//上一个页面
  106. isOperatorModel:false,
  107. operatorList:[
  108. {
  109. image:'../../../static/temp/logo@3x.png',
  110. name:'张三',
  111. mobile:'18888888888',
  112. status:'1',
  113. code:'456789',
  114. time:'5',
  115. static:'1',
  116. addtime:'2020-03-18 23:48:56',
  117. bindtime:'2020-03-18 23:48:56',
  118. },
  119. {
  120. image:'../../../static/temp/logo@3x.png',
  121. name:'张三',
  122. mobile:'18888888888',
  123. status:'2',
  124. code:'456789',
  125. time:'5',
  126. addtime:'2020-03-18 23:48:56',
  127. bindtime:'2020-03-18 23:48:56',
  128. },
  129. {
  130. image:'../../../static/temp/logo@3x.png',
  131. name:'张三',
  132. mobile:'18888888888',
  133. status:'3',
  134. code:'456789',
  135. time:'5',
  136. addtime:'2020-03-18 23:48:56',
  137. bindtime:'2020-03-18 23:48:56',
  138. },
  139. {
  140. image:'../../../static/temp/logo@3x.png',
  141. name:'张三',
  142. mobile:'18888888888',
  143. status:'0',
  144. code:'',
  145. time:'5',
  146. addtime:'2020-03-18 23:48:56',
  147. bindtime:'2020-03-18 23:48:56',
  148. },
  149. ],
  150. modelData:''
  151. }
  152. },
  153. onLoad(option){
  154. if(option.type=='select'){this.isSelect = true;}
  155. this.setScrollHeight();
  156. },
  157. onReachBottom() {
  158. // console.log('滑动到页面底部')
  159. if(this.isLoadMore) {
  160. // this.initAddressList();
  161. }
  162. },
  163. methods: {
  164. setScrollHeight() {
  165. // 窗口高度 - 底部距离
  166. setTimeout(()=> {
  167. const query = wx.createSelectorQuery().in(this);
  168. query.selectAll('.add-btn').boundingClientRect();
  169. query.exec(res => {
  170. if(res[0][0]){
  171. let winHeight = this.$api.getWindowHeight(),
  172. eleTop = res[0][0].top - 1;
  173. this.scrollHeight = eleTop;
  174. }
  175. })
  176. }, 500)
  177. },
  178. initAddressList(){
  179. this.$api.getStorage().then((resolve) =>{
  180. this.userID = resolve.userID
  181. this.$api.get('/personal/findAddress',{index:this.pageNum,pageSize:this.pageSize,userID:this.userID},
  182. response => {
  183. if(response.results == ''){
  184. this.isEmpty = true
  185. }else{
  186. this.isEmpty = false
  187. let results =[];
  188. results = response.results;
  189. this.addressList = this.addressList.concat(results);
  190. this.pageNum = response.index +1;
  191. if(this.pageNum === response.totalPage + 1 ){
  192. this.isLoadMore = false;
  193. } else {
  194. this.isLoadMore = true;
  195. }
  196. }
  197. }
  198. )
  199. })
  200. },
  201. showOperatorModel(item){
  202. console.log(item)
  203. this.isOperatorModel = true
  204. this.modelData = item
  205. },
  206. closeModel(){
  207. this.isOperatorModel = false
  208. },
  209. deleteOperator(id){//删除运营人员
  210. console.log('删除地址的ID',id)
  211. this.$util.modal('提示','确定删除运营人员吗?',true,() =>{
  212. this.$util.msg('删除成功',3000);
  213. this.isOperatorModel = false
  214. })
  215. // this.isShowDelModal = true;
  216. // this.deleteAddressId =id;
  217. },
  218. updateInvitationCode(){ //更新邀请码
  219. this.$util.modal('提示','确定更新邀请码并发送给运营人员?',true,() =>{
  220. this.$util.msg('更新邀请码成功',3000);
  221. this.isOperatorModel = false
  222. })
  223. },
  224. confirmDetele(){
  225. authorize.getCode('weixin').then(wechatcode =>{
  226. this.$api.get('/personal/delete?code='+`${wechatcode}`,{addressID:this.deleteAddressId,userOrganizeID:this.userOrganizeID},
  227. response => {
  228. if(response.code==1){
  229. uni.showToast({
  230. icon: 'none',
  231. title: response.msg,
  232. duration: 2000
  233. })
  234. this.isShowDelModal = false;
  235. this.pageNum = 1;
  236. this.addressList = [];
  237. this.initAddressList();
  238. }else{
  239. this.$util.msg(response.msg,3000);
  240. this.isShowDelModal = false;
  241. setTimeout(function(){
  242. uni.switchTab({
  243. url:'/pages/tabBar/home/home'
  244. })
  245. },1000)
  246. }
  247. }
  248. )
  249. })
  250. },
  251. rexpStautsText(status) {
  252. let text = ''
  253. switch (status) {
  254. case '1':
  255. text = '邀请码有效'
  256. break
  257. case '2':
  258. text = '邀请码已使用'
  259. break
  260. case '3':
  261. text = '邀请码已过期'
  262. break
  263. }
  264. return text
  265. },
  266. modelStautsText(status) {
  267. let text = ''
  268. switch (status) {
  269. case '1':
  270. text = '(有效)'
  271. break
  272. case '2':
  273. text = '(已使用)'
  274. break
  275. case '3':
  276. text = '(已过期)'
  277. break
  278. }
  279. return text
  280. },
  281. rexpStautsColor(status) {
  282. let textColor = ''
  283. switch (status) {
  284. case '1':
  285. textColor = '#55BB00'
  286. break
  287. case '2':
  288. textColor = '#0056BB'
  289. break
  290. case '3':
  291. textColor = '#BB0000'
  292. break
  293. }
  294. return textColor
  295. },
  296. iconStautsColor(status) {
  297. let textColor = ''
  298. if(status == '2'){
  299. textColor = '#09BB07'
  300. }else{
  301. textColor = '#DDDDDD'
  302. }
  303. return textColor
  304. },
  305. },
  306. onShow() {
  307. this.pageNum = 1;
  308. this.addressList = [];
  309. this.initAddressList();
  310. var pages = getCurrentPages();
  311. var prevPage = pages[pages.length - 2]; //上一个页面
  312. // prevPage.setData({select:''})
  313. }
  314. }
  315. </script>
  316. <style lang='scss'>
  317. page {
  318. height: auto;
  319. }
  320. page,.container{
  321. /* padding-bottom: 120upx; */
  322. background: #F7F7F7;
  323. border-top: 1px solid #EBEBEB;
  324. }
  325. .container{
  326. position: relative;
  327. }
  328. .operator-top{
  329. width: 702rpx;
  330. padding: 0 24rpx;
  331. height: auto;
  332. background: #FFFFFF;
  333. margin-bottom: 24rpx;
  334. .operator-title{
  335. width: 100%;
  336. height: 92rpx;
  337. padding: 34rpx 0;
  338. .title{
  339. float: left;
  340. font-size: $font-size-36;
  341. color: $text-color;
  342. line-height: 92rpx;
  343. text-align: left;
  344. margin-left: 20rpx;
  345. }
  346. .head{
  347. width: 92rpx;
  348. height: 92rpx;
  349. border-radius: 50%;
  350. border: 1px solid $color-system;
  351. float: left;
  352. image{
  353. width: 92rpx;
  354. height: 92rpx;
  355. border-radius: 50%;
  356. }
  357. }
  358. }
  359. .operator-search{
  360. width: 100%;
  361. height: auto;
  362. .search-from{
  363. width: 300rpx;
  364. height: 40rpx;
  365. padding: 24rpx;
  366. background: $sub-bg-color;
  367. border-radius: 14rpx;
  368. position: relative;
  369. margin-bottom: 20rpx;
  370. float: left;
  371. &.name{
  372. width: 260rpx;
  373. margin-right: 20rpx;
  374. .input{
  375. width: 180rpx;
  376. padding-left:10rpx;
  377. font-size: $font-size-28;
  378. color: $text-color;
  379. line-height: 40rpx;
  380. float: left;
  381. height: 40rpx;
  382. }
  383. }
  384. &.phone{
  385. width: 324rpx;
  386. .input{
  387. width: 220rpx;
  388. padding-left:10rpx;
  389. font-size: $font-size-28;
  390. color: $text-color;
  391. line-height: 40rpx;
  392. float: left;
  393. height: 40rpx;
  394. }
  395. }
  396. .label{
  397. text-align: left;
  398. font-size: $font-size-28;
  399. color:$text-color;
  400. line-height: 40rpx;
  401. float: left;
  402. }
  403. }
  404. .search-btn{
  405. width: 702rpx;
  406. height: 88rpx;
  407. border: 1px solid $color-system;
  408. border-radius: 14rpx;
  409. font-size: $font-size-28;
  410. color: $color-system;
  411. line-height: 88rpx;
  412. }
  413. }
  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: 1px solid $color-system;
  431. border-radius: 50%;
  432. image{
  433. width: 92rpx;
  434. height: 92rpx;
  435. border-radius: 50%;
  436. }
  437. }
  438. .list-tel{
  439. margin-left: 18rpx;
  440. .txt{
  441. display: flex;
  442. flex: 1;
  443. font-size: $font-size-28;
  444. color: $text-color;
  445. line-height: 46rpx;
  446. }
  447. }
  448. }
  449. .list-opea{
  450. flex:6;
  451. .opea-type{
  452. flex-direction: column;
  453. align-items: center;
  454. margin-left: 20rpx;
  455. float: left;
  456. .opea-type-cell{
  457. width: 186rpx;
  458. height: 64rpx;
  459. padding:0 16rpx;
  460. border-radius: 10rpx;
  461. border: 1px solid #DDDDDD;
  462. line-height: 64rpx;
  463. font-size: $font-size-24;
  464. .icon-iconfontweixin{
  465. margin-right: 8rpx;
  466. font-size: $font-size-32;
  467. }
  468. }
  469. }
  470. .opea-del{
  471. float: right;
  472. flex-direction: column;
  473. align-items: center;
  474. .opea-type-cell{
  475. width: 86rpx;
  476. height: 64rpx;
  477. padding:0 24rpx;
  478. border-radius: 10rpx;
  479. border: 1px solid #DDDDDD;
  480. line-height: 64rpx;
  481. font-size: $font-size-24;
  482. color: #FF0000;
  483. .icon-shanchu{
  484. font-size: $font-size-32;
  485. margin-right: 6rpx;
  486. }
  487. }
  488. }
  489. }
  490. }
  491. .operator-model{
  492. width: 100%;
  493. height: 100%;
  494. background: rgba(0,0,0,.1);
  495. position: fixed;
  496. top: 0;
  497. left: 0;
  498. bottom: 0;
  499. right: 0;
  500. margin: auto;
  501. z-index: 992;
  502. .operator-alert{
  503. width: 430rpx;
  504. height: 376rpx;
  505. padding: 68rpx 32rpx;
  506. background: #FFFFFF;
  507. border-radius: 14rpx;
  508. position: absolute;
  509. top: 0;
  510. left: 0;
  511. bottom: 0;
  512. right: 0;
  513. margin: auto;
  514. z-index: 999;
  515. .icon-iconfontguanbi{
  516. width: 68rpx;
  517. height: 68rpx;
  518. text-align: center;
  519. line-height: 68rpx;
  520. position: absolute;
  521. right: 0;
  522. top: 0;
  523. font-size: $font-size-36;
  524. color: #999999;
  525. }
  526. .content{
  527. .ciew-t{
  528. font-size: $font-size-28;
  529. color: $text-color;
  530. line-height: 48rpx;
  531. }
  532. }
  533. .btn{
  534. width: 100%;
  535. height: 68rpx;
  536. border-top: 1px solid #F7F7F7;
  537. line-height: 68rpx;
  538. font-size: $font-size-26;
  539. text-align: center;
  540. color: $color-system;
  541. position: absolute;
  542. bottom:0 ;
  543. left: 0;
  544. }
  545. }
  546. }
  547. .add-btn{
  548. position: fixed;
  549. left: 24rpx;
  550. right: 24rpx;
  551. bottom: 34rpx;
  552. z-index: 95;
  553. display: flex;
  554. align-items: center;
  555. justify-content: center;
  556. width: 702rpx;
  557. height: 88rpx;
  558. font-size: $font-size-28;
  559. line-height: 88rpx;
  560. color: #FFFFFF;
  561. text-align: center;
  562. background: $btn-confirm;
  563. border-radius: 14rpx;
  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>