You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

256 lines
5.4 KiB

3 months ago
<template>
<view class="page1">
1 week ago
<view class="title" :style="{'background-image': productImage ? 'url(' + productImage + ')' : ''}">
3 months ago
<view class="title-sreach">
<view class="back-btn" @tap="back" :style="{'padding-top': menuButtonInfo.top +'px'}">
<uni-icons type="left" size="28" color="#fff"></uni-icons>
</view>
</view>
</view>
<view class="content">
<view class="goods-top">
<view class="goods-content">
<view class="goods-name">
1 week ago
{{goodsItem.productName || ''}}
3 months ago
</view>
<view class="goods-content-center">
<view class="goods-deal1">
<view style="font-size: 28rpx;line-height: 54rpx;margin-right: 20rpx;">
1 week ago
{{soloPrice}}
3 months ago
</view>
1 week ago
<view class="pintuan-left-price" v-if="groupPrice">
拼团<text style="color: red;">{{groupPrice}}</text>
3 months ago
</view>
</view>
<view class="goods-tag">
1 week ago
销量 <text>{{goodsItem.tailWarn != null ? goodsItem.tailWarn : 0}}</text>
3 months ago
</view>
</view>
1 week ago
<view class="goods-fee" v-if="packageFeeNumber > 0">
餐盒费 {{packageFee}}
3 months ago
</view>
</view>
</view>
<view class="goods-bottom">
<view class="detail1">
商品详情
</view>
1 week ago
<view class="detail2" v-if="productIntro">
<rich-text :nodes="productIntro"></rich-text>
3 months ago
</view>
1 week ago
<view class="detail2 detail-empty" v-else>
暂无商品详情
3 months ago
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
1 week ago
menuButtonInfo: {},
goodsItem: {},
shopItem: {}
3 months ago
}
},
components: {
},
1 week ago
onLoad(option) {
if (option.item) {
this.goodsItem = JSON.parse(decodeURIComponent(option.item));
}
if (option.shopItem) {
this.shopItem = JSON.parse(decodeURIComponent(option.shopItem));
}
3 months ago
},
onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
},
1 week ago
computed: {
productImage() {
return this.goodsItem.productPicture || '';
},
productIntro() {
if (this.goodsItem.productIntro == undefined || this.goodsItem.productIntro == null) return '';
if (typeof this.goodsItem.productIntro === 'object') {
return this.goodsItem.productIntro.html || this.goodsItem.productIntro.text || '';
}
return this.goodsItem.productIntro;
},
groupRules() {
return Array.isArray(this.goodsItem.productGroupBuyPrices) ? this.goodsItem.productGroupBuyPrices : [];
},
soloPrice() {
return this.formatMoney(this.getAttributePrice(this.goodsItem));
},
groupPrice() {
if (!this.groupRules.length || this.goodsItem.isMoreBuy == 1) return '';
let rule = this.groupRules[0];
return rule && rule.groupPrice ? this.formatMoney(rule.groupPrice) : '';
},
packageFeeNumber() {
let fee = parseFloat(this.goodsItem.lunchBox || 0);
return isNaN(fee) ? 0 : fee;
},
packageFee() {
return this.formatMoney(this.packageFeeNumber);
}
},
3 months ago
methods: {
back() {
uni.navigateBack()
1 week ago
},
getAttributePrice(item) {
let price = 0;
if (!item || !item.attributeListPrice) return price;
try {
let pObj = typeof item.attributeListPrice === 'string' ? JSON.parse(item.attributeListPrice) : item.attributeListPrice;
if (Array.isArray(pObj) && pObj.length > 0) {
price = parseFloat(pObj[0].specPrice);
} else {
for (let k in pObj) {
price = parseFloat(pObj[k].specPrice);
break;
}
}
} catch (e) {}
return isNaN(price) ? 0 : price;
},
formatMoney(value) {
let amount = parseFloat(value);
return (isNaN(amount) ? 0 : amount).toFixed(2);
3 months ago
}
}
}
</script>
<style lang="scss">
page {
width: 100%;
height: 100%;
font-size: 24rpx;
background: #F5F8F5;
color: #00231C;
}
.page1 {
width: 100%;
height: 100%;
font-size: 24rpx;
position: relative;
}
.title {
background: url('https://jewel-shop.oss-cn-beijing.aliyuncs.com/9362dfb66c0f426789584cabb3977ccc.png') no-repeat;
width: 100%;
height: 700rpx;
1 week ago
background-size: cover;
background-position: center;
3 months ago
position: fixed;
top: 0;
z-index: -1;
}
.title-sreach {
width: 75%;
display: flex;
height: 200rpx;
}
.back-btn {
padding-top: 110rpx;
}
.content {
margin-top: 700rpx;
background: #fff;
overflow: hidden;
height: 100%;
}
.goods-top {
padding: 20rpx;
display: flex;
}
.goods-content {
flex: 1;
padding-left: 20rpx;
}
.goods-name {
font-size: 32rpx;
font-weight: 900;
}
.goods-content-center {
display: flex;
margin: 16rpx 0;
}
.goods-deal1 {
width: 60%;
display: flex;
}
.goods-tag {
margin: 0;
width: 40%;
text-align: right;
}
1 week ago
.goods-fee {
display: inline-block;
padding: 8rpx 18rpx;
border-radius: 999rpx;
background: rgba(255, 244, 232, 0.92);
border: 1rpx solid rgba(255, 180, 118, 0.54);
color: #b4572d;
font-size: 22rpx;
font-weight: 800;
}
3 months ago
.pintuan-left-price {
display: inline;
padding: 10rpx;
background: rgba(255, 57, 57, 0.1);
border-radius: 10rpx;
}
.goods-btn {
background: linear-gradient(90deg, #e3ff96, #a6ffea);
width: 130rpx;
text-align: center;
font-size: 28rpx;
font-weight: 600;
2 months ago
border-radius: 60rpx;
height: 60rpx;
line-height: 60rpx;
margin: 40rpx;
3 months ago
}
.goods-bottom {
width: 95%;
margin: 0 auto;
}
.detail1 {
2 months ago
height: 48rpx;
font-size: 30rpx;
3 months ago
font-weight: 700;
}
.detail2 {
2 months ago
line-height: 52rpx;
font-size: 28rpx;
padding-bottom: 80rpx;
3 months ago
}
1 week ago
.detail-empty {
color: #999;
3 months ago
}
</style>