feat: 购买按钮改为直接跳转带pid的购物车链接
This commit is contained in:
@@ -839,6 +839,7 @@
|
||||
remaining: '',
|
||||
promoCode: '',
|
||||
duration: '',
|
||||
buyUrl: '',
|
||||
isSoldOut: false
|
||||
};
|
||||
|
||||
@@ -930,8 +931,14 @@
|
||||
let buyBtn = card.querySelector('.form-footer-butt');
|
||||
if (!buyBtn) buyBtn = card.querySelector('.cat-styleBform-footer-butt');
|
||||
if (!buyBtn) buyBtn = card.querySelector('.cat-styleCform-footer a');
|
||||
if (buyBtn && buyBtn.classList.contains('disableButton')) {
|
||||
product.isSoldOut = true;
|
||||
if (buyBtn) {
|
||||
if (buyBtn.classList.contains('disableButton')) {
|
||||
product.isSoldOut = true;
|
||||
}
|
||||
const href = buyBtn.getAttribute('href');
|
||||
if (href && href.includes('pid')) {
|
||||
product.buyUrl = 'https://www.szhdy.com' + href;
|
||||
}
|
||||
}
|
||||
|
||||
return product;
|
||||
@@ -989,9 +996,9 @@
|
||||
</div>
|
||||
${product.oldPrice ? `<div class="price-old">原价: ¥${escapeHtml(product.oldPrice)}</div>` : ''}
|
||||
</div>
|
||||
${isSoldOut
|
||||
${isSoldOut
|
||||
? '<span class="buy-btn sold-out">已售罄</span>'
|
||||
: `<a href="${ACTIVITY_URL}" target="_blank" class="buy-btn">立即购买</a>`
|
||||
: `<a href="${product.buyUrl || ACTIVITY_URL}" target="_blank" class="buy-btn">立即购买</a>`
|
||||
}
|
||||
</div>
|
||||
<div class="product-monitor-checkbox">
|
||||
|
||||
Reference in New Issue
Block a user