敢为人鲜小程序前端代码仓库
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.
 
 
 

191 lines
3.5 KiB

<template>
<view class="page">
<!-- 导航栏 -->
<navbar title="商品详情" leftClick @leftClick="$utils.navigateBack" />
<view class="swipe">
<uv-swiper :list="productDetail.image
&& productDetail.image.split(',')" indicator height="520rpx"></uv-swiper>
</view>
<!-- 商品标题 -->
<view class="info">
<view class="title">
{{ productDetail.title }}
</view>
</view>
<!-- 服务 -->
<view class="server">
<view class="setver-main">
<view class="title">服务</view>
<view class="descript">
免费上门退·7天无理由退货·快递发货
</view>
</view>
<view class="server-arraw">
<uv-icon name="arrow-right"></uv-icon>
</view>
</view>
<!-- 参数 -->
<view v-if="productDetail.sku" class="params">
<view class="params-main">
<view class="title">参数</view>
<view class="descript">
{{ productDetail.sku }}
</view>
</view>
<view class="server-arraw">
<uv-icon name="arrow-right"></uv-icon>
</view>
</view>
<!-- 商品详情 -->
<view class="item-line">
<view class="before"></view>
<view class="label">商品详情</view>
</view>
<uv-parse :content="productDetail.details"></uv-parse>
<!-- 分享和购买按钮 -->
<submit @service="service" @submit="submit" :detail="productDetail" />
<!-- 联系客服 -->
<customerServicePopup ref="customerServicePopup" />
</view>
</template>
<script>
import submit from '../components/product/submit.vue'
import submitUnitSelect from '../components/product/submitUnitSelect.vue'
import customerServicePopup from '@/components/config/customerServicePopup.vue'
export default {
components: {
submit,
submitUnitSelect,
customerServicePopup
},
data() {
return {
productDetail: {
image: '',
details: '',
},
id: 0,
}
},
onLoad(args) {
this.id = args.id
},
onShow() {
this.getRiceProductDetail()
},
methods: {
// 分享商品
share() {
},
// 立即下单
submit() {
this.$store.commit('setPayOrderProduct', [
this.productDetail
])
this.$utils.navigateTo('/pages_order/order/createOrder')
},
// 获取商品
getRiceProductDetail() {
this.$api('getRiceProductDetail', {
id: this.id
}, res => {
if (res.code == 200) {
res.result.num = 1
this.productDetail = res.result
}
})
},
// 联系客服
service() {
this.$refs.customerServicePopup.open()
},
}
}
</script>
<style scoped lang="scss">
.page {
.swipe {}
// 商品标题
.info {
padding: 20rpx;
background-color: #fff;
.title {
font-size: 36rpx;
font-weight: 900;
}
}
// 服务 & 参数
.server,
.params {
background: white;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
padding: 30rpx 20rpx;
box-sizing: border-box;
.setver-main,
.params-main {
display: flex;
flex-wrap: wrap;
width: 90%;
font-size: 32rpx;
.title {
color: #7C7C7C;
margin-right: 20rpx;
}
}
.server-arraw {
display: flex;
justify-content: flex-end;
text-align: right;
}
}
// 商品详情
.item-line {
display: flex;
background: white;
box-sizing: border-box;
font-size: 34rpx;
padding: 20rpx;
}
.item-line .before {
content: "";
width: 8rpx;
height: 30rpx;
background: $uni-color;
border-radius: 4rpx;
margin-right: 10rpx;
margin-top: 15rpx;
}
.item-line .label {
display: flex;
align-items: center;
width: 152rpx;
height: 60rpx;
}
}
</style>