club-list.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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
  7. class="input"
  8. type="text"
  9. confirm-type="search"
  10. v-model="listQuery.name"
  11. @input="onShowClose"
  12. @confirm="GetSellerClubList()"
  13. placeholder="机构名称/联系人"
  14. maxlength="12"
  15. />
  16. <text class="iconfont icon-shanchu2" v-if="isShowClose" @click="delInputText()"></text>
  17. </view>
  18. <view class="search-btn">
  19. <button class="search-btn" type="default" @click.stop="searchClubList">搜索</button>
  20. </view>
  21. </view>
  22. <view class="club-main">
  23. <view v-if="isEmpty" class="empty-container">
  24. <image
  25. class="club-empty-image"
  26. src="https://img.caimei365.com/group1/M00/03/71/Cmis2F3wna6AY2ZjAABpmnBICH4247.png"
  27. mode="aspectFit"
  28. ></image>
  29. <view class="txt">暂无机构数据</view>
  30. </view>
  31. <view v-else class="club-list">
  32. <view class="list" v-for="(club, index) in clubList" :key="index">
  33. <view class="club-list-top">
  34. <view class="list-left">
  35. <view class="list-head">
  36. <image :src="staticUrl + 'icon_default_club@3x.png'" mode=""></image>
  37. </view>
  38. </view>
  39. <view class="list-item">
  40. <view class="list-title">
  41. <text class="list-name"> {{ club.name }} </text>
  42. </view>
  43. <view class="list-ntel">
  44. <text class="list-link">{{ club.linkMan ? club.linkMan : '' }}</text>
  45. <text class="list-texl">{{ club.contractMobile ? club.contractMobile : '' }}</text>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="club-list-bot">
  50. <view class="btn btn1" @click.stop="handleClickOper(2, club)">查看历史订单</view>
  51. <view class="btn btn2" @click.stop="handleClickOper(1, club)">立即下单</view>
  52. </view>
  53. </view>
  54. <!--加载loadding-->
  55. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  56. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#ffffff'" :text="nomoreText"></tui-nomore>
  57. <!--加载loadding-->
  58. </view>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. const defaultListQuery = {
  64. userIdentity: '',
  65. name: '',
  66. pageNum: 1,
  67. pageSize: 10,
  68. spId: 0,
  69. status: 66,
  70. type: 1,
  71. groupServiceId: 0
  72. }
  73. export default {
  74. data() {
  75. return {
  76. staticUrl: this.global.staticUrl,
  77. isShowClose: false,
  78. isEmpty: false,
  79. nomoreText: '上拉显示更多',
  80. hasNextPage: false,
  81. loadding: false,
  82. pullUpOn: true,
  83. pullFlag: true,
  84. scrollHeight: '',
  85. currPage: '', //当前页面
  86. prevPage: '', //上一个页面
  87. clubList: [],
  88. listQuery: Object.assign({}, defaultListQuery),
  89. }
  90. },
  91. onLoad() {},
  92. methods: {
  93. async initGetStotage() {
  94. // 初始化
  95. const user = await this.$api.getStorage()
  96. this.listQuery.spId = user.serviceProviderId
  97. this.GetSellerClubList()
  98. },
  99. searchClubList() {
  100. // 搜索
  101. this.GetSellerClubList()
  102. },
  103. async GetSellerClubList() {
  104. try{
  105. this.listQuery.pageNum = 1
  106. const res = await this.SellerService.sellerClubList(this.listQuery)
  107. const data = res.data
  108. if (data.list && data.list.length > 0) {
  109. this.isEmpty = false
  110. this.hasNextPage = data.hasNextPage
  111. this.clubList = data.list
  112. this.pullFlag = false
  113. setTimeout(() => {
  114. this.pullFlag = true
  115. }, 500)
  116. if (this.hasNextPage) {
  117. this.pullUpOn = false
  118. this.nomoreText = '上拉显示更多'
  119. } else {
  120. this.pullUpOn = true
  121. this.loadding = false
  122. this.nomoreText = '已至底部'
  123. }
  124. } else {
  125. this.isEmpty = true
  126. }
  127. }catch(error){
  128. this.$util.msg(error.msg, 2000)
  129. }
  130. },
  131. async getOnReachBottomData() {
  132. try{
  133. this.listQuery.pageNum += 1
  134. const res = await this.SellerService.sellerClubList(this.listQuery)
  135. const data = res.data
  136. if (data.list && data.list.length > 0) {
  137. this.hasNextPage = data.hasNextPage
  138. this.clubList = this.clubList.concat(data.list)
  139. this.pullFlag = false // 防上拉暴滑
  140. setTimeout(() => {
  141. this.pullFlag = true
  142. }, 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. console.log(error)
  154. }
  155. },
  156. onShowClose() {
  157. //输入框失去焦点时触发
  158. if (this.listQuery.name != '') {
  159. this.isShowClose = true
  160. } else {
  161. this.isShowClose = false
  162. }
  163. },
  164. delInputText() {
  165. //清除输入框内容
  166. this.listQuery.name = ''
  167. this.isShowClose = false
  168. },
  169. handleClickOper(type, club) {
  170. const pathMap = {
  171. 1: '/pages/seller/goods/list',
  172. 2: '/pages/seller/order/order-club-list?listType=0',
  173. 3: '/pages/seller/cart/buyagain',
  174. 4: '/pages/seller/order/create-recharge-order',
  175. 5: '/pages/seller/order/order-club-list?listType=0',
  176. 6: '/pages/seller/cart/coupon'
  177. }
  178. this.$api.setStorage('orderUserInfo', club)
  179. this.$api.navigateTo(pathMap[type])
  180. },
  181. },
  182. onReachBottom() {
  183. if (this.hasNextPage) {
  184. this.loadding = true
  185. this.pullUpOn = true
  186. this.getOnReachBottomData()
  187. }
  188. },
  189. onShow() {
  190. this.initGetStotage()
  191. }
  192. }
  193. </script>
  194. <style lang="scss">
  195. page {
  196. height: auto;
  197. }
  198. page,
  199. .container {
  200. /* padding-bottom: 120upx; */
  201. background: #f7f7f7;
  202. }
  203. .container {
  204. position: relative;
  205. }
  206. .club-search {
  207. height: 64rpx;
  208. width: 702rpx;
  209. padding: 24rpx;
  210. background: #ffffff;
  211. display: flex;
  212. align-items: center;
  213. position: fixed;
  214. top: 0;
  215. left: 0;
  216. z-index: 999;
  217. .search-from {
  218. width: 582rpx;
  219. height: 64rpx;
  220. background: #f7f7f7;
  221. border-radius: 32rpx;
  222. float: left;
  223. position: relative;
  224. .icon-iconfonticonfontsousuo1 {
  225. width: 64rpx;
  226. height: 64rpx;
  227. line-height: 64rpx;
  228. text-align: center;
  229. display: block;
  230. font-size: $font-size-38;
  231. float: left;
  232. color: #999999;
  233. }
  234. .icon-shanchu2 {
  235. font-size: $font-size-32;
  236. color: #999999;
  237. position: absolute;
  238. width: 64rpx;
  239. height: 64rpx;
  240. line-height: 64rpx;
  241. text-align: center;
  242. top: 0;
  243. right: 0;
  244. z-index: 10;
  245. }
  246. .input {
  247. width: 500rpx;
  248. height: 64rpx;
  249. float: left;
  250. line-height: 64rpx;
  251. color: $text-color;
  252. font-size: $font-size-24;
  253. }
  254. }
  255. .search-btn {
  256. width: 120rpx;
  257. line-height: 64rpx;
  258. text-align: center;
  259. font-size: $font-size-28;
  260. color: $color-system;
  261. float: left;
  262. background: #ffffff;
  263. }
  264. }
  265. .club-main {
  266. padding-top: 122rpx;
  267. .club-list{
  268. width: 100%;
  269. height: auto;
  270. box-sizing: border-box;
  271. padding: 0 24rpx;
  272. }
  273. .list {
  274. align-items: center;
  275. width: 100%;
  276. height: auto;
  277. padding: 24rpx;
  278. background: #ffffff;
  279. position: relative;
  280. box-sizing: border-box;
  281. margin: 12rpx 0;
  282. float: left;
  283. border-radius: 16rpx;
  284. .club-list-top {
  285. width: 100%;
  286. height: 140rpx;
  287. float: left;
  288. display: flex;
  289. align-items: center;
  290. margin-bottom: 24rpx;
  291. .list-left {
  292. height: 140rpx;
  293. flex: 2;
  294. margin-right: 10rpx;
  295. .list-head {
  296. width: 140rpx;
  297. height: 140rpx;
  298. border-radius: 8rpx;
  299. image {
  300. width: 140rpx;
  301. height: 140rpx;
  302. border-radius: 8rpx;
  303. }
  304. }
  305. }
  306. .list-item {
  307. height: 140rpx;
  308. flex: 8;
  309. display: flex;
  310. flex-direction: column;
  311. box-sizing: border-box;
  312. padding-left: 24rpx;
  313. .list-title {
  314. flex: 2;
  315. line-height: 80rpx;
  316. width: 100%;
  317. font-size: $font-size-30;
  318. color: $text-color;
  319. flex-direction: row;
  320. justify-content: flex-start;
  321. .list-name {
  322. min-width: 100rpx;
  323. display: block;
  324. float: left;
  325. text-align: left;
  326. -o-text-overflow: ellipsis;
  327. text-overflow: ellipsis;
  328. display: -webkit-box;
  329. word-break: break-all;
  330. -webkit-box-orient: vertical;
  331. -webkit-line-clamp: 1;
  332. overflow: hidden;
  333. font-weight: bold;
  334. }
  335. }
  336. .list-ntel {
  337. width: 100%;
  338. height: 50rpx;
  339. float: left;
  340. line-height: 50rpx;
  341. text-align: left;
  342. font-size: $font-size-26;
  343. color: #666666;
  344. .list-link {
  345. display: inline-block;
  346. float: left;
  347. margin-right: 40rpx;
  348. }
  349. .list-texl {
  350. display: inline-block;
  351. float: left;
  352. }
  353. }
  354. }
  355. }
  356. .club-list-bot {
  357. width: 100%;
  358. height: auto;
  359. border-top: 1px solid #e1e1e1;
  360. padding-top: 24rpx;
  361. float: left;
  362. .btn {
  363. width: 50%;
  364. line-height: 48rpx;
  365. box-sizing: border-box;
  366. text-align: center;
  367. font-size: $font-size-28;
  368. float: left;
  369. font-weight: bold;
  370. &.btn1 {
  371. color: #666666;
  372. border-right: 1px solid #e1e1e1;
  373. }
  374. &.btn2 {
  375. color: #F3B574;
  376. }
  377. }
  378. }
  379. }
  380. }
  381. </style>