zhaojs
2023-07-07 55803b1a7b478aade9b6e59ca6675777375e2a92
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<template>
    <view class="elm-wrapper wrapperLayer"
        :style="optionsCurrent==2?'background-color:#FFD100;':'background-color:#FFD100;'">
 
        <view class="flexbox borderBox colCen"
            :style="optionsCurrent==2?'background-color:#FFD100;':'background-color:#FFD100;'">
            <view class="topbarbox"></view>
            <view class="leftimgbox rowCenBet" @tap="back()">
                <view class="shadow rowCenCen" style="background:rgba(0,0,0,0);">
                    <view class="iconfont" style="color: rgb(255, 255, 255);">&#xe630;
                    </view>
                </view>
                <view class="pagetitle"
                    :style="'opacity:'+ (0+scrollTop/100)+';color:' + ((scrollTop/100)>0.5?'#FFF;':'#222222;')">
                    美团红包
                </view>
                <view class="shadow rowCenCen" style="opacity: 0;background-color:#FFF;">
                    <view class="iconfont" style="color: rgb(255, 255, 255);">&#xe630;</view>
                </view>
            </view>
        </view>
 
        <view class="options-bar-content rowCenCen">
             <view class="center-container rowCenBet">
                 <block v-for="(items,index) in optionsList" :key="index">
                    <view class="items-content rowCenCen" @tap="navTap(items.type)" :class="{ 'yellow':items.type == optionsCurrent && [1,3].includes(optionsCurrent), 'green': items.type == optionsCurrent && optionsCurrent ==2 }">
                        <view>{{items.label}}</view>
                    </view>
                </block>
                <div class="items-active" :style="{'transform':'translateX('+(optionsCurrent-1) * 120 +'rpx)'}"></div>
            </view>
        </view>
 
        <image class="pageBac" :src="pageBac" mode="aspectFill">
        </image>
 
        <view class="center-code-container rowCen borderBox">
            <view class="white-content colCen">
                <view class="dashed-content rowCenCen"
                    :style="optionsCurrent==2?'border-bottom: 1rpx dashed rgba(98, 188, 0, 0.6);':'border-bottom: 1rpx dashed rgba(255, 209, 0, 0.6);'">
                    <image class="stepImg" src="https://hxshapp.oss-cn-beijing.aliyuncs.com/weapp/huanstep.png" mode="">
                    </image>
                </view>
 
                <image class="miniCodeImg" :src="wxQrcodeUrl" mode="aspectFit"></image>
 
                <view class="getBtn-container rowCenCen" @tap="shareClick()">
                    <view>领红包点外卖</view>
                </view>
            </view>
        </view>
 
        <view class="rulesContent colCen borderBox">
            <view class="txt-title">
                规则说明:
            </view>
            <view class="richtext-content">
                1.此活动为部分区域有效,以活动页面实际展示为准;红包发放数量及红包金额具有随机性;具体红包使用有效期及红包金额以实际收到为准;</br>
                2.红包使用规则:</br>
                (1)红包使用门槛、使用期限及使用规则等以红包券面展示信息为准;</br>
                (2)红包可在美团或美团外卖最新版客户端、美团外卖小程序下单且选择在线支付时使用;且红包仅限非到店自取外卖订单,下午茶、夜宵、美食、蛋糕、团餐频道、甜点
                饮品频道使用; </br>
                (3)外卖新人首单红包限新用户(设备、手机号、 红包
                号均未在美团外卖下过单)首次下单使用,且不与其他优惠(首减、满减、满赠、套餐增、折扣菜)同享;非首单红包可与上述优惠叠加使用;</br>
                (4)使用红包时下单手机号码必须与收餐人手机号码、领取红包时输入的手机号码一致:</br>
                3.订单跟单规则为您通过本活动页点击跳转至美团后只要产生有效点击即可进行跟单,点击有效期最长为7天</br>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                optionsCurrent: 1,
                scrollTop: 0,
                optionsList: [{
                        label: "美团",
                        type: 1
                    },
                    {
                            label: "饿了么",
                            type: 2
                        }
                /*     ,
                    {
                        label: "商超",
                        type: 2
                    }, {
                        label: "优选",
                        type: 3
                    } */
                ],
                mtInfo: null,
                wxQrcodeUrl: ''
            }
        },
        onPageScroll(e) {
            this.scrollTop = e.scrollTop
        },
        onLoad() {
            this.IntiData()
        },
        onPullDownRefresh() {
            this.IntiData()
        },
        computed: {
            pageBac(){
                let url=""
                const obj={
                    1:()=>{
                        url = 'https://hxshapp.oss-cn-beijing.aliyuncs.com/weapp/mt1.png'
                    },
                    2:()=>{
                        url = 'https://hxshapp.oss-cn-beijing.aliyuncs.com/weapp/mt2.png'
                    },
                    3:()=>{
                        url = 'https://hxshapp.oss-cn-beijing.aliyuncs.com/weapp/mt3.png'
                    }
                }
                obj[this.optionsCurrent]()
                return url
            }
        },
        methods: {
            IntiData() {
                var that = this;
                this.$u.api.meituanAct({type:this.optionsCurrent}).then(e => {
                    if(e.code != 0)return that.$alert(e.msg)
                    uni.stopPullDownRefresh()
                    console.log(e)
                    that.mtInfo = e.data.info;
                    that.wxQrcodeUrl = that.mtInfo.we_app_info.miniCode;
                }).catch(function (err) {
                })
            },
            back() {
                uni.navigateBack({
                    delta: 1
                })
            },
            navTap(type) {
                if (this.optionsCurrent != type) {
                    this.optionsCurrent = type
                    if(this.optionsCurrent==2)
                    {//跳转饿了么
                        uni.redirectTo({
                            url:'./elm'
                        })
                        return;
                    }
                    else if (this.optionsCurrent == 2) {
                        uni.setNavigationBarColor({
                            frontColor: '#ffffff',
                            backgroundColor: '#62BC00'
                        })
                    } else {
                        uni.setNavigationBarColor({
                            frontColor: '#ffffff',
                            backgroundColor: '#FFD100'
                        })
                    }
                    this.IntiData()
                }
            },
            jumpMini() {
                uni.navigateToMiniProgram({
                    appId: this.mtInfo.we_app_info.app_id,
                    path: this.mtInfo.we_app_info.page_path,
                    success: (res) => {}
                })
            },
            shareClick() {
                // #ifdef APP-PLUS
                // 1拉起微信小程序    0 不拉
                var isAppletJump = getApp().globalData.appinfo.isAppletJump;
                console.log("===========" + isAppletJump)
                if (isAppletJump) {
                    if (plus.os.name == 'Android') {
                        plus.runtime.openURL(this.mtInfo.deeplink, res => {
                            this.toMiniProgram();
                        }, 'com.sankuai.meituan');
                    } else {
                        plus.runtime.openURL(this.mtInfo.deeplink, res => {
                            this.toMiniProgram();
                        }, 'com.sankuai.meituan');
                    }
                } else {
                    plus.runtime.openURL(this.mtInfo.deeplink, res => {
                        uni.navigateTo({
                            url: '../webView/webView?url=' + (this.mtInfo.h5 == "" ? this.mtInfo.long_h5 : this.mtInfo.h5)
                        })
                    }, 'com.sankuai.meituan');
                }
 
                // #endif
            },
            toMiniProgram() {
                var appid = this.mtInfo.we_app_info.app_id;
                var appPath = this.mtInfo.we_app_info.page_path;
                plus.share.getServices(function(res) {
 
                    var sweixin = null;
                    for (var i = 0; i < res.length; i++) {
 
                        var t = res[i];
                        if (t.id == 'weixin') {
                            sweixin = t;
 
                        }
                    }
 
                    if (sweixin) {
                        sweixin.launchMiniProgram({
                            id: appid,
                            type: 0, //0 正式 1 测试 2 体验  小程序的版本
                            path: appPath //这里你要跳的路径,可以传值
                        });
                    }
                }, function(res) {
                    console.log(JSON.stringify(res));
                });
            },
        }
    }
