club-list.vue 9.7 KB

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