list.vue 15 KB

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