club-list.vue 9.1 KB

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