绿满眶商城微信小程序-uniapp
zxl
2025-10-27 7ae4e27a487e282b60dc65d7836d1bcd86e7a464
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<template>
    <view class="customize-container">
        <!-- 订单信息头部 -->
        <view class="order-header">
            <view class="order-info">
                <text class="label">订单编号:</text>
                <text class="value">{{ orderSn }}</text>
            </view>
            <view class="template-info">
                <text class="label">模板名称:</text>
                <text class="value">{{ templateName }}</text>
            </view>
        </view>
        
        <!-- 选中的模板样式 -->
        <view class="template-preview" v-if="chooseImg">
            <text class="section-title">选中的模板图片</text>
            <view class="image-wrapper">
                <image :src="chooseImg" mode="widthFix" class="template-image"></image>
            </view>
        </view>
        
        <!-- 定制内容列表 -->
        <view class="content-section">
            <text class="section-title">定制内容</text>
            <view class="content-list" v-if="customizeList.length > 0">
                <view class="content-item" v-for="(item, index) in customizeList" :key="index">
                    <view class="item-header">
                        <text class="sub-name">{{ item.subName }}</text>
                    </view>
                    <view class="item-content">
                        <!-- 文本类型内容 -->
                        <text v-if="item.contentType === 'TEXT'" class="text-content">{{ item.content }}</text>
                        
                        <!-- 图片类型内容 -->
                        <view v-else-if="item.contentType === 'IMAGE'" class="image-content">
                            <image :src="item.content" mode="widthFix" class="custom-image"></image>
                        </view>
                    </view>
                </view>
            </view>
            
            <view class="empty-tip" v-else>
                暂无定制信息
            </view>
        </view>
    </view>
</template>
 
<script>
    import { getOrderCustomize } from "@/api/order.js";
    export default {
        data() {
            return {
                orderSn: '',
                templateName: '',
                chooseImg: '',
                customizeList: []
            }
        },
        methods: {
            
        },
        async onLoad(options) {
            if(options.sn){
                const res = await getOrderCustomize(options.sn)
                console.log('获取到的模板填写信息为:',JSON.stringify(res))
                if(res.data && res.data.result && res.data.result.length > 0) {
                    // 从第一个元素中提取订单信息
                    const firstItem = res.data.result[0];
                    this.orderSn = firstItem.orderSn || '';
                    this.templateName = firstItem.templateName || '';
                    this.chooseImg = firstItem.chooseImg || '';
                    
                    // 保存定制内容列表
                    this.customizeList = res.data.result;
                }
            }
        }
    }
</script>
 
<style scoped>
    .customize-container {
        padding: 20rpx;
        background-color: #f5f5f5;
        min-height: 100vh;
    }
    
    .order-header {
        background-color: #fff;
        padding: 30rpx;
        border-radius: 10rpx;
        margin-bottom: 20rpx;
        box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
    }
    
    .order-info, .template-info {
        margin-bottom: 15rpx;
        display: flex;
    }
    
    .order-info:last-child, .template-info:last-child {
        margin-bottom: 0;
    }
    
    .label {
        font-size: 28rpx;
        color: #666;
        width: 180rpx;
    }
    
    .value {
        font-size: 28rpx;
        color: #333;
        flex: 1;
    }
    
    .template-preview {
        background-color: #fff;
        border-radius: 10rpx;
        padding: 30rpx;
        margin-bottom: 20rpx;
        box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
    }
    
    .content-section {
        background-color: #fff;
        border-radius: 10rpx;
        padding: 30rpx;
        box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
    }
    
    .section-title {
        font-size: 32rpx;
        font-weight: bold;
        color: #333;
        margin-bottom: 20rpx;
        display: block;
    }
    
    .image-wrapper {
        text-align: center;
    }
    
    .template-image {
        max-width: 100%;
        border-radius: 10rpx;
        border: 1rpx solid #eee;
    }
    
    .content-list {
        display: flex;
        flex-direction: column;
        gap: 30rpx;
    }
    
    .content-item {
        padding: 20rpx;
        border: 1rpx solid #eee;
        border-radius: 10rpx;
    }
    
    .item-header {
        border-bottom: 1rpx solid #eee;
        padding-bottom: 15rpx;
        margin-bottom: 15rpx;
    }
    
    .sub-name {
        font-size: 30rpx;
        font-weight: bold;
        color: #333;
    }
    
    .text-content {
        font-size: 28rpx;
        color: #666;
        line-height: 1.6;
    }
    
    .image-content {
        width: 100%;
        text-align: center;
    }
    
    .custom-image {
        max-width: 100%;
        border-radius: 10rpx;
    }
    
    .empty-tip {
        text-align: center;
        padding: 60rpx 0;
        font-size: 28rpx;
        color: #999;
    }
</style>