This commit is contained in:
parent
da8d437cbb
commit
bdc742934a
|
|
@ -363,35 +363,42 @@
|
|||
|
||||
// 获取同类推荐 (使用 itemid 和 son_category)
|
||||
this.getSimilarProducts(d.itemid, d.son_category);
|
||||
// 加载完商品后请求淘口令 / 领券链接
|
||||
this.fetchTaoWord();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
fetchTaoWord() {
|
||||
fetchTaoWord(callback) {
|
||||
if (!this.product.taobaoId) return;
|
||||
uni.showLoading({ title: '加载中...', mask: true });
|
||||
uni.request({
|
||||
url: 'https://api.cmspro.haodanku.com/taobao/getTaoWord',
|
||||
url: 'https://v2.api.haodanku.com/ratesurl',
|
||||
method: 'POST',
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: {
|
||||
domain: 'cms.baimajiayuanjiankang.com',
|
||||
itemid: this.product.taobaoId,
|
||||
activityid: this.product.activityId || '',
|
||||
title: this.product.title || '',
|
||||
relation_id: '2887601176',
|
||||
cid: 'YsWZ21tx'
|
||||
get_taoword: 1,
|
||||
pid: 'mm_284380119_1881450385_111415850448',
|
||||
tb_name: 'michuan2018',
|
||||
relation_id: '2864040832',
|
||||
apikey: '5417B681C5EA'
|
||||
},
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
const body = res.data || {};
|
||||
if (body.code === 200 && body.data) {
|
||||
this.product.taoCode = body.data.tao_code || '';
|
||||
this.product.spreadUrl = body.data.spread_url || '';
|
||||
this.product.couponUrl = body.data.coupon_url || '';
|
||||
if (body.code === 1 && body.data) {
|
||||
this.product.taoCode = body.data.taoword || '';
|
||||
this.product.couponUrl = body.data.coupon_click_url || '';
|
||||
if (callback) callback();
|
||||
} else {
|
||||
uni.showToast({ title: body.msg || '获取失败', icon: 'none' });
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '网络错误', icon: 'none' });
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
@ -420,8 +427,9 @@
|
|||
uni.navigateBack();
|
||||
},
|
||||
copyTaoWord() {
|
||||
this.fetchTaoWord(() => {
|
||||
if (!this.product.taoCode) {
|
||||
uni.showToast({ title: '口令加载中,请稍候', icon: 'none' });
|
||||
uni.showToast({ title: '暂无口令', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
uni.setClipboardData({
|
||||
|
|
@ -433,11 +441,13 @@
|
|||
uni.showToast({ title: '复制失败', icon: 'none' });
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
goBuy() {
|
||||
this.fetchTaoWord(() => {
|
||||
const url = this.product.couponUrl;
|
||||
if (!url) {
|
||||
uni.showToast({ title: '链接加载中,请稍候', icon: 'none' });
|
||||
uni.showToast({ title: '暂无领券链接', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
// #ifdef H5
|
||||
|
|
@ -451,6 +461,7 @@
|
|||
}
|
||||
});
|
||||
// #endif
|
||||
});
|
||||
},
|
||||
handleScroll(e) {
|
||||
const scrollTop = e.detail.scrollTop;
|
||||
|
|
|
|||
Loading…
Reference in New Issue