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