list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  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="staticUrl + 'icon_default@3x.png'" mode=""></image></view>
  6. <view class="title">{{ clubName | nameFilters }}</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 :src="staticUrl + 'icon_default_opea@2x.png'" mode=""></image
  47. ></view>
  48. <view class="list-tel">
  49. <text class="txt">{{ item.linkName ? item.linkName : '' }}</text>
  50. <text class="txt">{{ item.mobile ? item.mobile : '' }}</text>
  51. </view>
  52. </view>
  53. <view class="list-opea">
  54. <view class="opea-type">
  55. <view
  56. class="opea-type-cell"
  57. v-if="item.effectiveFlag"
  58. :class="{
  59. success: item.effectiveFlag == 1,
  60. warning: item.effectiveFlag == 2,
  61. warning: item.effectiveFlag == 3
  62. }"
  63. >
  64. <text class="iconfont icon-weixin"></text>
  65. <text>{{ item.effectiveFlag | rexpStautsFilters }} </text>
  66. </view>
  67. <view class="opea-type-cell none" v-else> <text>- -</text> </view>
  68. </view>
  69. <view class="opea-del">
  70. <view class="opea-type-cell" @click.stop="handleOperator(1, item)">
  71. <text class="iconfont icon-shanchu1"></text> <text>删除</text>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. <!--加载loadding-->
  77. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  78. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#ffffff'" :text="nomoreText"></tui-nomore>
  79. <!--加载loadding-->
  80. </scroll-view>
  81. </view>
  82. </view>
  83. <div class="operator-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }">
  84. <view class="add-btn" @click="this.$api.navigateTo('/pages/user/operator/form')">添加运营人员</view>
  85. </div>
  86. <view class="operator-model" v-if="isOperatorModel" @click.stop="closeModel">
  87. <view class="operator-alert">
  88. <text class="iconfont icon-iconfontguanbi" @click.stop="closeModel"></text>
  89. <view class="content">
  90. <view class="ciew-t"><text>姓名:</text>{{ modelData.linkName }}</view>
  91. <view class="ciew-t"><text>手机号:</text>{{ modelData.mobile ? modelData.mobile : '--' }}</view>
  92. <view class="ciew-t"
  93. ><text>邀请码:</text>{{ modelData.invitationCode ? modelData.invitationCode : '--' }}
  94. <text
  95. :class="{
  96. success: modelData.status == 1,
  97. warning: modelData.status == 2,
  98. warning: modelData.status == 3
  99. }"
  100. >{{ modelData.effectiveFlag | modelStautsFilters }}</text
  101. >
  102. </view>
  103. <view class="ciew-t"
  104. ><text>邀请码有效期:</text
  105. >{{ modelData.effectiveDays ? modelData.effectiveDays : '0' }}天</view
  106. >
  107. <view class="ciew-t"><text>状态:</text>{{ modelData.status === 2 ? '已绑定' : '未绑定' }}</view>
  108. <view class="ciew-t"><text>添加时间:</text>{{ modelData.addTime }}</view>
  109. <view class="ciew-t"
  110. ><text>绑定时间:</text>{{ modelData.bindTime ? modelData.bindTime : '--' }}</view
  111. >
  112. </view>
  113. <view class="alert-btn" v-if="modelData.status != 2" @click.stop="handleOperator(2, modelData)">
  114. <view class="btn">更新邀请码</view>
  115. </view>
  116. </view>
  117. </view>
  118. <!-- 提示弹窗 -->
  119. <tui-modal
  120. :show="model"
  121. @click="handleClick"
  122. @cancel="hideMobel"
  123. :content="contentModalText"
  124. :button="modalButton"
  125. color="#333"
  126. :size="28"
  127. shape="circle"
  128. :maskClosable="false"
  129. />
  130. </view>
  131. </template>
  132. <script>
  133. export default {
  134. data() {
  135. return {
  136. staticUrl: this.global.staticUrl,
  137. clubName: '',
  138. isEmpty: false,
  139. nomoreText: '上拉显示更多',
  140. hasNextPage: false,
  141. loadding: false,
  142. pullUpOn: true,
  143. pullFlag: true,
  144. scrollHeight: '',
  145. isOperatorModel: false,
  146. operatorList: [],
  147. isIphoneX: this.$store.state.isIphoneX,
  148. modelData: {},
  149. listQuery: {
  150. userId: '',
  151. linkName: '',
  152. mobile: '',
  153. pageNum: 1,
  154. pageSize: 10
  155. },
  156. model:false,
  157. contentModalText:'确定更新邀请码并发送给运营人员?',
  158. showModalType:0,
  159. showModalBtn:'确定更新',
  160. modalButton: [
  161. {
  162. text: '取消',
  163. type: 'gray',
  164. plain: true //是否空心
  165. },
  166. {
  167. text: this.showModalBtn,
  168. customStyle: {
  169. color: '#fff',
  170. bgColor: '#F28F31'
  171. },
  172. plain: false
  173. }
  174. ],
  175. handleOper:0
  176. }
  177. },
  178. filters: {
  179. nameFilters(value) {
  180. if (value && value.length > 15) {
  181. return value.substring(0, 15) + '...'
  182. } else {
  183. return value
  184. }
  185. },
  186. rexpStautsFilters(value) {
  187. const map = {
  188. '': '--',
  189. 1: '邀请码有效',
  190. 2: '邀请码已使用',
  191. 3: '邀请码已过期'
  192. }
  193. return map[value]
  194. },
  195. modelStautsFilters(value) {
  196. const map = {
  197. 1: '(有效)',
  198. 2: '(已使用)',
  199. 3: '(已过期)'
  200. }
  201. return map[value]
  202. }
  203. },
  204. onLoad() {
  205. this.setScrollHeight()
  206. },
  207. methods: {
  208. async infoClucbUser() {
  209. const user = await this.$api.getStorage()
  210. this.clubName = user.name
  211. this.listQuery.userId = user.userId
  212. this.listQuery.pageNum = 1
  213. this.InitOperatorList()
  214. },
  215. setScrollHeight() {
  216. // 窗口高度 - 底部距离
  217. setTimeout(() => {
  218. const query = wx.createSelectorQuery().in(this)
  219. query.selectAll('.add-btn').boundingClientRect()
  220. query.exec(res => {
  221. if (res[0][0]) {
  222. let winHeight = this.$api.getWindowHeight(),
  223. eleTop = res[0][0].top - 1
  224. this.scrollHeight = eleTop
  225. }
  226. })
  227. }, 500)
  228. },
  229. handSearchOpertor() {
  230. this.listQuery.pageNum = 1
  231. this.InitOperatorList()
  232. },
  233. InitOperatorList() {
  234. //查询机构运营人员列表
  235. this.UserService.QueryOperatorList(this.listQuery)
  236. .then(response => {
  237. let responseData = response.data
  238. if (responseData.results && responseData.results.length > 0) {
  239. this.isEmpty = false
  240. this.hasNextPage = response.data.hasNextPage
  241. this.operatorList = responseData.results
  242. this.pullFlag = false
  243. setTimeout(() => {
  244. this.pullFlag = true
  245. }, 500)
  246. if (this.hasNextPage) {
  247. this.pullUpOn = false
  248. this.nomoreText = '上拉显示更多'
  249. } else {
  250. this.pullUpOn = true
  251. this.loadding = false
  252. this.nomoreText = '已至底部'
  253. }
  254. } else {
  255. this.isEmpty = true
  256. }
  257. })
  258. .catch(error => {
  259. this.$util.msg(error.msg, 2000)
  260. })
  261. },
  262. getOnReachBottomData() {
  263. this.listQuery.pageNum += 1
  264. this.UserService.QueryOperatorList(this.listQuery)
  265. .then(response => {
  266. let responseData = response.data
  267. if (responseData.results && responseData.results.length > 0) {
  268. this.hasNextPage = response.data.hasNextPage
  269. this.operatorList = this.operatorList.concat(responseData.results)
  270. this.pullFlag = false // 防上拉暴滑
  271. setTimeout(() => {
  272. this.pullFlag = true
  273. }, 500)
  274. if (this.hasNextPage) {
  275. this.pullUpOn = false
  276. this.nomoreText = '上拉显示更多'
  277. } else {
  278. this.pullUpOn = false
  279. this.loadding = false
  280. this.nomoreText = '已至底部'
  281. }
  282. }
  283. })
  284. .catch(error => {
  285. this.$util.msg(error.msg, 2000)
  286. })
  287. },
  288. showOperatorModel(item) {
  289. this.isOperatorModel = true
  290. this.modelData = item
  291. },
  292. closeModel() {
  293. this.isOperatorModel = false
  294. },
  295. handleOperator(type,row){
  296. this.showModalType = type
  297. this.handleOper = row
  298. switch(type){
  299. case 1:
  300. this.showModalBtn = '确定删除'
  301. this.contentModalText = '确定删除运营人员吗?'
  302. break
  303. case 2:
  304. this.showModalBtn = '确定更新'
  305. this.contentModalText = '确定更新邀请码并发送给运营人员?'
  306. break
  307. }
  308. this.model = true
  309. },
  310. // 删除运营人员
  311. async deleteOperator(){
  312. try{
  313. const res = await this.UserService.PostDeleteOperator({ id: this.handleOper.id })
  314. this.$util.msg(res.msg, 2000, true, 'success')
  315. setTimeout(() => {
  316. this.InitOperatorList()
  317. }, 2000)
  318. }catch(error){
  319. this.$util.msg(error.msg, 2000)
  320. }
  321. },
  322. // 更新邀请码
  323. async updateInvitationCode(){
  324. try{
  325. const res = await this.UserService.PostUpdateOperatorCode({ id: this.handleOper.id, status: this.handleOper.status })
  326. this.isOperatorModel = false
  327. this.$util.msg(res.msg, 2000, true, 'success')
  328. setTimeout(() => {
  329. this.InitOperatorList()
  330. }, 2000)
  331. }catch(error){
  332. this.$util.msg(error.msg, 2000)
  333. }
  334. },
  335. handleClick(e){
  336. if (e.index === 1) {
  337. if (this.showModalType === 1) {
  338. // 删除
  339. this.deleteOperator()
  340. }else{
  341. // 更新
  342. this.updateInvitationCode()
  343. }
  344. }
  345. this.model = false
  346. },
  347. hideMobel(){
  348. this.model = false
  349. }
  350. },
  351. onReachBottom() {
  352. if (this.hasNextPage) {
  353. this.loadding = true
  354. this.pullUpOn = true
  355. this.getOnReachBottomData()
  356. }
  357. },
  358. onShareAppMessage(res) {
  359. //分享转发
  360. if (res.from === 'button') {
  361. // 来自页面内转发按钮
  362. }
  363. return {
  364. title: '联合丽格集采商城',
  365. path: 'pages/tabBar/home/index',
  366. imageUrl: `${this.staticUrl}icon_share_home@2x.png`
  367. }
  368. },
  369. onShow() {
  370. this.infoClucbUser()
  371. }
  372. }
  373. </script>
  374. <style lang="scss">
  375. page {
  376. height: auto;
  377. }
  378. page,
  379. .container {
  380. /* padding-bottom: 120upx; */
  381. background: #f7f7f7;
  382. border-top: 1px solid #ebebeb;
  383. }
  384. .container {
  385. position: relative;
  386. }
  387. .operator-top {
  388. width: 702rpx;
  389. padding: 0 24rpx;
  390. height: 282rpx;
  391. background: #ffffff;
  392. position: fixed;
  393. top: 0;
  394. left: 0;
  395. z-index: 999;
  396. .operator-title {
  397. width: 100%;
  398. height: 92rpx;
  399. padding: 34rpx 0;
  400. .title {
  401. float: left;
  402. font-size: $font-size-28;
  403. color: #666666;
  404. line-height: 92rpx;
  405. text-align: left;
  406. margin-left: 20rpx;
  407. }
  408. .head {
  409. width: 92rpx;
  410. height: 92rpx;
  411. border-radius: 50%;
  412. border: 1px solid #ebebeb;
  413. float: left;
  414. image {
  415. width: 92rpx;
  416. height: 92rpx;
  417. border-radius: 50%;
  418. }
  419. }
  420. }
  421. .operator-search {
  422. width: 100%;
  423. height: auto;
  424. .search-from {
  425. width: 300rpx;
  426. height: 40rpx;
  427. padding: 20rpx;
  428. background: $sub-bg-color;
  429. border-radius: 40rpx;
  430. position: relative;
  431. margin-bottom: 20rpx;
  432. float: left;
  433. &.name {
  434. width: 180rpx;
  435. margin-right: 20rpx;
  436. .input {
  437. width: 180rpx;
  438. font-size: $font-size-28;
  439. color: $text-color;
  440. line-height: 40rpx;
  441. float: left;
  442. height: 40rpx;
  443. }
  444. }
  445. &.phone {
  446. width: 228rpx;
  447. margin-right: 20rpx;
  448. .input {
  449. width: 228rpx;
  450. padding-left: 10rpx;
  451. font-size: $font-size-28;
  452. color: $text-color;
  453. line-height: 40rpx;
  454. float: left;
  455. height: 40rpx;
  456. }
  457. }
  458. &.search {
  459. width: 175rpx;
  460. padding: 0;
  461. background: #ffffff;
  462. .search-btn {
  463. width: 170rpx;
  464. height: 78rpx;
  465. border-radius: 39rpx;
  466. font-size: $font-size-28;
  467. color: #ffffff;
  468. line-height: 78rpx;
  469. background: $btn-confirm;
  470. }
  471. }
  472. .label {
  473. text-align: left;
  474. font-size: $font-size-28;
  475. color: $text-color;
  476. line-height: 40rpx;
  477. float: left;
  478. }
  479. }
  480. }
  481. }
  482. .operator-main {
  483. padding-top: 282rpx;
  484. padding-bottom: 120rpx;
  485. }
  486. .list {
  487. display: flex;
  488. align-items: center;
  489. width: 702rpx;
  490. height: 92rpx;
  491. padding: 24rpx;
  492. background: #ffffff;
  493. position: relative;
  494. border-bottom: 1px solid #ebebeb;
  495. .list-left {
  496. display: flex;
  497. flex: 4;
  498. .list-head {
  499. width: 92rpx;
  500. height: 92rpx;
  501. border-radius: 50%;
  502. image {
  503. width: 92rpx;
  504. height: 92rpx;
  505. border-radius: 50%;
  506. }
  507. }
  508. .list-tel {
  509. margin-left: 18rpx;
  510. .txt {
  511. display: flex;
  512. flex: 1;
  513. font-size: $font-size-28;
  514. color: $text-color;
  515. line-height: 46rpx;
  516. }
  517. }
  518. }
  519. .list-opea {
  520. flex: 6;
  521. .opea-type {
  522. flex-direction: column;
  523. align-items: center;
  524. margin-left: 35rpx;
  525. float: left;
  526. .opea-type-cell {
  527. width: 186rpx;
  528. height: 64rpx;
  529. padding: 0 16rpx;
  530. border-radius: 32rpx;
  531. border: 1px solid #dddddd;
  532. line-height: 64rpx;
  533. font-size: $font-size-24;
  534. &.success {
  535. border-color: #16b75b;
  536. color: #16b75b;
  537. .icon-weixin {
  538. color: #16b75b;
  539. }
  540. }
  541. &.warning {
  542. border-color: #b2b2b2;
  543. color: #b2b2b2;
  544. .icon-weixin {
  545. color: #b2b2b2;
  546. }
  547. }
  548. .icon-weixin {
  549. margin-right: 8rpx;
  550. font-size: $font-size-32;
  551. }
  552. &.none {
  553. text-align: center;
  554. }
  555. }
  556. }
  557. .opea-del {
  558. float: right;
  559. flex-direction: column;
  560. align-items: center;
  561. .opea-type-cell {
  562. width: 86rpx;
  563. height: 64rpx;
  564. padding: 0 24rpx;
  565. border-radius: 32rpx;
  566. border: 1px solid #ff0000;
  567. line-height: 64rpx;
  568. font-size: $font-size-24;
  569. color: #ff0000;
  570. .icon-shanchu1 {
  571. font-size: $font-size-32;
  572. margin-right: 6rpx;
  573. }
  574. }
  575. }
  576. }
  577. }
  578. .operator-model {
  579. width: 100%;
  580. height: 100%;
  581. background: rgba(0, 0, 0, 0.7);
  582. position: fixed;
  583. top: 0;
  584. left: 0;
  585. bottom: 0;
  586. right: 0;
  587. margin: auto;
  588. z-index: 1000;
  589. .operator-alert {
  590. width: 580rpx;
  591. height: 670rpx;
  592. padding: 68rpx 24rpx 24rpx 24rpx;
  593. box-sizing: border-box;
  594. background: #ffffff;
  595. border-radius: 16rpx;
  596. position: absolute;
  597. top: 0;
  598. left: 0;
  599. bottom: 0;
  600. right: 0;
  601. margin: auto;
  602. z-index: 1001;
  603. .icon-iconfontguanbi {
  604. width: 68rpx;
  605. height: 68rpx;
  606. text-align: center;
  607. line-height: 68rpx;
  608. position: absolute;
  609. right: 0;
  610. top: 0;
  611. font-size: $font-size-36;
  612. color: #999999;
  613. }
  614. .content {
  615. width: 100%;
  616. height: auto;
  617. float: left;
  618. .ciew-t {
  619. font-size: $font-size-28;
  620. color: $text-color;
  621. line-height: 66rpx;
  622. text {
  623. color: #999999;
  624. &.success {
  625. color: #16b75b;
  626. }
  627. &.warning {
  628. color: #b2b2b2;
  629. }
  630. }
  631. }
  632. }
  633. .alert-btn {
  634. width: 100%;
  635. height: 84rpx;
  636. float: left;
  637. margin-top: 24rpx;
  638. .btn {
  639. width: 420rpx;
  640. height: 84rpx;
  641. margin: 0 auto;
  642. line-height: 84rpx;
  643. background: #f3b574;
  644. color: #ffffff;
  645. font-size: $font-size-28;
  646. text-align: center;
  647. border-radius: 42rpx;
  648. }
  649. }
  650. }
  651. }
  652. .operator-btn {
  653. position: fixed;
  654. width: 100%;
  655. height: 140rpx;
  656. left: 0;
  657. bottom: 0;
  658. background: #ffffff;
  659. z-index: 95;
  660. display: flex;
  661. align-items: center;
  662. justify-content: center;
  663. .add-btn {
  664. width: 600rpx;
  665. height: 88rpx;
  666. font-size: $font-size-28;
  667. line-height: 88rpx;
  668. color: #ffffff;
  669. text-align: center;
  670. background: $btn-confirm;
  671. border-radius: 44rpx;
  672. }
  673. }
  674. .adds-btn {
  675. width: 600rpx;
  676. height: 88rpx;
  677. font-size: 28rpx;
  678. line-height: 88rpx;
  679. color: #ffffff;
  680. margin: 0 auto;
  681. text-align: center;
  682. background: #000000;
  683. border-radius: 44rpx;
  684. }
  685. </style>