admin
2022-05-23 e88ac05ee96cbf0306958323bf3063133bd53649
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
<!DOCTYPE html>
<html>
    
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="chrome=1"/>
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
        <title>免费领券</title>
        <!--自设-->
        <link rel="stylesheet" type="text/css" href="css/doui.min.css"/>
        <script src="js/doui.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="js/publicFunction.js" type="text/javascript" charset="utf-8"></script>
        <style type="text/css">
            /*块*/
            .kuai{ width: 7.1rem; height: auto; margin-left: 0.2rem; background-color: white; border-radius: 0.1rem; overflow: hidden; }
            /*已经抢光*/
            .shareF_notHave{ width: 70%; height: 70%; display: block; position: absolute; left: 15%; top: 15%; }
            .shareH_notHave{ width: 60%; height: 60%; display: block; position: absolute; left: 20%; top: 20%; }
            
            /*优惠券*/
            .app-sp-coupons{ border: 1px solid #E5005C; border-radius: 0.06rem; overflow: hidden; display: -webkit-flex; display: flex; -webkit-flex-direction: row; flex-direction: row; -webkit-justify-content: center; justify-content: center; -webkit-align-items: center; align-items: center; }
            .app-sp-couponsQuan{ width: 0.35rem; height: 0.35rem; line-height: 0.4rem; font-size: 0.26rem; color: white; text-align: center; background-color: #E5005C; }
            .app-sp-couponsPrice{ width: auto; height: 0.35rem; line-height: 0.4rem; padding: 0 0.14rem; font-size: 0.26rem; color: #E5005C; text-align: center; }
            
        </style>
        
        <link  />
    </head>
    
    <body style="display:none;">
        <div id="allwai" class="heightenBox fontMobile">
            
            <!--圆弧框 距离顶部 距离 底色-->
            <div style="width:100%; height:0.2rem;"></div>
            
            <!--圆弧-->
            <div v-show="share.list.length>0" class="kuai fboxCol Xstart Ycenter">
                
                <!--猜你喜欢-->
                <div class="home_cai fboxRow Xcenter Ycenter">
                    <img v-if="appType=='flq'" class="homeF_caiimg" src="img/flq/index_z1.png"/>
                    <img v-else class="homeH_caiimg" src="img/hcj/index_z1.png"/>
                    <div class="font32 font-weight">好友分享</div>
                    <img v-if="appType=='flq'" class="homeF_caiimg" src="img/flq/index_z2.png"/>
                    <img v-else class="homeH_caiimg" src="img/hcj/index_z2.png"/>
                </div>
                
                <!--分享标题-->
                <div v-if="share.title" class="fboxRow Xstart Ystart" style="width:6.5rem; margin-bottom:0.2rem;">
                    <div class="font30 font-black" style="line-height:1.8; text-indent:0.6rem;">{{share.title}}</div>
                </div>
                
                <!--一个商品单框-->
                <div v-for="(item, index) in share.list" class="sp1 fboxRow" v-on:click="spdanClick(item)">
                
                    <!--商品图片-->
                    <div class="sp1_img">
                        <img class="sp1_imgsrc" src="img/flq/sp_imgDef.png"/>
                        <img class="sp1_imgsrc" v-bind:src="item.picUrl" />
                        <!--已经抢光图片-->
                        <img v-if="appType=='flq'&&item.state==1" class="shareF_notHave" src="img/flq/share_notHave.png"/>
                        <img v-else-if="appType=='hcj'&&item.state==1" class="shareH_notHave" src="img/hcj/share_notHave.png"/>
                    </div>
                    
                    <div class="sp1_content fboxCol" style="padding-top:0rem ;">
                        
                        <!--商品标题栏-->
                        <div class="sp1_title fboxRow Xstart Ycenter">
                            <!--标题文字-->
                            <div class="sp1_titleFont font-ell2">{{item.title}}</div>
                            <!--来源-->
                            <div class="sp_type">
                                <img v-if='item.shopType==10' src="img/flq/sp_type1.png" />
                                <img v-else-if='item.shopType==11' src="img/flq/sp_type2.png" />
                                <img v-else-if='item.shopType==20' src="img/flq/sp_type20.png" />
                                <img v-else-if='item.shopType==30' src="img/flq/sp_type30.png" />
                            </div>
                        </div>
                        
                    
                        
                        <div class="flex1"></div>
                        
                        <!--原价-->
                        <div class="fboxRow Xstart Ycenter Ybaseline" style="margin-bottom:0.1rem;">
                            <div class="fboxRow ziF_red Ybaseline font-weight">
                                <div class="font24">¥</div>
                                <div v-if="item.couponInfo" class="font40">{{item.couponPrice}}</div>
                                <div v-else class="font40">{{item.zkPrice}}</div>
                            </div>
                        
                            <div class="sp1_xiaoFont" style="margin-left: 0.1rem;text-decoration: line-through;">¥{{item.zkPrice}}</div>
                            <div class="sp1_xiaoFont" style="margin-left: 0.1rem;" v-if="item.salesType==1">月销&nbsp;{{item.salesCount}}</div>
                            <div class="sp1_xiaoFont" style="margin-left: 0.1rem;" v-if="item.salesType==4">总销量&nbsp;{{item.salesCount}}</div>
                        
                        </div>
                        
                        <!--价格栏-->
                        <div class="fboxRow Xstart Ycenter">
                            <div v-if="item.couponInfo" class="app-sp-coupons">
                                <div class="app-sp-couponsQuan" style="vertical-align: middle;">券</div>
                                <div class="app-sp-couponsPrice">¥{{item.couponInfo.amount}}</div>
                            </div>
                            <!--空白-->
                            <div class="flex1"></div>
                        </div>
                        
                    </div>
                    
                </div>
                
                <div style="width:50%; height:0.1rem;"></div>
                
            </div>
            
            <!--圆弧框 距离底部 距离 底色-->
            <div style="width:100%; height:0.2rem;"></div>
            
        </div>
    </body>
    
</html>
 
 
 
<!--一键复制-->
<script src="js/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/clipboard.config.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    // ================================================================================== 页面数据
    var urldata =null;
    var vm = null;
    doui.importComplete(getImport(), function()
    {
        // vue实例化
        vm = new Vue({
            el: '#allwai',
            // 数据定义
            data: {
                // ------------------------------------------------------- 系统信息
                appType: null, // app:flq-返利券   hcj-海草街
                fingerprint: '', // 浏览器指纹
                
                // ------------------------------------------------------- 分享信息 
                share: {
                    id: null, // 动态id
                    source: "", // 来源
                    title: "", // 分享标题
                    list: [], // 商品列表
                },    
            },
        });
        
        
        // 浏览器指纹获取
        var sys = doui.systemInfoGet();
        vm.fingerprint = sys.fingerprint;
        
        
        // 获取地址栏信息
        urldata = doui.urlParamGet();
        // 获取app类型
        if (urldata.appType) { vm.appType = urldata.appType; }
        else { vm.appType = appTypeGet(); }
        // 获取到来源
        if (urldata.source) { vm.share.source = urldata.source; }
        
        // 获取到用户id
        if (urldata.uid) 
        {
            var user = { id: urldata.uid }; 
            saveSharePeople(user); 
        }
        
        // 获取到分享id
        if (urldata.shareId)
        { 
            // 保存分享id
            vm.share.id = urldata.shareId;
            // 请求数据
            Get_splist();
        }
        else { doui.showToast("获取分享ID失败"); }
        
        
        $("body").css("display", "block");
    });
    
    
    
    // ================================================================================== 页面事件
    // 商品框 点击,参数:   商品id
    function spdanClick (itemC) 
    {
        // 1. 无优惠券
        if (itemC.state == 1) { doui.showToast("该优惠券已抢光"); }
        // 2. 有商品id
        else if (itemC.goodsId) { 
        if(itemC.goodsType==1)
        {
             window.location.href='./single/xiangQing.html?id='+itemC.goodsId+"&uid="+urldata.uid;
        }else if(itemC.goodsType==2)
        {
            jumpJDLink(itemC.goodsId,urldata.uid);
        }else if(itemC.goodsType==3)
        {
            jumpPDDLink(itemC.goodsId,urldata.uid);
        }
            
        }
        // 3. 无商品id
        else { doui.showToast("获取商品ID失败"); }
    }
    
    
    
    // ================================================================================== 数据请求
    // 分享内容
    function Get_splist ()
    {
        // 数据准备
        var myurl =getHttp() + '/api/apph5/v1/share/getList';//getHttp()
        var mydata = doui.AjaxData({
            shareId: vm.share.id, 
            source: vm.share.source,  
            fingerprint: vm.fingerprint,
        });
        // 数据请求
        doui.showLoading("载入中");
        doui.AjaxJsonp(myurl, mydata, function(res)
        {
            if (res.code != 0) { doui.hideLoading(); doui.showToast(res.msg); }
            else
            {
                var mo = res.data.result_list;
                // 列表保存
                vm.share.list = mo;
                // 标题保存
                vm.share.title = res.data.title;
                
                doui.hideLoading();
            }
        });
    }
    
    //获取拼多多的推广链接
    function jumpPDDLink(goodsId,uid) {
        //数据请求
        doui.showLoading("获取商品信息中");
        var mydata = doui.AjaxData({
            id:goodsId,
            uid: uid
        });
        doui.AjaxJsonp(
            getHttp()+ "/api/h5/v1/webRecommend/getPDDGoodsDetail",//getHttp()
            mydata,
            function(res) {
                doui.hideLoading();
                if (res.code != 0) {
                    doui.showToast(res.msg);
                } else {
                    var mo = res.data;
                    //跳转到券链接
                    window.location.href=mo.jumpLink;
                }
            }
        );
    }
    
    //获取京东的链接
    function jumpJDLink(goodsId,uid) {
        //数据请求
        doui.showLoading("正在获取商品信息");
        var mydata = doui.AjaxData({
            id:goodsId,
            uid: uid
        });
        doui.AjaxJsonp(
            getHttp()+ "/api/h5/v1/webRecommend/getJDGoodsDetail",//getHttp()
            mydata,
            function(res) {
                doui.hideLoading();
                if (res.code != 0) {
                    doui.showToast(res.msg);
                } else {
                        var mo = res.data;
                        //跳转到券链接
                        window.location.href=mo.jumpLink;
                }
            }
        );
    }
</script>