club-list.vue 10 KB

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