|
@@ -30,22 +30,39 @@ Component({ |
|
|
* 组件的方法列表 |
|
|
* 组件的方法列表 |
|
|
*/ |
|
|
*/ |
|
|
methods: { |
|
|
methods: { |
|
|
//获取砍价列表 |
|
|
|
|
|
getList() { |
|
|
|
|
|
|
|
|
//获取砍价拼团数据 |
|
|
|
|
|
getList(val) { |
|
|
let that = this; |
|
|
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({ |
|
|
Http.get({ |
|
|
url: config.api.change, |
|
|
url: config.api.change, |
|
|
data:param, |
|
|
data:param, |
|
|
}).then(res => { |
|
|
}).then(res => { |
|
|
if(res.data){ |
|
|
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 => { |
|
|
.catch(err => { |
|
|
console.log(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(){ |
|
|
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) { |
|
|
gotokjdetail: function (e) { |
|
@@ -160,11 +109,10 @@ Component({ |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
ready() { |
|
|
ready() { |
|
|
app.couponChannelListCallback = token => { |
|
|
|
|
|
|
|
|
app.couponChannelListCallback = (token,val) => { |
|
|
Http.setToken(token); |
|
|
Http.setToken(token); |
|
|
this.getList(); |
|
|
|
|
|
this.getptList(); |
|
|
|
|
|
// this.getChange(); |
|
|
|
|
|
|
|
|
this.getList('1'); |
|
|
|
|
|
this.getList('2'); |
|
|
}; |
|
|
}; |
|
|
if (app.globalData.token && app.globalData.token != null) { |
|
|
if (app.globalData.token && app.globalData.token != null) { |
|
|
app.couponChannelListCallback(app.globalData.token); |
|
|
app.couponChannelListCallback(app.globalData.token); |
|
|