liyaozhi
2025-10-28 1320688354fd168c51cf2e05f29a2253f4ed9c00
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<template>
    <view class="coupon-datail pb100" v-if="!loading">
        <view class="top_box">
            <view class="bg-white radius12 p20">
                <view :class="'coupon-box coupon-item coupon-item-'+detail.color.text">
                    <view class="operation coupon-sp w-b">
                        <view class="coupon-content">
                            <view class="coupon-title-top">
                                <view class="d-s-c">
                                    <view class="f24 pb10 flex-1" v-if="detail.shop_supplier_id==0">平台通用{{detail.coupon_type.text}}</view>
                                    <view class="f24 pb10 flex-1" v-else>{{detail.supplier.name}}{{detail.coupon_type.text}}</view>
                                    <view class="f24" v-if="detail.coupon_type.value==30">限到店使用</view>
                                    <view class="f24" v-else>
                                        <template v-if="detail.min_price ==0">
                                            无低消门槛
                                        </template>
                                        <template v-if="detail.min_price >0">
                                            满{{detail.min_price}}元可用
                                        </template>
                                    </view>
                                </view>
                                <template v-if=" detail.coupon_type.value == 10 ">
                                    <view class="price">
                                        <text>¥</text>
                                        <text class="f36 fb">{{ detail.reduce_price }}</text>
                                    </view>
                                </template>
                                <template v-if="detail.coupon_type.value == 20 ">
                                    <text class="f36 fb">{{ detail.discount }}</text><text>折</text>
                                </template>
                                <template v-if="detail.coupon_type.value == 30 ">
                                    <view class="f36 fb l-s">{{detail.name}}</view>
                                </template>
                            </view>
                            <view class="coupon-title-bottom d-c-c">
                                <view class="f24 pt20 flex-1">
                                    {{ detail.start_time.text }} 至 {{ detail.end_time.text }}
                                </view>
                                <view class="f24 pt20" v-if="detail.coupon_type.value == 30">可用{{detail.limit_use_num}}次</view>
                            </view>
                        </view>
                    </view>
                </view>
                <view class="coupon-project mt20 p20 radius12">
                    <view class="d-s-c border-b pb20">
                        <view class="flex-1 f32 fb">优惠项目</view>
                        <view class="f26 red w-s-n" v-if="detail.coupon_project.length>1">以下项目 {{detail.coupon_project.length}} 选 1</view>
                    </view>
                    <view class="project-box">
                        <view class="project-item mt20 d-s-s f26" v-for="(item, index) in detail.coupon_project" :key="index" @click="radioChange(index)">
                            <view class="radio">
                                <radio style="transform:scale(0.8)" color='#F6220C' :value="index+''" :checked="project_id==index+''" />
                            </view>
                            <view>{{item.content}}</view>
                        </view>
                    </view>
                </view>
            </view>
            <view class="mt20 bg-white radius12 p20">
                <view class="d-s-c border-b pb20">
                    <view class="flex-1 f32 fb">使用须知</view>
                </view>
                <view class="project-box">
                    <view class="d-s-c mt20">
                        <text class="icon iconfont icon-yuyue"></text>
                        <text class="ml10 fb">有效期</text>
                    </view>
                    <view class=" mt20 ml40 f26">
                        {{ detail.start_time.text }} 至 {{ detail.end_time.text }}
                    </view>
                    <view class="d-s-c mt20">
                        <text class="icon iconfont icon-quanbudingdan"></text>
                        <text class="ml10 fb">使用规则</text>
                    </view>
                    <view class="project-item mt20 ml20 f26" v-for="(item, index) in detail.coupon_rule" :key="index">
                        {{item.content}}
                    </view>
                </view>
            </view>
        </view>
 
        <!-- 操作栏 -->
        <view v-if="detail.is_use == 0 && detail.is_expire == 0" class="flow-fixed-footer b-f">
            <!-- 兑换券核销 -->
            <view class="p20 bg-white">
                <button class="btn-red" @click="onSubmitExtract(detail.user_coupon_id)">确认核销</button>
            </view>
        </view>
    </view>
</template>
 
