|
@@ -1,3 +1,4 @@
|
|
|
|
+<!-- 分类商品模块 -->
|
|
<template>
|
|
<template>
|
|
<view class="container commodity-list-wrapper" :style="{'overflow':(showSkeleton? 'hidden' : 'auto'),'height': (showSkeleton? windowHeight + 'px' : 'auto')}">
|
|
<view class="container commodity-list-wrapper" :style="{'overflow':(showSkeleton? 'hidden' : 'auto'),'height': (showSkeleton? windowHeight + 'px' : 'auto')}">
|
|
<list-skeleton v-if="showSkeleton" :listType='0'></list-skeleton>
|
|
<list-skeleton v-if="showSkeleton" :listType='0'></list-skeleton>
|
|
@@ -9,36 +10,43 @@
|
|
<text class="list-details-specs">规格:{{item.p_unit}}</text>
|
|
<text class="list-details-specs">规格:{{item.p_unit}}</text>
|
|
<view class="list-details-specs" v-if="item.p_code!=''&&item.p_code!=null">商品编码:{{item.p_code}}</view>
|
|
<view class="list-details-specs" v-if="item.p_code!=''&&item.p_code!=null">商品编码:{{item.p_code}}</view>
|
|
<view class="list-details-price">
|
|
<view class="list-details-price">
|
|
|
|
+ <view class="floor-item-act" v-if="item.actStatus==1">
|
|
|
|
+ <view class="floor-tags" v-if="item.promotions.type == 1 && item.promotions.mode==1">{{item.promotions.name}}<text v-if="hasLogin">:¥{{ item.price | NumFormat }}</text></view>
|
|
|
|
+ <view class="floor-tags" v-else>{{item.promotions.name}}</view>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="floor-item-act" v-if="item.actStatus ==0 && item.ladderPriceFlag==1">
|
|
|
|
+ <view class="floor-tags">阶梯价格</view>
|
|
|
|
+ </view>
|
|
<view v-if="hasLogin" class="list-price">
|
|
<view v-if="hasLogin" class="list-price">
|
|
<view v-if="userIdentity == 1">
|
|
<view v-if="userIdentity == 1">
|
|
<text v-if="priceLoading" class="price-larger small">正在获取价格...</text>
|
|
<text v-if="priceLoading" class="price-larger small">正在获取价格...</text>
|
|
- <text v-else>¥<text class="price-larger">{{item.price?item.price :'0.00'}}</text></text>
|
|
|
|
|
|
+ <text v-else class="price-larger" :class="item.promotions.type == 1 && item.promotions.mode==1 ? 'none' : ''">¥{{ item.price | NumFormat }}</text>
|
|
</view>
|
|
</view>
|
|
<view v-if="userIdentity == 4">
|
|
<view v-if="userIdentity == 4">
|
|
<view class="price-larger" v-if="item.p_price_flag == '1'">
|
|
<view class="price-larger" v-if="item.p_price_flag == '1'">
|
|
- <text class="txt">未公开价格</text>
|
|
|
|
|
|
+ <text class="txt">¥未公开价格</text>
|
|
</view>
|
|
</view>
|
|
<text v-else-if="priceLoading" class="price-larger small">正在获取价格...</text>
|
|
<text v-else-if="priceLoading" class="price-larger small">正在获取价格...</text>
|
|
<view v-else>
|
|
<view v-else>
|
|
<view class="price-larger" v-if="item.p_price_flag == '2'">
|
|
<view class="price-larger" v-if="item.p_price_flag == '2'">
|
|
- <text class="txt">价格仅会员可见</text>
|
|
|
|
- <text class="btn" @click.stop="this.$api.navigateTo(`/pages/login/apply?clubStatus=${clubStatus}`)">去升级</text>
|
|
|
|
|
|
+ <text class="txt">¥价格仅会员可见</text>
|
|
</view>
|
|
</view>
|
|
- <text v-else>¥<text class="price-larger">{{item.price ? item.price :'0.00'}}</text></text>
|
|
|
|
|
|
+ <text v-else class="price-larger" :class="item.promotions.type == 1 && item.promotions.mode==1 ? 'none' : ''">¥{{item.price | NumFormat}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view v-if="userIdentity == 2">
|
|
<view v-if="userIdentity == 2">
|
|
<view class="price-larger" v-if="item.p_price_flag == '1'">
|
|
<view class="price-larger" v-if="item.p_price_flag == '1'">
|
|
- <text class="txt">未公开价格</text>
|
|
|
|
|
|
+ <text class="txt">¥未公开价格</text>
|
|
</view>
|
|
</view>
|
|
<text v-else-if="priceLoading" class="price-larger small">正在获取价格...</text>
|
|
<text v-else-if="priceLoading" class="price-larger small">正在获取价格...</text>
|
|
- <text v-else>¥<text class="price-larger">{{item.price ? item.price :'0.00'}}</text></text>
|
|
|
|
|
|
+ <text v-else class="price-larger" :class="item.promotions.type == 1 && item.promotions.mode==1 ? 'none' : ''" >¥{{item.price | NumFormat}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view v-else class="list-login-now">
|
|
<view v-else class="list-login-now">
|
|
- <text class="p-no">价格:</text>
|
|
|
|
|
|
+ <text class="p-no">¥</text>
|
|
<uni-stars :stars="parseInt(item.p_price_grade)" :font-size='36' :width-info="180"></uni-stars>
|
|
<uni-stars :stars="parseInt(item.p_price_grade)" :font-size='36' :width-info="180"></uni-stars>
|
|
</view>
|
|
</view>
|
|
|
|
+
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -87,7 +95,7 @@
|
|
windowHeight: '',
|
|
windowHeight: '',
|
|
showSkeleton: true,
|
|
showSkeleton: true,
|
|
showEmpty: false,
|
|
showEmpty: false,
|
|
- userID: '',
|
|
|
|
|
|
+ userID:0,
|
|
userIdentity:'',
|
|
userIdentity:'',
|
|
priceLoading:true,
|
|
priceLoading:true,
|
|
scrollHeight: '',
|
|
scrollHeight: '',
|
|
@@ -108,7 +116,7 @@
|
|
this.setScrollHeight();
|
|
this.setScrollHeight();
|
|
this.$api.getComStorage('userInfo').then((resolve) =>{
|
|
this.$api.getComStorage('userInfo').then((resolve) =>{
|
|
this.clubStatus = resolve.clubStatus
|
|
this.clubStatus = resolve.clubStatus
|
|
- this.userID = resolve.userID ? resolve.userID : '';
|
|
|
|
|
|
+ this.userID = resolve.userID ? resolve.userID : 0;
|
|
this.userIdentity = resolve.userIdentity
|
|
this.userIdentity = resolve.userIdentity
|
|
if(this.userIdentity == 1){
|
|
if(this.userIdentity == 1){
|
|
this.identity = 1
|
|
this.identity = 1
|
|
@@ -120,6 +128,11 @@
|
|
this.getListFromServer();
|
|
this.getListFromServer();
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ filters: {
|
|
|
|
+ NumFormat:function(text) {//处理金额
|
|
|
|
+ return Number(text).toFixed(2);
|
|
|
|
+ },
|
|
|
|
+ },
|
|
computed: {
|
|
computed: {
|
|
...mapState(['hasLogin','userInfo'])
|
|
...mapState(['hasLogin','userInfo'])
|
|
},
|
|
},
|
|
@@ -158,11 +171,11 @@
|
|
this.totalPage = resData.total;
|
|
this.totalPage = resData.total;
|
|
if(loadMore) {
|
|
if(loadMore) {
|
|
this.listData = [...this.listData,...resList];
|
|
this.listData = [...this.listData,...resList];
|
|
- this.setProductPrice()
|
|
|
|
|
|
+ this.getProductPrice()
|
|
this.showSkeleton = false
|
|
this.showSkeleton = false
|
|
} else {
|
|
} else {
|
|
this.listData = [...resList];
|
|
this.listData = [...resList];
|
|
- this.setProductPrice()
|
|
|
|
|
|
+ this.getProductPrice()
|
|
this.showSkeleton = false
|
|
this.showSkeleton = false
|
|
}
|
|
}
|
|
// 防上拉暴滑
|
|
// 防上拉暴滑
|
|
@@ -183,7 +196,7 @@
|
|
this.$util.msg(error.msg,2000);
|
|
this.$util.msg(error.msg,2000);
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- setProductPrice(){//获取价格
|
|
|
|
|
|
+ getProductPrice(){//获取价格
|
|
let productIdArr = [];
|
|
let productIdArr = [];
|
|
this.listData.map(item=>{// 0公开价格 1不公开价格 2仅对会员机构公开
|
|
this.listData.map(item=>{// 0公开价格 1不公开价格 2仅对会员机构公开
|
|
productIdArr.push(item.p_id)
|
|
productIdArr.push(item.p_id)
|
|
@@ -191,29 +204,24 @@
|
|
this.productIds = productIdArr.join(",");
|
|
this.productIds = productIdArr.join(",");
|
|
this.ProductService.querySearchProductPrice({userId: this.userID,productIds:this.productIds}).then(response =>{
|
|
this.ProductService.querySearchProductPrice({userId: this.userID,productIds:this.productIds}).then(response =>{
|
|
if (response.data) {
|
|
if (response.data) {
|
|
- let priceList = response.data
|
|
|
|
- this.listData.map(item=>{
|
|
|
|
- for (let i = 0; i < priceList.length; i++) {
|
|
|
|
- let priceObj ={
|
|
|
|
- actStatus:priceList[i].actStatus,
|
|
|
|
- costCheckFlag:priceList[i].costCheckFlag,
|
|
|
|
- costPrice:priceList[i].costPrice,
|
|
|
|
- costProportional:priceList[i].costProportional,
|
|
|
|
- ladderPriceFlag:priceList[i].ladderPriceFlag,
|
|
|
|
- price:Number(priceList[i].price).toFixed(2),
|
|
|
|
- minBuyNumber:priceList[i].minBuyNumber
|
|
|
|
- }
|
|
|
|
- if( item.p_id == priceList[i].productId ){
|
|
|
|
- Object.assign(item,priceObj)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ this.listData = this.ReturnNewProducts(this.listData,response.data);
|
|
}
|
|
}
|
|
this.priceLoading = false;
|
|
this.priceLoading = false;
|
|
}).catch(error =>{
|
|
}).catch(error =>{
|
|
this.$util.msg(error.msg,2000)
|
|
this.$util.msg(error.msg,2000)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ ReturnNewProducts(Array,list){//处理对应商品ID的商品价格
|
|
|
|
+ let NewArray = []
|
|
|
|
+ Array.map(item=>{
|
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
|
+ if( item.p_id == list[i].productId ){
|
|
|
|
+ NewArray.push(Object.assign(item,list[i]))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return NewArray
|
|
|
|
+ },
|
|
navToDetailPage(id) {
|
|
navToDetailPage(id) {
|
|
this.isModallayer = true;
|
|
this.isModallayer = true;
|
|
this.$api.navigateTo(`/pages/goods/product?id=${id}`);
|
|
this.$api.navigateTo(`/pages/goods/product?id=${id}`);
|
|
@@ -271,7 +279,7 @@
|
|
font-size: 26rpx;
|
|
font-size: 26rpx;
|
|
position: relative;
|
|
position: relative;
|
|
.list-details-title {
|
|
.list-details-title {
|
|
- line-height: 38rpx;
|
|
|
|
|
|
+ line-height: 36rpx;
|
|
text-overflow: ellipsis;
|
|
text-overflow: ellipsis;
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
display: -webkit-box;
|
|
display: -webkit-box;
|
|
@@ -289,12 +297,30 @@
|
|
}
|
|
}
|
|
.list-details-price {
|
|
.list-details-price {
|
|
width: 100%;
|
|
width: 100%;
|
|
- display: flex;
|
|
|
|
- flex-direction: row;
|
|
|
|
- justify-content: space-between;
|
|
|
|
|
|
+ height: 54rpx;
|
|
|
|
+ line-height: 54rpx;
|
|
position: absolute;
|
|
position: absolute;
|
|
- bottom: 0;
|
|
|
|
|
|
+ bottom: -10rpx;
|
|
right: 0;
|
|
right: 0;
|
|
|
|
+ .floor-item-act{
|
|
|
|
+ height: 54rpx;
|
|
|
|
+ text-align: center;
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+ float: right;
|
|
|
|
+ .floor-tags{
|
|
|
|
+ float: right;
|
|
|
|
+ height: 36rpx;
|
|
|
|
+ border-radius: 4rpx;
|
|
|
|
+ background-color: rgba(225, 86, 22, 0.1);
|
|
|
|
+ line-height: 36rpx;
|
|
|
|
+ color: $color-system;
|
|
|
|
+ text-align: center;
|
|
|
|
+ display: inline-block;
|
|
|
|
+ padding:0 16rpx;
|
|
|
|
+ margin-top: 9rpx;
|
|
|
|
+ font-size: $font-size-20;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
.price-icon {
|
|
.price-icon {
|
|
width: 22rpx;
|
|
width: 22rpx;
|
|
height: 28rpx;
|
|
height: 28rpx;
|
|
@@ -306,15 +332,13 @@
|
|
vertical-align: middle;
|
|
vertical-align: middle;
|
|
}
|
|
}
|
|
.list-login-now {
|
|
.list-login-now {
|
|
- width: 375rpx;
|
|
|
|
color: #F8C499;
|
|
color: #F8C499;
|
|
- position: absolute;
|
|
|
|
- bottom: 0;
|
|
|
|
|
|
+ float: left;
|
|
|
|
+ line-height: 54rpx;
|
|
.p-no{
|
|
.p-no{
|
|
float: left;
|
|
float: left;
|
|
font-size: $font-size-24;
|
|
font-size: $font-size-24;
|
|
- color: $color-system;
|
|
|
|
- margin-right: 10rpx;
|
|
|
|
|
|
+ color: $text-color;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.login-now {
|
|
.login-now {
|
|
@@ -322,12 +346,16 @@
|
|
}
|
|
}
|
|
.list-price {
|
|
.list-price {
|
|
color: #FF2A2A;
|
|
color: #FF2A2A;
|
|
- width: 100%;
|
|
|
|
height: 44rpx;
|
|
height: 44rpx;
|
|
|
|
+ float: left;
|
|
.price-larger {
|
|
.price-larger {
|
|
width: 100%;
|
|
width: 100%;
|
|
height: 44rpx;
|
|
height: 44rpx;
|
|
font-size: 32rpx;
|
|
font-size: 32rpx;
|
|
|
|
+ &.none{
|
|
|
|
+ text-decoration: line-through;
|
|
|
|
+ color: #999999;
|
|
|
|
+ }
|
|
&.small{
|
|
&.small{
|
|
font-size: $font-size-24;
|
|
font-size: $font-size-24;
|
|
}
|
|
}
|
|
@@ -338,18 +366,6 @@
|
|
text-align: left;
|
|
text-align: left;
|
|
float: left;
|
|
float: left;
|
|
}
|
|
}
|
|
- .btn{
|
|
|
|
- width: 112rpx;
|
|
|
|
- height: 44rpx;
|
|
|
|
- display: inline-block;
|
|
|
|
- float: right;
|
|
|
|
- background: $btn-confirm;
|
|
|
|
- line-height: 44rpx;
|
|
|
|
- text-align: center;
|
|
|
|
- color: #FFFFFF;
|
|
|
|
- font-size: $font-size-24;
|
|
|
|
- border-radius: 22rpx;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.add-cart-btn {
|
|
.add-cart-btn {
|