瀏覽代碼

我的里面添加购物车

lifanagju_citu 4 月之前
父節點
當前提交
c9c6738d0b

+ 10 - 0
src/router/modules/recruit.js

@@ -68,6 +68,16 @@ const recruit = [
           title: '我的'
         },
         children: [
+          {
+            path: '/mall/user/cart',
+            component: () => import('@/views/mall/user/cart/index.vue'),
+            name: 'mallUserCart',
+            meta: {
+              title: '购物车',
+              enName: 'My Cart',
+              icon: 'mdi-cart-outline'
+            }
+          },
           {
             path: '/mall/user/order',
             component: () => import('@/views/mall/user/order/index.vue'),

+ 21 - 3
src/views/mall/cart/index.vue

@@ -1,11 +1,11 @@
 <template>
-  <Navbar class="mb-3" />
-  <v-card class="default-width card-box mb-5 pa-5 resume-box">
+  <Navbar v-if="props.showNavbar" class="mb-3" />
+  <v-card class="card-box mb-5 pa-5 resume-box" :class="props.defaultWidth ? 'default-width' : '100%'" :elevation="props.elevation">
     <div class="resume-header">
       <div class="resume-title">我的购物车</div>
       <div>
         <v-btn color="primary" size="small" variant="text" class="ml-2" @click="getCartList"><v-icon>mdi-refresh</v-icon>刷新购物车</v-btn>
-        <v-btn color="primary" size="small" variant="text" class="ml-2" to="/mall/user/order"><v-icon>mdi-account-circle-outline</v-icon>我的订单</v-btn>
+        <v-btn v-if="props.showOrder" color="primary" size="small" variant="text" class="ml-2" to="/mall/user/order"><v-icon>mdi-account-circle-outline</v-icon>我的订单</v-btn>
       </div>
     </div>
     <div v-if="cartList.length" class="mt-3">
@@ -86,6 +86,24 @@ import confirm from '@/views/mall/components/details/order/confirm.vue'
 import pay from '@/views/mall/components/details/order/pay.vue'
 import Confirm from '@/plugins/confirm'
 import { useI18n } from '@/hooks/web/useI18n'; const { t } = useI18n()
+const props = defineProps({
+  showNavbar: {
+    type: Boolean,
+    default: true
+  },
+  defaultWidth: {
+    type: Boolean,
+    default: true
+  },
+  showOrder: {
+    type: Boolean,
+    default: true
+  },
+  elevation: {
+    type: [Number, String],
+    default: '3'
+  }
+})
 
 const router = useRouter()
 const cartList = ref([])

+ 3 - 3
src/views/mall/components/details/order/confirm.vue

@@ -78,9 +78,9 @@
   const props = defineProps({
     data: {
       type: String,
-      default: '',
-    },
-  });
+      default: ''
+    }
+  })
 
   const state = reactive({
     orderPayload: {},

+ 19 - 0
src/views/mall/user/cart/index.vue

@@ -0,0 +1,19 @@
+<!--  -->
+<template>
+  <div>
+    <cart
+      :showNavbar="false"
+      :defaultWidth="false"
+      :showOrder="false"
+      :elevation="0"
+    ></cart>
+  </div>
+</template>
+
+<script setup>
+defineOptions({name: 'mall-user-cart'})
+import cart from '@/views/mall/cart/index.vue'
+
+</script>
+<style lang="scss" scoped>
+</style>