From 0e0b856edb26ae88481146077bb17475cce9cb67 Mon Sep 17 00:00:00 2001 From: Seven Date: Sun, 8 Mar 2026 02:38:43 +0700 Subject: [PATCH] refactor: improve code formatting and structure in product index view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Enhanced readability by adjusting indentation and spacing in the template. - Consolidated repeated code blocks for better maintainability. - Added functionality for changing product status (上架/下架) with confirmation prompts. - Updated the handleDelete function to maintain consistent formatting. - Ensured all API calls and data handling are properly formatted for clarity. --- src/api/service/product.js | 13 + src/views/service/product/details.vue | 1391 +++++++++++++------------ src/views/service/product/index.vue | 548 +++++----- 3 files changed, 1036 insertions(+), 916 deletions(-) diff --git a/src/api/service/product.js b/src/api/service/product.js index 291c22a..2d89abe 100644 --- a/src/api/service/product.js +++ b/src/api/service/product.js @@ -42,3 +42,16 @@ export function delProduct(id) { method: 'delete' }) } + +// 上架/下架商品 +export function changeProductStatus(id, status) { + const data = { + id, + status + } + return request({ + url: '/service/product/status', + method: 'put', + data: data + }) +} \ No newline at end of file diff --git a/src/views/service/product/details.vue b/src/views/service/product/details.vue index 62a4650..28bc634 100644 --- a/src/views/service/product/details.vue +++ b/src/views/service/product/details.vue @@ -1,216 +1,253 @@ diff --git a/src/views/service/product/index.vue b/src/views/service/product/index.vue index b34d9d2..75dcebf 100644 --- a/src/views/service/product/index.vue +++ b/src/views/service/product/index.vue @@ -1,50 +1,56 @@