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.
1131 lines
28 KiB
1131 lines
28 KiB
<style lang="less">
|
|
@import "@/styles/table-common.less";
|
|
@import "./courier.less";
|
|
</style>
|
|
<template>
|
|
<div class="search">
|
|
<Card>
|
|
<Row v-show="openSearch" @keydown.enter.native="handleSearch">
|
|
<Form ref="searchForm" :model="searchForm" inline :label-width="100">
|
|
<FormItem label="配送员名称" prop="workerName">
|
|
<Input type="text" v-model="searchForm.workerName" clearable placeholder="请输入配送员名称"
|
|
style="width: 200px" />
|
|
</FormItem>
|
|
<FormItem label="手机号" prop="mobile">
|
|
<Input type="text" v-model="searchForm.mobile" clearable placeholder="请输入手机号"
|
|
style="width: 200px" />
|
|
</FormItem>
|
|
<FormItem label="上线状态" prop="isOnLine">
|
|
<Select ref="lineStatusSelect" v-model="searchForm.isOnLine" clearable style="width:200px">
|
|
<Option v-for="(item, i) in dictDataLine" :key="i" :value="item.value">{{
|
|
item.title
|
|
}}</Option>
|
|
</Select>
|
|
</FormItem>
|
|
<FormItem label="是否接指派单" prop="getPushOrder">
|
|
<Select ref="pushOrderSelect" v-model="searchForm.getPushOrder" clearable style="width:210px">
|
|
<Option v-for="(item, i) in dictData" :key="i" :value="item.value">{{
|
|
item.title
|
|
}}</Option>
|
|
</Select>
|
|
</FormItem>
|
|
<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>
|
|
<Button type="primary" icon="ios-stats" @click="openOrderCountModal">查看配送单量</Button>
|
|
<Button type="warning" icon="ios-git-branch" style="margin-left: 8px" @click="openTransferOrderCountModal">查看中转单量</Button>
|
|
</div>
|
|
<div class="icons">
|
|
<Tooltip content="刷新" placement="top" transfer>
|
|
<Icon type="md-refresh" size="18" class="item" @click="getDataList" />
|
|
</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 :loading="loading" border :columns="colHidden" :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="searchForm.pageNum" :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>
|
|
<Modal title="查看评论" v-model="Visiable" :mask-closable="false" :scrollabele="true" :width="1200">
|
|
<logistics-address v-if="Visiable" ref="dialog"></logistics-address>
|
|
<div slot="footer" v-show=Visiable>
|
|
<Button type="text" @click="Visiable = false">关闭</Button>
|
|
</div>
|
|
</Modal>
|
|
<Modal title="接单规则" v-model="ruleVisible" :mask-closable="false" :width="1000">
|
|
<div class="rule-info">
|
|
<span>配送员:{{ ruleInfo.workerName || '-' }}</span>
|
|
<span>手机号:{{ ruleInfo.mobile || '-' }}</span>
|
|
<span>是否接指派:{{ formatPushOrder(ruleInfo.getPushOrder) }}</span>
|
|
<span>3楼以上额外费用:{{ ruleInfo.highFloorFee || 0 }} 元</span>
|
|
<span>送达地点:{{ formatDeliveryLocation(ruleInfo.deliveryLocation) }}</span>
|
|
</div>
|
|
<Table :loading="ruleLoading" border :columns="ruleColumns" :data="ruleData" :size="tableSize"></Table>
|
|
<div slot="footer">
|
|
<Button type="text" @click="ruleVisible = false">关闭</Button>
|
|
</div>
|
|
</Modal>
|
|
<Modal :title="orderCountTitle" v-model="orderCountVisible" :mask-closable="false" :width="800">
|
|
<Form inline :label-width="80">
|
|
<FormItem label="日期范围">
|
|
<DatePicker
|
|
:options="options"
|
|
clearable
|
|
v-model="orderCountSelectDate"
|
|
type="daterange"
|
|
format="yyyy-MM-dd"
|
|
placeholder="选择起始时间"
|
|
style="width: 240px"
|
|
@on-change="selectOrderCountDateRange"
|
|
></DatePicker>
|
|
</FormItem>
|
|
<FormItem>
|
|
<Button type="primary" icon="ios-search" @click="handleOrderCountSearch">搜索</Button>
|
|
<Button @click="handleOrderCountReset">重置</Button>
|
|
</FormItem>
|
|
</Form>
|
|
<Table
|
|
:loading="orderCountLoading"
|
|
border
|
|
:columns="orderCountColumns"
|
|
:data="orderCountData"
|
|
:size="tableSize"
|
|
></Table>
|
|
<Row type="flex" justify="end" class="page" style="margin-top: 12px">
|
|
<Page
|
|
:current="orderCountForm.pageNum"
|
|
:total="orderCountTotal"
|
|
:page-size="orderCountForm.pageSize"
|
|
@on-change="changeOrderCountPage"
|
|
@on-page-size-change="changeOrderCountPageSize"
|
|
:page-size-opts="[10, 20, 50]"
|
|
size="small"
|
|
show-total
|
|
show-elevator
|
|
show-sizer
|
|
></Page>
|
|
</Row>
|
|
<div slot="footer">
|
|
<Button type="text" @click="orderCountVisible = false">关闭</Button>
|
|
</div>
|
|
</Modal>
|
|
<withdraw-record-modal ref="withdrawRecordModal" :table-size="tableSize" />
|
|
<addEdit :data="form" :type="showType" v-model="showWorker" @on-submit="getDataList" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getWorkerListData,
|
|
enableWorker,
|
|
disableWorker,
|
|
deleteWorker,
|
|
offLineWorker,
|
|
onLineWorker,
|
|
setWorkerFullTime,
|
|
setWorkerTransferOrder,
|
|
getWorkerRelaPriceByWorkerId,
|
|
getWorkerDeliveryOrderCountPage,
|
|
getWorkerTransferDeliveryOrderCountPage,
|
|
} from "@/api/index";
|
|
import {
|
|
shortcuts
|
|
} from "@/libs/shortcuts";
|
|
// 模版导入文件表数据
|
|
import {
|
|
userColumns,
|
|
userData
|
|
} from "./importTemplate";
|
|
import "viewerjs/dist/viewer.css";
|
|
import Viewer from "viewerjs";
|
|
// 指定导出列数据
|
|
import {
|
|
exportColumn
|
|
} from "./exportColumn";
|
|
import excel from "@/libs/excel";
|
|
import addEdit from "./addEdit.vue";
|
|
import logisticsAddress from "@/views/app/business/courier/logisticsAddress.vue";
|
|
import withdrawRecordModal from "@/views/app/components/withdrawRecordModal.vue";
|
|
import dict from "@/views/my-components/hiver/dict";
|
|
export default {
|
|
name: "Courier",
|
|
components: {
|
|
addEdit,
|
|
dict,
|
|
logisticsAddress,
|
|
withdrawRecordModal
|
|
},
|
|
data() {
|
|
return {
|
|
tableSize: "default",
|
|
height: 510,
|
|
showWorker: false,
|
|
showType: "0",
|
|
openSearch: true,
|
|
openTip: true,
|
|
loading: true,
|
|
reading: false,
|
|
Visiable: false,
|
|
importLoading: false,
|
|
loadingExport: true,
|
|
ruleVisible: false,
|
|
ruleLoading: false,
|
|
orderCountVisible: false,
|
|
orderCountLoading: false,
|
|
orderCountMode: "delivery",
|
|
orderCountTitle: "查看配送单量",
|
|
orderCountSelectDate: null,
|
|
orderCountForm: {
|
|
regionId: JSON.parse(this.getStore("user")).departmentId,
|
|
startDate: "",
|
|
endDate: "",
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
},
|
|
orderCountData: [],
|
|
orderCountTotal: 0,
|
|
orderCountColumns: [
|
|
{
|
|
title: "排名",
|
|
width: 70,
|
|
align: "center",
|
|
render: (h, params) => {
|
|
const rank =
|
|
(this.orderCountForm.pageNum - 1) * this.orderCountForm.pageSize +
|
|
params.index +
|
|
1;
|
|
return h("span", rank);
|
|
},
|
|
},
|
|
{
|
|
title: "配送员名称",
|
|
key: "workerName",
|
|
minWidth: 140,
|
|
},
|
|
{
|
|
title: "手机号",
|
|
key: "mobile",
|
|
minWidth: 160,
|
|
},
|
|
{
|
|
title: "配送单量",
|
|
key: "orderCount",
|
|
minWidth: 120,
|
|
},
|
|
],
|
|
exportModalVisible: false,
|
|
importModalVisible: false,
|
|
drop: false,
|
|
dropDownIcon: "ios-arrow-down",
|
|
selectList: [],
|
|
dictDataLine: [{
|
|
title: "下线",
|
|
value: 0
|
|
}, {
|
|
title: "上线",
|
|
value: 1
|
|
}],
|
|
dictData: [{
|
|
title: "不接指派",
|
|
value: 0
|
|
}, {
|
|
title: "接指派",
|
|
value: 1
|
|
}],
|
|
searchForm: {
|
|
region:JSON.parse(this.getStore("user")).departmentId,
|
|
workerName:'',
|
|
mobile:'',
|
|
isOnLine:'', //0:下线;1:上线
|
|
getPushOrder:'', //0不接指派 1接收
|
|
pageNum: 1,
|
|
pageSize: 10
|
|
},
|
|
ruleInfo: {},
|
|
ruleData: [],
|
|
selectDate: null,
|
|
options: {
|
|
shortcuts: shortcuts,
|
|
},
|
|
form: {},
|
|
columns: [{
|
|
type: "selection",
|
|
width: 60,
|
|
align: "center",
|
|
fixed: "left",
|
|
},
|
|
{
|
|
type: "index",
|
|
width: 60,
|
|
align: "center",
|
|
fixed: "left",
|
|
},
|
|
{
|
|
title: "配送员名称",
|
|
key: "workerName",
|
|
minWidth: 125,
|
|
render: (h, params) => {
|
|
return h("div", [
|
|
h("div", params.row.workerName || "-"),
|
|
h("Tag", {
|
|
props: {
|
|
color: params.row.isFullTime == 1 ? "green" : "default",
|
|
},
|
|
style: {
|
|
marginTop: "4px",
|
|
},
|
|
}, params.row.isFullTime == 1 ? "全职配送员" : "非全职配送员"),
|
|
h("Tag", {
|
|
props: {
|
|
color: params.row.canTransferOrder == 1 ? "orange" : "default",
|
|
},
|
|
style: {
|
|
marginTop: "4px",
|
|
},
|
|
}, params.row.canTransferOrder == 1 ? "可接中转" : "不接中转"),
|
|
]);
|
|
},
|
|
},
|
|
{
|
|
title: "佣金余额(元)",
|
|
key: "depoBal",
|
|
minWidth: 145,
|
|
render: (h, params) => {
|
|
return h("div", [
|
|
h("div", "今日:" + this.formatAmount(params.row.depoBal)),
|
|
h("div", { style: { color: "#19be6b", marginTop: "4px" } }, "可提现:" + this.formatAmount(params.row.depoBalRel)),
|
|
]);
|
|
},
|
|
},
|
|
{
|
|
title: "联系方式",
|
|
key: "mobile",
|
|
minWidth: 125,
|
|
},
|
|
// {
|
|
// title: "接单区域",
|
|
// key: "regionTitle",
|
|
// minWidth: 125,
|
|
// },
|
|
// {
|
|
// title: "描述",
|
|
// key: "remark",
|
|
// minWidth: 125,
|
|
// },
|
|
{
|
|
title: "接单状态",
|
|
key: "workerStatus",
|
|
minWidth: 160,
|
|
render: (h, params) => {
|
|
let re = "",
|
|
color = "";
|
|
if (params.row.workerStatus == 1) {
|
|
re = "可抢单";
|
|
color = "blue";
|
|
} else if (params.row.workerStatus == 2) {
|
|
re = "不可接单";
|
|
color = "yellow";
|
|
} else if (params.row.workerStatus == 3) {
|
|
re = "已禁用";
|
|
color = "red";
|
|
}
|
|
return h("div", [
|
|
h(
|
|
"Tag", {
|
|
props: {
|
|
color: color,
|
|
},
|
|
},
|
|
re
|
|
),
|
|
]);
|
|
}
|
|
},
|
|
{
|
|
title: "上线状态",
|
|
key: "isOnLine",
|
|
minWidth: 160,
|
|
render: (h, params) => {
|
|
let re = "",
|
|
color = "";
|
|
if (params.row.isOnLine == 1) {
|
|
re = "上线";
|
|
color = "green";
|
|
} else if (params.row.isOnLine == 0) {
|
|
re = "下线";
|
|
color = "#D3D3D3";
|
|
}
|
|
return h("div", [
|
|
h(
|
|
"Tag", {
|
|
props: {
|
|
color: color,
|
|
},
|
|
},
|
|
re
|
|
),
|
|
]);
|
|
}
|
|
},
|
|
{
|
|
title: "学生/身份证",
|
|
key: "cardPicture",
|
|
width: 180,
|
|
render: (h, params) => {
|
|
|
|
return h("img", {
|
|
attrs: {
|
|
src: params.row.cardPicture,
|
|
},
|
|
style: {
|
|
cursor: "zoom-in",
|
|
width: "80px",
|
|
height: "60px",
|
|
margin: "10px 0",
|
|
"object-fit": "contain",
|
|
},
|
|
on: {
|
|
click: () => {
|
|
this.showPic(params.row.cardPicture);
|
|
},
|
|
},
|
|
});
|
|
},
|
|
},
|
|
{
|
|
title: "是否接指派",
|
|
key: "getPushOrder",
|
|
width: 180,
|
|
render: (h, params) => {
|
|
let re = ""
|
|
if (params.row.getPushOrder == 1) {
|
|
re = "接指派";
|
|
} else if (params.row.getPushOrder == 0) {
|
|
re = "不接";
|
|
}
|
|
return h("div", re);
|
|
}
|
|
},
|
|
{
|
|
title: "评分",
|
|
key: "score",
|
|
width: 180,
|
|
},
|
|
{
|
|
title: "平均时长(分钟)",
|
|
key: "avgTime",
|
|
width: 180,
|
|
},
|
|
{
|
|
title: "3楼以上额外费用(元)",
|
|
key: "highFloorFee",
|
|
width: 180,
|
|
},
|
|
{
|
|
title: "操作",
|
|
key: "action",
|
|
width: 470,
|
|
align: "center",
|
|
fixed: "right",
|
|
render: (h, params) => {
|
|
let enableOrDisable = "";
|
|
if (params.row.workerStatus == 3) {
|
|
enableOrDisable = h(
|
|
"a", {
|
|
on: {
|
|
click: () => {
|
|
this.enable(params.row);
|
|
},
|
|
},
|
|
},
|
|
"恢复"
|
|
);
|
|
} else {
|
|
enableOrDisable = h(
|
|
"a", {
|
|
on: {
|
|
click: () => {
|
|
this.disable(params.row);
|
|
},
|
|
},
|
|
},
|
|
"禁用"
|
|
);
|
|
}
|
|
let onOrOffLine = "";
|
|
if (params.row.workerStatus == 3) {
|
|
onOrOffLine = h(
|
|
"span",
|
|
{
|
|
style: {
|
|
color: "#c5c8ce",
|
|
},
|
|
},
|
|
"已禁用"
|
|
);
|
|
} else if (params.row.isOnLine == 1) {
|
|
onOrOffLine = h(
|
|
"a", {
|
|
on: {
|
|
click: () => {
|
|
this.offLine(params.row);
|
|
},
|
|
},
|
|
},
|
|
"下线"
|
|
);
|
|
} else {
|
|
onOrOffLine = h(
|
|
"a", {
|
|
on: {
|
|
click: () => {
|
|
this.onLine(params.row);
|
|
},
|
|
},
|
|
},
|
|
"上线"
|
|
);
|
|
}
|
|
const fullTimeText = params.row.isFullTime == 1 ? "取消全职" : "设置全职";
|
|
const fullTimeAction = h(
|
|
"a", {
|
|
on: {
|
|
click: () => {
|
|
this.changeFullTime(params.row);
|
|
},
|
|
},
|
|
},
|
|
fullTimeText
|
|
);
|
|
const transferText = params.row.canTransferOrder == 1 ? "取消中转" : "设置中转";
|
|
const transferAction = h(
|
|
"a", {
|
|
on: {
|
|
click: () => {
|
|
this.changeTransferOrder(params.row);
|
|
},
|
|
},
|
|
},
|
|
transferText
|
|
);
|
|
return h("div", [
|
|
/* h(
|
|
"a", {
|
|
on: {
|
|
click: () => {
|
|
this.edit(params.row);
|
|
},
|
|
},
|
|
},
|
|
"编辑"
|
|
), */
|
|
h("Divider", {
|
|
props: {
|
|
type: "vertical",
|
|
},
|
|
}),
|
|
h(
|
|
"a", {
|
|
on: {
|
|
click: () => {
|
|
this.findAllRecord(params.row);
|
|
},
|
|
},
|
|
},
|
|
"查看评论"
|
|
),
|
|
h("Divider", {
|
|
props: {
|
|
type: "vertical",
|
|
},
|
|
}),
|
|
onOrOffLine,
|
|
h("Divider", {
|
|
props: {
|
|
type: "vertical",
|
|
},
|
|
}),
|
|
enableOrDisable,
|
|
h("Divider", {
|
|
props: {
|
|
type: "vertical",
|
|
},
|
|
}),
|
|
h(
|
|
"a", {
|
|
on: {
|
|
click: () => {
|
|
this.viewWorkerRules(params.row);
|
|
},
|
|
},
|
|
},
|
|
"接单规则"
|
|
),
|
|
h("Divider", {
|
|
props: {
|
|
type: "vertical",
|
|
},
|
|
}),
|
|
fullTimeAction,
|
|
h("Divider", {
|
|
props: {
|
|
type: "vertical",
|
|
},
|
|
}),
|
|
transferAction,
|
|
h("Divider", {
|
|
props: {
|
|
type: "vertical",
|
|
},
|
|
}),
|
|
h(
|
|
"a", {
|
|
on: {
|
|
click: () => {
|
|
this.openWithdrawRecords(params.row);
|
|
},
|
|
},
|
|
},
|
|
"提现记录"
|
|
),
|
|
]);
|
|
},
|
|
},
|
|
],
|
|
exportColumns: exportColumn,
|
|
ruleColumns: [
|
|
{
|
|
type: "index",
|
|
width: 60,
|
|
align: "center",
|
|
},
|
|
{
|
|
title: "接单类型",
|
|
key: "orderType",
|
|
minWidth: 100,
|
|
render: (h, params) => h("span", this.formatOrderType(params.row.orderType)),
|
|
},
|
|
{
|
|
title: "取货区域",
|
|
key: "getAreaName",
|
|
minWidth: 160,
|
|
},
|
|
{
|
|
title: "送货区域",
|
|
key: "putAreaName",
|
|
minWidth: 160,
|
|
},
|
|
{
|
|
title: "配送佣金(元)",
|
|
key: "orderBkge",
|
|
minWidth: 130,
|
|
},
|
|
{
|
|
title: "是否接指派",
|
|
key: "getPushOrder",
|
|
minWidth: 120,
|
|
render: (h, params) => h("span", this.formatPushOrder(params.row.getPushOrder)),
|
|
},
|
|
{
|
|
title: "备注",
|
|
key: "remark",
|
|
minWidth: 180,
|
|
},
|
|
],
|
|
chooseColumns: [],
|
|
filename: "配送员数据",
|
|
exportTitle: "确认导出",
|
|
exportType: "",
|
|
importTableData: [],
|
|
importColumns: [],
|
|
uploadfile: {
|
|
name: "",
|
|
},
|
|
tempColumns: userColumns,
|
|
tempData: userData,
|
|
data: [],
|
|
exportData: [],
|
|
total: 0,
|
|
};
|
|
},
|
|
methods: {
|
|
init() {
|
|
this.getDataList();
|
|
|
|
},
|
|
handleSelectDep(v) {
|
|
this.searchForm.departmentId = v;
|
|
},
|
|
changePage(v) {
|
|
this.searchForm.pageNum = v;
|
|
this.getDataList();
|
|
this.clearSelectAll();
|
|
},
|
|
changePageSize(v) {
|
|
this.searchForm.pageSize = v;
|
|
this.getDataList();
|
|
},
|
|
showPic(v) {
|
|
let image = new Image();
|
|
image.src = v;
|
|
let viewer = new Viewer(image, {
|
|
hidden: function() {
|
|
viewer.destroy();
|
|
},
|
|
});
|
|
viewer.show();
|
|
},
|
|
selectDateRange(v) {
|
|
if (v) {
|
|
this.searchForm.startDate = v[0];
|
|
this.searchForm.endDate = v[1];
|
|
}
|
|
},
|
|
changeTableSize(v) {
|
|
this.tableSize = v;
|
|
},
|
|
getDataList() {
|
|
// 多条件搜索用户列表
|
|
this.loading = true;
|
|
|
|
getWorkerListData(this.searchForm).then((res) => {
|
|
this.loading = false;
|
|
if (res.success) {
|
|
this.data = res.result.content;
|
|
this.total = res.result.totalElements;
|
|
if (this.data.length == 0 && this.searchForm.pageNum > 1) {
|
|
this.searchForm.pageNum -= 1;
|
|
this.getDataList();
|
|
}
|
|
}
|
|
});
|
|
},
|
|
findAllRecord(v) {
|
|
this.Visiable = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.dialog.initRecharge(v);
|
|
});
|
|
},
|
|
openWithdrawRecords(v) {
|
|
this.$refs.withdrawRecordModal.open(v, "worker");
|
|
},
|
|
formatToday() {
|
|
const d = new Date();
|
|
const m = d.getMonth() + 1;
|
|
const day = d.getDate();
|
|
return (
|
|
d.getFullYear() +
|
|
"-" +
|
|
(m < 10 ? "0" + m : m) +
|
|
"-" +
|
|
(day < 10 ? "0" + day : day)
|
|
);
|
|
},
|
|
openOrderCountModal() {
|
|
const today = this.formatToday();
|
|
this.orderCountMode = "delivery";
|
|
this.orderCountTitle = "查看配送单量";
|
|
this.orderCountVisible = true;
|
|
this.orderCountSelectDate = [today, today];
|
|
this.orderCountForm = {
|
|
regionId: JSON.parse(this.getStore("user")).departmentId,
|
|
startDate: today,
|
|
endDate: today,
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
};
|
|
this.getOrderCountList();
|
|
},
|
|
openTransferOrderCountModal() {
|
|
const today = this.formatToday();
|
|
this.orderCountMode = "transfer";
|
|
this.orderCountTitle = "查看中转单量";
|
|
this.orderCountVisible = true;
|
|
this.orderCountSelectDate = [today, today];
|
|
this.orderCountForm = {
|
|
regionId: JSON.parse(this.getStore("user")).departmentId,
|
|
startDate: today,
|
|
endDate: today,
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
};
|
|
this.getOrderCountList();
|
|
},
|
|
selectOrderCountDateRange(v) {
|
|
if (v && v[0] && v[1]) {
|
|
this.orderCountForm.startDate = v[0];
|
|
this.orderCountForm.endDate = v[1];
|
|
} else {
|
|
this.orderCountForm.startDate = "";
|
|
this.orderCountForm.endDate = "";
|
|
}
|
|
},
|
|
handleOrderCountSearch() {
|
|
this.orderCountForm.pageNum = 1;
|
|
this.getOrderCountList();
|
|
},
|
|
handleOrderCountReset() {
|
|
const today = this.formatToday();
|
|
this.orderCountSelectDate = [today, today];
|
|
this.orderCountForm.startDate = today;
|
|
this.orderCountForm.endDate = today;
|
|
this.orderCountForm.pageNum = 1;
|
|
this.orderCountForm.pageSize = 10;
|
|
this.getOrderCountList();
|
|
},
|
|
changeOrderCountPage(v) {
|
|
this.orderCountForm.pageNum = v;
|
|
this.getOrderCountList();
|
|
},
|
|
changeOrderCountPageSize(v) {
|
|
this.orderCountForm.pageSize = v;
|
|
this.orderCountForm.pageNum = 1;
|
|
this.getOrderCountList();
|
|
},
|
|
getOrderCountList() {
|
|
this.orderCountLoading = true;
|
|
const request = this.orderCountMode === "transfer"
|
|
? getWorkerTransferDeliveryOrderCountPage
|
|
: getWorkerDeliveryOrderCountPage;
|
|
request(this.orderCountForm)
|
|
.then((res) => {
|
|
this.orderCountLoading = false;
|
|
if (res.success) {
|
|
this.orderCountData = res.result.records || [];
|
|
this.orderCountTotal = res.result.total || 0;
|
|
if (this.orderCountData.length == 0 && this.orderCountForm.pageNum > 1) {
|
|
this.orderCountForm.pageNum -= 1;
|
|
this.getOrderCountList();
|
|
}
|
|
}
|
|
})
|
|
.catch(() => {
|
|
this.orderCountLoading = false;
|
|
});
|
|
},
|
|
handleSearch() {
|
|
this.searchForm.pageNum = 1;
|
|
this.searchForm.pageSize = 10;
|
|
this.getDataList();
|
|
},
|
|
handleReset() {
|
|
this.$refs.searchForm.resetFields();
|
|
this.searchForm.region = JSON.parse(this.getStore("user")).departmentId;
|
|
this.searchForm.pageNum = 1;
|
|
this.searchForm.pageSize = 10;
|
|
this.selectDate = null;
|
|
this.searchForm.startDate = "";
|
|
this.searchForm.endDate = "";
|
|
// 重新加载数据
|
|
this.getDataList();
|
|
},
|
|
changeSort(e) {
|
|
this.searchForm.sort = e.key;
|
|
this.searchForm.order = e.order;
|
|
if (e.order == "normal") {
|
|
this.searchForm.order = "";
|
|
}
|
|
this.getDataList();
|
|
},
|
|
exportCustomData() {
|
|
if (this.filename == "") {
|
|
this.filename = "用户数据";
|
|
}
|
|
// 判断勾选导出列
|
|
let exportColumns = [];
|
|
this.exportColumns.forEach((e) => {
|
|
this.chooseColumns.forEach((c) => {
|
|
if (e.title == c && !e.disabled) {
|
|
exportColumns.push(e);
|
|
}
|
|
});
|
|
});
|
|
this.exportModalVisible = false;
|
|
let title = [];
|
|
let key = [];
|
|
exportColumns.forEach((e) => {
|
|
title.push(e.title);
|
|
key.push(e.key);
|
|
});
|
|
const params = {
|
|
title: title,
|
|
key: key,
|
|
data: this.exportData,
|
|
autoWidth: true,
|
|
filename: this.filename,
|
|
};
|
|
excel.export_array_to_excel(params);
|
|
},
|
|
|
|
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.form = data;
|
|
this.showType = "0";
|
|
this.showWorker = true;
|
|
},
|
|
add() {
|
|
this.showType = "2";
|
|
this.showWorker = true;
|
|
},
|
|
edit(v) {
|
|
let str = JSON.stringify(v);
|
|
let data = JSON.parse(str);
|
|
this.form = data;
|
|
this.showType = "1";
|
|
this.showWorker = true;
|
|
},
|
|
viewWorkerRules(v) {
|
|
this.ruleVisible = true;
|
|
this.ruleLoading = true;
|
|
this.ruleInfo = {};
|
|
this.ruleData = [];
|
|
getWorkerRelaPriceByWorkerId({
|
|
workerId: v.workerId
|
|
}).then((res) => {
|
|
this.ruleLoading = false;
|
|
if (res.success) {
|
|
this.ruleInfo = res.result || {};
|
|
this.ruleData = this.ruleInfo.workerRelaPriceList || [];
|
|
}
|
|
});
|
|
},
|
|
formatOrderType(v) {
|
|
if (v == 0) {
|
|
return "外卖";
|
|
}
|
|
if (v == 1) {
|
|
return "快递";
|
|
}
|
|
return "-";
|
|
},
|
|
formatPushOrder(v) {
|
|
if (v == 1) {
|
|
return "接指派";
|
|
}
|
|
if (v == 0) {
|
|
return "不接";
|
|
}
|
|
return "-";
|
|
},
|
|
formatDeliveryLocation(v) {
|
|
if (v == 0) {
|
|
return "送上楼";
|
|
}
|
|
if (v == 1) {
|
|
return "送到宿舍门口";
|
|
}
|
|
return "-";
|
|
},
|
|
formatAmount(v) {
|
|
const number = Number(v);
|
|
return isNaN(number) ? "0.00" : number.toFixed(2);
|
|
},
|
|
enable(v) {
|
|
this.$Modal.confirm({
|
|
title: "确认恢复",
|
|
content: "您确认要恢复配送员 " + v.workerName + " ?",
|
|
loading: true,
|
|
onOk: () => {
|
|
enableWorker(v.workerId).then((res) => {
|
|
this.$Modal.remove();
|
|
if (res.success) {
|
|
this.$Message.success("操作成功");
|
|
this.getDataList();
|
|
}
|
|
});
|
|
},
|
|
});
|
|
},
|
|
disable(v) {
|
|
this.$Modal.confirm({
|
|
title: "确认禁用",
|
|
content: "您确认要禁用配送员 " + v.workerName + " ?",
|
|
loading: true,
|
|
onOk: () => {
|
|
disableWorker(v.workerId).then((res) => {
|
|
this.$Modal.remove();
|
|
if (res.success) {
|
|
this.$Message.success("操作成功");
|
|
this.getDataList();
|
|
}
|
|
});
|
|
},
|
|
});
|
|
},
|
|
offLine(v) {
|
|
this.$Modal.confirm({
|
|
title: "确认下线",
|
|
content: "您确认要使配送员 " + v.workerName + " 下线吗?",
|
|
loading: true,
|
|
onOk: () => {
|
|
offLineWorker({
|
|
id: v.workerId
|
|
}).then((res) => {
|
|
this.$Modal.remove();
|
|
if (res.success) {
|
|
this.$Message.success("操作成功");
|
|
this.getDataList();
|
|
}
|
|
});
|
|
},
|
|
});
|
|
},
|
|
onLine(v) {
|
|
this.$Modal.confirm({
|
|
title: "确认上线",
|
|
content: "您确认要使配送员 " + v.workerName + " 上线吗?",
|
|
loading: true,
|
|
onOk: () => {
|
|
onLineWorker({
|
|
id: v.workerId
|
|
}).then((res) => {
|
|
this.$Modal.remove();
|
|
if (res.success) {
|
|
this.$Message.success("操作成功");
|
|
this.getDataList();
|
|
}
|
|
});
|
|
},
|
|
});
|
|
},
|
|
changeFullTime(v) {
|
|
const isFullTime = v.isFullTime == 1 ? 0 : 1;
|
|
const actionText = isFullTime == 1 ? "设置为全职配送员" : "取消全职配送员";
|
|
this.$Modal.confirm({
|
|
title: actionText,
|
|
content: "您确认要将配送员 " + v.workerName + " " + actionText + "吗?",
|
|
loading: true,
|
|
onOk: () => {
|
|
setWorkerFullTime(v.workerId, {
|
|
isFullTime
|
|
}).then((res) => {
|
|
this.$Modal.remove();
|
|
if (res.success) {
|
|
this.$Message.success("操作成功");
|
|
this.getDataList();
|
|
}
|
|
});
|
|
},
|
|
});
|
|
},
|
|
changeTransferOrder(v) {
|
|
const canTransferOrder = v.canTransferOrder == 1 ? 0 : 1;
|
|
const actionText = canTransferOrder == 1 ? "设置为可接中转单" : "取消接中转单";
|
|
this.$Modal.confirm({
|
|
title: actionText,
|
|
content: "您确认要将配送员 " + v.workerName + " " + actionText + "吗?",
|
|
loading: true,
|
|
onOk: () => {
|
|
setWorkerTransferOrder(v.workerId, {
|
|
canTransferOrder
|
|
}).then((res) => {
|
|
this.$Modal.remove();
|
|
if (res.success) {
|
|
this.$Message.success("操作成功");
|
|
this.getDataList();
|
|
}
|
|
});
|
|
},
|
|
});
|
|
},
|
|
remove(v) {
|
|
this.$Modal.confirm({
|
|
title: "确认删除",
|
|
content: "您确认要删除配送员 " + v.workerId + " ?",
|
|
loading: true,
|
|
onOk: () => {
|
|
deleteWorker(v.workerId).then((res) => {
|
|
this.$Modal.remove();
|
|
if (res.success) {
|
|
this.clearSelectAll();
|
|
this.$Message.success("删除成功");
|
|
this.getDataList();
|
|
}
|
|
});
|
|
},
|
|
});
|
|
},
|
|
showSelect(e) {
|
|
this.exportData = e;
|
|
this.selectList = e;
|
|
},
|
|
clearSelectAll() {
|
|
this.$refs.table.selectAll(false);
|
|
},
|
|
delAll() {
|
|
if (this.selectList.length <= 0) {
|
|
this.$Message.warning("您还未选择要删除的数据");
|
|
return;
|
|
}
|
|
this.$Modal.confirm({
|
|
title: "确认删除",
|
|
content: "您确认要删除所选的 " + this.selectList.length + " 条数据?",
|
|
loading: true,
|
|
onOk: () => {
|
|
let ids = "";
|
|
this.selectList.forEach(function(e) {
|
|
ids += e.id + ",";
|
|
});
|
|
ids = ids.substring(0, ids.length - 1);
|
|
deleteWorker({
|
|
ids: ids
|
|
}).then((res) => {
|
|
this.$Modal.remove();
|
|
if (res.success) {
|
|
this.$Message.success("删除成功");
|
|
this.clearSelectAll();
|
|
this.getDataList();
|
|
}
|
|
});
|
|
},
|
|
});
|
|
},
|
|
},
|
|
computed: {
|
|
colHidden: function() {
|
|
return this.columns.filter(function(e) {
|
|
return !e.hidden;
|
|
})
|
|
}
|
|
},
|
|
mounted() {
|
|
this.init();
|
|
},
|
|
};
|
|
</script>
|