Răsfoiți Sursa

新注册购买藏品

panhui 3 ani în urmă
părinte
comite
f86d83a552
2 a modificat fișierele cu 16 adăugiri și 6 ștergeri
  1. 8 3
      src/components/ProductInfo.vue
  2. 8 3
      src/components/ProductSmallInfo.vue

+ 8 - 3
src/components/ProductInfo.vue

@@ -90,9 +90,14 @@ const user = computed(() => {
 })
 
 const notStock = computed(() => {
-    return (
-        props.stopOfficial && props.info.sales === 0 && !isAfter(addDays(new Date(user.value.createdAt), 2), new Date())
-    )
+    if (user.value) {
+        return (
+            props.stopOfficial &&
+            props.info.sales === 0 &&
+            !isAfter(addDays(new Date(user.value.createdAt), 2), new Date())
+        )
+    }
+    return props.stopOfficial && props.info.sales === 0
 })
 
 const goDetail = () => {

+ 8 - 3
src/components/ProductSmallInfo.vue

@@ -67,9 +67,14 @@ const user = computed(() => {
 })
 
 const notStock = computed(() => {
-    return (
-        props.stopOfficial && props.info.sales === 0 && !isAfter(addDays(new Date(user.value.createdAt), 2), new Date())
-    )
+    if (user.value) {
+        return (
+            props.stopOfficial &&
+            props.info.sales === 0 &&
+            !isAfter(addDays(new Date(user.value.createdAt), 2), new Date())
+        )
+    }
+    return props.stopOfficial && props.info.sales === 0
 })
 
 const router = useIonRouter()