Liuyi
2024-11-19 440b4ab9d4278d3f9c13b004d2c2289f45254cbc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<script setup>
    import {ref,onMounted} from 'vue'
    import { goodsGetByIdApi } from '../../../api/index.js' 
    import { onLoad } from '@dcloudio/uni-app'
    import { BASE_URL } from '../../../config/baseUrl.js';
    
    const baseUrl = ref(BASE_URL)
    
    const detailInfo = ref({})
    async function getGoodsDetail(goodsId){
        await goodsGetByIdApi(goodsId).then((res) =>{
            detailInfo.value = res.data
            console.log('detailInfo',detailInfo.value)
        })
    }
    let goodsId
    onLoad(async(option) =>{
        goodsId = option.goodsId
        await getGoodsDetail(goodsId)
    })
</script>
<template>
    <view class="container">
        <point-navbar title='商品详情'></point-navbar>
        <view class="content">
            <view class="image">
                <image :src="baseUrl + '/upload'+ detailInfo.detailsUrl"></image>
            </view>
            <view class="detail">
                <view class="detail-info">
                    <view class="detail-info-text">
                        <view>【{{detailInfo.name}}】</view>
                        <view>
                            <rich-text :nodes='detailInfo.describe'></rich-text>
                        </view>
                    </view>
                    <text>价值{{detailInfo.price}}¥</text>
                </view>
                <view class="detail-exchange">
                    <view class="detail-exchange-points">
                        <!-- <image></image> -->
                        <text>1000</text>
                    </view>
                    <view class="detail-exchange-points">兑换</view>
                </view>
            </view>
        </view>
    </view>
</template>
 
<style lang="scss" scoped>
    
.container{
   width:100%;
   height:100vh;
   .content{
       width:100%;
       height:calc(100vh - 176rpx);
       background:linear-gradient(to bottom,#fef7da,#FFF);
       padding:50rpx 32rpx 100rpx;
       box-sizing: border-box;  
    }
}
</style>