Bladeren bron

[首页,换一换][修改][优化代码]

tags/河北版C.8.1.01
rui 5 jaren geleden
bovenliggende
commit
31d77db0b1
2 gewijzigde bestanden met toevoegingen van 32 en 85 verwijderingen
  1. +32
    -84
      components/hot/index.js
  2. +0
    -1
      pages/main/index.js

+ 32
- 84
components/hot/index.js Bestand weergeven

@@ -30,22 +30,39 @@ Component({
* 组件的方法列表
*/
methods: {
//获取砍价列表
getList() {
//获取砍价拼团数据
getList(val) {
let that = this;
let param = {
targetAd: 6,
let param = ''
if(val=='1'){
param={
targetAd : 6,
couponId: this.data.couponId
}
}else{
param = {
targetAd : 7,
couponId: this.data.couponId1
}
}
Http.get({
url: config.api.change,
data:param,
}).then(res => {
if(res.data){
that.setData({
kData:res.data,
couponId: res.data.couponId
});
if(val=='1'){
that.setData({
kData: res.data,
couponId: res.data.couponId
});
}else{
that.setData({
pData: res.data,
couponId1: res.data.couponId
});
}
}

})
.catch(err => {
console.log(err)
@@ -57,82 +74,14 @@ Component({
});
})
},
//获取拼团列表
getptList() {
let param1 = {
targetAd: 7,
}
Http.get({
url: config.api.change,
data: param1,
}).then(res => {
if(res.data){
this.setData({
pData:res.data,
couponId1: res.data.couponId
});
}
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
},
// 换一换
getChange(){
if(this.data.couponId){
let that = this;
let param = {
targetAd: 6,
couponid:this.data.couponId
}
Http.get({
url: config.api.change,
data:param,
}).then(res => {
that.setData({
kData:res.data,
couponId: res.data.couponId
});
})
.catch(err => {
console.log(err)
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
if (this.data.couponId){
this.getList(1)
}
if(this.data.couponId1){
let param1 = {
targetAd: 7,
couponid1:this.data.couponId1
}
Http.get({
url: config.api.change,
data: param1,
}).then(res => {
this.setData({
pData:res.data,
couponId1: res.data.couponId
});
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
});
})
if (this.data.couponId1) {
this.getList(2)
}
},
//跳转砍价详情
gotokjdetail: function (e) {
@@ -160,11 +109,10 @@ Component({
},
},
ready() {
app.couponChannelListCallback = token => {
app.couponChannelListCallback = (token,val) => {
Http.setToken(token);
this.getList();
this.getptList();
// this.getChange();
this.getList('1');
this.getList('2');
};
if (app.globalData.token && app.globalData.token != null) {
app.couponChannelListCallback(app.globalData.token);


+ 0
- 1
pages/main/index.js Bestand weergeven

@@ -579,7 +579,6 @@ Page({
};
// 砍价下拉刷新
that.selectComponent("#hot").getList();
that.selectComponent("#hot").getptList();
// that.selectComponent("#bargain").getList();
// that.selectComponent("#spellGroup").getList();
// that.selectComponent("#rushtobyCard").getList();


Laden…
Annuleren
Opslaan