Blame view

ceres-uniapp-master/pages/tabbar/index/index.vue 10.9 KB
3f535f30   杨鑫   '初始'
1
2
3
4
5
6
7
8
9
10
11
  <template>
    <div class="hom-page" :style="{'padding-top': height + 'px'}">
  <!--    <gg></gg>-->
      <global-loading />
      <u-sticky offset-top="0" h5-nav-height="0" bg-color="#fff">
        <view class="head">
          <!-- #ifdef MP-WEIXIN -->
          <view
              class="header weiXinBox"
              :style="{'padding-top': topHeight + 'px'}"
          >
c72ce3d7   杨鑫   '1'
12
            <!-- <view
3f535f30   杨鑫   '初始'
13
14
15
16
17
18
19
20
                class="topBox"
                :style="{'height': height + 'px'}"
            >
              <image
                  class="logo"
                  src="@/static/logoTop.png"
                  mode="widthFix"
              ></image>
c72ce3d7   杨鑫   '1'
21
            </view> -->
3f535f30   杨鑫   '初始'
22
23
24
25
26
27
28
29
30
31
32
          </view>
          <view
              class="wxBtnBg"
              :style="{'padding-top': (topHeight + height + 10) + 'px'}"
          >
            <view
                class="weiXinBoxBtn"
                @click="searchPro"
            >
              <image
                  class="search-icon"
844aa73a   杨鑫   '最新'
33
                  src="https://jy.scjysm.asia:18086/cdwlMall/questionnaire/file/static/images/searchImg.png"
3f535f30   杨鑫   '初始'
34
35
36
37
38
39
40
41
42
43
                  mode="widthFix"
              >
              </image>
              <text>请输入您想要的宝贝</text>
            </view>
          </view>
          <!-- #endif -->
          <!-- #ifdef H5 || APP-PLUS -->
          <view class="header">
            <view class="topBox">
c72ce3d7   杨鑫   '1'
44
              <!-- <image
3f535f30   杨鑫   '初始'
45
46
47
                  class="logo"
                   src="@/static/logoTop.png"
                  mode="widthFix"
c72ce3d7   杨鑫   '1'
48
              ></image> -->
3f535f30   杨鑫   '初始'
49
50
51
52
53
54
              <view
                  class="search-btn"
                  @click="searchPro"
              >
                <image
                    class="search-icon"
41c84754   杨鑫   '最新'
55
                    src="https://jy.scjysm.asia:18086/cdwlMall/questionnaire/file/static/img/search.png"
3f535f30   杨鑫   '初始'
56
57
58
59
60
61
62
                    mode="widthFix"
                >
                </image>
              </view>
            </view>
          </view>
          <!-- #endif -->
ad7d1a78   杨鑫   '最新'
63
          <!-- <category-list @tabChange="tabChange"></category-list> -->
3f535f30   杨鑫   '初始'
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
        </view>
      </u-sticky>
      <canvas-page ref="canvasPage"
                   :componentsData="componentsData"
                   v-if="activeTab==0"
                   :terminal="terminal"
                   :typeId="1"
      ></canvas-page>
     <category-show ref="categoryShow"
                     v-else
                     :categoryid="categoryid"></category-show>
      <ad-window ref="adWindow"
                 :triggerCondition="1"></ad-window>
      <view class="reachBottom"
            v-if="topLeft > 400">
        <image class="reach-icon"
41c84754   杨鑫   '最新'
80
               src="https://jy.scjysm.asia:18086/cdwlMall/questionnaire/file/static/img/reachBottom.png"
3f535f30   杨鑫   '初始'
81
82
83
84
85
86
87
88
89
90
91
               mode="widthFix">
        </image>
        <text class="reach-text">这里到底了哦~~</text>
      </view>
      <tui-modal :show="privacyShow"
                 :custom="true"
                 :fadein="true">
        <view class="Put-box1">
          <view class="text-align fs34 fs-bold">
            协议与隐私政策
          </view>
ba37c587   杨鑫   '最新版本'
92
          <p class="mar-top-20">欢迎来到锦江公园!我们根据最新的法律、法规、监管政策要求,更新了隐私政策。</p>