<script>
    import Popup from '@/components/uni-popup.vue'
    import utils from '@/common/utils.js'
    export default {
        data() {
            return {
                loading: true,
                /*兑换券id*/
                //user_coupon_id: 0,
                /*兑换券详情*/
                detail: {},
                extractStore: {},
                // 选择的优惠内容
                project_id: ''
            };
        },
        components: {},
        props: ['user_coupon_id'],
        onLoad(e) {
            // this.order_no = e.order_no;
        },
        mounted() {
            /*获取订单详情*/
            this.getData();
        },
        methods: {
            
            /*获取数据*/
            getData() {
                let self = this;
                uni.showLoading({
                    title: '加载中'
                });
                self._get(
                    'store.coupon/detail', {
                        user_coupon_id: self.user_coupon_id
                    },
                    function(res) {
                        self.loading = false;
                        self.detail = res.data.coupon;
                        if (self.detail.coupon_project.length == 1) {
                            self.project_id = 0;
                        }
                        // self.extractStore = res.data.order.extractStore;
                        uni.hideLoading();
                    },
                    function(res) {
                        uni.switchTab({
                            url:'/pages/index/index'
                        })
                    }
                );
            },
 
            /*核销*/
            onSubmitExtract(user_coupon_id) {
                let self = this;
                if (self.detail.coupon_type == 30 && self.project_id === '') {
                    uni.showToast({
                        title: '请选择优惠项目',
                        duration: 2000,
                        icon:'none'
                    });
                    return;
                }
                wx.showModal({
                    title: "提示",
                    content: "您确定要核销吗?",
                    success: function(o) {
                        o.confirm && self._post(
                            'store.coupon/extract', {
                                user_coupon_id: user_coupon_id,
                                project_id: self.project_id
                            },
                            function(res) {
                                uni.showToast({
                                    title: res.msg,
                                    duration: 2000,
                                    icon: 'success',
                                });
                                setTimeout(function () {
                                    self.gotoPage('/pages/index/index');
                                }, 2000);
                            }
                        );
                    }
                });
            },
            /*点击单选*/
            radioChange(e) {
                let self = this;
                self.project_id = e;
            },
        }
    };
</script>
 
<style scoped>
    .flow-fixed-footer {
        position: fixed;
        bottom: 0;
        width: 100%;
    }
    /* 兑换券 */
    /* 新样式 by lyzflash */
    .l-s {
        letter-spacing: 2rpx;
    }
    .coupon-box {
        border-radius: 12rpx;
        height: 210rpx;
    }
    .coupon-box .circles {
        left: auto;
        right: 0;
        top: 70rpx;
        bottom: 70rpx;
    }
    .coupon-box .circles-right text {
        border-radius: 10rpx 0 0 10rpx;
        width: 8rpx;
        height: 15rpx;
        background: #f6f6f6;
    }
    .coupon-box .operation .coupon-content {
        position: relative;
        /* background-color: #FFF2EC; */
        color: #FFFFFF;
        padding: 20rpx;
        display: block;
    }
    .coupon-box .coupon-sp::before,
    .coupon-box .coupon-sp::after {
      position: absolute;
      display: block;
      content: '';
      width: 11rpx;
      height: 22rpx;
      background: #FFFFFF;
      z-index: 10;
      top: 120rpx;
    }
    .coupon-box .coupon-sp::before {
      left: 0;
      border-radius: 0 15rpx 15rpx 0;
    }
    .coupon-box .coupon-sp::after {
      right: 0;
      border-radius: 15rpx 0 0 15rpx;
    }
    .coupon-box .btns {
        width: 150rpx;
        padding: 0 20rpx;
        background: transparent;
    }
    .coupon-box.coupon-item- .btns {
        /* background-color: #BEBEBE; */
    }
    .coupon-box .btns button {
        width: auto;
        background: #FFFFFF;
        border-radius: 60rpx;
        font-size: 22rpx;
        padding: 4rpx 20rpx;
    }
    .coupon-box .operation {
        padding-left: 0;
        margin-top: 4rpx;
        border-radius: 12rpx;
    }
    .coupon-product {
        width: 100%;
    }
    .coupon-product-item image {
        width: 124rpx;
        height: 124rpx;
        border-radius: 12rpx;
        background-color: rgba(0, 0, 0, 0.1);
    }
    .coupon-box .coupon-sp .btns {
        width: 446rpx;
        background: #FFFFFF;
        position: relative;
        color: #333333;
        box-sizing: border-box;
        padding: 20rpx;
    }
    .coupon-box .coupon-sp .btns:after {
        position: absolute;
        content: " ";
        border-left: 2rpx dashed #EEEEEE;
        left: -2rpx;
        height: 100%;
    }
    .coupon-title-top {
        height: 110rpx;
        border-bottom: 2rpx dashed #DDDDDD;
    }
    .buy-btn-box {
        position: fixed;
        width: 100%;
        left: 0;
        bottom: 0;
        z-index: 98;
    }
    
    .buy-btn {
        height: 80rpx;
        line-height: 80rpx;
        border-radius: 80rpx;
        overflow: hidden;
    }
    /* 兑换券内容 */
    .project-item {
        position: relative;
    }
    .project-box .iconfont {
        color: #333333;
    }
    .coupon-project {
        background-color: #FFF2EC;
    }
</style>