</script>
 
<style lang="scss">
    .elm-wrapper {
        width: 100%;
        min-height: 100vh;
        background-color: #FFD100;
 
        .flexbox {
            position: fixed;
            z-index: 100;
            width: 100%;
            padding: 0 32rpx;
 
            .leftimgbox {
                width: 100%;
                height: 90rpx;
 
                .shadow {
                    width: 50rpx;
                    height: 50rpx;
                    font-size: 28rpx;
                    border-radius: 50%;
                }
            }
        }
 
        .options-bar-content {
            width: 100%;
            margin-top: 198rpx;
            .center-container {
                position: relative;
                width: 240rpx;
                height: 58rpx;
                background: rgba(254, 254, 254, 0.3);
                border-radius: 29rpx;
 
                .items-content {
                    position: relative;
                    width: 120rpx;
                    height: 58rpx;
                    background: transparent;
                    border-radius: 29rpx;
                    font-size: 28rpx;
                    font-weight: 500;
                    z-index: 1;
                    color: rgba(255, 255, 255, 0.7);
                }
 
                .items-active {
                    position: absolute;
                    left: 0;
                    @extend .items-content;
                    background: #FEFEFE;
                    z-index: 0;
                    // opacity: 0.6;
                    transition:0.3s ease-out;
                }
                .green{
                    color:#62BC00;
                }
                .yellow{
                    color:#FFD100;
                }
            }
        }
 
        .pageBac {
            width: 100%;
            height: 294rpx;
            margin-top: 20rpx;
        }
 
        .center-code-container {
            width: 100%;
            padding: 0 28rpx;
 
            .white-content {
                width: 100%;
                padding-bottom: 50rpx;
                background-color: #FFFFFF;
                border-radius: 16rpx;
 
                .dashed-content {
                    width: 100%;
                    height: 194rpx;
 
                    .stepImg {
                        width: 540rpx;
                        height: 107rpx;
                    }
                }
 
                .miniCodeImg {
                    width: 288rpx;
                    height: 288rpx;
                    margin: 70rpx 0;
                }
 
                .getBtn-container {
                    width: 580rpx;
                    height: 78rpx;
                    border-radius: 39rpx;
                    background: linear-gradient(0deg, #F1B641 0%, #FFCE6D 100%);
                    font-size: 34rpx;
                    font-weight: 500;
                    color: #C03F11;
                }
 
                .shareBtn-container {
 
                    border: 1rpx solid #FFD100;
 
 
 
                    color: #FFD100;
                    ;
                    margin-top: 30rpx;
 
 
                    width: 580rpx;
                    height: 78rpx;
                    border-radius: 39rpx;
                    //background: linear-gradient(0deg, #F1B641 0%, #FFCE6D 100%);
                    font-size: 34rpx;
                    font-weight: 500;
 
                }
 
                .greenbtn {
                    color: #62BC00;
                    border-color: #62BC00;
                }
            }
        }
 
        .rulesContent {
            width: 100%;
            padding: 0 28rpx;
            margin-top: 45rpx;
 
            .txt-title {
                width: 100%;
                font-size: 32rpx;
                font-weight: 500;
                color: #FFFFFF;
                line-height: 48rpx;
                margin-bottom: 20rpx;
            }
 
            .richtext-content {
                width: 100%;
                margin-bottom: 40rpx;
                font-size: 26rpx;
                font-weight: 400;
                line-height: 48rpx;
                color: #FFFFFF;
            }
        }
    }
    
</style>