list.vue 15 KB

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