list.vue 15 KB

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