批量价格显示的样式

master
lemon橪 2022-05-27 10:28:37 +08:00
parent f19071542a
commit e97dbe1c90
2 changed files with 164 additions and 95 deletions

View File

@ -7,8 +7,18 @@
<div class="item-detail-big-img"> <div class="item-detail-big-img">
<pic-zoom :url="imgList[imgIndex].url" :scale="2"></pic-zoom> <pic-zoom :url="imgList[imgIndex].url" :scale="2"></pic-zoom>
</div> </div>
<div v-if="skuDetail.goodsType !== 'VIRTUAL_GOODS'" style="margin-top:10px;rgb(153, 149, 149);"></div> <div
<div v-else-if="skuDetail.goodsType == 'VIRTUAL_GOODS'" style="margin-top:10px;rgb(153, 149, 149);">虚拟商品</div> v-if="skuDetail.goodsType !== 'VIRTUAL_GOODS'"
style="margin-top:10px;rgb(153, 149, 149);"
>
实物商品
</div>
<div
v-else-if="skuDetail.goodsType == 'VIRTUAL_GOODS'"
style="margin-top:10px;rgb(153, 149, 149);"
>
虚拟商品
</div>
<div class="item-detail-img-row"> <div class="item-detail-img-row">
<div <div
class="item-detail-img-small" class="item-detail-img-small"
@ -22,9 +32,10 @@
<div class="goodsConfig mt_10"> <div class="goodsConfig mt_10">
<span @click="collect" <span @click="collect"
><Icon type="ios-heart" :color="isCollected ? '#ed3f14' : '#666'" />{{ ><Icon
isCollected ? "已收藏" : "收藏" type="ios-heart"
}}</span :color="isCollected ? '#ed3f14' : '#666'"
/>{{ isCollected ? "" : "" }}</span
> >
</div> </div>
</div> </div>
@ -46,9 +57,11 @@
<!-- 商品详细 价格优惠券促销 --> <!-- 商品详细 价格优惠券促销 -->
<div class="item-detail-price-row"> <div class="item-detail-price-row">
<div class="item-price-left"> <div class="item-price-left">
<!-- 秒杀价格 --> <!-- 秒杀价格 -->
<div class="item-price-row" v-if="skuDetail.promotionPrice && promotionMap['SECKILL']"> <div
class="item-price-row"
v-if="skuDetail.promotionPrice && promotionMap['SECKILL']"
>
<p> <p>
<span class="item-price-title" v-if="promotionMap['SECKILL']" <span class="item-price-title" v-if="promotionMap['SECKILL']"
> &nbsp;&nbsp;</span > &nbsp;&nbsp;</span
@ -63,10 +76,34 @@
</div> </div>
<!-- 商品原价 --> <!-- 商品原价 -->
<div class="item-price-row" v-else> <div class="item-price-row" v-else>
<p> <!-- 普通价格 -->
<span class="item-price-title"> &nbsp;&nbsp;&nbsp;&nbsp;</span> <div>
<span class="item-price">{{ skuDetail.price | unitPrice("¥") }}</span> <span class="item-price-title"
</p> > &nbsp;&nbsp;&nbsp;&nbsp;</span
>
<span class="item-price">{{
skuDetail.price | unitPrice("¥")
}}</span>
</div>
<!-- 批发价格 -->
<div>
<div class="flex">
<div class="item-price-title">
&nbsp;&nbsp;&nbsp;&nbsp;
</div>
<div class="item-price item-num">{{
skuDetail.price | unitPrice("¥")
}}</div>
<div class="item-price item-num">{{
skuDetail.price | unitPrice("¥")
}}</div>
</div>
<div class="flex">
<div class="item-price-title"> </div>
<div class="item-num item-price-num">20-39</div>
<div class="item-num item-price-num">40-90</div>
</div>
</div>
</div> </div>
<!-- 优惠券展示 --> <!-- 优惠券展示 -->
<div class="item-price-row" v-if="promotionMap['COUPON'].length"> <div class="item-price-row" v-if="promotionMap['COUPON'].length">
@ -82,7 +119,9 @@
>{{ item.consumeThreshold }}{{ item.price }}</span >{{ item.consumeThreshold }}{{ item.price }}</span
> >
<span v-if="item.couponType == 'DISCOUNT'" <span v-if="item.couponType == 'DISCOUNT'"
>{{ item.consumeThreshold }}{{ item.couponDiscount }}</span >{{ item.consumeThreshold }}{{
item.couponDiscount
}}</span
> >
</span> </span>
</p> </p>
@ -90,7 +129,9 @@
<!-- 满减展示 --> <!-- 满减展示 -->
<div class="item-price-row" v-if="promotionMap['FULL_DISCOUNT']"> <div class="item-price-row" v-if="promotionMap['FULL_DISCOUNT']">
<p> <p>
<span class="item-price-title">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="item-price-title"
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span
>
<span class="item-promotion">满减</span> <span class="item-promotion">满减</span>
<span <span
class="item-desc-pintuan" class="item-desc-pintuan"
@ -101,7 +142,10 @@
> >
<span <span
class="item-desc-pintuan" class="item-desc-pintuan"
v-if="promotionMap['FULL_DISCOUNT'].fullRate && promotionMap['FULL_DISCOUNT'].fullRateFlag" v-if="
promotionMap['FULL_DISCOUNT'].fullRate &&
promotionMap['FULL_DISCOUNT'].fullRateFlag
"
>{{ promotionMap["FULL_DISCOUNT"].fullMoney }}立享{{ >{{ promotionMap["FULL_DISCOUNT"].fullMoney }}立享{{
promotionMap["FULL_DISCOUNT"].fullRate promotionMap["FULL_DISCOUNT"].fullRate
}}</span }}</span
@ -113,23 +157,34 @@
<div class="item-remarks-sum"> <div class="item-remarks-sum">
<p>累计评价</p> <p>累计评价</p>
<p> <p>
<span class="item-remarks-num">{{ skuDetail.commentNum || 0 }} </span> <span class="item-remarks-num"
>{{ skuDetail.commentNum || 0 }} </span
>
</p> </p>
</div> </div>
</div> </div>
</div> </div>
<!-- 选择颜色 --> <!-- 选择颜色 -->
<div class="item-select" v-for="(sku, index) in formatList" :key="sku.name"> <div
class="item-select"
v-for="(sku, index) in formatList"
:key="sku.name"
>
<div class="item-select-title"> <div class="item-select-title">
<p>{{ sku.name }}</p> <p>{{ sku.name }}</p>
</div> </div>
<div class="item-select-column"> <div class="item-select-column">
<div class="item-select-row" v-for="item in sku.values" :key="item.value"> <div
class="item-select-row"
v-for="item in sku.values"
:key="item.value"
>
<div <div
class="item-select-box" class="item-select-box"
@click="select(index, item.value)" @click="select(index, item.value)"
:class="{ :class="{
'item-select-box-active': item.value === currentSelceted[index], 'item-select-box-active':
item.value === currentSelceted[index],
}" }"
> >
<div class="item-select-intro"> <div class="item-select-intro">
@ -158,7 +213,9 @@
</div> </div>
<div <div
class="item-select" class="item-select"
v-if="skuDetail.goodsType !== 'VIRTUAL_GOODS' && skuDetail.weight !== 0" v-if="
skuDetail.goodsType !== 'VIRTUAL_GOODS' && skuDetail.weight !== 0
"
> >
<div class="item-select-title"> <div class="item-select-title">
<p>重量</p> <p>重量</p>
@ -224,13 +281,25 @@ export default {
default: null, default: null,
}, },
}, },
watch: {
detail: {
handler(val) {
this.skuDetail = val.data;
this.swiperGoodsImg();
},
deep: true,
immediate: true,
},
},
data() { data() {
return { return {
count: 1, // count: 1, //
imgIndex: 0, // imgIndex: 0, //
currentSelceted: [], // sku currentSelceted: [], // sku
imgList: [{ url: "" }], // imgList: [{ url: "" }], //
skuDetail: this.detail.data, // sku skuDetail: {
specList: [],
}, // sku
goodsSpecList: this.detail.specs, // spec goodsSpecList: this.detail.specs, // spec
promotionMap: { promotionMap: {
// //
@ -262,9 +331,9 @@ export default {
return i; return i;
} }
}); });
this.$router.push({ this.$emit("handleClickSku", {
path: "/goodsDetail", skuId: selectedSkuId.skuId,
query: { skuId: selectedSkuId.skuId, goodsId: this.skuDetail.goodsId }, goodsId: this.skuDetail.goodsId,
}); });
}, },
@ -307,7 +376,10 @@ export default {
.then((res) => { .then((res) => {
this.loading1 = false; this.loading1 = false;
if (res.success) { if (res.success) {
this.$router.push({ path: "/pay", query: { way: params.cartType } }); this.$router.push({
path: "/pay",
query: { way: params.cartType },
});
} else { } else {
this.$Message.warning(res.message); this.$Message.warning(res.message);
} }
@ -405,6 +477,13 @@ export default {
} }
} }
}, },
swiperGoodsImg() {
this.skuDetail.specList.forEach((e) => {
if (e.specName === "images") {
this.imgList = e.specImage;
}
});
},
}, },
mounted() { mounted() {
// //
@ -415,11 +494,7 @@ export default {
} }
}); });
} }
this.detail.data.specList.forEach((e) => {
if (e.specName === "images") {
this.imgList = e.specImage;
}
});
this.formatSku(this.goodsSpecList); this.formatSku(this.goodsSpecList);
this.promotion(); this.promotion();
document.title = this.skuDetail.goodsName; document.title = this.skuDetail.goodsName;
@ -433,57 +508,25 @@ export default {
width: 175px; width: 175px;
margin-left: 30px; margin-left: 30px;
} }
.flex{
display: flex;
}
.inventory { .inventory {
padding-left: 4px; padding-left: 4px;
} }
.global_color {
text-align: center;
}
.see-Img {
width: 100%;
height: 175px;
}
.see-Item {
> p {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.Report {
color: $theme_color !important;
}
.wrapper { .wrapper {
@include white_background_color(); @include white_background_color();
} }
.item-sale-flex {
width: 29%; .item-num{
padding: 0 3%; text-align:center;
width: 100px;
} }
.item-sale { .item-price-num{
margin: 10px 0; font-size: 16px;
> h3 { color: #666;
width: 13%;
text-align: center;
font-size: 20px;
line-height: 60px;
box-sizing: border-box;
border-right: 1px solid $border_color;
}
height: 60px;
justify-content: center;
align-items: center;
display: flex;
width: 1200px;
margin: 0 auto;
margin-bottom: 10px;
border: 1px solid $border_color;
background: #f7f7f7;
} }
.item-detail-show { .item-detail-show {

View File

@ -1,5 +1,5 @@
<template> <template>
<div style="background:#fff;"> <div style="background: #fff">
<BaseHeader></BaseHeader> <BaseHeader></BaseHeader>
<Search></Search> <Search></Search>
<drawer></drawer> <drawer></drawer>
@ -8,25 +8,39 @@
<div class="shop-nav-container"> <div class="shop-nav-container">
<Breadcrumb> <Breadcrumb>
<BreadcrumbItem to="/">首页</BreadcrumbItem> <BreadcrumbItem to="/">首页</BreadcrumbItem>
<BreadcrumbItem v-for="(item, index) in categoryBar" :to="goGoodsList(index)" target="_blank" :key="index"> <BreadcrumbItem
v-for="(item, index) in categoryBar"
:to="goGoodsList(index)"
target="_blank"
:key="index"
>
{{ item.name }} {{ item.name }}
</BreadcrumbItem> </BreadcrumbItem>
</Breadcrumb> </Breadcrumb>
<div class="store-collect"> <div class="store-collect">
<span class="mr_10" v-if="goodsMsg.data"> <span class="mr_10" v-if="goodsMsg.data">
<router-link :to="'Merchant?id=' + goodsMsg.data.storeId">{{
<router-link :to="'Merchant?id=' + goodsMsg.data.storeId">{{ goodsMsg.data.storeName }}</router-link> goodsMsg.data.storeName
}}</router-link>
</span> </span>
<span @click="collect"> <span @click="collect">
<Icon type="ios-heart" :color="storeCollected ? '#ed3f14' : '#666'" /> <Icon
{{storeCollected ? '已收藏店铺' : '收藏店铺'}} type="ios-heart"
:color="storeCollected ? '#ed3f14' : '#666'"
/>
{{ storeCollected ? "已收藏店铺" : "收藏店铺" }}
</span> </span>
<span class="ml_10" @click="IMService()"></span> <span class="ml_10" @click="IMService()"></span>
</div> </div>
</div> </div>
</div> </div>
<!-- 商品信息展示 --> <!-- 商品信息展示 -->
<ShowGoods v-if="goodsMsg.data" :detail="goodsMsg"></ShowGoods> <ShowGoods
@handleClickSku="targetClickSku"
v-if="goodsMsg.data"
:detail="goodsMsg"
></ShowGoods>
<!-- 商品详细展示 --> <!-- 商品详细展示 -->
<ShowGoodsDetail v-if="goodsMsg.data" :detail="goodsMsg"></ShowGoodsDetail> <ShowGoodsDetail v-if="goodsMsg.data" :detail="goodsMsg"></ShowGoodsDetail>
@ -73,13 +87,19 @@ export default {
// im // im
async IMService() { async IMService() {
// 访Token // 访Token
let accessToken = Storage.getItem('accessToken'); let accessToken = Storage.getItem("accessToken");
await this.getIMDetailMethods(); await this.getIMDetailMethods();
if (!accessToken) { if (!accessToken) {
this.$Message.error("请登录后再联系客服"); this.$Message.error("请登录后再联系客服");
return; return;
} }
window.open(this.IMLink + "?token=" + accessToken + "&id=" + this.goodsMsg.data.storeId); window.open(
this.IMLink +
"?token=" +
accessToken +
"&id=" +
this.goodsMsg.data.storeId
);
}, },
// im // im
async getIMDetailMethods() { async getIMDetailMethods() {
@ -88,10 +108,18 @@ export default {
this.IMLink = res.result; this.IMLink = res.result;
} }
}, },
//
targetClickSku(val) {
// {skuId,goodId}
console.log("%c 规格信息", "color:green");
console.log(val);
this.getGoodsDetail(val);
},
// //
getGoodsDetail() { getGoodsDetail(val) {
this.isLoading = true; this.isLoading = true;
const params = this.$route.query; const params = val || this.$route.query;
// id // id
let distributionId = let distributionId =
params && params.distributionId params && params.distributionId
@ -128,7 +156,7 @@ export default {
}); });
}); });
this.categoryBar = cateArr; this.categoryBar = cateArr;
this.goodsMsg = res.result; this.$set(this, "goodsMsg", res.result);
// //
if (this.Cookies.getItem("userInfo")) { if (this.Cookies.getItem("userInfo")) {
isCollection("STORE", this.goodsMsg.data.storeId).then((res) => { isCollection("STORE", this.goodsMsg.data.storeId).then((res) => {
@ -137,18 +165,20 @@ export default {
} }
}); });
} }
// if (!this.storeMsg) {
getDetailById(this.goodsMsg.data.storeId).then((res) => { //
if (res.success) { getDetailById(this.goodsMsg.data.storeId).then((res) => {
this.storeMsg = res.result; if (res.success) {
} this.storeMsg = res.result;
}); }
});
}
} else { } else {
this.$Message.error(res.message); this.$Message.error(res.message);
this.$router.push("/"); this.$router.push("/");
} }
}) })
.catch(() => { .catch((e) => {
this.$router.push("/"); this.$router.push("/");
}); });
}, },
@ -179,11 +209,7 @@ export default {
} }
}, },
}, },
watch: { watch: {},
"$route.query.skuId": function (val) {
location.reload();
},
},
components: { components: {
Search, Search,
ShopHeader, ShopHeader,