list.vue 15 KB

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