Commit 01e95a2387233b4f1ae2541696e933ecf3105e02
1 parent
ed22eb7f
分销小店 分类 品牌和国家跳转优化
Showing
8 changed files
with
979 additions
and
987 deletions
app.json
| @@ -226,9 +226,9 @@ | @@ -226,9 +226,9 @@ | ||
| 226 | "sitemapLocation": "sitemap.json", | 226 | "sitemapLocation": "sitemap.json", |
| 227 | "usingComponents": { | 227 | "usingComponents": { |
| 228 | "customtabbar":"custom-tab-bar/index" | 228 | "customtabbar":"custom-tab-bar/index" |
| 229 | - } | ||
| 230 | - | ||
| 231 | - | 229 | + }, |
| 230 | + "useExtendedLib": { | ||
| 231 | + "weui": true | ||
| 232 | + } | ||
| 232 | 233 | ||
| 233 | - | ||
| 234 | } | 234 | } |
| 235 | \ No newline at end of file | 235 | \ No newline at end of file |
packageA/pages/distribution/shop/shop.js
| @@ -23,7 +23,7 @@ Page({ | @@ -23,7 +23,7 @@ Page({ | ||
| 23 | isShowRow: false,//控制视图切换状态 | 23 | isShowRow: false,//控制视图切换状态 |
| 24 | isHiddenDropdown: true,//控制筛选下拉菜单显隐 | 24 | isHiddenDropdown: true,//控制筛选下拉菜单显隐 |
| 25 | 25 | ||
| 26 | - list: null, | 26 | + list: [], |
| 27 | isLoading: false, // 检测是否已经发送请求,防止重复发送请求 | 27 | isLoading: false, // 检测是否已经发送请求,防止重复发送请求 |
| 28 | noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 | 28 | noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 |
| 29 | pageNum: 1, // 当前页数 | 29 | pageNum: 1, // 当前页数 |
| @@ -44,7 +44,6 @@ Page({ | @@ -44,7 +44,6 @@ Page({ | ||
| 44 | * 生命周期函数--监听页面加载 | 44 | * 生命周期函数--监听页面加载 |
| 45 | */ | 45 | */ |
| 46 | onLoad: function (options) { | 46 | onLoad: function (options) { |
| 47 | - console.log(options); | ||
| 48 | wx.setNavigationBarTitle({ | 47 | wx.setNavigationBarTitle({ |
| 49 | title: "我的小店", | 48 | title: "我的小店", |
| 50 | }); | 49 | }); |
| @@ -76,32 +75,20 @@ Page({ | @@ -76,32 +75,20 @@ Page({ | ||
| 76 | 75 | ||
| 77 | } | 76 | } |
| 78 | 77 | ||
| 79 | - | ||
| 80 | - // 判断会员是否授权登录, | ||
| 81 | - // 没有登录则跳转到登录页, | ||
| 82 | - // 已登录则设置已登录状态,请求加载签到数据 | ||
| 83 | - // isLogin记录登录状态 | ||
| 84 | - // app.isLogin().then(function(data) { | ||
| 85 | - // // 1.登录成功 | ||
| 86 | - // self.setData({ | ||
| 87 | - // isLogin: true, | ||
| 88 | - // userInfo: data, | ||
| 89 | - // currentQuery: { | ||
| 90 | - // store_id: app.globalData.setting.stoid, | ||
| 91 | - // user_id: app.globalData.user_id, | ||
| 92 | - // }, | ||
| 93 | - // }); | ||
| 94 | - // // 2.请求全部商品数据 | ||
| 95 | - // self.getData(true, '/api/weshop/users/distribut/pagemyshop', self.data.currentQuery); | ||
| 96 | - // // 3.请求新品 | ||
| 97 | - // app.request.promiseGet('/api/weshop/users/distribut/pagemyshop?type=2', { | ||
| 98 | - // data: self.data.currentQuery, | ||
| 99 | - // }).then(function(res) { | ||
| 100 | - // self.setData({ | ||
| 101 | - // newList: res.data.data, | ||
| 102 | - // }); | ||
| 103 | - // }) | ||
| 104 | - // }); | 78 | + if (options?.brand_id) { |
| 79 | + this.setData({ | ||
| 80 | + brand_id: options.brand_id, | ||
| 81 | + is_router:true | ||
| 82 | + }) | ||
| 83 | + // this.getData(true, '/api/weshop/users/distribut/pagemyshop', this.data.currentQuery); | ||
| 84 | + } | ||
| 85 | + if (options?.nation_id) { | ||
| 86 | + this.setData({ | ||
| 87 | + nation_id: options.nation_id, | ||
| 88 | + is_router:true | ||
| 89 | + }) | ||
| 90 | + // this.getData(true, '/api/weshop/users/distribut/pagemyshop', this.data.currentQuery); | ||
| 91 | + } | ||
| 105 | }, | 92 | }, |
| 106 | 93 | ||
| 107 | /** | 94 | /** |
| @@ -125,42 +112,16 @@ Page({ | @@ -125,42 +112,16 @@ Page({ | ||
| 125 | user_id: app.globalData.user_id, | 112 | user_id: app.globalData.user_id, |
| 126 | }, | 113 | }, |
| 127 | }); | 114 | }); |
| 128 | - // 请求数据 | ||
| 129 | - app.request.promiseGet('/api/weshop/users/distribut/pagemyshop?orderType=desc', { | ||
| 130 | - data: this.data.currentQuery, | ||
| 131 | - }).then(res => { | ||
| 132 | - self.setData({ | ||
| 133 | - list: res.data.data, | ||
| 134 | - total: res.data.data.total, | ||
| 135 | - }); | ||
| 136 | - }); | ||
| 137 | - | ||
| 138 | - // 新品 | ||
| 139 | - app.request.promiseGet('/api/weshop/users/distribut/pagemyshop?type=2&orderType=desc', { | ||
| 140 | - data: self.data.currentQuery, | ||
| 141 | - }).then(res => { | ||
| 142 | - self.setData({ | ||
| 143 | - newList: res.data.data, | ||
| 144 | - }); | ||
| 145 | - }); | ||
| 146 | - // 广告banner | ||
| 147 | - app.request.promiseGet("/api/weshop/ad/page", { | ||
| 148 | - data: { | ||
| 149 | - pid: 401, | ||
| 150 | - enabled: 1, | ||
| 151 | - store_id: app.globalData.setting.stoid, | ||
| 152 | - } | ||
| 153 | - }).then(res => { | ||
| 154 | - if (res.data.code == 0 && res.data.data) { | ||
| 155 | - let item = res.data.data.pageData[0]; | ||
| 156 | - if (item && item.ad_code) { | ||
| 157 | - self.setData({ | ||
| 158 | - ad_img: item.ad_code, | ||
| 159 | - }); | ||
| 160 | - }; | ||
| 161 | - }; | ||
| 162 | - }); | ||
| 163 | - | 115 | + !this.data.is_router&&this.initData(); |
| 116 | + this.data.is_router&&this.getData(true,"/api/weshop/users/distribut/pagemyshop?orderType=desc",this.data.currentQuery); | ||
| 117 | + let total=wx.getStorageSync('total'); | ||
| 118 | + let newListTotal=wx.getStorageSync('newListTotal'); | ||
| 119 | + if(total>0&&newListTotal>0){ | ||
| 120 | + this.setData({ | ||
| 121 | + total, | ||
| 122 | + newListTotal | ||
| 123 | + }) | ||
| 124 | + } | ||
| 164 | }; | 125 | }; |
| 165 | } | 126 | } |
| 166 | //被人分享点击开的 | 127 | //被人分享点击开的 |
| @@ -259,9 +220,50 @@ Page({ | @@ -259,9 +220,50 @@ Page({ | ||
| 259 | inputVal: app.globalData.key_word, | 220 | inputVal: app.globalData.key_word, |
| 260 | }) | 221 | }) |
| 261 | this.search(); | 222 | this.search(); |
| 262 | - } | 223 | + }; |
| 224 | + }, | ||
| 225 | + //初始化数据 | ||
| 226 | + initData() { | ||
| 227 | + | ||
| 228 | + // 全部商品 | ||
| 229 | + app.request.promiseGet('/api/weshop/users/distribut/pagemyshop?orderType=desc', { | ||
| 230 | + data: this.data.currentQuery, | ||
| 231 | + }).then(res => { | ||
| 232 | + wx.setStorageSync('total', res.data.data.total); | ||
| 233 | + this.setData({ | ||
| 234 | + total: res.data.data.total, | ||
| 235 | + list:res.data.data.pageData, | ||
| 236 | + }); | ||
| 237 | + }); | ||
| 238 | + // 新品 | ||
| 239 | + app.request.promiseGet('/api/weshop/users/distribut/pagemyshop?type=2&orderType=desc', { | ||
| 240 | + data: this.data.currentQuery, | ||
| 241 | + }).then(res => { | ||
| 242 | + wx.setStorageSync('newListTotal', res.data.data.total); | ||
| 243 | + this.setData({ | ||
| 244 | + newListTotal: res.data.data.total, | ||
| 245 | + }); | ||
| 246 | + }); | ||
| 247 | + | ||
| 248 | + // 广告banner | ||
| 249 | + app.request.promiseGet("/api/weshop/ad/page", { | ||
| 250 | + data: { | ||
| 251 | + pid: 401, | ||
| 252 | + enabled: 1, | ||
| 253 | + store_id: app.globalData.setting.stoid, | ||
| 254 | + } | ||
| 255 | + }).then(res => { | ||
| 256 | + if (res.data.code == 0 && res.data.data) { | ||
| 257 | + let item = res.data.data.pageData[0]; | ||
| 258 | + if (item && item.ad_code) { | ||
| 259 | + this.setData({ | ||
| 260 | + ad_img: item.ad_code, | ||
| 261 | + }); | ||
| 262 | + }; | ||
| 263 | + }; | ||
| 264 | + }); | ||
| 265 | + // } | ||
| 263 | }, | 266 | }, |
| 264 | - | ||
| 265 | /** | 267 | /** |
| 266 | * 生命周期函数--监听页面隐藏 | 268 | * 生命周期函数--监听页面隐藏 |
| 267 | */ | 269 | */ |
| @@ -273,7 +275,11 @@ Page({ | @@ -273,7 +275,11 @@ Page({ | ||
| 273 | * 生命周期函数--监听页面卸载 | 275 | * 生命周期函数--监听页面卸载 |
| 274 | */ | 276 | */ |
| 275 | onUnload: function () { | 277 | onUnload: function () { |
| 276 | - app.globalData.key_word=null; | 278 | + console.log('onun'); |
| 279 | + app.globalData.key_word = null; | ||
| 280 | + app.globalData.nid = null; | ||
| 281 | + app.globalData.bid = null; | ||
| 282 | + // wx.removeStorageSync(key); | ||
| 277 | }, | 283 | }, |
| 278 | 284 | ||
| 279 | /** | 285 | /** |
| @@ -395,20 +401,18 @@ Page({ | @@ -395,20 +401,18 @@ Page({ | ||
| 395 | search() { | 401 | search() { |
| 396 | let data = this.data.currentQuery; | 402 | let data = this.data.currentQuery; |
| 397 | data.key = this.data.inputVal; | 403 | data.key = this.data.inputVal; |
| 398 | - if (data.orderField) { | ||
| 399 | - delete data.orderField; | ||
| 400 | - }; | ||
| 401 | - if (data.page) { | ||
| 402 | - delete data.page; | ||
| 403 | - }; | 404 | + delete data.page; |
| 405 | + delete data.brand_id; | ||
| 406 | + delete data.nation_id; | ||
| 404 | this.setData({ | 407 | this.setData({ |
| 405 | - currentTabIndex: 4, | 408 | + currentTabIndex: this.data.currentTabIndex, |
| 406 | isSort: false, | 409 | isSort: false, |
| 407 | isDescending: false, | 410 | isDescending: false, |
| 408 | currentQuery: data, | 411 | currentQuery: data, |
| 409 | pageNum: 1, | 412 | pageNum: 1, |
| 410 | }); | 413 | }); |
| 411 | this.getData(true, '/api/weshop/users/distribut/pagemyshop', data); | 414 | this.getData(true, '/api/weshop/users/distribut/pagemyshop', data); |
| 415 | + app.globalData.key_word=null; | ||
| 412 | }, | 416 | }, |
| 413 | 417 | ||
| 414 | /** | 418 | /** |
| @@ -484,9 +488,6 @@ Page({ | @@ -484,9 +488,6 @@ Page({ | ||
| 484 | if (data.page) {// 清除page | 488 | if (data.page) {// 清除page |
| 485 | delete data.page; | 489 | delete data.page; |
| 486 | }; | 490 | }; |
| 487 | - | ||
| 488 | - | ||
| 489 | - | ||
| 490 | if (currentIndex == 0) { | 491 | if (currentIndex == 0) { |
| 491 | if (data.orderField) {// 清除orderField | 492 | if (data.orderField) {// 清除orderField |
| 492 | delete data.orderField; | 493 | delete data.orderField; |
| @@ -508,6 +509,9 @@ Page({ | @@ -508,6 +509,9 @@ Page({ | ||
| 508 | }; | 509 | }; |
| 509 | data.orderType = 'desc'; | 510 | data.orderType = 'desc'; |
| 510 | this.data.currentQuery = data; | 511 | this.data.currentQuery = data; |
| 512 | + delete data.brand_id; | ||
| 513 | + delete data.nation_id; | ||
| 514 | + console.log(data); | ||
| 511 | this.getData(true, '/api/weshop/users/distribut/pagemyshop', data); | 515 | this.getData(true, '/api/weshop/users/distribut/pagemyshop', data); |
| 512 | }, | 516 | }, |
| 513 | 517 | ||
| @@ -535,7 +539,19 @@ Page({ | @@ -535,7 +539,19 @@ Page({ | ||
| 535 | * 请求数据 | 539 | * 请求数据 |
| 536 | */ | 540 | */ |
| 537 | getData: function (isInit, url, data) { | 541 | getData: function (isInit, url, data) { |
| 538 | - | 542 | + let { brand_id, nation_id } = this.data; |
| 543 | + if (brand_id - 0) { | ||
| 544 | + delete data.nation_id; | ||
| 545 | + // delete data.key; | ||
| 546 | + data.brand_id = brand_id; | ||
| 547 | + this.data.brand_id=null; | ||
| 548 | + }; | ||
| 549 | + if (nation_id - 0) { | ||
| 550 | + delete data.brand_id; | ||
| 551 | + // delete data.key; | ||
| 552 | + data.nation_id = nation_id; | ||
| 553 | + this.data.nation_id=null; | ||
| 554 | + }; | ||
| 539 | app.request.promiseGet(url, { | 555 | app.request.promiseGet(url, { |
| 540 | data: data, | 556 | data: data, |
| 541 | isShowLoading: true, | 557 | isShowLoading: true, |
| @@ -545,16 +561,19 @@ Page({ | @@ -545,16 +561,19 @@ Page({ | ||
| 545 | if (res.data.code == 0) { | 561 | if (res.data.code == 0) { |
| 546 | 562 | ||
| 547 | self.setData({ | 563 | self.setData({ |
| 548 | - isLoading: false | 564 | + isLoading: false, |
| 565 | + // is_router:false, | ||
| 549 | }); | 566 | }); |
| 550 | 567 | ||
| 551 | if (isInit) {// 第一次加载 | 568 | if (isInit) {// 第一次加载 |
| 569 | + console.log('first',res); | ||
| 552 | self.setData({ | 570 | self.setData({ |
| 553 | - list: res.data.data, | 571 | + list: res.data.data.pageData, |
| 554 | }); | 572 | }); |
| 573 | + console.log(self.data.list); | ||
| 555 | } else { | 574 | } else { |
| 556 | self.setData({ | 575 | self.setData({ |
| 557 | - 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) | 576 | + list: self.data.list.concat(res.data.data.pageData) |
| 558 | }); | 577 | }); |
| 559 | }; | 578 | }; |
| 560 | 579 | ||
| @@ -566,7 +585,7 @@ Page({ | @@ -566,7 +585,7 @@ Page({ | ||
| 566 | 585 | ||
| 567 | } else { | 586 | } else { |
| 568 | self.setData({ | 587 | self.setData({ |
| 569 | - 'list.pageData': [] | 588 | + list: [] |
| 570 | }); | 589 | }); |
| 571 | }; | 590 | }; |
| 572 | 591 | ||
| @@ -574,7 +593,7 @@ Page({ | @@ -574,7 +593,7 @@ Page({ | ||
| 574 | .catch(function (err) { | 593 | .catch(function (err) { |
| 575 | console.log('出错拉!!!!', err); | 594 | console.log('出错拉!!!!', err); |
| 576 | self.setData({ | 595 | self.setData({ |
| 577 | - 'list.pageData': [] | 596 | + list: [] |
| 578 | }); | 597 | }); |
| 579 | }); | 598 | }); |
| 580 | }, | 599 | }, |
| @@ -668,12 +687,12 @@ Page({ | @@ -668,12 +687,12 @@ Page({ | ||
| 668 | */ | 687 | */ |
| 669 | clickAll() { | 688 | clickAll() { |
| 670 | let data = this.data.currentQuery; | 689 | let data = this.data.currentQuery; |
| 671 | - | ||
| 672 | if (data.page) delete data.page; | 690 | if (data.page) delete data.page; |
| 673 | if (data.orderField) delete data.orderField; | 691 | if (data.orderField) delete data.orderField; |
| 674 | if (data.orderType) delete data.orderType; | 692 | if (data.orderType) delete data.orderType; |
| 675 | if (data.key) delete data.key; | 693 | if (data.key) delete data.key; |
| 676 | - | 694 | + delete data.brand_id; |
| 695 | + delete data.nation_id; | ||
| 677 | this.setData({ | 696 | this.setData({ |
| 678 | pageNum: 1, | 697 | pageNum: 1, |
| 679 | noMore: false, | 698 | noMore: false, |
| @@ -689,11 +708,12 @@ Page({ | @@ -689,11 +708,12 @@ Page({ | ||
| 689 | clickNew() { | 708 | clickNew() { |
| 690 | let data = this.data.currentQuery; | 709 | let data = this.data.currentQuery; |
| 691 | 710 | ||
| 692 | - if (data.page) delete data.page; | ||
| 693 | - if (data.orderField) delete data.orderField; | ||
| 694 | - if (data.orderType) delete data.orderType; | ||
| 695 | - if (data.key) delete data.key; | ||
| 696 | - | 711 | + delete data.page; |
| 712 | + delete data.orderField; | ||
| 713 | + delete data.orderType; | ||
| 714 | + delete data.key; | ||
| 715 | + delete data.brand_id; | ||
| 716 | + delete data.nation_id; | ||
| 697 | this.setData({ | 717 | this.setData({ |
| 698 | pageNum: 1, | 718 | pageNum: 1, |
| 699 | noMore: false, | 719 | noMore: false, |
packageA/pages/distribution/shop/shop.wxml
| 1 | <wxs src="../../../../utils/filter.wxs" module="filter"></wxs> | 1 | <wxs src="../../../../utils/filter.wxs" module="filter"></wxs> |
| 2 | <wxs module="g_filter" src="g_filter.wxs"></wxs> | 2 | <wxs module="g_filter" src="g_filter.wxs"></wxs> |
| 3 | <view> | 3 | <view> |
| 4 | - <view class="head pr"> | ||
| 5 | - <view class="bdb"> | ||
| 6 | - <!-- <view><image src="../../../images/jfbuy.jpg" mode="widthFix" class="banner"/></view> --> | ||
| 7 | - <view><image src="{{imghost + (ad_img ? ad_img:'/miniapp/images/user_index_powder.jpg')}}" mode="widthFix" class="banner"/></view> | ||
| 8 | - <view class="flex bg-white pdh20 jc_sb pr"> | ||
| 9 | - <!-- 分享人的头像 --> | ||
| 10 | - <view class="avatar-container" wx:if="{{userInfo2}}"> | ||
| 11 | - <image class="avatar" src="{{userInfo2.head_pic}}"/> | ||
| 12 | - <view class="pdt20"><text class="nickname">{{userInfo2.nickname}}</text></view> | ||
| 13 | - </view> | ||
| 14 | - <!-- 自己的头像 --> | ||
| 15 | - <view class="avatar-container" wx:else> | ||
| 16 | - <image class="avatar" src="{{userInfo.head_pic}}"/> | ||
| 17 | - <view class="pdt20"><text class="nickname">{{userInfo.nickname}}</text></view> | ||
| 18 | - </view> | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - <view class="flex t-c fs24 f1 jc_fe"> | ||
| 22 | - <view class="pdv20 pdh40 {{isAll ? 'selected':''}}" bindtap="clickAll"> | ||
| 23 | - <view class="fs30">{{filter.show_default(total)}}</view> | ||
| 24 | - <view>全部商品</view> | ||
| 25 | - </view> | ||
| 26 | - <view class="pdv20 pdh40 {{!isAll ? 'selected':''}}" bindtap="clickNew"> | ||
| 27 | - <view class="fs30">{{filter.show_default(newList.total)}}</view> | ||
| 28 | - <view>新品</view> | ||
| 29 | - </view> | ||
| 30 | - <view class="pdv20 pdh40" bindtap="goto" data-url="/pages/user/index/index"> | ||
| 31 | - <view class="fs26"><text class="iconfont icon-ren1 bold"></text></view> | ||
| 32 | - <view>会员中心</view> | ||
| 33 | - </view> | ||
| 34 | - </view> | ||
| 35 | - </view> | ||
| 36 | - </view> | ||
| 37 | - | ||
| 38 | - <!-- 搜索 --> | ||
| 39 | - <view class="flex ai-center fs26 bg-white pd20"> | ||
| 40 | - <text class="pd20 c-9b iconfont icon-fenxiang" catch:tap="goto" data-url="/packageC/pages/goods/distributionCategoryList/index"></text> | ||
| 41 | - <view class="input-container f1"> | ||
| 42 | - <input class="input" type="text" value="{{inputVal}}" placeholder="请输入商品关键字" confirm-type="search" bindfocus="inputFocus" bindblur="inputBlur" bindinput="input" bindconfirm="search"/> | ||
| 43 | - <text class="iconfont icon-guanbi" hidden="{{!isInputFocus}}" catchtap="inputClear"></text> | ||
| 44 | - <!-- 搜索输入框聚焦时显示关闭按钮,否则隐藏关闭按钮 --> | ||
| 45 | - </view> | ||
| 46 | - <view class="pd20 c-red" bindtap="search">搜索</view> | ||
| 47 | - </view> | ||
| 48 | - | ||
| 49 | - </view> | ||
| 50 | - | ||
| 51 | - <view class="flex t-c fs26 bg-white bdb sticky c-a" catchtap="clickTab"> | ||
| 52 | - <block wx:for="{{tabArr}}"> | ||
| 53 | - <view class="f1 pd20 {{currentTabIndex == index ? 'active':''}}" data-index="{{index}}" wx:if="{{index != 3}}">{{item}}</view> | ||
| 54 | - <view class="f1 pd20 {{currentTabIndex == index ? 'active':''}}" data-index="{{index}}" wx:else bindtap="clickSort"> | ||
| 55 | - {{item}} | ||
| 56 | - <text class="iconfont icon-sort2 c-db" wx:if="{{!isSort}}"></text> | ||
| 57 | - <text class="t-icon t-icon-sort-up {{isDescending ? 'reverse':''}}" wx:else></text> | ||
| 58 | - </view> | ||
| 59 | - </block> | ||
| 60 | - <view class="f1 pd20" catchtap="change"> | ||
| 61 | - <text class="iconfont {{isShowRow ? 'icon-fenxiang':'icon-fenlie'}}"></text> | ||
| 62 | - </view> | ||
| 63 | - </view> | ||
| 64 | - | ||
| 65 | - | ||
| 66 | - <view class="content"> | ||
| 67 | - | ||
| 68 | - <view class="fs26" wx:if="{{isShowRow}}"> | ||
| 69 | - <view class="item bg-white flex ai-center pd20" wx:for="{{list.pageData}}"> | ||
| 70 | - <view class="flex pdl10" bindtap="goto" data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}"> | ||
| 71 | - <view class="img-container pdr20" data-txt="已售:{{item.sales_sum}}"><image class="img" src="{{imghost + (item.original_img ? item.original_img : default_img)}}" lazy-load mode="aspectFit"/></view> | ||
| 72 | - <view class="flex fdc jc_sb"> | ||
| 73 | - <view class="ellipsis-2 h68 mgb20">{{item.goods_name}}</view> | ||
| 74 | - | ||
| 75 | - <!-- 判断是否有活动价 --> | ||
| 76 | - <block wx:if="{{item.prom_price>0 || item.prom_integral>0}}"> | ||
| 77 | - <view class="flex xc-wc pdt20" > | ||
| 78 | - <text wx:if="{{item.prom_integral}}"><text class="fs30">{{item.prom_integral}}</text>积分</text> | ||
| 79 | - <text wx:if="{{item.prom_integral && item.prom_price}}">+</text> | ||
| 80 | - <!-- 活动价 --> | ||
| 81 | - <view class="flex xc-wc ai_and" wx:if="{{item.prom_price}}"> | ||
| 82 | - <!-- <view class="fs24">¥</view> --> | ||
| 83 | - <view class="fs30 money">{{item.prom_price}}</view> | ||
| 84 | - </view> | ||
| 85 | - </view> | ||
| 86 | - <view class="flex" style="line-height: 28rpx;"> | ||
| 87 | - <!-- 原价 --> | ||
| 88 | - <view class="price flex xc-ash line_th"> | ||
| 89 | - <!-- <view class="fs22">¥</view> --> | ||
| 90 | - <view class="fs22 money">{{item.market_price}}</view> | ||
| 91 | - </view> | ||
| 92 | - </view> | ||
| 93 | - </block> | ||
| 94 | - <block wx:else> | ||
| 95 | - <!-- 商品价格,先判断下是后⼜等级价--> | ||
| 96 | - <block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}"> | ||
| 97 | - <!-- 当会员是等级卡的时候 --> | ||
| 98 | - <block wx:if="{{card_field}}"> | ||
| 99 | - <!-- 等级价>0 --> | ||
| 100 | - <block wx:if="{{item[card_field]>0}}"> | ||
| 101 | - <view class="flex"> | ||
| 102 | - <!-- 办卡价 --> | ||
| 103 | - <view class="flex xc-wc ai_and"> | ||
| 104 | - <!-- <view class="fs24">¥</view> --> | ||
| 105 | - <view class="fs30 money">{{filter.toFix(item[card_field],2)}}</view> | ||
| 106 | - <view class="card_bg"> | ||
| 107 | - <image src="{{url + 'miniapp/images/plus/dj_icon.png'}}"></image> | ||
| 108 | - <text class="card_name ellipsis-1">{{card_name}}</text> | ||
| 109 | - </view> | ||
| 110 | - </view> | ||
| 111 | - </view> | ||
| 112 | - <view class="flex" style="line-height: 28rpx;"> | ||
| 113 | - <!-- 原价 --> | ||
| 114 | - <view class="price flex xc-ash line_th"> | ||
| 115 | - <!-- <view class="fs22">¥</view> --> | ||
| 116 | - <view class="fs22 money">{{item.market_price}}</view> | ||
| 117 | - </view> | ||
| 118 | - </view> | ||
| 119 | - </block> | ||
| 120 | - <blocK wx:else> | ||
| 121 | - <view class="flex"> | ||
| 122 | - <!-- 办卡价 --> | ||
| 123 | - <view class="flex xc-wc"> | ||
| 124 | - <!-- <view class="fs24">¥</view> --> | ||
| 125 | - <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 126 | - </view> | ||
| 127 | - </view> | ||
| 128 | - <view class="flex" style="line-height: 28rpx;"> | ||
| 129 | - <!-- 原价 --> | ||
| 130 | - <view class="price flex xc-ash line_th"> | ||
| 131 | - <!-- <view class="fs22">¥</view> --> | ||
| 132 | - <view class="fs22 money">{{item.market_price}}</view> | ||
| 133 | - </view> | ||
| 134 | - </view> | ||
| 135 | - </blocK> | ||
| 136 | - </block> | ||
| 137 | - <block wx:else> | ||
| 138 | - <!-- 如果商品有设置等级价⼤于0的 --> | ||
| 139 | - <block wx:if="{{g_filter.get_card_price(item,card_list,0)}}"> | ||
| 140 | - <view class="flex"> | ||
| 141 | - <!-- 办卡价 --> | ||
| 142 | - <view class="flex xc-wc"> | ||
| 143 | - <!-- <view class="fs24">¥</view> --> | ||
| 144 | - <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 145 | - </view> | ||
| 146 | - <!-- 原价 --> | ||
| 147 | - <view class="price flex xc-ash line_th"> | ||
| 148 | - <!-- <view class="fs22">¥</view> --> | ||
| 149 | - <view class="fs22 money">{{item.market_price}}</view> | ||
| 150 | - </view> | ||
| 151 | - </view> | ||
| 152 | - <view class="flexr" style=""> | ||
| 153 | - <!-- 等级价 --> | ||
| 154 | - <view class="price flex ai-center"> | ||
| 155 | - <!-- <view class="fs22">¥</view> --> | ||
| 156 | - <view class="fs28 money">{{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}}</view> | ||
| 157 | - <view class="card_bg"> | ||
| 158 | - <image src="{{url}}/miniapp/images/plus/dj_icon.png"></ image> | ||
| 159 | - <text class="card_name ellipsis-1">{{g_filter.get_card_price(item,card_list,1)}}</text> | ||
| 160 | - </view> | ||
| 161 | - </view> | ||
| 162 | - </view> | ||
| 163 | - </block> | ||
| 164 | - <block wx:else> | ||
| 165 | - <view class="flex"> | ||
| 166 | - <!-- 办卡价 --> | ||
| 167 | - <view class="flex xc-wc"> | ||
| 168 | - <!-- <view class="fs24">¥</view> --> | ||
| 169 | - <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 170 | - </view> | ||
| 171 | - </view> | ||
| 172 | - <view class="flex" style="line-height: 28rpx;"> | ||
| 173 | - <!-- 原价 --> | ||
| 174 | - <view class="price flex xc-ash line_th"> | ||
| 175 | - <!-- <view class="fs22">¥</view> --> | ||
| 176 | - <view class="fs22 money">{{item.market_price}}</view> | ||
| 177 | - </view> | ||
| 178 | - </view> | ||
| 179 | - </block> | ||
| 180 | - </block> | ||
| 181 | - </block> | ||
| 182 | - <!-- 商品压根就没有等级价 --> | ||
| 183 | - <block wx:else> | ||
| 184 | - <view class="flex"> | ||
| 185 | - <!-- 办卡价 --> | ||
| 186 | - <view class="flex xc-wc"> | ||
| 187 | - <!-- <view class="fs24">¥</view> --> | ||
| 188 | - <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 189 | - </view> | ||
| 190 | - </view> | ||
| 191 | - <view class="flex" style="line-height: 28rpx;"> | ||
| 192 | - <!-- 原价 --> | ||
| 193 | - <view class="price flex xc-ash line_th"> | ||
| 194 | - <!-- <view class="fs22">¥</view> --> | ||
| 195 | - <view class="fs22 money">{{item.market_price}}</view> | ||
| 196 | - </view> | ||
| 197 | - </view> | ||
| 198 | - </block> | ||
| 199 | - </block> | ||
| 200 | - <!-- 分层金额 --> | ||
| 201 | - <view hidden="{{ishidden_comise}}" class="fs24 c-a">分成金额:<text class="money c-red">{{filter.toFix(item.commission,2)}}</text></view> | ||
| 202 | - | ||
| 203 | - | ||
| 204 | - </view> | ||
| 205 | - </view> | ||
| 206 | - </view> | ||
| 207 | - </view> | ||
| 208 | - | ||
| 209 | - | ||
| 210 | - | ||
| 211 | - <view class="fs26 flex pd20 wrap" wx:else> | ||
| 212 | - <view class="item2 bg-white" wx:for="{{list.pageData}}" bindtap="goto" data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}"> | ||
| 213 | - <view class="img-container" data-txt="已售:{{item.sales_sum}}"><image class="img2" src="{{imghost + (item.original_img ? item.original_img : default_img)}}" lazy-load="true"/></view> | ||
| 214 | - <view class="pd20 fs26"> | ||
| 215 | - <view class="ellipsis-2 h68 mgb20">{{item.goods_name}}</view> | ||
| 216 | - <!-- 判断是否有活动价 --> | ||
| 217 | - <block wx:if="{{item.prom_price>0 || item.prom_integral>0}}"> | ||
| 218 | - <view class="flex xc-wc"> | ||
| 219 | - <text wx:if="{{item.prom_integral}}"><text class="fs30" style="font-weight: bold;">{{item.prom_integral}}</text>积分</text> | ||
| 220 | - <text wx:if="{{item.prom_integral && item.prom_price}}">+</text> | ||
| 221 | - <!-- 活动价 --> | ||
| 222 | - <view class="flex xc-wc" wx:if="{{item.prom_price}}"> | ||
| 223 | - <!-- <view class="fs24">¥</view> --> | ||
| 224 | - <view class="fs30 money">{{item.prom_price}}</view> | ||
| 225 | - </view> | ||
| 226 | - </view> | ||
| 227 | - <view class="flex" style="line-height: 28rpx;"> | ||
| 228 | - <!-- 原价 --> | ||
| 229 | - <view class="price flex xc-ash line_th"> | ||
| 230 | - <!-- <view class="fs22">¥</view> --> | ||
| 231 | - <view class="fs22 money">{{item.market_price}}</view> | ||
| 232 | - </view> | ||
| 233 | - </view> | ||
| 234 | - </block> | ||
| 235 | - <block wx:else> | ||
| 236 | - <!-- 商品价格,先判断下是后⼜等级价--> | ||
| 237 | - <block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}"> | ||
| 238 | - <!-- 当会员是等级卡的时候 --> | ||
| 239 | - <block wx:if="{{card_field}}"> | ||
| 240 | - <!-- 等级价>0 --> | ||
| 241 | - <block wx:if="{{item[card_field]>0}}"> | ||
| 242 | - <view class="flex"> | ||
| 243 | - <!-- 办卡价 --> | ||
| 244 | - <view class="flex xc-wc ai_and"> | ||
| 245 | - <!-- <view class="fs24">¥</view> --> | ||
| 246 | - <view class="fs30 money">{{filter.toFix(item[card_field],2)}}</view> | ||
| 247 | - <view class="card_bg"> | ||
| 248 | - <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image> | ||
| 249 | - <text class="card_name ellipsis-1">{{card_name}}</text> | ||
| 250 | - </view> | ||
| 251 | - </view> | ||
| 252 | - </view> | ||
| 253 | - <view class="flex" style="line-height: 28rpx;"> | ||
| 254 | - <!-- 原价 --> | ||
| 255 | - <view class="price flex xc-ash line_th"> | ||
| 256 | - <!-- <view class="fs22">¥</view> --> | ||
| 257 | - <view class="fs22 money">{{item.market_price}}</view> | ||
| 258 | - </view> | ||
| 259 | - </view> | ||
| 260 | - </block> | ||
| 261 | - <blocK wx:else> | ||
| 262 | - <view class="flex"> | ||
| 263 | - <!-- 办卡价 --> | ||
| 264 | - <view class="flex xc-wc ai_and"> | ||
| 265 | - <!-- <view class="fs24">¥</view> --> | ||
| 266 | - <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 267 | - </view> | ||
| 268 | - </view> | ||
| 269 | - <view class="flex" style="line-height: 28rpx;"> | ||
| 270 | - <!-- 原价 --> | ||
| 271 | - <view class="price flex xc-ash line_th"> | ||
| 272 | - <!-- <view class="fs22">¥</view> --> | ||
| 273 | - <view class="fs22 money">{{item.market_price}}</view> | ||
| 274 | - </view> | ||
| 275 | - </view> | ||
| 276 | - </blocK> | ||
| 277 | - </block> | ||
| 278 | - <block wx:else> | ||
| 279 | - <!-- 如果商品有设置等级价⼤于0的 --> | ||
| 280 | - <block wx:if="{{g_filter.get_card_price(item,card_list,0)}}"> | ||
| 281 | - <view class="flex"> | ||
| 282 | - <!-- 办卡价 --> | ||
| 283 | - <view class="flex xc-wc ai_and"> | ||
| 284 | - <!-- <view class="fs24">¥</view> --> | ||
| 285 | - <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 286 | - </view> | ||
| 287 | - <!-- 原价 --> | ||
| 288 | - <view class="price flex xc-ash line_th"> | ||
| 289 | - <!-- <view class="fs22">¥</view> --> | ||
| 290 | - <view class="fs22 money">{{item.market_price}}</view> | ||
| 291 | - </view> | ||
| 292 | - </view> | ||
| 293 | - <view class="flexr" style=""> | ||
| 294 | - <!-- 等级价 --> | ||
| 295 | - <view class="price flex ai-center"> | ||
| 296 | - <!-- <view class="fs22">¥</view> --> | ||
| 297 | - <view class="fs28 money">{{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}}</view> | ||
| 298 | - <view class="card_bg"> | ||
| 299 | - <image src="{{url}}/miniapp/images/plus/dj_icon.png"></ image> | ||
| 300 | - <text class="card_name ellipsis-1">{{g_filter.get_card_price(item,card_list,1)}}</text> | ||
| 301 | - </view> | ||
| 302 | - </view> | ||
| 303 | - </view> | ||
| 304 | - </block> | ||
| 305 | - <block wx:else> | ||
| 306 | - <view class="flex"> | ||
| 307 | - <!-- 办卡价 --> | ||
| 308 | - <view class="flex xc-wc ai_and"> | ||
| 309 | - <!-- <view class="fs24">¥</view> --> | ||
| 310 | - <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 311 | - </view> | ||
| 312 | - </view> | ||
| 313 | - <view class="flex" style="line-height: 28rpx;"> | ||
| 314 | - <!-- 原价 --> | ||
| 315 | - <view class="price flex xc-ash line_th"> | ||
| 316 | - <!-- <view class="fs22">¥</view> --> | ||
| 317 | - <view class="fs22 money">{{item.market_price}}</view> | ||
| 318 | - </view> | ||
| 319 | - </view> | ||
| 320 | - </block> | ||
| 321 | - </block> | ||
| 322 | - </block> | ||
| 323 | - <!-- 商品压根就没有等级价 --> | ||
| 324 | - <block wx:else> | ||
| 325 | - <view class="flex"> | ||
| 326 | - <!-- 办卡价 --> | ||
| 327 | - <view class="flex xc-wc ai_and"> | ||
| 328 | - <!-- <view class="fs24">¥</view> --> | ||
| 329 | - <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 330 | - </view> | ||
| 331 | - </view> | ||
| 332 | - <view class="flex" style="line-height: 28rpx;"> | ||
| 333 | - <!-- 原价 --> | ||
| 334 | - <view class="price flex xc-ash line_th"> | ||
| 335 | - <!-- <view class="fs22">¥</view> --> | ||
| 336 | - <view class="fs22 money">{{item.market_price}}</view> | ||
| 337 | - </view> | ||
| 338 | - </view> | ||
| 339 | - </block> | ||
| 340 | - </block> | ||
| 341 | - <!-- 分层金额 --> | ||
| 342 | - <view class="fs24 c-a">分成金额:<text class="money c-red">{{filter.toFix(item.commission,2)}}</text></view> | ||
| 343 | - </view> | ||
| 344 | - </view> | ||
| 345 | - </view> | ||
| 346 | - | ||
| 347 | - | ||
| 348 | - <nodata class="t-c" wx:if="{{list.pageData.length == 0 && list.pageData}}"></nodata> | ||
| 349 | - <view class="noMore" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">- 已经到底了 -</view> | ||
| 350 | - </view> | ||
| 351 | - | ||
| 352 | - | ||
| 353 | - | ||
| 354 | -</view> | ||
| 355 | - | ||
| 356 | - | ||
| 357 | - | ||
| 358 | - | ||
| 359 | - | 4 | + <view class="head pr"> |
| 5 | + <view class="bdb"> | ||
| 6 | + <!-- <view><image src="../../../images/jfbuy.jpg" mode="widthFix" class="banner"/></view> --> | ||
| 7 | + <view> | ||
| 8 | + <image src="{{imghost + (ad_img ? ad_img:'/miniapp/images/user_index_powder.jpg')}}" mode="widthFix" class="banner" /> | ||
| 9 | + </view> | ||
| 10 | + <view class="flex bg-white pdh20 jc_sb pr"> | ||
| 11 | + <!-- 分享人的头像 --> | ||
| 12 | + <view class="avatar-container" wx:if="{{userInfo2}}"> | ||
| 13 | + <image class="avatar" src="{{userInfo2.head_pic}}" /> | ||
| 14 | + <view class="pdt20"> | ||
| 15 | + <text class="nickname">{{userInfo2.nickname}}</text> | ||
| 16 | + </view> | ||
| 17 | + </view> | ||
| 18 | + <!-- 自己的头像 --> | ||
| 19 | + <view class="avatar-container" wx:else> | ||
| 20 | + <image class="avatar" src="{{userInfo.head_pic}}" /> | ||
| 21 | + <view class="pdt20"> | ||
| 22 | + <text class="nickname">{{userInfo.nickname}}</text> | ||
| 23 | + </view> | ||
| 24 | + </view> | ||
| 25 | + <view class="flex t-c fs24 f1 jc_fe"> | ||
| 26 | + <view class="pdv20 pdh40 {{isAll ? 'selected':''}}" bindtap="clickAll"> | ||
| 27 | + <view class="fs30">{{filter.show_default(total)}}</view> | ||
| 28 | + <view>全部商品</view> | ||
| 29 | + </view> | ||
| 30 | + <view class="pdv20 pdh40 {{!isAll ? 'selected':''}}" bindtap="clickNew"> | ||
| 31 | + <view class="fs30">{{filter.show_default(newListTotal)}}</view> | ||
| 32 | + <view>新品</view> | ||
| 33 | + </view> | ||
| 34 | + <view class="pdv20 pdh40" bindtap="goto" data-url="/pages/user/index/index"> | ||
| 35 | + <view class="fs26"> | ||
| 36 | + <text class="iconfont icon-ren1 bold"></text> | ||
| 37 | + </view> | ||
| 38 | + <view>会员中心</view> | ||
| 39 | + </view> | ||
| 40 | + </view> | ||
| 41 | + </view> | ||
| 42 | + </view> | ||
| 43 | + <!-- 搜索 --> | ||
| 44 | + <view class="flex ai-center fs26 bg-white pd20"> | ||
| 45 | + <text class="pd20 c-9b iconfont icon-fenxiang" catch:tap="goto" data-url="/packageC/pages/goods/distributionCategoryList/index"></text> | ||
| 46 | + <view class="input-container f1"> | ||
| 47 | + <input class="input" type="text" value="{{inputVal}}" placeholder="请输入商品关键字" confirm-type="search" bindfocus="inputFocus" bindblur="inputBlur" bindinput="input" bindconfirm="search" /> | ||
| 48 | + <text class="iconfont icon-guanbi" hidden="{{!isInputFocus}}" catchtap="inputClear"></text> | ||
| 49 | + <!-- 搜索输入框聚焦时显示关闭按钮,否则隐藏关闭按钮 --> | ||
| 50 | + </view> | ||
| 51 | + <view class="pd20 c-red" bindtap="search">搜索</view> | ||
| 52 | + </view> | ||
| 53 | + </view> | ||
| 54 | + <view class="flex t-c fs26 bg-white bdb sticky c-a" catchtap="clickTab"> | ||
| 55 | + <block wx:for="{{tabArr}}"> | ||
| 56 | + <view class="f1 pd20 {{currentTabIndex == index ? 'active':''}}" data-index="{{index}}" wx:if="{{index != 3}}"> | ||
| 57 | + {{item}} | ||
| 58 | + </view> | ||
| 59 | + <view class="f1 pd20 {{currentTabIndex == index ? 'active':''}}" data-index="{{index}}" wx:else bindtap="clickSort"> | ||
| 60 | + {{item}} | ||
| 61 | + <text class="iconfont icon-sort2 c-db" wx:if="{{!isSort}}"></text> | ||
| 62 | + <text class="t-icon t-icon-sort-up {{isDescending ? 'reverse':''}}" wx:else></text> | ||
| 63 | + </view> | ||
| 64 | + </block> | ||
| 65 | + <view class="f1 pd20" catchtap="change"> | ||
| 66 | + <text class="iconfont {{isShowRow ? 'icon-fenxiang':'icon-fenlie'}}"></text> | ||
| 67 | + </view> | ||
| 68 | + </view> | ||
| 69 | + <view class="content"> | ||
| 70 | + <view class="fs26" wx:if="{{isShowRow}}"> | ||
| 71 | + <view class="item bg-white flex ai-center pd20" wx:for="{{list}}"> | ||
| 72 | + <view class="flex pdl10" bindtap="goto" data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}"> | ||
| 73 | + <view class="img-container pdr20" data-txt="已售:{{item.sales_sum}}"> | ||
| 74 | + <image class="img" src="{{imghost + (item.original_img ? item.original_img : default_img)}}" lazy-load mode="aspectFit" /> | ||
| 75 | + </view> | ||
| 76 | + <view class="flex fdc jc_sb"> | ||
| 77 | + <view class="ellipsis-2 h68 mgb20">{{item.goods_name}}</view> | ||
| 78 | + <!-- 判断是否有活动价 --> | ||
| 79 | + <block wx:if="{{item.prom_price>0 || item.prom_integral>0}}"> | ||
| 80 | + <view class="flex xc-wc pdt20"> | ||
| 81 | + <text wx:if="{{item.prom_integral}}"> | ||
| 82 | + <text class="fs30">{{item.prom_integral}}</text> | ||
| 83 | + 积分 | ||
| 84 | + </text> | ||
| 85 | + <text wx:if="{{item.prom_integral && item.prom_price}}">+</text> | ||
| 86 | + <!-- 活动价 --> | ||
| 87 | + <view class="flex xc-wc ai_and" wx:if="{{item.prom_price}}"> | ||
| 88 | + <!-- <view class="fs24">¥</view> --> | ||
| 89 | + <view class="fs30 money">{{item.prom_price}}</view> | ||
| 90 | + </view> | ||
| 91 | + </view> | ||
| 92 | + <view class="flex" style="line-height: 28rpx;"> | ||
| 93 | + <!-- 原价 --> | ||
| 94 | + <view class="price flex xc-ash line_th"> | ||
| 95 | + <!-- <view class="fs22">¥</view> --> | ||
| 96 | + <view class="fs22 money">{{item.market_price}}</view> | ||
| 97 | + </view> | ||
| 98 | + </view> | ||
| 99 | + </block> | ||
| 100 | + <block wx:else> | ||
| 101 | + <!-- 商品价格,先判断下是后⼜等级价 --> | ||
| 102 | + <block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}"> | ||
| 103 | + <!-- 当会员是等级卡的时候 --> | ||
| 104 | + <block wx:if="{{card_field}}"> | ||
| 105 | + <!-- 等级价>0 --> | ||
| 106 | + <block wx:if="{{item[card_field]>0}}"> | ||
| 107 | + <view class="flex"> | ||
| 108 | + <!-- 办卡价 --> | ||
| 109 | + <view class="flex xc-wc ai_and"> | ||
| 110 | + <!-- <view class="fs24">¥</view> --> | ||
| 111 | + <view class="fs30 money">{{filter.toFix(item[card_field],2)}}</view> | ||
| 112 | + <view class="card_bg"> | ||
| 113 | + <image src="{{url + 'miniapp/images/plus/dj_icon.png'}}" /> | ||
| 114 | + <text class="card_name ellipsis-1">{{card_name}}</text> | ||
| 115 | + </view> | ||
| 116 | + </view> | ||
| 117 | + </view> | ||
| 118 | + <view class="flex" style="line-height: 28rpx;"> | ||
| 119 | + <!-- 原价 --> | ||
| 120 | + <view class="price flex xc-ash line_th"> | ||
| 121 | + <!-- <view class="fs22">¥</view> --> | ||
| 122 | + <view class="fs22 money">{{item.market_price}}</view> | ||
| 123 | + </view> | ||
| 124 | + </view> | ||
| 125 | + </block> | ||
| 126 | + <blocK wx:else> | ||
| 127 | + <view class="flex"> | ||
| 128 | + <!-- 办卡价 --> | ||
| 129 | + <view class="flex xc-wc"> | ||
| 130 | + <!-- <view class="fs24">¥</view> --> | ||
| 131 | + <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 132 | + </view> | ||
| 133 | + </view> | ||
| 134 | + <view class="flex" style="line-height: 28rpx;"> | ||
| 135 | + <!-- 原价 --> | ||
| 136 | + <view class="price flex xc-ash line_th"> | ||
| 137 | + <!-- <view class="fs22">¥</view> --> | ||
| 138 | + <view class="fs22 money">{{item.market_price}}</view> | ||
| 139 | + </view> | ||
| 140 | + </view> | ||
| 141 | + </blocK> | ||
| 142 | + </block> | ||
| 143 | + <block wx:else> | ||
| 144 | + <!-- 如果商品有设置等级价⼤于0的 --> | ||
| 145 | + <block wx:if="{{g_filter.get_card_price(item,card_list,0)}}"> | ||
| 146 | + <view class="flex"> | ||
| 147 | + <!-- 办卡价 --> | ||
| 148 | + <view class="flex xc-wc"> | ||
| 149 | + <!-- <view class="fs24">¥</view> --> | ||
| 150 | + <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 151 | + </view> | ||
| 152 | + <!-- 原价 --> | ||
| 153 | + <view class="price flex xc-ash line_th"> | ||
| 154 | + <!-- <view class="fs22">¥</view> --> | ||
| 155 | + <view class="fs22 money">{{item.market_price}}</view> | ||
| 156 | + </view> | ||
| 157 | + </view> | ||
| 158 | + <view class="flexr" style=""> | ||
| 159 | + <!-- 等级价 --> | ||
| 160 | + <view class="price flex ai-center"> | ||
| 161 | + <!-- <view class="fs22">¥</view> --> | ||
| 162 | + <view class="fs28 money">{{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}}</view> | ||
| 163 | + <view class="card_bg"> | ||
| 164 | + <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image> | ||
| 165 | + <text class="card_name ellipsis-1">{{g_filter.get_card_price(item,card_list,1)}} </text> | ||
| 166 | + </view> | ||
| 167 | + </view> | ||
| 168 | + </view> | ||
| 169 | + </block> | ||
| 170 | + <block wx:else> | ||
| 171 | + <view class="flex"> | ||
| 172 | + <!-- 办卡价 --> | ||
| 173 | + <view class="flex xc-wc"> | ||
| 174 | + <!-- <view class="fs24">¥</view> --> | ||
| 175 | + <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 176 | + </view> | ||
| 177 | + </view> | ||
| 178 | + <view class="flex" style="line-height: 28rpx;"> | ||
| 179 | + <!-- 原价 --> | ||
| 180 | + <view class="price flex xc-ash line_th"> | ||
| 181 | + <!-- <view class="fs22">¥</view> --> | ||
| 182 | + <view class="fs22 money">{{item.market_price}}</view> | ||
| 183 | + </view> | ||
| 184 | + </view> | ||
| 185 | + </block> | ||
| 186 | + </block> | ||
| 187 | + </block> | ||
| 188 | + <!-- 商品压根就没有等级价 --> | ||
| 189 | + <block wx:else> | ||
| 190 | + <view class="flex"> | ||
| 191 | + <!-- 办卡价 --> | ||
| 192 | + <view class="flex xc-wc"> | ||
| 193 | + <!-- <view class="fs24">¥</view> --> | ||
| 194 | + <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 195 | + </view> | ||
| 196 | + </view> | ||
| 197 | + <view class="flex" style="line-height: 28rpx;"> | ||
| 198 | + <!-- 原价 --> | ||
| 199 | + <view class="price flex xc-ash line_th"> | ||
| 200 | + <!-- <view class="fs22">¥</view> --> | ||
| 201 | + <view class="fs22 money">{{item.market_price}}</view> | ||
| 202 | + </view> | ||
| 203 | + </view> | ||
| 204 | + </block> | ||
| 205 | + </block> | ||
| 206 | + <!-- 分层金额 --> | ||
| 207 | + <view hidden="{{ishidden_comise}}" class="fs24 c-a"> | ||
| 208 | + 分成金额: | ||
| 209 | + <text class="money c-red">{{filter.toFix(item.commission,2)}}</text> | ||
| 210 | + </view> | ||
| 211 | + </view> | ||
| 212 | + </view> | ||
| 213 | + </view> | ||
| 214 | + </view> | ||
| 215 | + <view class="fs26 flex pd20 wrap" wx:else> | ||
| 216 | + <view class="item2 bg-white" wx:for="{{list}}" bindtap="goto" data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}"> | ||
| 217 | + <view class="img-container" data-txt="已售:{{item.sales_sum}}"> | ||
| 218 | + <image class="img2" src="{{imghost + (item.original_img ? item.original_img : default_img)}}" lazy-load="true" /> | ||
| 219 | + </view> | ||
| 220 | + <view class="pd20 fs26"> | ||
| 221 | + <view class="ellipsis-2 h68 mgb20">{{item.goods_name}}</view> | ||
| 222 | + <!-- 判断是否有活动价 --> | ||
| 223 | + <block wx:if="{{item.prom_price>0 || item.prom_integral>0}}"> | ||
| 224 | + <view class="flex xc-wc"> | ||
| 225 | + <text wx:if="{{item.prom_integral}}"> | ||
| 226 | + <text class="fs30" style="font-weight: bold;">{{item.prom_integral}}</text> | ||
| 227 | + 积分 | ||
| 228 | + </text> | ||
| 229 | + <text wx:if="{{item.prom_integral && item.prom_price}}">+</text> | ||
| 230 | + <!-- 活动价 --> | ||
| 231 | + <view class="flex xc-wc" wx:if="{{item.prom_price}}"> | ||
| 232 | + <!-- <view class="fs24">¥</view> --> | ||
| 233 | + <view class="fs30 money">{{item.prom_price}}</view> | ||
| 234 | + </view> | ||
| 235 | + </view> | ||
| 236 | + <view class="flex" style="line-height: 28rpx;"> | ||
| 237 | + <!-- 原价 --> | ||
| 238 | + <view class="price flex xc-ash line_th"> | ||
| 239 | + <!-- <view class="fs22">¥</view> --> | ||
| 240 | + <view class="fs22 money">{{item.market_price}}</view> | ||
| 241 | + </view> | ||
| 242 | + </view> | ||
| 243 | + </block> | ||
| 244 | + <block wx:else> | ||
| 245 | + <!-- 商品价格,先判断下是后⼜等级价 --> | ||
| 246 | + <block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}"> | ||
| 247 | + <!-- 当会员是等级卡的时候 --> | ||
| 248 | + <block wx:if="{{card_field}}"> | ||
| 249 | + <!-- 等级价>0 --> | ||
| 250 | + <block wx:if="{{item[card_field]>0}}"> | ||
| 251 | + <view class="flex"> | ||
| 252 | + <!-- 办卡价 --> | ||
| 253 | + <view class="flex xc-wc ai_and"> | ||
| 254 | + <!-- <view class="fs24">¥</view> --> | ||
| 255 | + <view class="fs30 money">{{filter.toFix(item[card_field],2)}}</view> | ||
| 256 | + <view class="card_bg"> | ||
| 257 | + <image src="{{url}}/miniapp/images/plus/dj_icon.png" /> | ||
| 258 | + <text class="card_name ellipsis-1">{{card_name}}</text> | ||
| 259 | + </view> | ||
| 260 | + </view> | ||
| 261 | + </view> | ||
| 262 | + <view class="flex" style="line-height: 28rpx;"> | ||
| 263 | + <!-- 原价 --> | ||
| 264 | + <view class="price flex xc-ash line_th"> | ||
| 265 | + <!-- <view class="fs22">¥</view> --> | ||
| 266 | + <view class="fs22 money">{{item.market_price}}</view> | ||
| 267 | + </view> | ||
| 268 | + </view> | ||
| 269 | + </block> | ||
| 270 | + <blocK wx:else> | ||
| 271 | + <view class="flex"> | ||
| 272 | + <!-- 办卡价 --> | ||
| 273 | + <view class="flex xc-wc ai_and"> | ||
| 274 | + <!-- <view class="fs24">¥</view> --> | ||
| 275 | + <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 276 | + </view> | ||
| 277 | + </view> | ||
| 278 | + <view class="flex" style="line-height: 28rpx;"> | ||
| 279 | + <!-- 原价 --> | ||
| 280 | + <view class="price flex xc-ash line_th"> | ||
| 281 | + <!-- <view class="fs22">¥</view> --> | ||
| 282 | + <view class="fs22 money">{{item.market_price}}</view> | ||
| 283 | + </view> | ||
| 284 | + </view> | ||
| 285 | + </blocK> | ||
| 286 | + </block> | ||
| 287 | + <block wx:else> | ||
| 288 | + <!-- 如果商品有设置等级价⼤于0的 --> | ||
| 289 | + <block wx:if="{{g_filter.get_card_price(item,card_list,0)}}"> | ||
| 290 | + <view class="flex"> | ||
| 291 | + <!-- 办卡价 --> | ||
| 292 | + <view class="flex xc-wc ai_and"> | ||
| 293 | + <!-- <view class="fs24">¥</view> --> | ||
| 294 | + <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 295 | + </view> | ||
| 296 | + <!-- 原价 --> | ||
| 297 | + <view class="price flex xc-ash line_th"> | ||
| 298 | + <!-- <view class="fs22">¥</view> --> | ||
| 299 | + <view class="fs22 money">{{item.market_price}}</view> | ||
| 300 | + </view> | ||
| 301 | + </view> | ||
| 302 | + <view class="flexr" style=""> | ||
| 303 | + <!-- 等级价 --> | ||
| 304 | + <view class="price flex ai-center"> | ||
| 305 | + <!-- <view class="fs22">¥</view> --> | ||
| 306 | + <view class="fs28 money"> | ||
| 307 | + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} | ||
| 308 | + </view> | ||
| 309 | + <view class="card_bg"> | ||
| 310 | + <image src="{{url}}/miniapp/images/plus/dj_icon.png" /> | ||
| 311 | + <text class="card_name ellipsis-1">{{g_filter.get_card_price(item,card_list,1)}}</text> | ||
| 312 | + </view> | ||
| 313 | + </view> | ||
| 314 | + </view> | ||
| 315 | + </block> | ||
| 316 | + <block wx:else> | ||
| 317 | + <view class="flex"> | ||
| 318 | + <!-- 办卡价 --> | ||
| 319 | + <view class="flex xc-wc ai_and"> | ||
| 320 | + <!-- <view class="fs24">¥</view> --> | ||
| 321 | + <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 322 | + </view> | ||
| 323 | + </view> | ||
| 324 | + <view class="flex" style="line-height: 28rpx;"> | ||
| 325 | + <!-- 原价 --> | ||
| 326 | + <view class="price flex xc-ash line_th"> | ||
| 327 | + <!-- <view class="fs22">¥</view> --> | ||
| 328 | + <view class="fs22 money">{{item.market_price}}</view> | ||
| 329 | + </view> | ||
| 330 | + </view> | ||
| 331 | + </block> | ||
| 332 | + </block> | ||
| 333 | + </block> | ||
| 334 | + <!-- 商品压根就没有等级价 --> | ||
| 335 | + <block wx:else> | ||
| 336 | + <view class="flex"> | ||
| 337 | + <!-- 办卡价 --> | ||
| 338 | + <view class="flex xc-wc ai_and"> | ||
| 339 | + <!-- <view class="fs24">¥</view> --> | ||
| 340 | + <view class="fs30 money">{{filter.toFix(item.shop_price,2)}}</view> | ||
| 341 | + </view> | ||
| 342 | + </view> | ||
| 343 | + <view class="flex" style="line-height: 28rpx;"> | ||
| 344 | + <!-- 原价 --> | ||
| 345 | + <view class="price flex xc-ash line_th"> | ||
| 346 | + <!-- <view class="fs22">¥</view> --> | ||
| 347 | + <view class="fs22 money">{{item.market_price}}</view> | ||
| 348 | + </view> | ||
| 349 | + </view> | ||
| 350 | + </block> | ||
| 351 | + </block> | ||
| 352 | + <!-- 分层金额 --> | ||
| 353 | + <view class="fs24 c-a"> | ||
| 354 | + 分成金额: | ||
| 355 | + <text class="money c-red">{{filter.toFix(item.commission,2)}}</text> | ||
| 356 | + </view> | ||
| 357 | + </view> | ||
| 358 | + </view> | ||
| 359 | + </view> | ||
| 360 | + <nodata class="t-c" wx:if="{{list.length == 0 && list}}"></nodata> | ||
| 361 | + <view class="noMore" hidden="{{!noMore}}" wx:if="{{list.length !== 0}}"> | ||
| 362 | + - 已经到底了 - | ||
| 363 | + </view> | ||
| 364 | + </view> | ||
| 365 | +</view> | ||
| 360 | \ No newline at end of file | 366 | \ No newline at end of file |
packageC/pages/goods/distributionCategoryList/index.js
| @@ -292,16 +292,31 @@ Page({ | @@ -292,16 +292,31 @@ Page({ | ||
| 292 | 292 | ||
| 293 | //跳转到品牌的商品列表 | 293 | //跳转到品牌的商品列表 |
| 294 | go_brand: function (t) { | 294 | go_brand: function (t) { |
| 295 | - var cid = t.currentTarget.dataset.bid; | ||
| 296 | - var lurl = "../../goods/goodsList/goodsList?brand_id=" + cid; | ||
| 297 | - wx.navigateTo({ url: lurl }); | 295 | + var bid = t.currentTarget.dataset.bid; |
| 296 | + // getApp().globalData.bid=bid; | ||
| 297 | + // console.log(getApp().globalData.bid); | ||
| 298 | + // let page=getCurrentPages(); | ||
| 299 | + // let prePage=page[page.length-2]; | ||
| 300 | + // console.log(prePage); | ||
| 301 | + // prePage.setData({ | ||
| 302 | + // brand_id:cid, | ||
| 303 | + // }) | ||
| 304 | + var lurl = "/packageA/pages/distribution/shop/shop?brand_id=" + bid; | ||
| 305 | + // var lurl = "/packageA/pages/distribution/shop/shop"; | ||
| 306 | + // wx.redirectTo({ url: lurl }); | ||
| 307 | + wx.navigateTo({ url: lurl }) | ||
| 308 | + // wx.navigateBack() | ||
| 298 | }, | 309 | }, |
| 299 | 310 | ||
| 300 | //跳转到国别的商品列表 | 311 | //跳转到国别的商品列表 |
| 301 | go_nation: function (t) { | 312 | go_nation: function (t) { |
| 302 | - var cid = t.currentTarget.dataset.nid; | ||
| 303 | - var lurl = "../../goods/goodsList/goodsList?nation_id=" + cid; | 313 | + var nid = t.currentTarget.dataset.nid; |
| 314 | + // getApp().globalData.nid=nid; | ||
| 315 | + var lurl = "/packageA/pages/distribution/shop/shop?nation_id=" + nid; | ||
| 316 | + // var lurl = "/packageA/pages/distribution/shop/shop"; | ||
| 304 | wx.navigateTo({ url: lurl }); | 317 | wx.navigateTo({ url: lurl }); |
| 318 | + | ||
| 319 | + // wx.navigateBack() | ||
| 305 | }, | 320 | }, |
| 306 | //获取国别 | 321 | //获取国别 |
| 307 | get_nation: function () { | 322 | get_nation: function () { |
packageC/pages/goods/distributionCategoryList/index.wxss
| @@ -27,7 +27,11 @@ swiper{ | @@ -27,7 +27,11 @@ swiper{ | ||
| 27 | min-height:200rpx; | 27 | min-height:200rpx; |
| 28 | height: auto; | 28 | height: auto; |
| 29 | } | 29 | } |
| 30 | - | 30 | +.navgation{ |
| 31 | + height: 300rpx; | ||
| 32 | + width: 100%; | ||
| 33 | + background-color: blue; | ||
| 34 | +} | ||
| 31 | /*--搜索--*/ | 35 | /*--搜索--*/ |
| 32 | .search-box { | 36 | .search-box { |
| 33 | width: 100% !important; | 37 | width: 100% !important; |
packageC/pages/goods/goodsList/goodsList.js
| @@ -72,9 +72,7 @@ Page({ | @@ -72,9 +72,7 @@ Page({ | ||
| 72 | if (getApp().globalData.userInfo) { | 72 | if (getApp().globalData.userInfo) { |
| 73 | url += "&user_id=" + getApp().globalData.userInfo.user_id; | 73 | url += "&user_id=" + getApp().globalData.userInfo.user_id; |
| 74 | } | 74 | } |
| 75 | - this.setData({ | ||
| 76 | - baseUrl:url, | ||
| 77 | - }) | 75 | + this.requestGoodsList(url); |
| 78 | //优惠活动的凑单 | 76 | //优惠活动的凑单 |
| 79 | if (t.prom_type == 3) { | 77 | if (t.prom_type == 3) { |
| 80 | if (0 != t.prom_id && t.prom_id != undefined) { url += "&prom_id=" + t.prom_id; } | 78 | if (0 != t.prom_id && t.prom_id != undefined) { url += "&prom_id=" + t.prom_id; } |
| @@ -89,8 +87,6 @@ Page({ | @@ -89,8 +87,6 @@ Page({ | ||
| 89 | } | 87 | } |
| 90 | }) | 88 | }) |
| 91 | } | 89 | } |
| 92 | - this.getInitData() | ||
| 93 | - | ||
| 94 | getApp().getConfig2(function (rs) { | 90 | getApp().getConfig2(function (rs) { |
| 95 | //计算等级价相关 | 91 | //计算等级价相关 |
| 96 | var swithc_list = rs.switch_list; | 92 | var swithc_list = rs.switch_list; |
| @@ -121,12 +117,7 @@ Page({ | @@ -121,12 +117,7 @@ Page({ | ||
| 121 | }) | 117 | }) |
| 122 | }, 500) | 118 | }, 500) |
| 123 | } | 119 | } |
| 124 | - }); | ||
| 125 | - | ||
| 126 | - }, | ||
| 127 | - async getInitData(){ | ||
| 128 | - await this.getShopGoods(); | ||
| 129 | - await this.requestGoodsList(this.data.baseUrl); | 120 | + }); |
| 130 | }, | 121 | }, |
| 131 | //设置优惠券的 | 122 | //设置优惠券的 |
| 132 | set_prom_list: async function (arr) { | 123 | set_prom_list: async function (arr) { |
| @@ -135,7 +126,6 @@ Page({ | @@ -135,7 +126,6 @@ Page({ | ||
| 135 | //优惠的实际内容 | 126 | //优惠的实际内容 |
| 136 | var content = JSON.parse(arr[i].preferential_type); | 127 | var content = JSON.parse(arr[i].preferential_type); |
| 137 | arr[i].content = content; | 128 | arr[i].content = content; |
| 138 | - | ||
| 139 | //--送礼包-- | 129 | //--送礼包-- |
| 140 | if (content.is_libao) { | 130 | if (content.is_libao) { |
| 141 | //-- 获取 -- | 131 | //-- 获取 -- |
| @@ -172,34 +162,6 @@ Page({ | @@ -172,34 +162,6 @@ Page({ | ||
| 172 | this.resetData(), this.requestGoodsList(url); | 162 | this.resetData(), this.requestGoodsList(url); |
| 173 | }, | 163 | }, |
| 174 | 164 | ||
| 175 | - //分销小店的商品 | ||
| 176 | - async getShopGoods() { | ||
| 177 | - let data= { | ||
| 178 | - store_id: oo.stoid, | ||
| 179 | - user_id: getApp().globalData.user_id, | ||
| 180 | - page:this.data.page, | ||
| 181 | - pageSize:2000, | ||
| 182 | - }; | ||
| 183 | - // this.setData({ | ||
| 184 | - // is_go:0 | ||
| 185 | - // }) | ||
| 186 | - // a.init(this, "", "shopGoodsData"); | ||
| 187 | - // let url=`/api/weshop/users/distribut/pagemyshop?orderType=desc&store_id=${oo.stoid}&user_id=${getApp().globalData.user_id}`; | ||
| 188 | - let url=`/api/weshop/users/distribut/pagemyshop?orderType=desc`; | ||
| 189 | - const distriGoods = await getApp().request.promiseGet(url, { | ||
| 190 | - data: data, | ||
| 191 | - isShowLoading: false, | ||
| 192 | - }); | ||
| 193 | - console.log(distriGoods,1); | ||
| 194 | - if (distriGoods.data.code == 0 && distriGoods.data.data.pageData.length > 0) { | ||
| 195 | - this.setData({ | ||
| 196 | - shopGoodsData: distriGoods.data.data.pageData, | ||
| 197 | - }) | ||
| 198 | - } | ||
| 199 | - // this.requestGoodsList(url) | ||
| 200 | - }, | ||
| 201 | - | ||
| 202 | - | ||
| 203 | requestGoodsList: async function (t) { | 165 | requestGoodsList: async function (t) { |
| 204 | 166 | ||
| 205 | if(this.data.is_no_more){ | 167 | if(this.data.is_no_more){ |
| @@ -216,57 +178,18 @@ Page({ | @@ -216,57 +178,18 @@ Page({ | ||
| 216 | } | 178 | } |
| 217 | 179 | ||
| 218 | t += "&page=" + e.data.currentPage; | 180 | t += "&page=" + e.data.currentPage; |
| 219 | - t += "&pageSize=" + 2000; | 181 | + t += "&pageSize=" + 20; |
| 220 | t +="&store_id=" +oo.stoid; | 182 | t +="&store_id=" +oo.stoid; |
| 221 | const { data: res } = await getApp().request.promiseGet(t, { | 183 | const { data: res } = await getApp().request.promiseGet(t, { |
| 222 | isShowLoading: true, | 184 | isShowLoading: true, |
| 223 | }) | 185 | }) |
| 224 | console.log(res); | 186 | console.log(res); |
| 225 | - | ||
| 226 | if (res.code == 0 && res.data.pageData.length > 0) { | 187 | if (res.code == 0 && res.data.pageData.length > 0) { |
| 227 | - let arr = []; | ||
| 228 | - arr = res.data.pageData.filter(obj => this.data.shopGoodsData.some(item => item.goods_id == obj.goods_id)); | ||
| 229 | - console.log(arr); | ||
| 230 | this.setData({ | 188 | this.setData({ |
| 231 | - requestData: arr, | ||
| 232 | - is_no_more:1, | 189 | + requestData: res.data.pageData, |
| 190 | + | ||
| 233 | }); | 191 | }); |
| 234 | - // if (res.data.page > 1) { | ||
| 235 | - // this.setData({ | ||
| 236 | - // requestData: this.data.requestData.concat(arr), | ||
| 237 | - // // select_classify_on: index, | ||
| 238 | - // }); | ||
| 239 | - // } else { | ||
| 240 | - // this.setData({ | ||
| 241 | - // requestData: arr, | ||
| 242 | - // // select_classify_on: index, | ||
| 243 | - // }); | ||
| 244 | - // }; | ||
| 245 | } | 192 | } |
| 246 | - // a.request(t, | ||
| 247 | - // function (t) { | ||
| 248 | - // let arr=[]; | ||
| 249 | - // e.setData({ is_go: 1 }); | ||
| 250 | - // null == e.data.allData && (e.data.allData = Object.assign({}, t.data.result)), | ||
| 251 | - // wx.stopPullDownRefresh(); | ||
| 252 | - | ||
| 253 | - // arr = e.data.requestData.filter(obj => e.data.shopGoodsData.some(item => item.goods_id == obj.goods_id)); | ||
| 254 | - // // e.data.requestData.map(item => { | ||
| 255 | - // // e.data.shopGoodsData.forEach(i => { | ||
| 256 | - // // if (i.nation_id = item.nation_id) { | ||
| 257 | - // // return item | ||
| 258 | - // // } | ||
| 259 | - // // }); | ||
| 260 | - // // arr.push(item); | ||
| 261 | - // // }); | ||
| 262 | - // console.log(arr); | ||
| 263 | - // // e.setData({ | ||
| 264 | - // // requestData: arr, | ||
| 265 | - // // }); | ||
| 266 | - // }, | ||
| 267 | - // null, { is_mainshow: 1, isonsale: 1, store_id: oo.stoid } | ||
| 268 | - // ); | ||
| 269 | - | ||
| 270 | }, | 193 | }, |
| 271 | getInput(e) { | 194 | getInput(e) { |
| 272 | this.setData({ | 195 | this.setData({ |
| @@ -280,10 +203,6 @@ Page({ | @@ -280,10 +203,6 @@ Page({ | ||
| 280 | t.showWarning("请输入搜索关键词"); | 203 | t.showWarning("请输入搜索关键词"); |
| 281 | return false | 204 | return false |
| 282 | } | 205 | } |
| 283 | - // this.search(val); | ||
| 284 | - // wx.navigateTo({ | ||
| 285 | - // url: `/packageA/pages/distribution/shop/shop?key_word=${val}`, | ||
| 286 | - // }); | ||
| 287 | wx.navigateBack({ | 206 | wx.navigateBack({ |
| 288 | delta: 2 | 207 | delta: 2 |
| 289 | }); | 208 | }); |
pages/distribution/distribution.js
pages/index/index/index.js
| 1 | -var e = function(e) { | ||
| 2 | - return e && e.__esModule ? e : { | ||
| 3 | - default: e | ||
| 4 | - }; | ||
| 5 | - }(require("../../../utils/LoadMore.js")), | 1 | +var e = function (e) { |
| 2 | + return e && e.__esModule ? e : { | ||
| 3 | + default: e | ||
| 4 | + }; | ||
| 5 | +}(require("../../../utils/LoadMore.js")), | ||
| 6 | t = getApp(), | 6 | t = getApp(), |
| 7 | a = t.request, | 7 | a = t.request, |
| 8 | o = t.globalData.setting, | 8 | o = t.globalData.setting, |
| @@ -72,123 +72,123 @@ Page({ | @@ -72,123 +72,123 @@ Page({ | ||
| 72 | is_disgraceful: 0, //是否显示新人广告 | 72 | is_disgraceful: 0, //是否显示新人广告 |
| 73 | new_image: "", //新人有礼弹窗图片 | 73 | new_image: "", //新人有礼弹窗图片 |
| 74 | new_nav: "", //新人页面跳转地址 | 74 | new_nav: "", //新人页面跳转地址 |
| 75 | - w_holiday_pop:0, | ||
| 76 | - | ||
| 77 | - showHongbao: false, | ||
| 78 | - showHongbaoSmall: false, | ||
| 79 | - | ||
| 80 | - is_full_screen_show:0, //全屏显示 | ||
| 81 | - sec_show:3, //倒计时的秒数 | ||
| 82 | - full_ad:null, //全屏广告 | ||
| 83 | - full_screen:0, //全屏广告 | ||
| 84 | - | 75 | + w_holiday_pop: 0, |
| 76 | + | ||
| 77 | + showHongbao: false, | ||
| 78 | + showHongbaoSmall: false, | ||
| 79 | + | ||
| 80 | + is_full_screen_show: 0, //全屏显示 | ||
| 81 | + sec_show: 3, //倒计时的秒数 | ||
| 82 | + full_ad: null, //全屏广告 | ||
| 83 | + full_screen: 0, //全屏广告 | ||
| 84 | + | ||
| 85 | }, | 85 | }, |
| 86 | 86 | ||
| 87 | - onLoad: async function(tt) { | ||
| 88 | - console.log("进入首页-------------"); | ||
| 89 | - console.log(tt); | ||
| 90 | - var th = this; | ||
| 91 | - var first_leader=tt.first_leader; | ||
| 92 | - if(!first_leader && tt.scene){ | ||
| 93 | - var first_leader_str= decodeURIComponent(tt.scene); | ||
| 94 | - var f_arr=first_leader_str.split("_"); | ||
| 95 | - first_leader=f_arr[0] && parseFloat(f_arr[0])>0?f_arr[0]:null; | ||
| 96 | - //注册门店 | ||
| 97 | - if(f_arr[1] && parseFloat(f_arr[1])>0){ | ||
| 98 | - getApp().globalData.store_number=f_arr[1]; | 87 | + onLoad: async function (tt) { |
| 88 | + console.log("进入首页-------------"); | ||
| 89 | + console.log(tt); | ||
| 90 | + var th = this; | ||
| 91 | + var first_leader = tt.first_leader; | ||
| 92 | + if (!first_leader && tt.scene) { | ||
| 93 | + var first_leader_str = decodeURIComponent(tt.scene); | ||
| 94 | + var f_arr = first_leader_str.split("_"); | ||
| 95 | + first_leader = f_arr[0] && parseFloat(f_arr[0]) > 0 ? f_arr[0] : null; | ||
| 96 | + //注册门店 | ||
| 97 | + if (f_arr[1] && parseFloat(f_arr[1]) > 0) { | ||
| 98 | + getApp().globalData.store_number = f_arr[1]; | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + getApp().getConfig(function (e) { | ||
| 103 | + //--首页的问题-- | ||
| 104 | + if (getApp().globalData.config && getApp().globalData.config.store_name != undefined && getApp().globalData.config.store_name != null) { | ||
| 105 | + wx.setNavigationBarTitle({ | ||
| 106 | + title: getApp().globalData.config.store_name, | ||
| 107 | + }); | ||
| 108 | + } else { | ||
| 109 | + wx.setNavigationBarTitle({ | ||
| 110 | + title: getApp().globalData.setting.appName, | ||
| 111 | + }); | ||
| 112 | + }; | ||
| 113 | + }); | ||
| 114 | + | ||
| 115 | + | ||
| 116 | + var th = this; | ||
| 117 | + getApp().getConfig2(function (config2) { | ||
| 118 | + if (config2 && config2.is_overdue == 1) { | ||
| 119 | + getApp().promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=5", {}).then(res => { | ||
| 120 | + var o = res; | ||
| 121 | + if (o.data.code == 0) { | ||
| 122 | + var ob = { isout: 0, isbuy: 1 }; | ||
| 123 | + var arr = o.data.data.pageData; | ||
| 124 | + var isbuy = 0; | ||
| 125 | + //----如果数组不为空---- | ||
| 126 | + if (arr.length > 0) { | ||
| 127 | + arr.forEach(function (val, ind) { | ||
| 128 | + if (val.is_sy == 0 && val.type == 5) { | ||
| 129 | + isbuy = 1; | ||
| 130 | + var now = ut.gettimestamp(); | ||
| 131 | + if (now > val.end_time) ob.isout = 1; | ||
| 132 | + return false; | ||
| 133 | + } | ||
| 134 | + }) | ||
| 135 | + } | ||
| 136 | + ob.isbuy = isbuy; | ||
| 137 | + | ||
| 138 | + var pages = getCurrentPages(); //获取加载的页面 | ||
| 139 | + var currentPage = pages[pages.length - 1]; //获取当前页面的对象 | ||
| 140 | + | ||
| 141 | + console.log("当前路由"); | ||
| 142 | + console.log(currentPage.route); | ||
| 143 | + | ||
| 144 | + | ||
| 145 | + th.setappdata(ob); | ||
| 146 | + | ||
| 147 | + if (ob.isbuy && !ob.isout) { | ||
| 148 | + th.onload_init(); | ||
| 149 | + } | ||
| 150 | + } else { | ||
| 151 | + th.onload_init(); | ||
| 152 | + } | ||
| 153 | + }) | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + else { | ||
| 157 | + th.onload_init(); | ||
| 158 | + } | ||
| 159 | + }) | ||
| 160 | + | ||
| 161 | + if (first_leader) { | ||
| 162 | + //-- user_id代过来免登录 -- | ||
| 163 | + getApp().globalData.first_leader = first_leader; | ||
| 164 | + //调用接口判断是不是会员 | ||
| 165 | + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { | ||
| 166 | + if (res.data.code == 0) { | ||
| 167 | + getApp().globalData.guide_id = res.data.data.id; | ||
| 99 | } | 168 | } |
| 100 | - } | ||
| 101 | - | ||
| 102 | - getApp().getConfig(function(e){ | ||
| 103 | - //--首页的问题-- | ||
| 104 | - if (getApp().globalData.config && getApp().globalData.config.store_name != undefined && getApp().globalData.config.store_name != null) { | ||
| 105 | - wx.setNavigationBarTitle({ | ||
| 106 | - title: getApp().globalData.config.store_name, | ||
| 107 | - }); | ||
| 108 | - } else { | ||
| 109 | - wx.setNavigationBarTitle({ | ||
| 110 | - title: getApp().globalData.setting.appName, | ||
| 111 | - }); | ||
| 112 | - }; | ||
| 113 | - }); | ||
| 114 | - | ||
| 115 | - | ||
| 116 | - var th = this; | ||
| 117 | - getApp().getConfig2(function(config2){ | ||
| 118 | - if(config2 && config2.is_overdue==1){ | ||
| 119 | - getApp().promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=5",{}).then(res=>{ | ||
| 120 | - var o=res; | ||
| 121 | - if (o.data.code == 0) { | ||
| 122 | - var ob = { isout: 0, isbuy: 1 }; | ||
| 123 | - var arr = o.data.data.pageData; | ||
| 124 | - var isbuy = 0; | ||
| 125 | - //----如果数组不为空---- | ||
| 126 | - if (arr.length > 0) { | ||
| 127 | - arr.forEach(function (val, ind) { | ||
| 128 | - if (val.is_sy == 0 && val.type == 5) { | ||
| 129 | - isbuy = 1; | ||
| 130 | - var now = ut.gettimestamp(); | ||
| 131 | - if (now > val.end_time) ob.isout = 1; | ||
| 132 | - return false; | ||
| 133 | - } | ||
| 134 | - }) | ||
| 135 | - } | ||
| 136 | - ob.isbuy = isbuy; | ||
| 137 | - | ||
| 138 | - var pages = getCurrentPages(); //获取加载的页面 | ||
| 139 | - var currentPage = pages[pages.length - 1]; //获取当前页面的对象 | ||
| 140 | - | ||
| 141 | - console.log("当前路由"); | ||
| 142 | - console.log(currentPage.route); | ||
| 143 | - | ||
| 144 | - | ||
| 145 | - th.setappdata(ob); | ||
| 146 | - | ||
| 147 | - if(ob.isbuy && !ob.isout){ | ||
| 148 | - th.onload_init(); | ||
| 149 | - } | ||
| 150 | - }else{ | ||
| 151 | - th.onload_init(); | ||
| 152 | - } | ||
| 153 | - }) | ||
| 154 | - } | ||
| 155 | - | ||
| 156 | - else{ | ||
| 157 | - th.onload_init(); | ||
| 158 | - } | ||
| 159 | - }) | ||
| 160 | - | ||
| 161 | - if(first_leader){ | ||
| 162 | - //-- user_id代过来免登录 -- | ||
| 163 | - getApp().globalData.first_leader=first_leader; | ||
| 164 | - //调用接口判断是不是会员 | ||
| 165 | - getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{ | ||
| 166 | - if(res.data.code==0){ | ||
| 167 | - getApp().globalData.guide_id=res.data.data.id; | ||
| 168 | - } | ||
| 169 | - }) | ||
| 170 | - } | ||
| 171 | - | ||
| 172 | - // 判断是否有红包活动 | ||
| 173 | - getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/'+getApp().globalData.setting.stoid, { | ||
| 174 | - data: {} | ||
| 175 | - }).then(function(data) { | ||
| 176 | - // console.log('909090909090----->', data.data.code); | ||
| 177 | - let code = data.data.code; | ||
| 178 | - if(code == 0) { | ||
| 179 | - | ||
| 180 | - th.setData({ | ||
| 181 | - showHongbao: true, | ||
| 182 | - }); | ||
| 183 | - } else if(code == -1) { | ||
| 184 | - th.setData({ | ||
| 185 | - showHongbao: false, | ||
| 186 | - }); | ||
| 187 | - }; | ||
| 188 | - }); | ||
| 189 | - | ||
| 190 | - | ||
| 191 | - // console.log(9090909); | 169 | + }) |
| 170 | + } | ||
| 171 | + | ||
| 172 | + // 判断是否有红包活动 | ||
| 173 | + getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/' + getApp().globalData.setting.stoid, { | ||
| 174 | + data: {} | ||
| 175 | + }).then(function (data) { | ||
| 176 | + // console.log('909090909090----->', data.data.code); | ||
| 177 | + let code = data.data.code; | ||
| 178 | + if (code == 0) { | ||
| 179 | + | ||
| 180 | + th.setData({ | ||
| 181 | + showHongbao: true, | ||
| 182 | + }); | ||
| 183 | + } else if (code == -1) { | ||
| 184 | + th.setData({ | ||
| 185 | + showHongbao: false, | ||
| 186 | + }); | ||
| 187 | + }; | ||
| 188 | + }); | ||
| 189 | + | ||
| 190 | + | ||
| 191 | + // console.log(9090909); | ||
| 192 | //看一下商家是否开通了权益 | 192 | //看一下商家是否开通了权益 |
| 193 | //--初始化是否有打勾-- | 193 | //--初始化是否有打勾-- |
| 194 | getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", { | 194 | getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", { |
| @@ -201,12 +201,12 @@ Page({ | @@ -201,12 +201,12 @@ Page({ | ||
| 201 | th.setData({ | 201 | th.setData({ |
| 202 | is_boot: is_init | 202 | is_boot: is_init |
| 203 | }); | 203 | }); |
| 204 | - | ||
| 205 | - if(!is_init){ | ||
| 206 | - th.setData({ | ||
| 207 | - swiperimage: [] | ||
| 208 | - }); | ||
| 209 | - } | 204 | + |
| 205 | + if (!is_init) { | ||
| 206 | + th.setData({ | ||
| 207 | + swiperimage: [] | ||
| 208 | + }); | ||
| 209 | + } | ||
| 210 | } | 210 | } |
| 211 | }) | 211 | }) |
| 212 | 212 | ||
| @@ -215,75 +215,75 @@ Page({ | @@ -215,75 +215,75 @@ Page({ | ||
| 215 | //t.editTabBar(th,o.stoid,th.data.url); | 215 | //t.editTabBar(th,o.stoid,th.data.url); |
| 216 | 216 | ||
| 217 | }, | 217 | }, |
| 218 | - | ||
| 219 | - async onload_init(){ | ||
| 220 | - var th=this; | ||
| 221 | - await this.init_load(); | ||
| 222 | - //显示的时候要开启计时器 | ||
| 223 | - this.data.is_timer = 1; | ||
| 224 | - //如果是自定义模板 | ||
| 225 | - if (this.data.isTemplate) { | ||
| 226 | - //---先获取会员--- | ||
| 227 | - t.getUserFir(function() { | ||
| 228 | - th.is_festival(); | ||
| 229 | - var new_nav = th.data.new_nav; | ||
| 230 | - if (new_nav == "") { | ||
| 231 | - th.is_new(); | ||
| 232 | - } | ||
| 233 | - setTimeout(function () { | ||
| 234 | - if (getApp().globalData.user_id) getApp().requestCardNum(th); | ||
| 235 | - },500) | ||
| 236 | - | ||
| 237 | - }); | ||
| 238 | - } else { | ||
| 239 | - await this.init_fir(); | ||
| 240 | - wx.setNavigationBarColor({ | ||
| 241 | - frontColor: '#ffffff', // 必写项 | ||
| 242 | - backgroundColor: '#ff7295', // 必写项 | ||
| 243 | - }) | ||
| 244 | - } | ||
| 245 | - | ||
| 246 | - //--正再拼团中的处理-- | ||
| 247 | - var url = "/api/weshop/order/pageTuan?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1" | ||
| 248 | - await getApp().request.promiseGet(url, {}).then(res => { | ||
| 249 | - if (res.data.code == 0 && res.data.data && res.data.data.pageData) { | ||
| 250 | - th.data.pt_timer_arr = res.data.data.pageData; | ||
| 251 | - } | ||
| 252 | - }) | ||
| 253 | - if (th.data.pt_timer_arr && th.data.pt_timer_arr.length > 0) { | ||
| 254 | - for (var i in th.data.pt_timer_arr) { | ||
| 255 | - var p_item = th.data.pt_timer_arr[i]; | ||
| 256 | - await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, { | ||
| 257 | - 1: 1 | ||
| 258 | - }).then(res => { | ||
| 259 | - th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic; | ||
| 260 | - th.data.pt_timer_arr[i].nickname = res.data.data.nickname; | ||
| 261 | - }) | ||
| 262 | - } | ||
| 263 | - th.Interval_pt(); | ||
| 264 | - } | ||
| 265 | - | ||
| 266 | - //---处理正在6个分类---- | ||
| 267 | - await getApp().request.promiseGet("/api/weshop/goodscategory/page", { | ||
| 268 | - data: { | ||
| 269 | - store_id: os.stoid, | ||
| 270 | - pageSize: 5, | ||
| 271 | - is_show: 1, | ||
| 272 | - level:1 | ||
| 273 | - } | ||
| 274 | - }).then(res => { | ||
| 275 | - if (res.data.data) { | ||
| 276 | - var gd_category = res.data.data.pageData; | ||
| 277 | - th.setData({ | ||
| 278 | - gd_category: gd_category | ||
| 279 | - }); | ||
| 280 | - } | ||
| 281 | - }) | 218 | + |
| 219 | + async onload_init() { | ||
| 220 | + var th = this; | ||
| 221 | + await this.init_load(); | ||
| 222 | + //显示的时候要开启计时器 | ||
| 223 | + this.data.is_timer = 1; | ||
| 224 | + //如果是自定义模板 | ||
| 225 | + if (this.data.isTemplate) { | ||
| 226 | + //---先获取会员--- | ||
| 227 | + t.getUserFir(function () { | ||
| 228 | + th.is_festival(); | ||
| 229 | + var new_nav = th.data.new_nav; | ||
| 230 | + if (new_nav == "") { | ||
| 231 | + th.is_new(); | ||
| 232 | + } | ||
| 233 | + setTimeout(function () { | ||
| 234 | + if (getApp().globalData.user_id) getApp().requestCardNum(th); | ||
| 235 | + }, 500) | ||
| 236 | + | ||
| 237 | + }); | ||
| 238 | + } else { | ||
| 239 | + await this.init_fir(); | ||
| 240 | + wx.setNavigationBarColor({ | ||
| 241 | + frontColor: '#ffffff', // 必写项 | ||
| 242 | + backgroundColor: '#ff7295', // 必写项 | ||
| 243 | + }) | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + //--正再拼团中的处理-- | ||
| 247 | + var url = "/api/weshop/order/pageTuan?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1" | ||
| 248 | + await getApp().request.promiseGet(url, {}).then(res => { | ||
| 249 | + if (res.data.code == 0 && res.data.data && res.data.data.pageData) { | ||
| 250 | + th.data.pt_timer_arr = res.data.data.pageData; | ||
| 251 | + } | ||
| 252 | + }) | ||
| 253 | + if (th.data.pt_timer_arr && th.data.pt_timer_arr.length > 0) { | ||
| 254 | + for (var i in th.data.pt_timer_arr) { | ||
| 255 | + var p_item = th.data.pt_timer_arr[i]; | ||
| 256 | + await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, { | ||
| 257 | + 1: 1 | ||
| 258 | + }).then(res => { | ||
| 259 | + th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic; | ||
| 260 | + th.data.pt_timer_arr[i].nickname = res.data.data.nickname; | ||
| 261 | + }) | ||
| 262 | + } | ||
| 263 | + th.Interval_pt(); | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + //---处理正在6个分类---- | ||
| 267 | + await getApp().request.promiseGet("/api/weshop/goodscategory/page", { | ||
| 268 | + data: { | ||
| 269 | + store_id: os.stoid, | ||
| 270 | + pageSize: 5, | ||
| 271 | + is_show: 1, | ||
| 272 | + level: 1 | ||
| 273 | + } | ||
| 274 | + }).then(res => { | ||
| 275 | + if (res.data.data) { | ||
| 276 | + var gd_category = res.data.data.pageData; | ||
| 277 | + th.setData({ | ||
| 278 | + gd_category: gd_category | ||
| 279 | + }); | ||
| 280 | + } | ||
| 281 | + }) | ||
| 282 | }, | 282 | }, |
| 283 | - | ||
| 284 | - | 283 | + |
| 284 | + | ||
| 285 | //关闭新用户领取广告 | 285 | //关闭新用户领取广告 |
| 286 | - close_disgraceful: function() { | 286 | + close_disgraceful: function () { |
| 287 | var th = this; | 287 | var th = this; |
| 288 | th.setData({ | 288 | th.setData({ |
| 289 | is_disgraceful: 0 | 289 | is_disgraceful: 0 |
| @@ -291,10 +291,10 @@ Page({ | @@ -291,10 +291,10 @@ Page({ | ||
| 291 | }, | 291 | }, |
| 292 | 292 | ||
| 293 | async onShow() { | 293 | async onShow() { |
| 294 | - var th=this; | ||
| 295 | - //-- 登录回来判断弹框 -- | ||
| 296 | - var userInfo=getApp().globalData.userInfo; | ||
| 297 | - if(userInfo){ | 294 | + var th = this; |
| 295 | + //-- 登录回来判断弹框 -- | ||
| 296 | + var userInfo = getApp().globalData.userInfo; | ||
| 297 | + if (userInfo) { | ||
| 298 | th.is_festival(); | 298 | th.is_festival(); |
| 299 | var new_nav = th.data.new_nav; | 299 | var new_nav = th.data.new_nav; |
| 300 | if (new_nav == "") { | 300 | if (new_nav == "") { |
| @@ -303,64 +303,64 @@ Page({ | @@ -303,64 +303,64 @@ Page({ | ||
| 303 | } | 303 | } |
| 304 | 304 | ||
| 305 | //优惠券要实时更新 | 305 | //优惠券要实时更新 |
| 306 | - getApp().getConfig2(function(e) { | 306 | + getApp().getConfig2(function (e) { |
| 307 | var json_d = JSON.parse(e.switch_list); | 307 | var json_d = JSON.parse(e.switch_list); |
| 308 | - th.setData({is_closecoupon: json_d.is_closecoupon}) | ||
| 309 | - th.setData({is_topstore: json_d.is_show_storeselect}) | ||
| 310 | - },1) | ||
| 311 | - | ||
| 312 | - if (typeof this.getTabBar === 'function' && this.getTabBar()) { | ||
| 313 | - var index=getApp().getPageIndex(this); | ||
| 314 | - this.getTabBar().setData({ | ||
| 315 | - active: index //数字是当前页面在tabbar的索引 | ||
| 316 | - }) | ||
| 317 | - | ||
| 318 | - getApp().requestCardNum(this); | ||
| 319 | - } | ||
| 320 | - | ||
| 321 | - var th = this; | ||
| 322 | - | ||
| 323 | - var show=getApp().globalData.isLoad_ad; | ||
| 324 | - setTimeout(function(){ | ||
| 325 | - //user没有及时更新 | ||
| 326 | - var userInfo=getApp().globalData.userInfo; | ||
| 327 | - if(!userInfo || !userInfo.user_id) userInfo=null; | ||
| 328 | - //有加载过一次首页,就显示 | ||
| 329 | - if(show || userInfo || getApp().globalData.user_id){ | ||
| 330 | - setTimeout(function(){ | ||
| 331 | - full_screen.get_the_full_screen(th); | ||
| 332 | - },800) | ||
| 333 | - //动画效果 | ||
| 334 | - if(!th.data.f_hidden){ | ||
| 335 | - wx.showLoading({ | ||
| 336 | - title:'加载中..' | ||
| 337 | - }); | ||
| 338 | - setTimeout(function(){ | ||
| 339 | - th.setData({f_hidden:1}) | ||
| 340 | - wx.hideLoading(); | ||
| 341 | - },960) | ||
| 342 | - } | ||
| 343 | - }else{ | ||
| 344 | - getApp().globalData.isLoad_ad=1; | ||
| 345 | - } | ||
| 346 | - },500) | ||
| 347 | - | ||
| 348 | - | ||
| 349 | - | 308 | + th.setData({ is_closecoupon: json_d.is_closecoupon }) |
| 309 | + th.setData({ is_topstore: json_d.is_show_storeselect }) | ||
| 310 | + }, 1) | ||
| 311 | + | ||
| 312 | + if (typeof this.getTabBar === 'function' && this.getTabBar()) { | ||
| 313 | + var index = getApp().getPageIndex(this); | ||
| 314 | + this.getTabBar().setData({ | ||
| 315 | + active: index //数字是当前页面在tabbar的索引 | ||
| 316 | + }) | ||
| 317 | + | ||
| 318 | + getApp().requestCardNum(this); | ||
| 319 | + } | ||
| 320 | + | ||
| 321 | + var th = this; | ||
| 322 | + | ||
| 323 | + var show = getApp().globalData.isLoad_ad; | ||
| 324 | + setTimeout(function () { | ||
| 325 | + //user没有及时更新 | ||
| 326 | + var userInfo = getApp().globalData.userInfo; | ||
| 327 | + if (!userInfo || !userInfo.user_id) userInfo = null; | ||
| 328 | + //有加载过一次首页,就显示 | ||
| 329 | + if (show || userInfo || getApp().globalData.user_id) { | ||
| 330 | + setTimeout(function () { | ||
| 331 | + full_screen.get_the_full_screen(th); | ||
| 332 | + }, 800) | ||
| 333 | + //动画效果 | ||
| 334 | + if (!th.data.f_hidden) { | ||
| 335 | + wx.showLoading({ | ||
| 336 | + title: '加载中..' | ||
| 337 | + }); | ||
| 338 | + setTimeout(function () { | ||
| 339 | + th.setData({ f_hidden: 1 }) | ||
| 340 | + wx.hideLoading(); | ||
| 341 | + }, 960) | ||
| 342 | + } | ||
| 343 | + } else { | ||
| 344 | + getApp().globalData.isLoad_ad = 1; | ||
| 345 | + } | ||
| 346 | + }, 500) | ||
| 347 | + | ||
| 348 | + | ||
| 349 | + | ||
| 350 | }, | 350 | }, |
| 351 | //当隐藏的时候就关闭计时器 | 351 | //当隐藏的时候就关闭计时器 |
| 352 | - onHide: function() { | 352 | + onHide: function () { |
| 353 | this.data.is_timer = 0; | 353 | this.data.is_timer = 0; |
| 354 | - if(this.data.pt_timer) clearInterval(this.data.pt_timer); | ||
| 355 | - if(this.data.w_holiday_pop) clearInterval(this.data.w_holiday_pop); | ||
| 356 | - if(this.data.full_screen) clearInterval(this.data.full_screen); | ||
| 357 | - this.data.w_holiday_pop=0; | 354 | + if (this.data.pt_timer) clearInterval(this.data.pt_timer); |
| 355 | + if (this.data.w_holiday_pop) clearInterval(this.data.w_holiday_pop); | ||
| 356 | + if (this.data.full_screen) clearInterval(this.data.full_screen); | ||
| 357 | + this.data.w_holiday_pop = 0; | ||
| 358 | 358 | ||
| 359 | }, | 359 | }, |
| 360 | 360 | ||
| 361 | //同步初始加载 | 361 | //同步初始加载 |
| 362 | async init_load() { | 362 | async init_load() { |
| 363 | - var th=this; | 363 | + var th = this; |
| 364 | //因为营销版本的功能包含了自定义模板的功能,是同时的 | 364 | //因为营销版本的功能包含了自定义模板的功能,是同时的 |
| 365 | //读取全局是否有弄自定义模板 | 365 | //读取全局是否有弄自定义模板 |
| 366 | await api.get_template_fir(o.stoid).then(res => { | 366 | await api.get_template_fir(o.stoid).then(res => { |
| @@ -368,6 +368,7 @@ Page({ | @@ -368,6 +368,7 @@ Page({ | ||
| 368 | if (data && data.length > 0) { | 368 | if (data && data.length > 0) { |
| 369 | var temp_data = data[0]; | 369 | var temp_data = data[0]; |
| 370 | var t_arr = JSON.parse(temp_data.json_str); | 370 | var t_arr = JSON.parse(temp_data.json_str); |
| 371 | + console.log(t_arr); | ||
| 371 | th.setData({ | 372 | th.setData({ |
| 372 | template_arr: t_arr, | 373 | template_arr: t_arr, |
| 373 | isTemplate: 1, | 374 | isTemplate: 1, |
| @@ -375,11 +376,11 @@ Page({ | @@ -375,11 +376,11 @@ Page({ | ||
| 375 | }); | 376 | }); |
| 376 | 377 | ||
| 377 | //---如果有设定顶部的颜色的时候-- | 378 | //---如果有设定顶部的颜色的时候-- |
| 378 | - if(temp_data.top_color && temp_data.top_color!='null' ){ | 379 | + if (temp_data.top_color && temp_data.top_color != 'null') { |
| 379 | 380 | ||
| 380 | - var top_w_color="#ffffff"; | ||
| 381 | - if(temp_data.top_word_color && temp_data.top_word_color=='black'){ | ||
| 382 | - top_w_color="#000000"; | 381 | + var top_w_color = "#ffffff"; |
| 382 | + if (temp_data.top_word_color && temp_data.top_word_color == 'black') { | ||
| 383 | + top_w_color = "#000000"; | ||
| 383 | } | 384 | } |
| 384 | wx.setNavigationBarColor({ | 385 | wx.setNavigationBarColor({ |
| 385 | frontColor: top_w_color, // 必写项 | 386 | frontColor: top_w_color, // 必写项 |
| @@ -390,15 +391,11 @@ Page({ | @@ -390,15 +391,11 @@ Page({ | ||
| 390 | } | 391 | } |
| 391 | }) | 392 | }) |
| 392 | 393 | ||
| 393 | - | ||
| 394 | 394 | ||
| 395 | - | ||
| 396 | - | ||
| 397 | - | ||
| 398 | - | ||
| 399 | }, | 395 | }, |
| 400 | //---读取数据内容--- | 396 | //---读取数据内容--- |
| 401 | async init_fir() { | 397 | async init_fir() { |
| 398 | + console.log('init_fir'); | ||
| 402 | var th = this; | 399 | var th = this; |
| 403 | //----广告---- | 400 | //----广告---- |
| 404 | var e = this; | 401 | var e = this; |
| @@ -407,24 +404,24 @@ Page({ | @@ -407,24 +404,24 @@ Page({ | ||
| 407 | enabled: 1 | 404 | enabled: 1 |
| 408 | } | 405 | } |
| 409 | }).then(res => { | 406 | }).then(res => { |
| 410 | - | ||
| 411 | - if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){ | ||
| 412 | - var a = res.data.data.pageData; | ||
| 413 | - var arr = new Array(); | ||
| 414 | - for (var i = 0; i < a.length; i++) { | ||
| 415 | - var tt = { | ||
| 416 | - 'ad_code': o.imghost + a[i].ad_code, | ||
| 417 | - 'media_link': '', | ||
| 418 | - 'ad_weapplink':a[i].ad_weapplink | ||
| 419 | - }; | ||
| 420 | - arr.push(tt); | ||
| 421 | - } | ||
| 422 | - if (arr.length > 0) e.setData({ | ||
| 423 | - banner: arr, | ||
| 424 | - }); | ||
| 425 | - | ||
| 426 | - wx.stopPullDownRefresh(); | ||
| 427 | - } | 407 | + |
| 408 | + if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) { | ||
| 409 | + var a = res.data.data.pageData; | ||
| 410 | + var arr = new Array(); | ||
| 411 | + for (var i = 0; i < a.length; i++) { | ||
| 412 | + var tt = { | ||
| 413 | + 'ad_code': o.imghost + a[i].ad_code, | ||
| 414 | + 'media_link': '', | ||
| 415 | + 'ad_weapplink': a[i].ad_weapplink | ||
| 416 | + }; | ||
| 417 | + arr.push(tt); | ||
| 418 | + } | ||
| 419 | + if (arr.length > 0) e.setData({ | ||
| 420 | + banner: arr, | ||
| 421 | + }); | ||
| 422 | + | ||
| 423 | + wx.stopPullDownRefresh(); | ||
| 424 | + } | ||
| 428 | }) | 425 | }) |
| 429 | 426 | ||
| 430 | //-----秒杀----- | 427 | //-----秒杀----- |
| @@ -447,7 +444,7 @@ Page({ | @@ -447,7 +444,7 @@ Page({ | ||
| 447 | //当前时间戳 | 444 | //当前时间戳 |
| 448 | var nt = ut.gettimestamp(); | 445 | var nt = ut.gettimestamp(); |
| 449 | 446 | ||
| 450 | - flash_data.forEach(function(val, ind) { | 447 | + flash_data.forEach(function (val, ind) { |
| 451 | if (val.start_time > nt) flash_data[ind].status = 0; | 448 | if (val.start_time > nt) flash_data[ind].status = 0; |
| 452 | else if (val.end_time > nt) flash_data[ind].status = 1; | 449 | else if (val.end_time > nt) flash_data[ind].status = 1; |
| 453 | if (val.buy_num >= val.goods_num) flash_data[ind].status = 2; | 450 | if (val.buy_num >= val.goods_num) flash_data[ind].status = 2; |
| @@ -464,6 +461,34 @@ Page({ | @@ -464,6 +461,34 @@ Page({ | ||
| 464 | //th.countDown(); | 461 | //th.countDown(); |
| 465 | } | 462 | } |
| 466 | }); | 463 | }); |
| 464 | + //-----预售---- | ||
| 465 | + //调用接口获取数据 | ||
| 466 | + await getApp().request.get("/api/weshop/marketing/marketingPresellList/page", { | ||
| 467 | + data: { | ||
| 468 | + is_end: 0, | ||
| 469 | + store_id: os.stoid, | ||
| 470 | + pageSize: 10, | ||
| 471 | + timetype: 1 | ||
| 472 | + }, | ||
| 473 | + success: function (res) { | ||
| 474 | + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) { | ||
| 475 | + var list = th.data.goodlist ? th.data.goodlist : []; | ||
| 476 | + var arr = res.data.data.pageData; | ||
| 477 | + //数组合起来 | ||
| 478 | + for (var i in arr) { | ||
| 479 | + list.push(arr[i]); | ||
| 480 | + } | ||
| 481 | + th.setData({ goodlist: list }); | ||
| 482 | + if (arr.length < 10) { | ||
| 483 | + th.setData({ no_more: 1 }) | ||
| 484 | + } | ||
| 485 | + } else { | ||
| 486 | + th.setData({ no_more: 1 }) | ||
| 487 | + } | ||
| 488 | + th.setData({ is_get: 1 }) | ||
| 489 | + | ||
| 490 | + } | ||
| 491 | + }); | ||
| 467 | 492 | ||
| 468 | //----拼单----- | 493 | //----拼单----- |
| 469 | await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", { | 494 | await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", { |
| @@ -482,7 +507,7 @@ Page({ | @@ -482,7 +507,7 @@ Page({ | ||
| 482 | 507 | ||
| 483 | //获取当前 | 508 | //获取当前 |
| 484 | var nt = ut.gettimestamp(); | 509 | var nt = ut.gettimestamp(); |
| 485 | - pd_data.forEach(function(val, ind) { | 510 | + pd_data.forEach(function (val, ind) { |
| 486 | if (val.start_time > nt) pd_data[ind].status = 0; | 511 | if (val.start_time > nt) pd_data[ind].status = 0; |
| 487 | else if (val.end_time > nt) pd_data[ind].status = 1; | 512 | else if (val.end_time > nt) pd_data[ind].status = 1; |
| 488 | if (val.buy_num >= val.goods_num) pd_data[ind].status = 2; | 513 | if (val.buy_num >= val.goods_num) pd_data[ind].status = 2; |
| @@ -559,6 +584,7 @@ Page({ | @@ -559,6 +584,7 @@ Page({ | ||
| 559 | for (var i = 0; i < new_data.length; i += 3) { | 584 | for (var i = 0; i < new_data.length; i += 3) { |
| 560 | arr.push(new_data.slice(i, i + 3)); | 585 | arr.push(new_data.slice(i, i + 3)); |
| 561 | } | 586 | } |
| 587 | + console.log(arr); | ||
| 562 | th.setData({ | 588 | th.setData({ |
| 563 | hotGoods: arr, | 589 | hotGoods: arr, |
| 564 | }); | 590 | }); |
| @@ -569,33 +595,33 @@ Page({ | @@ -569,33 +595,33 @@ Page({ | ||
| 569 | this.setData({ | 595 | this.setData({ |
| 570 | ishow: 1 | 596 | ishow: 1 |
| 571 | }); | 597 | }); |
| 572 | - | 598 | + |
| 573 | //---先获取会员--- | 599 | //---先获取会员--- |
| 574 | - t.getUserFir(function() { | ||
| 575 | - th.is_festival(); | ||
| 576 | - var new_nav = th.data.new_nav; | ||
| 577 | - if (new_nav == "") { | ||
| 578 | - th.is_new(); | ||
| 579 | - } | ||
| 580 | - | ||
| 581 | - setTimeout(function () { | ||
| 582 | - if (getApp().globalData.user_id) getApp().requestCardNum(th); | ||
| 583 | - },500) | ||
| 584 | - | 600 | + t.getUserFir(function () { |
| 601 | + th.is_festival(); | ||
| 602 | + var new_nav = th.data.new_nav; | ||
| 603 | + if (new_nav == "") { | ||
| 604 | + th.is_new(); | ||
| 605 | + } | ||
| 606 | + | ||
| 607 | + setTimeout(function () { | ||
| 608 | + if (getApp().globalData.user_id) getApp().requestCardNum(th); | ||
| 609 | + }, 500) | ||
| 610 | + | ||
| 585 | }); | 611 | }); |
| 586 | - | ||
| 587 | - setTimeout(function() { | ||
| 588 | - var goods_list = th.selectComponent("#goods_list"); //组件的id | ||
| 589 | - goods_list.init(); | ||
| 590 | - goods_list.get_list(); | 612 | + |
| 613 | + setTimeout(function () { | ||
| 614 | + var goods_list = th.selectComponent("#goods_list"); //组件的id | ||
| 615 | + goods_list.init(); | ||
| 616 | + goods_list.get_list(); | ||
| 591 | }, 2000) | 617 | }, 2000) |
| 592 | }, | 618 | }, |
| 593 | 619 | ||
| 594 | //--判断小程序是否过期-- | 620 | //--判断小程序是否过期-- |
| 595 | - setappdata: function(t) { | 621 | + setappdata: function (t) { |
| 596 | if (t.isout == 1) | 622 | if (t.isout == 1) |
| 597 | wx.reLaunch({ | 623 | wx.reLaunch({ |
| 598 | - url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:"+getApp().globalData.config.store_tel, | 624 | + url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:" + getApp().globalData.config.store_tel, |
| 599 | }); | 625 | }); |
| 600 | if (t.isbuy == 0) | 626 | if (t.isbuy == 0) |
| 601 | wx.reLaunch({ | 627 | wx.reLaunch({ |
| @@ -603,40 +629,39 @@ Page({ | @@ -603,40 +629,39 @@ Page({ | ||
| 603 | }); | 629 | }); |
| 604 | }, | 630 | }, |
| 605 | //---加载更多是靠这个函数---- | 631 | //---加载更多是靠这个函数---- |
| 606 | - onReachBottom: function() { | 632 | + onReachBottom: function () { |
| 607 | var goods_list = this.selectComponent("#goods_list"); //组件的id | 633 | var goods_list = this.selectComponent("#goods_list"); //组件的id |
| 608 | if (goods_list) goods_list.get_list(); | 634 | if (goods_list) goods_list.get_list(); |
| 609 | 635 | ||
| 610 | - if(getApp().globalData.func_list) | ||
| 611 | - { | ||
| 612 | - for(let i in getApp().globalData.func_list){ | ||
| 613 | - let item=getApp().globalData.func_list[i]; | ||
| 614 | - item.re_show(); | ||
| 615 | - } | ||
| 616 | - } | 636 | + if (getApp().globalData.func_list) { |
| 637 | + for (let i in getApp().globalData.func_list) { | ||
| 638 | + let item = getApp().globalData.func_list[i]; | ||
| 639 | + item.re_show(); | ||
| 640 | + } | ||
| 641 | + } | ||
| 617 | }, | 642 | }, |
| 618 | 643 | ||
| 619 | - onPullDownRefresh: function(e) { | 644 | + onPullDownRefresh: function (e) { |
| 620 | this.data.recommend = null, this.data.currentPage = 1, n.resetConfig(), this.requestHomePage(), | 645 | this.data.recommend = null, this.data.currentPage = 1, n.resetConfig(), this.requestHomePage(), |
| 621 | this.requestRecommend(); | 646 | this.requestRecommend(); |
| 622 | }, | 647 | }, |
| 623 | - requestRecommend(){}, | ||
| 624 | - requestHomePage(){}, | 648 | + requestRecommend() { }, |
| 649 | + requestHomePage() { }, | ||
| 625 | 650 | ||
| 626 | - onUnload: function() { | 651 | + onUnload: function () { |
| 627 | this.destroyActivityTimer(); | 652 | this.destroyActivityTimer(); |
| 628 | }, | 653 | }, |
| 629 | - setCountTime: function(e) { | 654 | + setCountTime: function (e) { |
| 630 | e.diffTime || (e.diffTime = new Date().getTime() - 1e3 * e.server_time), this.setData({ | 655 | e.diffTime || (e.diffTime = new Date().getTime() - 1e3 * e.server_time), this.setData({ |
| 631 | "sale.diffTime": e.diffTime | 656 | "sale.diffTime": e.diffTime |
| 632 | }), this.setData({ | 657 | }), this.setData({ |
| 633 | "sale.good": e.flash_sale_goods[0] | 658 | "sale.good": e.flash_sale_goods[0] |
| 634 | }), this.destroyActivityTimer(), this.createActivityTimer(); | 659 | }), this.destroyActivityTimer(), this.createActivityTimer(); |
| 635 | }, | 660 | }, |
| 636 | - createActivityTimer: function() { | 661 | + createActivityTimer: function () { |
| 637 | var e = this.data.sale, | 662 | var e = this.data.sale, |
| 638 | t = this; | 663 | t = this; |
| 639 | - this.data.timer = setInterval(function() { | 664 | + this.data.timer = setInterval(function () { |
| 640 | var a = 1e3 * e.good.end_time - new Date().getTime() + e.diffTime, | 665 | var a = 1e3 * e.good.end_time - new Date().getTime() + e.diffTime, |
| 641 | o = i.transTime(a); | 666 | o = i.transTime(a); |
| 642 | a <= 0 ? t.requestHomePage() : t.setData({ | 667 | a <= 0 ? t.requestHomePage() : t.setData({ |
| @@ -644,11 +669,11 @@ Page({ | @@ -644,11 +669,11 @@ Page({ | ||
| 644 | }); | 669 | }); |
| 645 | }, 1e3); | 670 | }, 1e3); |
| 646 | }, | 671 | }, |
| 647 | - destroyActivityTimer: function() { | 672 | + destroyActivityTimer: function () { |
| 648 | this.data.timer && (clearInterval(this.data.timer), this.data.timer = null); | 673 | this.data.timer && (clearInterval(this.data.timer), this.data.timer = null); |
| 649 | }, | 674 | }, |
| 650 | - onPageScroll: function(e) { | ||
| 651 | - this.data.scrollTop=e.scrollTop; | 675 | + onPageScroll: function (e) { |
| 676 | + this.data.scrollTop = e.scrollTop; | ||
| 652 | var t = getCurrentPages(); | 677 | var t = getCurrentPages(); |
| 653 | "pages/index/index/index" == t[t.length - 1].route; | 678 | "pages/index/index/index" == t[t.length - 1].route; |
| 654 | /*--(e.scrollTop > 10 ? wx.setNavigationBarColor({ | 679 | /*--(e.scrollTop > 10 ? wx.setNavigationBarColor({ |
| @@ -659,37 +684,37 @@ Page({ | @@ -659,37 +684,37 @@ Page({ | ||
| 659 | backgroundColor: "#eeeeee" | 684 | backgroundColor: "#eeeeee" |
| 660 | }));--*/ | 685 | }));--*/ |
| 661 | }, | 686 | }, |
| 662 | - jumpSearch: function() { | 687 | + jumpSearch: function () { |
| 663 | wx.navigateTo({ | 688 | wx.navigateTo({ |
| 664 | url: "/pages/goods/search/search" | 689 | url: "/pages/goods/search/search" |
| 665 | }); | 690 | }); |
| 666 | }, | 691 | }, |
| 667 | - onShareAppMessage: function(e) { | ||
| 668 | - var url="/pages/index/index/index"; | ||
| 669 | - var userInfo=getApp().globalData.userInfo; | ||
| 670 | - //是分销商才带 | ||
| 671 | - if(userInfo){ | ||
| 672 | - url+="?first_leader="+userInfo.user_id; | ||
| 673 | - } | ||
| 674 | - console.log("---首页---分享--"); | ||
| 675 | - var title="商城首页" | 692 | + onShareAppMessage: function (e) { |
| 693 | + var url = "/pages/index/index/index"; | ||
| 694 | + var userInfo = getApp().globalData.userInfo; | ||
| 695 | + //是分销商才带 | ||
| 696 | + if (userInfo) { | ||
| 697 | + url += "?first_leader=" + userInfo.user_id; | ||
| 698 | + } | ||
| 699 | + console.log("---首页---分享--"); | ||
| 700 | + var title = "商城首页" | ||
| 676 | //分享 | 701 | //分享 |
| 677 | - if(getApp().globalData.config && getApp().globalData.config.store_name){ | ||
| 678 | - title=getApp().globalData.config.store_name; | ||
| 679 | - }else if(getApp().globalData.setting.appName){ | ||
| 680 | - title=getApp().globalData.setting.appName; | ||
| 681 | - } | ||
| 682 | - | ||
| 683 | - var ob={ | ||
| 684 | - title: title, | ||
| 685 | - path:url, | ||
| 686 | - }; | ||
| 687 | - console.log(ob); | 702 | + if (getApp().globalData.config && getApp().globalData.config.store_name) { |
| 703 | + title = getApp().globalData.config.store_name; | ||
| 704 | + } else if (getApp().globalData.setting.appName) { | ||
| 705 | + title = getApp().globalData.setting.appName; | ||
| 706 | + } | ||
| 707 | + | ||
| 708 | + var ob = { | ||
| 709 | + title: title, | ||
| 710 | + path: url, | ||
| 711 | + }; | ||
| 712 | + console.log(ob); | ||
| 688 | return ob; | 713 | return ob; |
| 689 | }, | 714 | }, |
| 690 | 715 | ||
| 691 | //图片失败,默认图片 | 716 | //图片失败,默认图片 |
| 692 | - bind_bnerr: function(e) { | 717 | + bind_bnerr: function (e) { |
| 693 | var _errImg = e.target.dataset.errorimg; | 718 | var _errImg = e.target.dataset.errorimg; |
| 694 | var _errObj = {}; | 719 | var _errObj = {}; |
| 695 | _errObj[_errImg] = this.data.url + "/miniapp/images/del/logo.jpg"; | 720 | _errObj[_errImg] = this.data.url + "/miniapp/images/del/logo.jpg"; |
| @@ -697,7 +722,7 @@ Page({ | @@ -697,7 +722,7 @@ Page({ | ||
| 697 | }, | 722 | }, |
| 698 | 723 | ||
| 699 | //图片失败,默认图片 | 724 | //图片失败,默认图片 |
| 700 | - bind_bnerr2: function(e) { | 725 | + bind_bnerr2: function (e) { |
| 701 | var _errImg = e.target.dataset.errorimg; | 726 | var _errImg = e.target.dataset.errorimg; |
| 702 | var _errurl = e.target.dataset.url; | 727 | var _errurl = e.target.dataset.url; |
| 703 | var _errObj = {}; | 728 | var _errObj = {}; |
| @@ -706,7 +731,7 @@ Page({ | @@ -706,7 +731,7 @@ Page({ | ||
| 706 | 731 | ||
| 707 | }, | 732 | }, |
| 708 | //图片失败,默认图片 | 733 | //图片失败,默认图片 |
| 709 | - bind_bnerr3: function(e) { | 734 | + bind_bnerr3: function (e) { |
| 710 | var _errImg = e.target.dataset.errorimg; | 735 | var _errImg = e.target.dataset.errorimg; |
| 711 | var _Img = e.target.dataset.img; | 736 | var _Img = e.target.dataset.img; |
| 712 | if (_Img != undefined) { | 737 | if (_Img != undefined) { |
| @@ -821,19 +846,19 @@ Page({ | @@ -821,19 +846,19 @@ Page({ | ||
| 821 | setTimeout(th.countDown2, 1000); | 846 | setTimeout(th.countDown2, 1000); |
| 822 | }, | 847 | }, |
| 823 | 848 | ||
| 824 | - bannerSwiperChange: function(e) { | 849 | + bannerSwiperChange: function (e) { |
| 825 | var index = e.detail.current; | 850 | var index = e.detail.current; |
| 826 | this.setData({ | 851 | this.setData({ |
| 827 | banner_index: index | 852 | banner_index: index |
| 828 | }); | 853 | }); |
| 829 | }, | 854 | }, |
| 830 | - flashSwiperChange: function(e) { | 855 | + flashSwiperChange: function (e) { |
| 831 | var index = e.detail.current; | 856 | var index = e.detail.current; |
| 832 | this.setData({ | 857 | this.setData({ |
| 833 | flash_index: index | 858 | flash_index: index |
| 834 | }); | 859 | }); |
| 835 | }, | 860 | }, |
| 836 | - ptSwiperChange: function(e) { | 861 | + ptSwiperChange: function (e) { |
| 837 | var index = e.detail.current; | 862 | var index = e.detail.current; |
| 838 | this.setData({ | 863 | this.setData({ |
| 839 | pt_index: index | 864 | pt_index: index |
| @@ -842,13 +867,13 @@ Page({ | @@ -842,13 +867,13 @@ Page({ | ||
| 842 | 867 | ||
| 843 | Interval_pt() { | 868 | Interval_pt() { |
| 844 | var th = this; | 869 | var th = this; |
| 845 | - this.data.pt_timer = setInterval(function() { | 870 | + this.data.pt_timer = setInterval(function () { |
| 846 | var item = ut.get_rand_item(th.data.pt_timer_arr); | 871 | var item = ut.get_rand_item(th.data.pt_timer_arr); |
| 847 | th.setData({ | 872 | th.setData({ |
| 848 | pt_timer_active: 1, | 873 | pt_timer_active: 1, |
| 849 | pt_timer_item: item | 874 | pt_timer_item: item |
| 850 | }); | 875 | }); |
| 851 | - setTimeout(function() { | 876 | + setTimeout(function () { |
| 852 | th.setData({ | 877 | th.setData({ |
| 853 | pt_timer_active: 0 | 878 | pt_timer_active: 0 |
| 854 | }); | 879 | }); |
| @@ -858,7 +883,7 @@ Page({ | @@ -858,7 +883,7 @@ Page({ | ||
| 858 | 883 | ||
| 859 | 884 | ||
| 860 | //---扫一扫的函数--- | 885 | //---扫一扫的函数--- |
| 861 | - getScancode: function() { | 886 | + getScancode: function () { |
| 862 | var _this = this; | 887 | var _this = this; |
| 863 | // 允许从相机和相册扫码 | 888 | // 允许从相机和相册扫码 |
| 864 | wx.scanCode({ | 889 | wx.scanCode({ |
| @@ -872,16 +897,16 @@ Page({ | @@ -872,16 +897,16 @@ Page({ | ||
| 872 | }, | 897 | }, |
| 873 | 898 | ||
| 874 | //跳转到分类 | 899 | //跳转到分类 |
| 875 | - go_cate: function() { | 900 | + go_cate: function () { |
| 876 | getApp().goto("/pages/goods/categoryList/categoryList"); | 901 | getApp().goto("/pages/goods/categoryList/categoryList"); |
| 877 | }, | 902 | }, |
| 878 | 903 | ||
| 879 | - go_url: function(e) { | 904 | + go_url: function (e) { |
| 880 | var url = e.currentTarget.dataset.url; | 905 | var url = e.currentTarget.dataset.url; |
| 881 | getApp().goto(url); | 906 | getApp().goto(url); |
| 882 | }, | 907 | }, |
| 883 | 908 | ||
| 884 | - bind_bnerr_icon: function(e) { | 909 | + bind_bnerr_icon: function (e) { |
| 885 | var def = "/miniapp/images/no_cate_def.png"; | 910 | var def = "/miniapp/images/no_cate_def.png"; |
| 886 | var _err = e.currentTarget.dataset.err; | 911 | var _err = e.currentTarget.dataset.err; |
| 887 | var ob = {}; | 912 | var ob = {}; |
| @@ -890,7 +915,7 @@ Page({ | @@ -890,7 +915,7 @@ Page({ | ||
| 890 | }, | 915 | }, |
| 891 | 916 | ||
| 892 | //跳转到分类的商品列表 | 917 | //跳转到分类的商品列表 |
| 893 | - go_cate2: function(t) { | 918 | + go_cate2: function (t) { |
| 894 | var cid = t.currentTarget.dataset.cid; | 919 | var cid = t.currentTarget.dataset.cid; |
| 895 | var pid = t.currentTarget.dataset.pid; | 920 | var pid = t.currentTarget.dataset.pid; |
| 896 | var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid; | 921 | var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid; |
| @@ -898,13 +923,13 @@ Page({ | @@ -898,13 +923,13 @@ Page({ | ||
| 898 | url: lurl | 923 | url: lurl |
| 899 | }); | 924 | }); |
| 900 | }, | 925 | }, |
| 901 | - new_nav: function(e) { | 926 | + new_nav: function (e) { |
| 902 | var th = this; | 927 | var th = this; |
| 903 | var new_nav = th.data.new_nav; | 928 | var new_nav = th.data.new_nav; |
| 904 | getApp().goto(new_nav); | 929 | getApp().goto(new_nav); |
| 905 | }, | 930 | }, |
| 906 | //跳转到权益 | 931 | //跳转到权益 |
| 907 | - go_quanyi: function(t) { | 932 | + go_quanyi: function (t) { |
| 908 | var user_info = getApp().globalData.userInfo; | 933 | var user_info = getApp().globalData.userInfo; |
| 909 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 934 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 910 | wx.navigateTo({ | 935 | wx.navigateTo({ |
| @@ -916,7 +941,7 @@ Page({ | @@ -916,7 +941,7 @@ Page({ | ||
| 916 | getApp().goto("/pages/user/userqy/userqy"); | 941 | getApp().goto("/pages/user/userqy/userqy"); |
| 917 | }, | 942 | }, |
| 918 | 943 | ||
| 919 | - imageLoad: function(e) { | 944 | + imageLoad: function (e) { |
| 920 | var imgwidth = e.detail.width; | 945 | var imgwidth = e.detail.width; |
| 921 | var imgheight = e.detail.height; | 946 | var imgheight = e.detail.height; |
| 922 | //宽高比 | 947 | //宽高比 |
| @@ -928,7 +953,7 @@ Page({ | @@ -928,7 +953,7 @@ Page({ | ||
| 928 | }); | 953 | }); |
| 929 | }, | 954 | }, |
| 930 | //判断该用户是否是新会员 | 955 | //判断该用户是否是新会员 |
| 931 | - is_new: function() { | 956 | + is_new: function () { |
| 932 | var th = this; | 957 | var th = this; |
| 933 | wx.hideLoading(); | 958 | wx.hideLoading(); |
| 934 | getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", { | 959 | getApp().request.promiseGet("/api/weshop/marketing/newpeople/act/judge", { |
| @@ -964,20 +989,20 @@ Page({ | @@ -964,20 +989,20 @@ Page({ | ||
| 964 | th.setData({ | 989 | th.setData({ |
| 965 | is_disgraceful: 1 | 990 | is_disgraceful: 1 |
| 966 | }) | 991 | }) |
| 967 | - }else{ | ||
| 968 | - th.check_holiday_pop(); //节日的弹窗 | ||
| 969 | - } | ||
| 970 | - | 992 | + } else { |
| 993 | + th.check_holiday_pop(); //节日的弹窗 | ||
| 994 | + } | ||
| 995 | + | ||
| 971 | }) | 996 | }) |
| 972 | - }else{ | ||
| 973 | - th.check_holiday_pop(); //节日的弹窗 | ||
| 974 | - } | ||
| 975 | - | 997 | + } else { |
| 998 | + th.check_holiday_pop(); //节日的弹窗 | ||
| 999 | + } | ||
| 1000 | + | ||
| 976 | }) | 1001 | }) |
| 977 | 1002 | ||
| 978 | }, | 1003 | }, |
| 979 | - | ||
| 980 | - is_festival: function(e) { | 1004 | + |
| 1005 | + is_festival: function (e) { | ||
| 981 | var th = this; | 1006 | var th = this; |
| 982 | var url = "/api/weshop/marketing/holiday/act/judge"; | 1007 | var url = "/api/weshop/marketing/holiday/act/judge"; |
| 983 | getApp().request.promiseGet(url, { | 1008 | getApp().request.promiseGet(url, { |
| @@ -991,24 +1016,24 @@ Page({ | @@ -991,24 +1016,24 @@ Page({ | ||
| 991 | var giftBagId = res.data.data.gifBagId; //礼包id | 1016 | var giftBagId = res.data.data.gifBagId; //礼包id |
| 992 | var nav_url = "/pages/giftpack/festival/festival?actId=" + actid + '&' + 'actType=' + 3 + '&' + 'giftBagId=' + giftBagId; | 1017 | var nav_url = "/pages/giftpack/festival/festival?actId=" + actid + '&' + 'actType=' + 3 + '&' + 'giftBagId=' + giftBagId; |
| 993 | var swiperimage = th.data.swiperimage; | 1018 | var swiperimage = th.data.swiperimage; |
| 994 | - var actBoundImg = res.data.data.actBoundImg?res.data.data.actBoundImg:'/miniapp/images/default_g_img.gif'; | ||
| 995 | - | ||
| 996 | - th.data.holiday_image= res.data.data.actImg; | ||
| 997 | - th.data.holiday_url=nav_url; | ||
| 998 | - | 1019 | + var actBoundImg = res.data.data.actBoundImg ? res.data.data.actBoundImg : '/miniapp/images/default_g_img.gif'; |
| 1020 | + | ||
| 1021 | + th.data.holiday_image = res.data.data.actImg; | ||
| 1022 | + th.data.holiday_url = nav_url; | ||
| 1023 | + | ||
| 999 | var img = { | 1024 | var img = { |
| 1000 | image: actBoundImg, | 1025 | image: actBoundImg, |
| 1001 | nav_url: nav_url, | 1026 | nav_url: nav_url, |
| 1002 | - id:res.data.data.id, | ||
| 1003 | - type:'festival' | 1027 | + id: res.data.data.id, |
| 1028 | + type: 'festival' | ||
| 1029 | + } | ||
| 1030 | + | ||
| 1031 | + for (var i in swiperimage) { | ||
| 1032 | + var item = swiperimage[i]; | ||
| 1033 | + if (item.id == img.id && item.type == img.type) { | ||
| 1034 | + return false; | ||
| 1035 | + } | ||
| 1004 | } | 1036 | } |
| 1005 | - | ||
| 1006 | - for(var i in swiperimage){ | ||
| 1007 | - var item=swiperimage[i]; | ||
| 1008 | - if(item.id ==img.id && item.type==img.type){ | ||
| 1009 | - return false; | ||
| 1010 | - } | ||
| 1011 | - } | ||
| 1012 | 1037 | ||
| 1013 | swiperimage.unshift(img); | 1038 | swiperimage.unshift(img); |
| 1014 | th.setData({ | 1039 | th.setData({ |
| @@ -1018,82 +1043,82 @@ Page({ | @@ -1018,82 +1043,82 @@ Page({ | ||
| 1018 | } | 1043 | } |
| 1019 | }) | 1044 | }) |
| 1020 | }, | 1045 | }, |
| 1021 | - | 1046 | + |
| 1022 | //弹出节日有礼 | 1047 | //弹出节日有礼 |
| 1023 | - check_holiday_pop:function(){ | ||
| 1024 | - var th=this; | ||
| 1025 | - getApp().waitfor2(th,'w_holiday_pop','holiday_image',function(){ | ||
| 1026 | - //等到结果才显示 | ||
| 1027 | - if(th.data.holiday_image){ | ||
| 1028 | - th.setData({ | ||
| 1029 | - new_image: th.data.holiday_image, | ||
| 1030 | - new_nav: th.data.holiday_url, | ||
| 1031 | - is_disgraceful: 1 | ||
| 1032 | - }) | ||
| 1033 | - } | ||
| 1034 | - }) | 1048 | + check_holiday_pop: function () { |
| 1049 | + var th = this; | ||
| 1050 | + getApp().waitfor2(th, 'w_holiday_pop', 'holiday_image', function () { | ||
| 1051 | + //等到结果才显示 | ||
| 1052 | + if (th.data.holiday_image) { | ||
| 1053 | + th.setData({ | ||
| 1054 | + new_image: th.data.holiday_image, | ||
| 1055 | + new_nav: th.data.holiday_url, | ||
| 1056 | + is_disgraceful: 1 | ||
| 1057 | + }) | ||
| 1058 | + } | ||
| 1059 | + }) | ||
| 1035 | }, | 1060 | }, |
| 1036 | - | ||
| 1037 | - go_ad:function(e){ | ||
| 1038 | - var url=e.currentTarget.dataset.url; | ||
| 1039 | - if(!url || url=='') return; | ||
| 1040 | - if(url[0]!='/') url='/'+url; | ||
| 1041 | - getApp().goto(url); | 1061 | + |
| 1062 | + go_ad: function (e) { | ||
| 1063 | + var url = e.currentTarget.dataset.url; | ||
| 1064 | + if (!url || url == '') return; | ||
| 1065 | + if (url[0] != '/') url = '/' + url; | ||
| 1066 | + getApp().goto(url); | ||
| 1042 | }, | 1067 | }, |
| 1043 | - | 1068 | + |
| 1044 | //导航跳转 | 1069 | //导航跳转 |
| 1045 | - nav_goto:function(e){ | ||
| 1046 | - var url=e.currentTarget.dataset.url; | ||
| 1047 | - if(!url || url=='') return; | ||
| 1048 | - if(url[0]!='/') url='/'+url; | ||
| 1049 | - getApp().goto(url); | ||
| 1050 | - if(this.data.showHongbao) { | ||
| 1051 | - this.setData({ | ||
| 1052 | - showHongbao: false, | ||
| 1053 | - showHongbaoSmall: true, //显示抢红包小图标 | ||
| 1054 | - }); | ||
| 1055 | - } | ||
| 1056 | - }, | ||
| 1057 | - | ||
| 1058 | - //----跳转到搭配购买---- | ||
| 1059 | - go_test:function () { | ||
| 1060 | - wx.navigateTo({ url: "/packageA/pages/goods_share/goods_share", }) | ||
| 1061 | - }, | ||
| 1062 | - | ||
| 1063 | - | 1070 | + nav_goto: function (e) { |
| 1071 | + var url = e.currentTarget.dataset.url; | ||
| 1072 | + if (!url || url == '') return; | ||
| 1073 | + if (url[0] != '/') url = '/' + url; | ||
| 1074 | + getApp().goto(url); | ||
| 1075 | + if (this.data.showHongbao) { | ||
| 1076 | + this.setData({ | ||
| 1077 | + showHongbao: false, | ||
| 1078 | + showHongbaoSmall: true, //显示抢红包小图标 | ||
| 1079 | + }); | ||
| 1080 | + } | ||
| 1081 | + }, | ||
| 1082 | + | ||
| 1083 | + //----跳转到搭配购买---- | ||
| 1084 | + go_test: function () { | ||
| 1085 | + wx.navigateTo({ url: "/packageA/pages/goods_share/goods_share", }) | ||
| 1086 | + }, | ||
| 1087 | + | ||
| 1088 | + | ||
| 1064 | onShareTimeline() { | 1089 | onShareTimeline() { |
| 1065 | - // getApp().getConfig(function(t) { | ||
| 1066 | - // return { | ||
| 1067 | - // title: '首页-' + getApp().globalData.config.store_name, | ||
| 1068 | - // } | ||
| 1069 | - // }); | ||
| 1070 | - var store_name=getApp().globalData.config?getApp().globalData.config.store_name:''; | ||
| 1071 | - if(!store_name) | ||
| 1072 | - store_name=getApp().globalData.setting.appName; | ||
| 1073 | - return { | ||
| 1074 | - title: '首页-' + store_name, | ||
| 1075 | - } | ||
| 1076 | - }, | ||
| 1077 | - | ||
| 1078 | - | ||
| 1079 | - // 关闭首页抢红包主弹窗,显示侧边栏抢红包小图标 | ||
| 1080 | - closeHongbao() { | ||
| 1081 | - this.setData({ | ||
| 1082 | - showHongbao: false, //关闭抢红包主弹窗 | ||
| 1083 | - showHongbaoSmall: true, //显示抢红包小图标 | ||
| 1084 | - }); | ||
| 1085 | - }, | ||
| 1086 | - | ||
| 1087 | - /*-- 全屏广告 --*/ | ||
| 1088 | - close_full_screen(){ | ||
| 1089 | - this.setData({is_full_screen_show:0,sec_show:0}); | ||
| 1090 | - }, | ||
| 1091 | - //-- 跳转到满屏广告的链接 -- | ||
| 1092 | - go_full_ad(){ | ||
| 1093 | - if(!this.data.full_ad) return false; | ||
| 1094 | - if(!this.data.full_ad.ad_weapplink) return false; | ||
| 1095 | - getApp().goto(this.data.full_ad.ad_weapplink); | ||
| 1096 | - this.close_full_screen(); | ||
| 1097 | - }, | 1090 | + // getApp().getConfig(function(t) { |
| 1091 | + // return { | ||
| 1092 | + // title: '首页-' + getApp().globalData.config.store_name, | ||
| 1093 | + // } | ||
| 1094 | + // }); | ||
| 1095 | + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | ||
| 1096 | + if (!store_name) | ||
| 1097 | + store_name = getApp().globalData.setting.appName; | ||
| 1098 | + return { | ||
| 1099 | + title: '首页-' + store_name, | ||
| 1100 | + } | ||
| 1101 | + }, | ||
| 1102 | + | ||
| 1103 | + | ||
| 1104 | + // 关闭首页抢红包主弹窗,显示侧边栏抢红包小图标 | ||
| 1105 | + closeHongbao() { | ||
| 1106 | + this.setData({ | ||
| 1107 | + showHongbao: false, //关闭抢红包主弹窗 | ||
| 1108 | + showHongbaoSmall: true, //显示抢红包小图标 | ||
| 1109 | + }); | ||
| 1110 | + }, | ||
| 1111 | + | ||
| 1112 | + /*-- 全屏广告 --*/ | ||
| 1113 | + close_full_screen() { | ||
| 1114 | + this.setData({ is_full_screen_show: 0, sec_show: 0 }); | ||
| 1115 | + }, | ||
| 1116 | + //-- 跳转到满屏广告的链接 -- | ||
| 1117 | + go_full_ad() { | ||
| 1118 | + if (!this.data.full_ad) return false; | ||
| 1119 | + if (!this.data.full_ad.ad_weapplink) return false; | ||
| 1120 | + getApp().goto(this.data.full_ad.ad_weapplink); | ||
| 1121 | + this.close_full_screen(); | ||
| 1122 | + }, | ||
| 1098 | 1123 | ||
| 1099 | }); | 1124 | }); |
| 1100 | \ No newline at end of file | 1125 | \ No newline at end of file |