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

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/
/dist/
*/dist/
.DS_Store
node_modules/
yarn.lock

View File

@ -1,27 +1,65 @@
<template>
<div>
<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">
<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 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 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="PINTUAN">拼团订单</Option>
<Option value="GIFT">赠品订单</Option>
<Option value="VIRTUAL">核验订单</Option>
<Option value="POINTS">积分订单</Option>
<Option value="KANJIA">砍价订单</Option>
</Select>
</Form-item>
<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 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="PAID">已付款</Option>
<Option value="UNDELIVERED">待发货</Option>
@ -31,24 +69,50 @@
<Option value="CANCELLED">已取消</Option>
</Select>
</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>
<div>
<download-excel class="export-excel-wrapper" :data="data" :fields="fields" :fetch="exportOrder" name="商品订单.xls">
<Button type="info" class="export">
导出订单
</Button>
<download-excel
class="export-excel-wrapper"
:data="data"
:fields="fields"
:fetch="exportOrder"
name="商品订单.xls"
>
<Button type="info" class="export"> 导出订单 </Button>
</download-excel>
</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">
<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>
<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>
</Card>
</div>
</template>
@ -139,17 +203,29 @@ export default {
},
{
title: "订单类型",
key: "orderType",
key: "orderPromotionType",
width: 120,
render: (h, params) => {
if (params.row.orderType == "NORMAL") {
return h("div", [h("tag", {props: {color: "blue"}}, "普通订单")]);
} else if (params.row.orderType == "PINTUAN") {
return h("div", [h("tag", {props: {color: "volcano"}}, "拼团订单")]);
} else if (params.row.orderType == "GIFT") {
return h("div", [h("tag", {props: {color: "green"}}, "赠品订单")]);
} else if (params.row.orderType == "VIRTUAL") {
return h("div", [h("tag", {props: {color: "geekblue"}}, "核验订单")]);
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" } }, "砍价订单"),
]);
}
},
},
@ -179,19 +255,33 @@ export default {
minWidth: 100,
render: (h, params) => {
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") {
return h("div", [h("tag", {props: {color: "blue"}}, "已付款")]);
return h("div", [
h("tag", { props: { color: "blue" } }, "已付款"),
]);
} 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") {
return h("div", [h("tag", {props: {color: "cyan"}}, "已发货")]);
return h("div", [
h("tag", { props: { color: "cyan" } }, "已发货"),
]);
} 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") {
return h("div", [h("tag", {props: {color: "volcano"}}, "待核验")]);
return h("div", [
h("tag", { props: { color: "volcano" } }, "待核验"),
]);
} 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",
width: 100,
render: (h, params) => {
return h("Button", {props: {type: "info", size: "small",},
style: {marginRight: "5px",},
on: {click: () => {this.detail(params.row);},},
}, "查看"
)
return h(
"Button",
{
props: { type: "info", size: "small" },
style: { marginRight: "5px" },
on: {
click: () => {
this.detail(params.row);
},
},
},
"查看"
);
},
},
],
@ -270,23 +368,22 @@ export default {
},
//
async exportOrder() {
const params = JSON.parse(JSON.stringify(this.searchForm))
const params = JSON.parse(JSON.stringify(this.searchForm));
params.pageNumber = 1;
params.pageSize = 10000
const result = await API_Order.getOrderList(params)
params.pageSize = 10000;
const result = await API_Order.getOrderList(params);
if (result.success) {
if (result.result.records.length === 0) {
this.$Message.warning('暂无待发货订单')
return []
this.$Message.warning("暂无待发货订单");
return [];
} else {
return result.result.records
return result.result.records;
}
} else {
this.$Message.warning('导出订单失败,请重试')
}
this.$Message.warning("导出订单失败,请重试");
}
},
},
mounted() {
this.init();
},
@ -299,5 +396,4 @@ export default {
.export-excel-wrapper {
display: inline;
}
</style>

View File

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

View File

@ -1,15 +1,38 @@
<template>
<div class="search">
<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">
<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 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 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="PAID">已付款</Option>
<Option value="UNDELIVERED">待发货</Option>
@ -18,10 +41,34 @@
<Option value="CANCELLED">已取消</Option>
</Select>
</Form-item>
<Form-item label="下单时间">
<DatePicker v-model="selectDate" type="datetimerange" format="yyyy-MM-dd" clearable @on-change="selectDateRange" placeholder="选择起始时间" style="width: 160px"></DatePicker>
<Form-item label="订单类型" prop="orderType">
<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>
<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>
</Form>
<div class="export">
@ -29,7 +76,7 @@
批量发货
</Button>
<download-excel
style="display:inline-block;"
style="display: inline-block"
:data="data"
:fields="excelColumns"
:fetch="exportOrder"
@ -38,10 +85,26 @@
<Button>导出待发货订单</Button>
</download-excel>
</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">
<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>
<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>
</Card>
</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: "买家名称",
key: "memberName",
@ -123,26 +214,40 @@ export default {
minWidth: 100,
render: (h, params) => {
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") {
return h("div", [h("tag", {props: {color: "blue"}}, "已付款")]);
return h("div", [
h("tag", { props: { color: "blue" } }, "已付款"),
]);
} 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") {
return h("div", [h("tag", {props: {color: "cyan"}}, "已发货")]);
return h("div", [
h("tag", { props: { color: "cyan" } }, "已发货"),
]);
} 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") {
return h("div", [h("tag", {props: {color: "volcano"}}, "待核验")]);
return h("div", [
h("tag", { props: { color: "volcano" } }, "待核验"),
]);
} else if (params.row.orderStatus == "CANCELLED") {
return h("div", [h("tag", {props: {color: "red"}}, "已取消")]);
return h("div", [
h("tag", { props: { color: "red" } }, "已取消"),
]);
}
},
},
{
title: "下单时间",
key: "createTime",
width: 170
width: 170,
},
{
title: "操作",
@ -175,19 +280,20 @@ export default {
],
data: [], //
total: 0, //
excelColumns: { // excel
'编号': 'index',
'订单号': 'sn',
'收货人': 'consigneeName',
'收货人联系电话': 'consigneeMobile',
'收货地址': 'consigneeAddress',
'商品名称': 'goodsName',
'商品价格': 'goodsPrice',
'订单金额': 'flowPrice',
'商品数量': 'num',
'店铺名称': 'storeName',
'创建时间': 'createTime'
}
excelColumns: {
// excel
编号: "index",
订单号: "sn",
收货人: "consigneeName",
收货人联系电话: "consigneeMobile",
收货地址: "consigneeAddress",
商品名称: "goodsName",
商品价格: "goodsPrice",
订单金额: "flowPrice",
商品数量: "num",
店铺名称: "storeName",
创建时间: "createTime",
},
};
},
methods: {
@ -263,26 +369,32 @@ export default {
buyerName: "",
tag: "WAIT_SHIP",
orderType: "NORMAL",
storeId: userInfo.id
}
const res = await API_Order.queryExportOrder(params)
storeId: userInfo.id,
};
const res = await API_Order.queryExportOrder(params);
if (res.success) {
if (res.result.length === 0) {
this.$Message.warning('暂无待发货订单')
return []
this.$Message.warning("暂无待发货订单");
return [];
}
for (let i = 0; i < res.result.length; i++) {
res.result[i].index = i + 1;
res.result[i].consigneeAddress =
res.result[i].consigneeAddressPath.replace(/,/g, "") + res.result[i].consigneeDetail
res.result[i].goodsPrice = this.$options.filters.unitPrice(res.result[i].goodsPrice,'¥')
res.result[i].flowPrice = this.$options.filters.unitPrice(res.result[i].flowPrice,'¥')
res.result[i].consigneeAddressPath.replace(/,/g, "") +
res.result[i].consigneeDetail;
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 {
this.$Message.warning('导出订单失败,请重试')
this.$Message.warning("导出订单失败,请重试");
}
},
//
detail(v) {
@ -298,9 +410,9 @@ export default {
},
// KeepAlivefalse
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false
next()
}
from.meta.keepAlive = false;
next();
},
};
</script>
<style lang="scss">