club-list.vue 8.5 KB

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