diff --git a/src/pages/Cart/Checkout.vue b/src/pages/Cart/Checkout.vue
index c4c210d..5b08c8a 100644
--- a/src/pages/Cart/Checkout.vue
+++ b/src/pages/Cart/Checkout.vue
@@ -193,13 +193,18 @@
data-bs-parent="#accordionBonus"
>
-
{{ bonus.name }}
@@ -332,14 +337,6 @@ const bonus = reactive({
//檢查優惠代碼
const handleCheckBonusSn = async () => {
- if (bonus.sn.length !== 10) {
- bonus.name = "沒有優惠劵";
- bonus.number = 0;
- bonus.remain = 0;
-
- orderStore.discount = 0;
- return;
- }
let res = await checkBonusSn(bonus.sn);
@@ -349,7 +346,7 @@ const handleCheckBonusSn = async () => {
bonus.remain = res.data.remain_number;
bonus.number = res.data.bonus_number;
//如果res.data最後是% 就相剩,沒有%就直接扣
- if (res.data.type_money.slice(-1) === "%") {
+ if (res.data.type_money.slice(-1) == '%' || res.data.type_money.slice(-1) ==='%') {
orderStore.discount = ((100 - res.data.type_money.slice(0, -1)) / 100) * orderStore.sum_amount;
} else {
orderStore.discount = res.data;
@@ -359,8 +356,6 @@ const handleCheckBonusSn = async () => {
}
};
-watch(() => bonus.sn, _.debounce(handleCheckBonusSn, 500));
-
//將購物車商品資料轉換成訂單商品資料
const cartToOrder = () => {
if (cartStore.cartItems.length === 0) {
@@ -613,4 +608,16 @@ const detail = computed(() => {
.bonus-desc {
padding: 0 10px;
}
+
+.bonus-input{
+ display: flex;
+ align-items: center;
+ div:nth-child(1){
+ flex: 1;
+ padding-right: 10px;
+ }
+ div:nth-child(2){
+ width: 50px;
+ }
+}