club-list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  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://static.caimei365.com/app/wisa/img/icon/icon-club-empty.png"
  33. mode="widthFix"
  34. lazy-load
  35. ></image>
  36. <view class="txt">门店列表空空如也~</view>
  37. </view>
  38. <!-- :style="{ height: scrollHeight }" -->
  39. <view v-else class="club-list">
  40. <scroll-view
  41. class="club-scroll"
  42. scroll-y="true"
  43. @scrolltolower="getOnReachBottomData"
  44. :style="{ height: scrollHeight, 'padding-bottom': isIphoneX ? '44px' : '' }"
  45. >
  46. <!-- 机构数据 -->
  47. <view class="list" v-for="item in clubList" :key="item.storeId">
  48. <view class="list-left">
  49. <view class="list-head">
  50. <image src="https://static.caimei365.com/app/img/icon/icon-club@3x.png" mode=""></image>
  51. </view>
  52. </view>
  53. <view class="list-item">
  54. <view class="list-title">
  55. <text class="list-name">{{ item.name }}</text>
  56. </view>
  57. <view class="list-contact">
  58. <view class="list-row">
  59. <text class="iconfont icon-lianxiren"></text>
  60. <text>{{ item.linkMan }}</text>
  61. </view>
  62. <view class="list-row">
  63. <text class="iconfont icon-dianhua"></text>
  64. <text>{{ item.mobile }}</text>
  65. </view>
  66. </view>
  67. <view class="list-opea">
  68. <view class="btn border-btn" @click.stop="goOrderList(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: true, //机构列表是否为空
  105. nomoreText: '上拉显示更多',
  106. pageNum: 1, //当前页码
  107. pageSize: 10, //每页获取条数
  108. hasNextPage: false, //是否还有下一页
  109. loadding: false,
  110. pullUpOn: true,
  111. pullFlag: true,
  112. scrollHeight: '', //scoll-view高度
  113. clubList: [],
  114. showSearchModal: false, //模糊搜索框是否显示
  115. organizeId: '',
  116. isIphoneX: false
  117. }
  118. },
  119. onLoad() {
  120. this.isIphoneX = this.$store.state.isIphoneX
  121. this.setScrollHeight()
  122. // 获取传过来的organizeId
  123. const userInfo = uni.getStorageSync('userInfo')
  124. this.organizeId = userInfo.organizeId
  125. // 初始化列表
  126. this.init()
  127. },
  128. methods: {
  129. // 初始化机构列表
  130. async init() {
  131. this.pageNum = 1
  132. this.clubList = await this.getClubList()
  133. if (this.clubList.length > 0) {
  134. this.isEmpty = false
  135. }
  136. },
  137. // 设置scroll高度
  138. setScrollHeight() {
  139. // 窗口高度 - 底部距离
  140. const _that = this
  141. uni.getSystemInfo({
  142. success(res) {
  143. if (_that.isIphoneX) {
  144. _that.scrollHeight = res.windowHeight - 60 + 'px'
  145. } else {
  146. _that.scrollHeight = res.windowHeight - 60 + 'px'
  147. }
  148. }
  149. })
  150. },
  151. async searchClubList() {
  152. // 如果搜索框为空
  153. if (this.searchInputVal.trim().length <= 0) {
  154. this.searchInputVal = ''
  155. return
  156. }
  157. this.searchKeyWords()
  158. },
  159. async searchKeyWords() {
  160. console.log(this.searchInputVal)
  161. this.pageNum = 1
  162. this.clubList = await this.getClubList()
  163. if (this.clubList.length <= 0) {
  164. this.isEmpty = true
  165. } else {
  166. this.isEmpty = false
  167. }
  168. },
  169. // 初始化机构列表
  170. async getClubList() {
  171. let params = {
  172. organizeId: this.organizeId,
  173. name: this.searchInputVal,
  174. pageNum: this.pageNum,
  175. pageSize: this.pageSize
  176. }
  177. const { data: res } = await this.SellerService.GetSellerClubList(params).catch(
  178. error => {
  179. this.$util.msg(error.msg, 1500)
  180. setTimeout(() => {
  181. uni.navigateBack({
  182. delta: 1
  183. })
  184. }, 1500)
  185. }
  186. )
  187. this.pageNum = res.pageNum
  188. this.hasNextPage = res.hasNextPage
  189. return res.list
  190. },
  191. // 加载下一页数据
  192. async getOnReachBottomData() {
  193. if (!this.hasNextPage && this.pullFlag) {
  194. this.loadding = false
  195. this.pullUpOn = false
  196. this.nomoreText = '已至底部'
  197. return
  198. }
  199. this.nomoreText = '上拉显示更多'
  200. this.loadding = true
  201. this.pullUpOn = true
  202. this.pageNum += 1
  203. const list = await this.getClubList()
  204. this.clubList = [...this.clubList, ...list]
  205. setTimeout(() => {
  206. this.pullFlag = true
  207. }, 2000)
  208. },
  209. //输入框失去焦点时触发
  210. onShowClose() {
  211. if (this.searchInputVal != '') {
  212. this.isShowClose = true
  213. } else {
  214. this.isShowClose = false
  215. }
  216. },
  217. async delInputText() {
  218. //清除输入框内容
  219. this.searchInputVal = ''
  220. this.isShowClose = false
  221. this.searchKeyWords()
  222. },
  223. // 跳转下单产品列表
  224. goGoodsList(item) {
  225. uni.setStorageSync('clubInfo', item)
  226. this.$api.navigateTo(`/pages/goods/list`)
  227. },
  228. // 跳转订单列表
  229. goOrderList(item) {
  230. uni.setStorageSync('clubInfo', item)
  231. this.$api.navigateTo(`/pages/user/order/order-list?listType=store&state=0`)
  232. // this.$api.navigateTo(`/pages/user/order/order-historylist`)
  233. },
  234. async hideSearchModalHandle() {
  235. this.showSearchModal = false
  236. this.searchKeyWords()
  237. },
  238. searchInputFoucs() {
  239. this.showSearchModal = true
  240. }
  241. }
  242. }
  243. </script>
  244. <style lang="scss">
  245. page {
  246. height: auto;
  247. }
  248. page,
  249. .container {
  250. /* padding-bottom: 120upx; */
  251. background: #fff;
  252. width: 100%;
  253. height: 100vh;
  254. overflow: hidden;
  255. }
  256. .container {
  257. position: relative;
  258. }
  259. .over-bg {
  260. top: 0;
  261. position: fixed;
  262. width: 100vw;
  263. height: 100vh;
  264. z-index: 888;
  265. background: rgba(0, 0, 0, 0.4);
  266. }
  267. .club-search {
  268. display: flex;
  269. justify-content: space-between;
  270. align-items: center;
  271. height: 74rpx;
  272. width: 702rpx;
  273. padding: 20rpx 24rpx;
  274. background: #ffffff;
  275. position: fixed;
  276. top: 0;
  277. left: 0;
  278. z-index: 999;
  279. .search-from {
  280. display: flex;
  281. justify-content: space-between;
  282. align-items: center;
  283. flex: 1;
  284. height: 64rpx;
  285. background: #f7f7f7;
  286. border-radius: 32rpx;
  287. position: relative;
  288. .icon-sousuo {
  289. width: 64rpx;
  290. height: 64rpx;
  291. line-height: 64rpx;
  292. text-align: center;
  293. display: block;
  294. font-size: $font-size-28;
  295. color: #999999;
  296. }
  297. .icon-guanbi {
  298. font-size: $font-size-28;
  299. color: #999999;
  300. position: absolute;
  301. width: 64rpx;
  302. height: 64rpx;
  303. line-height: 64rpx;
  304. text-align: center;
  305. top: 0;
  306. right: 0;
  307. z-index: 10;
  308. }
  309. .input {
  310. width: 570rpx;
  311. height: 64rpx;
  312. line-height: 64rpx;
  313. color: $text-color;
  314. font-size: $font-size-24;
  315. }
  316. }
  317. .search-btn {
  318. width: 100rpx;
  319. line-height: 64rpx;
  320. text-align: center;
  321. font-size: $font-size-28;
  322. color: $color-system;
  323. background: #ffffff;
  324. }
  325. }
  326. .empty-container {
  327. background: #f7f7f7;
  328. justify-content: flex-start;
  329. .club-empty-image {
  330. width: 200rpx;
  331. height: 200rpx;
  332. margin-top: 400rpx;
  333. margin-bottom: 36rpx;
  334. }
  335. }
  336. .club-main {
  337. position: relative;
  338. padding-top: 57px;
  339. .club-scroll {
  340. // height: 100vh;
  341. // box-sizing: border-box;
  342. // padding-top: 122rpx;
  343. }
  344. .list {
  345. align-items: flex-start;
  346. width: 702rpx;
  347. height: auto;
  348. margin: 0 auto;
  349. padding: 24rpx 0;
  350. background: #ffffff;
  351. position: relative;
  352. border-bottom: 1px solid #ebebeb;
  353. display: flex;
  354. .list-left {
  355. height: 140rpx;
  356. flex: 2;
  357. margin-right: 24rpx;
  358. .list-head {
  359. width: 180rpx;
  360. height: 180rpx;
  361. image {
  362. width: 180rpx;
  363. height: 180rpx;
  364. border-radius: 8rpx;
  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: 100%;
  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. &:last-child {
  434. background: rgb(25, 25, 25);
  435. color: #fff;
  436. }
  437. }
  438. }
  439. }
  440. }
  441. }
  442. </style>