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
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
<!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">
            /*轮播图*/
            .swiper-pagination{ display: -webkit-flex; display: flex; -webkit-flex-direction: row; flex-direction: row; -webkit-justify-content: center; justify-content: center; }
            .swiper-container-horizontal>.swiper-pagination-bullets{ width: 94%; left: 3%; bottom: 8px; border-radius: 0.04rem; background-color: rgba(255,255,255,0.4); }
            .swiper-pagination-bullet{ -webkit-flex: 1; flex: 1; height: 0.08rem; border-radius: 0.04rem; background: transparent; }
            .swiper-container-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet{ margin: 0; }
            .swiper-pagination-bullet-active{ background-color: white; opacity: 1; }
            /*白色圆弧盘*/
            .whitePan{ width: 7.14rem; margin-left: 0.18rem; padding-bottom: 0.1rem; background-color: white; border-radius: 0.3rem; }
            /*问题标题*/
            .contitle{ width: 6.5rem; margin-top: 0.42rem; line-height: 1.2; color: #3399CC; }
            /*已经下架*/
            .sp1_xiaJiaWai{ width: 100%; height: 100%; border-radius: 0.1rem; position: absolute; left: 0; top: 0; background-color: rgba(102,102,102,0.6); }
            .sp1_xiaJia{ width: 1.02rem; height: 1.02rem; position: absolute; left: 0; top: 0; }
        </style>
        <script type="text/javascript">
            doui.importSet([
                'css/yesApp.css',
                'css/swiper.min.css',
                'http://cdn.yeshitv.com/js/vue.min.js',
                'js/swiper.min.js',
                'js/yesApp.js',
                'js/wangEditor.min.js',
                'js/wangEditor.config.js',
            ]);
        </script>
    </head>
    
    <body style="display:none;">
        <div id="allwai" class="heightenBox fontMobile">
            
            <!--预留轮播图区域-->
            <div v-show="swiper.list.length>0">
                <!--轮播图插件-->
                <div class="swiper-container">
                    <div class="swiper-wrapper">
                        <div v-for="(item, index) in swiper.list" class="swiper-slide">
                            <div class="home_lunbo fboxRow Xcenter Ycenter" v-on:click="lunboImgClick(item)">
                                <img style="width:100%; height:100%;" v-bind:src="item.src"/>
                            </div>
                        </div>
                      </div>
                      <div class="swiper-pagination"></div>
                </div>
            </div>
            
            <!--内容区域-->
            <div style="width:7.5rem; padding-top:0.18rem; padding-bottom:0.18rem;">
                <!--白色圆弧盘-->
                <div v-show="pushCon.title" class="whitePan fboxCol Xstart Ycenter">
                    
                    
                    <!--推送标题-->
                    <div class="font36 contitle">{{pushCon.title}}</div>
                    
                    
                    <!--推送内容-->
                    <div style="width:6.9rem; margin-bottom:0.05rem;">
                        <!--富文本编辑器-->
                        <div id="editor1"></div><!--菜单栏隐藏-->
                        <div id="editor2"></div><!--正文编辑区(禁止编辑)-->
                    </div>
                    
                    
                    <!--一个商品单框-->
                    <div v-for="(item, index) in table.list" class="sp1 fboxRow" style="width:100%; border-radius:0.2rem;" v-on:click="if(item.state==0){ spdanClick(item.auctionId); } else{ doui.showToast('该商品已下架'); }">
                    
                        <!--商品图片-->
                        <div class="sp1_img">
                            <img class="sp1_imgsrc" src="img/flq/sp_imgDef.png"/>
                            <img class="sp1_imgsrc" v-bind:src="item.pictUrl" />
                            <div v-if="item.state==1" class="sp1_xiaJiaWai"></div>
                            <img v-if="item.state==1" class="sp1_xiaJia" src="img/AppPage/pushToday/goodsFalse.png"/>
                        </div>
                        
                        <div class="sp1_content fboxCol">
                            
                            <!--商品标题栏-->
                            <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==1' src="img/flq/sp_type1.png" />
                                    <img v-else-if='item.shopType==2' src="img/flq/sp_type2.png" />
                                </div>
                            </div>
                            
                            <!--返利-->
                            <div class="fboxRow Xstart Ycenter" style="width:100%; margin-top:0.2rem;">
                                <!--返利-->
                                <div class="fboxRow Xstart Ycenter">
                                    <div class="spF_fan"><img src="img/flq/sp_fan.png"/></div>
                                    <div v-if="item.taoBaoHongBaoInfo.hongbao>0" class="sp1_fanFont">¥{{item.taoBaoHongBaoInfo.hongbao}}</div>
                                    <div v-else-if="item.taoBaoHongBaoInfo.hongbao<=0" class="sp1_fanFont">{{item.taoBaoHongBaoInfo.rate}}</div>
                                    <div v-else class="sp1_fanFont">¥0</div>
                                </div>
                                <!--空白-->
                                <div class="flex1"></div>
                                <!--销量-->
                                <div class="sp1_xiaoFont">月销&nbsp;{{item.salesCount}}</div>
                            </div>
                            
                            <!--空白区域-->
                            <div class="flex1"></div>
                            
                            <!--原价-->
                            <div class="fboxRow Xstart Ycenter" style="margin-bottom:0.1rem;">
                                <div v-if="item.shopType==1" class="sp1_yuanFont">淘宝价¥{{item.zkPrice}}</div>
                                <div v-else-if="item.shopType==2" class="sp1_yuanFont">天猫价¥{{item.zkPrice}}</div>
                                <div v-else class="sp1_yuanFont">原价¥{{item.zkPrice}}</div>
                            </div>
                            
                            <!--价格栏-->
                            <div class="fboxRow Xstart Ycenter">
                                <!--现价数目-->
                                <div class="ziF_red fboxRow Xstart Ybaseline">
                                    <div class="font24">¥</div>
                                    <div v-if="item.taoBaoQuanInfo" class="font40 font-weight">{{item.quanPrice}}</div>
                                    <div v-else class="font40 font-weight">{{item.zkPrice}}</div>
                                </div>
                                <!--空白-->
                                <div class="flex1"></div>
                                <!--优惠券-->
                                <div v-if="item.taoBaoQuanInfo" class="sp1_quan spF_quanBg">{{item.taoBaoQuanInfo.couponAmount}}元券</div>
                            </div>
                            
                        </div>
                        
                    </div>
                    
                    
                </div>
            </div>
            
            <div class="do-scrollLoading"></div>
            
        </div>
    </body>
    
</html>
 
 
<!--编辑器-->
<script type="text/javascript">
    
    // 编辑器申明
    var editor = null;
    // 轮播图申明
    var mySwiper = null;
    // vue申明
    var vm = null;
    
    doui.onReady(function()
    {
        // vue 初始化
        vm = new Vue({
            el: "#allwai",
            // 数据
            data: {
                // 轮播图
                swiperChange: false,
                swiper: { list: [], },
                
                // 推送内容
                pushCon: {
                    id: null,
                    title: "",
                    html: "",
                },
                
                // 表格
                table: {
                    yema: 1,
                    yemamax: 1,
                    pagesize: 20,
                    list: [],
                },
            },
            // 数据监听
            updated: function () {
                // 轮播图组件更新
                if (vm.swiperChange == true && $(".swiper-wrapper").children().length > 0) 
                {
                    mySwiper.update();
                    vm.swiperChange = false;
                    console.log("轮播图更新成功");
                }
            },
            watch: {
                // 深度监听,可监听到对象、数组的变化
                'swiper.list': {
                    handler (val, oldVal) {
                        console.log("轮播图数据发生变化");
                        vm.swiperChange = true;
                    },
                    deep:true
                   },
            },
            // 初始事件
            methods: {
                creatPushCon: function () { vm.pushCon.id = null; vm.pushCon.title = ''; vm.pushCon.html = ''; },
                creatTable: function () { vm.table.yema = 1; vm.table.yemamax = 1; vm.table.list = new Array(); },
            },
        });
        
        
        // 关闭左上角“叉叉”按钮
        yesApp.closeBtnHidden();
        
        
        // 轮播图实例化
        mySwiper = new Swiper('.swiper-container', 
        {
            autoplay: true, //可选选项,自动滑动
            pagination: { el: '.swiper-pagination', },
        });
        
        
        // 编辑器初始化
        editor = wang.createGet({
            ids: ['editor1', 'editor2'],
            menus: [], // 菜单项设置
        });
        wang.editorFalse(editor, 'editor2');
        wang.style_scrollbar();
        wang.style_menu(editor, 'display:none;');
        wang.style_editor(editor, 'font-size:0.3rem;');
        wang.style_img('width:0.3rem; height:0.3rem;');
        
        
        // 获取地址栏传递值
        var urldata = doui.urlParamGet();
        if (urldata.id) 
        {
            // id赋值
            vm.pushCon.id = urldata.id;
            // 请求数据
            doui.showScrollLoading("加载推荐^_^", function(){ tableGet(); });
        }
        else { doui.showToast("获取推荐ID失败"); }
        
        
        // 轮播图
        Get_lunbo();
        
        
        document.body.style.display = "block";
    });
    
    
    
    // =================================================================== 页面事件
    // 轮播图点击
    function lunboImgClick (itemC)
    {
        if (itemC.params) 
        {
            yesApp.navigatorTo(itemC.jumpDetail, itemC.params, true);
        }
    }
    
    
    
    // =================================================================== 数据请求
    // 轮播图
    function Get_lunbo () 
    {
        // 数据准备
        var myurl = getHttp() + '/api/apph5/v1/swiper/getpicture';
        var mydata = doui.AjaxData({ card: "h5_pushToday" });
        // 数据请求
        doui.AjaxJsonp(myurl, mydata, function(res)
        {
            if (res.code != 0) {}
            // 轮播图保存
            else { vm.swiper.list = res.data.result_list; }
        });
    }
    
    // 获取列表
    function tableGet ()
    {
        // 数据准备
        var myurl = getHttp() + "/api/apph5/v1/push/getpushgoods";
        var mydata = doui.AjaxData({ 
            id: vm.pushCon.id, 
            page: vm.table.yema,
        });
        
        // 数据请求
        doui.AjaxJsonp(myurl, mydata, function(res)
        {
            if (res.code != 0) { doui.hideScrollLoading(); doui.showToast(res.msg); }
            else
            {
                // 标题赋值
                vm.pushCon.title = res.data.title;
                // 内容赋值(html代码)
                vm.pushCon.html = res.data.content;
                wang.valueSet(editor, vm.pushCon.html);
                // 列表赋值
                vm.table.list = res.data.result_list;
                // 取消弹框
                doui.hideScrollLoading();
            }
        });
    }
</script>