冯诚 3 years ago
parent
commit
c69f631a09

+ 5 - 3
src/components/nav-bar/index.vue

@@ -18,11 +18,11 @@
           </div>
           <div class="nav-menu-body">
             <ul class="nav-links-inner">
-              <li class="nav-link">
+              <!-- <li class="nav-link">
                 <router-link to="/repaire/appointment"
                   >REPAIR BOOKING</router-link
                 >
-              </li>
+              </li> -->
               <li class="nav-link">
                 <router-link to="/fill-order">ONLINE SHOP</router-link>
               </li>
@@ -143,7 +143,9 @@
             <li class="dropdown-item i4">
               <router-link to="/invite"
                 >INVITE FRIENDS
-                <span class="ptc-tag">Get a $10 coupon</span></router-link
+                <span v-if="state.coupon.coupon_amount" class="ptc-tag"
+                  >Get a ${{ state.coupon.coupon_amount }} coupon</span
+                ></router-link
               >
             </li>
             <li class="dropdown-item i5">

+ 2 - 2
src/main.ts

@@ -1,7 +1,7 @@
 import { createApp } from 'vue'
 import App from './App.vue'
 import router from './router'
-import { getUserInfo } from './store'
+import { bootstrap } from './store'
 // import './utils/rem'
 import 'nprogress/nprogress.css'
 import './style'
@@ -11,7 +11,7 @@ import Toast from './components/toast'
 import Dialog from './components/dialog'
 import globalFilters from './filters'
 
-getUserInfo(false).finally(() => {
+bootstrap().finally(() => {
   const app = createApp(App)
   app.use(router).mount('#app')
   app.use(Toast).use(Dialog)

+ 10 - 5
src/pages/invite/index.vue

@@ -4,7 +4,7 @@
       <div class="award">
         <p class="award-name">Invite friends to get</p>
         <div class="award-worth">
-          <span class="num">- $10</span>
+          <span class="num">- ${{ couponAmount }}</span>
           <span class="txt">COUPON</span>
         </div>
         <p class="award-instruction">PTC offline store use</p>
@@ -12,10 +12,12 @@
       <div class="desc">
         <p class="desc-title"><i class="star"></i>Event Description</p>
         <p class="desc-content">
-          Friends who share your link will get a <strong>$10</strong> coupon. If
-          a friend buys a membership, you will get a
-          <strong>$10</strong> coupon. after the purchase, which can be used for
-          the next membership fee payment and electronic accessories products.
+          Friends who share your link will get a
+          <strong>${{ couponAmount }}</strong> coupon. If a friend buys a
+          membership, you will get a
+          <strong>${{ couponAmount }}</strong> coupon. after the purchase, which
+          can be used for the next membership fee payment and electronic
+          accessories products.
         </p>
       </div>
       <div class="methods">
@@ -114,6 +116,9 @@ export default defineComponent({
         0
       )
     },
+    couponAmount() {
+      return state.coupon.coupon_amount || 'N/A'
+    },
   },
   methods: {
     async invite() {

+ 1 - 1
src/pages/repaire/steps/StepTwo.vue

@@ -50,7 +50,7 @@
               class="date"
               :disabled="item.is_resreve != 1"
               :value="item.interface_time"
-              >{{ item.time }}</PtcRadio
+              >{{ item.interface_time }}</PtcRadio
             >
           </PtcRadioGroup>
         </div>

+ 4 - 0
src/service/user.ts

@@ -44,3 +44,7 @@ export function inviteFriends(emails: string) {
 export function getInviteRewards() {
   return request.get('/user/invite/rewards')
 }
+
+export function getInviteCoupon() {
+  return request.get('/invite/coupon')
+}

+ 7 - 0
src/store.ts

@@ -4,6 +4,8 @@ import * as api from '@/service/user'
 export const state = reactive({
   bgWhite: false,
   userInfo: null as ApiUser.Info.Response | null,
+  // 拉新优惠券信息
+  coupon: {} as any,
 })
 
 export async function getUserInfo(reportError?: boolean) {
@@ -21,3 +23,8 @@ export async function logout() {
   await api.logout()
   state.userInfo = null
 }
+
+export function bootstrap() {
+  api.getInviteCoupon().then(({ results }) => (state.coupon = results))
+  return getUserInfo(false)
+}