冯诚 vor 3 Jahren
Ursprung
Commit
5848e586c4
3 geänderte Dateien mit 16 neuen und 11 gelöschten Zeilen
  1. 14 9
      src/pages/fill-order/StepOne.vue
  2. 1 1
      src/pages/fill-order/StepTwo.vue
  3. 1 1
      src/pages/fill-order/store.ts

+ 14 - 9
src/pages/fill-order/StepOne.vue

@@ -16,7 +16,7 @@
         </PtcRadioGroup>
         <div
           class="version-desc"
-          :class="{ pro: state.form.product_id === 'pro' }"
+          :class="{ second: state.form.product_id === 'pro' }"
         >
           {{ selectedProduct.remark }}
         </div>
@@ -30,15 +30,17 @@
             <span class="cost">${{ selectedProduct.amount_year }}</span>
             <span class="name">Annual</span>
             <span class="ptc-tag"
-              >-{{ selectedProduct.better_than_monthly * 100 }}% OFF</span
+              >-{{ selectedProduct.better_than_monthly }}% OFF</span
             >
           </PtcRadio>
           <PtcRadio class="method" value="month">
             <span class="cost">${{ selectedProduct.amount_month }}</span>
             <span class="name">
-              Monthly&nbsp; Activation fee ${{
-                selectedProduct.amount_month_open
-              }}</span
+              Monthly<template v-if="+selectedProduct.amount_month_open"
+                >&nbsp; Activation fee ${{
+                  selectedProduct.amount_month_open
+                }}</template
+              ></span
             >
           </PtcRadio>
         </PtcRadioGroup>
@@ -70,7 +72,7 @@
     </div>
 
     <div class="total">
-      <div class="ptc-inner">
+      <div v-if="cost" class="ptc-inner">
         <p>
           total<strong>${{ cost }}</strong>
         </p>
@@ -106,7 +108,7 @@ const cost = computed(() => {
     case 'year':
       return amount_year
     case 'month':
-      return amount_month + amount_month_open
+      return (+amount_month + +amount_month_open).toFixed(2)
     default:
       return ''
   }
@@ -115,7 +117,10 @@ const cost = computed(() => {
 async function checkDiscount() {
   if (!state.form.discount_code) return Toast('Please enter promotional code')
   try {
-    const { results } = await api.checkDiscount(state.form.discount_code)
+    const { results, message } = await api.checkDiscount(
+      state.form.discount_code
+    )
+    Toast(message)
     showCoupon.value = true
   } catch {
     state.form.discount_code = ''
@@ -167,7 +172,7 @@ async function next() {
       border-width: 0 12px 14px;
       border-color: #f2f5fb transparent;
     }
-    &.pro::before {
+    &.second::before {
       left: 88px + 276px;
     }
   }

+ 1 - 1
src/pages/fill-order/StepTwo.vue

@@ -35,7 +35,7 @@
         </PtcRadioGroup>
       </div>
     </div>
-    <template v-if="state.form.brand_id">
+    <template v-if="state.modelList.length">
       <div class="ptc-block">
         <div class="ptc-inner">
           <p class="ptc-label">Choose phone model</p>

+ 1 - 1
src/pages/fill-order/store.ts

@@ -29,5 +29,5 @@ export async function getBrandList() {
 }
 
 export async function getModelList() {
-  state.brandList = (await api.getModels(state.form.brand_id)).results
+  state.modelList = (await api.getModels(state.form.brand_id)).results
 }