club-list.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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. status:66,
  75. pageNum:1,
  76. pageSize:10,
  77. hasNextPage:false,
  78. loadding: false,
  79. pullUpOn: true,
  80. pullFlag: true,
  81. scrollHeight:'',
  82. currPage:'',//当前页面
  83. prevPage:'',//上一个页面
  84. clubList:[],
  85. }
  86. },
  87. onLoad(){
  88. this.setScrollHeight();
  89. },
  90. methods: {
  91. setScrollHeight() {
  92. // 窗口高度 - 底部距离
  93. setTimeout(()=> {
  94. const query = wx.createSelectorQuery().in(this);
  95. query.selectAll('.add-btn').boundingClientRect();
  96. query.exec(res => {
  97. if(res[0][0]){
  98. let winHeight = this.$api.getWindowHeight(),
  99. eleTop = res[0][0].top - 1;
  100. this.scrollHeight = eleTop;
  101. }
  102. })
  103. }, 500)
  104. },
  105. searchClubList(){
  106. this.pageNum=1
  107. this.initclubList()
  108. },
  109. initclubList(){
  110. let params = {userIdentity:'',name:this.searchInputVal,pageNum:1,pageSize:this.pageSize,spId:this.serviceProviderId,status:this.status}
  111. getSellerClubList(params).then(response =>{
  112. let responseData = response.data
  113. if(responseData.results&&responseData.results.length > 0){
  114. this.isEmpty = false
  115. this.hasNextPage = response.data.hasNextPage
  116. this.clubList =responseData.results
  117. this.pullFlag = false;
  118. setTimeout(()=>{this.pullFlag = true;},500)
  119. if(this.hasNextPage){
  120. this.pullUpOn = false
  121. this.nomoreText = '上拉显示更多'
  122. }else{
  123. this.pullUpOn = true
  124. this.loadding = false
  125. this.nomoreText = '已至底部'
  126. }
  127. }else{
  128. this.isEmpty = true
  129. }
  130. }).catch(error =>{
  131. this.$util.msg(error.msg,2000)
  132. })
  133. },
  134. getOnReachBottomData(){
  135. this.pageNum+=1
  136. let params = {userIdentity:'',name:this.searchInputVal,pageNum:this.pageNum,pageSize:this.pageSize,spId:this.serviceProviderId,status:this.status}
  137. getSellerClubList(params).then(response =>{
  138. let responseData = response.data
  139. if(responseData.results&&responseData.results.length > 0){
  140. this.hasNextPage = response.data.hasNextPage
  141. this.clubList = this.clubList.concat(responseData.results)
  142. this.pullFlag = false;// 防上拉暴滑
  143. setTimeout(()=>{this.pullFlag = true;},500)
  144. if(this.hasNextPage){
  145. this.pullUpOn = false
  146. this.nomoreText = '上拉显示更多'
  147. }else{
  148. this.pullUpOn = false
  149. this.loadding = false
  150. this.nomoreText = '已至底部'
  151. }
  152. }
  153. }).catch(error =>{
  154. this.$util.msg(error.msg,2000)
  155. })
  156. },
  157. onShowClose () {//输入框失去焦点时触发
  158. if(this.searchInputVal != ''){
  159. this.isShowClose = true
  160. }else{
  161. this.isShowClose = false
  162. }
  163. },
  164. delInputText(){//清除输入框内容
  165. this.searchInputVal = ''
  166. this.isShowClose = false
  167. },
  168. _goImmediately(item){
  169. this.$api.setStorage('orderUserInfo',item)
  170. this.$api.navigateTo('/seller/pages/cart/immediately')
  171. },
  172. _goBuyagain(item ){
  173. this.$api.setStorage('orderUserInfo',item)
  174. this.$api.navigateTo('/seller/pages/cart/buyagain')
  175. },
  176. _goHistory(item){
  177. this.$api.setStorage('orderUserInfo',item)
  178. this.$api.navigateTo('/seller/pages/order/order-history')
  179. }
  180. },
  181. onReachBottom() {
  182. if(this.hasNextPage){
  183. this.loadding = true
  184. this.pullUpOn = true
  185. this.getOnReachBottomData()
  186. }
  187. },
  188. onShow() {
  189. this.$api.getStorage().then(response =>{
  190. this.serviceProviderId = response.serviceProviderID
  191. this.pageNum = 1;
  192. this.initclubList();
  193. })
  194. }
  195. }
  196. </script>
  197. <style lang='scss'>
  198. page {
  199. height: auto;
  200. }
  201. page,.container{
  202. /* padding-bottom: 120upx; */
  203. background: #F7F7F7;
  204. border-top: 1px solid #EBEBEB;
  205. }
  206. .container{
  207. position: relative;
  208. }
  209. .club-search{
  210. height: 64rpx;
  211. width: 702rpx;
  212. padding: 24rpx;
  213. background: #FFFFFF;
  214. display: flex;
  215. align-items: center;
  216. position: fixed;
  217. top: 0;
  218. left: 0;
  219. z-index: 999;
  220. .search-from{
  221. width: 582rpx;
  222. height: 64rpx;
  223. background: #F7F7F7;
  224. border-radius: 14rpx;
  225. float: left;
  226. position: relative;
  227. .icon-iconfonticonfontsousuo1{
  228. width: 64rpx;
  229. height: 64rpx;
  230. line-height: 64rpx;
  231. text-align: center;
  232. display: block;
  233. font-size: $font-size-38;
  234. float: left;
  235. color: #999999;
  236. }
  237. .icon-shanchu1{
  238. font-size: $font-size-32;
  239. color: #999999;
  240. position: absolute;
  241. width: 64rpx;
  242. height: 64rpx;
  243. line-height: 64rpx;
  244. text-align: center;
  245. top: 0;
  246. right: 0;
  247. z-index: 10;
  248. }
  249. .input{
  250. width: 500rpx;
  251. height: 64rpx;
  252. float: left;
  253. line-height: 64rpx;
  254. color: $text-color;
  255. font-size: $font-size-24;
  256. }
  257. }
  258. .search-btn{
  259. width: 120rpx;
  260. line-height: 64rpx;
  261. text-align: center;
  262. font-size: $font-size-28;
  263. color: $color-system;
  264. float: left;
  265. background: #FFFFFF;
  266. }
  267. }
  268. .club-main{
  269. padding-top: 122rpx;
  270. .list{
  271. align-items: center;
  272. width: 702rpx;
  273. height: auto;
  274. padding: 24rpx;
  275. background: #FFFFFF;
  276. position: relative;
  277. border-bottom: 1px solid #EBEBEB;
  278. display: flex;
  279. .list-left{
  280. height: 140rpx;
  281. flex: 2;
  282. margin-right: 10rpx;
  283. .list-head{
  284. width: 140rpx;
  285. height: 140rpx;
  286. border-radius: 14rpx;
  287. image{
  288. width: 140rpx;
  289. height: 140rpx;
  290. border-radius: 14rpx;
  291. }
  292. }
  293. }
  294. .list-item{
  295. height: 140rpx;
  296. flex: 8;
  297. display: flex;
  298. flex-direction:column ;
  299. .list-title{
  300. flex: 2;
  301. line-height: 40rpx;
  302. width: 100%;
  303. font-size: $font-size-28;
  304. color: $text-color;
  305. text-align: left;
  306. padding-left: 11rpx;
  307. }
  308. .list-opea{
  309. width: 100%;
  310. display: flex;
  311. flex: 4;
  312. color: #166CE1;
  313. flex-direction: row;
  314. align-items: center;
  315. .btn{
  316. width: 156rpx;
  317. height: 60rpx;
  318. line-height: 60rpx;
  319. border-radius: 10rpx;
  320. font-size: $font-size-24;
  321. color: $text-color;
  322. text-align: center;
  323. margin: 0 12rpx;
  324. &.org{
  325. background:$btn-confirm;
  326. color: #FFFFFF;
  327. }
  328. &.gre{
  329. background:$btn-confirm;
  330. color: #FFFFFF;
  331. }
  332. &.yel{
  333. background:#FFFFFF ;
  334. border: 1px solid #999999;
  335. }
  336. }
  337. }
  338. }
  339. }
  340. }
  341. </style>