|
@@ -1,11 +1,13 @@
|
|
import { reactive } from 'vue'
|
|
import { reactive } from 'vue'
|
|
import * as api from '@/service/user'
|
|
import * as api from '@/service/user'
|
|
|
|
+import { getOrderInfo } from '@/service/order'
|
|
|
|
|
|
export const state = reactive({
|
|
export const state = reactive({
|
|
bgWhite: false,
|
|
bgWhite: false,
|
|
userInfo: null as ApiUser.Info.Response | null,
|
|
userInfo: null as ApiUser.Info.Response | null,
|
|
// 拉新优惠券信息
|
|
// 拉新优惠券信息
|
|
coupon: {} as any,
|
|
coupon: {} as any,
|
|
|
|
+ currentOrder: null as any,
|
|
})
|
|
})
|
|
|
|
|
|
export async function getUserInfo(reportError?: boolean) {
|
|
export async function getUserInfo(reportError?: boolean) {
|
|
@@ -28,3 +30,9 @@ export function bootstrap() {
|
|
api.getInviteCoupon().then(({ results }) => (state.coupon = results))
|
|
api.getInviteCoupon().then(({ results }) => (state.coupon = results))
|
|
return getUserInfo(false)
|
|
return getUserInfo(false)
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+export async function getCurrentOrder(id: string | number) {
|
|
|
|
+ if (!state.currentOrder || +state.currentOrder.id !== +id) {
|
|
|
|
+ state.currentOrder = (await getOrderInfo(+id)).results
|
|
|
|
+ }
|
|
|
|
+}
|