club-list.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  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}"
  45. >
  46. <!-- 机构数据 -->
  47. <view class="list" v-for="item in clubList" :key="item.userId">
  48. <view class="list-left">
  49. <view class="list-head"
  50. ><image
  51. src="https://static.caimei365.com/app/img/icon/icon-club@3x.png"
  52. mode=""
  53. ></image
  54. ></view>
  55. </view>
  56. <view class="list-item">
  57. <view class="list-title">
  58. <text class="list-name">{{ item.clubName }}</text>
  59. </view>
  60. <view class="list-contact">
  61. <view class="list-row">
  62. <text class="iconfont icon-lianxiren"></text>
  63. <text>{{ item.userName }}</text>
  64. </view>
  65. <view class="list-row">
  66. <text class="iconfont icon-dianhua"></text>
  67. <text>{{ item.bindMobile }}</text>
  68. </view>
  69. </view>
  70. <view class="list-opea">
  71. <view class="btn border-btn" @click.stop="goOrderList(item)">
  72. <text>订单列表</text>
  73. </view>
  74. <view class="btn border-btn" @click.stop="goGoodsList(item)">
  75. <text>立即下单</text>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <!--加载loadding-->
  81. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  82. <tui-nomore
  83. :visible="!pullUpOn"
  84. :backgroundColor="'#ffffff'"
  85. :text="nomoreText"
  86. ></tui-nomore>
  87. <!--加载loadding-->
  88. </scroll-view>
  89. </view>
  90. </view>
  91. <view class="over-bg" @click="hideSearchModalHandle" v-if="showSearchModal"></view>
  92. </view>
  93. </template>
  94. <script>
  95. import authorize from '@/common/config/authorize.js'
  96. import tuiLoadmore from '@/components/tui-components/loadmore/loadmore'
  97. import tuiNomore from '@/components/tui-components/nomore/nomore'
  98. export default {
  99. components: {
  100. tuiLoadmore,
  101. tuiNomore
  102. },
  103. data() {
  104. return {
  105. isShowClose: false, //是否显示搜索框关闭按钮
  106. searchInputVal: '', //搜索框数据
  107. isEmpty: true, //机构列表是否为空
  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. }
  120. },
  121. onLoad(data) {
  122. this.setScrollHeight()
  123. // 获取传过来的organizeId
  124. this.organizeId = data.id
  125. // 初始化列表
  126. this.init()
  127. console.log(this.clubList)
  128. },
  129. methods: {
  130. // 初始化机构列表
  131. async init() {
  132. this.pageNum = 1
  133. this.clubList = await this.getClubList()
  134. if (this.clubList.length > 0) {
  135. this.isEmpty = false
  136. }
  137. },
  138. // 设置scroll高度
  139. setScrollHeight() {
  140. console.log(this.$store.state.windowHeight)
  141. this.scrollHeight = this.$store.state.windowHeight - 100 - 40 + '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. if (this.clubList.length <= 0) {
  155. this.isEmpty = true
  156. }
  157. },
  158. // 初始化机构列表
  159. async getClubList() {
  160. let params = {
  161. organizeId: this.organizeId,
  162. name: this.searchInputVal,
  163. pageNum: this.pageNum,
  164. pageSize: this.pageSize
  165. }
  166. const { data: res } = await this.SellerService.GetSellerClubList(params).catch(
  167. error => {
  168. this.$util.msg(error.msg, 1500)
  169. setTimeout(() => {
  170. uni.navigateBack({
  171. delta: 1
  172. })
  173. }, 1500)
  174. }
  175. )
  176. this.pageNum = res.pageNum
  177. this.hasNextPage = res.hasNextPage
  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. console.log(item)
  220. this.$api.setStorage('clubInfo', item)
  221. this.$api.navigateTo('pages/user/order/order-list')
  222. this.$api.navigateTo(`/pages/user/order/order-historylist`)
  223. },
  224. async hideSearchModalHandle() {
  225. this.showSearchModal = false
  226. this.searchKeyWords()
  227. },
  228. searchInputFoucs() {
  229. this.showSearchModal = true
  230. }
  231. }
  232. }
  233. </script>
  234. <style lang="scss">
  235. page {
  236. height: auto;
  237. }
  238. page,
  239. .container {
  240. /* padding-bottom: 120upx; */
  241. background: #fff;
  242. width: 100%;
  243. height: 100vh;
  244. overflow: hidden;
  245. }
  246. .container {
  247. position: relative;
  248. }
  249. .over-bg {
  250. top: 0;
  251. position: fixed;
  252. width: 100vw;
  253. height: 100vh;
  254. z-index: 888;
  255. background: rgba(0, 0, 0, 0.4);
  256. }
  257. .club-search {
  258. display: flex;
  259. justify-content: space-between;
  260. align-items: center;
  261. height: 74rpx;
  262. width: 702rpx;
  263. padding: 20rpx 24rpx;
  264. background: #ffffff;
  265. position: fixed;
  266. top: 0;
  267. left: 0;
  268. z-index: 999;
  269. .search-from {
  270. display: flex;
  271. justify-content: space-between;
  272. align-items: center;
  273. flex: 1;
  274. height: 64rpx;
  275. background: #f7f7f7;
  276. border-radius: 32rpx;
  277. position: relative;
  278. .icon-sousuo {
  279. width: 64rpx;
  280. height: 64rpx;
  281. line-height: 64rpx;
  282. text-align: center;
  283. display: block;
  284. font-size: $font-size-28;
  285. color: #999999;
  286. }
  287. .icon-guanbi {
  288. font-size: $font-size-28;
  289. color: #999999;
  290. position: absolute;
  291. width: 64rpx;
  292. height: 64rpx;
  293. line-height: 64rpx;
  294. text-align: center;
  295. top: 0;
  296. right: 0;
  297. z-index: 10;
  298. }
  299. .input {
  300. width: 570rpx;
  301. height: 64rpx;
  302. line-height: 64rpx;
  303. color: $text-color;
  304. font-size: $font-size-24;
  305. }
  306. }
  307. .search-btn {
  308. width: 100rpx;
  309. line-height: 64rpx;
  310. text-align: center;
  311. font-size: $font-size-28;
  312. color: $color-system;
  313. background: #ffffff;
  314. }
  315. }
  316. .club-main {
  317. position: relative;
  318. padding-top: 57px;
  319. .club-scroll {
  320. // height: 100vh;
  321. // box-sizing: border-box;
  322. // padding-top: 122rpx;
  323. }
  324. .list {
  325. align-items: flex-start;
  326. width: 702rpx;
  327. height: auto;
  328. margin: 0 auto;
  329. padding: 24rpx 0;
  330. background: #ffffff;
  331. position: relative;
  332. border-bottom: 1px solid #ebebeb;
  333. display: flex;
  334. .list-left {
  335. height: 140rpx;
  336. flex: 2;
  337. margin-right: 24rpx;
  338. .list-head {
  339. width: 180rpx;
  340. height: 180rpx;
  341. image {
  342. width: 180rpx;
  343. height: 180rpx;
  344. border-radius: 8rpx;
  345. }
  346. }
  347. }
  348. .list-item {
  349. flex: 8;
  350. display: flex;
  351. flex-direction: column;
  352. align-items: flex-start;
  353. .list-title {
  354. flex: 2;
  355. width: 100%;
  356. color: $text-color;
  357. flex-direction: row;
  358. justify-content: flex-start;
  359. .list-name {
  360. font-size: $font-size-30;
  361. width: 400rpx;
  362. display: block;
  363. float: left;
  364. text-align: left;
  365. -o-text-overflow: ellipsis;
  366. text-overflow: ellipsis;
  367. display: -webkit-box;
  368. word-break: break-all;
  369. -webkit-box-orient: vertical;
  370. -webkit-line-clamp: 1;
  371. overflow: hidden;
  372. }
  373. }
  374. .list-contact {
  375. padding: 20rpx 0;
  376. .list-row {
  377. margin: 10rpx 0;
  378. display: flex;
  379. justify-content: flex-start;
  380. align-items: center;
  381. color: #666;
  382. text {
  383. font-size: $font-size-26;
  384. }
  385. .iconfont {
  386. font-size: $font-size-26;
  387. margin-right: 10rpx;
  388. }
  389. }
  390. }
  391. .list-opea {
  392. width: 100%;
  393. display: flex;
  394. justify-content: flex-end;
  395. flex: 4;
  396. color: #166ce1;
  397. flex-direction: row;
  398. align-items: center;
  399. .btn {
  400. width: 160rpx;
  401. height: 56rpx;
  402. line-height: 54rpx;
  403. border-radius: 30rpx;
  404. font-size: $font-size-24;
  405. color: $text-color;
  406. text-align: center;
  407. margin: 0 17rpx;
  408. border: 1px solid #333333;
  409. box-sizing: border-box;
  410. &.border-btn {
  411. color: #333;
  412. }
  413. }
  414. }
  415. }
  416. }
  417. }
  418. </style>