club-list.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <template>
  2. <view class="container club clearfix">
  3. <view class="club-search clearfix">
  4. <view class="search-from name">
  5. <text class="iconfont icon-sousuo"></text>
  6. <input
  7. class="input"
  8. type="text"
  9. confirm-type="search"
  10. v-model="searchInputVal"
  11. @input="onShowClose"
  12. @confirm="getClubList()"
  13. placeholder="请输入机构名称/机构联系人"
  14. maxlength="12"
  15. @focus="searchInputFoucs"
  16. @blur="hideSearchModalHandle"
  17. />
  18. <text
  19. class="iconfont icon-guanbi"
  20. v-if="isShowClose"
  21. @click="delInputText()"
  22. ></text>
  23. </view>
  24. <view class="search-btn">
  25. <button class="search-btn" type="default" @click.stop="searchClubList">搜索</button>
  26. </view>
  27. </view>
  28. <view class="club-main">
  29. <view v-if="isEmpty" class="empty-container">
  30. <image
  31. class="club-empty-image"
  32. src="/static/ws/empty_club.png"
  33. mode="aspectFit"
  34. lazy-load
  35. ></image>
  36. <view class="txt">机构列表空空如也~</view>
  37. </view>
  38. <!-- :style="{ height: scrollHeight }" -->
  39. <view v-else class="club-list">
  40. <scroll-view
  41. class="club-scroll"
  42. scroll-y="true"
  43. @scrolltolower="getOnReachBottomData"
  44. :style="{ height: scrollHeight ,'padding-bottom':isIphoneX ? '44px' :''}"
  45. >
  46. <!-- 机构数据 -->
  47. <view
  48. class="list"
  49. v-for="item in clubList"
  50. :key="item.userId"
  51. >
  52. <view class="list-left">
  53. <view class="list-head"
  54. ><image
  55. src="https://static.caimei365.com/app/img/icon/icon-club@3x.png"
  56. mode=""
  57. ></image
  58. ></view>
  59. </view>
  60. <view class="list-item">
  61. <view class="list-title">
  62. <text class="list-name">{{ item.clubName }}</text>
  63. </view>
  64. <view class="list-contact">
  65. <view class="list-row">
  66. <text class="iconfont icon-lianxiren"></text>
  67. <text>{{ item.userName }}</text>
  68. </view>
  69. <view class="list-row">
  70. <text class="iconfont icon-dianhua"></text>
  71. <text>{{ item.bindMobile }}</text>
  72. </view>
  73. </view>
  74. <view class="list-opea">
  75. <view class="btn border-btn" @click.stop="goOrderList(item)">
  76. <text>订单列表</text>
  77. </view>
  78. <view class="btn border-btn" @click.stop="goGoodsList(item)">
  79. <text>立即下单</text>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <!--加载loadding-->
  85. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  86. <tui-nomore
  87. :visible="!pullUpOn"
  88. :backgroundColor="'#ffffff'"
  89. :text="nomoreText"
  90. ></tui-nomore>
  91. <!--加载loadding-->
  92. </scroll-view>
  93. </view>
  94. </view>
  95. <view class="over-bg" @click="hideSearchModalHandle" v-if="showSearchModal"></view>
  96. </view>
  97. </template>
  98. <script>
  99. import authorize from '@/common/config/authorize.js'
  100. import tuiLoadmore from '@/components/tui-components/loadmore/loadmore'
  101. import tuiNomore from '@/components/tui-components/nomore/nomore'
  102. export default {
  103. components: {
  104. tuiLoadmore,
  105. tuiNomore
  106. },
  107. data() {
  108. return {
  109. isShowClose: false, //是否显示搜索框关闭按钮
  110. searchInputVal: '', //搜索框数据
  111. isEmpty: true, //机构列表是否为空
  112. nomoreText: '上拉显示更多',
  113. pageNum: 1, //当前页码
  114. pageSize: 10, //每页获取条数
  115. hasNextPage: false, //是否还有下一页
  116. loadding: false,
  117. pullUpOn: true,
  118. pullFlag: true,
  119. scrollHeight: '', //scoll-view高度
  120. clubList: [],
  121. showSearchModal: false, //模糊搜索框是否显示
  122. organizeId: '',
  123. isIphoneX: false
  124. }
  125. },
  126. onLoad(data) {
  127. this.isIphoneX = this.$store.state.isIphoneX
  128. this.setScrollHeight()
  129. // 获取传过来的organizeId
  130. this.organizeId = data.id
  131. // 初始化列表
  132. this.init()
  133. console.log(this.clubList)
  134. },
  135. methods: {
  136. // 初始化机构列表
  137. async init() {
  138. this.pageNum = 1
  139. this.clubList = await this.getClubList()
  140. if (this.clubList.length > 0) {
  141. this.isEmpty = false
  142. }
  143. },
  144. // 设置scroll高度
  145. setScrollHeight() {
  146. // 窗口高度 - 底部距离
  147. const _that = this
  148. uni.getSystemInfo({
  149. success(res) {
  150. if (_that.isIphoneX) {
  151. _that.scrollHeight = res.windowHeight - 60 + 'px'
  152. } else {
  153. _that.scrollHeight = res.windowHeight - 60 + 'px'
  154. }
  155. }
  156. })
  157. },
  158. async searchClubList() {
  159. // 如果搜索框为空
  160. if (this.searchInputVal.trim().length <= 0) {
  161. this.searchInputVal = ''
  162. return
  163. }
  164. this.searchKeyWords()
  165. },
  166. async searchKeyWords() {
  167. console.log(this.searchInputVal)
  168. this.pageNum = 1
  169. this.clubList = await this.getClubList()
  170. if (this.clubList.length <= 0) {
  171. this.isEmpty = true
  172. } else {
  173. this.isEmpty = false
  174. }
  175. },
  176. // 初始化机构列表
  177. async getClubList() {
  178. let params = {
  179. organizeId: this.organizeId,
  180. name: this.searchInputVal,
  181. pageNum: this.pageNum,
  182. pageSize: this.pageSize
  183. }
  184. const { data: res } = await this.SellerService.GetSellerClubList(params).catch(
  185. error => {
  186. this.$util.msg(error.msg, 1500)
  187. setTimeout(() => {
  188. uni.navigateBack({
  189. delta: 1
  190. })
  191. }, 1500)
  192. }
  193. )
  194. this.pageNum = res.pageNum
  195. this.hasNextPage = res.hasNextPage
  196. return res.list
  197. },
  198. // 加载下一页数据
  199. async getOnReachBottomData() {
  200. if (!this.hasNextPage && this.pullFlag) {
  201. this.loadding = false
  202. this.pullUpOn = false
  203. this.nomoreText = '已至底部'
  204. return
  205. }
  206. this.nomoreText = '上拉显示更多'
  207. this.loadding = true
  208. this.pullUpOn = true
  209. this.pageNum += 1
  210. const list = await this.getClubList()
  211. this.clubList = [...this.clubList, ...list]
  212. setTimeout(() => {
  213. this.pullFlag = true
  214. }, 2000)
  215. },
  216. //输入框失去焦点时触发
  217. onShowClose() {
  218. if (this.searchInputVal != '') {
  219. this.isShowClose = true
  220. } else {
  221. this.isShowClose = false
  222. }
  223. },
  224. async delInputText() {
  225. //清除输入框内容
  226. this.searchInputVal = ''
  227. this.isShowClose = false
  228. this.searchKeyWords()
  229. },
  230. // 跳转下单产品列表
  231. goGoodsList(item) {
  232. uni.setStorageSync('clubInfo', item)
  233. this.$api.navigateTo(`/pages/goods/list`)
  234. },
  235. // 跳转订单列表
  236. goOrderList(item) {
  237. console.log(item)
  238. this.$api.setStorage('clubInfo', item)
  239. this.$api.navigateTo('pages/user/order/order-list')
  240. this.$api.navigateTo(`/pages/user/order/order-historylist`)
  241. },
  242. async hideSearchModalHandle() {
  243. this.showSearchModal = false
  244. this.searchKeyWords()
  245. },
  246. searchInputFoucs() {
  247. this.showSearchModal = true
  248. }
  249. }
  250. }
  251. </script>
  252. <style lang="scss">
  253. page {
  254. height: auto;
  255. }
  256. page,
  257. .container {
  258. /* padding-bottom: 120upx; */
  259. background: #fff;
  260. width: 100%;
  261. height: 100vh;
  262. overflow: hidden;
  263. }
  264. .container {
  265. position: relative;
  266. }
  267. .over-bg {
  268. top: 0;
  269. position: fixed;
  270. width: 100vw;
  271. height: 100vh;
  272. z-index: 888;
  273. background: rgba(0, 0, 0, 0.4);
  274. }
  275. .club-search {
  276. display: flex;
  277. justify-content: space-between;
  278. align-items: center;
  279. height: 74rpx;
  280. width: 702rpx;
  281. padding: 20rpx 24rpx;
  282. background: #ffffff;
  283. position: fixed;
  284. top: 0;
  285. left: 0;
  286. z-index: 999;
  287. .search-from {
  288. display: flex;
  289. justify-content: space-between;
  290. align-items: center;
  291. flex: 1;
  292. height: 64rpx;
  293. background: #f7f7f7;
  294. border-radius: 32rpx;
  295. position: relative;
  296. .icon-sousuo {
  297. width: 64rpx;
  298. height: 64rpx;
  299. line-height: 64rpx;
  300. text-align: center;
  301. display: block;
  302. font-size: $font-size-28;
  303. color: #999999;
  304. }
  305. .icon-guanbi {
  306. font-size: $font-size-28;
  307. color: #999999;
  308. position: absolute;
  309. width: 64rpx;
  310. height: 64rpx;
  311. line-height: 64rpx;
  312. text-align: center;
  313. top: 0;
  314. right: 0;
  315. z-index: 10;
  316. }
  317. .input {
  318. width: 570rpx;
  319. height: 64rpx;
  320. line-height: 64rpx;
  321. color: $text-color;
  322. font-size: $font-size-24;
  323. }
  324. }
  325. .search-btn {
  326. width: 100rpx;
  327. line-height: 64rpx;
  328. text-align: center;
  329. font-size: $font-size-28;
  330. color: $color-system;
  331. background: #ffffff;
  332. }
  333. }
  334. .empty-container {
  335. background: #f7f7f7;
  336. justify-content: flex-start;
  337. .club-empty-image {
  338. margin-top: 400rpx;
  339. margin-bottom: 36rpx;
  340. }
  341. }
  342. .club-main {
  343. position: relative;
  344. padding-top: 57px;
  345. .club-scroll {
  346. // height: 100vh;
  347. // box-sizing: border-box;
  348. // padding-top: 122rpx;
  349. }
  350. .list {
  351. align-items: flex-start;
  352. width: 702rpx;
  353. height: auto;
  354. margin: 0 auto;
  355. padding: 24rpx 0;
  356. background: #ffffff;
  357. position: relative;
  358. border-bottom: 1px solid #ebebeb;
  359. display: flex;
  360. .list-left {
  361. height: 140rpx;
  362. flex: 2;
  363. margin-right: 24rpx;
  364. .list-head {
  365. width: 180rpx;
  366. height: 180rpx;
  367. image {
  368. width: 180rpx;
  369. height: 180rpx;
  370. border-radius: 8rpx;
  371. }
  372. }
  373. }
  374. .list-item {
  375. flex: 8;
  376. display: flex;
  377. flex-direction: column;
  378. align-items: flex-start;
  379. .list-title {
  380. flex: 2;
  381. width: 100%;
  382. color: $text-color;
  383. flex-direction: row;
  384. justify-content: flex-start;
  385. .list-name {
  386. font-size: $font-size-30;
  387. width: 100%;
  388. display: block;
  389. float: left;
  390. text-align: left;
  391. -o-text-overflow: ellipsis;
  392. text-overflow: ellipsis;
  393. display: -webkit-box;
  394. word-break: break-all;
  395. -webkit-box-orient: vertical;
  396. -webkit-line-clamp: 1;
  397. overflow: hidden;
  398. }
  399. }
  400. .list-contact {
  401. padding: 20rpx 0;
  402. .list-row {
  403. margin: 10rpx 0;
  404. display: flex;
  405. justify-content: flex-start;
  406. align-items: center;
  407. color: #666;
  408. text {
  409. font-size: $font-size-26;
  410. }
  411. .iconfont {
  412. font-size: $font-size-26;
  413. margin-right: 10rpx;
  414. }
  415. }
  416. }
  417. .list-opea {
  418. width: 100%;
  419. display: flex;
  420. justify-content: flex-end;
  421. flex: 4;
  422. color: #166ce1;
  423. flex-direction: row;
  424. align-items: center;
  425. .btn {
  426. width: 160rpx;
  427. height: 56rpx;
  428. line-height: 54rpx;
  429. border-radius: 30rpx;
  430. font-size: $font-size-24;
  431. color: $text-color;
  432. text-align: center;
  433. margin: 0 17rpx;
  434. border: 1px solid #333333;
  435. box-sizing: border-box;
  436. &.border-btn {
  437. color: #333;
  438. }
  439. &:last-child {
  440. background: rgb(25, 25, 25);
  441. color: #fff;
  442. }
  443. }
  444. }
  445. }
  446. }
  447. }
  448. </style>