763 lines
33 KiB
Vue
763 lines
33 KiB
Vue
<template>
|
||
<div class="app-container">
|
||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
|
||
<el-form-item label="日期">
|
||
<el-date-picker
|
||
v-model="dateRange"
|
||
type="daterange"
|
||
align="right"
|
||
unlink-panels
|
||
range-separator="至"
|
||
start-placeholder="开始日期"
|
||
end-placeholder="结束日期"
|
||
format="yyyy-MM-dd" style="width: 220px"
|
||
:picker-options="pickerOptions" >
|
||
</el-date-picker>
|
||
</el-form-item>
|
||
<el-form-item label="所属区域" prop="areaId">
|
||
<el-cascader v-model="queryParams.areaId"
|
||
:options="treeAreaOptions" :filterable="true" style="width: 220px" :show-all-levels="false"
|
||
:props="{
|
||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||
checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
||
value:'id',label:'label'
|
||
}" clearable collapse-tags @change="handleAreaChange">
|
||
</el-cascader>
|
||
</el-form-item>
|
||
<el-form-item label="所属超市" prop="canteenId">
|
||
<el-select v-model="queryParams.canteenId" clearable collapse-tags placeholder="请选择所属超市" style="width: 220px" @change="handleCanteenChange">
|
||
<el-option v-for="item in supermarketOptions"
|
||
:key="item.supermarketId"
|
||
:label="item.supermarketName"
|
||
:value="item.supermarketId"
|
||
></el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="所属组织" prop="deptIdList">
|
||
<el-cascader v-model="queryParams.deptIdList"
|
||
:options="deptOptions" :filterable="true" style="width: 220px" :show-all-levels="false"
|
||
:props="{
|
||
multiple: true,
|
||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||
checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
||
value:'id',label:'label'
|
||
}" clearable collapse-tags>
|
||
</el-cascader>
|
||
</el-form-item>
|
||
<el-form-item label="关键字">
|
||
<el-input v-model="queryParams.custSearchInfo" placeholder="请输入用户姓名,编号,手机号" maxlength="20" clearable style="width: 220px"/>
|
||
</el-form-item>
|
||
<el-form-item label="订单号">
|
||
<el-input v-model="queryParams.orderId" placeholder="请输入订单号" maxlength="20" clearable style="width: 220px"/>
|
||
</el-form-item>
|
||
<el-form-item label="商品名称">
|
||
<el-input v-model="queryParams.goodsSearchInfo" placeholder="请输入商品名称" maxlength="20" clearable style="width: 220px"/>
|
||
</el-form-item>
|
||
<el-form-item label="订单状态">
|
||
<el-select v-model="queryParams.orderStateList" clearable multiple collapse-tags style="width: 220px">
|
||
<el-option
|
||
v-for="dict in dict.type.sm_order_status"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="Number(dict.value)"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="支付方式">
|
||
<el-select v-model="queryParams.payStateList" clearable multiple collapse-tags style="width: 220px">
|
||
<el-option
|
||
v-for="dict in dict.type.sm_order_pay_type"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="Number(dict.value)"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||
</el-form-item>
|
||
</el-form>
|
||
|
||
<el-row :gutter="10" class="mb8">
|
||
<!-- <el-col :span="1.5">
|
||
<el-button
|
||
type="danger"
|
||
size="mini" :disabled="multiple"
|
||
@click="handleBatchRefund"
|
||
>批量退单</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="primary"
|
||
size="mini" :disabled="multiple"
|
||
@click="handleBatchWriteOff"
|
||
>批量核销</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="primary"
|
||
size="mini" :disabled="multiple"
|
||
@click="handleSyncPayState"
|
||
>同步订单状态</el-button>
|
||
</el-col> -->
|
||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||
</el-row>
|
||
|
||
<el-table v-loading="loading" :data="tableListData" height="800" ref="multipleTable" :row-key="(row)=>{return row.orderId}" @selection-change="handleOrderSelectionChange">
|
||
<el-table-column type="selection" width="50" align="center" :reserve-selection="true"/>
|
||
<el-table-column label="序号" align="center" width="80" type="index" fixed="left">
|
||
<template slot-scope="scope">
|
||
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="订单日期" align="center" prop="orderDate" :show-overflow-tooltip="true" width="100"/>
|
||
<!-- <el-table-column label="流水号" align="center" prop="mealCode" :show-overflow-tooltip="true" width="80"/> -->
|
||
<el-table-column label="商品明细" align="center" prop="orderDetailList" :show-overflow-tooltip="true" width="120">
|
||
<template slot-scope="scope">
|
||
<span v-for="item in scope.row.orderDetailList" :key="item.detailId">{{ item.goodsDishesName }}*{{ item.goodsGetNum }};</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="订单类型" align="center" prop="orderType" :show-overflow-tooltip="true" width="100">
|
||
<template slot-scope="scope">
|
||
<dict-tag :options="dict.type.sm_order_type" :value="scope.row.orderType"/>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="订单金额" align="center" prop="payableAmount" :show-overflow-tooltip="true" width="80">
|
||
<template slot-scope="scope">
|
||
<span>{{ (scope.row.payableAmount/100).toFixed(2) }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="配送费" align="center" prop="deliveryAmount" :show-overflow-tooltip="true" width="80">
|
||
<template slot-scope="scope">
|
||
<span>{{ (scope.row.deliveryAmount/100).toFixed(2) }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="实付金额" align="center" prop="realAmount" :show-overflow-tooltip="true" width="80">
|
||
<template slot-scope="scope">
|
||
<span>{{ (scope.row.realAmount/100).toFixed(2) }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="支付方式" align="center" prop="payType" :show-overflow-tooltip="true" width="100">
|
||
<template slot-scope="scope">
|
||
<dict-tag :options="dict.type.sm_order_pay_type" :value="scope.row.payType"/>
|
||
</template>
|
||
</el-table-column>
|
||
<!-- <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" width="80"/> -->
|
||
<el-table-column label="用户编号" align="center" prop="userId" :show-overflow-tooltip="true" width="120"/>
|
||
<el-table-column label="用户姓名" align="center" prop="nickName" :show-overflow-tooltip="true" width="100"/>
|
||
<el-table-column label="用户手机号" align="center" prop="phoneNumber" :show-overflow-tooltip="true" width="120"/>
|
||
<el-table-column label="所属组织" align="center" prop="deptFullName" :show-overflow-tooltip="true" width="120"/>
|
||
<el-table-column label="订单号" align="center" prop="orderId" :show-overflow-tooltip="true" width="180"/>
|
||
<el-table-column label="下单时间" align="center" prop="orderTime" :show-overflow-tooltip="true" width="180"/>
|
||
<el-table-column label="订单状态" align="center" prop="orderState" :show-overflow-tooltip="true" width="100">
|
||
<template slot-scope="scope">
|
||
<dict-tag :options="dict.type.sm_order_status" :value="scope.row.orderState"/>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width" fixed="right">
|
||
<template slot-scope="scope">
|
||
<el-button
|
||
size="mini"
|
||
type="text"
|
||
@click="handleView(scope.row)"
|
||
>详情</el-button>
|
||
<!-- <el-button
|
||
size="mini"
|
||
type="text" v-if="scope.row.orderStateMix==1||scope.row.orderStateMix==11"
|
||
@click="handleRefundPart(scope.row)"
|
||
>部分退款</el-button>
|
||
<el-button
|
||
size="mini" style="color: red;"
|
||
type="text" v-if="scope.row.orderStateMix==1||scope.row.orderStateMix==11"
|
||
@click="handleRefund(scope.row)"
|
||
>退单</el-button>
|
||
<el-button
|
||
size="mini"
|
||
type="text" v-if="scope.row.orderStateMix==1"
|
||
@click="writeOffOrder(scope.row)"
|
||
>核销</el-button> -->
|
||
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
|
||
<pagination
|
||
v-show="total>0"
|
||
:total="total"
|
||
:page.sync="queryParams.pageNum"
|
||
:limit.sync="queryParams.pageSize"
|
||
@pagination="getList"
|
||
/>
|
||
|
||
<!-- 详情对话框 -->
|
||
<el-dialog title="详情" :visible.sync="open" width="900px" append-to-body>
|
||
<div style="width: 100%;height: 600px;overflow-y: auto;">
|
||
<el-descriptions class="margin-top" title="订单信息" :column="2" size="small" border>
|
||
<el-descriptions-item>
|
||
<template slot="label">订单号</template>
|
||
{{orderInfoData.orderId}}
|
||
</el-descriptions-item>
|
||
<el-descriptions-item>
|
||
<template slot="label">订单来源</template>
|
||
{{orderInfoData.deviceName}}
|
||
</el-descriptions-item>
|
||
|
||
<el-descriptions-item>
|
||
<template slot="label"> 超市名称</template>
|
||
{{ orderInfoData.canteenName }}
|
||
</el-descriptions-item>
|
||
<el-descriptions-item>
|
||
<template slot="label"> 用户姓名</template>
|
||
{{ orderInfoData.nickName }}
|
||
</el-descriptions-item>
|
||
|
||
<el-descriptions-item>
|
||
<template slot="label"> 用户编号</template>
|
||
{{ orderInfoData.userId }}
|
||
</el-descriptions-item>
|
||
<el-descriptions-item>
|
||
<template slot="label"> 用户手机号</template>
|
||
{{ orderInfoData.phoneNumber }}
|
||
</el-descriptions-item>
|
||
|
||
<el-descriptions-item>
|
||
<template slot="label"> 所属组织</template>
|
||
{{ orderInfoData.deptFullName }}
|
||
</el-descriptions-item>
|
||
<el-descriptions-item>
|
||
<template slot="label"> 订单日期</template>
|
||
{{ orderInfoData.orderDate }}
|
||
</el-descriptions-item>
|
||
|
||
<el-descriptions-item>
|
||
<template slot="label"> 订单金额</template>
|
||
{{ (orderInfoData.payableAmount/100).toFixed(2) }}
|
||
</el-descriptions-item>
|
||
<el-descriptions-item>
|
||
<template slot="label"> 配送费</template>
|
||
{{ (orderInfoData.deliveryAmount/100).toFixed(2) }}
|
||
</el-descriptions-item>
|
||
<el-descriptions-item>
|
||
<template slot="label"> 实付金额</template>
|
||
{{ (orderInfoData.realAmount/100).toFixed(2) }}
|
||
</el-descriptions-item>
|
||
<el-descriptions-item>
|
||
<template slot="label"> 配送方式</template>
|
||
<!-- <div v-for="item in deliveryTypeOptions" :key="item.key" v-if="item.key==orderInfoData.deliveryType">
|
||
{{ item.value }}
|
||
</div> -->
|
||
</el-descriptions-item>
|
||
<el-descriptions-item>
|
||
<template slot="label"> 支付方式</template>
|
||
{{orderInfoData.payTypesStr}}
|
||
</el-descriptions-item>
|
||
|
||
<el-descriptions-item>
|
||
<template slot="label"> 下单时间</template>
|
||
{{ orderInfoData.orderTime }}
|
||
</el-descriptions-item>
|
||
<el-descriptions-item>
|
||
<template slot="label"> 支付时间</template>
|
||
{{ orderInfoData.payTime }}
|
||
</el-descriptions-item>
|
||
|
||
<el-descriptions-item>
|
||
<template slot="label"> 订单状态</template>
|
||
<!-- <div v-for="item in orderStateOptions" :key="item.key" v-if="item.key==orderInfoData.orderStateMix">
|
||
{{ item.value }}
|
||
</div> -->
|
||
</el-descriptions-item>
|
||
<el-descriptions-item>
|
||
<template slot="label"> 流水号</template>
|
||
{{ orderInfoData.mealCode }}
|
||
</el-descriptions-item>
|
||
<el-descriptions-item>
|
||
<template slot="label"> 备注</template>
|
||
{{ orderInfoData.remark }}
|
||
</el-descriptions-item>
|
||
</el-descriptions>
|
||
<div style="margin: 10px 0;font-weight: bold;font-size: 16px;color: #000;">商品信息</div>
|
||
<el-table :data="orderInfoData.orderDetailList">
|
||
<el-table-column label="商品名称" align="center" prop="goodsDishesName" :show-overflow-tooltip="true"/>
|
||
<el-table-column label="单价(元)" align="center" prop="prefPrice" :show-overflow-tooltip="true">
|
||
<template slot-scope="scope">
|
||
<span>{{ (scope.row.prefPrice/100).toFixed(2) }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="数量" align="center" prop="quantity" :show-overflow-tooltip="true"/>
|
||
<el-table-column label="合计(元)" align="center" prop="totalAmount" :show-overflow-tooltip="true">
|
||
<template slot-scope="scope">
|
||
<span>{{ (scope.row.totalAmount/100).toFixed(2) }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="退款数量" align="center" prop="goodsRefundNum" :show-overflow-tooltip="true"/>
|
||
<el-table-column label="退款金额(元)" align="center" prop="refundAmount" :show-overflow-tooltip="true">
|
||
<template slot-scope="scope">
|
||
<span>{{ (scope.row.refundAmount/100).toFixed(2) }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
</div>
|
||
<div slot="footer" class="dialog-footer">
|
||
<el-button type="primary" @click="open=false">确 定</el-button>
|
||
<el-button @click="open=false">取 消</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
|
||
|
||
<!-- 部分退款对话框 -->
|
||
<el-dialog title="部分退款" :visible.sync="openPart" width="80%" append-to-body>
|
||
<el-table :data="orderDetailList">
|
||
<el-table-column label="商品名称" align="center" prop="goodsDishesName" :show-overflow-tooltip="true"/>
|
||
<el-table-column label="商品单价" align="center" prop="prefPrice" :show-overflow-tooltip="true">
|
||
<template slot-scope="scope">
|
||
<span>{{ (scope.row.prefPrice/100).toFixed(2) }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="商品数量" align="center" prop="quantity" :show-overflow-tooltip="true"/>
|
||
<el-table-column label="商品金额" align="center" prop="totalAmount" :show-overflow-tooltip="true">
|
||
<template slot-scope="scope">
|
||
<span>{{ (scope.row.totalAmount/100).toFixed(2) }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="可退款数量" align="center" prop="quantity" :show-overflow-tooltip="true"/>
|
||
<el-table-column label="已退款数量" align="center" prop="goodsRefundNum" :show-overflow-tooltip="true"/>
|
||
<el-table-column label="已退款金额" align="center" prop="refundAmount" :show-overflow-tooltip="true">
|
||
<template slot-scope="scope">
|
||
<span>{{ (scope.row.refundAmount/100).toFixed(2) }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="退款数量" align="center" prop="refundNum" :show-overflow-tooltip="true" width="100">
|
||
<template slot-scope="scope">
|
||
<el-input v-model="scope.row.refundNum" placeholder="退款数量" maxlength="20" clearable style="width: 100%" @change="inputNum(scope.row)" @input="(v)=>(scope.row.refundNum=v.replace(/[^\d]/g,''))"/>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="退款金额" align="center" prop="refundMoney" :show-overflow-tooltip="true" width="100">
|
||
<template slot-scope="scope">
|
||
<span>{{ (scope.row.refundMoney/100).toFixed(2) }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="是否退库存" align="center" prop="ifBackStore" :show-overflow-tooltip="true" width="100">
|
||
<template slot-scope="scope">
|
||
<el-switch
|
||
v-model="scope.row.ifBackStore"
|
||
active-text="是"
|
||
inactive-text="否"
|
||
:active-value="1"
|
||
:inactive-value="2"
|
||
>
|
||
</el-switch>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="操作" align="center" width="100" class-name="small-padding fixed-width" fixed="right">
|
||
<template slot-scope="scope">
|
||
<el-button
|
||
size="mini" style="color: red;"
|
||
type="text"
|
||
@click="refundPartMoney(scope.row)"
|
||
>退款</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<div slot="footer" class="dialog-footer">
|
||
<el-button type="primary" @click="openPart=false">确 定</el-button>
|
||
<el-button @click="openPart=false">取 消</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
|
||
<!-- 提醒对话框 -->
|
||
<el-dialog :title="handleType+'提醒'" :visible.sync="openRemind" width="40%" append-to-body>
|
||
<div class="remind-question">请问是否对以下可{{handleType}}订单进行{{handleType}}操作?</div>
|
||
<div class="remind-title">可{{handleType}}订单 {{ableList.length}} 笔</div>
|
||
<div v-for="(item,index) in ableList" :key="item.orderId">{{ (index+1) }}. 订单编号:{{item.orderId}},用户姓名:{{item.nickName}},用户编号:{{item.userId}},订单金额:{{(item.payableAmount/100).toFixed(2)}}</div>
|
||
|
||
<div class="remind-title">不可{{handleType}}订单 {{unableList.length}} 笔</div>
|
||
<div v-for="(item,index) in unableList" :key="item.orderId">{{ (index+1) }}. 订单编号:{{item.orderId}},用户姓名:{{item.nickName}}:{{item.userId}},订单金额:{{(item.payableAmount/100).toFixed(2)}}</div>
|
||
|
||
<div slot="footer" class="dialog-footer">
|
||
<el-button type="primary" @click="confirmRemind" :disabled="ableList.length==0">确 定</el-button>
|
||
<el-button @click="openRemind=false">取 消</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import { deptTreeSelect } from '@/api/system/user'
|
||
import { systemAreaTreeApi,getCanteenByAreaApi } from "@/api/base/stall";
|
||
import { orderPageListApi,orderDetailInfoApi,refundOrderPartApi,refundOrderApi,writeOffOrderApi,syncOrderPayStateApi } from "@/api/superStore/superOrder";
|
||
export default {
|
||
name: "",
|
||
dicts: ['sys_user_type','sm_order_type','sm_order_status','sm_order_pay_type'],
|
||
data() {
|
||
return {
|
||
// 遮罩层
|
||
loading: true,
|
||
// 选中数组
|
||
ids: [],
|
||
// 非单个禁用
|
||
single: true,
|
||
// 非多个禁用
|
||
multiple: true,
|
||
// 显示搜索条件
|
||
showSearch: true,
|
||
// 总条数
|
||
total: 0,
|
||
//表格数据
|
||
tableListData: [],
|
||
// 是否显示弹出层
|
||
open: false,
|
||
dateRange:[new Date(),new Date()],
|
||
pickerOptions: {
|
||
shortcuts: [{
|
||
text: '最近一周',
|
||
onClick(picker) {
|
||
const start = new Date();
|
||
const end = new Date();
|
||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 6);
|
||
picker.$emit('pick', [start, end]);
|
||
}
|
||
},{
|
||
text: '最近一个月',
|
||
onClick(picker) {
|
||
const start = new Date();
|
||
const end = new Date();
|
||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
||
picker.$emit('pick', [start, end]);
|
||
}
|
||
},{
|
||
text: '最近三个月',
|
||
onClick(picker) {
|
||
const start = new Date();
|
||
const end = new Date();
|
||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 91);
|
||
picker.$emit('pick', [start, end]);
|
||
}
|
||
}]
|
||
},
|
||
treeAreaOptions:[],//区域树
|
||
supermarketOptions:[],//查询-超市下拉选
|
||
canteenOptions:[],//查询-食堂下拉选
|
||
stallOptions:[],//查询-档口下拉选
|
||
deptOptions:[],//组织树
|
||
//组织树
|
||
treeOrgOptions:[],
|
||
// 查询参数
|
||
queryParams: {
|
||
pageNum: 1,
|
||
pageSize: 10,
|
||
custSearchInfo: undefined,
|
||
orderId: undefined,
|
||
orderType:4,
|
||
areaId:null,
|
||
canteenId:null,
|
||
goodsSearchInfo: undefined
|
||
},
|
||
//订单详情
|
||
orderInfoData: {},
|
||
//部分退款
|
||
openPart:false,
|
||
orderDetailList:[],
|
||
rowData:{},
|
||
refundRules:{
|
||
refundMoney: [
|
||
{
|
||
required: true,
|
||
message: "本次退款金额不能为空",
|
||
trigger: "blur",
|
||
}
|
||
]
|
||
},
|
||
//批量操作
|
||
batchIds:[],//批量id
|
||
batchList:[],//批量数据数组
|
||
//批量核销批量退单提醒对话框
|
||
handleType:"退单",
|
||
ableList:[],
|
||
unableList:[],
|
||
openRemind:false,
|
||
};
|
||
},
|
||
created() {
|
||
this.getAreaTreeData();
|
||
this.getDeptTree();
|
||
this.getList()
|
||
},
|
||
methods: {
|
||
//区域树
|
||
getAreaTreeData() {
|
||
systemAreaTreeApi({}).then((response) => {
|
||
this.treeAreaOptions = response.data;
|
||
});
|
||
},
|
||
handleAreaChange(e){
|
||
let param= {
|
||
areaId:this.queryParams.areaId,
|
||
canteenType:2
|
||
}
|
||
getCanteenByAreaApi(param).then((response) => {
|
||
this.supermarketOptions=response.rows||[]
|
||
this.queryParams.canteenId = null
|
||
});
|
||
},
|
||
handleCanteenChange(e){
|
||
},
|
||
/** 查询部门下拉树结构 */
|
||
getDeptTree() {
|
||
deptTreeSelect().then((response) => {
|
||
this.deptOptions = this.filterTree(response.data)
|
||
})
|
||
},
|
||
filterTree(nodes) {
|
||
return nodes
|
||
.map((node) => {
|
||
if (node.children) {
|
||
node.children = this.filterTree(node.children)
|
||
}
|
||
return node
|
||
})
|
||
.filter((node) => node.status !== '1')
|
||
},
|
||
|
||
/** 搜索按钮操作 */
|
||
handleQuery() {
|
||
this.queryParams.pageNum = 1;
|
||
this.getList();
|
||
},
|
||
/** 重置按钮操作 */
|
||
resetQuery() {
|
||
this.dateRange = [new Date(),new Date()]
|
||
this.queryParams = {
|
||
pageNum: 1,
|
||
pageSize: 10,
|
||
custSearchInfo: undefined,
|
||
orderId: undefined,
|
||
orderType:4,
|
||
areaId:null,
|
||
canteenId:null,
|
||
goodsSearchInfo: undefined
|
||
}
|
||
this.resetForm("queryForm");
|
||
this.handleQuery();
|
||
},
|
||
/** 查询列表 */
|
||
getList() {
|
||
this.loading = true;
|
||
let param = {
|
||
...this.queryParams,
|
||
"startDate":this.formatDate(this.dateRange[0]),
|
||
"endDate":this.formatDate(this.dateRange[1])
|
||
}
|
||
orderPageListApi(param).then(response => {
|
||
this.tableListData = response.rows;
|
||
this.total = Number(response.total);
|
||
this.loading = false;
|
||
});
|
||
},
|
||
/** 修改按钮操作 */
|
||
handleView(row) {
|
||
// let param = {
|
||
// orderId:row.orderId
|
||
// }
|
||
// orderDetailInfoApi(param).then(response => {
|
||
// this.orderInfoData = response.data
|
||
// });
|
||
this.orderInfoData = Object.assign({}, row)
|
||
this.open = true;
|
||
},
|
||
/** 部分退款按钮操作 */
|
||
handleRefundPart(row) {
|
||
this.orderDetailList = row.orderDetailList;
|
||
this.rowData = row;
|
||
this.$set(this.rowData,"refundMoney","")
|
||
console.log(this.rowData)
|
||
this.orderDetailList.forEach((item,index)=>{
|
||
this.$set(this.orderDetailList[index],"refundNum",item.quantity)
|
||
this.$set(this.orderDetailList[index],"refundMoney",Number(item.quantity)*(item.prefPrice).toFixed(2))
|
||
})
|
||
this.openPart = true;
|
||
},
|
||
inputNum(row){
|
||
if(Number(row.refundNum)>row.quantity){
|
||
this.$modal.msgError("退款数量不能大于可退款数量!");
|
||
row.refundNum=row.quantity
|
||
}
|
||
row.refundMoney = Number(row.refundNum)*(row.prefPrice).toFixed(2)
|
||
},
|
||
refundPartMoney(){
|
||
|
||
},
|
||
confirmRefund(){
|
||
if(this.refundList.length==0){
|
||
this.$modal.msgError("请先勾选退款商品!");
|
||
}else{
|
||
console.log(this.refundList)
|
||
let param = {
|
||
detailRefundList:this.refundList,
|
||
orderId:this.rowData.orderId
|
||
}
|
||
refundOrderPartApi(param).then(response => {
|
||
if(response.data.resultCode==10000){
|
||
this.$modal.msgSuccess("退款成功");
|
||
}
|
||
this.getList()
|
||
this.openPart = false;
|
||
});
|
||
}
|
||
|
||
},
|
||
/** 退单按钮操作 */
|
||
handleRefund(row) {
|
||
let param = {
|
||
backType: 1,
|
||
macOrderId:row.macOrderId,
|
||
orderId:row.orderId
|
||
}
|
||
this.$modal.confirm('是否确认退单?').then(function() {
|
||
return refundOrderApi(param);
|
||
}).then(() => {
|
||
this.getList();
|
||
this.$modal.msgSuccess("退单成功");
|
||
}).catch(() => {});
|
||
},
|
||
/** 核销按钮操作 */
|
||
writeOffOrder(row) {
|
||
let param = {
|
||
orderId:row.orderId
|
||
}
|
||
this.$modal.confirm('是否确认核销?').then(function() {
|
||
return writeOffOrderApi(param);
|
||
}).then(() => {
|
||
this.getList();
|
||
this.$modal.msgSuccess("核销成功");
|
||
}).catch(() => {});
|
||
},
|
||
// ----订单批量操作------
|
||
handleOrderSelectionChange(selection){
|
||
this.batchIds = selection.map((item) => item.orderId)
|
||
this.batchList = selection;
|
||
this.single = selection.length !== 1
|
||
this.multiple = !selection.length
|
||
},
|
||
//批量退单
|
||
handleBatchRefund(){
|
||
this.handleType="退单"
|
||
this.ableList = []
|
||
this.unableList = []
|
||
this.batchList.forEach(item=>{
|
||
if(item.orderStateMix==1||item.orderStateMix==11){
|
||
this.ableList.push(item)
|
||
}else{
|
||
this.unableList.push(item)
|
||
}
|
||
})
|
||
this.openRemind = true
|
||
},
|
||
//批量核销
|
||
handleBatchWriteOff(){
|
||
this.handleType="核销"
|
||
this.ableList = []
|
||
this.unableList = []
|
||
this.batchList.forEach(item=>{
|
||
if(item.orderStateMix==1){
|
||
this.ableList.push(item)
|
||
}else{
|
||
this.unableList.push(item)
|
||
}
|
||
})
|
||
this.openRemind = true
|
||
},
|
||
confirmRemind(){
|
||
console.log(this.ableList.length)
|
||
if(this.ableList.length>0){
|
||
if(this.handleType=="退单"){
|
||
this.ableList.forEach(item=>{
|
||
let param = {
|
||
backType: 1,
|
||
macOrderId:item.macOrderId,
|
||
orderId:item.orderId
|
||
}
|
||
refundOrderApi(param).then(response => {
|
||
if(response.code!=200){
|
||
this.$modal.msgError(response.msg);
|
||
}
|
||
});
|
||
})
|
||
this.$modal.msgSuccess("退单成功");
|
||
}
|
||
if(this.handleType=="核销"){
|
||
this.ableList.forEach(item=>{
|
||
let param = {
|
||
orderId:item.orderId
|
||
}
|
||
writeOffOrderApi(param).then(response => {
|
||
if(response.code!=200){
|
||
this.$modal.msgError(response.msg);
|
||
}
|
||
});
|
||
})
|
||
this.$modal.msgSuccess("核销成功");
|
||
}
|
||
setTimeout(()=>{
|
||
this.getList()
|
||
this.$refs.multipleTable.clearSelection()
|
||
},1000)
|
||
}
|
||
},
|
||
//同步订单状态
|
||
handleSyncPayState(){
|
||
if(this.batchIds.length>0){
|
||
this.batchIds.forEach(item=>{
|
||
syncOrderPayStateApi({orderId:item}).then(response => {
|
||
if(response.code!=200){
|
||
this.$modal.msgError(response.msg);
|
||
}
|
||
});
|
||
})
|
||
this.$modal.msgSuccess("同步已完成");
|
||
this.getList()
|
||
this.$refs.multipleTable.clearSelection()
|
||
}else{
|
||
this.$modal.msgError("请先勾选订单数据!");
|
||
}
|
||
},
|
||
|
||
|
||
|
||
|
||
|
||
//日期
|
||
formatDate(date) {
|
||
// 格式化为 YYYY-MM-DD
|
||
const year = date.getFullYear();
|
||
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始
|
||
const day = String(date.getDate()).padStart(2, '0');
|
||
return `${year}-${month}-${day}`;
|
||
}
|
||
}
|
||
};
|
||
</script>
|
||
<style scoped>
|
||
.remind-question{
|
||
width: 100%;
|
||
height: 50px;
|
||
font-size: 22px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
.remind-title{
|
||
width: 100%;
|
||
height: 40px;
|
||
font-size: 16px;
|
||
font-weight: bold;
|
||
color: #000;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
</style>
|
||
|