club-list.vue 9.5 KB

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