club-list.vue 9.0 KB

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