club-list.vue 9.4 KB

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