3f535f30   杨鑫   '初始'
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
          <view class="flex-display flex-sp-between">
            <view class="btn submit"
                  @click="privacyShow = false">
              同意
            </view>
          </view>
        </view>
      </tui-modal>
    </div>
  </template>
  
  <script>
  import tuiModal from "@/components/modal/modal";
  import AdWindow from "@/components/adWindow";
  const NET = require('@/utils/request')
  const API = require('../../../config/api')
  import api from '@/components/canvasShow/config/api'
  import CategoryList from "@/components/basics/categoryList.vue"
  import CategoryShow from "@/components/basics/categoryShow.vue"
  import comHeader from '@/components/canvasShow/basics/header/app'
  import canvasPage from '@/components/canvasShow/canvasShowPage.vue'
  export default {
    components: {
      AdWindow,
      CategoryList,
      CategoryShow,
      canvasPage,
      tuiModal
    },
    data() {
      return {
        terminal: API.terminal,
        activeTab: 0,
        categoryid: 0,
        topHeight: 0,
        height: 0,
        topLeft: 0,
        privacyShow: false,
        componentsData: [],
        typeId: 1
      }
    },
    onReachBottom() {
      this.HandleLoadMoreProduct()
    },
ad7d1a78   杨鑫   '最新'
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
    onLoad(options) {
  	  console.log(options.phone,'phjas')
  	     if(options.phone&&options.phone!=''){
  	  	NET.request(API.Login, {
  	  		phone: options.phone,
  	  		verificationCode:'wGnknz0SpYZ0YkFTCqnWXDWqoNRJm3w2f3BVrUvEpbk='
  	  	}, 'POST').then(res => {
  	  		uni.hideLoading()
  	  		const item = res.data
  	  		uni.setStorageSync('storage_key', item);
  	  		if (uni.getStorageSync("salesId")) {
  				NET.request(API.huiyuanList, {phone:options.phone}, 'POST').then(item => {
  					uni.setStorageSync('memerId', JSON.parse(item.data).data.id);
  				})
  	  			let salesId = uni.getStorageSync("salesId")
  	  			let shopId = uni.getStorageSync("shopId")
  	  			this.bindSalesCustomer(salesId, shopId)
  	  			uni.removeStorageSync('salesId');
  	  			uni.removeStorageSync('shopId');
  	  		}
  	  	})
  	     }
00f63f76   杨鑫   '最新'
160
161
  	  const homePageUrl = window.location.href
  	  localStorage.setItem('homePageUrl', homePageUrl)
3f535f30   杨鑫   '初始'
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
      if (!uni.getStorageSync('storage_key')) {
        // #ifdef APP-PLUS
        this.privacyShow = true
        // #endif
      }
      this.$nextTick(() => {
        this.canvasGet()
        this.$refs.adWindow.getAd()
      })
    },
    onShow() {
      // #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO || MP-QQ
      let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
      this.topHeight = menuButtonInfo.top
      this.height = menuButtonInfo.height
      // #endif
  
    },
    onPageScroll(e) {
      this.topLeft = e.scrollTop
    },
    methods: {
ad7d1a78   杨鑫   '最新'
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
  	  //绑定关系
  	  bindSalesCustomer(salesId, storeId) {
  	  	if (salesId && storeId) {
  	  		//如果已登录,静默绑定客户关系,否则跳转到登录页面
  	  		NET.request(API.BindSalesCustomer, {
  	  			shopId: storeId,
  	  			distributorId: salesId
  	  		}, 'POST').then(res => {
  	  			uni.showToast({
  	  				title: "绑定成功",
  	  				icon: "none"
  	  			})
  	  		}).catch(res => {
  	  			uni.showToast({
  	  				title: res.data.message,
  	  				icon: "none"
  	  			})
  	  		})
  	  
  	  	}
  	  },
3f535f30   杨鑫   '初始'
205
206
207
208
      // 读取画布
      canvasGet() {
        var _this = this
        var apiUrl = api.getCanvas + '?terminal=' + this.terminal + '&type=' + this.typeId
65478d1d   杨鑫   '最新'
209
  	  
3f535f30   杨鑫   '初始'
210
211
212
213
214
215
216
217
218
219
220
221
222
        if (this.shopId) {
          apiUrl += '&shopId=' + this.shopId
        }
        let params = {
          url: apiUrl,
          method: 'GET'
        }
        // uni.showLoading({
        //   mask: true,
        //   title: '加载中...',
        // })
        NET.request(apiUrl, {}, 'GET').then(res => {
          if (JSON.stringify(res.data) !== '{}') {
3f535f30   杨鑫   '初始'
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
            var componentsData = JSON.parse(res.data.json)
            this.componentsData = componentsData
          }
          uni.hideLoading()
        }).catch(res => {
          uni.hideLoading()
        })
      },
      // 分享到朋友圈
      onShareTimeline: function() {
        return {
          title: this.miniHomeRemark,
          imageUrl: this.miniHomeImg,
          path: 'pages/tabbar/index/index',
        }
      },
      // 分享好友
      onShareAppMessage: function() {
        return {
          title: this.miniHomeRemark,
          imageUrl: this.miniHomeImg,
          path: 'pages/tabbar/index/index',
        }
      },
      /**
       * 请求非首页的子组件的下一页
       * */
      HandleLoadMoreProduct(){
        if (this.activeTab != 0) {
          let pitchOnPage = this.$refs.categoryShow
          if (pitchOnPage.total !== 0 && pitchOnPage.productList.length < pitchOnPage.total) {
            pitchOnPage.page++
            pitchOnPage.getData()
          }
        }
      },
      /**
       * 清空非首页的子组件商品数据
       * 回滚请求参数到起始页
       * */
      HandleCleanActiveTabProduct(){
        if(this.$refs.categoryShow){
          let pitchOnPage = this.$refs.categoryShow
          pitchOnPage.total = 0
          pitchOnPage.page=1
          pitchOnPage.productList=[{},{},{},{},{},{},{},{}]
        }
      },
      tabChange(index, id) {
        this.HandleCleanActiveTabProduct()
        this.activeTab = index
        this.categoryid = id
      },
      // 查询产品
      searchPro(key, type) {
        uni.navigateTo({
          url: `/pages_category_page1/search/index/index`
        })
      }
    }
  };
  </script>
  
  <style lang="scss" scoped>
  .hom-page{
    margin-top: calc(20rpx + var(--status-bar-height));
  }
  .head{
    background: #fff;
  
  }
  .header {
    background: #fff;
    .toLive {
      height: 60px;
      color: #FFF;
      background-color: #333;
    }
  
    .topBox {
      display: flex;
      align-items: center;
65478d1d   杨鑫   '最新'
305
      justify-content: flex-end;
3f535f30   杨鑫   '初始'
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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
      width: 100%;
    }
  
    .logo {
      width: 175rpx;
      height: 42rpx;
      margin-left: 30rpx;
    }
  
    .search-btn {
      height: 66rpx;
      background: rgba(255, 255, 255, 1);
      border-radius: 33rpx;
      display: flex;
      flex-direction: row;
      align-items: center;
      margin-right: 30rpx;
  
      .search-icon {
        width: 60rpx;
        height: 60rpx;
        // margin-left: 33rpx;
      }
  
      .search-word {
        font-size: 26rpx;
        font-weight: 400;
        color: rgba(153, 153, 153, 1);
        margin-left: 10rpx;
      }
    }
  
    .tabs-nav-warp {
      margin-top: 20rpx;
      padding: 0 30rpx;
    }
  
    .tabs-nav {
      .ul {
        display: flex;
  
        .li {
          flex: 1 0 auto;
          margin-left: 36rpx;
          font-size: 30rpx;
          color: #999999;
          position: relative;
          padding-bottom: 18rpx;
  
          &:first-child {
            margin-left: 0;
          }
  
          &.on {
            &:after {
              content: '';
              width: 100%;
              height: 4rpx;
              background: #39be7a;
              position: absolute;
              left: 0;
              bottom: 0;
            }
  
            font-weight: bold;
          }
        }
      }
    }
  }
  
  .weiXinBox {
    width: 100%;
    position: fixed;
    background: #F7F7F7;
    z-index: 99;
  }
  
  .wxBtnBg {
    padding: 0 20rpx;
  
    .weiXinBoxBtn {
      display: flex;
      align-items: center;
      padding: 10rpx 0 10rpx 15rpx;
      width: 100%;
      background: #F3F4F5;
      opacity: 1;
  
      .search-icon {
        width: 50rpx;
        height: 50rpx;
        margin-right: 20rpx;
      }
  
      text {
        color: #999999;
      }
    }
  }
  
  .terminal1 {
    .header {
      .topBox {
        // justify-content: left;
  
        .search-btn {
          .search-icon {
            margin-left: 0rpx;
          }
        }
      }
    }
  }
  
  .topTitle {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100rpx;
    width: 100%;
  
    .topText {
      text-align: center;
      color: #000000;
      font-size: 38rpx;
      font-weight: bold;
    }
  }
  
  .topWap {
    padding-top: 60rpx;
  
    .logo {
      margin-top: 0 !important;
    }
  }
  
  .terminal2 {
  }
  
  .terminal3 {
  }
  
  // 触底样式
  .reachBottom {
    margin-top: 30rpx;
    display: flex;
    flex-direction: column;
    align-items: center;
  
    .reach-icon {
      width: 150rpx;
      height: 150rpx;
    }
  
    .reach-text {
      margin: 20rpx 0;
      color: #CCCCCC;
    }
  }
  
  .Put-box1 {
    .btn {
      text-align: center;
      margin-top: 40rpx;
      border: 1px solid #333333;
      height: 80upx;
      line-height: 80upx;
      width: 100%;
      color: #333333;
    }
  
    .submit {
      background-color: #333333;
      color: #FFEBC4;
    }
  }
  </style>