list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  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="addAddress('add')">添加运营人员</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="addAddress('add')">添加运营人员</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. })
  213. // this.isShowDelModal = true;
  214. // this.deleteAddressId =id;
  215. },
  216. updateInvitationCode(){ //更新邀请码
  217. this.$util.modal('提示','确定更新邀请码并发送给运营人员?',true,() =>{
  218. })
  219. },
  220. confirmDetele(){
  221. authorize.getCode('weixin').then(wechatcode =>{
  222. this.$api.get('/personal/delete?code='+`${wechatcode}`,{addressID:this.deleteAddressId,userOrganizeID:this.userOrganizeID},
  223. response => {
  224. if(response.code==1){
  225. uni.showToast({
  226. icon: 'none',
  227. title: response.msg,
  228. duration: 2000
  229. })
  230. this.isShowDelModal = false;
  231. this.pageNum = 1;
  232. this.addressList = [];
  233. this.initAddressList();
  234. }else{
  235. this.$util.msg(response.msg,3000);
  236. this.isShowDelModal = false;
  237. setTimeout(function(){
  238. uni.switchTab({
  239. url:'/pages/tabBar/home/home'
  240. })
  241. },1000)
  242. }
  243. }
  244. )
  245. })
  246. },
  247. rexpStautsText(status) {
  248. let text = ''
  249. switch (status) {
  250. case '1':
  251. text = '邀请码有效'
  252. break
  253. case '2':
  254. text = '邀请码已使用'
  255. break
  256. case '3':
  257. text = '邀请码已过期'
  258. break
  259. }
  260. return text
  261. },
  262. modelStautsText(status) {
  263. let text = ''
  264. switch (status) {
  265. case '1':
  266. text = '(有效)'
  267. break
  268. case '2':
  269. text = '(已使用)'
  270. break
  271. case '3':
  272. text = '(已过期)'
  273. break
  274. }
  275. return text
  276. },
  277. rexpStautsColor(status) {
  278. let textColor = ''
  279. switch (status) {
  280. case '1':
  281. textColor = '#55BB00'
  282. break
  283. case '2':
  284. textColor = '#0056BB'
  285. break
  286. case '3':
  287. textColor = '#BB0000'
  288. break
  289. }
  290. return textColor
  291. },
  292. iconStautsColor(status) {
  293. let textColor = ''
  294. if(status == '2'){
  295. textColor = '#09BB07'
  296. }else{
  297. textColor = '#DDDDDD'
  298. }
  299. return textColor
  300. },
  301. },
  302. onShow() {
  303. this.pageNum = 1;
  304. this.addressList = [];
  305. this.initAddressList();
  306. var pages = getCurrentPages();
  307. var prevPage = pages[pages.length - 2]; //上一个页面
  308. // prevPage.setData({select:''})
  309. }
  310. }
  311. </script>
  312. <style lang='scss'>
  313. page {
  314. height: auto;
  315. }
  316. page,.container{
  317. /* padding-bottom: 120upx; */
  318. background: #F7F7F7;
  319. border-top: 1px solid #EBEBEB;
  320. }
  321. .container{
  322. position: relative;
  323. }
  324. .operator-top{
  325. width: 702rpx;
  326. padding: 0 24rpx;
  327. height: auto;
  328. background: #FFFFFF;
  329. margin-bottom: 24rpx;
  330. .operator-title{
  331. width: 100%;
  332. height: 92rpx;
  333. padding: 34rpx 0;
  334. .title{
  335. float: left;
  336. font-size: $font-size-36;
  337. color: $text-color;
  338. line-height: 92rpx;
  339. text-align: left;
  340. margin-left: 20rpx;
  341. }
  342. .head{
  343. width: 92rpx;
  344. height: 92rpx;
  345. border-radius: 50%;
  346. border: 1px solid $color-system;
  347. float: left;
  348. image{
  349. width: 92rpx;
  350. height: 92rpx;
  351. border-radius: 50%;
  352. }
  353. }
  354. }
  355. .operator-search{
  356. width: 100%;
  357. height: auto;
  358. .search-from{
  359. width: 300rpx;
  360. height: 40rpx;
  361. padding: 24rpx;
  362. background: $sub-bg-color;
  363. border-radius: 14rpx;
  364. position: relative;
  365. margin-bottom: 20rpx;
  366. float: left;
  367. &.name{
  368. width: 260rpx;
  369. margin-right: 20rpx;
  370. .input{
  371. width: 180rpx;
  372. padding-left:10rpx;
  373. font-size: $font-size-base;
  374. color: $text-color;
  375. line-height: 40rpx;
  376. float: left;
  377. height: 40rpx;
  378. }
  379. }
  380. &.phone{
  381. width: 324rpx;
  382. .input{
  383. width: 220rpx;
  384. padding-left:10rpx;
  385. font-size: $font-size-base;
  386. color: $text-color;
  387. line-height: 40rpx;
  388. float: left;
  389. height: 40rpx;
  390. }
  391. }
  392. .label{
  393. text-align: left;
  394. font-size: $font-size-base;
  395. color:$text-color;
  396. line-height: 40rpx;
  397. float: left;
  398. }
  399. }
  400. .search-btn{
  401. width: 702rpx;
  402. height: 88rpx;
  403. border: 1px solid $color-system;
  404. border-radius: 14rpx;
  405. font-size: $font-size-base;
  406. color: $color-system;
  407. line-height: 88rpx;
  408. }
  409. }
  410. }
  411. .list{
  412. display: flex;
  413. align-items: center;
  414. width: 702rpx;
  415. height: 92rpx;
  416. padding: 24rpx;
  417. background: #FFFFFF;
  418. position: relative;
  419. border-bottom: 1px solid #EBEBEB;
  420. .list-left{
  421. display: flex;
  422. flex: 4;
  423. .list-head{
  424. width: 92rpx;
  425. height: 92rpx;
  426. border: 1px solid $color-system;
  427. border-radius: 50%;
  428. image{
  429. width: 92rpx;
  430. height: 92rpx;
  431. border-radius: 50%;
  432. }
  433. }
  434. .list-tel{
  435. margin-left: 18rpx;
  436. .txt{
  437. display: flex;
  438. flex: 1;
  439. font-size: $font-size-base;
  440. color: $text-color;
  441. line-height: 46rpx;
  442. }
  443. }
  444. }
  445. .list-opea{
  446. flex:6;
  447. .opea-type{
  448. flex-direction: column;
  449. align-items: center;
  450. margin-left: 20rpx;
  451. float: left;
  452. .opea-type-cell{
  453. width: 186rpx;
  454. height: 64rpx;
  455. padding:0 16rpx;
  456. border-radius: 10rpx;
  457. border: 1px solid #DDDDDD;
  458. line-height: 64rpx;
  459. font-size: $font-size-sm;
  460. .icon-iconfontweixin{
  461. margin-right: 8rpx;
  462. font-size: $font-size-lg;
  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-sm;
  478. color: #FF0000;
  479. .icon-shanchu{
  480. font-size: $font-size-lg;
  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: 992;
  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: 999;
  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-base;
  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-sb;
  535. text-align: center;
  536. color: $color-system;
  537. position: absolute;
  538. bottom:0 ;
  539. left: 0;
  540. }
  541. }
  542. }
  543. .add-btn{
  544. position: fixed;
  545. left: 24rpx;
  546. right: 24rpx;
  547. bottom: 34rpx;
  548. z-index: 95;
  549. display: flex;
  550. align-items: center;
  551. justify-content: center;
  552. width: 702rpx;
  553. height: 88rpx;
  554. font-size: $font-size-base;
  555. line-height: 88rpx;
  556. color: #FFFFFF;
  557. text-align: center;
  558. background: $btn-confirm;
  559. border-radius: 14rpx;
  560. }
  561. .adds-btn{
  562. width: 702rpx;
  563. height: 88rpx;
  564. font-size: 28rpx;
  565. line-height: 88rpx;
  566. color: #FFFFFF;
  567. margin: 0 auto;
  568. text-align: center;
  569. background: #000000;
  570. border-radius: 14rpx;
  571. }
  572. </style>