club-list.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  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. this.showSkeleton = false
  136. },
  137. // 设置scroll高度
  138. setScrollHeight() {
  139. this.scrollHeight = this.$store.state.windowHeight - 61 + 'px'
  140. },
  141. async searchClubList() {
  142. // 如果搜索框为空
  143. if (this.searchInputVal.trim().length <= 0) {
  144. this.searchInputVal = ''
  145. return
  146. }
  147. this.searchKeyWords()
  148. },
  149. async searchKeyWords() {
  150. this.pageNum = 1
  151. this.clubList = await this.getClubList()
  152. },
  153. // 初始化机构列表
  154. async getClubList() {
  155. let params = {
  156. organizeId: this.organizeId,
  157. name: this.searchInputVal,
  158. pageNum: this.pageNum,
  159. pageSize: this.pageSize
  160. }
  161. const { data: res } = await this.SellerService.GetSellerClubList(params).catch(
  162. error => {
  163. this.$util.msg(error.msg, 1500)
  164. setTimeout(() => {
  165. uni.navigateBack({
  166. delta: 1
  167. })
  168. }, 1500)
  169. }
  170. )
  171. this.pageNum = res.pageNum
  172. this.hasNextPage = res.hasNextPage
  173. if (res.list.length < 0) {
  174. this.isEmpty = true
  175. }
  176. return res.list
  177. },
  178. // 加载下一页数据
  179. async getOnReachBottomData() {
  180. if (!this.hasNextPage && this.pullFlag) {
  181. this.loadding = false
  182. this.pullUpOn = false
  183. this.nomoreText = '已至底部'
  184. return
  185. }
  186. this.nomoreText = '上拉显示更多'
  187. this.loadding = true
  188. this.pullUpOn = true
  189. this.pageNum += 1
  190. const list = await this.getClubList()
  191. this.clubList = [...this.clubList, ...list]
  192. setTimeout(() => {
  193. this.pullFlag = true
  194. }, 2000)
  195. },
  196. //输入框失去焦点时触发
  197. onShowClose() {
  198. if (this.searchInputVal != '') {
  199. this.isShowClose = true
  200. } else {
  201. this.isShowClose = false
  202. }
  203. },
  204. async delInputText() {
  205. //清除输入框内容
  206. this.searchInputVal = ''
  207. this.isShowClose = false
  208. this.searchKeyWords()
  209. },
  210. // 跳转下单产品列表
  211. goGoodsList(item) {
  212. uni.setStorageSync('clubInfo', item)
  213. this.$api.navigateTo(`/pages/goods/list`)
  214. },
  215. // 跳转订单列表
  216. goOrderList(item) {
  217. this.$api.setStorage('clubInfo', item)
  218. this.$api.navigateTo(`pages/user/order/order-list`)
  219. },
  220. async hideSearchModalHandle() {
  221. this.showSearchModal = false
  222. this.searchKeyWords()
  223. },
  224. searchInputFoucs() {
  225. this.showSearchModal = true
  226. }
  227. }
  228. }
  229. </script>
  230. <style lang="scss">
  231. page {
  232. height: auto;
  233. }
  234. page,
  235. .container {
  236. /* padding-bottom: 120upx; */
  237. background: #fff;
  238. width: 100%;
  239. height: 100vh;
  240. overflow: hidden;
  241. }
  242. .container {
  243. position: relative;
  244. }
  245. .over-bg {
  246. top: 0;
  247. position: fixed;
  248. width: 100vw;
  249. height: 100vh;
  250. z-index: 888;
  251. background: rgba(0, 0, 0, 0.4);
  252. }
  253. .club-search {
  254. display: flex;
  255. justify-content: space-between;
  256. align-items: center;
  257. height: 74rpx;
  258. width: 702rpx;
  259. padding: 20rpx 24rpx;
  260. background: #ffffff;
  261. position: fixed;
  262. top: 0;
  263. left: 0;
  264. z-index: 999;
  265. .search-from {
  266. display: flex;
  267. justify-content: space-between;
  268. align-items: center;
  269. flex: 1;
  270. height: 64rpx;
  271. background: #f7f7f7;
  272. border-radius: 32rpx;
  273. position: relative;
  274. .icon-sousuo {
  275. width: 64rpx;
  276. height: 64rpx;
  277. line-height: 64rpx;
  278. text-align: center;
  279. display: block;
  280. font-size: $font-size-28;
  281. color: #999999;
  282. }
  283. .icon-guanbi {
  284. font-size: $font-size-28;
  285. color: #999999;
  286. position: absolute;
  287. width: 64rpx;
  288. height: 64rpx;
  289. line-height: 64rpx;
  290. text-align: center;
  291. top: 0;
  292. right: 0;
  293. z-index: 10;
  294. }
  295. .input {
  296. width: 570rpx;
  297. height: 64rpx;
  298. line-height: 64rpx;
  299. color: $text-color;
  300. font-size: $font-size-24;
  301. }
  302. }
  303. .search-btn {
  304. width: 100rpx;
  305. line-height: 64rpx;
  306. text-align: center;
  307. font-size: $font-size-28;
  308. color: $color-system;
  309. background: #ffffff;
  310. }
  311. }
  312. .club-main {
  313. position: relative;
  314. padding-top: 122rpx;
  315. .list {
  316. align-items: flex-start;
  317. width: 702rpx;
  318. height: auto;
  319. margin: 0 auto;
  320. padding: 24rpx 0;
  321. background: #ffffff;
  322. position: relative;
  323. border-bottom: 1px solid #ebebeb;
  324. display: flex;
  325. .list-left {
  326. height: 140rpx;
  327. flex: 2;
  328. margin-right: 24rpx;
  329. .list-head {
  330. width: 180rpx;
  331. height: 180rpx;
  332. image {
  333. width: 180rpx;
  334. height: 180rpx;
  335. }
  336. }
  337. }
  338. .list-item {
  339. flex: 8;
  340. display: flex;
  341. flex-direction: column;
  342. align-items: flex-start;
  343. .list-title {
  344. flex: 2;
  345. width: 100%;
  346. color: $text-color;
  347. flex-direction: row;
  348. justify-content: flex-start;
  349. .list-name {
  350. font-size: $font-size-30;
  351. width: 400rpx;
  352. display: block;
  353. float: left;
  354. text-align: left;
  355. -o-text-overflow: ellipsis;
  356. text-overflow: ellipsis;
  357. display: -webkit-box;
  358. word-break: break-all;
  359. -webkit-box-orient: vertical;
  360. -webkit-line-clamp: 1;
  361. overflow: hidden;
  362. }
  363. }
  364. .list-contact {
  365. padding: 20rpx 0;
  366. .list-row {
  367. margin: 10rpx 0;
  368. display: flex;
  369. justify-content: flex-start;
  370. align-items: center;
  371. color: #666;
  372. text {
  373. font-size: $font-size-26;
  374. }
  375. .iconfont {
  376. font-size: $font-size-26;
  377. margin-right: 10rpx;
  378. }
  379. }
  380. }
  381. .list-opea {
  382. width: 100%;
  383. display: flex;
  384. justify-content: flex-end;
  385. flex: 4;
  386. color: #166ce1;
  387. flex-direction: row;
  388. align-items: center;
  389. .btn {
  390. width: 160rpx;
  391. height: 56rpx;
  392. line-height: 54rpx;
  393. border-radius: 30rpx;
  394. font-size: $font-size-24;
  395. color: $text-color;
  396. text-align: center;
  397. margin: 0 17rpx;
  398. border: 1px solid #333333;
  399. box-sizing: border-box;
  400. &.border-btn {
  401. color: #333;
  402. }
  403. }
  404. }
  405. }
  406. }
  407. }
  408. </style>