list.vue 15 KB

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