feat(订单/商品): 添加数量统计功能并优化列表展示

- 在订单和商品管理页面添加数量统计功能
- 优化订单和商品列表的筛选和展示样式
- 统一API接口参数传递方式
- 移除重复代码和无用代码
This commit is contained in:
pikachu1995@126.com
2025-08-29 09:40:36 +08:00
parent 05abad3905
commit 78b058009b
9 changed files with 592 additions and 271 deletions

View File

@@ -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)
}
//查询分类绑定参数信息

View File

@@ -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)
}

View File

@@ -370,7 +370,6 @@ export default {
})
},
// 售后筛选
// 售后筛选
serviceStatusClick(item) {
this.currentStatus = item;
// 如果是全部空字符串则删除serviceStatus字段

View File

@@ -104,7 +104,7 @@
<Card>
<div class="order-tab">
<Tabs v-model="currentStatus" @on-click="orderStatusClick">
<TabPane v-for="(item,index) in orderStatus" :key="index" :label="item.title" :name="item.value">
<TabPane v-for="(item,index) in orderStatusWithCount" :key="index" :label="item.title" :name="item.value">
</TabPane>
</Tabs>
</div>
@@ -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();

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -67,21 +67,21 @@
</Row>
</Card>
<Card>
<div class="goods-tab">
<Tabs v-model="currentStatus" @on-click="goodsStatusClick">
<TabPane v-for="(item,index) in goodsStatusWithCount" :key="index" :label="item.title" :name="item.value">
</TabPane>
</Tabs>
</div>
<Row class="operation padding-row">
<Button @click="addGoods" type="primary">添加商品</Button>
<Button @click="openImportGoods" type="primary">导入商品</Button>
<Dropdown @on-click="handleDropdown">
<Button type="default">
批量操作
<Icon type="ios-arrow-down"></Icon>
</Button>
<DropdownMenu slot="list">
<DropdownItem name="uppers">批量上架</DropdownItem>
<DropdownItem name="lowers">批量下架</DropdownItem>
<DropdownItem name="deleteAll">批量删除</DropdownItem>
<DropdownItem name="batchShipTemplate">批量设置物流模板</DropdownItem>
</DropdownMenu>
</Dropdown>
<Button @click="addGoods" type="info">添加商品</Button>
<Button @click="openImportGoods" >导入商品</Button>
<Button @click="openImportGoods" >批量上架</Button>
<Button @click="openImportGoods" >批量下架</Button>
<Button @click="openImportGoods" >批量删除</Button>
<Button @click="openImportGoods" >批量设置物流模板</Button>
</Row>
<Table
@@ -95,11 +95,11 @@
>
<!-- 商品栏目格式化 -->
<template slot="goodsSlot" slot-scope="{ row }">
<div style="margin-top: 5px; height: 90px; display: flex">
<div style=" height: 60px; display: flex">
<div style="">
<img
:src="row.original"
style="height: 80px; margin-top: 3px; width: 70px"
style="height: 50px; margin-top: 3px; width: 50px"
/>
</div>
@@ -107,25 +107,7 @@
<div class="div-zoom">
<a @click="linkTo(row.id, row.skuId)">{{ row.goodsName }}</a>
</div>
<Poptip trigger="hover" title="扫码在手机中查看" transfer>
<div slot="content">
<!-- <vueQr>123</vueQr> -->
<vue-qr
:text="wapLinkTo(row.id, row.skuId)"
:margin="0"
colorDark="#000"
colorLight="#fff"
:size="150"
></vue-qr>
</div>
<img
src="../../../assets/qrcode.svg"
class="hover-pointer"
width="20"
height="20"
alt=""
/>
</Poptip>
</div>
</div>
</template>
@@ -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 {
</script>
<style lang="scss" scoped>
@import "@/styles/table-common.scss";
// Tab组件样式
.goods-tab {
::v-deep .ivu-tabs-tab {
font-size: 14px;
}
}
</style>

View File

@@ -48,9 +48,14 @@
</Row>
</Card>
<Card>
<div class="order-tab">
<Tabs v-model="currentStatus" @on-click="serviceStatusClick">
<TabPane v-for="(item,index) in serviceStatus" :key="index" :label="item.title" :name="item.value">
</TabPane>
</Tabs>
</div>
<Table
:loading="loading"
border
class="mt_10"
:columns="columns"
:data="data"
@@ -59,21 +64,16 @@
<!-- 商品栏目格式化 -->
<template slot="goodsSlot" slot-scope="{row}">
<div style="margin-top: 5px;height: 90px; display: flex;">
<div style="margin-top: 5px;height: 60px; display: flex;">
<div style="">
<img :src="row.goodsImage" style="height: 80px;margin-top: 3px">
<img :src="row.goodsImage" style="height: 50px;margin-top: 3px">
</div>
<div style="margin-left: 13px;">
<div class="div-zoom">
<a @click="linkTo(row.goodsId,row.skuId)">{{row.goodsName}}</a>
</div>
<Poptip trigger="hover" title="扫码在手机中查看" transfer>
<div slot="content">
<vue-qr :text="wapLinkTo(row.goodsId,row.skuId)" :margin="0" colorDark="#000" colorLight="#fff" :size="150"></vue-qr>
</div>
<img src="../../../assets/qrcode.svg" class="hover-pointer" width="20" height="20" alt="">
</Poptip>
</div>
</div>
@@ -86,7 +86,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
@@ -109,7 +109,7 @@
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
pageSize: 20, // 页面大小
sort: "createTime", // 默认排序字段
order: "desc", // 默认排序方式
startDate: "", // 起始时间
@@ -154,6 +154,11 @@
key: "memberName",
minWidth: 120,
},
{
title: "会员ID",
key: "memberId",
minWidth: 120,
},
{
title: "状态",
align: "center",
@@ -218,6 +223,18 @@
],
data: [], // 表单数据
total: 0, // 表单数据总数
serviceStatus: [
{title: '全部', value: ''},
{title: '申请售后', value: 'APPLY'},
{title: '通过售后', value: 'PASS'},
{title: '拒绝售后', value: 'REFUSE'},
{title: '待收货', value: 'BUYER_RETURN'},
{title: '确认收货', value: 'SELLER_CONFIRM'},
{title: '完成售后', value: 'COMPLETE'},
{title: '卖家终止售后', value: 'SELLER_TERMINATION'},
{title: '买家取消售后', value: 'BUYER_CANCEL'}
],
currentStatus: ''
};
},
methods: {
@@ -238,7 +255,7 @@
// 搜索
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.searchForm.pageSize = 20;
this.getDataList();
},
// 重置
@@ -246,7 +263,7 @@
const defaultForm = {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
pageSize: 20, // 页面大小
sort: "createTime", // 默认排序字段
order: "desc", // 默认排序方式
startDate: "", // 起始时间
@@ -289,6 +306,17 @@
})
},
// 售后筛选
serviceStatusClick(item) {
this.currentStatus = item;
// 如果是全部空字符串则删除serviceStatus字段
if (item === 0) {
delete this.searchForm.serviceStatus;
} else {
this.searchForm.serviceStatus = item;
}
this.getDataList();
},
},
mounted () {
this.init();
@@ -303,4 +331,10 @@
<style lang="scss">
// 建议引入通用样式 可删除下面样式代码
@import "@/styles/table-common.scss";
// Tab组件样式
.order-tab {
::v-deep .ivu-tabs-tab {
font-size: 14px;
}
}
</style>

View File

@@ -8,6 +8,15 @@
:label-width="70"
class="search-form"
>
<Form-item label="关键字" prop="keywords" style="display: block; width: 100%;">
<Input
type="text"
v-model="searchForm.keywords"
placeholder="请输入商品名称/收货人/收货人手机号/店铺名称"
clearable
style="width: 500px"
/>
</Form-item>
<Form-item label="订单编号" prop="orderSn">
<Input
type="text"
@@ -26,22 +35,14 @@
style="width: 240px"
/>
</Form-item>
<Form-item label="订单状态" prop="orderStatus">
<Select
v-model="searchForm.orderStatus"
placeholder="请选择"
<Form-item label="收货人" prop="shipName">
<Input
type="text"
v-model="searchForm.shipName"
placeholder="请输入收货人姓名"
clearable
style="width: 240px"
>
<Option value="UNPAID">未付款</Option>
<Option value="PAID">已付款</Option>
<Option value="UNDELIVERED">待发货</Option>
<Option value="PARTS_DELIVERED">部分发货</Option>
<Option value="DELIVERED">已发货</Option>
<Option value="COMPLETED">已完成</Option>
<Option value="CANCELLED">已取消</Option>
<Option value="STAY_PICKED_UP">待自提</Option>
</Select>
/>
</Form-item>
<Form-item label="订单类型" prop="orderType">
<Select
@@ -75,6 +76,12 @@
</Form>
</Card>
<Card>
<div class="order-tab">
<Tabs v-model="currentStatus" @on-click="orderStatusClick">
<TabPane v-for="(item,index) in orderStatusWithCount" :key="index" :label="item.title" :name="item.value">
</TabPane>
</Tabs>
</div>
<div class="export">
<Button type="primary" class="mr_10" @click="expressOrderDeliver">批量发货</Button>
<Button @click="exportOrder" type="info" class="export">导出订单</Button>
@@ -93,7 +100,6 @@
</div>
<Table
:loading="loading"
border
:columns="columns"
:data="data"
ref="table"
@@ -209,6 +215,12 @@ export default {
minWidth: 130,
tooltip: true,
},
{
title: "会员ID",
key: "memberId",
minWidth: 120,
tooltip: true,
},
{
title: "订单金额",
key: "flowPrice",
@@ -263,6 +275,24 @@ export default {
}
},
},
{
title: "支付方式",
key: "paymentMethod",
width: 120,
render: (h, params) => {
if (params.row.paymentMethod == "WECHAT") {
return h("div", {}, "微信支付");
} else if (params.row.paymentMethod == "ALIPAY") {
return h("div", {}, "支付宝");
} else if (params.row.paymentMethod == "WALLET") {
return h("div", {}, "余额支付");
} else if (params.row.paymentMethod == "BANK_TRANSFER") {
return h("div", {}, "线下转账");
} else {
return h("div", {}, params.row.paymentMethod || "-");
}
},
},
{
title: "下单时间",
key: "createTime",
@@ -299,6 +329,7 @@ export default {
],
data: [], // 表单数据
total: 0, // 表单数据总数
orderNumData: {}, // 新增:订单数量统计数据
excelColumns: {
// 导出excel的参数
编号: "index",
@@ -313,8 +344,38 @@ export default {
店铺名称: "storeName",
创建时间: "createTime",
},
orderStatus: [
{title: '全部', value: ''},
{title: '未付款', value: 'UNPAID'},
{title: '已付款', value: 'PAID'},
{title: '待发货', value: 'UNDELIVERED'},
{title: '部分发货', value: 'PARTS_DELIVERED'},
{title: '已发货', value: 'DELIVERED'},
{title: '待核验', value: 'TAKE'},
{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: {
/**
* 核验订单
@@ -340,6 +401,7 @@ export default {
// 初始化数据
init() {
this.getDataList();
this.getOrderNumData(); // 新增:获取订单数量统计
},
// 改变页码
changePage(v) {
@@ -356,6 +418,7 @@ export default {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
this.getOrderNumData(); // 新增:搜索时也更新数量统计
},
// 重置
handleReset() {
@@ -428,6 +491,30 @@ export default {
})
},
// 订单筛选
orderStatusClick(name) {
if (name === 0) {
// 点击"全部"时设置为空字符串在getDataList中会被过滤掉
this.searchForm.orderStatus = '';
} else {
// 其他状态正常赋值
this.searchForm.orderStatus = name;
}
this.currentStatus = name;
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();
@@ -437,6 +524,7 @@ export default {
from.meta.keepAlive = false;
next();
},
};
</script>
<style lang="scss">
@@ -445,4 +533,10 @@ export default {
.export {
margin: 10px 20px 10px 0;
}
// Tab组件样式
.order-tab {
::v-deep .ivu-tabs-tab {
font-size: 14px;
}
}
</style>