| | |
| | | dybanner:[], |
| | | pddbanner:[], |
| | | wphbanner:[], |
| | | haspreference:false, |
| | | preferData:{}, |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | }, |
| | | created() { |
| | | this._freshing = false; |
| | | this.changeRecommend(); |
| | | //this.changeRecommend(); |
| | | this.checkPreferenceGoods(); |
| | | uni.$emit('initpage') |
| | | this.getBannerInfo(); |
| | | this.getHomeMenuList(); |
| | | this.getrecommendGoods(); |
| | | this.getbottomGoodsList(this.bottomType); |
| | | //this.getbottomGoodsList(this.bottomType); |
| | | this.getGOODSfalling(); |
| | | this.getRQList(); |
| | | //this.getPageImg(); |
| | |
| | | }, 1500) |
| | | }, |
| | | methods: { |
| | | checkPreferenceGoods() |
| | | {//是否有推荐 |
| | | var that = this; |
| | | var tmp_1 = { |
| | | mainTitle: '天猫', |
| | | subTitle: '天猫热销', |
| | | type: 5 |
| | | }; |
| | | var tmp_2 = { |
| | | mainTitle: '天猫', |
| | | subTitle: '为你推荐', |
| | | type: 1 |
| | | }; |
| | | var tmp_3= { |
| | | mainTitle: '推荐', |
| | | subTitle: '猜你喜欢', |
| | | type: 7 |
| | | }; |
| | | var open_like_recommend = uni.getStorageSync('open_like_recommend'); |
| | | if(this.typedataList.length == 5)this.typedataList.shift() |
| | | if(open_like_recommend == 1){ |
| | | this.typedataList.unshift(tmp_2); |
| | | this.bottomType = tmp_2.type; |
| | | }else{ |
| | | this.typedataList.unshift(tmp_1); |
| | | this.bottomType = tmp_1.type; |
| | | } |
| | | this.$u.api.checkPreferenceGoods({ |
| | | }).then(e => { |
| | | if(e.code != 0) |
| | | { |
| | | that.currentPage = 1; |
| | | that.getbottomGoodsList(that.bottomType); |
| | | return; |
| | | }; |
| | | if(e.data&&e.data.p_cids) |
| | | {//有偏好 |
| | | that.preferData=e.data; |
| | | that.typedataList.unshift(tmp_3); |
| | | that.bottomType = tmp_3.type; |
| | | //去除唯品会 |
| | | that.typedataList = that.typedataList.filter(function(item) {return item.type !== 4}); |
| | | } |
| | | that.currentPage = 1; |
| | | that.getbottomGoodsList(that.bottomType); |
| | | }).catch(function (err) { |
| | | this.changeRecommend(); |
| | | }) |
| | | }, |
| | | changeRecommend(){ |
| | | var tmp_1 = { |
| | | mainTitle: '天猫', |
| | |
| | | type: 5 |
| | | }; |
| | | var tmp_2 = { |
| | | mainTitle: '推荐', |
| | | mainTitle: '天猫', |
| | | subTitle: '为你推荐', |
| | | type: 1 |
| | | }; |
| | |
| | | }, |
| | | getbottomGoodsList(type) { |
| | | var that = this; |
| | | if(type==7&&that.preferData) |
| | | {//猜你喜欢 |
| | | this.$u.api.gussessLikeGoods({ |
| | | platefrom:that.preferData.p_platefrom, |
| | | cids:that.preferData.p_cids, |
| | | pageId:1, |
| | | pageSize:10 |
| | | }).then(e=>{ |
| | | console.log(e); |
| | | var res = e.data.list; |
| | | if (res.length < 10) { |
| | | that.loadingState = false |
| | | that.loadstatus = 'normal' |
| | | } else { |
| | | that.currentPage++ |
| | | that.loadstatus = 'loading' |
| | | that.loadingState = true |
| | | } |
| | | that.bottomGoodsList = res |
| | | }) |
| | | } |
| | | else |
| | | { |
| | | this.$u.api.getGoodThing({ |
| | | deviceType: getApp().globalData.platform == 'android' ? (getApp().globalData.systemLevel < 10 ? |
| | | 'IMEI' : 'OAID') : 'IDFA', |
| | |
| | | } |
| | | that.bottomGoodsList = res |
| | | }).catch(function(err) {}) |
| | | } |
| | | }, |
| | | |
| | | getNextPage() { |
| | | if (this.loadingState) { |
| | | this.loadingState = false |
| | | var that = this; |
| | | |
| | | if(that.currentPage==7&&that.preferData) |
| | | {//猜你喜欢 |
| | | this.$u.api.gussessLikeGoods({ |
| | | platefrom:that.preferData.p_platefrom, |
| | | cids:that.preferData.p_cids, |
| | | pageId:this.currentPage, |
| | | pageSize:10 |
| | | }).then(e=>{ |
| | | console.log(e) |
| | | }) |
| | | } |
| | | else{ |
| | | this.$u.api.getGoodThing({ |
| | | deviceType: getApp().globalData.platform == 'android' ? (getApp().globalData.systemLevel < |
| | | 10 ? 'IMEI' : 'OAID') : 'IDFA', |
| | |
| | | that.bottomGoodsList = that.bottomGoodsList.concat(res) |
| | | }).catch(function(err) {}) |
| | | } |
| | | } |
| | | }, |
| | | |
| | | switchtype(info, idx) { |