club-list.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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-iconfonticonfontsousuo1"></text>
  6. <input class="input" type="text" v-model="searchInputVal" placeholder="请输入机构名称搜索" maxlength="12"/>
  7. </view>
  8. <view class="search-btn">
  9. <button class="search-btn" type="default" @click.stop="searchClubList">搜索</button>
  10. </view>
  11. </view>
  12. <view class="club-main">
  13. <view v-if="isEmpty" class="empty-container">
  14. <image class="club-empty-image" src="https://img.caimei365.com/group1/M00/03/71/Cmis2F3wna6AY2ZjAABpmnBICH4247.png" mode="aspectFit"></image>
  15. <view class="txt">暂无机构数据</view>
  16. </view>
  17. <view v-else class="club-list">
  18. <scroll-view scroll-y="true" >
  19. <view class="list" v-for="(item, index) in clubList" :key="index">
  20. <view class="list-left">
  21. <view class="list-head"><image :src="item.headpic ? item.headpic : '../../../static/temp/icon-club@3x.png'" mode=""></image></view>
  22. </view>
  23. <view class="list-item">
  24. <view class="list-title">
  25. <text>{{item.name}}</text>
  26. </view>
  27. <view class="list-opea">
  28. <view class="btn org" @click.stop="_goImmediately(item)">
  29. <text>立即下单</text>
  30. </view>
  31. <view class="btn gre" @click.stop="_goBuyagain(item)">
  32. <text>再次购买</text>
  33. </view>
  34. <view class="btn yel" @click.stop="_goHistory(item)">
  35. <text>订单列表</text>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <!--加载loadding-->
  41. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  42. <tui-nomore :visible="!pullUpOn" bgcolor="#F7F7F7" :text='nomoreText'></tui-nomore>
  43. <!--加载loadding-->
  44. </scroll-view>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import authorize from '@/common/config/authorize.js'
  51. import tuiLoadmore from "@/components/tui-components/loadmore/loadmore"
  52. import tuiNomore from "@/components/tui-components/nomore/nomore"
  53. import { getSellerClubList } from "@/api/seller.js"
  54. export default {
  55. components:{
  56. tuiLoadmore,
  57. tuiNomore,
  58. },
  59. data() {
  60. return {
  61. serviceProviderId:'',
  62. isShowClose:false,
  63. searchInputVal:'',
  64. isEmpty:false,
  65. nomoreText: '上拉显示更多',
  66. pageNum:1,
  67. pageSize:10,
  68. hasNextPage:false,
  69. loadding: false,
  70. pullUpOn: true,
  71. pullFlag: true,
  72. scrollHeight:'',
  73. currPage:'',//当前页面
  74. prevPage:'',//上一个页面
  75. clubList:[],
  76. }
  77. },
  78. onLoad(){
  79. this.setScrollHeight();
  80. },
  81. methods: {
  82. setScrollHeight() {
  83. // 窗口高度 - 底部距离
  84. setTimeout(()=> {
  85. const query = wx.createSelectorQuery().in(this);
  86. query.selectAll('.add-btn').boundingClientRect();
  87. query.exec(res => {
  88. if(res[0][0]){
  89. let winHeight = this.$api.getWindowHeight(),
  90. eleTop = res[0][0].top - 1;
  91. this.scrollHeight = eleTop;
  92. }
  93. })
  94. }, 500)
  95. },
  96. searchClubList(){
  97. this.pageNum=1
  98. this.initclubList()
  99. },
  100. initclubList(){
  101. let params = {name:this.searchInputVal,pageNum:1,pageSize:this.pageSize,spId:this.serviceProviderId,status:90}
  102. getSellerClubList(params).then(response =>{
  103. let responseData = response.data
  104. if(responseData.results&&responseData.results.length > 0){
  105. this.isEmpty = false
  106. this.hasNextPage = response.data.hasNextPage
  107. this.clubList =responseData.results
  108. this.pullFlag = false;
  109. setTimeout(()=>{this.pullFlag = true;},500)
  110. if(this.hasNextPage){
  111. this.pullUpOn = false
  112. this.nomoreText = '上拉显示更多'
  113. }else{
  114. this.pullUpOn = true
  115. this.loadding = false
  116. this.nomoreText = '已至底部'
  117. }
  118. }else{
  119. this.isEmpty = true
  120. }
  121. }).catch(response =>{
  122. this.$util.msg(response.msg,2000)
  123. })
  124. },
  125. getOnReachBottomData(){
  126. this.pageNum+=1
  127. let params = {name:this.searchInputVal,pageNum:this.pageNum,pageSize:this.pageSize,spId:this.serviceProviderId,status:90}
  128. getSellerClubList(params).then(response =>{
  129. let responseData = response.data
  130. if(responseData.results&&responseData.results.length > 0){
  131. this.hasNextPage = response.data.hasNextPage
  132. this.clubList = this.clubList.concat(responseData.results)
  133. this.pullFlag = false;// 防上拉暴滑
  134. setTimeout(()=>{this.pullFlag = true;},500)
  135. if(this.hasNextPage){
  136. this.pullUpOn = false
  137. this.nomoreText = '上拉显示更多'
  138. }else{
  139. this.pullUpOn = false
  140. this.loadding = false
  141. this.nomoreText = '已至底部'
  142. }
  143. }
  144. }).catch(response =>{
  145. this.$util.msg(response.msg,2000)
  146. })
  147. },
  148. onShowClose () {//输入框失去焦点时触发
  149. if(this.searchInputVal != ''){
  150. this.isShowClose = true
  151. }else{
  152. this.isShowClose = false
  153. }
  154. },
  155. delInputText(){//清除输入框内容
  156. this.searchInputVal = ''
  157. this.isShowClose = false
  158. },
  159. _goImmediately(item){
  160. this.$api.setStorage('orderUserInfo',item)
  161. this.$api.navigateTo('/market/pages/cart/immediately')
  162. },
  163. _goBuyagain(item ){
  164. this.$api.setStorage('orderUserInfo',item)
  165. this.$api.navigateTo('/market/pages/cart/buyagain')
  166. },
  167. _goHistory(item){
  168. this.$api.setStorage('orderUserInfo',item)
  169. this.$api.navigateTo('/market/pages/order/order-history')
  170. }
  171. },
  172. onReachBottom() {
  173. if(this.hasNextPage){
  174. this.loadding = true
  175. this.pullUpOn = true
  176. this.getOnReachBottomData()
  177. }
  178. },
  179. onShow() {
  180. this.$api.getStorage().then(response =>{
  181. this.serviceProviderId = response.serviceProviderID
  182. this.pageNum = 1;
  183. this.initclubList();
  184. })
  185. }
  186. }
  187. </script>
  188. <style lang='scss'>
  189. page {
  190. height: auto;
  191. }
  192. page,.container{
  193. /* padding-bottom: 120upx; */
  194. background: #F7F7F7;
  195. border-top: 1px solid #EBEBEB;
  196. }
  197. .container{
  198. position: relative;
  199. }
  200. .club-search{
  201. height: 64rpx;
  202. width: 702rpx;
  203. padding: 24rpx;
  204. background: #FFFFFF;
  205. display: flex;
  206. align-items: center;
  207. position: fixed;
  208. top: 0;
  209. left: 0;
  210. z-index: 999;
  211. .search-from{
  212. width: 582rpx;
  213. height: 64rpx;
  214. background: #F7F7F7;
  215. border-radius: 14rpx;
  216. float: left;
  217. .iconfont{
  218. width: 64rpx;
  219. height: 64rpx;
  220. line-height: 64rpx;
  221. text-align: center;
  222. display: block;
  223. font-size: $font-size-38;
  224. float: left;
  225. color: #999999;
  226. }
  227. .input{
  228. width: 500rpx;
  229. height: 64rpx;
  230. float: left;
  231. line-height: 64rpx;
  232. color: $text-color;
  233. font-size: $font-size-24;
  234. }
  235. }
  236. .search-btn{
  237. width: 120rpx;
  238. line-height: 64rpx;
  239. text-align: center;
  240. font-size: $font-size-28;
  241. color: $color-system;
  242. float: left;
  243. background: #FFFFFF;
  244. }
  245. }
  246. .club-main{
  247. padding-top: 122rpx;
  248. .list{
  249. align-items: center;
  250. width: 702rpx;
  251. height: auto;
  252. padding: 24rpx;
  253. background: #FFFFFF;
  254. position: relative;
  255. border-bottom: 1px solid #EBEBEB;
  256. display: flex;
  257. .list-left{
  258. height: 140rpx;
  259. flex: 2;
  260. .list-head{
  261. width: 140rpx;
  262. height: 140rpx;
  263. image{
  264. width: 140rpx;
  265. height: 140rpx;
  266. }
  267. }
  268. }
  269. .list-item{
  270. height: 140rpx;
  271. flex: 8;
  272. display: flex;
  273. flex-direction:column ;
  274. .list-title{
  275. flex: 2;
  276. line-height: 40rpx;
  277. width: 100%;
  278. font-size: $font-size-28;
  279. color: $text-color;
  280. text-align: left;
  281. padding-left: 11rpx;
  282. }
  283. .list-opea{
  284. width: 100%;
  285. display: flex;
  286. flex: 4;
  287. color: #166CE1;
  288. flex-direction: row;
  289. align-items: center;
  290. .btn{
  291. width: 156rpx;
  292. height: 60rpx;
  293. line-height: 60rpx;
  294. border-radius: 10rpx;
  295. font-size: $font-size-24;
  296. color: $text-color;
  297. text-align: center;
  298. margin: 0 12rpx;
  299. &.org{
  300. background:$btn-confirm;
  301. color: #FFFFFF;
  302. }
  303. &.gre{
  304. background:$btn-confirm;
  305. color: #FFFFFF;
  306. }
  307. &.yel{
  308. background:#FFFFFF ;
  309. border: 1px solid #999999;
  310. }
  311. }
  312. }
  313. }
  314. }
  315. }
  316. </style>