club-list.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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-historylist?clubID=${item.clubID}&listType=0`)
  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. }
  204. .container{
  205. position: relative;
  206. }
  207. .club-search{
  208. height: 64rpx;
  209. width: 702rpx;
  210. padding: 24rpx;
  211. background: #FFFFFF;
  212. display: flex;
  213. align-items: center;
  214. position: fixed;
  215. top: 0;
  216. left: 0;
  217. z-index: 999;
  218. .search-from{
  219. width: 582rpx;
  220. height: 64rpx;
  221. background: #F7F7F7;
  222. border-radius: 14rpx;
  223. float: left;
  224. position: relative;
  225. .icon-iconfonticonfontsousuo1{
  226. width: 64rpx;
  227. height: 64rpx;
  228. line-height: 64rpx;
  229. text-align: center;
  230. display: block;
  231. font-size: $font-size-38;
  232. float: left;
  233. color: #999999;
  234. }
  235. .icon-shanchu1{
  236. font-size: $font-size-32;
  237. color: #999999;
  238. position: absolute;
  239. width: 64rpx;
  240. height: 64rpx;
  241. line-height: 64rpx;
  242. text-align: center;
  243. top: 0;
  244. right: 0;
  245. z-index: 10;
  246. }
  247. .input{
  248. width: 500rpx;
  249. height: 64rpx;
  250. float: left;
  251. line-height: 64rpx;
  252. color: $text-color;
  253. font-size: $font-size-24;
  254. }
  255. }
  256. .search-btn{
  257. width: 120rpx;
  258. line-height: 64rpx;
  259. text-align: center;
  260. font-size: $font-size-28;
  261. color: $color-system;
  262. float: left;
  263. background: #FFFFFF;
  264. }
  265. }
  266. .club-main{
  267. padding-top: 122rpx;
  268. .list{
  269. align-items: center;
  270. width: 702rpx;
  271. height: auto;
  272. padding: 24rpx;
  273. background: #FFFFFF;
  274. position: relative;
  275. border-bottom: 1px solid #EBEBEB;
  276. display: flex;
  277. .list-left{
  278. height: 140rpx;
  279. flex: 2;
  280. margin-right: 10rpx;
  281. .list-head{
  282. width: 140rpx;
  283. height: 140rpx;
  284. border-radius: 14rpx;
  285. image{
  286. width: 140rpx;
  287. height: 140rpx;
  288. border-radius: 14rpx;
  289. }
  290. }
  291. }
  292. .list-item{
  293. height: 140rpx;
  294. flex: 8;
  295. display: flex;
  296. flex-direction:column ;
  297. .list-title{
  298. flex: 2;
  299. line-height: 40rpx;
  300. width: 100%;
  301. font-size: $font-size-28;
  302. color: $text-color;
  303. text-align: left;
  304. padding-left: 11rpx;
  305. }
  306. .list-opea{
  307. width: 100%;
  308. display: flex;
  309. flex: 4;
  310. color: #166CE1;
  311. flex-direction: row;
  312. align-items: center;
  313. .btn{
  314. width: 156rpx;
  315. height: 60rpx;
  316. line-height: 60rpx;
  317. border-radius: 10rpx;
  318. font-size: $font-size-24;
  319. color: $text-color;
  320. text-align: center;
  321. margin: 0 12rpx;
  322. &.org{
  323. background:$btn-confirm;
  324. color: #FFFFFF;
  325. }
  326. &.gre{
  327. background:$btn-confirm;
  328. color: #FFFFFF;
  329. }
  330. &.yel{
  331. background:#FFFFFF ;
  332. border: 1px solid #999999;
  333. }
  334. }
  335. }
  336. }
  337. }
  338. }
  339. </style>