diff --git a/src/locales/zh-Hant.json b/src/locales/zh-Hant.json
index 12e097372..144ef5230 100644
--- a/src/locales/zh-Hant.json
+++ b/src/locales/zh-Hant.json
@@ -1003,7 +1003,7 @@
"shopping_cart_empty_notice": "購物車是空的",
"shopping_cart_empty_notice_button": "瀏覽書店",
"shopping_cart_error_insufficient_balance": "餘額不足,你只有 {balance}",
- "shopping_cart_list_coupon_title": "優惠(如適用)",
+ "shopping_cart_list_coupon_title": "優惠(如適用)",
"shopping_cart_list_coupon_text": "將於下一步計算",
"shopping_cart_list_header_item": "購物明細",
"shopping_cart_list_header_price": "單價",
diff --git a/src/pages/shopping-cart/book.vue b/src/pages/shopping-cart/book.vue
index ccdc9a325..bbc225de5 100644
--- a/src/pages/shopping-cart/book.vue
+++ b/src/pages/shopping-cart/book.vue
@@ -79,7 +79,7 @@
{{ $t('shopping_cart_list_coupon_title') }}
{{ $t('shopping_cart_list_coupon_text') }}
@@ -154,6 +154,9 @@ import { getNFTBookCartPurchaseLink } from '~/util/api';
import nftMixin from '~/mixins/nft';
import alertMixin from '~/mixins/alert';
+const CHRISTMAS_CAMPAIGN_MIN_SPEND = 9;
+const CHRISTMAS_CAMPAIGN_COUPON = 'XMASREAD';
+
export default {
name: 'ShoppingCartPage',
filters: {
@@ -228,9 +231,32 @@ export default {
return totalPrice + (unitPrice * item.quantity || 0);
}, 0);
},
+ totalItemPriceInUSD() {
+ return this.shoppingCartBookItems.reduce((totalPrice, item) => {
+ let itemPrice = 0;
+ if (item.collectionId) {
+ itemPrice = this.getNFTCollectionPriceByCollectionId(
+ item.collectionId
+ );
+ } else {
+ const edition = this.getNFTBookStorePriceByClassIdAndIndex(
+ item.productId,
+ item.classId ? item.priceIndex : undefined
+ );
+ itemPrice = edition?.price || 0;
+ }
+ return totalPrice + (itemPrice * item.quantity || 0);
+ }, 0);
+ },
formattedFiatPrice() {
return formatNumberWithUSD(this.totalNFTPriceInUSD);
},
+ getApplicableCoupon() {
+ if (this.coupon) return this.coupon;
+ return this.totalItemPriceInUSD > CHRISTMAS_CAMPAIGN_MIN_SPEND
+ ? CHRISTMAS_CAMPAIGN_COUPON
+ : '';
+ },
},
mounted() {
logPurchaseFlowEvent(this, 'view_cart', this.purchaseEventParams);
@@ -361,7 +387,7 @@ export default {
fbClickId: this.fbClickId,
items: this.shoppingCartBookItems,
email: this.walletEmail,
- coupon: this.coupon || 'CHRISTMAS10',
+ coupon: this.getApplicableCoupon,
giftInfo,
},
{