You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1403 lines
38 KiB

<style lang="less">
@import "@/styles/table-common.less";
@import "./orderManage.less";
.refund-goods-row {
display: flex;
align-items: center;
padding: 10px 0;
border-bottom: 1px solid #eee;
}
.refund-goods-name {
flex: 1;
}
.refund-goods-num {
width: 80px;
text-align: center;
}
.refund-goods-price {
width: 100px;
text-align: right;
}
.refund-goods-empty {
padding: 30px 0;
color: #999;
text-align: center;
}
.group-order-card {
margin-bottom: 12px;
padding: 12px;
border: 1px solid #eee;
border-radius: 6px;
}
.group-order-head,
.group-order-row,
.group-goods-row {
display: flex;
align-items: center;
padding: 6px 0;
}
.group-order-code {
flex: 1;
font-weight: 700;
}
.group-order-status {
color: #ff6b35;
font-weight: 700;
}
.group-order-row span:first-child {
width: 80px;
color: #777;
}
.group-order-fee {
padding-top: 8px;
text-align: right;
}
.feedback-preview {
text-align: center;
}
.feedback-preview-img {
max-width: 100%;
max-height: 70vh;
border-radius: 4px;
}
.feedback-preview-actions {
display: flex;
align-items: center;
justify-content: center;
margin-top: 12px;
gap: 12px;
}
.refund-type-status-wrap {
display: inline-block;
max-width: 100%;
white-space: normal;
word-break: break-all;
line-height: 20px;
}
.search-date-row {
display: inline-flex;
align-items: flex-start;
white-space: nowrap;
vertical-align: top;
}
</style>
<template>
<div class="search">
<Card>
<Tabs v-model="tabName" :animated="false" @on-click="changeOrderTab">
<TabPane v-for="item in orderTypeTabs" :key="item.name" :label="getOrderTypeTabLabel(item)" :name="item.name"></TabPane>
</Tabs>
<Tabs v-if="!isRefundTab && !isFeedbackTab" v-model="tabName1" :animated="false" @on-click="changeTab">
<TabPane v-for="item in currentStatusTabs" :key="item.name" :label="item.label" :name="item.name"></TabPane>
</Tabs>
<Row v-show="openSearch" @keydown.enter.native="handleSearch">
<Form ref="searchForm" :model="searchForm" inline :label-width="100">
<FormItem label="订单编号" prop="id">
<Input type="text" v-model="searchForm.id" clearable placeholder="请输入订单编号"
style="width: 200px" />
</FormItem>
<FormItem label="店铺名称" prop="shopName">
<Input type="text" v-model="searchForm.shopName" clearable placeholder="请输入店铺名称"
style="width: 200px" />
</FormItem>
<FormItem label="收货人手机号" prop="receiverPhone">
<Input type="text" v-model="searchForm.receiverPhone" clearable placeholder="请输入收货人手机号"
style="width: 200px" />
</FormItem>
<div class="search-date-row">
<FormItem label="开始日期" prop="startDate">
<DatePicker type="date" v-model="searchForm.startDate" clearable placeholder="请选择开始日期"
format="yyyy-MM-dd" @on-change="searchForm.startDate = $event" style="width: 200px" />
</FormItem>
<FormItem label="结束日期" prop="endDate">
<DatePicker type="date" v-model="searchForm.endDate" clearable placeholder="请选择结束日期"
format="yyyy-MM-dd" @on-change="searchForm.endDate = $event" style="width: 200px" />
</FormItem>
</div>
<FormItem style="margin-left: -35px" class="br">
<Button @click="handleSearch" type="primary" icon="ios-search">搜索</Button>
<Button @click="handleReset">重置</Button>
</FormItem>
</Form>
</Row>
<Row align="middle" justify="space-between" class="operation">
<div class="icons">
<Tooltip content="刷新" placement="top" transfer>
<Icon type="md-refresh" size="18" class="item" @click="refreshWholePage" />
</Tooltip>
<Tooltip :content="openSearch ? '关闭搜索' : '开启搜索'" placement="top" transfer>
<Icon type="ios-search" size="18" class="item tip" @click="openSearch = !openSearch" />
</Tooltip>
<!-- <Tooltip :content="openTip ? '关闭提示' : '开启提示'" placement="top" transfer>
<Icon type="md-bulb" size="18" class="item tip" @click="openTip = !openTip" />
</Tooltip> -->
<Tooltip content="表格密度" placement="top" transfer>
<Dropdown @on-click="changeTableSize" trigger="click">
<Icon type="md-list" size="18" class="item" />
<DropdownMenu slot="list">
<DropdownItem :selected="tableSize == 'default'" name="default">默认</DropdownItem>
<DropdownItem :selected="tableSize == 'large'" name="large">宽松</DropdownItem>
<DropdownItem :selected="tableSize == 'small'" name="small">紧密</DropdownItem>
</DropdownMenu>
</Dropdown>
</Tooltip>
</div>
</Row>
<Alert show-icon v-show="openTip">
已选择
<span class="select-count">{{ selectList.length }}</span> 项
<a class="select-clear" @click="clearSelectAll">清空</a>
</Alert>
<Table class="order-manage-table" :loading="loading" border :columns="currentColumns" :data="data" :size="tableSize" sortable="custom"
@on-sort-change="changeSort" @on-selection-change="showSelect" ref="table"></Table>
<Row type="flex" justify="end" class="page">
<Page :current="currentPageNum" :total="total" :page-size="currentPageSize"
@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>
<!-- 订单详情 -->
<Modal title="订单详情" v-model="Visiable" :mask-closable="true" :scrollabele="true" :width="1000">
<logistics-address v-if="Visiable" @closePage="closePage" ref="dialog"></logistics-address>
<div slot="footer" v-show="Visiable">
<Button type="text" @click="Visiable = false">关闭</Button>
</div>
</Modal>
<addEdit :data="form" :type="showType" v-model="showOrder" @on-submit="getLogisticsInfo" />
<Modal title="拒绝原因" v-model="rejectModalVisible" :mask-closable="false" :width="520">
<Input type="textarea" v-model="rejectReason" :rows="4" maxlength="100" show-word-limit placeholder="请输入拒绝原因" />
<div slot="footer">
<Button @click="closeRejectModal">取消</Button>
<Button type="primary" :loading="submitLoading" @click="confirmReject">确认拒绝</Button>
</div>
</Modal>
<Modal title="商品详情" v-model="refundGoodsVisible" :mask-closable="false" :width="680">
<div v-if="refundGoodsList.length > 0">
<div class="refund-goods-row" v-for="(item,index) in refundGoodsList" :key="index">
<div class="refund-goods-name">{{ item.productName }}</div>
<div class="refund-goods-num">X{{ item.quantity }}</div>
<div class="refund-goods-price">¥{{ item.price }}</div>
</div>
</div>
<div v-else class="refund-goods-empty">暂无商品详情</div>
<div slot="footer">
<Button type="primary" @click="refundGoodsVisible = false">关闭</Button>
</div>
</Modal>
<Modal title="拼团详情" v-model="groupOrderVisible" :mask-closable="false" :width="760">
<div v-if="groupOrderList.length > 0">
<div class="group-order-card" v-for="(item,index) in groupOrderList" :key="index">
<div class="group-order-head">
<div class="group-order-code">订单-{{ item.numberCode || item.id }}</div>
<div class="group-order-status">{{ getOrderStatusText(item) }}</div>
</div>
<div class="group-order-row">
<span>订单号</span>
<span>{{ item.id }}</span>
</div>
<div class="group-order-row">
<span>订单时间</span>
<span>{{ formatDateTime(item.createTime) }}</span>
</div>
<div class="group-goods-row" v-for="(goods,goodsIndex) in item.goodsList" :key="goodsIndex">
<div class="refund-goods-name">{{ goods.productName }}</div>
<div class="refund-goods-num">X{{ goods.quantity }}</div>
<div class="refund-goods-price">¥{{ goods.price }}</div>
</div>
<div class="group-order-fee">配送费:¥{{ item.deliveryFee || 0 }}</div>
</div>
</div>
<div v-else class="refund-goods-empty">暂无拼团订单</div>
<div slot="footer">
<Button type="primary" @click="groupOrderVisible = false">关闭</Button>
</div>
</Modal>
<Modal title="投诉吐槽详情" v-model="feedbackDetailVisible" :mask-closable="false" :width="720">
<Form :label-width="90">
<FormItem label="反馈类型">{{ feedbackDetail.feedbackType || "投诉吐槽" }}</FormItem>
<FormItem label="反馈用户">{{ feedbackDetail.userName || feedbackDetail.userId || "未知用户" }}</FormItem>
<FormItem label="联系电话">{{ feedbackDetail.contactPhone || "无" }}</FormItem>
<FormItem label="所属区域">{{ feedbackDetail.regionName || feedbackDetail.regionId || "无" }}</FormItem>
<FormItem label="反馈内容">{{ feedbackDetail.problemContent || "无" }}</FormItem>
<FormItem label="反馈图片">
<a v-if="getPictureList(feedbackDetail.problemPicture).length > 0" @click="previewFeedbackImage(feedbackDetail.problemPicture)">查看图片</a>
<span v-else>无</span>
</FormItem>
<FormItem label="提交时间">{{ formatDateTime(feedbackDetail.createTime) }}</FormItem>
<FormItem label="处理意见">
<Input type="textarea" v-model="feedbackReplyContent" :rows="4" maxlength="300" show-word-limit
:disabled="feedbackDetail.status == 1" placeholder="请输入处理意见" />
</FormItem>
<FormItem v-if="feedbackDetail.status == 1" label="处理时间">{{ formatDateTime(feedbackDetail.handleTime) }}</FormItem>
</Form>
<div slot="footer">
<Button @click="feedbackDetailVisible = false">关闭</Button>
<Button v-if="feedbackDetail.status != 1" type="primary" :loading="feedbackSubmitLoading" @click="submitFeedbackReply">回复</Button>
</div>
</Modal>
<Modal title="图片预览" v-model="feedbackPreviewVisible" :footer-hide="true" :width="760">
<div class="feedback-preview" v-if="feedbackPreviewList.length > 0">
<img class="feedback-preview-img" :src="feedbackPreviewList[feedbackPreviewIndex]" />
<div class="feedback-preview-actions" v-if="feedbackPreviewList.length > 1">
<Button size="small" @click="changeFeedbackPreview(-1)">上一张</Button>
<span>{{ feedbackPreviewIndex + 1 }} / {{ feedbackPreviewList.length }}</span>
<Button size="small" @click="changeFeedbackPreview(1)">下一张</Button>
</div>
</div>
</Modal>
</div>
</template>
<script>
import {
getOrderList,
getReturnOrderList,
returnOrNoOrder,
getGroupOrdersByOrderId,
getProblemFeedbackList,
replyProblemFeedback
} from "@/api/index";
import addEdit from "./addEdit.vue";
import logisticsAddress from "@/views/sys/order-manage/logisticsAddress";
export default {
name: "order-manage",
components: {
addEdit,
logisticsAddress,
},
data() {
return {
tableSize: "default",
Visiable: false,
showOrder: false,
showType: "0",
openSearch: true,
openTip: true,
loading: true,
refundTodoCount: 0,
rejectModalVisible: false,
rejectReason: "",
rejectItem: null,
submitLoading: false,
submitRefundId: "",
refundGoodsVisible: false,
refundGoodsList: [],
groupOrderVisible: false,
groupOrderList: [],
feedbackTodoCount: 0,
feedbackDetailVisible: false,
feedbackDetail: {},
feedbackReplyContent: "",
feedbackSubmitLoading: false,
feedbackPreviewVisible: false,
feedbackPreviewList: [],
feedbackPreviewIndex: 0,
drop: false,
dropDownContent: "展开",
dropDownIcon: "ios-arrow-down",
selectList: [],
tabName: "1",
tabName1: "10",
statusTabOrder: ["10", "0", "1", "2", "13", "3", "4", "5", "6", "8", "9", "11", "12"],
orderTypeTabs: [{
label: "饭团订单",
name: "1"
},
{
label: "快递跑腿订单",
name: "2"
},
{
label: "团购订单",
name: "3"
},
{
label: "二手订单",
name: "4"
},
{
label: "待退款/售后",
name: "refund",
badge: true
},
{
label: "投诉吐槽",
name: "feedback",
badge: true
}
],
statusTabs: [{
label: "待支付",
name: "0"
},
{
label: "待成团",
name: "1"
},
{
label: "待消费",
name: "2"
},
{
label: "待出餐",
name: "13"
},
{
label: "全部",
name: "10"
},
{
label: "待接单",
name: "3"
},
{
label: "待取货",
name: "4"
},
{
label: "待送达",
name: "5"
},
{
label: "已完成",
name: "6"
},
{
label: "已退款",
name: "8"
},
{
label: "已取消",
name: "9"
},
{
label: "售后中",
name: "11"
},
{
label: "已售后",
name: "12"
}
],
groupStatusTabs: [{
label: "待支付",
name: "0"
},
{
label: "待成团",
name: "1"
},
{
label: "待消费",
name: "2"
},
{
label: "待出餐",
name: "13"
},
{
label: "全部",
name: "10"
},
{
label: "已完成",
name: "6"
},
{
label: "已退款",
name: "8"
},
{
label: "已取消",
name: "9"
},
{
label: "售后中",
name: "11"
},
{
label: "已售后",
name: "12"
}
],
deliveryStatusTabs: [{
label: "全部",
name: "10"
},
{
label: "待接单",
name: "3"
},
{
label: "待取货",
name: "4"
},
{
label: "待送达",
name: "5"
},
{
label: "已完成",
name: "6"
},
{
label: "已退款",
name: "8"
},
{
label: "已取消",
name: "9"
},
{
label: "售后中",
name: "11"
},
{
label: "已售后",
name: "12"
}
],
returnForm:{
regionId: JSON.parse(this.getStore("user")).departmentId,
pageNum: 1,
pageSize: 10,
statusList: [0, 3],
},
refundCountForm:{
regionId: JSON.parse(this.getStore("user")).departmentId,
pageNum: 1,
pageSize: 100,
statusList: [0, 3],
},
feedbackForm: {
regionId: JSON.parse(this.getStore("user")).departmentId,
pageNum: 1,
pageSize: 10
},
feedbackCountForm: {
regionId: JSON.parse(this.getStore("user")).departmentId,
pageNum: 1,
pageSize: 1,
status: 0
},
searchForm: {
id: "",
pageNum: 1,
pageSize: 10,
regionId: JSON.parse(this.getStore("user")).departmentId,
searchType: "1",
searchStatus:10,
shopName: "",
receiverPhone: "",
startDate: "",
endDate: "",
mobile:'',
userId: ""
},
form: {},
columns: [{
type: "index",
width: 60,
align: "center",
fixed: "left",
},
{
title: "订单状态",
key: "status",
width: 130,
align: "center",
render: (h, params) => {
let re = ""
if (params.row.status == 0) {
re = "待支付";
} else if (params.row.status == 2) {
re = "待接单";
} else if (params.row.otherOrder == null && params.row.status == 3 && params.row.deliveryType == 1 && params.row.shopMakeTime != null) {
re = "待取货";
} else if (params.row.otherOrder == null && params.row.status == 3 && params.row.deliveryType == 1 && params.row.shopMakeTime == null) {
re = "待出餐";
} else if (params.row.otherOrder != null && params.row.status == 3 && params.row.deliveryType == 1) {
re = "待取货";
} else if (params.row.status == 3 && params.row.deliveryType == 2) {
re = "待消费";
} else if (params.row.status == 4) {
re = "待送达";
} else if (params.row.status == 5) {
re = "已完成";
} else if (params.row.status == 6) {
re = "已取消";
} else if (params.row.status == 7) {
re = "待退款";
} else if (params.row.status == 8) {
re = "已退款";
} else if (params.row.status == 10) {
re = "待成团";
} else if (params.row.status == 11) {
re = "售后中";
} else if (params.row.status == 12) {
re = "已售后";
}
return h(
"div",
re
);
}
},
{
title: "预计送达时间",
key: "mustFinishTime",
width: 200,
align: "center",
render: (h, params) => {
if (params.row.deliveryType != 1 || !params.row.deliveryInfo) {
return h("div", "");
}
return h(
"div",
this.formatDateTime(params.row.deliveryInfo.mustFinishTime)
);
}
},
{
title: "用户账号",
key: "receiverPhone",
width: 130,
align: "center",
},
{
title: "店铺名称",
key: "shopName",
width: 230,
align: "center",
},
{
title: "配送费",
key: "deliveryFee",
width: 130,
align: "center",
},
{
title: "订单总金额",
key: "totalAmount",
width: 130,
align: "center",
},
{
title: "完成支付时间",
key: "createTime",
minWidth: 180,
align: "center",
render: (h, params) => {
return h(
"div",
this.formatDateTime(params.row.createTime)
);
}
},
{
title: "操作",
key: "action",
width: 170,
align: "center",
fixed: "right",
render: (h, params) => {
return h("div", [
h(
"a", {
on: {
click: () => {
this.showDetail(params.row);
},
},
},
"查看详情"
),
]);
},
},
],
refundColumns: [{
type: "index",
width: 60,
align: "center",
fixed: "left",
},
{
title: "订单编号",
key: "orderId",
width: 190,
align: "center",
render: (h, params) => {
const order = params.row.mallOrder || {};
return h("span", order.numberCode || params.row.orderId || "");
}
},
{
title: "用户账号",
width: 130,
align: "center",
render: (h, params) => {
const order = params.row.mallOrder || {};
return h("span", order.receiverPhone || "");
}
},
{
title: "店铺名称",
width: 180,
align: "center",
render: (h, params) => {
const order = params.row.mallOrder || {};
return h("span", order.shopName || "");
}
},
{
title: "申请时间",
key: "createTime",
width: 180,
align: "center",
render: (h, params) => {
return h("span", this.formatDateTime(params.row.createTime));
}
},
{
title: "状态",
key: "status",
width: 110,
align: "center",
render: (h, params) => {
return h("span", this.getRefundStatusText(params.row.status));
}
},
{
title: "退款类型",
key: "refundType",
width: 120,
align: "center",
render: (h, params) => {
return h("span", this.getRefundTypeText(params.row.refundType));
}
},
{
title: "退款/售后原因",
key: "reason",
minWidth: 220,
align: "center",
render: (h, params) => {
return h("Tooltip", {
props: {
content: params.row.reason || "无",
transfer: true,
}
}, [h("span", params.row.reason || "无")]);
}
},
{
title: "退款责任方",
key: "refundTypeStatus",
width: 210,
align: "center",
render: (h, params) => {
return h("span", {
class: "refund-type-status-wrap"
}, this.getRefundTypeStatusText(params.row.refundTypeStatus));
}
},
{
title: "原因图片",
key: "pictures",
width: 90,
align: "center",
render: (h, params) => {
if (this.getPictureList(params.row.pictures).length == 0) {
return h("span", "无");
}
return h("a", {
on: {
click: () => {
this.previewRefundImage(params.row.pictures);
},
},
}, "查看");
}
},
{
title: "退款金额",
key: "refundAmount",
width: 120,
align: "center",
render: (h, params) => {
return h("span", `¥${params.row.refundAmount || 0}`);
}
},
{
title: "操作",
key: "action",
width: 390,
align: "center",
fixed: "right",
render: (h, params) => {
const order = params.row.mallOrder || {};
const actionList = [
/* h("a", {
style: {
marginRight: "8px"
},
on: {
click: () => {
this.showRefundGoods(params.row);
},
},
}, order.otherOrder == 1 ? "快递/跑腿单" : "查看商品"), */
];
if (order && order.orderType != 1) {
actionList.push(
h("a", {
style: {
marginRight: "8px"
},
on: {
click: () => {
this.getGroupOrders(order.id || params.row.orderId);
},
},
}, "拼团详情")
);
}
actionList.push(
h("a", {
style: {
marginRight: "8px"
},
on: {
click: () => {
this.showOrderDetail(params.row);
},
},
}, "查看详情")
/* h("a", {
style: {
marginRight: "8px"
},
on: {
click: () => {
this.returnAmountAllow(params.row, 0);
},
},
}, this.isSubmittingRefund(params.row) ? "处理中" : "不同意"),
h("a", {
on: {
click: () => {
this.returnAmountAllow(params.row, 1);
},
},
}, this.isSubmittingRefund(params.row) ? "处理中" : "同意"), */
);
return h("div", actionList);
},
},
],
feedbackColumns: [{
type: "index",
width: 60,
align: "center",
fixed: "left",
},
{
title: "反馈类型",
key: "feedbackType",
width: 110,
align: "center",
render: (h, params) => {
return h("span", params.row.feedbackType || "投诉吐槽");
}
},
{
title: "反馈用户",
key: "userName",
width: 150,
align: "center",
render: (h, params) => {
return h("span", params.row.userName || params.row.userId || "");
}
},
{
title: "联系电话",
key: "contactPhone",
width: 130,
align: "center",
},
{
title: "反馈内容",
key: "problemContent",
minWidth: 260,
align: "center",
render: (h, params) => {
return h("Tooltip", {
props: {
content: params.row.problemContent || "无",
transfer: true,
}
}, [h("span", params.row.problemContent || "无")]);
}
},
{
title: "状态",
key: "status",
width: 100,
align: "center",
render: (h, params) => {
return h("span", params.row.status == 1 ? "已回复" : "待回复");
}
},
{
title: "提交时间",
key: "createTime",
width: 180,
align: "center",
render: (h, params) => {
return h("span", this.formatDateTime(params.row.createTime));
}
},
{
title: "处理意见",
key: "handleOpinion",
minWidth: 200,
align: "center",
render: (h, params) => {
return h("span", params.row.handleOpinion || "未回复");
}
},
{
title: "操作",
key: "action",
width: 130,
align: "center",
fixed: "right",
render: (h, params) => {
return h("a", {
on: {
click: () => {
this.showFeedbackDetail(params.row);
},
},
}, params.row.status == 1 ? "查看详情" : "查看/回复");
},
},
],
data: [],
total: 0,
};
},
computed: {
colHidden: function() {
return this.columns.filter(function(e) {
return !e.hidden;
})
},
availableStatusTabs() {
return this.getStatusTabsByType(this.searchForm.searchType);
},
currentStatusTabs() {
return this.sortStatusTabs(this.availableStatusTabs);
},
currentColumns() {
if (this.isRefundTab) return this.refundColumns;
if (this.isFeedbackTab) return this.feedbackColumns;
return this.columns;
},
isRefundTab() {
return this.tabName == "refund";
},
isFeedbackTab() {
return this.tabName == "feedback";
},
currentPageNum() {
if (this.isRefundTab) return this.returnForm.pageNum;
if (this.isFeedbackTab) return this.feedbackForm.pageNum;
return this.searchForm.pageNum;
},
currentPageSize() {
if (this.isRefundTab) return this.returnForm.pageSize;
if (this.isFeedbackTab) return this.feedbackForm.pageSize;
return this.searchForm.pageSize;
}
},
mounted() {
this.init();
},
methods: {
init() {
this.getRefundTodoCount();
this.getFeedbackTodoCount();
this.getLogisticsInfo()
},
closePage(){
this.Visiable = false;
this.getLogisticsInfo()
},
formatDateTime(isoString) {
if (!isoString) return ''
const date = new Date(isoString)
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
},
getOrderTypeTabLabel(item) {
if (item.name == "refund") {
return this.renderRefundTabLabel;
}
if (item.name == "feedback") {
return this.renderFeedbackTabLabel;
}
return item.label;
},
renderRefundTabLabel(h) {
return h("Badge", {
props: {
count: this.refundTodoCount,
overflowCount: 99
}
}, [
h("span", {
class: "order-tab-label"
}, "待退款/售后")
]);
},
renderFeedbackTabLabel(h) {
return h("Badge", {
props: {
count: this.feedbackTodoCount,
overflowCount: 99
}
}, [
h("span", {
class: "order-tab-label"
}, "投诉吐槽")
]);
},
getOrderStatusText(item) {
if (!item) return "";
if (item.status == 0) return "待支付";
if (item.status == 2) return "待配送员接单";
if (item.status == 3 && item.deliveryType == 1 && item.shopMakeTime == null) return "待出餐";
if (item.status == 3 && item.deliveryType == 1 && item.shopMakeTime != null) return "待取货";
if (item.status == 3 && item.deliveryType == 2) return "待消费";
if (item.status == 4) return "待送达";
if (item.status == 5) return "已完成";
if (item.status == 7) return "待同意退款";
if (item.status == 8) return "已退款";
if (item.status == 6) return "已取消";
if (item.status == 11) return "售后中";
if (item.status == 12) return "已售后";
return "";
},
getMonth() {
let date = new Date()
let year = date.getFullYear().toString() //'年'
let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : (date.getMonth() + 1)
.toString() //'月'
let da = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate().toString() //'日'
let single = year + '-' + month + '-' + da //当天
return single
},
//订单状态切换2
changeTab(v) {
this.searchForm.pageNum = 1;
this.searchForm.searchStatus = v;
this.getLogisticsInfo();
},
//订单状态切换1
changeOrderTab(v){
this.searchForm.pageNum = 1;
this.returnForm.pageNum = 1;
this.feedbackForm.pageNum = 1;
if (v == "refund") {
this.getReturnOrder();
return;
}
if (v == "feedback") {
this.getProblemFeedback();
return;
}
this.searchForm.searchType = v
if (!this.availableStatusTabs.some((item) => item.name == this.tabName1)) {
this.tabName1 = this.getDefaultStatusTabName(v);
this.searchForm.searchStatus = this.tabName1;
}
this.getLogisticsInfo()
},
getStatusTabsByType(type) {
if (type == "2") return this.deliveryStatusTabs;
if (type == "3" || type == "4") return this.groupStatusTabs;
return this.statusTabs;
},
sortStatusTabs(tabs) {
return tabs.slice().sort((a, b) => {
const aIndex = this.statusTabOrder.indexOf(a.name);
const bIndex = this.statusTabOrder.indexOf(b.name);
return (aIndex == -1 ? Number.MAX_SAFE_INTEGER : aIndex) - (bIndex == -1 ? Number.MAX_SAFE_INTEGER : bIndex);
});
},
getDefaultStatusTabName(type) {
const defaultStatusMap = {
"2": "10",
"3": "10",
"4": "10"
};
const statusTabs = this.availableStatusTabs;
const defaultStatus = defaultStatusMap[type];
if (defaultStatus && statusTabs.some((item) => item.name == defaultStatus)) return defaultStatus;
return statusTabs[0].name;
},
checkStatus(v) {
this.searchForm.orderStatus = v
},
changePage(v) {
if (this.isRefundTab) {
this.returnForm.pageNum = v;
} else if (this.isFeedbackTab) {
this.feedbackForm.pageNum = v;
} else {
this.searchForm.pageNum = v;
}
this.getLogisticsInfo();
this.clearSelectAll();
},
changePageSize(v) {
if (this.isRefundTab) {
this.returnForm.pageSize = v;
} else if (this.isFeedbackTab) {
this.feedbackForm.pageSize = v;
} else {
this.searchForm.pageSize = v;
}
this.getLogisticsInfo();
},
changeTableSize(v) {
this.tableSize = v;
},
//查询订单
getReturnOrder() {
this.loading = true;
getReturnOrderList(this.returnForm).then((res) => {
this.loading = false;
if (res.success) {
this.data = res.result.records || [];
this.total = res.result.total;
this.refundTodoCount = res.result.total;
}
}).catch(() => {
this.loading = false;
});
},
getRefundTodoCount() {
getReturnOrderList(this.refundCountForm).then((res) => {
if (res.success && res.result) {
this.refundTodoCount = res.result.total || (res.result.records || []).length;
}
});
},
getFeedbackTodoCount() {
getProblemFeedbackList(this.feedbackCountForm).then((res) => {
if (res.success && res.result) {
this.feedbackTodoCount = res.result.total || (res.result.records || []).length;
}
});
},
getProblemFeedback() {
this.loading = true;
getProblemFeedbackList(this.feedbackForm).then((res) => {
this.loading = false;
if (res.success) {
this.data = (res.result && res.result.records) || [];
this.total = (res.result && res.result.total) || 0;
}
}).catch(() => {
this.loading = false;
});
},
//查询订单
getLogisticsInfo() {
if (this.isRefundTab) {
this.getReturnOrder();
return;
}
if (this.isFeedbackTab) {
this.getProblemFeedback();
return;
}
this.loading = true;
getOrderList(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
this.data = res.result.records
this.total = res.result.total;
}
}).catch(() => {
this.loading = false;
});
},
handleSearch() {
if (this.isRefundTab) {
this.returnForm.pageNum = 1;
this.returnForm.pageSize = 10;
} else if (this.isFeedbackTab) {
this.feedbackForm.pageNum = 1;
this.feedbackForm.pageSize = 10;
} else {
this.searchForm.pageNum = 1;
this.searchForm.pageSize = 10;
}
this.getLogisticsInfo();
},
handleReset() {
this.$refs.searchForm.resetFields();
this.searchForm.id = "";
this.searchForm.shopName = "";
this.searchForm.receiverPhone = "";
this.searchForm.startDate = "";
this.searchForm.endDate = "";
this.searchForm.pageNum = 1;
this.searchForm.pageSize = 10;
this.returnForm.pageNum = 1;
this.returnForm.pageSize = 10;
this.feedbackForm.pageNum = 1;
this.feedbackForm.pageSize = 10;
// 重新加载数据
this.getLogisticsInfo();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order == "normal") {
this.searchForm.order = "";
}
this.getLogisticsInfo();
},
showDetail(v) {
// 转换null为""
for (let attr in v) {
if (v[attr] == null) {
v[attr] = "";
}
}
let str = JSON.stringify(v);
let data = JSON.parse(str);
this.Visiable = true;
this.$nextTick(() => {
this.$refs.dialog.initRecharge(data);
});
},
showOrderDetail(row) {
const order = row.mallOrder || {};
this.showDetail({
id: row.orderId,
shopId: order.shopId || row.shopId || "",
status: "",
});
},
getRefundStatusText(status) {
return status == 0 ? "待退款" : status == 3 ? "待售后" : "";
},
getRefundTypeStatusText(status) {
if (status == 1) return "商家原因";
if (status == 2) return "配送原因";
if (status == 3) return "商家/配送都有原因";
if (status == 4) return "平台退款";
return "";
},
getRefundTypeText(type) {
if (type == 1) return "退商品";
if (type == 2) return "退配送费";
if (type == 3) return "全额退款";
return "";
},
getPictureList(pictures) {
if (pictures == null || pictures === "") return [];
if (Array.isArray(pictures)) {
return pictures.filter((item) => item != null && item !== "");
}
return String(pictures).split(",").map((item) => item.trim()).filter((item) => item !== "");
},
previewRefundImage(pictures) {
const list = this.getPictureList(pictures);
if (list.length == 0) return;
window.open(list[0], "_blank");
},
previewFeedbackImage(pictures, index = 0) {
const list = this.getPictureList(pictures);
if (list.length == 0) return;
this.feedbackPreviewList = list;
this.feedbackPreviewIndex = index >= 0 && index < list.length ? index : 0;
this.feedbackPreviewVisible = true;
},
changeFeedbackPreview(step) {
if (this.feedbackPreviewList.length == 0) return;
const length = this.feedbackPreviewList.length;
this.feedbackPreviewIndex = (this.feedbackPreviewIndex + step + length) % length;
},
showFeedbackDetail(row) {
this.feedbackDetail = Object.assign({}, row);
this.feedbackReplyContent = row.handleOpinion || "";
this.feedbackDetailVisible = true;
},
submitFeedbackReply() {
const opinion = (this.feedbackReplyContent || "").trim();
if (opinion == "") {
this.$Message.warning("请输入处理意见");
return;
}
this.feedbackSubmitLoading = true;
replyProblemFeedback({
id: this.feedbackDetail.id,
handleOpinion: opinion
}).then((res) => {
this.feedbackSubmitLoading = false;
if (res.success) {
this.$Message.success(res.message || "回复成功");
this.feedbackDetailVisible = false;
this.refreshWholePage();
} else {
this.$Message.error(res.message || "回复失败");
}
}).catch((err) => {
this.feedbackSubmitLoading = false;
this.$Message.error((err && err.message) || "回复失败");
});
},
refreshWholePage() {
this.getRefundTodoCount();
this.getFeedbackTodoCount();
this.getLogisticsInfo();
},
showRefundGoods(row) {
this.refundGoodsList = row.items || [];
this.refundGoodsVisible = true;
},
getGroupOrders(id) {
if (!id) return;
getGroupOrdersByOrderId(id).then((res) => {
if (res.success) {
this.groupOrderList = res.result || [];
this.groupOrderVisible = true;
} else {
this.$Message.error(res.message || "查询拼团详情失败");
}
});
},
returnAmountAllow(item, status) {
if (this.submitLoading) return;
if (status == 0) {
this.rejectItem = item;
this.rejectReason = "";
this.rejectModalVisible = true;
return;
}
this.submitReturnAmountAllow(item, status);
},
closeRejectModal() {
this.rejectModalVisible = false;
this.rejectReason = "";
this.rejectItem = null;
},
confirmReject() {
const reason = (this.rejectReason || "").trim();
if (reason == "") {
this.$Message.warning("请输入拒绝原因");
return;
}
this.rejectModalVisible = false;
this.submitReturnAmountAllow(this.rejectItem, 0, reason);
},
submitReturnAmountAllow(item, status, rejectReason) {
let titleText = status == 1 ? "确定同意该申请吗?" : "确定拒绝该申请吗?";
this.$Modal.confirm({
title: "提示",
content: titleText,
onOk: () => {
this.processReturn(item, status, rejectReason);
},
});
},
processReturn(item, status, rejectReason) {
if (!item) return;
const order = item.mallOrder || {};
const returnFormData = {
id: item.id,
orderId: item.orderId,
deliveryType: order.deliveryType,
orderType: order.orderType,
refundAmount: item.refundAmount,
refundType: item.refundType,
refundTypeStatus: item.refundTypeStatus,
};
if (item.status == 0) {
returnFormData.status = status == 0 ? 2 : 1;
} else if (item.status == 3) {
returnFormData.status = status == 0 ? 5 : 4;
}
if (status == 0) {
returnFormData.rejectReason = rejectReason;
}
this.submitLoading = true;
this.submitRefundId = item.id;
returnOrNoOrder(returnFormData).then((res) => {
this.submitLoading = false;
this.submitRefundId = "";
if (res.success) {
this.$Message.success(res.message || "处理成功");
this.refreshWholePage();
} else {
this.$Message.error(res.message || "处理失败");
}
}).catch((err) => {
this.submitLoading = false;
this.submitRefundId = "";
this.$Message.error((err && err.message) || "处理失败");
});
},
isSubmittingRefund(item) {
return this.submitLoading && item && this.submitRefundId == item.id;
},
dropDown() {
if (this.drop) {
this.dropDownContent = "展开";
this.dropDownIcon = "ios-arrow-down";
} else {
this.dropDownContent = "收起";
this.dropDownIcon = "ios-arrow-up";
}
this.drop = !this.drop;
},
showSelect(e) {
this.selectList = e;
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
}
};
</script>