list.vue 14 KB

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