<template>
|
|
<view class="goods-detail">
|
|
<!-- 轮播图 -->
|
|
<view class="banner-container">
|
|
<uv-swiper
|
|
indicator
|
|
indicatorMode="dot"
|
|
indicatorActiveColor="blue"
|
|
height="700rpx"
|
|
:list="goodsData.image ? goodsData.image.split(',') : []"></uv-swiper>
|
|
</view>
|
|
|
|
<!-- 商品信息 -->
|
|
<view class="goods-info">
|
|
<!-- 积分信息 -->
|
|
<view class="points-section">
|
|
<image src="/static/积分图标.png" class="points-icon" mode="aspectFit"></image>
|
|
<text class="points-text">{{ goodsData.price }}积分</text>
|
|
</view>
|
|
|
|
<!-- 商品标题 -->
|
|
<view class="title-section">
|
|
<text class="goods-title">{{ goodsData.title }}</text>
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- 商品详情独立容器 -->
|
|
<view class="detail-container">
|
|
<!-- 商品详情标题 -->
|
|
<view class="detail-title-section">
|
|
<rich-text :nodes="goodsData.details"></rich-text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 底部操作栏 - 只在待领取状态显示 -->
|
|
<view v-if="status === 'pending'" class="bottom-bar">
|
|
<view class="exchange-btn" @click="confirmReceive">
|
|
<text class="exchange-text">确认取货</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'ExchangeDetail',
|
|
data() {
|
|
return {
|
|
goodsId: '',
|
|
status: 'pending', // pending: 待领取, received: 已领取, cancelled: 系统取消
|
|
goodsData: {
|
|
id: 1,
|
|
title: '哪吒之魔童闹海新款首套装哪吒校内艺术手办树脂摆件学生小礼品',
|
|
price: 100,
|
|
category: '积分兑换',
|
|
exchangeCount: 120,
|
|
sales: 0,
|
|
inventory: 50,
|
|
details: '这是一款美味的薄脆小饼干,口感酥脆,营养丰富。采用优质原料制作,无添加剂,适合全家人享用。每一口都能感受到浓郁的香味和酥脆的口感,是您休闲时光的最佳选择。',
|
|
image: '/static/商城_商品1.png,/static/商城_商品2.png,/static/bannerImage.png'
|
|
}
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
if (options.id) {
|
|
this.goodsId = options.id;
|
|
}
|
|
if (options.status) {
|
|
this.status = options.status;
|
|
}
|
|
this.getGoodsDetail(this.goodsId);
|
|
},
|
|
methods: {
|
|
async getGoodsDetail(id) {
|
|
const res = await this.$api.user.queryOrderById({ orderId: id })
|
|
this.goodsData = res.result
|
|
},
|
|
|
|
previewImage(current, urls) {
|
|
uni.previewImage({
|
|
current: current,
|
|
urls: urls
|
|
});
|
|
},
|
|
|
|
confirmReceive() {
|
|
uni.showModal({
|
|
title: '确认取货',
|
|
content: `确定已取货${this.goodsData.title}吗?`,
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
// 执行确认取货逻辑
|
|
uni.showToast({
|
|
title: '取货成功',
|
|
icon: 'success'
|
|
});
|
|
|
|
// 延迟返回上一页
|
|
setTimeout(() => {
|
|
uni.navigateBack();
|
|
}, 1500);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.goods-detail {
|
|
background: #f8f8f8;
|
|
min-height: 100vh;
|
|
padding-bottom: 120rpx; // 为底部固定栏留出空间
|
|
}
|
|
|
|
.banner-container {
|
|
height: 700rpx;
|
|
.banner-swiper {
|
|
width: 100%;
|
|
|
|
.banner-image {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
}
|
|
|
|
.goods-info {
|
|
background: #ffffff;
|
|
margin-top: 20rpx;
|
|
padding: 30rpx;
|
|
}
|
|
|
|
.points-section {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 20rpx;
|
|
|
|
.points-icon {
|
|
width: 32rpx;
|
|
height: 32rpx;
|
|
margin-right: 8rpx;
|
|
}
|
|
|
|
.points-text {
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
color: #1488DB;
|
|
}
|
|
}
|
|
|
|
.title-section {
|
|
margin-bottom: 40rpx;
|
|
|
|
.goods-title {
|
|
font-size: 28rpx;
|
|
color: #333333;
|
|
line-height: 1.5;
|
|
display: block;
|
|
}
|
|
}
|
|
|
|
.detail-container {
|
|
background: #ffffff;
|
|
margin-top: 20rpx;
|
|
padding: 30rpx;
|
|
margin-bottom: 120rpx;
|
|
}
|
|
|
|
.detail-title-section {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-bottom: 30rpx;
|
|
}
|
|
|
|
.bottom-bar {
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
right: 0;
|
|
background: #ffffff;
|
|
padding: 20rpx 30rpx;
|
|
border-top: 1rpx solid #f0f0f0;
|
|
z-index: 999;
|
|
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.1);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
.exchange-btn {
|
|
width: 100%;
|
|
height: 80rpx;
|
|
border-radius: 40rpx;
|
|
background-color: #218cdd;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
.exchange-text {
|
|
color: #ffffff;
|
|
font-size: 28rpx;
|
|
}
|
|
}
|
|
}
|
|
</style>
|