club-list.vue 10 KB

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