club-list.vue 9.1 KB

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