123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633 |
- <template>
- <view class="container commodity-list-wrapper" :style="{'overflow':(showSkeleton? 'hidden' : 'auto'),'height': (showSkeleton? windowHeight + 'px' : 'auto')}">
- <view class="good-search clearfix" v-if="searchStatus">
- <view class="nav-tab-bar u-f-ajc">
- <block v-for="(tab,index) in tabBars" :key='tab.id'>
- <view class="tabstyle u-f-ajc" :class="{'addstyle':tabIndex==index}" @click="changeTab(index)">{{tab.name}}
- <i v-if='(tabIndex==index)' class='nav-tab-line'>√</i>
- </view>
- </block>
- </view>
- <view class="search-from name">
- <text class="iconfont icon-iconfonticonfontsousuo1"></text>
- <input class="input"
- type="text"
- focus
- confirm-type="search"
- v-model="searchInputVal"
- placeholder="请输入商品关键词"
- @input="onShowClose"
- @confirm="searchOpertor"
- maxlength="20"/>
- <text class="iconfont icon-shanchu1" v-if="isShowClose" @click="delInputText()"></text>
- </view>
- <view class="search-btn">
- <button class="search-btn" type="default" @click.stop="searchOpertor">搜索</button>
- </view>
- </view>
- <list-skeleton v-if="showSkeleton"></list-skeleton>
- <view class="empty-container" v-if="isShowEmpty" >
- <image class="empty-container-image" src="https://img.caimei365.com/group1/M00/03/71/Cmis2F3wna6AY2ZjAABpmnBICH4247.png"></image>
- <text class="error-text">{{isShowEmptyText}}</text>
- </view>
-
- <view class="product-container" v-else :style="{paddingTop:searchStatus?'112rpx':''}" >
- <swiper :current="tabIndex" style="height: 1190rpx;">
- <swiper-item>
- <scroll-view :style="{'height':scrollHeight+'px'}" @scrolltolower="scrolltolower" scroll-y v-if="productList.length > 0">
- <view v-for="(item,index) in productList" :key="index" :id="item.id" class="all-type-list-content commodity-list" @click.stop="navToDetailPage(item.productID)">
- <image mode='widthFix' :src="item.mainImage" class="list-img" alt="list-img"></image>
- <view class="list-details-info">
- <text class="list-details-title">{{item.name}}</text>
- <text class="list-details-specs">规格:{{item.unit?item.unit:''}}</text>
- <text class="list-details-miniQuantity">起订量:{{item.minBuyNumber}}</text>
- <view class="list-details-price">
- <view class="list-shop">
- <view class="list-price" >
- <text class="price-view activity" v-if="item.isShowActFlg">活动价</text>
- <text class="price-larger">¥{{item.retailPrice.toFixed(2)}}</text>
- <text class="price-view ladder" v-if="item.ladderPriceFlag == '1'">阶</text>
- </view>
- <view class="list-price-none" v-if="item.repurchasePriceState">
- <text class="price-none">¥{{item.discountPrice}}</text>
- <text class="iconfont icon-wenhao" @click.stop="repurchModel"></text>
- </view>
- </view>
- <button class="add-cart-btn" @click.stop="operationHanld(item)">选择数量</button>
- </view>
- </view>
- </view>
- <view v-if="showLoading && productList.length > 4 && !showRegularBtn">
- <view class="loading-wrapper loading-wrapper-now" v-if="loadingNow">{{loadingText}}<text v-if="loadingText === '已至底部'">‧ ‧ ‧</text></view>
- <view class="loading-wrapper loading-wrapper-btm" v-else>———<text class="btm-text">已至底部</text>———</view>
- </view>
- </scroll-view>
- </swiper-item>
- <!-- 组合商品list -->
- <swiper-item>
- <scroll-view :style="{'height':scrollHeight+'px'}" @scrolltolower="scrolltolower" scroll-y>
- <view class="zuhe_title">组合组合组合组合组合</view>
- <view v-for="(item,index) in productList" :key="index" :id="item.id" class="zuhe-list-content commodity-list" @click.stop="navToDetailPage(item.productID)">
- <view class="list-details-info">
- <text class="list-details-title zuhe_list_text">商品编码:{{item.name}}</text>
- <text class="list-details-specs zuhe_list_text">{{item.name}}</text>
- <view class="list-details-price zuhe_list_price">
- <view class="list-shop">
- <view class="list-price zuhe_list_price" >
- <text class="zuhe_price-larger zuhe_list_text" >价格:¥{{item.retailPrice.toFixed(2)}}</text>
- <text class="price-two zuhe_list_text">总价:<text class="zuhe_list_zj">¥ 12451.00</text></text>
- <text class="price-view ladder" v-if="item.ladderPriceFlag == '1'">阶</text>
- <text class="price-view activity" v-if="item.isShowActFlg">活动价</text>
- </view>
- <view class="list-price-none" v-if="item.repurchasePriceState">
- <!-- -->
- <text class="price-none">价格:¥{{item.discountPrice}}</text>
- <text class="price-two">总价:<span>¥12401.00</span></text>
- <text class="iconfont icon-wenhao" @click.stop="repurchModel"></text>
- </view>
- </view>
- <button class="add-cart-btn zuhe_btn" @click.stop="operationHanld(item)">选择数量</button>
- </view>
- </view>
- </view>
- <view class="foot_conten" >
- <view class="zuhe_foot-box">
- <text>种类:10</text>
- <text>总数:12450</text>
- <text>总额:1215421</text>
- </view>
- <button type="default" class="buycart" @click.stop="operationHanld(item)">加入购物车</button>
- </view>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- <view class="cart-icon" @click="toCartPage">
- <text v-if="cartQuantity > 0" class="uni-badge uni-badge-error uni-small uni-badge--small icon-num">
- {{cartQuantity >= 100 ? '99+' : cartQuantity}}
- </text>
- <image src='../../../static/icon-cart-active@3x.png' mode="widthFix"></image>
- </view>
- <!-- 透明模态层 -->
- <modal-layer v-if='isModallayer'></modal-layer>
- </view>
- </template>
- <script>
- import listSkeleton from '@/components/cm-module/listTemplate/listSkeleton'
- import modalLayer from "@/components/modal-layer"
- import uniStars from '@/components/uni-stars/uni-stars.vue'
- import { getSellerProduct } from "@/api/seller.js"
- import { mapState,mapMutations } from 'vuex';
- export default{
- name:'productList',
- components:{
- listSkeleton,
- modalLayer,
- uniStars
- },
- props: {
- searchStatus:{
- type:Boolean,
- default:false
- }
- },
- data(){
- return{
- isShowClose:false,
- searchInputVal:'',
- isModallayer:false,
- windowHeight: '',
- showSkeleton: false,
- isShowEmpty: false,
- isShowEmptyText: '搜索相关商品',
- clubUserId: '',
- scrollHeight: '',
- productList: [],
- showLoading: false,
- loadingNow: true,
- loadingText: '上拉加载更多',
- pageSize: 10,
- pageNum: 1,
- hasNextPage: false,
- pullFlag: true,
- fromRegularPurchasePage: false,
- cartQuantity: 0,
- showRegularBtn: false,
- isPrecedence:false,
- tabIndex:0,
- tabBars:[
- {name:'单一商品',id:'danyi'},
- {name:'组合商品',id:'zuhe'}
- ]
- }
- },
- created() {
- this.setScrollHeight();
- this.$api.getComStorage('orderUserInfo').then((resolve) =>{
- this.clubUserId = resolve.userID
- })
- },
- computed: {
- ...mapState(['hasLogin','userInfo'])
- },
- methods:{
- scrolltolower() {
- if(this.hasNextPage && this.pullFlag) {
- this.getProductAgainInfo(true);
- }
- },
- changeTab(index){
- this.tabIndex = index;
- },
- setScrollHeight() {
- const {windowHeight, pixelRatio} = wx.getSystemInfoSync();
- this.windowHeight = windowHeight - 1;
- this.scrollHeight = windowHeight - 1;
- },
- getProductAgainInfo(loadMore) {
- this.showLoading = true;
- this.loadingNow = true;
- this.loadingText = '加载中';
- this.isShowEmpty = false;
- if(loadMore) {this.pageNum += 1;}
- let params = {clubUserId:this.clubUserId,pageNum:this.pageNum,pageSize:this.pageSize,searchWord:this.searchInputVal}
- getSellerProduct(params).then(response =>{
- this.isShowWrapper = true
- const responseData = response.data;
- if(responseData.results && responseData.results.length > 0){
- this.hasNextPage = responseData.hasNextPage;
- this.isShowEmpty = false;
- if(loadMore) {
- this.productList = [...this.productList,...responseData.results];
- } else {
- this.productList = [...responseData.results];
- this.showSkeleton = false;
- }
- //价格显示处理
- let isActFlg,newProductList=[];
- this.productList.map((item, index)=> {
- if(item.actStatus == 1){
- isActFlg = true
- }else if(item.actStatus == 1 && item.ladderPriceFlag == '1'){
- isActFlg = true
- }else{
- isActFlg = false
- }
- newProductList.push(Object.assign({},item,{isShowActFlg:isActFlg}))
- })
- this.productList = newProductList
- // 防上拉暴滑
- this.pullFlag = false;
- setTimeout(()=>{
- this.pullFlag = true;
- },500)
- // 底部提示文案
- if(this.hasNextPage) {
- this.loadingText = '上拉加载更多';
- } else {
- this.showLoading = true;
- this.loadingNow = false;
- }
- } else {
- this.isShowEmpty = true;
- this.isShowEmptyText ='暂无相关商品'
- }
- }).catch(error =>{
- this.$util.msg(error.msg,2000);
- })
- },
- searchOpertor(){//搜索商品
- if(this.searchInputVal == ''){
- this.$util.msg('请输入商品关键词',2000)
- }else{
- this.pageNum = 1
- this.showSkeleton = true;
- this.getProductAgainInfo();
- }
- },
- operationHanld(prop){
- this.$emit('operationConfim',prop)
- },
- navToDetailPage(id) {
- this.isModallayer = true;
- this.$api.navigateTo(`/pages/goods/product?id=${id}`);
- this.isModallayer = false;
- },
- toCartPage() {
- this.$emit('goCartPage')
- },
- repurchModel(){
- this.$util.modal('','此商品的价格有变化,原来的购买价已不适用','知道了','',false,() =>{})
- },
- onShowClose () {//输入框失去焦点时触发
- if(this.searchInputVal != ''){
- this.isShowClose = true
- }else{
- this.isShowClose = false
- }
- },
- delInputText(){//清除输入框内容
- this.searchInputVal = ''
- this.isShowClose = false
- }
- }
- }
- </script>
- <style lang="scss">
- .foot_conten{
- width: 100%;
- position: fixed;
- left:0px;
- bottom:100rpx;
- z-index: 9999;
- background: #fff;
- font-size: 28rpx;
- text-align: center;
- height: 120rpx;
- line-height: 120rpx;
- display: inline-block;
- }
- .zuhe_foot-box{
- width: 70%;
- float: left;
- }
- .zuhe_foot-box text{
- margin-right: 30rpx;
- }
- .foot_conten .buycart{
- width: 162rpx;
- height: 64rpx;
- background: #EFAF00 !important;
- color: #fff;
- font-size: 28rpx;
- border-radius: 36rpx;
- text-align: center;
- line-height: 64rpx;
- margin-top: 25rpx
- }
- .price-none{
- font-size: 24rpx;
- color: #666666;
- }
- .zuhe_title{
- background:#FFFFFF;
- height: 76rpx;
- color: #E15616;
- font-size: 28rpx;
- border-bottom: 2rpx solid #E15616;
- line-height: 76rpx;
- padding-left: 30rpx;;
- }
- .nav-tab-line{
- color: #E15616;
- position: absolute;
- top: 20rpx;
- right: 4rpx;
- font-weight: bold
- }
- .addstyle{
- background: linear-gradient(-42deg, transparent 28rpx, #E15616 0) top right;
- color: #FFFFFF;
- }
- .tabstyle{
- width: 128rpx;
- height: 64rpx;
- font-size: 26rpx;
- display: inline-block;
- border-radius: 10rpx;
- text-align: center;
- line-height: 64rpx;
- border: 2rpx solid #EEEEEE;
- position: relative;
- margin-right: 12rpx;
-
- }
- .commodity-list-wrapper {
- scroll-view {
- height: 100%;
- }
- .show-more-btn {
- width: 276rpx;
- height: 52rpx;
- line-height: 52rpx;
- border: 2rpx solid #D8D8D8;
- background: #F7F7F7;
- font-size: 26rpx;
- margin: 26rpx 0;
- position: absolute;
- left: 50%;
- margin-left: -138rpx;
- }
- }
- .good-search{
- height: 64rpx;
- width: 702rpx;
- padding: 24rpx;
- background: #FFFFFF;
- display: flex;
- align-items: center;
- margin-bottom: 20rpx;
- position: fixed;
- top: 0;
- left: 0;
- z-index: 999;
- .search-from{
- width: 326rpx;
- height: 64rpx;
- background: #F7F7F7;
- border-radius: 14rpx;
- float: left;
- position: relative;
- .input{
- // width: 500rpx;
- height: 64rpx;
- float: left;
- line-height: 64rpx;
- color: $text-color;
- font-size: $font-size-24;
- }
- .icon-iconfonticonfontsousuo1{
- 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;
- top: 0;
- right: 0;
- text-align: center;
- z-index: 10;
- }
- }
- .search-btn{
- // width: 120rpx;
- line-height: 64rpx;
- text-align: center;
- font-size: $font-size-28;
- color: $color-system;
- float: left;
- background: #FFFFFF;
- margin-left: 10rpx;
- }
- }
- .all-type-list-content {
- height: 240rpx;
- padding: 24rpx;
- background: #fff;
- margin-bottom: 2rpx;
- display: flex;
- flex-direction: row;
- box-sizing: content-box;
- .list-img {
- width: 240rpx;
- height: 240rpx !important;
- margin-right: 26rpx;
- border-radius: 10rpx;
- border: 2rpx solid #f3f3f3;
- }
- }
- .zuhe-list-content{
- width: 655rpx;
- // height: 214rpx;
- background: #fff;
- border: 2px solid #FFF0DE;
- display: flex;
- flex-direction: row;
- box-sizing: content-box;
- margin-top: 10rpx;
- border-radius: 14rpx;
- margin: 10rpx auto;
- padding: 20rpx;
- }
- .list-details-info {
- width: 100%;
- flex-direction: column;
- font-size: 26rpx;
- position: relative;
- .list-details-title {
- line-height: 38rpx;
- text-overflow: ellipsis;
- overflow: hidden;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .list-details-specs {
- width: 100%;
- display: inline-block;
- margin-top: 8rpx;
- color: #999999;
- }
- .list-details-miniQuantity {
- width: 100%;
- display: inline-block;
- margin-top: 7rpx;
- }
- }
- .list-details-price {
- width: 100%;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- .price-icon {
- width: 22rpx;
- height: 28rpx;
- vertical-align: middle;
- margin-right: 10rpx;
- }
- .price-icon + text {
- font-size: 25rpx;
- vertical-align: middle;
- }
- .list-login-now {
- width: 375rpx;
- color: #F8C499;
- position: absolute;
- bottom: 0;
- .p-no{
- float: left;
- font-size: $font-size-24;
- color: $color-system;
- margin-right: 10rpx;
- }
- }
- .login-now {
- padding: 10rpx 10rpx 10rpx 0;
- }
- .list-none{
- margin-top: 15rpx;
- .price-small{
- font-size:$font-size-24;
- line-height: 40rpx;
- color: #FF2A2A;
- }
- }
-
- .list-shop{
- width: 100%;
- height: auto;
- flex: 6;
- .list-price {
- width: 100%;
- color: #FF2A2A;
- float: left;
- line-height:36rpx ;
- align-items: center;
- justify-content: center;
- .price-larger {
- margin-top: 20rpx;
- font-size: $font-size-30;
- display: inline-block;
- }
- .zuhe_price-larger{
- color: #666666;
- float: left;
- }
- .price-two{
- color: #666666;
- float: left;
- margin-left: 25rpx;
- }
- .zuhe_list_zj{
- color: #FF2A2A;
- }
- .price-view{
- display: inline-block;
- width: 40rpx;
- border-radius: 10rpx;
- font-size: $font-size-24;
- text-align: center;
- color: #FFFFFF;
- height: 36rpx;
- line-height: 36rpx;
- margin-right: 8rpx;
- &.ladder{
- background: linear-gradient(135deg,rgba(255,0,0,1) 0%,rgba(242,143,49,1) 100%);
- }
- &.activity{
- background: linear-gradient(135deg,rgba(128,0,255,1) 0%,rgba(242,49,153,1) 100%);
- }
- }
- }
- .zuhe_list_price .price-view{
- margin-top: 20rpx;
- float: right;
- margin-right: 0;
- }
- .zuhe_list_price{
- width: 70%;
- }
- .list-price-none{
- width: 100%;
- .price-none{
- text-decoration: line-through;
- color: #999999;
- display: inline-block;
- }
- .icon-wenhao{
- font-size: $font-size-32;
- color: #0091FF;
- margin-left: 6rpx;
- }
- }
- }
- .add-cart-btn {
- flex: 4;
- width: 156rpx;
- height: 64rpx;
- line-height: 64rpx;
- border-radius: 32rpx;
- color: #333333;
- font-size: 26rpx;
- margin-right: 0;
- // background:linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
- background: #FFFFFF;
- border: 2rpx solid #C9C9C9;
- }
- .zuhe_btn{
- float: right;
- }
- }
- .zuhe_list_price{
- display: block !important;
- }
- .cart-icon {
- width: 92rpx;
- height: 92rpx;
- border-radius: 50%;
- background: rgba(255, 147, 0, 0.5);
- position: fixed;
- right: 24rpx;
- bottom: 37%;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- image {
- width: 58rpx;
- height: 58rpx;
- }
- text {
- font-size: 28rpx;
- position: absolute;
- top: -10rpx;
- right: 0;
- }
- }
- .zuhe_list_text{
- margin-top: 20rpx;
- }
- </style>
|