From 78b058009ba7dd986317fd82bcace9fb50cbf1c3 Mon Sep 17 00:00:00 2001 From: "pikachu1995@126.com" Date: Fri, 29 Aug 2025 09:40:36 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=AE=A2=E5=8D=95/=E5=95=86=E5=93=81):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=95=B0=E9=87=8F=E7=BB=9F=E8=AE=A1=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=B9=B6=E4=BC=98=E5=8C=96=E5=88=97=E8=A1=A8=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在订单和商品管理页面添加数量统计功能 - 优化订单和商品列表的筛选和展示样式 - 统一API接口参数传递方式 - 移除重复代码和无用代码 --- manager/src/api/goods.js | 25 +- manager/src/api/order.js | 5 + .../order/after-order/afterSaleOrder.vue | 1 - manager/src/views/order/order/orderList.vue | 34 +- seller/src/api/goods.js | 4 + seller/src/api/order.js | 5 + seller/src/views/goods/goods-seller/goods.vue | 605 +++++++++++------- .../order/after-order/returnGoodsOrder.vue | 60 +- seller/src/views/order/order/orderList.vue | 124 +++- 9 files changed, 592 insertions(+), 271 deletions(-) diff --git a/manager/src/api/goods.js b/manager/src/api/goods.js index cab60545..bd73cfe5 100644 --- a/manager/src/api/goods.js +++ b/manager/src/api/goods.js @@ -101,20 +101,23 @@ export const getGoodsCategory = (parent_id) => { } // 上架商品 -export const upGoods = (id, params) => { - return putRequest(`/goods/goods/${id}/up`, params) - } - // 下架商品 - export const lowGoods = (id, params) => { - return putRequest(`/goods/goods/${id}/under`, params) - } +export const upGoods = (params) => { + return putRequest(`/goods/goods/up`, params) +} + +// 下架商品 +export const lowGoods = (params) => { +return putRequest(`/goods/goods/under`, params) +} // 获取商品sku分页列表 export const getGoodsSkuData = (params) => { return getRequest('/goods/goods/sku/list', params) } - - +// 获取商品数量 +export const getGoodsNumerData = (params) => { + return getRequest('/goods/goods/goodsNumber', params) +} // 获取商品分页列表 export const getGoodsListData = (params) => { return getRequest('/goods/goods/list', params) @@ -124,8 +127,8 @@ export const getAuthGoodsListData = (params) => { return getRequest('/goods/goods/auth/list', params) } // 审核商品 -export const authGoods = (id, params) => { - return putRequest(`/goods/goods/${id}/auth`, params) +export const authGoods = (params) => { + return putRequest(`/goods/goods/auth`, params) } //查询分类绑定参数信息 diff --git a/manager/src/api/order.js b/manager/src/api/order.js index 4981a96d..1ba03b63 100644 --- a/manager/src/api/order.js +++ b/manager/src/api/order.js @@ -160,3 +160,8 @@ export const refundLog = (params) => { export const storeAddress = (sn) => { return getRequest(`/order/afterSale/getStoreAfterSaleAddress/${sn}`) } + +// 获取订单数量统计 +export const getOrderNum = (params) => { + return getRequest(`/order/order/orderNum`, params) +} diff --git a/manager/src/views/order/after-order/afterSaleOrder.vue b/manager/src/views/order/after-order/afterSaleOrder.vue index 0e18cffc..cffbbf85 100644 --- a/manager/src/views/order/after-order/afterSaleOrder.vue +++ b/manager/src/views/order/after-order/afterSaleOrder.vue @@ -370,7 +370,6 @@ export default { }) }, // 售后筛选 - // 售后筛选 serviceStatusClick(item) { this.currentStatus = item; // 如果是全部(空字符串),则删除serviceStatus字段 diff --git a/manager/src/views/order/order/orderList.vue b/manager/src/views/order/order/orderList.vue index 27709699..20d903bc 100644 --- a/manager/src/views/order/order/orderList.vue +++ b/manager/src/views/order/order/orderList.vue @@ -104,7 +104,7 @@
- +
@@ -374,6 +374,7 @@ export default { ], data: [], // 表单数据 total: 0, // 表单数据总数 + orderNumData: {}, // 新增:订单数量统计数据 orderStatus: [ {title: '全部', value: ''}, {title: '未付款', value: 'UNPAID'}, @@ -385,15 +386,32 @@ export default { {title: '待自提', value: 'STAY_PICKED_UP'}, {title: '已完成', value: 'COMPLETED'}, {title: '已关闭', value: 'CANCELLED'}, - ], currentStatus: '' }; }, + computed: { + // 新增:带数量的订单状态选项 + orderStatusWithCount() { + return [ + {title: '全部', value: ''}, + {title: `未付款${this.orderNumData.waitPayNum ? '(' + this.orderNumData.waitPayNum + ')' : ''}`, value: 'UNPAID'}, + {title: `已付款${this.orderNumData.waitDeliveryNum ? '(' + this.orderNumData.waitDeliveryNum + ')' : ''}`, value: 'PAID'}, + {title: `待发货${this.orderNumData.waitShipNum ? '(' + this.orderNumData.waitShipNum + ')' : ''}`, value: 'UNDELIVERED'}, + {title: `部分发货${this.orderNumData.partsDeliveredNumNum ? '(' + this.orderNumData.partsDeliveredNumNum + ')' : ''}`, value: 'PARTS_DELIVERED'}, + {title: `待收货${this.orderNumData.deliveredNum ? '(' + this.orderNumData.deliveredNum + ')' : ''}`, value: 'DELIVERED'}, + {title: `待核验${this.orderNumData.waitCheckNum ? '(' + this.orderNumData.waitCheckNum + ')' : ''}`, value: 'TAKE'}, + {title: `待自提${this.orderNumData.waitSelfPickNum ? '(' + this.orderNumData.waitSelfPickNum + ')' : ''}`, value: 'STAY_PICKED_UP'}, + {title: `已完成${this.orderNumData.finishNum ? '(' + this.orderNumData.finishNum + ')' : ''}`, value: 'COMPLETED'}, + {title: `已关闭${this.orderNumData.closeNum ? '(' + this.orderNumData.closeNum + ')' : ''}`, value: 'CANCELLED'}, + ]; + } + }, methods: { // 初始化数据 init() { this.getDataList(); + this.getOrderNumData(); // 新增:获取订单数量统计 }, // 分页 改变页码 changePage(v) { @@ -411,6 +429,7 @@ export default { this.searchForm.pageNumber = 1; this.searchForm.pageSize = 20; this.getDataList(); + this.getOrderNumData(); // 新增:搜索时也更新数量统计 }, // 起止时间从新赋值 selectDateRange(v) { @@ -486,6 +505,17 @@ export default { this.getDataList(); }, + getOrderNumData() { + // 创建一个不包含orderStatus字段的搜索参数 + const { orderStatus, ...searchParams } = this.searchForm; + API_Order.getOrderNum(searchParams).then((res) => { + if (res.success) { + this.orderNumData = res.result; + } + }).catch((err) => { + console.error('获取订单数量统计失败:', err); + }); + }, }, mounted() { this.init(); diff --git a/seller/src/api/goods.js b/seller/src/api/goods.js index 9b976ebf..02427c9b 100644 --- a/seller/src/api/goods.js +++ b/seller/src/api/goods.js @@ -147,6 +147,10 @@ export const getGoodsSkuData = params => { export const getGoodsListData = params => { return getRequest("/goods/goods/list", params); }; +// 获取商品数量 +export const getGoodsNumerData = (params) => { + return getRequest('/goods/goods/goodsNumber', params) +} // 获取待审核商品分页列表 export const getAuthGoodsListData = params => { return getRequest("/goods/auth/list", params); diff --git a/seller/src/api/order.js b/seller/src/api/order.js index a5fbd578..bc025202 100644 --- a/seller/src/api/order.js +++ b/seller/src/api/order.js @@ -168,3 +168,8 @@ export const partDelivery = (orderSn,params) => { export const getTracesList = (sn) => { return getRequest(`/order/order/getTracesList/${sn}`); } + +// 获取订单数量统计 +export const getOrderNum = (params) => { + return getRequest(`/order/order/orderNum`, params); +} diff --git a/seller/src/views/goods/goods-seller/goods.vue b/seller/src/views/goods/goods-seller/goods.vue index 51bf36bd..9512d53c 100644 --- a/seller/src/views/goods/goods-seller/goods.vue +++ b/seller/src/views/goods/goods-seller/goods.vue @@ -67,21 +67,21 @@
+ +
+ + + + +
+ - - - - - - 批量上架 - 批量下架 - 批量删除 - 批量设置物流模板 - - + + + + + + @@ -137,7 +119,7 @@ :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" - :page-size-opts="[10, 20, 50]" + :page-size-opts="[20, 50, 100]" size="small" show-total show-elevator @@ -221,7 +203,8 @@ import { lowGoods, deleteGoods, batchShipTemplate, - downLoadGoods + downLoadGoods, + getGoodsNumerData } from "@/api/goods"; import { baseUrl } from "@/libs/axios.js"; import * as API_Shop from "@/api/shops"; @@ -246,7 +229,7 @@ export default { searchForm: { // 搜索框初始化对象 pageNumber: 1, // 当前页数 - pageSize: 10, // 页面大小 + pageSize: 20, // 页面大小 sort: "create_time", // 默认排序字段 order: "desc", // 默认排序方式 }, @@ -259,6 +242,213 @@ export default { price: "", sellerName: "", }, + columns: [ + { + type: "selection", + width: 60, + align: "center", + }, + { + title: "商品ID", + key: "id", + width: 180, + tooltip: true, + }, + { + title: "商品", + key: "goodsName", + minWidth: 200, + slot: "goodsSlot", + }, + { + title: "销售模式", + key: "salesModel", + width: 150, + render: (h, params) => { + if (params.row.salesModel === "RETAIL") { + return h("div", [h("Tag", { props: { color: "blue" } }, "零售")]); + } else if (params.row.salesModel === "WHOLESALE") { + return h("div", [h("Tag", { props: { color: "green" } }, "批发")]); + } + }, + }, + { + title: "商品类型", + key: "goodsType", + width: 150, + render: (h, params) => { + if (params.row.goodsType === "PHYSICAL_GOODS") { + return h("div", [h("Tag", { props: { color: "blue" } }, "实物")]); + } else if (params.row.goodsType === "VIRTUAL_GOODS") { + return h("div", [h("Tag", { props: { color: "green" } }, "虚拟")]); + } + }, + }, + { + title: "价格", + key: "price", + width: 150, + render: (h, params) => { + return h("div", "¥" + params.row.price); + }, + }, + { + title: "销量", + key: "buyCount", + width: 150, + render: (h, params) => { + return h("span", params.row.buyCount || 0); + }, + }, + { + title: "库存", + key: "quantity", + width: 150, + render: (h, params) => { + return h("span", params.row.quantity || 0); + }, + }, + { + title: "审核状态", + key: "authFlag", + width: 150, + render: (h, params) => { + if (params.row.authFlag === "TOBEAUDITED") { + return h("Tag", { props: { color: "gold" } }, "待审核"); + } else if (params.row.authFlag === "PASS") { + return h("Tag", { props: { color: "green" } }, "审核通过"); + } else if (params.row.authFlag === "REFUSE") { + return h("Tag", { props: { color: "red" } }, "审核拒绝"); + } + }, + }, + { + title: "状态", + key: "marketEnable", + width: 150, + render: (h, params) => { + if (params.row.marketEnable === "UPPER") { + return h("Tag", { props: { color: "green" } }, "上架"); + } else if (params.row.marketEnable === "DOWN") { + return h("Tag", { props: { color: "red" } }, "下架"); + } + }, + }, + { + title: "操作", + key: "action", + align: "center", + fixed: "right", + width: 200, + render: (h, params) => { + if (params.row.marketEnable == "DOWN") { + return h("div", [ + h( + "a", + { + style: { + color: "#2d8cf0", + cursor: "pointer", + textDecoration: "none" + }, + on: { + click: () => { + this.editGoods(params.row); + }, + }, + }, + "编辑" + ), + h("span", { + style: { + margin: "0 8px", + color: "#dcdee2" + } + }, "|"), + h( + "a", + { + style: { + color: "#2d8cf0", + cursor: "pointer", + textDecoration: "none" + }, + on: { + click: () => { + this.upper(params.row); + }, + }, + }, + "上架" + ), + ]); + } else { + return h("div", [ + h( + "a", + { + style: { + color: "#2d8cf0", + cursor: "pointer", + textDecoration: "none" + }, + on: { + click: () => { + this.editGoods(params.row); + }, + }, + }, + "编辑" + ), + h("span", { + style: { + margin: "0 8px", + color: "#dcdee2" + } + }, "|"), + h( + "a", + { + style: { + color: "#2d8cf0", + cursor: "pointer", + textDecoration: "none" + }, + on: { + click: () => { + this.getStockDetail(params.row.id); + }, + }, + }, + "库存" + ), + h("span", { + style: { + margin: "0 8px", + color: "#dcdee2" + } + }, "|"), + h( + "a", + { + style: { + color: "#2d8cf0", + cursor: "pointer", + textDecoration: "none" + }, + on: { + click: () => { + this.lower(params.row); + }, + }, + }, + "下架" + ), + ]); + } + }, + }, + ], updateStockColumns: [ { title: "sku规格", @@ -282,124 +472,6 @@ export default { } }, }, - { - title: "操作", - key: "action", - align: "center", - width: 200, - render: (h, params) => { - let vm = this; - return h("InputNumber", { - props: { - value: params.row.quantity, - }, - on: { - "on-change": (event) => { - vm.stockList[params.index].quantity = event; - }, - }, - }); - }, - }, - ], - // 表单验证规则 - formValidate: {}, - submitLoading: false, // 添加或编辑提交状态 - selectList: [], // 多选数据 - selectCount: 0, // 多选计数 - columns: [ - { - type: "selection", - width: 60, - align: "center", - }, - { - title: "商品编号", - key: "id", - width: 180, - tooltip: true, - }, - { - title: "商品名称", - key: "goodsName", - minWidth: 200, - slot: "goodsSlot", - }, - { - title: "销售模式", - key: "salesModel", - width: 100, - render: (h, params) => { - if (params.row.salesModel === "RETAIL") { - return h("Tag", { props: { color: "orange" } }, "零售"); - } else if (params.row.salesModel === "WHOLESALE") { - return h("Tag", { props: { color: "magenta" } }, "批发"); - } else { - return h("Tag", { props: { color: "volcano" } }, "其他类型"); - } - }, - }, - { - title: "商品类型", - key: "goodsType", - width: 130, - render: (h, params) => { - if (params.row.goodsType === "PHYSICAL_GOODS") { - return h("Tag", { props: { color: "geekblue" } }, "实物商品"); - } else if (params.row.goodsType === "VIRTUAL_GOODS") { - return h("Tag", { props: { color: "purple" } }, "虚拟商品"); - } else { - return h("Tag", { props: { color: "cyan" } }, "电子卡券"); - } - }, - }, - { - title: "商品价格", - key: "price", - width: 130, - render: (h, params) => { - return h("priceColorScheme", {props:{value:params.row.price,color:this.$mainColor}} ); - }, - }, - { - title: "库存", - key: "quantity", - width: 120, - render: (h, params) => { - if (params.row.quantity) { - return h("div", params.row.quantity); - } else { - return h("div", 0); - } - }, - }, - { - title: "审核状态", - key: "authFlag", - width: 120, - render: (h, params) => { - if (params.row.authFlag == "PASS") { - return h("Tag", { props: { color: "green" } }, "通过"); - } else if (params.row.authFlag == "TOBEAUDITED") { - return h("Tag", { props: { color: "volcano" } }, "待审核"); - } else if (params.row.authFlag == "REFUSE") { - return h("Tag", { props: { color: "red" } }, "审核拒绝"); - } - }, - }, - { - title: "上架状态", - key: "marketEnable", - width: 130, - sortable: false, - render: (h, params) => { - if (params.row.marketEnable == "DOWN") { - return h("Tag", { props: { color: "red" } }, "下架"); - } else if (params.row.marketEnable == "UPPER") { - return h("Tag", { props: { color: "green" } }, "上架"); - } - }, - }, { title: "操作", key: "action", @@ -407,99 +479,137 @@ export default { fixed: "right", width: 200, render: (h, params) => { - let enableOrDisable = ""; - let showEditStock = ""; if (params.row.marketEnable == "DOWN") { - enableOrDisable = h( - "Button", - { - props: { - size: "small", - type: "success", - }, - style: { - marginRight: "5px", - }, - on: { - click: () => { - this.upper(params.row); + return h("div", [ + h( + "a", + { + style: { + color: "#2d8cf0", + cursor: "pointer", + textDecoration: "none" + }, + on: { + click: () => { + this.editGoods(params.row); + }, }, }, - }, - "上架" - ); + "编辑" + ), + h("span", { + style: { + margin: "0 8px", + color: "#dcdee2" + } + }, "|"), + h( + "a", + { + style: { + color: "#2d8cf0", + cursor: "pointer", + textDecoration: "none" + }, + on: { + click: () => { + this.upper(params.row); + }, + }, + }, + "上架" + ), + ]); } else { - showEditStock = h( - "Button", - { - props: { - type: "default", - size: "small", - }, - style: { - marginRight: "5px", - }, - on: { - click: () => { - this.getStockDetail(params.row.id); + return h("div", [ + h( + "a", + { + style: { + color: "#2d8cf0", + cursor: "pointer", + textDecoration: "none" + }, + on: { + click: () => { + this.editGoods(params.row); + }, }, }, - }, - "库存" - ); - enableOrDisable = h( - "Button", - { - props: { - type: "warning", - size: "small", - }, + "编辑" + ), + h("span", { style: { - marginRight: "5px", - }, - on: { - click: () => { - this.lower(params.row); + margin: "0 8px", + color: "#dcdee2" + } + }, "|"), + h( + "a", + { + style: { + color: "#2d8cf0", + cursor: "pointer", + textDecoration: "none" + }, + on: { + click: () => { + this.getStockDetail(params.row.id); + }, }, }, - }, - "下架" - ); + "库存" + ), + h("span", { + style: { + margin: "0 8px", + color: "#dcdee2" + } + }, "|"), + h( + "a", + { + style: { + color: "#2d8cf0", + cursor: "pointer", + textDecoration: "none" + }, + on: { + click: () => { + this.lower(params.row); + }, + }, + }, + "下架" + ), + ]); } - return h("div", [ - h( - "Button", - { - props: { - type: "info", - size: "small", - }, - style: { - marginRight: "5px", - }, - on: { - click: () => { - this.editGoods(params.row); - }, - }, - }, - "编辑" - ), - showEditStock, - enableOrDisable, - ]); }, }, ], data: [], // 表单数据 total: 0, // 表单数据总数 updateStockType: 'updateStock', // 更新库存状态 + goodsNumerData: {}, + currentStatus: '', }; }, + computed: { + goodsStatusWithCount() { + return [ + {title: '全部', value: ''}, + {title: `出售中${this.goodsNumerData.upperGoodsNum ? '(' + this.goodsNumerData.upperGoodsNum + ')' : ''}`, value: 'UPPER'}, + {title: `仓库中${this.goodsNumerData.downGoodsNum ? '(' + this.goodsNumerData.downGoodsNum + ')' : ''}`, value: 'DOWN'}, + {title: `待审核${this.goodsNumerData.auditGoodsNum ? '(' + this.goodsNumerData.auditGoodsNum + ')' : ''}`, value: 'TOBEAUDITED'}, + {title: `审核未通过${this.goodsNumerData.refuseGoodsNum ? '(' + this.goodsNumerData.refuseGoodsNum + ')' : ''}`, value: 'REFUSE'} + ]; + } + }, methods: { init() { // 初始化数据 this.getDataList(); + this.getNumberData(); }, // 添加商品 addGoods() { @@ -624,16 +734,18 @@ export default { // 搜索 handleSearch() { this.searchForm.pageNumber = 1; - this.searchForm.pageSize = 10; + this.searchForm.pageSize = 20; this.getDataList(); + this.getNumberData(); }, // 重置搜索条件 handleReset() { this.searchForm = {}; this.searchForm.pageNumber = 1; - this.searchForm.pageSize = 10; + this.searchForm.pageSize = 20; // 重新加载数据 this.getDataList(); + this.getNumberData(); }, // 清除多选 clearSelectAll() { @@ -831,6 +943,35 @@ export default { }, }); }, + getNumberData() { + // 创建一个不包含goodsStatus字段的搜索参数 + const { goodsStatus, ...searchParams } = this.searchForm; + getGoodsNumerData(searchParams).then((res) => { + if (res.success) { + this.goodsNumerData = res.result; + } + }) + }, + // 商品状态筛选 + goodsStatusClick(item) { + // 根据选择的状态设置搜索条件 + if (item === 0) { + // 全部:清除状态筛选 + delete this.searchForm.goodsStatus; + } else { + // 其他状态正常赋值 + this.searchForm.goodsStatus = item; + } + this.currentStatus = item; + + // tab切换时清除选中内容 + this.selectedRows = []; + if (this.$refs.table) { + this.$refs.table.selectAll(false); + } + + this.getDataList(); + }, }, mounted() { this.init(); @@ -840,4 +981,10 @@ export default { diff --git a/seller/src/views/order/after-order/returnGoodsOrder.vue b/seller/src/views/order/after-order/returnGoodsOrder.vue index edf783ef..d290eae8 100644 --- a/seller/src/views/order/after-order/returnGoodsOrder.vue +++ b/seller/src/views/order/after-order/returnGoodsOrder.vue @@ -48,9 +48,14 @@ +
+ + + + +