club-list.vue 9.1 KB

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