修复订单列表查询订单类型查询无效问题

master
paulGao 2022-08-11 20:57:30 +08:00
parent db51df89f7
commit 283f4d6afa
4 changed files with 312 additions and 104 deletions

4
.gitignore vendored
View File

@ -1,6 +1,6 @@
/.vscode/ */.vscode/
/.idea/ /.idea/
/dist/ */dist/
.DS_Store .DS_Store
node_modules/ node_modules/
yarn.lock yarn.lock

View File

@ -1,27 +1,65 @@
<template> <template>
<div> <div>
<Card> <Card>
<Form ref="searchForm" @keydown.enter.native="handleSearch" :model="searchForm" inline :label-width="70" class="search-form"> <Form
ref="searchForm"
@keydown.enter.native="handleSearch"
:model="searchForm"
inline
:label-width="70"
class="search-form"
>
<Form-item label="订单号" prop="orderSn"> <Form-item label="订单号" prop="orderSn">
<Input type="text" v-model="searchForm.orderSn" placeholder="请输入订单号" clearable style="width: 160px" /> <Input
type="text"
v-model="searchForm.orderSn"
placeholder="请输入订单号"
clearable
style="width: 160px"
/>
</Form-item> </Form-item>
<Form-item label="会员名称" prop="buyerName"> <Form-item label="会员名称" prop="buyerName">
<Input type="text" v-model="searchForm.buyerName" placeholder="请输入会员名称" clearable style="width: 160px" /> <Input
type="text"
v-model="searchForm.buyerName"
placeholder="请输入会员名称"
clearable
style="width: 160px"
/>
</Form-item> </Form-item>
<Form-item label="订单类型" prop="orderType"> <Form-item label="订单类型" prop="orderType">
<Select v-model="searchForm.orderType" placeholder="请选择" clearable style="width: 160px"> <Select
v-model="searchForm.orderPromotionType"
placeholder="请选择"
clearable
style="width: 160px"
>
<Option value="NORMAL">普通订单</Option> <Option value="NORMAL">普通订单</Option>
<Option value="PINTUAN">拼团订单</Option> <Option value="PINTUAN">拼团订单</Option>
<Option value="GIFT">赠品订单</Option> <Option value="GIFT">赠品订单</Option>
<Option value="VIRTUAL">核验订单</Option> <Option value="POINTS">积分订单</Option>
<Option value="KANJIA">砍价订单</Option>
</Select> </Select>
</Form-item> </Form-item>
<Form-item label="下单时间"> <Form-item label="下单时间">
<DatePicker v-model="selectDate" type="datetimerange" format="yyyy-MM-dd" clearable @on-change="selectDateRange" placeholder="选择起始时间" style="width: 160px"></DatePicker> <DatePicker
v-model="selectDate"
type="datetimerange"
format="yyyy-MM-dd"
clearable
@on-change="selectDateRange"
placeholder="选择起始时间"
style="width: 160px"
></DatePicker>
</Form-item> </Form-item>
<Form-item label="订单状态" prop="orderStatus"> <Form-item label="订单状态" prop="orderStatus">
<Select v-model="searchForm.orderStatus" placeholder="请选择" clearable style="width: 160px"> <Select
v-model="searchForm.orderStatus"
placeholder="请选择"
clearable
style="width: 160px"
>
<Option value="UNPAID">未付款</Option> <Option value="UNPAID">未付款</Option>
<Option value="PAID">已付款</Option> <Option value="PAID">已付款</Option>
<Option value="UNDELIVERED">待发货</Option> <Option value="UNDELIVERED">待发货</Option>
@ -31,24 +69,50 @@
<Option value="CANCELLED">已取消</Option> <Option value="CANCELLED">已取消</Option>
</Select> </Select>
</Form-item> </Form-item>
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button> <Button
@click="handleSearch"
type="primary"
icon="ios-search"
class="search-btn"
>搜索</Button
>
</Form> </Form>
<div> <div>
<download-excel class="export-excel-wrapper" :data="data" :fields="fields" :fetch="exportOrder" name="商品订单.xls"> <download-excel
<Button type="info" class="export"> class="export-excel-wrapper"
导出订单 :data="data"
</Button> :fields="fields"
:fetch="exportOrder"
name="商品订单.xls"
>
<Button type="info" class="export"> 导出订单 </Button>
</download-excel> </download-excel>
</div> </div>
<Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom" ></Table> <Table
:loading="loading"
border
:columns="columns"
:data="data"
ref="table"
sortable="custom"
></Table>
<Row type="flex" justify="end" class="mt_10"> <Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small" <Page
show-total show-elevator show-sizer></Page> :current="searchForm.pageNumber"
:total="total"
:page-size="searchForm.pageSize"
@on-change="changePage"
@on-page-size-change="changePageSize"
:page-size-opts="[10, 20, 50]"
size="small"
show-total
show-elevator
show-sizer
></Page>
</Row> </Row>
</Card> </Card>
</div> </div>
</template> </template>
@ -139,17 +203,29 @@ export default {
}, },
{ {
title: "订单类型", title: "订单类型",
key: "orderType", key: "orderPromotionType",
width: 120, width: 120,
render: (h, params) => { render: (h, params) => {
if (params.row.orderType == "NORMAL") { if (params.row.orderPromotionType == "NORMAL") {
return h("div", [h("tag", {props: {color: "blue"}}, "普通订单")]); return h("div", [
} else if (params.row.orderType == "PINTUAN") { h("tag", { props: { color: "blue" } }, "普通订单"),
return h("div", [h("tag", {props: {color: "volcano"}}, "拼团订单")]); ]);
} else if (params.row.orderType == "GIFT") { } else if (params.row.orderPromotionType == "PINTUAN") {
return h("div", [h("tag", {props: {color: "green"}}, "赠品订单")]); return h("div", [
} else if (params.row.orderType == "VIRTUAL") { h("tag", { props: { color: "volcano" } }, "拼团订单"),
return h("div", [h("tag", {props: {color: "geekblue"}}, "核验订单")]); ]);
} else if (params.row.orderPromotionType == "GIFT") {
return h("div", [
h("tag", { props: { color: "green" } }, "赠品订单"),
]);
} else if (params.row.orderPromotionType == "POINTS") {
return h("div", [
h("tag", { props: { color: "geekblue" } }, "积分订单"),
]);
} else if (params.row.orderPromotionType == "KANJIA") {
return h("div", [
h("tag", { props: { color: "pink" } }, "砍价订单"),
]);
} }
}, },
}, },
@ -179,19 +255,33 @@ export default {
minWidth: 100, minWidth: 100,
render: (h, params) => { render: (h, params) => {
if (params.row.orderStatus == "UNPAID") { if (params.row.orderStatus == "UNPAID") {
return h("div", [h("tag", {props: {color: "magenta"}}, "未付款")]); return h("div", [
h("tag", { props: { color: "magenta" } }, "未付款"),
]);
} else if (params.row.orderStatus == "PAID") { } else if (params.row.orderStatus == "PAID") {
return h("div", [h("tag", {props: {color: "blue"}}, "已付款")]); return h("div", [
h("tag", { props: { color: "blue" } }, "已付款"),
]);
} else if (params.row.orderStatus == "UNDELIVERED") { } else if (params.row.orderStatus == "UNDELIVERED") {
return h("div", [h("tag", {props: {color: "geekblue"}}, "待发货")]); return h("div", [
h("tag", { props: { color: "geekblue" } }, "待发货"),
]);
} else if (params.row.orderStatus == "DELIVERED") { } else if (params.row.orderStatus == "DELIVERED") {
return h("div", [h("tag", {props: {color: "cyan"}}, "已发货")]); return h("div", [
h("tag", { props: { color: "cyan" } }, "已发货"),
]);
} else if (params.row.orderStatus == "COMPLETED") { } else if (params.row.orderStatus == "COMPLETED") {
return h("div", [h("tag", {props: {color: "green"}}, "已完成")]); return h("div", [
h("tag", { props: { color: "green" } }, "已完成"),
]);
} else if (params.row.orderStatus == "TAKE") { } else if (params.row.orderStatus == "TAKE") {
return h("div", [h("tag", {props: {color: "volcano"}}, "待核验")]); return h("div", [
h("tag", { props: { color: "volcano" } }, "待核验"),
]);
} else if (params.row.orderStatus == "CANCELLED") { } else if (params.row.orderStatus == "CANCELLED") {
return h("div", [h("tag", {props: {color: "red"}}, "已取消")]); return h("div", [
h("tag", { props: { color: "red" } }, "已取消"),
]);
} }
}, },
}, },
@ -206,11 +296,19 @@ export default {
align: "center", align: "center",
width: 100, width: 100,
render: (h, params) => { render: (h, params) => {
return h("Button", {props: {type: "info", size: "small",}, return h(
style: {marginRight: "5px",}, "Button",
on: {click: () => {this.detail(params.row);},}, {
}, "查看" props: { type: "info", size: "small" },
) style: { marginRight: "5px" },
on: {
click: () => {
this.detail(params.row);
},
},
},
"查看"
);
}, },
}, },
], ],
@ -269,24 +367,23 @@ export default {
}); });
}, },
// //
async exportOrder () { async exportOrder() {
const params = JSON.parse(JSON.stringify(this.searchForm)) const params = JSON.parse(JSON.stringify(this.searchForm));
params.pageNumber = 1; params.pageNumber = 1;
params.pageSize = 10000 params.pageSize = 10000;
const result = await API_Order.getOrderList(params) const result = await API_Order.getOrderList(params);
if (result.success) { if (result.success) {
if (result.result.records.length === 0) { if (result.result.records.length === 0) {
this.$Message.warning('暂无待发货订单') this.$Message.warning("暂无待发货订单");
return [] return [];
} else { } else {
return result.result.records return result.result.records;
} }
} else { } else {
this.$Message.warning('导出订单失败,请重试') this.$Message.warning("导出订单失败,请重试");
}
} }
}, },
},
mounted() { mounted() {
this.init(); this.init();
}, },
@ -299,5 +396,4 @@ export default {
.export-excel-wrapper { .export-excel-wrapper {
display: inline; display: inline;
} }
</style> </style>

View File

@ -409,14 +409,14 @@
<dl> <dl>
<dt>物流公司</dt> <dt>物流公司</dt>
<dd> <dd>
<div class="text-box">{{ logisticsInfo.shipper }}</div> <div class="text-box">{{ logisticsInfo.shipper || orderInfo.order.logisticsName }}</div>
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dt>快递单号</dt> <dt>快递单号</dt>
<dd> <dd>
<div nctype="ordersSn" class="text-box"> <div nctype="ordersSn" class="text-box">
{{ logisticsInfo.logisticCode }} {{ logisticsInfo.logisticCode || orderInfo.order.logisticsNo }}
</div> </div>
</dd> </dd>
</dl> </dl>

View File

@ -1,15 +1,38 @@
<template> <template>
<div class="search"> <div class="search">
<Card> <Card>
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form"> <Form
ref="searchForm"
:model="searchForm"
inline
:label-width="70"
class="search-form"
>
<Form-item label="订单编号" prop="orderSn"> <Form-item label="订单编号" prop="orderSn">
<Input type="text" v-model="searchForm.orderSn" clearable placeholder="请输入订单编号" style="width: 160px" /> <Input
type="text"
v-model="searchForm.orderSn"
clearable
placeholder="请输入订单编号"
style="width: 160px"
/>
</Form-item> </Form-item>
<Form-item label="会员名称" prop="buyerName"> <Form-item label="会员名称" prop="buyerName">
<Input type="text" v-model="searchForm.buyerName" clearable placeholder="请输入会员名称" style="width: 160px" /> <Input
type="text"
v-model="searchForm.buyerName"
clearable
placeholder="请输入会员名称"
style="width: 160px"
/>
</Form-item> </Form-item>
<Form-item label="订单状态" prop="orderStatus"> <Form-item label="订单状态" prop="orderStatus">
<Select v-model="searchForm.orderStatus" placeholder="请选择" clearable style="width: 160px"> <Select
v-model="searchForm.orderStatus"
placeholder="请选择"
clearable
style="width: 160px"
>
<Option value="UNPAID">未付款</Option> <Option value="UNPAID">未付款</Option>
<Option value="PAID">已付款</Option> <Option value="PAID">已付款</Option>
<Option value="UNDELIVERED">待发货</Option> <Option value="UNDELIVERED">待发货</Option>
@ -18,10 +41,34 @@
<Option value="CANCELLED">已取消</Option> <Option value="CANCELLED">已取消</Option>
</Select> </Select>
</Form-item> </Form-item>
<Form-item label="下单时间"> <Form-item label="订单类型" prop="orderType">
<DatePicker v-model="selectDate" type="datetimerange" format="yyyy-MM-dd" clearable @on-change="selectDateRange" placeholder="选择起始时间" style="width: 160px"></DatePicker> <Select
v-model="searchForm.orderPromotionType"
placeholder="请选择"
clearable
style="width: 160px"
>
<Option value="NORMAL">普通订单</Option>
<Option value="PINTUAN">拼团订单</Option>
<Option value="GIFT">赠品订单</Option>
<Option value="POINTS">积分订单</Option>
<Option value="KANJIA">砍价订单</Option>
</Select>
</Form-item> </Form-item>
<Button @click="handleSearch" type="primary" class="search-btn">搜索</Button> <Form-item label="下单时间">
<DatePicker
v-model="selectDate"
type="datetimerange"
format="yyyy-MM-dd"
clearable
@on-change="selectDateRange"
placeholder="选择起始时间"
style="width: 160px"
></DatePicker>
</Form-item>
<Button @click="handleSearch" type="primary" class="search-btn"
>搜索</Button
>
<Button @click="handleReset" class="search-btn">重置</Button> <Button @click="handleReset" class="search-btn">重置</Button>
</Form> </Form>
<div class="export"> <div class="export">
@ -29,19 +76,35 @@
批量发货 批量发货
</Button> </Button>
<download-excel <download-excel
style="display:inline-block;" style="display: inline-block"
:data="data" :data="data"
:fields="excelColumns" :fields="excelColumns"
:fetch="exportOrder" :fetch="exportOrder"
name="待发货订单.xls" name="待发货订单.xls"
> >
<Button >导出待发货订单</Button> <Button>导出待发货订单</Button>
</download-excel> </download-excel>
</div> </div>
<Table :loading="loading" border :columns="columns" :data="data" ref="table"></Table> <Table
:loading="loading"
border
:columns="columns"
:data="data"
ref="table"
></Table>
<Row type="flex" justify="end" class="mt_10"> <Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small" <Page
show-total show-elevator show-sizer></Page> :current="searchForm.pageNumber"
:total="total"
:page-size="searchForm.pageSize"
@on-change="changePage"
@on-page-size-change="changePageSize"
:page-size-opts="[10, 20, 50]"
size="small"
show-total
show-elevator
show-sizer
></Page>
</Row> </Row>
</Card> </Card>
</div> </div>
@ -98,6 +161,34 @@ export default {
} }
}, },
}, },
{
title: "订单类型",
key: "orderPromotionType",
width: 120,
render: (h, params) => {
if (params.row.orderPromotionType == "NORMAL") {
return h("div", [
h("tag", { props: { color: "blue" } }, "普通订单"),
]);
} else if (params.row.orderPromotionType == "PINTUAN") {
return h("div", [
h("tag", { props: { color: "volcano" } }, "拼团订单"),
]);
} else if (params.row.orderPromotionType == "GIFT") {
return h("div", [
h("tag", { props: { color: "green" } }, "赠品订单"),
]);
} else if (params.row.orderPromotionType == "POINTS") {
return h("div", [
h("tag", { props: { color: "geekblue" } }, "积分订单"),
]);
} else if (params.row.orderPromotionType == "KANJIA") {
return h("div", [
h("tag", { props: { color: "pink" } }, "砍价订单"),
]);
}
},
},
{ {
title: "买家名称", title: "买家名称",
key: "memberName", key: "memberName",
@ -123,26 +214,40 @@ export default {
minWidth: 100, minWidth: 100,
render: (h, params) => { render: (h, params) => {
if (params.row.orderStatus == "UNPAID") { if (params.row.orderStatus == "UNPAID") {
return h("div", [h("tag", {props: {color: "magenta"}}, "未付款")]); return h("div", [
h("tag", { props: { color: "magenta" } }, "未付款"),
]);
} else if (params.row.orderStatus == "PAID") { } else if (params.row.orderStatus == "PAID") {
return h("div", [h("tag", {props: {color: "blue"}}, "已付款")]); return h("div", [
h("tag", { props: { color: "blue" } }, "已付款"),
]);
} else if (params.row.orderStatus == "UNDELIVERED") { } else if (params.row.orderStatus == "UNDELIVERED") {
return h("div", [h("tag", {props: {color: "geekblue"}}, "待发货")]); return h("div", [
h("tag", { props: { color: "geekblue" } }, "待发货"),
]);
} else if (params.row.orderStatus == "DELIVERED") { } else if (params.row.orderStatus == "DELIVERED") {
return h("div", [h("tag", {props: {color: "cyan"}}, "已发货")]); return h("div", [
h("tag", { props: { color: "cyan" } }, "已发货"),
]);
} else if (params.row.orderStatus == "COMPLETED") { } else if (params.row.orderStatus == "COMPLETED") {
return h("div", [h("tag", {props: {color: "green"}}, "已完成")]); return h("div", [
h("tag", { props: { color: "green" } }, "已完成"),
]);
} else if (params.row.orderStatus == "TAKE") { } else if (params.row.orderStatus == "TAKE") {
return h("div", [h("tag", {props: {color: "volcano"}}, "待核验")]); return h("div", [
h("tag", { props: { color: "volcano" } }, "待核验"),
]);
} else if (params.row.orderStatus == "CANCELLED") { } else if (params.row.orderStatus == "CANCELLED") {
return h("div", [h("tag", {props: {color: "red"}}, "已取消")]); return h("div", [
h("tag", { props: { color: "red" } }, "已取消"),
]);
} }
}, },
}, },
{ {
title: "下单时间", title: "下单时间",
key: "createTime", key: "createTime",
width: 170 width: 170,
}, },
{ {
title: "操作", title: "操作",
@ -175,19 +280,20 @@ export default {
], ],
data: [], // data: [], //
total: 0, // total: 0, //
excelColumns: { // excel excelColumns: {
'编号': 'index', // excel
'订单号': 'sn', 编号: "index",
'收货人': 'consigneeName', 订单号: "sn",
'收货人联系电话': 'consigneeMobile', 收货人: "consigneeName",
'收货地址': 'consigneeAddress', 收货人联系电话: "consigneeMobile",
'商品名称': 'goodsName', 收货地址: "consigneeAddress",
'商品价格': 'goodsPrice', 商品名称: "goodsName",
'订单金额': 'flowPrice', 商品价格: "goodsPrice",
'商品数量': 'num', 订单金额: "flowPrice",
'店铺名称': 'storeName', 商品数量: "num",
'创建时间': 'createTime' 店铺名称: "storeName",
} 创建时间: "createTime",
},
}; };
}, },
methods: { methods: {
@ -249,7 +355,7 @@ export default {
}); });
}, },
// //
async exportOrder () { async exportOrder() {
let userInfo = JSON.parse(Cookies.get("userInfoSeller")); let userInfo = JSON.parse(Cookies.get("userInfoSeller"));
const params = { const params = {
// //
@ -263,26 +369,32 @@ export default {
buyerName: "", buyerName: "",
tag: "WAIT_SHIP", tag: "WAIT_SHIP",
orderType: "NORMAL", orderType: "NORMAL",
storeId: userInfo.id storeId: userInfo.id,
} };
const res = await API_Order.queryExportOrder(params) const res = await API_Order.queryExportOrder(params);
if (res.success) { if (res.success) {
if (res.result.length === 0) { if (res.result.length === 0) {
this.$Message.warning('暂无待发货订单') this.$Message.warning("暂无待发货订单");
return [] return [];
} }
for (let i=0; i<res.result.length; i++) { for (let i = 0; i < res.result.length; i++) {
res.result[i].index = i+1; res.result[i].index = i + 1;
res.result[i].consigneeAddress = res.result[i].consigneeAddress =
res.result[i].consigneeAddressPath.replace(/,/g, "") + res.result[i].consigneeDetail res.result[i].consigneeAddressPath.replace(/,/g, "") +
res.result[i].goodsPrice = this.$options.filters.unitPrice(res.result[i].goodsPrice,'¥') res.result[i].consigneeDetail;
res.result[i].flowPrice = this.$options.filters.unitPrice(res.result[i].flowPrice,'¥') res.result[i].goodsPrice = this.$options.filters.unitPrice(
res.result[i].goodsPrice,
"¥"
);
res.result[i].flowPrice = this.$options.filters.unitPrice(
res.result[i].flowPrice,
"¥"
);
} }
return res.result return res.result;
} else { } else {
this.$Message.warning('导出订单失败,请重试') this.$Message.warning("导出订单失败,请重试");
} }
}, },
// //
detail(v) { detail(v) {
@ -298,9 +410,9 @@ export default {
}, },
// KeepAlivefalse // KeepAlivefalse
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false from.meta.keepAlive = false;
next() next();
} },
}; };
</script> </script>
<style lang="scss"> <style lang="scss">