123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467 |
- <template>
- <view class="container supplier clearfix">
- <view class="supplier-search clearfix">
- <view class="search-from name">
- <text class="iconfont icon-sousuo"></text>
- <input class="input"
- type="text"
- confirm-type="search"
- v-model="listQuery.keyword"
- :focus="isFocus"
- @input="onShowClose"
- @confirm="GetSearchSupplierList()"
- placeholder="请输入供应商名称"
- maxlength="16"/>
- <text class="iconfont icon-shanchu1" v-if="isShowClose" @click="delInputText()"></text>
- </view>
- <view class="search-btn">
- <button class="search-btn" type="default" @click.stop="searchsupplierList">搜索</button>
- </view>
- </view>
- <view class="supplier-main">
- <view v-if="isEmpty" class="empty-container">
- <image class="empty-container-image" :src="productNoneImage" mode="aspectFit"></image>
- <view class="txt">暂无供应商数据^_^</view>
- </view>
- <view v-else class="supplier-list">
- <view class="list clearfix" v-for="(item, index) in supplierList" :key="index">
- <view class="list-top">
- <view class="list-top-supplier" @click="goSupplier(item.s_id)">
- <view class="logo"><img :src="item.s_logo" alt=""></view>
- <view class="main">
- <view class="name">{{ item.s_name }}</view>
- <view class="massgs">
- <view class="label">满意度:</view>
- <view class="p-stars">
- <uni-stars :stars="6" :iconClass="iconClass" :iconColor="iconColor" :fontSize="36" :widthInfo="176"></uni-stars>
- </view>
- </view>
- </view>
- <view class="right"><text class="iconfont icon-xiayibu"></text></view>
- </view>
- <view class="list-top-msg">
- <view class="msg-pin clearfix">
- <view class="label">经营品项:</view>
- <view class="label-li" v-if="item.s_business">
- <text class="text" v-for="(label, idx) in SetNewBusiness(item.s_business)" :key="idx">{{ label }}</text>
- </view>
- <view class="label-li" v-else>
- <text class="none">暂无</text>
- </view>
- </view>
- <view class="msg-pin clearfix">
- <view class="label">所在地区:</view>
- <view class="label-text">{{ item.s_address ? item.s_address : '暂无'}}</view>
- </view>
- </view>
- </view>
- <view class="list-bottom">
- <view class="pros-item" v-for="(pros, pdx) in item.products" :key="pdx" @click.stop="navToDetailPage(pros.p_id)">
- <image class="pros-item-image" :src="pros.p_image" mode="scaleToFill"></image>
- <view class="pros-name">{{ pros.p_name }}</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-->
- </view>
- </view>
- </view>
- </template>
- <script>
- import tuiLoadmore from "@/components/tui-components/loadmore/loadmore"
- import tuiNomore from "@/components/tui-components/nomore/nomore"
- import uniStars from '@/components/uni-stars/uni-stars.vue'
- import authorize from '@/common/config/authorize.js'
- import wxLogin from "@/common/config/wxLogin.js"
-
- export default {
- components:{
- tuiLoadmore,
- tuiNomore,
- uniStars
- },
- data() {
- return {
- iconClass:'icon-aixin',
- iconColor:'#ff9100',
- serviceProviderId:'',
- isShowClose:false,
- isEmpty:false,
- isFocus:true,
- productNoneImage:'https://static.caimei365.com/app/img/icon/icon-pnone.png',
- nomoreText: '上拉显示更多',
- loadding: false,
- pullUpOn: true,
- pullFlag: true,
- supplierList:[],
- isIphoneX:this.$store.state.isIphoneX,
- listQuery:{
- keyword: '',
- pageSize: 10,
- pageNum: 1
- },
- total:0
- }
- },
- onLoad(option){
- if(option.type =='share'){
- authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
- console.log(wxResponse)
- if(wxResponse == 1){
- wxLogin.wxLoginAuthorize()
- }else{
- console.log(new Date +'用户未授权微信信息')
- }
- })
- }
- if(option.keyWord){
- console.log(option.keyWord)
- this.listQuery.keyword = option.keyWord
- this.GetSearchSupplierList();
- }
- },
- methods: {
- searchsupplierList(){//搜索
- this.listQuery.pageNum=1
- this.GetSearchSupplierList()
- },
- GetSearchSupplierList(){//查询供应商列表
- this.ShopService.GetSearchSupplierList(this.listQuery).then(response =>{
- let data = JSON.parse(response.data)
- let dataList = data.items
- console.log(data)
- this.total = data.total
- if(dataList && dataList.length > 0){
- this.isEmpty = false
- this.supplierList = dataList
- this.pullFlag = false;
- setTimeout(()=>{this.pullFlag = true;},500)
- if(this.total>this.supplierList.length){
- 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)
- })
- },
- GetSearchSupplierListBottomData(){//上滑加载
- this.listQuery.pageNum+=1
- this.ShopService.GetSupplierHomeProductList(this.listQuery).then(response =>{
- let data = JSON.parse(response.data)
- console.log(data)
- this.total = data.total
- this.supplierList = this.supplierList.concat(data.items)
- if(this.total>this.supplierList.length){
- this.pullUpOn = false
- this.nomoreText = '上拉显示更多'
- }else{
- this.pullUpOn = true
- this.loadding = false
- this.nomoreText = '已至底部'
- }
- }).catch(error =>{
- this.$util.msg(error.msg,2000)
- })
- },
- onShowClose () {//输入框失去焦点时触发
- if(this.listQuery.keyword != ''){
- this.isShowClose = true
- }else{
- this.isShowClose = false
- this.listQuery.pageNum=1
- this.GetSearchSupplierList()
- }
- },
- delInputText(){//清除输入框内容
- this.listQuery.keyword = ''
- this.isShowClose = false
- this.listQuery.pageNum=1
- this.GetSearchSupplierList()
- },
- navToDetailPage(id) {//跳转商品详情页
- this.$api.navigateTo(`/pages/goods/product?id=${id}`)
- },
- SetNewBusiness(value){//回显处理主营内容
- let Array = []
- value.split('/').forEach((item,index) =>{
- Array.push(item)
- })
- return Array
- },
- goSupplier(value){//跳供应商资料页
- this.$api.navigateTo('/supplier/pages/user/my-shop?shopId='+value)
- },
- },
- onReachBottom() {
- if(this.total>this.supplierList.length){
- this.loadding = true
- this.pullUpOn = true
- this.GetSearchSupplierListBottomData()
- }
- },
- onShareAppMessage(res){//分享转发
- if (res.from === 'button') {
- // 来自页面内转发按钮
- }
- return {
- title: `采美正品供应商,质量有保证!`,
- path: `search/pages/search/search-supplier?type=share&keyWord=${this.listQuery.keyword}`
- }
- },
- onShow() {
-
- }
- }
- </script>
- <style lang='scss'>
- page {
- height: auto;
- }
- page,.container{
- /* padding-bottom: 120upx; */
- background: #F7F7F7;
- }
- .container{
- position: relative;
- }
- .supplier {
- width: 100%;
- height: auto;
- box-sizing: border-box;
- }
- .supplier-search{
- height: 84rpx;
- width: 100%;
- padding:10rpx 24rpx;
- background: #FFFFFF;
- display: flex;
- align-items: center;
- position: fixed;
- top: 0;
- left: 0;
- z-index: 999;
- box-sizing: border-box;
- .search-from{
- width: 582rpx;
- height: 64rpx;
- background: #F7F7F7;
- border-radius: 32rpx;
- float: left;
- position: relative;
- .input{
- width: 500rpx;
- height: 64rpx;
- float: left;
- line-height: 64rpx;
- color: $text-color;
- font-size: $font-size-24;
- }
- .icon-sousuo{
- width: 64rpx;
- height: 64rpx;
- line-height: 64rpx;
- text-align: center;
- display: block;
- font-size: $font-size-38;
- float: left;
- color: #999999;
- }
- .icon-shanchu1{
- font-size: $font-size-32;
- color: #999999;
- position: absolute;
- width: 64rpx;
- height: 64rpx;
- line-height: 64rpx;
- text-align: center;
- top: 0;
- right: 0;
- z-index: 10;
- }
- }
- .search-btn{
- width: 120rpx;
- line-height: 64rpx;
- text-align: center;
- font-size: $font-size-28;
- color: #666666;
- float: left;
- background: #FFFFFF;
- }
- }
- .supplier-main{
- margin-top: 94rpx;
- }
- .list{
- box-sizing: border-box;
- padding: 0 24rpx;
- background-color:#FFFFFF ;
- margin-bottom: 20rpx;
- }
- .list-top{
- width: 100%;
- height: auto;
- }
- .list-top-msg{
- width: 100%;
- height: auto;
- box-sizing: border-box;
- padding-left: 115rpx;
- .msg-pin{
- width: 100%;
- height: auto;
- margin-bottom: 16rpx;
- .label{
- float: left;
- line-height: 37rpx;
- font-size: $font-size-26;
- color: #999999;
- }
- .label-li{
- width: 476rpx;
- float: left;
- line-height: 37rpx;
- .text{
- display: inline-block;
- padding: 0 8rpx;
- height: 33rpx;
- border-radius: 6rpx;
- background-color: #86b2fb;
- color: #FFFFFF;
- line-height: 33rpx;
- float: left;
- font-size: $font-size-20;
- text-align: center;
- margin: 10rpx;
- margin-top: 5rpx;
- }
- .none{
- font-size: $font-size-20;
- color: #999999;
- }
- }
- .label-text{
- line-height: 37rpx;
- font-size: $font-size-26;
- color: #999999;
- margin-left: 10rpx;
- float: left;
- }
- }
- }
- .list-top-supplier{
- width: 100%;
- height: 140rpx;
- padding: 30rpx 0 10rpx 0;
- box-sizing: border-box;
- background-color: #FFFFFF;
- position: relative;
- box-sizing: border-box;
- .logo{
- width: 90rpx;
- height: 72rpx;
- float: left;
- border: 1px solid #efefef;
- border-radius: 6rpx;
- image{
- width: 100%;
- height: 100%;
- display: block;
- border-radius: 6rpx;
- }
- }
- .main{
- width: 470rpx;
- height: 92rpx;
- float: left;
- margin-left: 20rpx;
- .name{
- width: 100%;
- line-height: 46rpx;
- float: left;
- font-size: $font-size-28;
- color: $text-color;
- float: right;
- overflow: hidden;
- text-overflow:ellipsis;
- white-space: nowrap;
- text-align: left;
- }
- .massgs{
- width: 100%;
- line-height: 46rpx;
- float: left;
- font-size: $font-size-24;
- color: #999999;
- .label{
- float: left;
- }
- .p-stars{
- float: left;
- margin-left: 20rpx;
- }
- }
- }
- .icon-xiayibu{
- line-height: 154rpx;
- display: inline-block;
- position: absolute;
- width: 48rpx;
- top: 0;
- right: 0;
- color: #b2b2b2;
- }
- }
- .list-bottom{
- width: 100%;
- height: auto;
- float: left;
- padding: 20rpx 0;
- .pros-item{
- width: 220rpx;
- height: auto;
- float: left;
- margin-right: 20rpx;
- &:last-child{
- margin-right: 0;
- }
- .pros-item-image{
- width: 218rpx;
- height: 218rpx;
- display: block;
- float: left;
- border: 1px solid #EBEBEB;
- border-radius: 6rpx;
- }
- .pros-name{
- width: 100%;
- height: 54rpx;
- line-height: 54rpx;
- box-sizing: border-box;
- padding: 0 10rpx;
- font-size: $font-size-24;
- color: #666666;
- white-space: normal;
- word-break: break-all;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 1;
- }
- }
- }
- </style>
|