<template>
|
<div class="orderTable">
|
<list-condition-template ref="table" :form="listQuery" :dataKey="'orderId'"
|
:formLabel="formLabel" :tableData="tableData" :total="total"
|
:setRowStyle="setRowStyle" @selected="selectItem"
|
:multipleSelected="true" @page-info-change="handlePageInfoChange"
|
:sizes="[50, 100, 150]" :isExistBtn="true"
|
:showFormItem="showFormItem">
|
<template slot="topForm" slot-scope="">
|
<el-col :xs='12' :sm='12' :md='12' :lg='12' :xl='12' :offset="0" style="display: flex;">
|
<el-form-item label="下单时间:" class="start-time-style" prop="startOrderTime"
|
style="flex-grow:1;">
|
<el-date-picker :append-to-body="false" v-model="listQuery.startOrderTime"
|
style="width:calc(100% - 90px);" type="datetime"
|
@change="getStartOrderTime" value-format="yyyy-MM-dd HH:mm:ss"
|
:picker-options="{
|
disabledDate: (time) =>
|
listQuery.endOrderTime &&
|
time.getTime() >=
|
new Date(listQuery.endOrderTime).getTime() + 86400000,
|
selectableRange: limitTime(
|
1,
|
listQuery.endOrderTime,
|
listQuery.startOrderTime
|
),
|
}" placeholder="选择开始时间">
|
</el-date-picker>
|
</el-form-item>
|
<el-form-item label="-" class="end-time-style" prop="endOrderTime" style="flex-grow:1;">
|
<el-date-picker :append-to-body="false" v-model="listQuery.endOrderTime" type="datetime"
|
style="width:calc(100% - 20px);" value-format="yyyy-MM-dd HH:mm:ss"
|
@change="getEndOrderTime" :picker-options="{
|
disabledDate: (time) =>
|
listQuery.startOrderTime &&
|
time.getTime() <=
|
new Date(listQuery.startOrderTime).getTime() - 86400000,
|
selectableRange: limitTime(
|
2,
|
listQuery.startOrderTime,
|
listQuery.endOrderTime
|
),
|
}" placeholder="选择结束时间">
|
</el-date-picker>
|
</el-form-item>
|
</el-col>
|
</template>
|
<template slot="otherElement">
|
<el-col :span="24" :offset="0" style="text-align:center;">
|
<el-button size="mini" type="primary" @click="queryData">查询</el-button>
|
<el-button size="mini" @click="resetQuery">重置</el-button>
|
<el-button type="text" @click.stop="toggleForm">
|
{{showFormItem ? '收起' : '展开'}} <i
|
:class="showFormItem?'el-icon-arrow-up':'el-icon-arrow-down'"></i>
|
</el-button>
|
</el-col>
|
</template>
|
<template slot="operationSection">
|
<!-- <el-button size="mini" type="success" @click="createOrder">手动建单</el-button> -->
|
<div class="operation-style">
|
<el-tooltip class="item" effect="dark" content="默认导出一个月的订单数据" placement="top">
|
<el-button size="mini" class="orderDownload" type="primary" icon="el-icon-download"
|
v-customLoading="{ isLoading: isLoading, percentage: percentage }"
|
@click="exportData">订单导出</el-button>
|
</el-tooltip>
|
<el-radio-group v-model="listQuery.operationStatus" size="small"
|
@change="changeOperationStatus">
|
<el-radio-button v-for="item in orderOperationStatus" :key="item.id"
|
v-show="item.id !== '2'" :label="item.id" class="left-btn-style">
|
{{ item.name }}
|
</el-radio-button>
|
</el-radio-group>
|
<span class="operation-btn">
|
<el-radio-group v-model="operationBtn" size="small" @change="changeOperationBtn">
|
<el-radio-button v-for="item in orderOperationBtn" :key="item.id" :label="item.id">
|
{{ item.name }}
|
</el-radio-button>
|
</el-radio-group>
|
</span>
|
</div>
|
</template>
|
<template slot="columns">
|
<!-- <el-table-column type="selection" align="center" label="全选" label-class-name="hideSelectAll" width="50"></el-table-column> -->
|
<el-table-column type="expand">
|
<template slot-scope="props">
|
<el-table border :data="props.row.orderItemsAll.omsOrderItems">
|
<el-table-column type="index" align="center" label="序号" width="80px">
|
</el-table-column>
|
<el-table-column label="商品图片" align="center">
|
<template slot-scope="scope">
|
<product-img :imgUrl="scope.row.imgUrl"></product-img>
|
</template>
|
</el-table-column>
|
<el-table-column label="商品主编码">
|
<template slot-scope="scope">
|
{{ scope.row.spuNum ? scope.row.spuNum : '-' }}
|
</template>
|
</el-table-column>
|
<el-table-column label="商品名称" prop="spuName">
|
<template slot-scope="scope">
|
<span class="giftStyle" v-if="scope.row.promotionType === '2'">赠</span>
|
<span class="giftStyle"
|
v-if="scope.row.refundStatus && scope.row.refundStatus!== '00'">
|
退
|
</span>
|
<span>{{ scope.row.spuName }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="商品规格">
|
<template slot-scope="scope">
|
{{
|
scope.row.skuProps && JSON.parse(scope.row.skuProps).length
|
? JSON.parse(scope.row.skuProps)
|
.map((item) => item.propValueName)
|
.join('/')
|
: '-'
|
}}
|
</template>
|
</el-table-column>
|
<el-table-column label="销售金额(元)">
|
<template slot-scope="scope">
|
<span v-if="scope.row.promotionType !== '2'">
|
{{
|
scope.row.totelAmt
|
? '¥ ' + scope.row.totelAmt.toFixed(2)
|
: '-'
|
}}
|
</span>
|
<span v-else>-</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="实收金额(元)">
|
<template slot-scope="scope">
|
<span v-if="scope.row.promotionType !== '2'">
|
{{
|
scope.row.totelAmtAct
|
? '¥ ' + scope.row.totelAmtAct.toFixed(2)
|
: '-'
|
}}
|
</span>
|
<span v-else>-</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="数量">
|
<template slot-scope="scope">
|
{{ scope.row.buyQuantity }}
|
<span v-if="!scope.row.rightExchange">
|
* {{ JSON.parse(scope.row.expInfo).skuReduceStorage }} ({{
|
scope.row.spuUnit ? scope.row.spuUnit : '瓶'
|
}})
|
</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="售后状态">
|
<template slot-scope="scope">
|
{{ getRefundStatus(scope.row.refundStatus) }}
|
</template>
|
</el-table-column>
|
<el-table-column v-if="
|
props.row.promotionStatus &&
|
props.row.promotionStatus.indexOf('虚拟权益活动') !== -1
|
" label="兑换状态">
|
<template slot-scope="scope">
|
{{
|
scope.row.rightExchange
|
? scope.row.rightExchange === '1'
|
? '已兑换'
|
: '未兑换'
|
: '-'
|
}}
|
</template>
|
</el-table-column>
|
</el-table>
|
</template>
|
</el-table-column>
|
<el-table-column label="订单编号" prop="orderId" width="170px" show-overflow-tooltip>
|
<template slot-scope="scope">
|
<!-- <span class="giftStyle" v-if="scope.row.orderTag">{{
|
scope.row.orderTag === 'returnPart' ? '部' : '退'
|
}}</span> -->
|
<el-link class="urlLink" @click="lookInfo(scope.row)">{{ scope.row.orderId }}</el-link>
|
</template>
|
</el-table-column>
|
<el-table-column label="原始订单编号" prop="sourceOrderCode" width="170px" show-overflow-tooltip>
|
<template slot-scope="scope">
|
{{ scope.row.sourceOrderCode ? scope.row.sourceOrderCode : '-' }}
|
</template>
|
</el-table-column>
|
<el-table-column label="物流服务商" width="120px" show-overflow-tooltip>
|
<template slot-scope="scope">
|
{{
|
scope.row.omsOrderDelivery &&
|
scope.row.omsOrderDelivery.logisticSupplier
|
? getText(logisticSupplierData, scope.row.omsOrderDelivery.logisticSupplier)
|
: '-'
|
}}</template>
|
</el-table-column>
|
<el-table-column label="支付时间" prop="payTime" width="155px" show-overflow-tooltip>
|
</el-table-column>
|
<el-table-column label="订单金额" width="120px" prop="orderPrice" show-overflow-tooltip>
|
<template slot-scope="scope">
|
{{
|
scope.row.orderPrice !== null
|
? '¥' + scope.row.orderPrice.toFixed(2)
|
: '-'
|
}}
|
</template>
|
</el-table-column>
|
<el-table-column label="实收金额" width="120px" prop="orderPayPrice" show-overflow-tooltip>
|
<template slot-scope="scope">{{
|
scope.row.orderPayPrice !== null
|
? '¥ ' + scope.row.orderPayPrice.toFixed(2)
|
: '-'
|
}}</template>
|
</el-table-column>
|
<el-table-column label="操作状态" prop="orderStatus">
|
<template slot-scope="scope">
|
{{
|
getLabel(orderOperationStatus, scope.row.operationStatus)
|
}}</template>
|
</el-table-column>
|
<el-table-column label="推送状态" width="120px">
|
<template slot-scope="scope">
|
<span v-if="scope.row.orderStatus !== '01'">{{
|
scope.row.pushAnjiType === '1'
|
? '推送成功'
|
: scope.row.pushAnjiType === '2'
|
? '推送失败'
|
: '-'
|
}}</span>
|
<span v-else>-</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="拦截状态" width="120px">
|
<template slot-scope="scope">
|
<span v-if="scope.row.interceptType == '1'">
|
手动拦截成功
|
</span>
|
<span v-else-if="scope.row.interceptType == '2'">
|
手动拦截失败
|
</span>
|
<span v-else-if="scope.row.interceptType == '3'">
|
系统拦截成功
|
</span>
|
<span v-else-if="scope.row.interceptType == '4'">
|
系统拦截失败
|
</span>
|
<span v-else-if="scope.row.interceptType == '0'">
|
已重新推送
|
</span>
|
<span v-else>
|
-
|
</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="订单类型" width="100px">
|
<template slot-scope="scope">{{
|
scope.row.orderType ? scope.row.orderTypeName : '-'
|
}}</template>
|
</el-table-column>
|
<el-table-column label="订单状态" prop="orderStatus">
|
<template slot-scope="scope">
|
{{scope.row.orderStatus ? scope.row.orderStatusName:'-'}}
|
</template>
|
</el-table-column>
|
<!-- <el-table-column label="下单用户" width="150px" show-overflow-tooltip>
|
<template slot-scope="scope">{{
|
scope.row.creatorName ? scope.row.creatorName : '-'
|
}}</template>
|
</el-table-column> -->
|
<el-table-column label="下单时间" prop="orderTime" width="155px"></el-table-column>
|
<el-table-column label="门店名称" prop="orderTime" show-overflow-tooltip width="200px">
|
<template slot-scope="scope">
|
<span>{{ scope.row.shopName ? scope.row.shopName :'' }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="活动类型" width="150px" show-overflow-tooltip>
|
<template slot-scope="scope">
|
{{ scope.row.promotionStatus ? scope.row.promotionStatus :'-'}}
|
</template>
|
</el-table-column>
|
<el-table-column label="是否开票" width="150px" show-overflow-tooltip>
|
<template slot-scope="scope">
|
{{ scope.row.omsInvoiceStatus ? scope.row.omsInvoiceStatus :'-'}}
|
</template>
|
</el-table-column>
|
<el-table-column label="下单人" prop="creatorName" show-overflow-tooltip width="150px">
|
</el-table-column>
|
<el-table-column label="收货人" show-overflow-tooltip width="150px">
|
<template slot-scope="scope">
|
{{
|
scope.row.omsOrderDelivery &&
|
scope.row.omsOrderDelivery.contactName
|
? scope.row.omsOrderDelivery.contactName
|
: '-'
|
}}
|
</template>
|
</el-table-column>
|
<el-table-column label="收货人电话" show-overflow-tooltip width="150px">
|
<template slot-scope="scope">
|
{{
|
scope.row.omsOrderDelivery &&
|
scope.row.omsOrderDelivery.contactPhone
|
? scope.row.omsOrderDelivery.contactPhone
|
: '-'
|
}}
|
</template>
|
</el-table-column>
|
<el-table-column label="来源" width="200px" prop="orderSource" show-overflow-tooltip>
|
<template slot-scope="scope">
|
{{ getLabel(orderSourceArr, scope.row.orderSource) }}
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" fixed="right" align="center"
|
:width="`${$store.getters.colSize+1}px`">
|
<template slot-scope="scope">
|
<wly-btn @click="lookInfo(scope.row)">详情</wly-btn>
|
<!-- <el-button
|
type="primary"
|
v-show="scope.row.orderStatus === '03' && JSON.parse(scope.row.expInfo).prodOwner !== 'TS'"
|
@click="deliverGoods(scope.row)"
|
>发货</el-button> -->
|
<!-- <el-button
|
size="mini"
|
type="warning"
|
v-show="scope.row.orderStatus==='05' && scope.row.omsInvoice.isInvoice === '1' && scope.row.omsInvoice.status === '0'"
|
@click="Invoice(scope.row)"
|
>开票</el-button> -->
|
<!-- <el-button
|
size="mini"
|
type="success"
|
v-show="scope.row.omsInvoice.isInvoice === '1' && scope.row.omsInvoice.status === '1'"
|
@click="lookInvoice(scope.row)"
|
>查看开票</el-button> -->
|
<!-- <wly-btn :type="'primary'" v-if="scope.row.isExitZeroOrder === '1'"
|
@click="freeBuyProd(scope.row)">0元购建单</wly-btn>
|
<wly-btn :type="'warning'" @click="manualPush(scope.row)" v-if="
|
scope.row.orderStatus === '03' &&
|
scope.row.pushAnjiType !== '1' &&
|
scope.row.operationStatus === '1'
|
">手动推送</wly-btn>
|
<wly-btn :type="'success'" v-if="scope.row.isCreateOrder === '1'"
|
@click="createIntegralOrder(scope.row)">手动建单</wly-btn>
|
<wly-btn :type="'warning'"
|
v-if="scope.row.isCanRefund && scope.row.orderType !== 'T04'"
|
@click="openReturnInfo(scope.row)">生成退货单</wly-btn> -->
|
</template>
|
</el-table-column>
|
</template>
|
</list-condition-template>
|
<deliver-goods :show.sync="show" :row="row"></deliver-goods>
|
<el-dialog :visible.sync="dialogVisible" title="订单详情" :close-on-click-modal="false"
|
:modal-append-to-body="false" width="40%">
|
<details-info></details-info>
|
<div slot="footer" class="dialog-footer">
|
<el-button size="mini" @click="dialogVisible = false">关闭</el-button>
|
</div>
|
</el-dialog>
|
<el-dialog :visible.sync="InvoiceVisible" title="查看发票" :close-on-click-modal="false"
|
:modal-append-to-body="false" width="40%">
|
<Invoice-info :form="InvoiceForm"></Invoice-info>
|
<div slot="footer" class="dialog-footer">
|
<el-button size="mini" @click="InvoiceVisible = false">关闭</el-button>
|
</div>
|
</el-dialog>
|
<return-info :show.sync="showReturnInfo" :orderRow="orderRow"></return-info>
|
</div>
|
</template>
|
<script>
|
import orderMgtApi from '@/api/orderMgt'
|
import deliverGoods from '@/views/orderMgt/components/deliverGoods.vue'
|
import detailsInfo from '@/views/orderMgt/info.vue'
|
import InvoiceInfo from '@/views/orderMgt/components/InvoiceInfo.vue'
|
import { downloadFile } from '@/utils/downloadFile'
|
import orderSourceArr from '@/utils/constant/orderSourceArr'
|
import returnInfo from '@/views/orderMgt/components/returnInfo.vue'
|
import orderStatus from '@/utils/constant/orderStatus'
|
import orderOperationStatus from '@/utils/constant/orderOperationStatus'
|
import { getArrayLable } from '@/utils/getArrayLable'
|
import orderTypeArr from '@/utils/constant/orderTypeArr'
|
import productImg from '@/views/product/components/productImg.vue'
|
import { getDate, dateDiffer } from '@/utils/getDate'
|
|
const promotionStatusArr = [
|
{
|
id: '1',
|
name: '满减活动'
|
},
|
{
|
id: '2',
|
name: '满赠活动'
|
},
|
{
|
id: '3',
|
name: '其他活动'
|
},
|
{
|
id: '4',
|
name: '无活动'
|
},
|
{
|
id: '5',
|
name: '优惠券活动'
|
},
|
{
|
id: '6',
|
name: '盲盒抽奖'
|
},
|
{
|
id: '7',
|
name: '限时购活动'
|
},
|
{
|
id: '9',
|
name: '拼团活动'
|
},
|
{
|
id: '8',
|
name: '虚拟权益活动'
|
}
|
]
|
const orderExtTypeArr = [
|
{
|
id: '06',
|
name: '京仓业务订单'
|
},
|
{
|
id: '08',
|
name: '运营商提货单'
|
},
|
{
|
id: '09',
|
name: '运营商订单'
|
},
|
{
|
id: '10',
|
name: '赠品单'
|
}
|
]
|
export default {
|
components: {
|
deliverGoods,
|
detailsInfo,
|
InvoiceInfo,
|
returnInfo,
|
productImg
|
},
|
data() {
|
return {
|
orderStatus: orderStatus,
|
orderSourceArr: orderSourceArr,
|
listQuery: {
|
idList: null, // 批量查询的订单id
|
startOrderTime: null,
|
endOrderTime: null,
|
orderStatus: null,
|
spuName: null,
|
orderSourceArr: null,
|
orderType: null,
|
promotionType: null,
|
waybillId: null,
|
contactName: null,
|
contactPhone: null,
|
operationStatus: null, // 操作状态
|
spuNum: null, // 商品sku
|
lockState: null, // 是否锁定
|
promotionStatus: null, // 是否参与活动
|
sourceOrderCode: null, // 原始订单编号
|
interceptType: null, // 拦截类型
|
creatorName: null, // 下单人
|
orderExtType: null, // 订单扩展类型
|
invoiceStatus: null, // 是否开票
|
timeSlot: []
|
},
|
newObj: {
|
startOrderTime: null,
|
endOrderTime: null
|
},
|
logisticSupplierData: [],
|
formLabel: [
|
{
|
model: 'orderStatus',
|
label: '订单状态',
|
type: 'select',
|
opts: orderStatus
|
},
|
{
|
model: 'orderSourceArr',
|
label: '订单来源',
|
type: 'select',
|
multiple: true,
|
opts: orderSourceArr
|
},
|
{
|
model: 'orderType',
|
label: '订单类型',
|
type: 'select',
|
opts: orderTypeArr
|
},
|
{
|
model: 'sourceOrderCode', // 原始订单编号
|
label: '原始订单编号',
|
labelWidth: '100px',
|
type: 'input'
|
// rule: /[^\w,]/g // 可输入数字字母
|
},
|
{
|
model: 'idList', // 批量查询的订单id
|
label: '订单编号',
|
type: 'input',
|
flag: 'textarea'
|
// rule: /[^\w,]/g // 可输入数字字母
|
},
|
{
|
model: 'spuName',
|
label: '商品名称',
|
showItem: false,
|
type: 'input'
|
},
|
{
|
model: 'spuNum',
|
label: '商品主编码',
|
showItem: false,
|
type: 'input',
|
labelWidth: '100px',
|
rule: /[^\w]/g // 可输入数字字母
|
},
|
{
|
model: 'waybillId', // 物流单号
|
label: '物流单号',
|
type: 'input',
|
showItem: false,
|
rule: /[^\w]/g // 可输入数字字母
|
|
},
|
{
|
model: 'logisticSupplier',
|
labelWidth: '90px',
|
label: '物流服务商',
|
type: 'select',
|
opts: []
|
},
|
{
|
model: 'creatorName', // 下单人名称
|
label: '下单人',
|
showItem: false,
|
type: 'input'
|
},
|
{
|
model: 'contactName', // 收货人名称
|
label: '收货人',
|
showItem: false,
|
type: 'input'
|
},
|
{
|
model: 'contactPhone', // 联系电话
|
label: '收货人电话',
|
showItem: false,
|
labelWidth: '100px',
|
type: 'input'
|
},
|
{
|
model: 'lockState',
|
label: '是否锁定',
|
showItem: false,
|
type: 'select',
|
opts: [
|
{
|
id: '1',
|
name: '否'
|
},
|
{
|
id: '2',
|
name: '是'
|
}
|
]
|
},
|
{
|
model: 'pushAnjiType',
|
label: '推送状态',
|
showItem: false,
|
type: 'select',
|
opts: [
|
{
|
id: '1',
|
name: '推送成功'
|
},
|
{
|
id: '2',
|
name: '推送失败'
|
}
|
]
|
},
|
{
|
model: 'interceptType',
|
label: '拦截状态',
|
showItem: false,
|
type: 'select',
|
labelWidth: '80px',
|
opts: [
|
{
|
id: '0',
|
name: '已重新推送'
|
},
|
{
|
id: '1',
|
name: '手动拦截成功'
|
},
|
{
|
id: '2',
|
name: '手动拦截失败'
|
},
|
{
|
id: '3',
|
name: '系统拦截成功'
|
},
|
{
|
id: '4',
|
name: '系统拦截失败'
|
}
|
]
|
},
|
{
|
model: 'promotionStatus',
|
label: '活动类型',
|
type: 'select',
|
showItem: false,
|
opts: promotionStatusArr
|
},
|
{
|
model: 'orderExtType',
|
label: '订单扩展类型',
|
type: 'select',
|
labelWidth: '100px',
|
showItem: false,
|
opts: orderExtTypeArr
|
},
|
{
|
model: 'timeSlot',
|
label: '支付时间',
|
type: 'date',
|
flag: 'daterange',
|
valueFormat: 'yyyy-MM-dd',
|
showItem: false
|
},
|
{
|
model: 'invoiceStatus',
|
label: '是否开票',
|
showItem: false,
|
type: 'select',
|
opts: [
|
{
|
id: '1',
|
name: '未申请'
|
},
|
{
|
id: '2',
|
name: '未开票'
|
},
|
{
|
id: '3',
|
name: '已开票'
|
},
|
{
|
id: '4',
|
name: '开票失败'
|
}
|
]
|
}
|
],
|
tableData: [],
|
show: false,
|
title: null,
|
row: {},
|
dialogVisible: false,
|
form: {},
|
total: 0,
|
InvoiceVisible: false,
|
InvoiceForm: {},
|
rows: [],
|
exportQuery: {},
|
showReturnInfo: false,
|
orderRow: null,
|
orderOperationStatus: orderOperationStatus, // 订单操作状态(查询)
|
orderOperationBtn: [
|
// 对未确认的订单进行操作
|
{
|
id: '1',
|
name: '确认'
|
},
|
{
|
id: '2',
|
name: '锁定'
|
},
|
{
|
id: '4',
|
name: '取消锁定'
|
},
|
{
|
id: '6',
|
name: '拦截发货'
|
},
|
{
|
id: '7',
|
name: '取消拦截'
|
},
|
{
|
id: '3',
|
name: '无效'
|
},
|
{
|
id: '5',
|
name: '批量添加备注'
|
}
|
],
|
operationBtn: null, // 修改订单状态
|
rowItem: [], // 获取勾选的订单
|
percentage: 0, // 进度条数值
|
isLoading: false, // 是否展示进度条遮罩
|
showFormItem: false
|
}
|
},
|
watch: {
|
$route: {
|
handler() {
|
if (this.$route.name === 'orderMgtList') {
|
this.queryParamsChange()
|
}
|
// 深度监听,同时也可监听到param参数变化
|
},
|
deep: true,
|
immediate: true
|
}
|
},
|
mounted() {
|
// 获取物流服务商
|
this.getLogisticsProvidersData();
|
},
|
methods: {
|
/**
|
* 获取物流服务商
|
*/
|
async getLogisticsProvidersData() {
|
let arr = [];
|
const res = await orderMgtApi.getWarehouseTree({})
|
if (res.code === '200' && res.data.length) {
|
res.data.forEach((item) => {
|
arr.push({
|
id: item.warehouseService,
|
name: item.warehouseServiceName,
|
})
|
})
|
this.logisticSupplierData = arr;
|
this.formLabel[8].opts = arr;
|
}
|
},
|
toggleForm() {
|
this.showFormItem = !this.showFormItem
|
},
|
getStartOrderTime(val) {
|
if (val && val.length) {
|
this.newObj.startOrderTime = val
|
} else {
|
this.newObj.startOrderTime = null
|
}
|
},
|
getEndOrderTime(val) {
|
if (val && val.length) {
|
this.newObj.endOrderTime = val
|
} else {
|
this.newObj.endOrderTime = null
|
}
|
},
|
/**
|
* 进入页面默认查询参数
|
*/
|
queryParamsChange() {
|
const _this = this
|
const _query = _this.$route.query
|
if (_query && _query.prodNo) {
|
// 订单编号
|
_this.listQuery.idList = _query.prodNo
|
}
|
// 当订单初始条件为空时 设置订单时间为当前的一个月
|
const bool = _this.initOrderTime()
|
if (bool && !_this.listQuery.startOrderTime && !_this.listQuery.endOrderTime) {
|
_this.listQuery.startOrderTime = getDate(-30)[0] + ' 00:00:00'
|
_this.listQuery.endOrderTime = getDate(-30)[1] + ' 23:59:59'
|
}
|
_this.$nextTick(() => {
|
_this.queryList(_this.$refs.table.getPageInfo())
|
})
|
},
|
/**
|
* 获取售后状态
|
*/
|
getRefundStatus(status) {
|
switch (status) {
|
case '10':
|
return '售后中'
|
case '20':
|
return '退款失败'
|
case '30':
|
return '退款成功'
|
default:
|
return '-'
|
}
|
},
|
// 给锁定与解锁的数据添加/移除样式
|
setRowStyle({ row, rowIndex }) {
|
if (row.operationStatus === '2') {
|
return { color: '#999999', background: '#eeeeee' }
|
}
|
},
|
// 点击不同的操作状态去查询对应的列表
|
changeOperationStatus(val) {
|
this.listQuery.orderSourceArr = []
|
this.$refs.table.resetForm()
|
this.listQuery.operationStatus = val
|
this.$refs.table.changeCondition()
|
this.rowItem = []
|
},
|
/**
|
* 拦截发货
|
*/
|
interceptDeliverGoods(row) {
|
orderMgtApi.interceptDeliverGoods({
|
orderIds: this.rows
|
}).then((res) => {
|
if (res.code === '0') {
|
this.$message({
|
message: '操作成功',
|
type: 'success'
|
})
|
this.$refs.table.changeCondition()
|
this.rows = []
|
this.rowItem = []
|
this.operationBtn = null
|
} else {
|
this.operationBtn = null
|
}
|
}).catch(() => {
|
this.operationBtn = null
|
})
|
},
|
/**
|
* 取消拦截
|
*/
|
async deliverDeliverGoods(row) {
|
const res = await orderMgtApi.deliverDeliverGoods({ orderIds: this.rows })
|
if (res.code === '0') {
|
this.$refs.table.changeCondition()
|
this.$message({
|
message: '操作成功',
|
type: 'success'
|
})
|
this.rows = []
|
this.rowItem = []
|
this.operationBtn = null
|
} else {
|
this.operationBtn = null
|
}
|
},
|
// 勾选后的订单进行状态变更
|
changeOperationBtn(val) {
|
if (!this.rowItem.length) {
|
this.$message({
|
message: '请勾选需要操作的数据',
|
type: 'info'
|
})
|
this.operationBtn = null
|
return
|
}
|
for (const i of this.rowItem) {
|
if (
|
i.operationStatus !== '0' &&
|
val !== '4' &&
|
val !== '6' &&
|
val !== '7'
|
) {
|
this.$message({
|
message: '此功能只针对未确定的订单,请重新选择订单',
|
type: 'warning'
|
})
|
this.operationBtn = null
|
return
|
} else if (
|
i.operationStatus === '0' &&
|
val !== '4' &&
|
i.orderStatus !== '03' &&
|
val !== '6' &&
|
val !== '7'
|
) {
|
this.$message({
|
message: '此功能只针对未确定、待发货的订单,请重新选择订单',
|
type: 'warning'
|
})
|
this.operationBtn = null
|
return
|
} else if (val === '4' && i.operationStatus !== '2') {
|
this.$message({
|
message: '此功能只针对锁定的订单,请重新选择订单',
|
type: 'warning'
|
})
|
this.operationBtn = null
|
return
|
} else if (
|
val === '4' &&
|
i.operationStatus === '2' &&
|
i.orderStatus !== '03'
|
) {
|
this.$message({
|
message: '此功能只针对锁定且待发货的订单,请重新选择订单',
|
type: 'warning'
|
})
|
this.operationBtn = null
|
return
|
} else if (
|
val === '6' &&
|
i.orderType !== 'T04' &&
|
(i.orderSource === 'JD' ||
|
i.orderSource === 'TB' ||
|
i.orderSource === 'SN')
|
) {
|
this.$message({
|
message: '暂不支持淘宝、京东、苏宁平台订单,请重新选择',
|
type: 'warning'
|
})
|
this.operationBtn = null
|
return
|
} else if (
|
val === '6' &&
|
(i.operationStatus !== '1' ||
|
(i.operationStatus === '1' && i.orderStatus !== '03'))
|
) {
|
this.$message({
|
message: '仅可拦截已确认、待发货订单,请重新选择',
|
type: 'warning'
|
})
|
this.operationBtn = null
|
return
|
} else if (val === '6' && i.pushAnjiType !== '1') {
|
this.$message({
|
message: '仅可拦截已推送的订单,请重新选择',
|
type: 'warning'
|
})
|
this.operationBtn = null
|
return
|
} else if (
|
val === '6' &&
|
(i.interceptType === '1' || i.interceptType === '2')
|
) {
|
this.$message({
|
message: '订单不可重复拦截,请重新选择',
|
type: 'warning'
|
})
|
this.operationBtn = null
|
return
|
} else if (
|
val === '7' &&
|
(i.interceptType !== '1' ||
|
(i.interceptType === '1' && i.orderStatus !== '03'))
|
) {
|
this.$message({
|
message: '仅可推送已拦截、待发货的订单,请重新选择',
|
type: 'warning'
|
})
|
this.operationBtn = null
|
return
|
}
|
}
|
if (val === '5') {
|
this.addOrderRemarks(val)
|
} else if (val === '6') {
|
this.interceptDeliverGoods()
|
} else if (val === '7') {
|
this.deliverDeliverGoods()
|
} else {
|
this.setOperationStatus(val)
|
}
|
},
|
// 添加订单备注
|
addOrderRemarks(val) {
|
this.$prompt('请输入订单备注', '批量添加订单备注', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
inputPattern: /^.{1,20}$/,
|
inputErrorMessage: '订单备注不能为空,且不超过20字符'
|
})
|
.then(({ value }) => {
|
this.setOperationStatus(val, value)
|
})
|
.catch(() => {
|
this.operationBtn = null
|
})
|
},
|
// 更改勾选数据的操作状态
|
async setOperationStatus(val, message) {
|
try {
|
const param = {
|
operationStatus: val,
|
orderIds: this.rows,
|
orderMerchantMemo: message
|
}
|
const res = await orderMgtApi.updateOperationStatus(param)
|
if (res.code === '0') {
|
this.$message({
|
message: '操作成功',
|
type: 'success'
|
})
|
this.$refs.table.changeCondition()
|
this.rows = []
|
this.rowItem = []
|
this.operationBtn = null
|
} else {
|
this.operationBtn = null
|
}
|
} catch (error) {
|
this.operationBtn = null
|
}
|
},
|
// 限制选择开始结束时间的时分秒
|
limitTime(val, time1, time2) {
|
if (!time1 || !time2 || time1.split(' ')[0] !== time2.split(' ')[0]) { return }
|
const date = new Date(time1)
|
var h = date.getHours() > 9 ? date.getHours() : '0' + date.getHours()
|
var m =
|
date.getMinutes() > 9 ? date.getMinutes() : '0' + date.getMinutes()
|
var s =
|
date.getSeconds() > 9 ? date.getSeconds() : '0' + date.getSeconds()
|
let str = null
|
str =
|
val === 1
|
? `00:00:00 - ${h + ':' + m + ':' + s}`
|
: `${h + ':' + m + ':' + s} - 23:59:59`
|
return str
|
},
|
/**
|
* '分页信息改变时查询列表
|
*/
|
handlePageInfoChange(pageInfo) {
|
this.queryList(pageInfo)
|
},
|
/**
|
* 重置
|
*/
|
resetQuery() {
|
this.newObj.startOrderTime = null
|
this.newObj.endOrderTime = null
|
this.listQuery.orderSourceArr = []
|
this.listQuery.operationStatus = null
|
this.$refs.table.reloadCurrent()
|
},
|
/**
|
* 点击查询按钮
|
*/
|
queryData() {
|
this.$refs.table.changeCondition()
|
},
|
/**
|
*
|
*获取勾选的表格数据
|
*/
|
selectItem(val) {
|
this.rows = []
|
this.rowItem = []
|
val.forEach((item) => {
|
this.rows.push(item.orderId)
|
this.rowItem.push(item)
|
})
|
},
|
/**
|
* 导出
|
*/
|
async exportData() {
|
this.exportQuery.orderIdArr = this.rows
|
if (!this.rows.length && (!this.exportQuery.startOrderTime || !this.exportQuery.endOrderTime)) {
|
this.$message({
|
message: '请选择要导出的下单时间范围',
|
type: 'info'
|
})
|
return
|
}
|
const day = dateDiffer(
|
this.exportQuery.startOrderTime,
|
this.exportQuery.endOrderTime
|
)
|
if (day > 92) {
|
this.$message({
|
message: '仅支持导出3个月的订单数据',
|
type: 'info'
|
})
|
return
|
}
|
|
const config = {
|
onUploadProgress: (ProgressEvent) => {
|
const progressPercent = Math.round(
|
((ProgressEvent.loaded / ProgressEvent.total) * 100) | 0
|
)
|
this.percentage = progressPercent === 100 ? 99 : progressPercent
|
this.isLoading = true
|
},
|
onDownloadProgress: (ProgressEvent) => { },
|
url: 'awl-order-service/order/v2/downland/exportOrderData',
|
data: this.exportQuery,
|
fileName: '订单数据',
|
type: '.xlsx'
|
}
|
const res = await downloadFile(config)
|
if (res) {
|
this.percentage = 100
|
this.isLoading = false
|
this.rows = []
|
this.$refs.table.clearTableSelected() // 清空表格勾选项
|
} else {
|
this.percentage = 100
|
this.isLoading = false
|
}
|
},
|
getText(array, id) {
|
return getArrayLable(array, id)
|
},
|
/**
|
* 获取数组的label
|
*/
|
getLabel(array, id, row) {
|
if (row && row.orderType === 'T05') {
|
switch (id) {
|
case '88':
|
return '售后中'
|
case '10':
|
return '售后成功'
|
case '06':
|
return '已完成'
|
default:
|
return getArrayLable(array, id)
|
}
|
} else {
|
return getArrayLable(array, id)
|
}
|
},
|
/**
|
* 查看开票
|
*/
|
lookInvoice(row) {
|
orderMgtApi.getInvoiceInfo({ orderId: row.orderId }).then((res) => {
|
if (res.data) {
|
this.InvoiceForm = res.data
|
this.InvoiceVisible = true
|
}
|
})
|
},
|
/**
|
* 开票
|
*/
|
Invoice(row) {
|
this.$confirm('确认已完成开票吗?', '开票确认', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
orderMgtApi.confirmInvoice(row.orderId).then((res) => {
|
if (res.data) {
|
this.$refs.table.changeCondition() // 查询列表
|
}
|
})
|
})
|
.catch(() => { })
|
},
|
/**
|
* 获取详情打开发货窗口
|
*/
|
deliverGoods(row) {
|
orderMgtApi.detailsInfo({ orderId: row.orderId }).then((res) => {
|
if (res.data) {
|
this.row = res.data
|
this.show = true
|
}
|
})
|
},
|
/**
|
* 查看详情
|
*/
|
lookInfo(row) {
|
this.$router.push({
|
name: 'orderMgtInfo',
|
query: {
|
orderId: row.orderId,
|
promotionStatus: row.promotionStatus
|
}
|
})
|
},
|
initOrderTime() {
|
let queryIsNull = true
|
for (const i in this.listQuery) {
|
if (i !== 'startOrderTime' && i !== 'endOrderTime') {
|
if ((Array.isArray(this.listQuery[i]) && this.listQuery[i].length) || (!Array.isArray(this.listQuery[i]) && this.listQuery[i])) {
|
queryIsNull = false
|
break
|
}
|
}
|
}
|
return queryIsNull
|
},
|
/**
|
* 查询列表
|
*/
|
queryList(pageInfo = { pageNum: 1, pageSize: 50 }) {
|
const { startOrderTime, endOrderTime } = this.newObj
|
const bool = this.initOrderTime()
|
if (!startOrderTime && !endOrderTime) {
|
if (!bool) {
|
// 条件不为空的情况下查询所有订单
|
this.listQuery.startOrderTime = null
|
this.listQuery.endOrderTime = null
|
} else {
|
// 为空的情况下查询近一个月的
|
this.listQuery.startOrderTime = getDate(-30)[0] + ' 00:00:00'
|
this.listQuery.endOrderTime = getDate(-30)[1] + ' 23:59:59'
|
}
|
} else {
|
if (startOrderTime) {
|
this.listQuery.startOrderTime = startOrderTime
|
}
|
if (endOrderTime) {
|
this.listQuery.endOrderTime = endOrderTime
|
}
|
}
|
const param = JSON.parse(JSON.stringify(this.listQuery))
|
param.deleteFlag = this.listQuery.orderStatus === '07' ? true : null
|
param.isMarketOrder = '0'
|
param.orderSources = this.listQuery.orderSourceArr.join(',')
|
if (param.timeSlot && param.timeSlot.length) {
|
param.startPayTime = param.timeSlot[0] + ' 00:00:00'
|
param.endPayTime = param.timeSlot[1] + ' 23:59:59'
|
}
|
delete param.timeSlot
|
|
if (param.deleteFlag) {
|
delete param.orderStatus
|
}
|
orderMgtApi.getOrderList({ ...param, ...pageInfo }).then((res) => {
|
if (res.data) {
|
this.tableData = res.data.list
|
this.total = res.data.total
|
this.exportQuery = JSON.parse(JSON.stringify(param))
|
}
|
})
|
}
|
}
|
}
|
</script>
|
<style lang="scss">
|
// .hideSelectAll .cell .el-checkbox{
|
// display: none !important;
|
// }
|
.orderTable .el-table .el-button + .el-button {
|
margin-top: 10px;
|
}
|
.orderTable {
|
// .tableStyle {
|
// margin-top: 0 !important;
|
// }
|
.operation-style {
|
margin-top: 15px;
|
.orderDownload {
|
margin-right: 10px;
|
height: 32px;
|
}
|
.operation-btn {
|
float: right;
|
}
|
}
|
}
|
</style>
|