list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  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="../../../static/temp/logo@3x.png" mode=""></image></view>
  6. <view class="title">{{clubName}}</view>
  7. </view>
  8. <view class="operator-search">
  9. <view class="search-wrap">
  10. <view class="search-from name">
  11. <view class="label">姓名:</view>
  12. <input class="input" type="text" v-model="linkman" placeholder="请输入姓名" maxlength="6"/>
  13. </view>
  14. <view class="search-from phone">
  15. <view class="label">手机号:</view>
  16. <input class="input" type="text" v-model="clubMobile" placeholder="请输入手机号" maxlength="11"/>
  17. </view>
  18. </view>
  19. <view class="search-wrap">
  20. <button class="search-btn" type="default">搜索</button>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="operator-main">
  25. <view v-if="isEmpty" class="empty-container">
  26. <view class="txt">暂无运营人员</view>
  27. <view class="login-btn" @click="addAddress('add')">添加运营人员</view>
  28. </view>
  29. <view v-else class="operator-list">
  30. <scroll-view scroll-y="true">
  31. <view class="list" v-for="(item, index) in operatorList" :key="index" @click="checkAddress(item)">
  32. <view class="list-left">
  33. <view class="list-head"><image :src="item.image" mode=""></image></view>
  34. <view class="list-tel">
  35. <text class="txt">{{item.name}}</text>
  36. <text class="txt">{{item.mobile}}</text>
  37. </view>
  38. </view>
  39. <view class="list-opea">
  40. <view class="opea-type">
  41. <view class="opea-type-cell" v-if="item.status != '0'">
  42. <text class="iconfont icon-iconfontweixin" :style="{color: iconStautsColor(item.status)}"></text>
  43. <text :style="{color: rexpStautsColor(item.status)}">{{ rexpStautsText(item.status) }}</text>
  44. </view>
  45. </view>
  46. <view class="opea-del">
  47. <view class="opea-type-cell">
  48. <text class="iconfont icon-shanchu"></text>
  49. <text>删除</text>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </scroll-view>
  55. <view class="add-btn" @click="addAddress('add')">添加运营人员</view>
  56. </view>
  57. </view>
  58. <view class="operator-model">
  59. <view class="operator-alert">
  60. <text class="iconfont icon-iconfontguanbi"></text>
  61. <view class="content">
  62. <view class="ciew-t">姓名:张三</view>
  63. <view class="ciew-t">手机号:15888888888</view>
  64. <view class="ciew-t">邀请码:456789<text>(已过期)</text></view>
  65. <view class="ciew-t">邀请码有效期:5天</view>
  66. <view class="ciew-t">状态:已绑定</view>
  67. <view class="ciew-t">添加时间:2020-03-18 17:09:58</view>
  68. <view class="ciew-t">绑定时间:2020-03-18 17:09:58</view>
  69. </view>
  70. <view class="btn">更新邀请码</view>
  71. </view>
  72. </view>
  73. <!-- 删除弹窗 -->
  74. <model-alert v-if="isShowDelModal"
  75. :alertText='alertText'
  76. @btnConfirm ='confirmDetele'>
  77. </model-alert>
  78. </view>
  79. </template>
  80. <script>
  81. import authorize from '@/common/config/authorize.js'
  82. import modelAlert from '@/components/module/modelAlert/modelAlert.vue'
  83. export default {
  84. components:{
  85. modelAlert
  86. },
  87. data() {
  88. return {
  89. clubName:'采美商城采购机构按时',
  90. isSelect:false,
  91. isEmpty:false,
  92. isLoadMore:false,
  93. alertText:'确定要删除该地址?',
  94. userID:'',
  95. pageNum:1,
  96. pageSize:10,
  97. addressList: [],
  98. hasNextPage:false,
  99. allowDataStatus:true,
  100. isShowDelModal:false,
  101. wrapperHeight:'100%',
  102. scrollHeight:'',
  103. deleteAddressId:'',
  104. currPage:'',//当前页面
  105. prevPage:'',//上一个页面
  106. operatorList:[
  107. {image:'../../../static/temp/logo@3x.png',name:'张三',mobile:'18888888888',status:'1'},
  108. {image:'../../../static/temp/logo@3x.png',name:'张三',mobile:'18888888888',status:'2'},
  109. {image:'../../../static/temp/logo@3x.png',name:'张三',mobile:'18888888888',status:'3'},
  110. {image:'../../../static/temp/logo@3x.png',name:'张三',mobile:'18888888888',status:'0'},
  111. ]
  112. }
  113. },
  114. onLoad(option){
  115. if(option.type=='select'){this.isSelect = true;}
  116. this.setScrollHeight();
  117. },
  118. onReachBottom() {
  119. // console.log('滑动到页面底部')
  120. if(this.isLoadMore) {
  121. this.initAddressList();
  122. }
  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. initAddressList(){
  140. this.$api.getStorage().then((resolve) =>{
  141. this.userID = resolve.userID
  142. this.$api.get('/personal/findAddress',{index:this.pageNum,pageSize:this.pageSize,userID:this.userID},
  143. response => {
  144. if(response.results == ''){
  145. this.isEmpty = true
  146. }else{
  147. this.isEmpty = false
  148. let results =[];
  149. results = response.results;
  150. this.addressList = this.addressList.concat(results);
  151. this.pageNum = response.index +1;
  152. if(this.pageNum === response.totalPage + 1 ){
  153. this.isLoadMore = false;
  154. } else {
  155. this.isLoadMore = true;
  156. }
  157. }
  158. }
  159. )
  160. })
  161. },
  162. //选择地址
  163. checkAddress(item){
  164. //是否需要返回地址(从订单确认页跳过来选收货地址)
  165. if(!this.isSelect){return ;}
  166. uni.setStorageSync('selectAddress',item)
  167. var pages = getCurrentPages();
  168. var prevPage = pages[pages.length - 2]; //上一个页面
  169. prevPage.setData({select:'select'})
  170. uni.navigateBack();
  171. },
  172. addAddress(type,item){
  173. uni.navigateTo({
  174. url: `/pages/user/address/addressManage?type=${type}&data=${JSON.stringify(item)}`
  175. })
  176. },
  177. //删除收货地址
  178. deleteAddress(id){
  179. console.log('删除地址的ID',id)
  180. this.isShowDelModal = true;
  181. this.deleteAddressId =id;
  182. },
  183. confirmDetele(){
  184. authorize.getCode('weixin').then(wechatcode =>{
  185. this.$api.get('/personal/delete?code='+`${wechatcode}`,{addressID:this.deleteAddressId,userOrganizeID:this.userOrganizeID},
  186. response => {
  187. if(response.code==1){
  188. uni.showToast({
  189. icon: 'none',
  190. title: response.msg,
  191. duration: 2000
  192. })
  193. this.isShowDelModal = false;
  194. this.pageNum = 1;
  195. this.addressList = [];
  196. this.initAddressList();
  197. }else{
  198. this.$util.msg(response.msg,3000);
  199. this.isShowDelModal = false;
  200. setTimeout(function(){
  201. uni.switchTab({
  202. url:'/pages/tabBar/home/home'
  203. })
  204. },1000)
  205. }
  206. }
  207. )
  208. })
  209. },
  210. rexpStautsText(status) {
  211. let text = ''
  212. switch (status) {
  213. case '1':
  214. text = '邀请码有效'
  215. break
  216. case '2':
  217. text = '邀请码已使用'
  218. break
  219. case '3':
  220. text = '邀请码已过期'
  221. break
  222. }
  223. return text
  224. },
  225. rexpStautsColor(status) {
  226. let textColor = ''
  227. switch (status) {
  228. case '1':
  229. textColor = '#55BB00'
  230. break
  231. case '2':
  232. textColor = '#0056BB'
  233. break
  234. case '3':
  235. textColor = '#BB0000'
  236. break
  237. }
  238. return textColor
  239. },
  240. iconStautsColor(status) {
  241. let textColor = ''
  242. if(status == '2'){
  243. textColor = '#09BB07'
  244. }else{
  245. textColor = '#DDDDDD'
  246. }
  247. return textColor
  248. },
  249. },
  250. onShow() {
  251. this.pageNum = 1;
  252. this.addressList = [];
  253. this.initAddressList();
  254. var pages = getCurrentPages();
  255. var prevPage = pages[pages.length - 2]; //上一个页面
  256. // prevPage.setData({select:''})
  257. }
  258. }
  259. </script>
  260. <style lang='scss'>
  261. page {
  262. height: auto;
  263. }
  264. page,.container{
  265. /* padding-bottom: 120upx; */
  266. background: #F7F7F7;
  267. border-top: 1px solid #EBEBEB;
  268. }
  269. .container{
  270. position: relative;
  271. }
  272. .operator-top{
  273. width: 702rpx;
  274. padding: 0 24rpx;
  275. height: auto;
  276. background: #FFFFFF;
  277. margin-bottom: 24rpx;
  278. .operator-title{
  279. width: 100%;
  280. height: 92rpx;
  281. padding: 34rpx 0;
  282. .title{
  283. float: left;
  284. font-size: $font-size-36;
  285. color: $text-color;
  286. line-height: 92rpx;
  287. text-align: left;
  288. margin-left: 20rpx;
  289. }
  290. .head{
  291. width: 92rpx;
  292. height: 92rpx;
  293. border-radius: 50%;
  294. border: 1px solid $color-system;
  295. float: left;
  296. image{
  297. width: 92rpx;
  298. height: 92rpx;
  299. border-radius: 50%;
  300. }
  301. }
  302. }
  303. .operator-search{
  304. width: 100%;
  305. height: auto;
  306. .search-from{
  307. width: 300rpx;
  308. height: 40rpx;
  309. padding: 24rpx;
  310. background: $sub-bg-color;
  311. border-radius: 14rpx;
  312. position: relative;
  313. margin-bottom: 20rpx;
  314. float: left;
  315. &.name{
  316. width: 260rpx;
  317. margin-right: 20rpx;
  318. .input{
  319. width: 180rpx;
  320. padding-left:10rpx;
  321. font-size: $font-size-base;
  322. color: $text-color;
  323. line-height: 40rpx;
  324. float: left;
  325. height: 40rpx;
  326. }
  327. }
  328. &.phone{
  329. width: 324rpx;
  330. .input{
  331. width: 220rpx;
  332. padding-left:10rpx;
  333. font-size: $font-size-base;
  334. color: $text-color;
  335. line-height: 40rpx;
  336. float: left;
  337. height: 40rpx;
  338. }
  339. }
  340. .label{
  341. text-align: left;
  342. font-size: $font-size-base;
  343. color:$text-color;
  344. line-height: 40rpx;
  345. float: left;
  346. }
  347. }
  348. .search-btn{
  349. width: 702rpx;
  350. height: 88rpx;
  351. border: 1px solid $color-system;
  352. border-radius: 14rpx;
  353. font-size: $font-size-base;
  354. color: $color-system;
  355. line-height: 88rpx;
  356. }
  357. }
  358. }
  359. .list{
  360. display: flex;
  361. align-items: center;
  362. width: 702rpx;
  363. height: 92rpx;
  364. padding: 24rpx;
  365. background: #FFFFFF;
  366. position: relative;
  367. border-bottom: 1px solid #EBEBEB;
  368. .list-left{
  369. display: flex;
  370. flex: 4;
  371. .list-head{
  372. width: 92rpx;
  373. height: 92rpx;
  374. border: 1px solid $color-system;
  375. border-radius: 50%;
  376. image{
  377. width: 92rpx;
  378. height: 92rpx;
  379. border-radius: 50%;
  380. }
  381. }
  382. .list-tel{
  383. margin-left: 18rpx;
  384. .txt{
  385. display: flex;
  386. flex: 1;
  387. font-size: $font-size-base;
  388. color: $text-color;
  389. line-height: 46rpx;
  390. }
  391. }
  392. }
  393. .list-opea{
  394. flex:6;
  395. .opea-type{
  396. flex-direction: column;
  397. align-items: center;
  398. margin-left: 20rpx;
  399. float: left;
  400. .opea-type-cell{
  401. width: 186rpx;
  402. height: 64rpx;
  403. padding:0 16rpx;
  404. border-radius: 10rpx;
  405. border: 1px solid #DDDDDD;
  406. line-height: 64rpx;
  407. font-size: $font-size-sm;
  408. .icon-iconfontweixin{
  409. margin-right: 8rpx;
  410. font-size: $font-size-lg;
  411. }
  412. }
  413. }
  414. .opea-del{
  415. float: right;
  416. flex-direction: column;
  417. align-items: center;
  418. .opea-type-cell{
  419. width: 86rpx;
  420. height: 64rpx;
  421. padding:0 24rpx;
  422. border-radius: 10rpx;
  423. border: 1px solid #DDDDDD;
  424. line-height: 64rpx;
  425. font-size: $font-size-sm;
  426. color: #FF0000;
  427. .icon-shanchu{
  428. font-size: $font-size-lg;
  429. margin-right: 6rpx;
  430. }
  431. }
  432. }
  433. }
  434. }
  435. .operator-model{
  436. width: 100%;
  437. height: 100%;
  438. background: rgba(0,0,0,.1);
  439. position: fixed;
  440. top: 0;
  441. left: 0;
  442. bottom: 0;
  443. right: 0;
  444. margin: auto;
  445. z-index: 992;
  446. .operator-alert{
  447. width: 422rpx;
  448. height: 376rpx;
  449. padding: 68rpx 32rpx;
  450. background: #FFFFFF;
  451. border-radius: 14rpx;
  452. position: absolute;
  453. top: 0;
  454. left: 0;
  455. bottom: 0;
  456. right: 0;
  457. margin: auto;
  458. z-index: 999;
  459. .icon-iconfontguanbi{
  460. width: 68rpx;
  461. height: 68rpx;
  462. text-align: center;
  463. line-height: 68rpx;
  464. position: absolute;
  465. right: 0;
  466. top: 0;
  467. font-size: $font-size-36;
  468. color: #999999;
  469. }
  470. .content{
  471. .ciew-t{
  472. font-size: $font-size-base;
  473. color: $text-color;
  474. line-height: 50rpx;
  475. }
  476. }
  477. .btn{
  478. width: 100%;
  479. height: 68rpx;
  480. border-top: 1px solid #F7F7F7;
  481. line-height: 68rpx;
  482. font-size: $font-size-sb;
  483. text-align: center;
  484. color: $color-system;
  485. position: absolute;
  486. bottom:0 ;
  487. left: 0;
  488. }
  489. }
  490. }
  491. .add-btn{
  492. position: fixed;
  493. left: 24rpx;
  494. right: 24rpx;
  495. bottom: 34rpx;
  496. z-index: 95;
  497. display: flex;
  498. align-items: center;
  499. justify-content: center;
  500. width: 702rpx;
  501. height: 88rpx;
  502. font-size: $font-size-base;
  503. line-height: 88rpx;
  504. color: #FFFFFF;
  505. text-align: center;
  506. background: $btn-confirm;
  507. border-radius: 14rpx;
  508. }
  509. .adds-btn{
  510. width: 702rpx;
  511. height: 88rpx;
  512. font-size: 28rpx;
  513. line-height: 88rpx;
  514. color: #FFFFFF;
  515. margin: 0 auto;
  516. text-align: center;
  517. background: #000000;
  518. border-radius: 14rpx;
  519. }
  520. </style>