123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440 |
- <template>
- <view class="container club clearfix">
- <view class="club-search clearfix">
- <view class="search-from name">
- <text class="iconfont icon-sousuo"></text>
- <input
- class="input"
- type="text"
- confirm-type="search"
- v-model="searchInputVal"
- @input="onShowClose"
- @confirm="getClubList()"
- placeholder="请输入机构名称/机构联系人"
- maxlength="12"
- @focus="searchInputFoucs"
- @blur="hideSearchModalHandle"
- />
- <text
- class="iconfont icon-guanbi"
- v-if="isShowClose"
- @click="delInputText()"
- ></text>
- </view>
- <view class="search-btn">
- <button class="search-btn" type="default" @click.stop="searchClubList">搜索</button>
- </view>
- </view>
- <view class="club-main">
- <view v-if="isEmpty" class="empty-container">
- <image
- class="club-empty-image"
- src="https://img.caimei365.com/group1/M00/03/71/Cmis2F3wna6AY2ZjAABpmnBICH4247.png"
- mode="aspectFit"
- ></image>
- <view class="txt">暂无机构数据</view>
- </view>
- <view v-else class="club-list">
- <scroll-view scroll-y="true" :style="{ height: scrollHeight }">
- <!-- 机构数据 -->
- <view class="list" v-for="item in clubList" :key="item.userId">
- <view class="list-left">
- <view class="list-head"
- ><image
- src="https://static.caimei365.com/app/img/icon/icon-club@3x.png"
- mode=""
- ></image
- ></view>
- </view>
- <view class="list-item">
- <view class="list-title">
- <text class="list-name">{{ item.clubName }}</text>
- </view>
- <view class="list-contact">
- <view class="list-row">
- <text class="iconfont icon-lianxiren"></text>
- <text>{{ item.userName }}</text>
- </view>
- <view class="list-row">
- <text class="iconfont icon-dianhua"></text>
- <text>{{ item.bindMobile }}</text>
- </view>
- </view>
- <view class="list-opea">
- <view class="btn border-btn" @click.stop="_goGoodsList(item)">
- <text>订单列表</text>
- </view>
- <view class="btn border-btn" @click.stop="_goGoodsList(item)">
- <text>立即下单</text>
- </view>
- </view>
- </view>
- </view>
- <!--加载loadding-->
- <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
- <tui-nomore
- :visible="!pullUpOn"
- :backgroundColor="'#ffffff'"
- :text="nomoreText"
- ></tui-nomore>
- <!--加载loadding-->
- </scroll-view>
- </view>
- </view>
- <view class="over-bg" @click="hideSearchModalHandle" v-if="showSearchModal"></view>
- </view>
- </template>
- <script>
- import authorize from '@/common/config/authorize.js'
- import tuiLoadmore from '@/components/tui-components/loadmore/loadmore'
- import tuiNomore from '@/components/tui-components/nomore/nomore'
- export default {
- components: {
- tuiLoadmore,
- tuiNomore
- },
- data() {
- return {
- isShowClose: false,
- searchInputVal: '', //搜索框数据
- isEmpty: false, //机构列表是否为空
- nomoreText: '上拉显示更多',
- status: 66,
- pageNum: 1, //当前页码
- pageSize: 10, //每页获取条数
- hasNextPage: false, //是否还有下一页
- loadding: false,
- pullUpOn: true,
- pullFlag: true,
- scrollHeight: '', //scoll-view高度
- currPage: '', //当前页面
- prevPage: '', //上一个页面
- clubList: [],
- showSearchModal: false, //模糊搜索框是否显示
- organizeId: ''
- }
- },
- onLoad(data) {
- this.setScrollHeight()
- // 获取传过来的organizeId
- this.organizeId = data.id
- this.init()
- console.log(this.scrollHeight)
- },
- methods: {
- // 初始胡机构列表
- init() {
- this.$api.getStorage().then(response => {
- this.serviceProviderId = response.serviceProviderID
- this.pageNum = 1
- this.getClubList()
- })
- },
- // 设置scroll高度
- setScrollHeight() {
- this.scrollHeight = this.$store.state.windowHeight - 61 + 'px'
- },
- searchClubList() {
- // 如果搜索框为空
- if (this.searchInputVal.trim().length <= 0) {
- this.searchInputVal = ''
- return
- }
- this.pageNum = 1
- this.getClubList()
- },
- // 初始化机构列表
- getClubList() {
- let params = {
- organizeId: this.organizeId,
- name: this.searchInputVal,
- pageNum: 1,
- pageSize: this.pageSize
- // status: this.status
- }
- this.SellerService.GetSellerClubList(params)
- .then(response => {
- let responseData = response.data
- console.log(responseData)
- // 如果返回机构条数大于0
- if (responseData.total > 0) {
- this.isEmpty = false
- this.hasNextPage = response.data.hasNextPage
- this.clubList = responseData.list
- this.pullFlag = false
- setTimeout(() => {
- this.pullFlag = true
- }, 500)
- if (this.hasNextPage) {
- this.pullUpOn = false
- this.nomoreText = '上拉显示更多'
- } else {
- this.pullUpOn = true
- this.loadding = false
- this.nomoreText = '已至底部'
- }
- } else {
- this.isEmpty = true
- }
- })
- .catch(error => {
- this.$util.msg(error.msg, 2000)
- })
- },
- // scroll触底事件
- onReachBottom() {
- if (this.hasNextPage) {
- this.loadding = true
- this.pullUpOn = true
- this.getOnReachBottomData()
- }
- },
- // 加载下一页数据
- getOnReachBottomData() {
- this.pageNum += 1
- let params = {
- organizeId: this.organizeId,
- name: this.searchInputVal,
- pageNum: this.pageNum,
- pageSize: this.pageSize
- }
- this.SellerService.GetSellerClubList(params)
- .then(response => {
- let responseData = response.data
- if (responseData.total > 0) {
- this.hasNextPage = response.data.hasNextPage
- // 将数据追加到clubList列表
- this.clubList = this.clubList.concat(responseData.list)
- this.pullFlag = false // 防上拉暴滑
- setTimeout(() => {
- this.pullFlag = true
- }, 500)
- if (this.hasNextPage) {
- this.pullUpOn = false
- this.nomoreText = '上拉显示更多'
- } else {
- this.pullUpOn = false
- this.loadding = false
- this.nomoreText = '已至底部'
- }
- }
- })
- .catch(error => {
- this.$util.msg(error.msg, 2000)
- })
- },
- //输入框失去焦点时触发
- onShowClose() {
- if (this.searchInputVal != '') {
- this.isShowClose = true
- } else {
- this.isShowClose = false
- }
- },
- delInputText() {
- //清除输入框内容
- this.searchInputVal = ''
- this.isShowClose = false
- this.getClubList()
- },
- // 跳转下单产品列表
- _goGoodsList(item) {
- this.$api.setStorage('clubInfo', item)
- this.$api.navigateTo(`/pages/goods/list?userId=${item.userId}`)
- },
- // 跳转订单列表
- _goOrderList(item) {
- this.$api.setStorage('clubInfo', item)
- this.$api.navigateTo(`pages/user/order/order-list`)
- },
- hideSearchModalHandle() {
- this.showSearchModal = false
- this.searchClubList()
- },
- searchInputFoucs() {
- this.showSearchModal = true
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- height: auto;
- }
- page,
- .container {
- /* padding-bottom: 120upx; */
- background: #fff;
- width: 100%;
- height: 100vh;
- overflow: hidden;
- }
- .container {
- position: relative;
- }
- .over-bg {
- top: 0;
- position: fixed;
- width: 100vw;
- height: 100vh;
- z-index: 888;
- background: rgba(0, 0, 0, 0.4);
- }
- .club-search {
- display: flex;
- justify-content: space-between;
- align-items: center;
- height: 74rpx;
- width: 702rpx;
- padding: 20rpx 24rpx;
- background: #ffffff;
- position: fixed;
- top: 0;
- left: 0;
- z-index: 999;
- .search-from {
- display: flex;
- justify-content: space-between;
- align-items: center;
- flex: 1;
- height: 64rpx;
- background: #f7f7f7;
- border-radius: 32rpx;
- position: relative;
- .icon-sousuo {
- width: 64rpx;
- height: 64rpx;
- line-height: 64rpx;
- text-align: center;
- display: block;
- font-size: $font-size-28;
- color: #999999;
- }
- .icon-guanbi {
- font-size: $font-size-28;
- color: #999999;
- position: absolute;
- width: 64rpx;
- height: 64rpx;
- line-height: 64rpx;
- text-align: center;
- top: 0;
- right: 0;
- z-index: 10;
- }
- .input {
- width: 570rpx;
- height: 64rpx;
- line-height: 64rpx;
- color: $text-color;
- font-size: $font-size-24;
- }
- }
- .search-btn {
- width: 100rpx;
- line-height: 64rpx;
- text-align: center;
- font-size: $font-size-28;
- color: $color-system;
- background: #ffffff;
- }
- }
- .club-main {
- position: relative;
- padding-top: 122rpx;
- .list {
- align-items: flex-start;
- width: 702rpx;
- height: auto;
- margin: 0 auto;
- padding: 24rpx 0;
- background: #ffffff;
- position: relative;
- border-bottom: 1px solid #ebebeb;
- display: flex;
- .list-left {
- height: 140rpx;
- flex: 2;
- margin-right: 24rpx;
- .list-head {
- width: 180rpx;
- height: 180rpx;
- image {
- width: 180rpx;
- height: 180rpx;
- }
- }
- }
- .list-item {
- flex: 8;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- .list-title {
- flex: 2;
- width: 100%;
- color: $text-color;
- flex-direction: row;
- justify-content: flex-start;
- .list-name {
- font-size: $font-size-30;
- width: 400rpx;
- display: block;
- float: left;
- text-align: left;
- -o-text-overflow: ellipsis;
- text-overflow: ellipsis;
- display: -webkit-box;
- word-break: break-all;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 1;
- overflow: hidden;
- }
- }
- .list-contact {
- padding: 20rpx 0;
- .list-row {
- margin: 10rpx 0;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- color: #666;
- text {
- font-size: $font-size-26;
- }
- .iconfont {
- font-size: $font-size-26;
- margin-right: 10rpx;
- }
- }
- }
- .list-opea {
- width: 100%;
- display: flex;
- justify-content: flex-end;
- flex: 4;
- color: #166ce1;
- flex-direction: row;
- align-items: center;
- .btn {
- width: 160rpx;
- height: 56rpx;
- line-height: 54rpx;
- border-radius: 30rpx;
- font-size: $font-size-24;
- color: $text-color;
- text-align: center;
- margin: 0 17rpx;
- border: 1px solid #333333;
- box-sizing: border-box;
- &.border-btn {
- color: #333;
- }
- }
- }
- }
- }
- }
- </style>
|