From c71306721cb2e8916e5a94e7dcc33a82161e4ed2 Mon Sep 17 00:00:00 2001 From: 2812875475 <2812875475@qq.com> Date: Sun, 31 Mar 2024 09:48:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E8=B4=AD=E7=89=A9=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/product/shop.js | 44 +++ src/api/shopCart/shop.js | 53 +++ src/layouttest/index.vue | 75 +++- src/router/index.js | 25 +- src/views/a/detailsComponent.vue | 347 ------------------ .../productInfo/detail/productDetails.vue | 340 +++++++++++++++++ .../product/productInfo/detail/shopping.vue | 183 +++++++++ src/views/shopCart/shop/index.vue | 310 ++++++++++++++++ 8 files changed, 1009 insertions(+), 368 deletions(-) create mode 100644 src/api/product/shop.js create mode 100644 src/api/shopCart/shop.js delete mode 100644 src/views/a/detailsComponent.vue create mode 100644 src/views/product/productInfo/detail/productDetails.vue create mode 100644 src/views/product/productInfo/detail/shopping.vue create mode 100644 src/views/shopCart/shop/index.vue diff --git a/src/api/product/shop.js b/src/api/product/shop.js new file mode 100644 index 0000000..d8d2bd9 --- /dev/null +++ b/src/api/product/shop.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询购物车列表 +export function listShop(query) { + return request({ + url: '/product/shop/list', + method: 'get', + params: query + }) +} + +// 查询购物车详细 +export function getShop(id) { + return request({ + url: '/product/shop/' + id, + method: 'get' + }) +} + +// 新增购物车 +export function addShop(data) { + return request({ + url: '/product/shop', + method: 'post', + data: data + }) +} + +// 修改购物车 +export function updateShop(data) { + return request({ + url: '/product/shop/'+data.id, + method: 'put', + data: data + }) +} + +// 删除购物车 +export function delShop(id) { + return request({ + url: '/product/shop/' + id, + method: 'delete' + }) +} diff --git a/src/api/shopCart/shop.js b/src/api/shopCart/shop.js new file mode 100644 index 0000000..09f5a15 --- /dev/null +++ b/src/api/shopCart/shop.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 查询购物车列表 +export function listShop(query) { + return request({ + url: '/shopCart/shop/list', + method: 'get', + params: query + }) +} + + +export function testShop(query) { + return request({ + url: '/shopCart/shop/shopList', + method: 'get', + params: query + }) +} + +// 查询购物车详细 +export function getShop(id) { + return request({ + url: '/shopCart/shop/' + id, + method: 'get' + }) +} + +// 新增购物车 +export function addShop(data) { + return request({ + url: '/shopCart/shop', + method: 'post', + data: data + }) +} + +// 修改购物车 +export function updateShop(data) { + return request({ + url: '/shopCart/shop/'+data.id, + method: 'put', + data: data + }) +} + +// 删除购物车 +export function delShop(id) { + return request({ + url: '/shopCart/shop/' + id, + method: 'delete' + }) +} diff --git a/src/layouttest/index.vue b/src/layouttest/index.vue index 4ae0c16..3cf3d22 100644 --- a/src/layouttest/index.vue +++ b/src/layouttest/index.vue @@ -11,17 +11,34 @@ active-text-color="#ffd04b"> 处理中心 - - - 选项1 - 选项2 - 选项3 - - - 选项1 - 选项2 - 选项3 - + + + + + + + + + + + + 进入购物车 消息中心 订单管理 @@ -41,22 +58,36 @@ diff --git a/src/router/index.js b/src/router/index.js index d44abf0..7f430fe 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -3,7 +3,6 @@ import Router from 'vue-router' /* Layout */ import Layout from '@/layout' import Layouttest from "@/layouttest"; -import DetailsComponent from '@/views/a/detailsComponent.vue'; Vue.use(Router) @@ -91,18 +90,30 @@ export const constantRoutes = [ }, { path: '', - component: DetailsComponent, + component: Layouttest, redirect: 'test', children: [ { path: '/detailsComponent/:id', - component: () => import('@/views/a/detailsComponent'), + component: () => import('@/views/product/productInfo/detail/productDetails.vue'), name: 'Test', meta: {title: "商品详情", icon: 'dashboard', affix: true} } ] }, - + { + path: '', + component: Layouttest, + redirect: 'test', + children: [ + { + path: 'shopping', + component: () => import('@/views/product/productInfo/detail/shopping.vue'), + name: 'Test', + meta: {title: "购物车", icon: 'dashboard', affix: true} + } + ] + }, { path: '/user', component: Layout, @@ -117,11 +128,7 @@ export const constantRoutes = [ } ] }, - { - path:'/details', - name:'/details', - component: DetailsComponent - } + ] // 动态路由,基于用户权限动态去加载 diff --git a/src/views/a/detailsComponent.vue b/src/views/a/detailsComponent.vue deleted file mode 100644 index af6ac0e..0000000 --- a/src/views/a/detailsComponent.vue +++ /dev/null @@ -1,347 +0,0 @@ - - - diff --git a/src/views/product/productInfo/detail/productDetails.vue b/src/views/product/productInfo/detail/productDetails.vue new file mode 100644 index 0000000..1c64fe9 --- /dev/null +++ b/src/views/product/productInfo/detail/productDetails.vue @@ -0,0 +1,340 @@ + + + diff --git a/src/views/product/productInfo/detail/shopping.vue b/src/views/product/productInfo/detail/shopping.vue new file mode 100644 index 0000000..7093364 --- /dev/null +++ b/src/views/product/productInfo/detail/shopping.vue @@ -0,0 +1,183 @@ + + + diff --git a/src/views/shopCart/shop/index.vue b/src/views/shopCart/shop/index.vue new file mode 100644 index 0000000..bc84a9a --- /dev/null +++ b/src/views/shopCart/shop/index.vue @@ -0,0 +1,310 @@ + + +